diff --git a/include/io/ata.h b/include/io/ata.h index ea4edac..1843212 100644 --- a/include/io/ata.h +++ b/include/io/ata.h @@ -33,13 +33,15 @@ //----------------------------------------------------------------------------// +#define MASS_STORAGE_CLASS 0x1 +#define SERIAL_ATA_SUBCLASS 0x6 + +//----------------------------------------------------------------------------// + +void IoDetectATA(void); void IoReadATA(void *sectorBuffer, char n, char first); void IoDumpSector(void); -//----------------------------------------------------------------------------// - - - //----------------------------------------------------------------------------// #endif diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index 92cda93..ba3beae 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -88,6 +89,9 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg) // PCI express IoInitPCI(); + // Drivers + IoDetectATA(); + // Scheduler PsInitSched(); diff --git a/kaleid/kernel/io/ata.c b/kaleid/kernel/io/ata.c index b7c23b9..3c58262 100644 --- a/kaleid/kernel/io/ata.c +++ b/kaleid/kernel/io/ata.c @@ -45,5 +45,13 @@ void IoDumpFirstSector(void) void IoDetectATA(void) { + PciDev_t *ataDevice = IoPciGetDeviceByClass(MASS_STORAGE_CLASS, + SERIAL_ATA_SUBCLASS); + if(!ataDevice) { + return; + } + + DebugLog("AHCI controller found ! PCI config addr = %p\n", + ataDevice->configAddr); }