Discussion:
[SeaBIOS] [coreboot] Add IDE_TO_AHCI config
Chuang, Alex
2011-05-26 23:01:56 UTC
Permalink
Hi,



I add one config 'IDE_TO_AHCI' in 'seabios\src\Kconfig' and modify
'seabios\src\ata.c'. Please help me to review and check-in.



This 'IDE_TO_AHCI' function can let SeaBIOS handle AHCI controller as
IDE controller when 'ATA' enable, and also let Windows OS to load AHCI
inbox driver or chipset vender's AHCI driver. In other words, it means
that SATA Hard Disk ran as IDE mode in SeaBIOS but AHCI mode in Windows
OS.



Best regards,

Alex





In 'seabios\src\Kconfig':

menu "Hardware support"

config ATA

depends on DRIVES

bool "ATA controllers"

default y

help

Support for IDE disk code.

config ATA_DMA

depends on ATA

bool "ATA DMA"

default n

help

Detect and try to use ATA bus mastering DMA controllers.

config ATA_PIO32

depends on ATA

bool "ATA 32bit PIO"

default n

help

Use 32bit PIO accesses on ATA (minor optimization on PCI
transfers).

config IDE_TO_AHCI
<- New add.

depends on ATA
<- New add.

bool "IDE to AHCI support"
<- New add.

default n
<- New add.

help
<- New add.

Handle AHCI controller as ATA controller when POST. <- New
add.

config AHCI

depends on DRIVES

bool "AHCI controllers"

default n

help

Support for AHCI disk code.





In 'seabios\src\ata.c':

static void

ata_init(void)

{

// Scan PCI bus for ATA adapters

int count=0, pcicount=0;

int bdf, max;

foreachpci(bdf, max) {

pcicount++;

if (pci_config_readw(bdf, PCI_CLASS_DEVICE) !=
PCI_CLASS_STORAGE_IDE)

if ((! CONFIG_IDE_TO_AHCI) ||
(pci_config_readw(bdf, PCI_CLASS_DEVICE) != 0x0106)) <- New add.

continue;



u8 pciirq = pci_config_readb(bdf, PCI_INTERRUPT_LINE);

u8 prog_if = pci_config_readb(bdf, PCI_CLASS_PROG);

if (CONFIG_IDE_TO_AHCI && (pci_config_readw(bdf,
PCI_CLASS_DEVICE) == 0x0106)) <- New add.

prog_if = 0x8F;
<- New add.

int master = 0;
Scott Duplichan
2011-05-27 06:44:21 UTC
Permalink
Alex Chuang wrote:

]Hi,
]
]I add one config ‘IDE_TO_AHCI’ in ‘seabios\src\Kconfig’ and modify
]‘seabios\src\ata.c’. Please help me to review and check-in.
]
]This ‘IDE_TO_AHCI’ function can let SeaBIOS handle AHCI controller as IDE
]controller when ‘ATA’ enable, and also let Windows OS to load AHCI inbox
]driver or chipset vender’s AHCI driver. In other words, it means that SATA
]Hard Disk ran as IDE mode in SeaBIOS but AHCI mode in Windows OS.

Hello Alex,

Thanks for this contribution. Also thanks for explaining IDE_TO_AHCI.
I have seen it in BIOS setup before, but without explanation.

Before diving into the details of this change, what benefit can be
expected from using it? I assume its purpose is to gain the benefits
of OS use of AHCI interface while avoiding the need for an AHCI option
ROM. Avoiding option ROMs is certainly a good thing. But why not use AHCI
mode for both SeaBIOS and OS? SeaBIOS AHCI support works on AMD hardware
when this patch is used:
http://comments.gmane.org/gmane.comp.bios.coreboot.seabios/1663

]   if ((! CONFIG_IDE_TO_AHCI) || (pci_config_readw(bdf, PCI_CLASS_DEVICE)
]!= 0x0106))  <- New add.

You could improve readability by replacing 0x0106 with
PCI_CLASS_STORAGE_SATA.

Thanks,
Scott
Chuang, Alex
2011-05-27 09:07:50 UTC
Permalink
Hi Scott,

