Enabling AHCI in legacy (BIOS) OS on a Mac Pro 

The Mac Pro is a really nice workstation, which comes with the really nice EFI instead of BIOS.

EFI needs an adaptation layer (the Compatibility Support Module, or CSM) that emulates the BIOS, to be able to boot legacy OS, like Microsoft ones, or any GNU/Linux distribution without EFI support (which is nearly all of them, afaik).

Unfortunately, the CSM provided by apple does not contain an AHCI OpRom, and has to put the disk controller into IDE mode, instead of using the (also really nice) AHCI mode (whereas the controller's default mode is AHCI, and MacOSX uses this mode).

So far, Linux driver developers put the hack in the driver: when initialized, it puts back the controller to AHCI mode. But this does not work with other OS, so I had to put it at a lower level.

As Apple's EFI part of BootCamp is quite simple (just "chainloads" to a legacy bootloader), I decided to use the GNU GRUB to load legacy OS, and modified it to put back the controller in AHCI mode before any OS tries to load a driver for it.

Here is the patch, and here is a stage1 binary built from patched Grub 0.97 sources.

Please note that this is extremely ugly! As I didn't want to spend too much time on this, I decided to go the fastest way: adding the hack as x86 assembly in stage1. But as stage1 has a really strict size constraint (must fit in the first block), I had to remove some other hacks from it, to be able to add mine in.

UPDATE: This OnMac.net forum thread contains a bit more detailled information on how to set this up.

IMPORTANT UPDATE: The patch posted here contains a few mistakes (the binary has been updated, and includes fixes). For a fixed version of the patch, please read this blog entry.

Comments

Add Comment

Comments are not available for this entry.