More of the same?


Intel SATA chipsets and AHCI

Filed under: Hardware, Kernel — Tags: , , , , — _ds_ @ 23:49

I’ve been playing with Matthew Garrett’s AHCI patch¹ (and discussing it with him on IRC), and we now have a new patch which seems to work a bit better: it handles a few possible failures and situations in which the quirk shouldn’t be activated, and also handles resume (for ICH7M; others need to be added and tested).

To enable the quirk, you’ll need to boot with quirks.ich_force_ahci=1. If all is well, you’ll see at least the first two of these messages:

ICH AHCI quirk: SATA AHCI controller has device ID 8086:27c5
Quirked ICH SATA controller to AHCI mode
Your ICH SATA controller is in AHCI mode. PATA devices attached to it WILL be ignored.

Typically, the ignored devices will be DVD drives and, in netbooks, SSDs.

The italicised part may vary; that shown is the PCI ID for the ICH7 SATA AHCI controller. If your computer fails to resume properly with this quirk activated (give it a few minutes and the kernel will complain about stuck processes and a disk command time-out), but works fine without, then you should alter the number in the DECLARE_PCI_FIXUP_RESUME_EARLY line added by the patch and re-test.

¹ Well, a slightly newer version than is linked from there…



  1. Hello
    I’m interested about this.
    Can you help me?
    what this patch do,to reprogram pci register can you give me in asm code?

    Comment by Gabi — 2010-02-12 @ 22:27

    • objdump or gcc -S would do that.

      Comment by _ds_ — 2010-02-18 @ 15:46

  2. Hi,

    Can you re-write the ICH7M IDE->AHCI switching code using the DOS based setpci and pt commands using batch files (DIY ViDock bootdisk)? Seems a few ppl would like the script, then chainload into XP/Win7

    See for more info.


    Comment by nando — 2010-02-18 @ 03:43

    • No.

      This is the nearest that I can do:

      #! /bin/bash
      # locate the device
      DEV=$(lspci -n | grep '0101:' | cut -d' ' -f1)
      # sanity check
      if test "$(setpci -s $DEV 90.w)" != 40
      || test "$(setpci -s $DEV CLASS_PROG)" != 80
      || test "$(setpci -s $DEV CLASS_DEVICE)" != 011
      exit 1
      # set AHCI mode
      setpci -s $DEV 90.w=40
      # set the SCRAE bit
      SIR_WORD=0x$(setpci -s $DEV 0x94.l)
      setpci -s $DEV 94=$(printf %x $((SIR_WORD | 0x200)))
      # set the device type
      setpci -s $DEV CLASS_PROG=1 # 09.b=1
      setpci -s $DEV CLASS_DEVICE=6 # 0a.w=6

      (Windows? DOS? What are they?)

      Comment by _ds_ — 2010-02-18 @ 16:52

  3. I’m still experimenting.
    I try this in asm and a Sample code pci option rom

    mov eax,8000fa90h
    mov ebx,10150038h
    mov dx,0CF8h
    out dx,eax
    mov dx,0CFCh
    in eax,dx
    and eax,0FFFFFFFFh
    or eax,ebx
    out dx,eax
    but problem is offset 90 become 42 not 40 as expected.
    Normal offset values 90-93 -00150002
    Resulted offset value 90-93 -10150042

    Comment by Gabi — 2010-02-23 @ 00:03

  4. Normal offset values 90-93 -00150002
    Resulted offset value 90-93 -10150042

    offset 90 91 92 93
    40 XX XX XX shoud’t be here?

    Comment by SoMeBoDy777 — 2012-03-06 @ 20:22

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: