Euclid1 Posted April 24, 2011 Share Posted April 24, 2011 >MV=0 This value is RO (read only) so you cannot write it. It's probably set to 1 for legacy controllers that do not support AHCI. >0x60 does switch to AHCI 0x60 does successfully change the controller to AHCI. I have verified this. It can also be verified using the RWEverything tool: http://jacky5488.myweb.hinet.net/ 1. Start Windows with IDE 2. Install the tool 3. Run the tool, select the IDE controller in the interface 4. Now go to the command line (in the tool) 5. And write the word 0x60 to 0x90 (check the help file for the command) The view then updates and you can see that the device id has changed and the mode as well. Also the reason that Windows cannot find the boot device (blue screen error 0x0007b) is a strong indication that it has changed to AHCI (otherwise it would find the boot device). I also did a CriticalDeviceDatabase injection into the Windows registry: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_8086&dev_1c03] "Service"="msahci" "ClassGUID"="{4d36e96a-e325-11ce-bfc1-08002be10318}" This tells Windows to use the msahci controller if it finds a new device with vendor/deviceid of the controller we have. But this didn't make a change either. Link to comment Share on other sites More sharing options...
ludacrisvp Posted April 24, 2011 Author Share Posted April 24, 2011 Is it possible that the windows generic ahci driver just doesnt support the sandbridge chipset, have you tried a forced driver install like we had to do for the windows xp change over to ahci? Link to comment Share on other sites More sharing options...
jacoch Posted April 24, 2011 Share Posted April 24, 2011 I tried. Booted Windows to repair and tried to give Intel drivers. It doesn't work. Link to comment Share on other sites More sharing options...
ludacrisvp Posted April 24, 2011 Author Share Posted April 24, 2011 From the inf file for the sandybridge drivers from intel show that it uses the same driver for both of the following device ids. [strings] INTEL="Intel" ;CougarPoint AHCI PCI\VEN_8086&DEV_1C02.DeviceDesc="Intel® 6 Series/C200 Series Chipset Family 6 Port SATA AHCI Controller - 1C02" PCI\VEN_8086&DEV_1C03.DeviceDesc="Intel® 6 Series/C200 Series Chipset Family 6 Port SATA AHCI Controller - 1C03" I would say that a forced driver install has the best chance of success. Link to comment Share on other sites More sharing options...
Euclid1 Posted April 24, 2011 Share Posted April 24, 2011 The msahci.sys is what the Intel inf "driver" tells Windows to use: cougahci.inf [iNTEL_HDC];CougarPoint AHCI %PCI\VEN_8086&DEV_1C02.DeviceDesc%=intelahci,PCI\VEN_8086&DEV_1C02 %PCI\VEN_8086&DEV_1C03.DeviceDesc%=intelahci,PCI\VEN_8086&DEV_1C03 [iNTEL_HDC.NTamd64] ;CougarPoint AHCI %PCI\VEN_8086&DEV_1C02.DeviceDesc%=intelahci,PCI\VEN_8086&DEV_1C02 %PCI\VEN_8086&DEV_1C03.DeviceDesc%=intelahci,PCI\VEN_8086&DEV_1C03 ;********************************************************** ; Intel AHCI Controller [intelahci] Include=mshdc.inf Needs=msahci_Inst [intelahci.Services] Include=mshdc.inf Needs=msahci_Inst.Services Link to comment Share on other sites More sharing options...
ludacrisvp Posted April 24, 2011 Author Share Posted April 24, 2011 The bsod is a good confirmation that the mode changed but incorrect drivers are in place. Link to comment Share on other sites More sharing options...
Euclid1 Posted April 24, 2011 Share Posted April 24, 2011 The drivers are 100% correct (see cougahci.inf). I also have another Sandy Bridge system here with the exact same controller (deviceid/revision) and it boots with the msahci.sys driver. I believe you have a pre 2011 MBP, can you run some simple tests? Basically what I need to know is: What registers change when the controller is manually switched from 0x20 to 0x40. This can be seen using the RWEverything tool: http://jacky5488.myweb.hinet.net/ The best would be if you can boot Windows with the IDE controller. Or alternatively, boot with a Ubuntu CD into Grub2 and read the pci registers with lspci and then change the controller to AHCI using setpci and read the pci registers out again. Please let me know if that would be possible and where I send/post the instructions for the tests? Thanks. Link to comment Share on other sites More sharing options...
ludacrisvp Posted April 24, 2011 Author Share Posted April 24, 2011 I had a MacBook pro 4,1 that was previous to the unibody MacBook pro. I returned it after 2 weeks due to screen warping into a smiley face. I got a real Mac pro 2008 instead. Both new from apple online and the Mac pro was cheaper than the MacBook pro 17" that I had. Link to comment Share on other sites More sharing options...
Euclid1 Posted April 24, 2011 Share Posted April 24, 2011 Last update is as following. - Installed Ubuntu 10.10 from the Live CD - Booted into Grub 1.98 (had to select Windows in the refi menu and not Linux) - Went to the command line "c" - setpci -d 8086:1c01 90.b=60 (Also verified that if this is not done, that IDE mode is used in Ubuntu) - Esc - Started Ubuntu Result - AHCI loads fine and this is what lspci shows: 00:1f.2 SATA controller: Intel Corporation Cougar Point 6 port SATA AHCI Controller (rev 05) (prog-if 01 [AHCI 1.0]) Subsystem: Intel Corporation Device 7270 Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+ Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0 Interrupt: pin B routed to IRQ 46 Region 0: I/O ports at 3148 Region 1: I/O ports at 315c Region 2: I/O ports at 3140 Region 3: I/O ports at 3158 Region 4: I/O ports at 3060 Region 5: Memory at 8fa00000 (32-bit, non-prefetchable) Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit- Address: fee1100c Data: 4199 Capabilities: [70] Power Management version 3 Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot+,D3cold-) Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME- Capabilities: [a8] SATA HBA v1.0 BAR4 Offset=00000004 Capabilities: [b0] PCI Advanced Features AFCap: TP+ FLR+ AFCtrl: FLR- AFStatus: TP- Kernel driver in use: ahci Kernel modules: ahci 00: 86 80 03 1c 07 04 b0 02 05 01 06 01 00 00 00 00 10: 49 31 00 00 5d 31 00 00 41 31 00 00 59 31 00 00 20: 61 30 00 00 00 00 a0 8f 00 00 00 00 86 80 70 72 30: 00 00 00 00 80 00 00 00 00 00 00 00 0b 02 00 00 40: 00 80 00 80 00 00 00 00 00 00 00 00 00 00 00 00 50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 70: 01 a8 03 40 08 00 00 00 00 00 00 00 00 00 00 00 80: 05 70 01 00 0c 10 e1 fe 99 41 00 00 00 00 00 00 90: 60 3a 05 85 83 01 00 3a 08 42 5c 01 00 00 00 00 a0: e0 00 00 00 39 0f 00 00 12 b0 10 00 48 00 00 00 b0: 13 00 06 03 00 00 00 00 00 00 00 00 00 00 00 00 c0: 00 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f0: 00 00 00 00 00 00 00 00 87 0f 05 08 00 00 00 00 Tried the same on Windows and BSOD as expected. So apparently the Linux kernel can handle everything without any problems. Next step is to compare the registers on a PC when BIOS is set to IDE and then switched to AHCI. Update 1 There does not seem to be anything unexpected in the PCI registers. I have created a compilation of all dumps I have collected from MBP 2011 and Dell XPS 17x2: https://www.rapidshare.com/#!download|4...umps.rar|72.654 The readme.txt with a description is inside. Update 2 I have found some Intel (Intel® RST Driver Files) beta drivers for the "Intel® Mobile Express Chipset SATA AHCI Controller" controller (non RAID) from here: http://www.station-drivers.com/page/intel%20raid.htm and manually installed them: - Device Manager - Update Drivers - Search for drivers on the computer, Have Disk - Selected iaAHCI.inf (the iaStor.inf is for the RAID controllers) - Select "Intel® Mobile Express Chipset SATA AHCI Controller" - Driver installs and reboots - In the Grub loader, set 90.b to 60 - Windows does not BSOD with 7b, so I think it actually finds a boot device - But when iaStore.sys continues, I get a BSOD DRIVER_IRQL_NOT_LESS_OR_EQUAL caused by iaStor.sys. I tried the following driver versions: 10.5.0.1022 10.5.0.1015 and the official WHQ ones from here: http://downloadcenter.intel.com/Detail_Des...p;DwnldID=19601 Update 3 Windows Vista/7 MBR to enable AHCI. Tested on MBP 2011 17". If you do not have the exact same hardware configuration as the MBP 2011 17" it probably won't work. https://www.rapidshare.com/#!download|4...edcode.bin|0.44 To patch the MBR: Copy the patchedcode.bin to a USB stick Boot with MacOSX Setup CD (or Ubuntu Live CD or anything else where you can write the MBR to the disk) In the first screen select your language, in the 2nd screen, open a Terminal through the menu at the top. Go to your USB stick: cd /Volumes/USBSTICKNAME IMPORTANT: Make a backup of your mbr first: dd if=/dev/disk0 of=backup.bin bs=512 count=1 Unmount all mapped drives from your disk0: umount /dev/disk0s1, umount /dev/disk0s2, etc. Write the new mbr: dd if=patchedcode.bin of=/dev/disk0 bs=440 count=1 Type: reboot now If for some reason it should not work for you, you can restore the MBR as following: dd if=backup.bin of=/dev/disk0 bs=440 count=1 It is assumed that you already have set the msahci service start type to 0 in the Windows operating system. I will post a detailed writeup later. Link to comment Share on other sites More sharing options...
jacoch Posted April 27, 2011 Share Posted April 27, 2011 GREAT JOB! Tried on my MBP 15" 2011. Works fine. How did you get this working MBR? EDIT I sometime get a BSOD (0x0000007B) when starting MBP with a second HD in place of super drive. With Intel drivers 10.1.0.1008. Will try beta drivers above to see if it fixes the problem. Link to comment Share on other sites More sharing options...
ilkevinli Posted April 27, 2011 Share Posted April 27, 2011 Thanks so much for posting this and for your time researching this. This method worked great on my 13" 2011 MacBook Pro i5. Last update is as following. - Installed Ubuntu 10.10 from the Live CD - Booted into Grub 1.98 (had to select Windows in the refi menu and not Linux) - Went to the command line "c" - setpci -d 8086:1c01 90.b=60 (Also verified that if this is not done, that IDE mode is used in Ubuntu) - Esc - Started Ubuntu Result - AHCI loads fine and this is what lspci shows: Tried the same on Windows and BSOD as expected. So apparently the Linux kernel can handle everything without any problems. Next step is to compare the registers on a PC when BIOS is set to IDE and then switched to AHCI. Update 1 There does not seem to be anything unexpected in the PCI registers. I have created a compilation of all dumps I have collected from MBP 2011 and Dell XPS 17x2: https://www.rapidshare.com/#!download|4...umps.rar|72.654 The readme.txt with a description is inside. Update 2 I have found some Intel (Intel® RST Driver Files) beta drivers for the "Intel® Mobile Express Chipset SATA AHCI Controller" controller (non RAID) from here: http://www.station-drivers.com/page/intel%20raid.htm and manually installed them: - Device Manager - Update Drivers - Search for drivers on the computer, Have Disk - Selected iaAHCI.inf (the iaStor.inf is for the RAID controllers) - Select "Intel® Mobile Express Chipset SATA AHCI Controller" - Driver installs and reboots - In the Grub loader, set 90.b to 60 - Windows does not BSOD with 7b, so I think it actually finds a boot device - But when iaStore.sys continues, I get a BSOD DRIVER_IRQL_NOT_LESS_OR_EQUAL caused by iaStor.sys. I tried the following driver versions: 10.5.0.1022 10.5.0.1015 and the official WHQ ones from here: http://downloadcenter.intel.com/Detail_Des...p;DwnldID=19601 Update 3 Windows Vista/7 MBR to enable AHCI. Tested on MBP 2011 17". If you do not have the exact same hardware configuration as the MBP 2011 17" it probably won't work. https://www.rapidshare.com/#!download|4...edcode.bin|0.44 To patch the MBR: Copy the patchedcode.bin to a USB stick Boot with MacOSX Setup CD (or Ubuntu Live CD or anything else where you can write the MBR to the disk) In the first screen select your language, in the 2nd screen, open a Terminal through the menu at the top. Go to your USB stick: cd /Volumes/USBSTICKNAME IMPORTANT: Make a backup of your mbr first: dd if=/dev/disk0 of=backup.bin bs=512 count=1 Unmount all mapped drives from your disk0: umount /dev/disk0s1, umount /dev/disk0s2, etc. Write the new mbr: dd if=patchedcode.bin of=/dev/disk0 bs=440 count=1 Type: reboot now If for some reason it should not work for you, you can restore the MBR as following: dd if=backup.bin of=/dev/disk0 bs=440 count=1 It is assumed that you already have set the msahci service start type to 0 in the Windows operating system. I will post a detailed writeup later. Link to comment Share on other sites More sharing options...
Ruben van der Zwan Posted April 28, 2011 Share Posted April 28, 2011 Works great over here also! MacBook Pro 2011 14" Link to comment Share on other sites More sharing options...
Shade69 Posted April 28, 2011 Share Posted April 28, 2011 Thanks for your hard working ! (ludascrisvp & Euclid1) I follow this thread since March. Works perfectly on a MacbookPro 2011" 15 Corei7 (6750M) (Win7 / GUID Partition - Winclone) I use the Apple SSD 120GO in the superdrive bay for bootcamp. Euclid1, what's the difference between previous MBR registry code and now ? (For personal g33k knowledge) Link to comment Share on other sites More sharing options...
ilkevinli Posted April 28, 2011 Share Posted April 28, 2011 Theres a 14" MacBook Pro ?? Works great over here also! MacBook Pro 2011 14" Link to comment Share on other sites More sharing options...
ludacrisvp Posted April 28, 2011 Author Share Posted April 28, 2011 Nice! I am happy to finally see that you were able to figure it out. Like Shade69 mentioned, what was different between the original method and what worked? Was it simply using the new drivers you found? Link to comment Share on other sites More sharing options...
Ruben van der Zwan Posted April 28, 2011 Share Posted April 28, 2011 Theres a 14" MacBook Pro ?? Hmm, small keys on a 13"? let's keep it at a typo Link to comment Share on other sites More sharing options...
jacoch Posted April 28, 2011 Share Posted April 28, 2011 Nice! I am happy to finally see that you were able to figure it out. Like Shade69 mentioned, what was different between the original method and what worked? Was it simply using the new drivers you found? Not really. As mentionned above, I first tried with official Intel drivers. And it worked fine (if super drive is in its slot). So he changed something in modified MBR. Regarding drivers, with beta ones, I don't get BSOD anymore when a HD is installed in place of super drive. Link to comment Share on other sites More sharing options...
Euclid1 Posted April 28, 2011 Share Posted April 28, 2011 The ABAR address needs to be set as well. The trick was to find a correct address. The setpci commands are as following: setpci -d 8086:1c01 90.b=60 setpci -d 8086:1c03 24.l=8fa00000 This is basically what the MBR patch does. I moved the code to a different place than the original patch. The original patch had the code running multiple times. This was most likely not desired. Now the code runs right after the A20 initialization and before the TPM init. ;------- A20 init --------- ... seg000:00E2 loc_E2: ; CODE XREF: seg000:00C9j seg000:00E2 jmp loc_163 seg000:00E5; --------------------------------------------------------------------------- seg000:00E5 ; ------- TPM init--------- ; .... ; and this is contoller setup seg000:0163 loc_163: ; CODE XREF: seg000:loc_E2j seg000:0163 mov eax, 8000FA90h seg000:0169 mov dx, 0CF8h seg000:016C out dx, eax seg000:016E mov ax, 60h; '`' seg000:0171 mov dx, 0CFCh seg000:0174 out dx, ax seg000:0175 mov eax, 8000FA24h seg000:017B mov dx, 0CF8h seg000:017E out dx, eax seg000:0180 mov eax, 8FA00000h seg000:0186 mov dx, 0CFCh seg000:0189 out dx, eax seg000:018B mov ax, 0BB00h seg000:018E jmp loc_E5 Link to comment Share on other sites More sharing options...
gabiz_ro Posted April 28, 2011 Share Posted April 28, 2011 Was not enough only to switch controller to AHCI by rewriting offset 90h with 60 value. There is need also to set ABAR so chipset can have memory space. After switching from IDE to AHCI chipset registers was left set to I/O ports and needed to be rewrite offset 24h to set base address for memory space. posted at same time Bad new is that if Apple really don't want you tu use it on AHCI on next update that memory mapped region could be allocated to something else ,that will result in error. But since Euclid1 know that linux can start in AHCI and alocate itself what free region find,then patch can be readjusted. Link to comment Share on other sites More sharing options...
Euclid1 Posted April 28, 2011 Share Posted April 28, 2011 But since Euclid1 know that linux can start in AHCI and alocate itself what free region find,then patch can be readjusted. Correct. I figured out that Ubuntu 10.10 (BIOS mode) was able to use the AHCI controller even though the ABAR (BAR5) was not correct. So my guess is that the Linux kernel automatically fixes the problem by setting the BAR5 to a free region. If the PCI configuration changes (maybe due to a firmware upgrade in the future) a new ABAR address needs to be found by booting into GRUB to switch the controller to AHCI and then continuing with a Linux kernel. And then the base address can be extracted from a linux terminal with: setpci -d 8086:1c03 24.l Link to comment Share on other sites More sharing options...
ludacrisvp Posted April 28, 2011 Author Share Posted April 28, 2011 Have you contacted johnsock about getting this added into the GUI application that runs in osx to mod the mbr easier? Link to comment Share on other sites More sharing options...
Euclid1 Posted April 29, 2011 Share Posted April 29, 2011 Have you contacted johnsock about getting this added into the GUI application that runs in osx to mod the mbr easier? I tried to contact him before but never heard anything back. But he is free to use/incorporate the new MBR patch in/into his tool. Link to comment Share on other sites More sharing options...
ludacrisvp Posted April 30, 2011 Author Share Posted April 30, 2011 How does your modded mbr compare to a normal one when viewing it as hex it seems that the first 350 bytes or so seem to be like any other mbr but about the last 80 or so bytes (up to the 440 mark) seem to be different the script is setup to write hex string to mbr so it's as simple as modifying the hex string from the script to match what changes you have made. I'm not sure how to make changes to his app right bow but the script is easy enough to change. Link to comment Share on other sites More sharing options...
Shade69 Posted April 30, 2011 Share Posted April 30, 2011 I found a critical bug with this parallel desktop 6 (VM = use the Bootcamp partition mode) and the patch. It seems that Parallel modify at the beginning the mbr for his own ahci activation. So if you want to use at least the win7 partition you've to re-apply the patch everytime you use Parallel... Euclid1 do you know if the problem could be fixed? Thanks. Link to comment Share on other sites More sharing options...
ludacrisvp Posted May 1, 2011 Author Share Posted May 1, 2011 Chances are the only fix there would be to modify parallels to not write anything to the mbr or make it write the new code instead. You might also consider switching over to vmware fusion instead and see if they cause the same issue. I'm personally a fan of vmware. Edit: updated first post with directions for euclid1's mbr patch. Link to comment Share on other sites More sharing options...
Recommended Posts