Changeset 44692 in vbox
- Timestamp:
- Feb 14, 2013 3:44:30 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83788
- Location:
- trunk/src/VBox/Devices/PC/BIOS
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/ata.c
r44528 r44692 757 757 758 758 if (status & ATA_CB_STAT_ERR) { 759 BX_DEBUG_ATA("%s: readerror\n", __func__);759 BX_DEBUG_ATA("%s: write error\n", __func__); 760 760 // Enable interrupts 761 761 outb(iobase2+ATA_CB_DC, ATA_CB_DC_HD15); … … 949 949 } 950 950 951 if (status & ATA_CB_STAT_ ERR) {951 if (status & ATA_CB_STAT_CHK) { 952 952 BX_DEBUG_ATA("%s: error, status is %02x\n", __func__, status); 953 953 // Enable interrupts … … 988 988 break; 989 989 990 if (status & ATA_CB_STAT_ ERR) {990 if (status & ATA_CB_STAT_CHK) { 991 991 BX_DEBUG_ATA("%s: error (status %02x)\n", __func__, status); 992 992 // Enable interrupts … … 996 996 997 997 // Device must be ready to send data 998 if ( (status & (ATA_CB_STAT_BSY | ATA_CB_STAT_RDY | ATA_CB_STAT_DRQ | ATA_CB_STAT_ ERR) )998 if ( (status & (ATA_CB_STAT_BSY | ATA_CB_STAT_RDY | ATA_CB_STAT_DRQ | ATA_CB_STAT_CHK) ) 999 999 != (ATA_CB_STAT_RDY | ATA_CB_STAT_DRQ) ) { 1000 1000 BX_DEBUG_ATA("%s: not ready (status %02x)\n", __func__, status); … … 1094 1094 1095 1095 // Final check, device must be ready 1096 if ( (status & (ATA_CB_STAT_BSY | ATA_CB_STAT_RDY | ATA_CB_STAT_DF | ATA_CB_STAT_DRQ | ATA_CB_STAT_ ERR) )1096 if ( (status & (ATA_CB_STAT_BSY | ATA_CB_STAT_RDY | ATA_CB_STAT_DF | ATA_CB_STAT_DRQ | ATA_CB_STAT_CHK) ) 1097 1097 != ATA_CB_STAT_RDY ) { 1098 1098 BX_DEBUG_ATA("%s: not ready (status %02x)\n", __func__, (unsigned) status); … … 1107 1107 } 1108 1108 1109 // --------------------------------------------------------------------------- 1110 // ATA/ATAPI driver : reset device; intended for ATAPI devices 1111 // --------------------------------------------------------------------------- 1112 // returns 1113 // 0 : no error 1114 // 1 : error 1115 uint16_t ata_soft_reset(uint16_t device) 1116 { 1117 uint16_t iobase1, iobase2; 1118 uint8_t channel, slave; 1119 uint8_t status; 1120 bio_dsk_t __far *bios_dsk; 1121 1122 bios_dsk = read_word(0x0040, 0x000E) :> &EbdaData->bdisk; 1123 1124 channel = device / 2; 1125 slave = device % 2; 1126 1127 iobase1 = bios_dsk->channels[channel].iobase1; 1128 iobase2 = bios_dsk->channels[channel].iobase2; 1129 1130 /* Send a reset command to the device. */ 1131 outb(iobase2 + ATA_CB_DC, ATA_CB_DC_HD15 | ATA_CB_DC_NIEN); 1132 outb(iobase1 + ATA_CB_DH, slave ? ATA_CB_DH_DEV1 : ATA_CB_DH_DEV0); 1133 outb(iobase1 + ATA_CB_CMD, ATA_CMD_DEVICE_RESET); 1134 1135 /* Wait for the device to clear BSY. */ 1136 while (1) { 1137 status = inb(iobase1 + ATA_CB_STAT); 1138 if ( !(status & ATA_CB_STAT_BSY) ) break; 1139 } 1140 1141 /* Final check, device must be ready */ 1142 if ( (status & (ATA_CB_STAT_BSY | ATA_CB_STAT_RDY | ATA_CB_STAT_DF | ATA_CB_STAT_DRQ | ATA_CB_STAT_CHK) ) 1143 != ATA_CB_STAT_RDY ) { 1144 BX_DEBUG_ATA("%s: not ready (status %02x)\n", __func__, (unsigned) status); 1145 /* Enable interrupts */ 1146 outb(iobase2 + ATA_CB_DC, ATA_CB_DC_HD15); 1147 return 1; 1148 } 1149 1150 /* Enable interrupts */ 1151 outb(iobase2+ATA_CB_DC, ATA_CB_DC_HD15); 1152 return 0; 1153 } 1154 1109 1155 1110 1156 // --------------------------------------------------------------------------- -
trunk/src/VBox/Devices/PC/BIOS/ebda.h
r44528 r44692 222 222 uint16_t header, uint32_t length, uint8_t inout, char __far *buffer); 223 223 224 extern uint16_t ata_soft_reset(uint16_t device); 225 224 226 /* All BIOS disk information. Disk-related code in the BIOS should not need 225 227 * anything outside of this structure. -
trunk/src/VBox/Devices/PC/BIOS/eltorito.c
r44528 r44692 109 109 }; 110 110 111 /* Generic reset routine signature. */ 112 typedef uint16_t (* cd_rst_func)(uint16_t device_id); 113 114 /* Pointers to HW specific CD-ROM reset routines. */ 115 cd_rst_func softrst[DSKTYP_CNT] = { 116 [DSK_TYPE_ATAPI] = { ata_soft_reset }, 117 #ifdef VBOX_WITH_AHCI 118 [DSK_TYPE_AHCI] = NULL, 119 #endif 120 #ifdef VBOX_WITH_SCSI 121 [DSK_TYPE_SCSI] = NULL, 122 #endif 123 }; 124 125 111 126 // --------------------------------------------------------------------------- 112 127 // Start of El-Torito boot functions … … 474 489 switch (GET_AH()) { 475 490 491 case 0x00: /* disk controller reset */ 492 if (pktacc[bios_dsk->devices[device].type]) 493 { 494 status = softrst[bios_dsk->devices[device].type](device); 495 } 496 goto int13_success; 497 break; 476 498 // all those functions return SUCCESS 477 case 0x00: /* disk controller reset */478 499 case 0x09: /* initialize drive parameters */ 479 500 case 0x0c: /* seek to specified cylinder */
Note:
See TracChangeset
for help on using the changeset viewer.