Yes, the purpose is to gain the benefits of OS use of AHCI interface.
And I met the same problem when I enabled the config AHCI.
I will try to add your AHCI patch code in my side, but please kindly send the final ahci.c to me.

Best regards,
Alex

-----Original Message-----
From: Scott Duplichan [mailto:***@notabs.org]
Sent: Friday, May 27, 2011 2:44 PM
To: Chuang, Alex; ***@seabios.org
Subject: RE: [SeaBIOS] [coreboot] Add IDE_TO_AHCI config

Alex Chuang wrote:

]Hi,
]
]I add one config 'IDE_TO_AHCI' in 'seabios\src\Kconfig' and modify
]'seabios\src\ata.c'. Please help me to review and check-in.
]
]This 'IDE_TO_AHCI' function can let SeaBIOS handle AHCI controller as IDE
]controller when 'ATA' enable, and also let Windows OS to load AHCI inbox
]driver or chipset vender's AHCI driver. In other words, it means that SATA
]Hard Disk ran as IDE mode in SeaBIOS but AHCI mode in Windows OS.

Hello Alex,

Thanks for this contribution. Also thanks for explaining IDE_TO_AHCI.
I have seen it in BIOS setup before, but without explanation.

Before diving into the details of this change, what benefit can be
expected from using it? I assume its purpose is to gain the benefits
of OS use of AHCI interface while avoiding the need for an AHCI option
ROM. Avoiding option ROMs is certainly a good thing. But why not use AHCI
mode for both SeaBIOS and OS? SeaBIOS AHCI support works on AMD hardware
when this patch is used:
http://comments.gmane.org/gmane.comp.bios.coreboot.seabios/1663

]   if ((! CONFIG_IDE_TO_AHCI) || (pci_config_readw(bdf, PCI_CLASS_DEVICE)
]!= 0x0106))  <- New add.

You could improve readability by replacing 0x0106 with
PCI_CLASS_STORAGE_SATA.

Thanks,
Scott
Chuang, Alex
2011-05-27 17:34:31 UTC
Permalink
Hi,

Attach my modified files that are used "git format-patch" format.

Best regards,
Alex

-----Original Message-----
From: Chuang, Alex
Sent: Friday, May 27, 2011 5:08 PM
To: 'Scott Duplichan'; ***@seabios.org
Subject: RE: [SeaBIOS] [coreboot] Add IDE_TO_AHCI config

Hi Scott,

Yes, the purpose is to gain the benefits of OS use of AHCI interface.
And I met the same problem when I enabled the config AHCI.
I will try to add your AHCI patch code in my side, but please kindly send the final ahci.c to me.

Best regards,
Alex

-----Original Message-----
From: Scott Duplichan [mailto:***@notabs.org]
Sent: Friday, May 27, 2011 2:44 PM
To: Chuang, Alex; ***@seabios.org
Subject: RE: [SeaBIOS] [coreboot] Add IDE_TO_AHCI config

Alex Chuang wrote:

]Hi,
]
]I add one config 'IDE_TO_AHCI' in 'seabios\src\Kconfig' and modify
]'seabios\src\ata.c'. Please help me to review and check-in.
]
]This 'IDE_TO_AHCI' function can let SeaBIOS handle AHCI controller as IDE
]controller when 'ATA' enable, and also let Windows OS to load AHCI inbox
]driver or chipset vender's AHCI driver. In other words, it means that SATA
]Hard Disk ran as IDE mode in SeaBIOS but AHCI mode in Windows OS.

Hello Alex,

Thanks for this contribution. Also thanks for explaining IDE_TO_AHCI.
I have seen it in BIOS setup before, but without explanation.

Before diving into the details of this change, what benefit can be
expected from using it? I assume its purpose is to gain the benefits
of OS use of AHCI interface while avoiding the need for an AHCI option
ROM. Avoiding option ROMs is certainly a good thing. But why not use AHCI
mode for both SeaBIOS and OS? SeaBIOS AHCI support works on AMD hardware
when this patch is used:
http://comments.gmane.org/gmane.comp.bios.coreboot.seabios/1663

]   if ((! CONFIG_IDE_TO_AHCI) || (pci_config_readw(bdf, PCI_CLASS_DEVICE)
]!= 0x0106))  <- New add.

You could improve readability by replacing 0x0106 with
PCI_CLASS_STORAGE_SATA.

