Changes in / [b2a081ae:28a3e74] in mainline


Ignore:
Location:
uspace/srv/bd/ata_bd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/ata_bd/ata_bd.c

    rb2a081ae r28a3e74  
    372372        uint16_t w;
    373373        uint8_t c;
    374         uint16_t bc;
    375374        size_t pos, len;
    376375        int rc;
     
    388387        } else if (rc == EIO) {
    389388                /*
    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.
    398391                 */
    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;
    410396                } else {
    411397                        /* Nope. Something's there, but not recognized. */
     
    417403        }
    418404
     405        printf("device caps: 0x%04x\n", idata.caps);
    419406        if (d->dev_type == ata_pkt_dev) {
    420407                /* Packet device */
     
    579566
    580567        /*
    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.
    584570         */
    585         if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK)
     571        if (wait_status(SR_DRDY, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK)
    586572                return ETIMEOUT;
    587573
     
    591577                return ETIMEOUT;
    592578
    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
    597588        if ((status & SR_ERR) != 0) {
    598589                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;
    609590        }
    610591
  • uspace/srv/bd/ata_bd/ata_hw.h

    rb2a081ae r28a3e74  
    293293};
    294294
    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 
    303295#endif
    304296
Note: See TracChangeset for help on using the changeset viewer.