Changes in / [b2a081ae:28a3e74] in mainline
- Location:
- uspace/srv/bd/ata_bd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/ata_bd/ata_bd.c
rb2a081ae r28a3e74 372 372 uint16_t w; 373 373 uint8_t c; 374 uint16_t bc;375 374 size_t pos, len; 376 375 int rc; … … 388 387 } else if (rc == EIO) { 389 388 /* 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. 389 * There is something, but not a register device. 390 * It could be a packet device. 398 391 */ 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 } 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; 410 396 } else { 411 397 /* Nope. Something's there, but not recognized. */ … … 417 403 } 418 404 405 printf("device caps: 0x%04x\n", idata.caps); 419 406 if (d->dev_type == ata_pkt_dev) { 420 407 /* Packet device */ … … 579 566 580 567 /* 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. 568 * This is where we would most likely expect a non-existing device to 569 * show up by not setting SR_DRDY. 584 570 */ 585 if (wait_status( 0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK)571 if (wait_status(SR_DRDY, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK) 586 572 return ETIMEOUT; 587 573 … … 591 577 return ETIMEOUT; 592 578 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 */ 579 /* Read data from the disk buffer. */ 580 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 597 588 if ((status & SR_ERR) != 0) { 598 589 return EIO; 599 }600 601 if (wait_status(SR_DRQ, ~SR_BSY, &status, TIMEOUT_PROBE) != EOK)602 return ETIMEOUT;603 604 /* Read data from the disk buffer. */605 606 for (i = 0; i < identify_data_size / 2; i++) {607 data = pio_read_16(&cmd->data_port);608 ((uint16_t *) buf)[i] = data;609 590 } 610 591 -
uspace/srv/bd/ata_bd/ata_hw.h
rb2a081ae r28a3e74 293 293 }; 294 294 295 enum ata_pdev_signature {296 /**297 * Signature put by a packet device in byte count register298 * in response to Identify command.299 */300 PDEV_SIGNATURE_BC = 0xEB14301 };302 303 295 #endif 304 296
Note:
See TracChangeset
for help on using the changeset viewer.