Changeset 268 for trunk/hal


Ignore:
Timestamp:
Jul 21, 2017, 3:36:16 PM (7 years ago)
Author:
max@…
Message:

Mmh, the wait must be done for each block, not for each operation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/drivers/ioc_ata.c

    r221 r268  
    7878        uint8_t status;
    7979
    80         while (!(ata_cbr_read(ATA_SR) & ATA_SR_DRQ));
    81         status = ata_cbr_read(ATA_SR);
     80        while (1) {
     81                status = ata_cbr_read(ATA_SR);
     82                if (status & ATA_SR_DRQ)
     83                        break;
     84        }
     85
    8286        return ((status & ATA_SR_ERR) ? -1 : 0);
    8387}
     
    102106        int idx;
    103107
    104         /* wait for the drive to signal that it's ready */
    105         if (ata_wait() == -1)
    106                 x86_panic("ata_wait");
    107 
    108108        for (idx = 0; idx < 256 * count; idx++) {
     109                /* wait for the drive to signal that it's ready */
     110                if (ata_wait() == -1)
     111                        x86_panic("ata_wait");
     112
     113                /* read */
    109114                tmpword = ata_data_read();
    110115                buf[idx * 2] = (uint8_t)(tmpword & 0xFF);
Note: See TracChangeset for help on using the changeset viewer.