mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-20 21:08:51 +00:00
Ata boot fix.
This commit is contained in:
parent
e132b0f473
commit
c75cdffbb4
2 changed files with 40 additions and 9 deletions
|
|
@ -15,6 +15,7 @@ namespace Cosmos.HAL
|
|||
|
||||
public static TextScreenBase TextScreen = new TextScreen();
|
||||
public static PCI Pci;
|
||||
public static int atamode;
|
||||
|
||||
static public void Init(TextScreenBase textScreen)
|
||||
{
|
||||
|
|
@ -46,16 +47,26 @@ namespace Cosmos.HAL
|
|||
|
||||
mDebugger.Send("Done initializing Cosmos.HAL.Global");
|
||||
|
||||
mDebugger.Send("ATA Primary Master");
|
||||
InitAta(Ata.ControllerIdEnum.Primary, Ata.BusPositionEnum.Master);
|
||||
if (atamode == 1)
|
||||
{
|
||||
//TODO Implement an AHCI Driver
|
||||
}
|
||||
else if (atamode == 2)
|
||||
{
|
||||
//TODO Implement a RAID Driver
|
||||
}
|
||||
else if (atamode == 3)
|
||||
{
|
||||
mDebugger.Send("ATA Primary Master");
|
||||
InitAta(Ata.ControllerIdEnum.Primary, Ata.BusPositionEnum.Master);
|
||||
|
||||
//TODO Need to change code to detect if ATA controllers are present or not. How to do this? via PCI enum?
|
||||
// They do show up in PCI space as well as the fixed space.
|
||||
// Or is it always here, and was our compiler stack corruption issue?
|
||||
mDebugger.Send("ATA Secondary Master");
|
||||
InitAta(Ata.ControllerIdEnum.Secondary, Ata.BusPositionEnum.Master);
|
||||
//InitAta(BlockDevice.Ata.ControllerIdEnum.Secondary, BlockDevice.Ata.BusPositionEnum.Slave);
|
||||
|
||||
//TODO Need to change code to detect if ATA controllers are present or not. How to do this? via PCI enum?
|
||||
// They do show up in PCI space as well as the fixed space.
|
||||
// Or is it always here, and was our compiler stack corruption issue?
|
||||
mDebugger.Send("ATA Secondary Master");
|
||||
InitAta(Ata.ControllerIdEnum.Secondary, Ata.BusPositionEnum.Master);
|
||||
//InitAta(BlockDevice.Ata.ControllerIdEnum.Secondary, BlockDevice.Ata.BusPositionEnum.Slave);
|
||||
}
|
||||
}
|
||||
|
||||
public static void EnableInterrupts()
|
||||
|
|
|
|||
|
|
@ -32,6 +32,26 @@ namespace Cosmos.HAL
|
|||
CheckBus(fn);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PCIDevice device in Devices)
|
||||
{
|
||||
|
||||
if (device.ClassCode == 0x01 && device.Subclass == 0x06 && device.ProgIF == 0x01)
|
||||
{
|
||||
//Serial ATA (AHCI 1.0)
|
||||
Global.atamode = 1;
|
||||
}
|
||||
else if (device.ClassCode == 0x01 && device.Subclass == 0x04 && device.ProgIF == 0x00)
|
||||
{
|
||||
//RAID Controller
|
||||
Global.atamode = 2;
|
||||
}
|
||||
else if (device.ClassCode == 0x01 && device.Subclass == 0x01)
|
||||
{
|
||||
//IDE Controller
|
||||
Global.atamode = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void CheckBus(ushort xBus)
|
||||
|
|
|
|||
Loading…
Reference in a new issue