Changeset b2a081ae in mainline
- Timestamp:
- 2011-04-02T12:49:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8aa2b3b, 97186929, f3e2663
- Parents:
- 28a3e74 (diff), 029b13c (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. - Location:
- uspace/srv/bd/ata_bd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/ata_bd/ata_bd.c
r28a3e74 rb2a081ae 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 -
uspace/srv/bd/ata_bd/ata_hw.h
r28a3e74 rb2a081ae 293 293 }; 294 294 295 enum ata_pdev_signature { 296 /** 297 * Signature put by a packet device in byte count register 298 * in response to Identify command. 299 */ 300 PDEV_SIGNATURE_BC = 0xEB14 301 }; 302 295 303 #endif 296 304
Note:
See TracChangeset
for help on using the changeset viewer.