X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FModules%2FStorage%2FATA%2Fio.c;h=c3258bc95fc9ca441575ebc2e117afcf1ba1b016;hb=5cab4c07bc13888dc7956194ef9595508072a4eb;hp=b15918e12b1ee4ba4724635a032693b439b5479b;hpb=45ff232a1db704623e0c4baed011d12cbd44b06e;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/Storage/ATA/io.c b/KernelLand/Modules/Storage/ATA/io.c index b15918e1..c3258bc9 100644 --- a/KernelLand/Modules/Storage/ATA/io.c +++ b/KernelLand/Modules/Storage/ATA/io.c @@ -153,8 +153,8 @@ int ATA_SetupIO(void) outb(base+0x03, 0xFF); if(inb(base+0x02) != 0x66 || inb(base+0x03) != 0xFF) { Log_Error("ATA", "Unable to write to 0x%x/0x%x", base+2, base+3); - LEAVE('i', 0); - return 0; + LEAVE('i', MODULE_ERR_MISC); + return MODULE_ERR_MISC; } } @@ -183,11 +183,11 @@ int ATA_SetupIO(void) LOG("gATA_PRDTs = {PBufAddr: 0x%x, PBufAddr: 0x%x}", gATA_PRDTs[0].PBufAddr, gATA_PRDTs[1].PBufAddr); - // TODO: Ensure that this is within 32-bits gaATA_PRDT_PAddrs[0] = MM_GetPhysAddr( &gATA_PRDTs[0] ); gaATA_PRDT_PAddrs[1] = MM_GetPhysAddr( &gATA_PRDTs[1] ); LOG("gaATA_PRDT_PAddrs = {0x%P, 0x%P}", gaATA_PRDT_PAddrs[0], gaATA_PRDT_PAddrs[1]); #if PHYS_BITS > 32 + // Ensure that this is within 32-bits if( gaATA_PRDT_PAddrs[0] >> 32 || gaATA_PRDT_PAddrs[1] >> 32 ) { Log_Error("ATA", "Physical addresses of PRDTs are not in 32-bits (%P and %P)", gaATA_PRDT_PAddrs[0], gaATA_PRDT_PAddrs[1]); @@ -203,6 +203,14 @@ int ATA_SetupIO(void) outb(IDE_SEC_BASE+1, 1); outb(IDE_PRI_CTRL, 0); outb(IDE_SEC_CTRL, 0); + + + // Soft reset all drives + outb(IDE_PRI_CTRL, 4); + outb(IDE_SEC_CTRL, 4); + IO_DELAY(); + outb(IDE_PRI_CTRL, 0); + outb(IDE_SEC_CTRL, 0); // Make sure interrupts are ACKed ATA_int_BusMasterWriteByte(2, 0x4); @@ -305,7 +313,7 @@ int ATA_DoDMA(Uint8 Disk, Uint64 Address, Uint Count, int bWrite, void *Buffer) int cont = (Disk>>1)&1; // Controller ID int disk = Disk & 1; Uint16 base; - int bUseBounceBuffer; + int bUseBounceBuffer = 0; ENTER("iDisk XAddress iCount bbWrite pBuffer", Disk, Address, Count, bWrite, Buffer); @@ -363,21 +371,6 @@ int ATA_DoDMA(Uint8 Disk, Uint64 Address, Uint Count, int bWrite, void *Buffer) // Reset IRQ Flag gaATA_IRQs[cont] = 0; - - // TODO: What the ____ does this do? - #if 1 - if( cont == 0 ) { - outb(IDE_PRI_CTRL, 4); - IO_DELAY(); - outb(IDE_PRI_CTRL, 0); - } - else { - outb(IDE_SEC_CTRL, 4); - IO_DELAY(); - outb(IDE_SEC_CTRL, 0); - } - #endif - // Set up transfer if( Address > 0x0FFFFFFF ) // Use LBA48 {