git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added some very pedantic warning flags
[tpg/acess2.git]
/
Modules
/
Storage
/
ATA
/
io.c
diff --git
a/Modules/Storage/ATA/io.c
b/Modules/Storage/ATA/io.c
index
89fcdb9
..
44f774a
100644
(file)
--- 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
int gATA_IRQSec = 15;
volatile int gaATA_IRQs[2] = {0};
// - Locks to avoid tripping
-t
Spinlock gi
aATA_ControllerLock[2];
+t
Mutex gl
aATA_ControllerLock[2];
// - Buffers!
Uint8 gATA_Buffers[2][(MAX_DMA_SECTORS+0xFFF)&~0xFFF] __attribute__ ((section(".padata")));
// - PRDTs
// - 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
}
// Get exclusive access to the disk controller
-
LOCK( &gi
aATA_ControllerLock[ cont ] );
+
Mutex_Acquire( &gl
aATA_ControllerLock[ cont ] );
// Set Size
gATA_PRDTs[ cont ].Bytes = Count * SECTOR_SIZE;
// Set Size
gATA_PRDTs[ cont ].Bytes = Count * SECTOR_SIZE;
@@
-332,7
+332,10
@@
int ATA_ReadDMA(Uint8 Disk, Uint64 Address, Uint Count, void *Buffer)
// Wait for transfer to complete
timeoutTime = now() + ATA_TIMEOUT;
while( gaATA_IRQs[cont] == 0 && now() < timeoutTime)
// Wait for transfer to complete
timeoutTime = now() + ATA_TIMEOUT;
while( gaATA_IRQs[cont] == 0 && now() < timeoutTime)
- Threads_Yield();
+ {
+ HALT();
+// Threads_Yield();
+ }
// Complete Transfer
ATA_int_BusMasterWriteByte( cont << 3, 8 ); // Read and stop
// Complete Transfer
ATA_int_BusMasterWriteByte( cont << 3, 8 ); // Read and stop
@@
-345,7
+348,7
@@
int ATA_ReadDMA(Uint8 Disk, Uint64 Address, Uint Count, void *Buffer)
if( gaATA_IRQs[cont] == 0 ) {
// Release controller lock
if( gaATA_IRQs[cont] == 0 ) {
// Release controller lock
-
RELEASE( &gi
aATA_ControllerLock[ cont ] );
+
Mutex_Release( &gl
aATA_ControllerLock[ cont ] );
Log_Warning("ATA",
"Read timeout on disk %i (Reading sector 0x%llx)\n",
Disk, Address);
Log_Warning("ATA",
"Read timeout on disk %i (Reading sector 0x%llx)\n",
Disk, Address);
@@
-357,7
+360,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
// Copy to destination buffer
memcpy( Buffer, gATA_Buffers[cont], Count*SECTOR_SIZE );
// Release controller lock
-
RELEASE( &gi
aATA_ControllerLock[ cont ] );
+
Mutex_Release( &gl
aATA_ControllerLock[ cont ] );
LEAVE('i', 0);
return 0;
LEAVE('i', 0);
return 0;
@@
-384,7
+387,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
if(Count > MAX_DMA_SECTORS) return 1;
// Get exclusive access to the disk controller
-
LOCK( &gi
aATA_ControllerLock[ cont ] );
+
Mutex_Acquire( &gl
aATA_ControllerLock[ cont ] );
// Set Size
gATA_PRDTs[ cont ].Bytes = Count * SECTOR_SIZE;
// Set Size
gATA_PRDTs[ cont ].Bytes = Count * SECTOR_SIZE;
@@
-429,7
+432,10
@@
int ATA_WriteDMA(Uint8 Disk, Uint64 Address, Uint Count, const void *Buffer)
// Wait for transfer to complete
timeoutTime = now() + ATA_TIMEOUT;
while( gaATA_IRQs[cont] == 0 && now() < timeoutTime)
// Wait for transfer to complete
timeoutTime = now() + ATA_TIMEOUT;
while( gaATA_IRQs[cont] == 0 && now() < timeoutTime)
- Threads_Yield();
+ {
+// Threads_Yield();
+ HALT();
+ }
// Complete Transfer
ATA_int_BusMasterWriteByte( cont << 3, 0 ); // Write and stop
// Complete Transfer
ATA_int_BusMasterWriteByte( cont << 3, 0 ); // Write and stop
@@
-437,11
+443,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
// If the IRQ is unset, return error
if( gaATA_IRQs[cont] == 0 ) {
// Release controller lock
-
RELEASE( &gi
aATA_ControllerLock[ cont ] );
+
Mutex_Release( &gl
aATA_ControllerLock[ cont ] );
return 1; // Error
}
else {
return 1; // Error
}
else {
-
RELEASE( &gi
aATA_ControllerLock[ cont ] );
+
Mutex_Release( &gl
aATA_ControllerLock[ cont ] );
return 0;
}
}
return 0;
}
}
UCC
git Repository :: git.ucc.asn.au