Skip to contentSkip to conversation

Enabling AHCI on ICH7 without BIOS support

DISCUSSION Jonathan Bastien-Filiatrault 4 participants 8 messages Aug 14, 2007 – Aug 19, 2007 libata

lore
Share & tools
lore
#0 lore raw

Hello,

I am the owner of a Dell Latitude D620 notebook with an ICH7 SATA controller, unfortunately, the BIOS does not offer the option of using "native mode" instead of "compatibility mode" when it comes to SATA. For now, the ata_piix runs happily in compatibility mode. Looking at the ICH7 docs, I found that poking register 0x90 in PCI configuration space with value 0x40 should enable AHCI. However, there are some issues with poking that register with setpci in an early initramfs:

- The kernel does not seem to update the device id from PCI config space, which changes with the controller mode (it would seem the PCI subsystem keeps a copy)

- Poking PCI registers from userspace is far from ideal

It would be great if the AHCI driver (or otherwise) had a "force_ich7_ahci" to properly setup and initialize this device in full "native" AHCI mode. This option would be greatly welcome from users like me who have a stupid bios (eh, who doesn't).

Thank you,

Jonathan

#1 lore raw

Hello,

Quoted 15 lines · Jonathan Bastien-Filiatrault

Hello,

I am the owner of a Dell Latitude D620 notebook with an ICH7 SATA controller, unfortunately, the BIOS does not offer the option of using "native mode" instead of "compatibility mode" when it comes to SATA. For now, the ata_piix runs happily in compatibility mode. Looking at the ICH7 docs, I found that poking register 0x90 in PCI configuration space with value 0x40 should enable AHCI. However, there are some issues with poking that register with setpci in an early initramfs:

- The kernel does not seem to update the device id from PCI config space, which changes with the controller mode (it would seem the PCI subsystem keeps a copy)

Quoted 7 lines

- Poking PCI registers from userspace is far from ideal

It would be great if the AHCI driver (or otherwise) had a "force_ich7_ahci" to properly setup and initialize this device in full "native" AHCI mode. This option would be greatly welcome from users like me who have a stupid bios (eh, who doesn't).

Sorry but most BIOSen don't map ABAR unless it supports AHCI and there usually isn't a hole to fit in ABAR afterwards unless the kernel completely reallocates IO resources, which, again unfortunately, can't be done reliably cuz machines can be quirky and might puke if addresses aren't laid out as their BIOSen would do.

So, you'll have to live with ata_piix.

Signature · 1 line
tejun
#2 lore raw
Quoted 28 lines · Tejun Heo

Hello,

Quoted 15 lines · Jonathan Bastien-Filiatrault

Hello,

I am the owner of a Dell Latitude D620 notebook with an ICH7 SATA controller, unfortunately, the BIOS does not offer the option of using "native mode" instead of "compatibility mode" when it comes to SATA. For now, the ata_piix runs happily in compatibility mode. Looking at the ICH7 docs, I found that poking register 0x90 in PCI configuration space with value 0x40 should enable AHCI. However, there are some issues with poking that register with setpci in an early initramfs:

- The kernel does not seem to update the device id from PCI config space, which changes with the controller mode (it would seem the PCI subsystem keeps a copy)

Quoted 8 lines

- Poking PCI registers from userspace is far from ideal

It would be great if the AHCI driver (or otherwise) had a "force_ich7_ahci" to properly setup and initialize this device in full "native" AHCI mode. This option would be greatly welcome from users like me who have a stupid bios (eh, who doesn't).

Quoted 9 lines

Sorry but most BIOSen don't map ABAR unless it supports AHCI and there usually isn't a hole to fit in ABAR afterwards unless the kernel completely reallocates IO resources, which, again unfortunately, can't be done reliably cuz machines can be quirky and might puke if addresses aren't laid out as their BIOSen would do.

So, you'll have to live with ata_piix.

So far, I have managed to patch up the AHCI driver to initialize the ICH7 AHCI state machine as the BIOS would do (as per the AHCI spec instructions). This involves mapping ABAR and such. So far, I have gotten the AHCI driver to detect the chip properly, but it does not detect any drives. It looks like I will need to further initialize the chip. I think there might be a chance of success, but it will involve manually specifying which ports are present via a module parameter.

Thank you,
Jonathan

#3 lore raw
Quoted 7 lines · Jonathan Bastien-Filiatrault

So far, I have managed to patch up the AHCI driver to initialize the ICH7 AHCI state machine as the BIOS would do (as per the AHCI spec instructions). This involves mapping ABAR and such. So far, I have gotten the AHCI driver to detect the chip properly, but it does not detect any drives. It looks like I will need to further initialize the chip. I think there might be a chance of success, but it will involve manually specifying which ports are present via a module parameter.

You probably need to program PCS.

Signature · 1 line
tejun
#4 lore raw
In reply to Jonathan Bastien-Filiatrault
Quoted 41 lines
Quoted 41 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

In <[email protected]>
Jonathan Bastien-Filiatrault <[email protected]> wrote:

Quoted 37 lines · Tejun Heo

Hello,

Quoted 15 lines · Jonathan Bastien-Filiatrault

Hello,

I am the owner of a Dell Latitude D620 notebook with an ICH7 SATA controller, unfortunately, the BIOS does not offer the option of using "native mode" instead of "compatibility mode" when it comes to SATA. For now, the ata_piix runs happily in compatibility mode. Looking at the ICH7 docs, I found that poking register 0x90 in PCI configuration space with value 0x40 should enable AHCI. However, there are some issues with poking that register with setpci in an early initramfs:

- The kernel does not seem to update the device id from PCI config space, which changes with the controller mode (it would seem the PCI subsystem keeps a copy)

Quoted 8 lines

- Poking PCI registers from userspace is far from ideal

It would be great if the AHCI driver (or otherwise) had a "force_ich7_ahci" to properly setup and initialize this device in full "native" AHCI mode. This option would be greatly welcome from users like me who have a stupid bios (eh, who doesn't).

Sorry but most BIOSen don't map ABAR unless it supports AHCI and there usually isn't a hole to fit in ABAR afterwards unless the kernel completely reallocates IO resources, which, again unfortunately, can't be done reliably cuz machines can be quirky and might puke if addresses aren't laid out as their BIOSen would do.

So, you'll have to live with ata_piix.

Quoted 7 lines
Quoted 7 lines

So far, I have managed to patch up the AHCI driver to initialize the ICH7 AHCI state machine as the BIOS would do (as per the AHCI spec instructions). This involves mapping ABAR and such. So far, I have gotten the AHCI driver to detect the chip properly, but it does not detect any drives. It looks like I will need to further initialize the chip. I think there might be a chance of success, but it will involve manually specifying which ports are present via a module parameter.

Do you know Edvin's patch?

http://www.bughost.org/pipermail/power/2007-June/000538.html

I've tested it and works fine on my note
(Sony VAIO type S VGN-SZ92PS, ICH7-M)

Signature · 2 lines
ISHIKAWA Mutsumi
 <[email protected]>, <[email protected]>
#5 lore raw
Quoted 48 lines · ISHIKAWA Mutsumi
Quoted 40 lines
Quoted 40 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

In <[email protected]>
Jonathan Bastien-Filiatrault <[email protected]> wrote:

Quoted 36 lines · Tejun Heo

Hello,

Quoted 15 lines · Jonathan Bastien-Filiatrault

Hello,

I am the owner of a Dell Latitude D620 notebook with an ICH7 SATA controller, unfortunately, the BIOS does not offer the option of using "native mode" instead of "compatibility mode" when it comes to SATA. For now, the ata_piix runs happily in compatibility mode. Looking at the ICH7 docs, I found that poking register 0x90 in PCI configuration space with value 0x40 should enable AHCI. However, there are some issues with poking that register with setpci in an early initramfs:

- The kernel does not seem to update the device id from PCI config space, which changes with the controller mode (it would seem the PCI subsystem keeps a copy)

Quoted 8 lines

- Poking PCI registers from userspace is far from ideal

It would be great if the AHCI driver (or otherwise) had a "force_ich7_ahci" to properly setup and initialize this device in full "native" AHCI mode. This option would be greatly welcome from users like me who have a stupid bios (eh, who doesn't).

Sorry but most BIOSen don't map ABAR unless it supports AHCI and there usually isn't a hole to fit in ABAR afterwards unless the kernel completely reallocates IO resources, which, again unfortunately, can't be done reliably cuz machines can be quirky and might puke if addresses aren't laid out as their BIOSen would do.

So, you'll have to live with ata_piix.

Quoted 7 lines
Quoted 7 lines

So far, I have managed to patch up the AHCI driver to initialize the ICH7 AHCI state machine as the BIOS would do (as per the AHCI spec instructions). This involves mapping ABAR and such. So far, I have gotten the AHCI driver to detect the chip properly, but it does not detect any drives. It looks like I will need to further initialize the chip. I think there might be a chance of success, but it will involve manually specifying which ports are present via a module parameter.

Quoted 6 lines

Do you know Edvin's patch?

http://www.bughost.org/pipermail/power/2007-June/000538.html

I've tested it and works fine on my note
(Sony VAIO type S VGN-SZ92PS, ICH7-M)

Yeah, I've seen it but I'm not sure whether it would worth the risk. For one, there are BIOSen which won't assign IO memory region to ABAR at all. There also is a patch to reallocate IO memory regions and make room for ABAR but that can break things.

Thanks.

Signature · 1 line
tejun
#6 lore raw
Quoted 7 lines · Tejun Heo <htejun <at> gmail.com> writes:
Quoted 6 lines · ISHIKAWA Mutsumi

Do you know Edvin's patch?

http://www.bughost.org/pipermail/power/2007-June/000538.html

I've tested it and works fine on my note
(Sony VAIO type S VGN-SZ92PS, ICH7-M)

Thanks for testing.

Quoted 6 lines

Yeah, I've seen it but I'm not sure whether it would worth the risk. For one, there are BIOSen which won't assign IO memory region to ABAR at all. There also is a patch to reallocate IO memory regions and make room for ABAR but that can break things.

It works fine on 2.6.22 (except that you loose the CD-ROM, and I found no way to reliably reactivate it), however since 2.6.23-rc it breaks.
I get misrouted IRQs: IRQ 12 (keyboard) is being fired instead of IRQ 18 (ahci), the kernel disables IRQ 18 because of spurious IRQs, and then IRQ 0 gets fired instead of IRQ 18. It is an edge-triggered interrupt, and I get the feeling the interrupt status isn't cleared after handling it, since I continously get messages about misrouted IRQs even if the system idle.
It works with irqpoll, but I don't have to tell you how slow that is.

When I'll be back from holiday I will try to compare lspci -xxx outputs, and then maybe try a git-bisect.

Bottom line is that force-enabling AHCI like this can stop working at any time with a new kernel version.
If there is a document describing _exactly_ what steps I need to follow to properly enable the device, I'd be happy to read it, but I guess such documentation is only available to BIOS developers.

--Edwin

#7 lore raw
Quoted 3 lines · Török Edwin

If there is a document describing _exactly_ what steps I need to follow to properly enable the device, I'd be happy to read it, but I guess such documentation is only available to BIOS developers.

It all depends on how BIOS set up the controller / IO regions during boot and even worse BIOS might expect certain configuration when ACPI suspend/resume or shutdown transition is requested. I don't really think we can include AHCI force-enable in the mainline. It's just too risky without too much benefit.

Signature · 1 line
tejun