Thanks,
Scott
Scott Duplichan
2011-05-28 05:10:11 UTC
Permalink
Alex Chuang wrote:

]Hi,
]
]Attach my modified files that are used "git format-patch" format.
]
]Best regards,
]Alex

Hello Alex,

I tested this patch on AMD Persimmon. In SeaBIOS, I enabled your new
IDE_TO_AHCI option, enabled ATA and ATA DMA, and disabled AHCI.

In coreboot, I hid the IDE controller at device 14h function 1 and
enabled the SATA AHCI/IDE controller at device 11h function 0.

Windows 7 installs and device manager reports device 11h function 0
as "Standard AHCI 1.0 Serial ATA Controller". This show that the
feature is working as intended.

Thanks,
Scott
Chuang, Alex
2011-05-30 06:44:21 UTC
Permalink
Hi,



I add one config 'IDE_TO_AHCI' in 'src\Kconfig' and modify 'src\ata.c'.
Please help me to review and check-in.



This 'IDE_TO_AHCI' function can let SeaBIOS handle AHCI controller as
IDE controller when 'ATA' enable, and also let Windows OS to load AHCI
inbox driver or chipset vender's AHCI driver. In other words, it means
that SATA Hard Disk ran as IDE mode in SeaBIOS but AHCI mode in Windows
OS.



Attached file: A.patch B.patch.



Signed-off-by: Alex Chuang <***@amd.com>



Best regards,

Alex
Kevin O'Connor
2011-05-30 14:35:00 UTC
Permalink
Post by Chuang, Alex
Hi,
I add one config 'IDE_TO_AHCI' in 'src\Kconfig' and modify 'src\ata.c'.
Please help me to review and check-in.
This 'IDE_TO_AHCI' function can let SeaBIOS handle AHCI controller as
IDE controller when 'ATA' enable, and also let Windows OS to load AHCI
inbox driver or chipset vender's AHCI driver. In other words, it means
that SATA Hard Disk ran as IDE mode in SeaBIOS but AHCI mode in Windows
OS.
Can all SATA controllers be run in IDE mode? If not, how can one know
which SATA controller supports the mode?

-Kevin
Chuang, Alex
2011-05-30 17:18:28 UTC
Permalink
Post by Kevin O'Connor
Post by Chuang, Alex
Hi,
I add one config 'IDE_TO_AHCI' in 'src\Kconfig' and modify
'src\ata.c'.
Post by Kevin O'Connor
Post by Chuang, Alex
Please help me to review and check-in.
This 'IDE_TO_AHCI' function can let SeaBIOS handle AHCI controller as
IDE controller when 'ATA' enable, and also let Windows OS to load AHCI
inbox driver or chipset vender's AHCI driver. In other words, it means
that SATA Hard Disk ran as IDE mode in SeaBIOS but AHCI mode in Windows
OS.
Can all SATA controllers be run in IDE mode? If not, how can one know
which SATA controller supports the mode?
Not all SATA controllers can be run in this mode.
That's why I set 'IDE_TO_AHCI' default to disable.
I only confirm it's working with AMD's SATA controller.

Best regards,
Alex
Kevin O'Connor
2011-05-31 22:57:16 UTC
Permalink
Post by Chuang, Alex
Post by Kevin O'Connor
Can all SATA controllers be run in IDE mode? If not, how can one know
which SATA controller supports the mode?
Not all SATA controllers can be run in this mode.
That's why I set 'IDE_TO_AHCI' default to disable.
I only confirm it's working with AMD's SATA controller.
Okay. In that case, I think it would be better to detect the
vendor/device ids that can be supported instead of adding a new config
option.

-Kevin
Chuang, Alex
2011-06-01 07:14:46 UTC
Permalink
Post by Kevin O'Connor
Post by Chuang, Alex
Not all SATA controllers can be run in this mode.
That's why I set 'IDE_TO_AHCI' default to disable.
I only confirm it's working with AMD's SATA controller.
Okay. In that case, I think it would be better to detect the
vendor/device ids that can be supported instead of adding a new config
option.
It's fine to add vendor ids detect code, but I think config
'IDE_TO_AHCI' should be reserved.
Because there are three ways to control AHCI controller.

1. AHCI option rom.
2. ATA emulation mode in ATA.c.
3. non-ATA emulation mode in AHCI.c.

Config 'AHCI' can control non-ATA emulation mode enable/disable in
AHCI.c and we also need config 'IDE_TO_AHCI' to control ATA emulation
mode enable/disable in ATA.c.

Best regards,
Alex
Kevin O'Connor
2011-06-10 12:04:21 UTC
Permalink
Post by Chuang, Alex
Post by Kevin O'Connor
Post by Chuang, Alex
Not all SATA controllers can be run in this mode.
That's why I set 'IDE_TO_AHCI' default to disable.
I only confirm it's working with AMD's SATA controller.
Okay. In that case, I think it would be better to detect the
vendor/device ids that can be supported instead of adding a new config
option.
It's fine to add vendor ids detect code, but I think config
'IDE_TO_AHCI' should be reserved.
Because there are three ways to control AHCI controller.
1. AHCI option rom.
2. ATA emulation mode in ATA.c.
3. non-ATA emulation mode in AHCI.c.
Config 'AHCI' can control non-ATA emulation mode enable/disable in
AHCI.c and we also need config 'IDE_TO_AHCI' to control ATA emulation
mode enable/disable in ATA.c.
Best regards,
Alex
Hi Alex,

Sorry for not getting back to you sooner.

I recently purchased an Asrock E350M1/USB3 motherboard and some flash
chips. So, I'll give your patch a spin this weekend.

Basically, I'd like to see if there is some way this can be
auto-detected at runtime instead of using a compile time setting.

-Kevin
Marc Jones
2011-06-10 15:58:21 UTC
Permalink
Post by Kevin O'Connor
Post by Chuang, Alex
Post by Chuang, Alex
Not all SATA controllers can be run in this mode.
That's why I set 'IDE_TO_AHCI' default to disable.
I only confirm it's working with AMD's SATA controller.
Okay.  In that case, I think it would be better to detect the
vendor/device ids that can be supported instead of adding a new config
option.
It's fine to add vendor ids detect code, but I think config
'IDE_TO_AHCI' should be reserved.
Because there are three ways to control AHCI controller.
1. AHCI option rom.
2. ATA emulation mode in ATA.c.
3. non-ATA emulation mode in AHCI.c.
Config 'AHCI' can control non-ATA emulation mode enable/disable in
AHCI.c and we also need config 'IDE_TO_AHCI' to control ATA emulation
mode enable/disable in ATA.c.
Best regards,
Alex
Hi Alex,
Sorry for not getting back to you sooner.
I recently purchased an Asrock E350M1/USB3 motherboard and some flash
chips.  So, I'll give your patch a spin this weekend.
Basically, I'd like to see if there is some way this can be
auto-detected at runtime instead of using a compile time setting.
-Kevin
Kevin,

Auto detect would be great. It would also be good if we could
incorporate fixes ScottD made for AHCI. The patch may require some
tweaking.

Marc
--
http://se-eng.com
Kevin O'Connor
2011-06-13 11:55:43 UTC
Permalink
Post by Marc Jones
Post by Kevin O'Connor
I recently purchased an Asrock E350M1/USB3 motherboard and some flash
chips.  So, I'll give your patch a spin this weekend.
Basically, I'd like to see if there is some way this can be
auto-detected at runtime instead of using a compile time setting.
Auto detect would be great. It would also be good if we could
incorporate fixes ScottD made for AHCI. The patch may require some
tweaking.
Yes - that will be first priority. It's been tough getting time to
work on it though.

-Kevin
Marc Jones
2011-06-13 17:32:56 UTC
Permalink
Post by Marc Jones
Post by Kevin O'Connor
I recently purchased an Asrock E350M1/USB3 motherboard and some flash
chips.  So, I'll give your patch a spin this weekend.
Basically, I'd like to see if there is some way this can be
auto-detected at runtime instead of using a compile time setting.
Auto detect would be great. It would also be good if we could
incorporate fixes ScottD made for AHCI. The patch may require some
tweaking.
Yes - that will be first priority.  It's been tough getting time to
work on it though.
-Kevin
I understand completely! :)

Marc
--
http://se-eng.com
Loading...