AHCI: Difference between revisions

Jump to navigation Jump to search
311 bytes added ,  11 years ago
Added some extra error handling
[unchecked revision][unchecked revision]
(Added link to Haiku)
(Added some extra error handling)
Line 553:
{
port->is = (DWORD)-1; // Clear pending interrupt bits
int spin = 0; // Spin lock timeout counter
 
int slot = find_cmdslot(port);
if (slot == -1)
Line 600:
cmdfis->countl = LOBYTE(count);
cmdfis->counth = HIBYTE(count);
 
// The below loop waits until the port is no longer busy before issuing a new command
while ((port->tfd & (ATA_DEV_BUSY | ATA_DEV_DRQ)) && spin < 1000000)
{
spin++;
}
if (spin == 1000000)
{
trace_ahci("Port is hung\n");
return FALSE;
}
 
port->ci = 1<<slot; // Issue command
Line 606 ⟶ 617:
while (1)
{
if ((port->ci & (1<<slot)) == 0) // In some longer duration reads, it may be helpful to spin on the DPS bit in the PxIS port field as well
// in the PxIS port field as well (1 << 5)
if ((port->ci & (1<<slot)) == 0)
break;
if (port->is & HBA_PxIS_TFES) // Task file error
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu