X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FStorage%2FATA%2Fio.c;h=0f442acd6f7bcbb4a05a4a37405a8b058fb19a17;hb=7d881c2e5fef91a6570e46ef69a5d4a5cf0e8b4d;hp=89fcdb9f8cb28879105474e9695669023b85da41;hpb=73e8ed89c011abce9b0ae2c5a3eb232bdbe8660e;p=tpg%2Facess2.git diff --git a/Modules/Storage/ATA/io.c b/Modules/Storage/ATA/io.c index 89fcdb9f..0f442acd 100644 --- a/Modules/Storage/ATA/io.c +++ b/Modules/Storage/ATA/io.c @@ -94,7 +94,7 @@ Uint8 *gATA_BusMasterBasePtr; //!< Paging Mapped MMIO (If needed) int gATA_IRQSec = 15; volatile int gaATA_IRQs[2] = {0}; // - Locks to avoid tripping -tSpinlock giaATA_ControllerLock[2]; +tMutex glaATA_ControllerLock[2]; // - Buffers! Uint8 gATA_Buffers[2][(MAX_DMA_SECTORS+0xFFF)&~0xFFF] __attribute__ ((section(".padata"))); // - PRDTs @@ -283,7 +283,7 @@ int ATA_ReadDMA(Uint8 Disk, Uint64 Address, Uint Count, void *Buffer) } // Get exclusive access to the disk controller - LOCK( &giaATA_ControllerLock[ cont ] ); + Mutex_Acquire( &glaATA_ControllerLock[ cont ] ); // Set Size gATA_PRDTs[ cont ].Bytes = Count * SECTOR_SIZE; @@ -345,7 +345,7 @@ int ATA_ReadDMA(Uint8 Disk, Uint64 Address, Uint Count, void *Buffer) if( gaATA_IRQs[cont] == 0 ) { // Release controller lock - RELEASE( &giaATA_ControllerLock[ cont ] ); + Mutex_Release( &glaATA_ControllerLock[ cont ] ); Log_Warning("ATA", "Read timeout on disk %i (Reading sector 0x%llx)\n", Disk, Address); @@ -357,7 +357,7 @@ int ATA_ReadDMA(Uint8 Disk, Uint64 Address, Uint Count, void *Buffer) // Copy to destination buffer memcpy( Buffer, gATA_Buffers[cont], Count*SECTOR_SIZE ); // Release controller lock - RELEASE( &giaATA_ControllerLock[ cont ] ); + Mutex_Release( &glaATA_ControllerLock[ cont ] ); LEAVE('i', 0); return 0; @@ -384,7 +384,7 @@ int ATA_WriteDMA(Uint8 Disk, Uint64 Address, Uint Count, const void *Buffer) if(Count > MAX_DMA_SECTORS) return 1; // Get exclusive access to the disk controller - LOCK( &giaATA_ControllerLock[ cont ] ); + Mutex_Acquire( &glaATA_ControllerLock[ cont ] ); // Set Size gATA_PRDTs[ cont ].Bytes = Count * SECTOR_SIZE; @@ -437,11 +437,11 @@ int ATA_WriteDMA(Uint8 Disk, Uint64 Address, Uint Count, const void *Buffer) // If the IRQ is unset, return error if( gaATA_IRQs[cont] == 0 ) { // Release controller lock - RELEASE( &giaATA_ControllerLock[ cont ] ); + Mutex_Release( &glaATA_ControllerLock[ cont ] ); return 1; // Error } else { - RELEASE( &giaATA_ControllerLock[ cont ] ); + Mutex_Release( &glaATA_ControllerLock[ cont ] ); return 0; } }