Kernel: ATABuses are but to compatibility mode if possible

I don't support native mode ata bus (irq sharing) so ata buses are
but to compatibility mode if possible.
This commit is contained in:
Bananymous 2023-10-16 16:56:12 +03:00
parent b767317a7a
commit 48980b56ab
2 changed files with 18 additions and 3 deletions

View File

@ -1,7 +1,9 @@
#pragma once #pragma once
#define ATA_PROGIF_PRIMARY_NATIVE (1 << 0) #define ATA_PROGIF_PRIMARY_NATIVE (1 << 0)
#define ATA_PROGIF_SECONDARY_NATIVE (1 << 2) #define ATA_PROGIF_CAN_MODIFY_PRIMARY_NATIVE (1 << 1)
#define ATA_PROGIF_SECONDARY_NATIVE (1 << 2)
#define ATA_PROGIF_CAN_MODIFY_SECONDARY_NATIVE (1 << 3)
#define ATA_PORT_DATA 0x00 #define ATA_PORT_DATA 0x00
#define ATA_PORT_ERROR 0x00 #define ATA_PORT_ERROR 0x00

View File

@ -41,6 +41,20 @@ namespace Kernel
uint8_t prog_if = m_pci_device.read_byte(0x09); uint8_t prog_if = m_pci_device.read_byte(0x09);
if ((prog_if & ATA_PROGIF_CAN_MODIFY_PRIMARY_NATIVE) && (prog_if & ATA_PROGIF_PRIMARY_NATIVE))
{
prog_if &= ~ATA_PROGIF_PRIMARY_NATIVE;
m_pci_device.write_byte(0x09, prog_if);
dprintln("enabling compatibility mode for bus 1");
}
if ((prog_if & ATA_PROGIF_CAN_MODIFY_SECONDARY_NATIVE) && (prog_if & ATA_PROGIF_SECONDARY_NATIVE))
{
prog_if &= ~ATA_PROGIF_SECONDARY_NATIVE;
m_pci_device.write_byte(0x09, prog_if);
dprintln("enabling compatibility mode for bus 2");
}
if (!(prog_if & ATA_PROGIF_PRIMARY_NATIVE)) if (!(prog_if & ATA_PROGIF_PRIMARY_NATIVE))
{ {
auto bus_or_error = ATABus::create(0x1F0, 0x3F6, 14); auto bus_or_error = ATABus::create(0x1F0, 0x3F6, 14);
@ -54,7 +68,6 @@ namespace Kernel
dprintln("unsupported IDE ATABus in native mode"); dprintln("unsupported IDE ATABus in native mode");
} }
// BUS 2
if (!(prog_if & ATA_PROGIF_SECONDARY_NATIVE)) if (!(prog_if & ATA_PROGIF_SECONDARY_NATIVE))
{ {
auto bus_or_error = ATABus::create(0x170, 0x376, 15); auto bus_or_error = ATABus::create(0x170, 0x376, 15);