From 701b0f0804f62170fd4b9e18f701e8a5b7957cb0 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 17 Feb 2020 19:10:59 +0100 Subject: [PATCH] WIP : working on AHCI --- include/io/ata.h | 10 ++++++---- kaleid/kernel/init/init.c | 4 ++++ kaleid/kernel/io/ata.c | 8 ++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) 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); }