Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

gugucom

macrumors 68020
Original poster
May 21, 2009
2,136
2
Munich, Germany
1. What this is about

This is about the installation of AHCI drivers to SATA ports for Windows. AHCI drivers (Advanced Host Controller Interface klick -> http://de.wikipedia.org/wiki/Advanced_Host_Controller_Interface for Wiki) are advanced performance drivers for the SATA controller in your Mac Pro (ICH10R chips for Nehalem - ESB2 for all others). When you go to profiler in OS X and bring up ATA you will see that your disks will all be connected by AHCI protocols.

Windows natively uses legacy drivers instead of AHCI when you install it. It expects a BIOS command to select the AHCI mode. On a BIOS machine you simply use a software switch to select the configuration. On an EFI machine as the Mac, you have to manipulate the boot mechanism because the firmware has no user adjustable features. You actually edit your Master Boot Record (MBR) inside the GUID or MBR partition table with a terminal script. I will come to that later.

If you are making a fresh installation of Windows from the install disk you can pre load the AHCI drivers from the floppy facility (check the download link in section 3). In Vista and Win7 you do this from the installation window where you can format or partition drives. In XP you have to hit the F6 key in the beginning when XP starts to load from the optical disk.

This tutorial is based on the instructions from Ludachris at http://www.insanelymac.com/forum/index.php?showtopic=126089&hl= Many thanks to him.

The shell script for the MBR patch is made by Johnsock. http://www.insanelymac.com/forum/index.php?act=attach&type=post&id=49096 Also a big thank you to him.


2. Some potential traps to avoid

Some people like to use a unused ODD-SATA port for a Windows HDD or SSD. This is possible as soon as the AHCI driver is working. In order to make the AHCI installation you need to fit the Windows drive to a standard HDD port and make the installation according to section 5.

There is a bummer which may hit you if you already use a SW RAID in OS X with a pre 2009 machine. An OS X software RAID array prevents Windows from recognizing other SATA drives as internal. The installation program will tell you that you are installing to an external drive although you are setting your Windows drive properly up on one of the # 1-4 HDD bay.

To work around this problem you can physically remove the RAID disks and put them away for a moment . After installing Windows you can put the array back in and it will run without a problem again, so you need not be concerned to remove the array temporarily.

To substitute for your now missing array clone OS X to a single disk before you remove your array and when you have it taken out, fit that disk. Then you do your Windows installation stuff. When you are finished with Windows you remove the single disk and refit your array.

The 64-bit varieties of Vista and Win7 have 32-bit emulations installed which will allow you to run any 32-bit program. So they are much better to use. A word of warning to 2006 and 2007 Mac Pro owners. Your machines use a 32-bit EFI. It will not be able to read Windows install DVDs with multiple images like the anytime upgrade DVDs. The 32-bit EFI boot loader freezes when you try to load an install disk with multiple images. Known workaround at this time use Jowie's tweak or a similar method to make the file variables palatable to the EFI32 boot loader. https://forums.macrumors.com/posts/8513769/


3. Preparations

Download the Intel Matrix Storage Manager http://www.intel.com/support/chipsets/imsm/index.htm from this adress. If you run XP you also need the floppy disk facility that you find there. The executable we will need very much later when we are practically done changing the MP to AHCI but get hold of it for now.

Intel have reported that there was a Vista installation issue with their chips driver (Intel Matrixs storage) up to version 7.0. It is therefore recommended to use 8.8 now. Win7 is officially only supported by 8.9.

When you have made those downloads put the folder with the floppy facility on a USB stick or burn it on CD. If you are hell bent to use XP you will actually need floppies because XP will not let you use other means. Generally XP isn't desirable on a Mac Pro because it is only supported in 32-Bit and not in 64-Bit which will make most of your RAM (above 2 GB) memory useless.

Copy the zipped file with Johnsock's shell script which is attached to this posting to your OS X drive. You have to unzip it for use.

Next go to disk utility in OS X and make a list of the identifiers of your installed drives. You can right click the drive name or use the info button which tells you the internal name of each drive. If the drive is shown as disk2 note it with the extended code form that the shell script uses ( /dev/disk2 ). Make a paper record of that full name of the disk and make sure you copy exactly that code. You will need this later when you may have no access to disk utility and are doing some delicate terminal work. Finally at this point make a backup of your Windows installation if you care for it. You can use Winclone (free software) for the back up or at minimum set a restore point for Windows to get back to that version if you screw up the next step. Restore points can be set when you enter the program section where you find all the Windows internal backup and restore stuff.

There are reports that the MP3,1 model from 2008 cannot be put into AHCI mode normally. But some users succeeded by exchanging their optical drive from IDE to SATA or removing it completely before trying to boot Windows from the ODD-SATA ports. So it is recommended to take out any IDE drive.

4. A refresher about other drivers

When you have installed Windows load your Apple related drivers from the hybrid Leopard disk. All Leopard disks have a Bootcamp driver image on them which is acessible under Windows only. For 64-bit Windows you need to execute Bootcamp64.msi with admin rights. You find it in the drivers/apple folder on the leopard/SL disk. If it is not there you have a very old version and need to source those drivers somewhere from the internet. There are torrents and downloads from rapidshare available. Google Bootcamp 2.0.1 for that. In Win7 you have to apply the compatibility patch to Vista drivers before you can load the program. To get to compatibility mode right click the file and select the routine for compatibility. When you are done with the general Windows drivers and have installed all the Windows updates you will still need to activate the AHCI drivers for optimum performance. They will not be running at that stage.


5. This is the actual installation

5.1 Editing the registry

Now in case we use Vista or Seven we are going to edit the Windows registry as directed by Ludachris. This only needs to be done in Vista and Seven but not in XP because XP has no MS AHCI driver in the standard.

Vista 32/64 Windows7 32/64
- Run Regedit (from the command prompt)
- Navigate to "High Key Local Machine\System\CurrentControlSet\Services\msahci"
- edit the "Start" key and change the value from what it is to "0"
- this will tell Vista to check for AHCI on next boot and install the AHCI driver if it is in AHCI mode
- this installs the generic AHCI Microsoft driver and it is really a poor driver for your hardware and you will need the Intel ones to get full performance.

This does not yet activate the AHCI driver. If you have pre loaded the Intel driver during the Windows installation it will load a better Intel legacy driver instead of the slow IDE. You can shut down and restart Windows now.

5.2 Installing the driver

After this reboot comes the tricky part. We will force Windows to take an AHCI driver, which it normally rejects and we will patch the master boot record (MBR) of the drive that holds the Windows installation.

In Windows device manager go to IDE/ATA devices. 2006, 2007 and 2008 Mac Pros have one device for the SATA ports; so its no question which to use. 2009 machines have two separate devices for the ODD and the HDD ports. Select the 4 port HDD device for the AHCI updating. Click properties and update the legacy driver to either the Microsoft or the Intel AHCI driver. It doesn't really matter which one you use. This AHCI installation cannot be done in automatic driver search mode. You have to tell Windows to look in the IDE ATA controller category for them. To find the MS AHCI 1.0 driver in Vista and Seven go to the manufacturer selection and look for Standard. You will have to scroll down to find it. For XP you have to load the Intel driver from from the Intel manufacturer list. If you havn't pre loaded the Intel drivers you should now use the Floppy utility you downloaded. Load these files from USB floppy or USB stick by clicking the have disk option. For pre 2009 you need to select the ESB2 driver. For Nehalem use the ICH10R driver. After this you must not reboot into Windows until you have patched the MBR. Force Windows to take this driver even if it thinks it is incompatible. It actually is but we will soon take care of this with the patch.

5.3 Patching the MBR in OS X

The next step is executing Johnsock's script to patch your MBR. This patch is absolutely necessary for every Windows. Pay particular attention to patch the right disk!!! If you patch an OS X disk that holds no Windows you are in serious trouble. The wrong disk selection will screw up your disk count and nothing will work right from there.

In OS X open the terminal utility. Type "sudo" and a blank. Then drag the unzipped script shell file into the terminal with your mouse. Input your admin password and follow the dialogue.

For this you will need the disk codes that you have noted on paper. The program tries to find your Windows disk but you have to make sure it finds the right one. It often suggests a wrong disk. Be really carefull to insert the complete name for the disk!! In our example it was /dev/disk2 for the second disk. Just inserting the number like 2, 0 or 3 or disk3 or disk4 will not work.

When you are done with patching your MBR the program will confirm to you that you were successfull. You shut down OS X and restart Windows. If you have done the patch right and selected the right controller for your chipset Windows should now show SATA drives and get busy to find the real AHCI drivers for them. If you installed MS AHCI 1.0 you can now switch to the Intel driver without problems. If you got it wrong Windows will malfunction with a BSD on loading. You can use special load options to go back to the last known good configuration which you hopefully established by setting the restore point or you can restore Windows by Winclone. Start all over with the registry edit until you got it right.

5.4 Installing the Intel Matrix Storage Manager

To load the Intel Matrix storage driver you can now execute the Intel executable package which we downloaded. It will be accepted by your machine. If you try installing that package before the patch it will tell you that you are loading a wrong package for your machine. Restart Windows after the storage driver has completely installed. In Vista and Win7 you have to run the executable as administrator. Now you should be all set.


6. Trouble shooting

What to do if you patch the wrong drive? I happened to patch my OS X drive which was partitioned in three partitions of which one was NTFS. So the patch program thought I had a Windows on it. I did not check it and so I went ahead and patched it. It turned out to be real bad news because now as long as this drive is in the system I get BSD and the patch method does not work any more.

I went back to the thread at Insanelymac and Johnsock had left instruction how to recover the backup MBR. It is stored in USERS/Yourname/backup.mbr

Johnsock advised to run in terminal:

sudo fdisk -y -u -f ./path/to/backup.mbr /dev/rdisk0

But that command is designed for drives with one partition I guess. So I modified my command to:

sudo fdisk -y -u -f /Users/gugucom/backup.mbr /dev/rdisk0

That command worked for me.


Feel free to challenge everything I have written here. I have only limited experience and will like to discuss any questions you have as good as I can. I tought the issue deserves its own thread so that we can collect the wisdom of all users here.
 

Attachments

  • ahci-1.sh.zip
    1.9 KB · Views: 10,069

gugucom

macrumors 68020
Original poster
May 21, 2009
2,136
2
Munich, Germany
I had to find out about the AHCI driver in order to run my Blu-Ray ROM from the ODD-SATA ports. I never tried to boot from there but I guess you will have to fit the AHCI driver to do in Windows.
 

SilverL

macrumors member
Jan 14, 2008
90
0
Got so frustrated with trying to get it working on my 2008 MacPro a while back, I just abandoned it since all I wanted was BluRay playback.

Enter PS3 :)
 

gugucom

macrumors 68020
Original poster
May 21, 2009
2,136
2
Munich, Germany
Got so frustrated with trying to get it working on my 2008 MacPro a while back, I just abandoned it since all I wanted was BluRay playback.

Enter PS3 :)

I really had to do it several times to write a half decent tutorial. There were several really bad descriptions in the first version. Sorry for that....

I even got it figured out for my MacBook Pro. On that I can only run MSAHCI 1.0 but it is way better than the legacy. Perhaps I will find the NVIDIA AHCI driver for my uMBP.
 

SilverL

macrumors member
Jan 14, 2008
90
0
I really had to do it several times to write a half decent tutorial. There were several really bad descriptions in the first version. Sorry for that....

I even got it figured out for my MacBook Pro. On that I can only run MSAHCI 1.0 but it is way better than the legacy. Perhaps I will find the NVIDIA AHCI driver for my uMBP.

No worries man, thanks for providing the information.
I'll probably give it another shot once I install Windows 7 on an external drive soon....
 

gugucom

macrumors 68020
Original poster
May 21, 2009
2,136
2
Munich, Germany
No worries man, thanks for providing the information.
I'll probably give it another shot once I install Windows 7 on an external drive soon....

Be advised that Intel released the version 8.9 for Win7. The other versions officially do not support Win7.

Versions under 8 do not support Vista.
 

inur

macrumors newbie
Oct 19, 2009
1
0
Unibody MBP and AHCI

I really had to do it several times to write a half decent tutorial. There were several really bad descriptions in the first version. Sorry for that....

I even got it figured out for my MacBook Pro. On that I can only run MSAHCI 1.0 but it is way better than the legacy. Perhaps I will find the NVIDIA AHCI driver for my uMBP.

You got it working on your unibody MBP? - Really strange because I cannot. Modifing the MBR does not trigger the AHCI drivers to be installed, and I get BCD when trying manually. Do you have any additional info on how tho get AHCI on unibody MBP's ?
 

gugucom

macrumors 68020
Original poster
May 21, 2009
2,136
2
Munich, Germany
You got it working on your unibody MBP? - Really strange because I cannot. Modifing the MBR does not trigger the AHCI drivers to be installed, and I get BCD when trying manually. Do you have any additional info on how tho get AHCI on unibody MBP's ?

Actually the order of things is generally the other way round. You force an AHCI driver which would cause a BSD if you would start Windows unmodified. Then you do the MBR patch and this will make Windows start with the AHCI driver without a BDS.

I could never find a Nvidia chipset driver which has a similar function as the Intel driver but in Vista and Seven you do get the MSAHCI 1.0 driver which isn't too bad.
 

JPamplin

macrumors 6502
Mar 12, 2009
321
64
Nashville, TN
@Gugucom,

I've already installed and activated Win7 on a dedicated drive in Bay 4 of my MacPro4,1 - Win7 is running, but the hard disk seems slower than it should be. I'm running Win7 Pro 64-bit.

  1. Would the AHCI driver increase drive performance?
  2. Is it possible to install these drivers after Win7 is installed? I.E., change the driver in Device Manager? I don't want to have to reinstall Win7 and use another activation (I think they count them) if the answer to 1) is "not really."
  3. I've read about data loss with Intel's 8.9 driver set - anyone see this?

Any help would be very... helpful.
 

gugucom

macrumors 68020
Original poster
May 21, 2009
2,136
2
Munich, Germany
Would the AHCI driver increase drive performance?

I would say that it would do with 99,99% certainty.


Is it possible to install these drivers after Win7 is installed? I.E., change the driver in Device Manager? I don't want to have to reinstall Win7 and use another activation (I think they count them) if the answer to 1) is "not really."

You can install the AHCI driver at any stage of the Windows driver installation or updating process. That goes for XP and all 32 and 64-bit versions of Vista and Seven.

Just changing the driver in device manager will BSD your system on reboot. You need to mod the registry (Vista and 7 only) and patch the MBR in OS X with the terminal script.

Installing AHCI drivers has no impact on activation, unless you mess up and have no backup. Then you would have to start from scratch and activate. Even then activation should go without a hitch as the relevant hardware would be reported as identical. Having a Winclone or Windows internal backup makes much sense though. At minimum you need to set a restore point.

I've read about data loss with Intel's 8.9 driver set - anyone see this?

Actually Intel received reports of frequent drive failures under 8.9 and changed their recommendation to 8.8 for all older Windows systems. They still recommend 8.9 for Windows7 though.

I have Windows Vista and Seven running on 8.9 on HDD and SSD and had no problems.
 

Infrared

macrumors 68000
Mar 28, 2007
1,715
65
I've already installed and activated Win7 on a dedicated drive in Bay 4 of my MacPro4,1 - Win7 is running, but the hard disk seems slower than it should be. I'm running Win7 Pro 64-bit.

Bays 3 and 4 are reportedly problematic for the 2009 Mac Pros.

Could you try the drive in bay 1 or 2?
 

Infrared

macrumors 68000
Mar 28, 2007
1,715
65
Actually Intel received reports of frequent drive failures under 8.9 and changed their recommendation to 8.8 for all older Windows systems. They still recommend 8.9 for Windows7 though.

Do you have a link, please?

I have Windows Vista and Seven running on 8.9 on HDD and SSD and had no problems.

Windows 7 x64 with 8.9 here and no obvious issues.
 

hms84

macrumors regular
Jul 28, 2007
114
0
One question,
Do I have to format my existing windows Vista??
This thing is really confusing me...... :confused:
 

gugucom

macrumors 68020
Original poster
May 21, 2009
2,136
2
Munich, Germany
No, but you better make a backup before you start the installation. I will divide the Posting up into sections and mark the actual installation section.
 

hms84

macrumors regular
Jul 28, 2007
114
0
So in simple words,

1- Registry, Restart.
2- Microsoft drivers autoload, after all drivers are set restart to Mac.
3- Do the patch, Restart to Windows.
4- Install intel drivers, then restart in Windows...

ALL SET ;)
 

gugucom

macrumors 68020
Original poster
May 21, 2009
2,136
2
Munich, Germany
So in simple words,

1- Registry, Restart.
2- Microsoft drivers autoload, after all drivers are set restart to Mac.
3- Do the patch, Restart to Windows.
4- Install intel drivers, then restart in Windows...

ALL SET ;)

Sure, but I have seen all kinds of experienced people struggle with this.
 

BeerdedOne

macrumors member
Oct 15, 2009
33
0
Awesome.. question

This is a great guide, thank you gugucom!

For those who have thought about this longer than I have, is it likely that this procedure could break something if MS updates ACHI driver support under Win 7 in the future? I haven't taken a look at the script but wonder what the MBR patch is doing, exactly..
 

gugucom

macrumors 68020
Original poster
May 21, 2009
2,136
2
Munich, Germany
For those who are interested in the background of Johnsock's patch I quote his original post from insanelymac.com
http://www.insanelymac.com/forum/index.php?showtopic=126089&st=40#
Remember that this describes an early rudimentary job which he later refined for various Windows versions with Ludachris. The method is based on an earlier program written by pipomolo42 for the GRUB boot loader.

1. Copy MBR from Windows disk:
- sudo dd if=/dev/disk3 of=./original.mbr bs=1 count=446
- make sure that you substitute the proper disk number where I have disk3 above!
- this will make a 446 byte file containing the boot code. Don't get the entire 512 byte sector because the other bytes contain your partition table. If you jack up the partition table you won't be able to boot Windows.
2. I used the DOS DEBUG program to unassemble the boot code so that I could modify it. I'm not going to detail that process here, but I will be happy to elaborate in another post if anyone is interested. Long story short: there are only 3 unused bytes in the Vista boot code and the code for programming the configuration registers need 17 bytes. Fortunately, the boot code also contains text for some error messages: "Invalid partition table", "Error loading operating system", and "Missing operating system". These seemed a bit wordy for me, so I changed them to "Bad partition table", "Bad OS", and "No OS" respectively. This freed up a whopping 47 bytes that I could use for additional code.
3. This additional space needs to be contiguous so I moved my newly modified text to the end of the MBR code and then modified the pointers used in the boot program so that it could still find them. This put some empty space in-between the actual boot program and the error message text.
4. After examining the original MBR boot code I decided that the best place to put the AHCI configuration code was at the beginning, before jumping into the standard boot program. This meant I had to move the entire program down 47 bytes, placing the empty bytes at the beginning of the file. This required changing a few pointers in the original code so it would still run properly, but I got it working with a minimal effort.
5. I then put the code for AHCI configuration at the start of the MBR file and filled in the rest of the space with 0x90 (NOP opcode for you assembly language programmers) so that it would run my code at the beginning and then continue right on with the standard boot code afterwards.
6. Then, I wrote the modified MBR to the disk:
- sudo fdisk -u -f ahci.mbr /dev/rdisk3
- again, make sure you use the correct disk where I have rdisk3 above
- Also, you have to use rdisk instead of disk so that fdisk can access the RAW drive
7. After that I was able to reboot into Vista using AHCI mode

Credit goes to pipomolo42 for the original AHCI configuration modification for GRUB. The code I used was blatantly taken from his GRUB patch file although I did verify it against the 631xESB/632xESB I/O Controller Hub Datasheet and I understand how and why it works now.
Also, I must give mad props to the guys at twocanoes, authors of the awesome Winclone utility for the methods used for reading and writing the MBR from within OS X.

I think that this method is very likely to be unaffected by any changes MS makes in the near future. It covers Win systems spanning six or seven years and works on all of them.
 

BeerdedOne

macrumors member
Oct 15, 2009
33
0
Will Intel ACHI mod kill 7's support for TRIM in SSDs?

I'm exploring my options for SSD with TRIM implementation in Win 7, and I just read this over at the Anandtech forums, which gave me pause:

"There are significant limitations to TRIM at this point. The instruction only works in a supported OS (Windows 7 and some Linux builds) and only with supported drivers. Under Windows 7 that means you have to use a Microsoft made IDE or AHCI driver (you can't install chipset drivers from anyone else)."

At face value, this would indicate that Win 7 dual booters are going to lose support for TRIM if they replace the MS drivers with Intel's, right? Crap.

Then again, from gugucom's description of the legacy drivers installed on Mac Pro systems by Windows 7, I wonder if TRIM support is present at all?
 

gugucom

macrumors 68020
Original poster
May 21, 2009
2,136
2
Munich, Germany
I think the more important issue in Windows is the defragmentation option. If you have enabled defragmentation you will quickly damage your SSD because it is not designed to be defragged.

Windows SATA driver in Bootcamp standard is MS and not Intel. With TRIM and AHCI it means you can only use Vista and Win7 which come with an MS AHCI 1.0 driver in the standard. XP does not naturally have the AHCI driver. MS AHCI will be less performant than an Intel driver. But if TRIM gives you additional performance advantages it may be justified to use it. It is certainly not a problem to install.

Anand says that Intel are going to fix the issue with 32nm TRIM software expected to be released in the current quarter. That is one more reason to use the Intel 2nd Gen SSDs. They are superior even without TRIM and are max compatible with RAID cards.
 

BeerdedOne

macrumors member
Oct 15, 2009
33
0
Intel AHCI and SSD TRIM

Thanks for your reply gugucom, your point about defrag option is well taken. I just wanted to make sure that the current Intel drivers were indeed going to prevent OS passing TRIM commands to the Intel G2 SSDs.

Since this setup would be with Windows 7, an SSD for boot/applications and a large conventional drive for data storage, it looks like the choice is for TRIM or more efficient AHCI implementation from Intel, but not both (for now).
 

i7SSD

macrumors newbie
Oct 30, 2009
4
0
Just a bump but wondering if it would be possible to use windows xp ( whatever service pack revision you want ) in a virtual machine then do the following :

download and use nlite to slipstream the relevant drivers you want with the windows 7 installation disc and create a new windows 7 disc ( whether cd or dvd ) and then use the newly created disc to install windows 7

http://www.nliteos.com/
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.