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;