forked from AbleOS/ableos
filling out the ide_select_drive function
This commit is contained in:
parent
559f25bb4e
commit
36d50f6b38
|
@ -16,6 +16,10 @@ main := fn(): int {
|
|||
|
||||
ATA_PRIMARY := @as(u8, @intcast(0x0))
|
||||
ATA_PRIMARY_IO := @as(u8, @intcast(0x1F0))
|
||||
|
||||
ATA_SECONDARY := @as(u8, @intcast(0x1))
|
||||
ATA_SECONDARY_IO := @as(u8, @intcast(0x170))
|
||||
|
||||
ATA_REG_HDDEVSEL := @as(u8, @intcast(0x6))
|
||||
|
||||
ATA_MASTER := @as(u8, @intcast(0x0))
|
||||
|
@ -24,16 +28,16 @@ IDE := struct {}
|
|||
ide_select_drive := fn(bus: u8, i: u8): void {
|
||||
if bus == ATA_PRIMARY {
|
||||
if i == ATA_MASTER {
|
||||
// BUG: Causes qemu to crash
|
||||
// memory.outb(ATA_PRIMARY_IO + ATA_REG_HDDEVSEL, 0xA0)
|
||||
log.info("Primary ATA selected\0")
|
||||
memory.outb(ATA_PRIMARY_IO + ATA_REG_HDDEVSEL, 0xA0)
|
||||
} else {
|
||||
// outportb(ATA_PRIMARY_IO + ATA_REG_HDDEVSEL, 0xB0);
|
||||
memory.outb(ATA_PRIMARY_IO + ATA_REG_HDDEVSEL, 0xB0)
|
||||
}
|
||||
} else {
|
||||
if i == ATA_MASTER {
|
||||
// outportb(ATA_SECONDARY_IO + ATA_REG_HDDEVSEL, 0xA0);
|
||||
memory.outb(ATA_SECONDARY_IO + ATA_REG_HDDEVSEL, 0xA0)
|
||||
} else {
|
||||
// outportb(ATA_SECONDARY_IO + ATA_REG_HDDEVSEL, 0xB0)
|
||||
memory.outb(ATA_SECONDARY_IO + ATA_REG_HDDEVSEL, 0xB0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +45,7 @@ ide_select_drive := fn(bus: u8, i: u8): void {
|
|||
identify := fn(bus: u8, drive: u8): bool {
|
||||
io := 0
|
||||
|
||||
// BUG: Causes qemu to crash
|
||||
ide_select_drive(bus, drive)
|
||||
if bus == ATA_PRIMARY {
|
||||
io = ATA_PRIMARY_IO
|
||||
|
@ -56,6 +61,7 @@ ata_probe := fn(): void {
|
|||
|
||||
ATA := struct {
|
||||
new := fn(): void {
|
||||
ata_probe()
|
||||
log.info("Checking for ATA Drives.\0")
|
||||
// ata_probe()
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue