VirtualBox

Changeset 78729 in vbox for trunk/src/VBox/Devices/PC/BIOS


Ignore:
Timestamp:
May 24, 2019 1:27:36 PM (6 years ago)
Author:
vboxsync
Message:

BIOS: After ATA reset, first wait for drive not busy, then read other registers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/ata.c

    r78572 r78729  
    11/* $Id$ */
    22/** @file
    3  * PC BIOS - ???
     3 * PC BIOS - ATA disk support.
    44 */
    55
     
    177177    outb(iobase2+ATA_CB_DC, ATA_CB_DC_HD15 | ATA_CB_DC_NIEN);
    178178
     179    // 8.2.1 (h) -- wait for not BSY
     180    max=0xffff; /* The ATA specification says that the drive may be busy for up to 30 seconds. */
     181    while(--max>0) {
     182        uint8_t status = inb(iobase1+ATA_CB_STAT);
     183        if ((status & ATA_CB_STAT_BSY) == 0)
     184            break;
     185        pdelay=0xffff;
     186        while (--pdelay>0) {
     187            /* nothing */
     188        }
     189    }
     190
    179191    if (bios_dsk->devices[device].type != DSK_TYPE_NONE) {
    180192        // 8.2.1 (g) -- check for sc==sn==0x01
     
    185197
    186198        if ( (sc==0x01) && (sn==0x01) ) {
    187             // 8.2.1 (h) -- wait for not BSY
    188             max=0xffff; /* The ATA specification says that the drive may be busy for up to 30 seconds. */
     199            // 8.2.1 (i) -- wait for DRDY
     200            max = 0x10; /* Speed up for virtual drives. Disks are immediately ready, CDs never */
    189201            while(--max>0) {
    190202                uint8_t status = inb(iobase1+ATA_CB_STAT);
    191                 if ((status & ATA_CB_STAT_BSY) == 0)
     203                if ((status & ATA_CB_STAT_RDY) != 0)
    192204                    break;
    193                 pdelay=0xffff;
    194                 while (--pdelay>0) {
    195                     /* nothing */
    196                 }
    197             }
    198         }
    199     }
    200 
    201     // 8.2.1 (i) -- wait for DRDY
    202     max = 0x10; /* Speed up for virtual drives. Disks are immediately ready, CDs never */
    203     while(--max>0) {
    204         uint8_t status = inb(iobase1+ATA_CB_STAT);
    205         if ((status & ATA_CB_STAT_RDY) != 0)
    206             break;
     205            }
     206        }
    207207    }
    208208
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette