Changeset e50cd7f in mainline for uspace/srv/bd/ata_bd/ata_bd.c
- Timestamp:
- 2011-04-17T19:17:55Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63517c2, cfbbe1d3
- Parents:
- ef354b6 (diff), 8595577b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/ata_bd/ata_bd.c
ref354b6 re50cd7f 372 372 uint16_t w; 373 373 uint8_t c; 374 uint16_t bc; 374 375 size_t pos, len; 375 376 int rc; … … 387 388 } else if (rc == EIO) { 388 389 /* 389 * There is something, but not a register device. 390 * It could be a packet device. 390 * There is something, but not a register device. Check to see 391 * whether the IDENTIFY command left the packet signature in 392 * the registers in case this is a packet device. 393 * 394 * According to the ATA specification, the LBA low and 395 * interrupt reason registers should be set to 0x01. However, 396 * there are many devices that do not follow this and only set 397 * the byte count registers. So, only check these. 391 398 */ 392 rc = identify_pkt_dev(disk_id, &idata); 393 if (rc == EOK) { 394 /* We have a packet device. */ 395 d->dev_type = ata_pkt_dev; 399 bc = ((uint16_t)pio_read_8(&cmd->cylinder_high) << 8) | 400 pio_read_8(&cmd->cylinder_low); 401 402 if (bc == PDEV_SIGNATURE_BC) { 403 rc = identify_pkt_dev(disk_id, &idata); 404 if (rc == EOK) { 405 /* We have a packet device. */ 406 d->dev_type = ata_pkt_dev; 407 } else { 408 return EIO; 409 } 396 410 } else { 397 411 /* Nope. Something's there, but not recognized. */ … … 403 417 } 404 418 405 printf("device caps: 0x%04x\n", idata.caps);406 419 if (d->dev_type == ata_pkt_dev) { 407 420 /* Packet device */ … … 566 579 567 580 /* 568 * This is where we would most likely expect a non-existing device to 569 * show up by not setting SR_DRDY. 581 * Do not wait for DRDY to be set in case this is a packet device. 582 * We determine whether the device is present by waiting for DRQ to be 583 * set after issuing the command. 570 584 */ 571 if (wait_status( SR_DRDY, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK)585 if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK) 572 586 return ETIMEOUT; 573 587 … … 577 591 return ETIMEOUT; 578 592 593 /* 594 * If ERR is set, this may be a packet device, so return EIO to cause 595 * the caller to check for one. 596 */ 597 if ((status & SR_ERR) != 0) { 598 return EIO; 599 } 600 601 if (wait_status(SR_DRQ, ~SR_BSY, &status, TIMEOUT_PROBE) != EOK) 602 return ETIMEOUT; 603 579 604 /* Read data from the disk buffer. */ 580 605 581 if ((status & SR_DRQ) != 0) { 582 for (i = 0; i < identify_data_size / 2; i++) { 583 data = pio_read_16(&cmd->data_port); 584 ((uint16_t *) buf)[i] = data; 585 } 586 } 587 588 if ((status & SR_ERR) != 0) { 589 return EIO; 606 for (i = 0; i < identify_data_size / 2; i++) { 607 data = pio_read_16(&cmd->data_port); 608 ((uint16_t *) buf)[i] = data; 590 609 } 591 610
Note:
See TracChangeset
for help on using the changeset viewer.