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
Kernel/PTYs - Fixed client writes not blocking
[tpg/acess2.git]
/
KernelLand
/
Modules
/
Storage
/
ATA
/
io.c
diff --git
a/KernelLand/Modules/Storage/ATA/io.c
b/KernelLand/Modules/Storage/ATA/io.c
index
9f471b7
..
b15918e
100644
(file)
--- a/
KernelLand/Modules/Storage/ATA/io.c
+++ b/
KernelLand/Modules/Storage/ATA/io.c
@@
-249,15
+249,22
@@
Uint64 ATA_GetDiskSize(int Disk)
}
// Poll until BSY clears or ERR is set
}
// Poll until BSY clears or ERR is set
+ tTime endtime = now() + 2*1000; // 2 second timeout
// TODO: Timeout?
// TODO: Timeout?
- while( (val & 0x80) && !(val & 1) )
+ while( (val & 0x80) && !(val & 1)
&& now() < endtime
)
val = inb(base+7);
LOG("BSY unset (0x%x)", val);
// and, wait for DRQ to set
val = inb(base+7);
LOG("BSY unset (0x%x)", val);
// and, wait for DRQ to set
- while( !(val & 0x08) && !(val & 1))
+ while( !(val & 0x08) && !(val & 1)
&& now() < endtime
)
val = inb(base+7);
LOG("DRQ set (0x%x)", val);
val = inb(base+7);
LOG("DRQ set (0x%x)", val);
+ if(now() >= endtime) {
+ Log_Warning("ATA", "Timeout on ATA IDENTIFY (Disk %i)", Disk);
+ LEAVE('i', 0);
+ return 0;
+ }
+
// Check for an error
if(val & 1) {
LEAVE('i', 0);
// Check for an error
if(val & 1) {
LEAVE('i', 0);
UCC
git Repository :: git.ucc.asn.au