X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FModules%2FStorage%2FAHCI%2Fahci.c;h=d48c1bf35144bab40c3e7d815c9779431875e88e;hb=13078002b01ee4f63eb2001d2ef479a2a006ea32;hp=698ffe9494e773fca4ac0e07948a40cb23af6c5e;hpb=cdf177534936e5380ff41a5c073367553e8a55bf;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/Storage/AHCI/ahci.c b/KernelLand/Modules/Storage/AHCI/ahci.c index 698ffe94..d48c1bf3 100644 --- a/KernelLand/Modules/Storage/AHCI/ahci.c +++ b/KernelLand/Modules/Storage/AHCI/ahci.c @@ -5,8 +5,8 @@ * ahci.c * - Driver core */ -#define DEBUG 1 -#define VERSION 0x0001 +#define DEBUG 0 +#define VERSION VER2(1,0) #include #include #include @@ -348,7 +348,6 @@ void AHCI_IRQHandler(int UNUSED(IRQ), void *Data) Uint32 IS = Ctrlr->MMIO->IS; Uint32 PI = Ctrlr->MMIO->PI; - LOG("Ctrlr->MMIO->IS = %x", IS); for( int i = 0; i < 32; i ++ ) { @@ -367,7 +366,7 @@ void AHCI_IRQHandler(int UNUSED(IRQ), void *Data) void AHCI_int_IRQHandlerPort(tAHCI_Port *Port) { Uint32 PxIS = Port->MMIO->PxIS; - LOG("port->MMIO->PxIS = %x", PxIS); + LOG("port[%i]->MMIO->PxIS = %x", Port->Idx, PxIS); Port->LastIS |= PxIS; if( PxIS & AHCI_PxIS_CPDS ) { // Cold port detect change detected @@ -375,15 +374,15 @@ void AHCI_int_IRQHandlerPort(tAHCI_Port *Port) } if( PxIS & AHCI_PxIS_DHRS ) { - LOG("Port->RcvdFIS->RFIS = {"); - LOG(".Status = 0x%02x", Port->RcvdFIS->RFIS.Status); - LOG(".Error = 0x%02x", Port->RcvdFIS->RFIS.Error); - LOG("}"); + // LOG("Port->RcvdFIS->RFIS = {"); + // LOG(".Status = 0x%02x", Port->RcvdFIS->RFIS.Status); + // LOG(".Error = 0x%02x", Port->RcvdFIS->RFIS.Error); + // LOG("}"); } // Get bitfield of completed commands (Issued but no activity) Uint32 done_commands = Port->IssuedCommands ^ Port->MMIO->PxSACT; - LOG("done_commands = %x", done_commands); + //LOG("done_commands = %x", done_commands); for( int i = 0; i < 32; i ++ ) { if( !(done_commands & (1 << i)) ) @@ -405,6 +404,9 @@ int AHCI_ReadSectors(void *Ptr, Uint64 Address, size_t Count, void *Buffer) { tAHCI_Port *Port = Ptr; + ENTER("pPtr XAddress xCount pBuffer", + Ptr, Address, Count, Buffer); + memset(Buffer, 0xFF, Count*512); ASSERT(Count <= 8096/512); @@ -414,15 +416,18 @@ int AHCI_ReadSectors(void *Ptr, Uint64 Address, size_t Count, void *Buffer) AHCI_SendLBA48Cmd(Port, 0, 0, Count, Address, ATA_CMD_READDMA48, Count*512, Buffer); if( AHCI_WaitForInterrupt(Port, 1000) ) { Log_Notice("AHCI", "Timeout reading from disk"); + LEAVE('i', 0); return 0; } if( Port->RcvdFIS->RFIS.Status & ATA_STATUS_ERR ) { LOG("Error detected = 0x%02x", Port->RcvdFIS->RFIS.Error); + LEAVE('i', 0); return 0; } //Debug_HexDump("AHCI_ReadSectors", Buffer, Count*512); // TODO: Check status from command + LEAVE('i', Count); return Count; } @@ -486,7 +491,7 @@ int AHCI_SendLBA48Cmd(tAHCI_Port *Port, int bWrite, regs.SectorCountExp = 0; regs.Control = 0; - LOG("Sending command %02x with %p+0x%x", Cmd, Data, Size); + LOG("Sending command %02x : 0x%llx with %p+0x%x", Cmd, LBA, Data, Size); AHCI_DoFIS(Port, bWrite, sizeof(regs), ®s, 0, NULL, Size, Data); return 0; @@ -518,7 +523,7 @@ int AHCI_SendLBA28Cmd(tAHCI_Port *Port, int bWrite, regs.SectorCountExp = 0; regs.Control = 0; - LOG("Sending command %02x with %p+0x%x", Cmd, Data, Size); + LOG("Sending command %02x : 0x%llx with %p+0x%x", Cmd, LBA, Data, Size); AHCI_DoFIS(Port, bWrite, sizeof(regs), ®s, 0, NULL, Size, Data); return 0;