|
Lines 77-82
Link Here
|
| 77 |
#else |
77 |
#else |
| 78 |
#define ATA_MASTERDEV(dev) (1) |
78 |
#define ATA_MASTERDEV(dev) (1) |
| 79 |
#endif |
79 |
#endif |
|
|
80 |
#define ATA_WAIT_DELAY (5000000) /* microseconds */ |
| 81 |
#define ATA_INTR_DELAY (10 * hz) /* ticks */ |
| 80 |
|
82 |
|
| 81 |
/* prototypes */ |
83 |
/* prototypes */ |
| 82 |
static int ata_probe(device_t); |
84 |
static int ata_probe(device_t); |
|
Lines 1431-1437
Link Here
|
| 1431 |
int statio = scp->ioaddr + ATA_STATUS; |
1433 |
int statio = scp->ioaddr + ATA_STATUS; |
| 1432 |
|
1434 |
|
| 1433 |
DELAY(1); |
1435 |
DELAY(1); |
| 1434 |
while (timeout < 5000000) { /* timeout 5 secs */ |
1436 |
while (timeout < ATA_WAIT_DELAY) { |
| 1435 |
scp->status = inb(statio); |
1437 |
scp->status = inb(statio); |
| 1436 |
|
1438 |
|
| 1437 |
/* if drive fails status, reselect the drive just to be sure */ |
1439 |
/* if drive fails status, reselect the drive just to be sure */ |
|
Lines 1457-1463
Link Here
|
| 1457 |
} |
1459 |
} |
| 1458 |
if (scp->status & ATA_S_ERROR) |
1460 |
if (scp->status & ATA_S_ERROR) |
| 1459 |
scp->error = inb(scp->ioaddr + ATA_ERROR); |
1461 |
scp->error = inb(scp->ioaddr + ATA_ERROR); |
| 1460 |
if (timeout >= 5000000) |
1462 |
if (timeout >= ATA_WAIT_DELAY) |
| 1461 |
return -1; |
1463 |
return -1; |
| 1462 |
if (!mask) |
1464 |
if (!mask) |
| 1463 |
return (scp->status & ATA_S_ERROR); |
1465 |
return (scp->status & ATA_S_ERROR); |
|
Lines 1514-1527
Link Here
|
| 1514 |
switch (flags) { |
1516 |
switch (flags) { |
| 1515 |
case ATA_WAIT_INTR: |
1517 |
case ATA_WAIT_INTR: |
| 1516 |
scp->active = ATA_WAIT_INTR; |
1518 |
scp->active = ATA_WAIT_INTR; |
| 1517 |
asleep((caddr_t)scp, PRIBIO, "atacmd", 10 * hz); |
1519 |
asleep((caddr_t)scp, PRIBIO, "atacmd", ATA_INTR_DELAY); |
| 1518 |
outb(scp->ioaddr + ATA_CMD, command); |
1520 |
outb(scp->ioaddr + ATA_CMD, command); |
| 1519 |
|
1521 |
|
| 1520 |
/* enable interrupt */ |
1522 |
/* enable interrupt */ |
| 1521 |
if (scp->flags & ATA_QUEUED) |
1523 |
if (scp->flags & ATA_QUEUED) |
| 1522 |
outb(scp->altioaddr, ATA_A_4BIT); |
1524 |
outb(scp->altioaddr, ATA_A_4BIT); |
| 1523 |
|
1525 |
|
| 1524 |
if (await(PRIBIO, 10 * hz)) { |
1526 |
if (await(PRIBIO, ATA_INTR_DELAY)) { |
| 1525 |
ata_printf(scp, device, "ata_command: timeout waiting for intr\n"); |
1527 |
ata_printf(scp, device, "ata_command: timeout waiting for intr\n"); |
| 1526 |
scp->active = ATA_IDLE; |
1528 |
scp->active = ATA_IDLE; |
| 1527 |
error = -1; |
1529 |
error = -1; |