feat: added basic ACPI support using LAI

This commit is contained in:
2021-08-30 19:56:36 +02:00
parent 462dd90890
commit e37222c346
17 changed files with 729 additions and 44 deletions

View File

@@ -9,7 +9,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include <myke/cpu/timer.h>
#include <myke/cpu/pit.h>
#include <myke/debug/debug.h>
#include <myke/drivers/pci/ide.h>
#include <myke/drivers/pci/pci.h>
@@ -395,6 +395,10 @@ void ide_register_block_devices() {
if (!ide_devices[i].reserved) {
continue;
}
if (ide_devices[i].type == IDE_ATAPI) {
// skip ATAPI for now
continue;
}
ide_block_device_info *info = malloc(sizeof(ide_block_device_info)); // todo free for this one
info->device_number = i;
@@ -451,11 +455,11 @@ uint8_t att_used ide_pci_initialize(pci_device *device) {
// (I) Select Drive:
ide_write(i, ATA_REG_HDDEVSEL, 0xA0 | (j << 4)); // Select Drive.
sleep(1); // Wait 1ms for drive select to work.
pit_sleep(1); // Wait 1ms for drive select to work.
// (II) Send ATA Identify Command:
ide_write(i, ATA_REG_COMMAND, ATA_CMD_IDENTIFY);
sleep(1); // This function should be implemented in your OS. which waits for 1 ms.
pit_sleep(1); // This function should be implemented in your OS. which waits for 1 ms.
// it is based on System Timer Device Driver.
// (III) Polling:
@@ -485,7 +489,7 @@ uint8_t att_used ide_pci_initialize(pci_device *device) {
}
ide_write(i, ATA_REG_COMMAND, ATA_CMD_IDENTIFY_PACKET);
sleep(1);
pit_sleep(1);
}
// (V) Read Identification Space of the Device: