Changeset 38706 in vbox for trunk/src/VBox/Devices/PC/BIOS-new
- Timestamp:
- Sep 9, 2011 12:56:49 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS-new/disk.c
r38699 r38706 68 68 void BIOSCALL int13_harddisk(disk_regs_t r) 69 69 { 70 uint32_t lba;71 uint16_t ebda_seg=read_word(0x0040,0x000E);72 uint16_t cylinder, head, sector;73 uint16_t npc, nph, npspt, nlc, nlh, nlspt;74 uint 16_t count;75 uint8_t device, status;76 uint8_t scsi_device;70 uint32_t lba; 71 uint16_t cylinder, head, sector; 72 uint16_t npc, nph, npspt, nlc, nlh, nlspt; 73 uint16_t count; 74 uint8_t device, status; 75 uint8_t scsi_device; 76 ebda_data_t __far *ebda_data; 77 77 78 78 BX_DEBUG_INT13_HD("%s: AX=%04x BX=%04x CX=%04x DX=%04x ES=%04x\n", __func__, AX, BX, CX, DX, ES); 79 79 80 ebda_data = read_word(0x0040,0x000E) :> 0; 80 81 write_byte(0x0040, 0x008e, 0); // clear completion flag 81 82 … … 87 88 88 89 // Get the ata channel 89 device =read_byte(ebda_seg,(uint16_t)&EbdaData->ata.hdidmap[GET_ELDL()-0x80]);90 device = ebda_data->ata.hdidmap[GET_ELDL()-0x80]; 90 91 91 92 // basic check : device has to be valid … … 135 136 #endif 136 137 { 137 nlc = read_word(ebda_seg, (uint16_t)&EbdaData->ata.devices[device].lchs.cylinders);138 nlh = read_word(ebda_seg, (uint16_t)&EbdaData->ata.devices[device].lchs.heads);139 nlspt = read_word(ebda_seg, (uint16_t)&EbdaData->ata.devices[device].lchs.spt);138 nlc = ebda_data->ata.devices[device].lchs.cylinders; 139 nlh = ebda_data->ata.devices[device].lchs.heads; 140 nlspt = ebda_data->ata.devices[device].lchs.spt; 140 141 } 141 142 #ifdef VBOX_WITH_SCSI … … 143 144 scsi_device = VBOX_GET_SCSI_DEVICE(device); 144 145 145 nlc = read_word(ebda_seg, (uint16_t)&EbdaData->scsi.devices[scsi_device].device_info.lchs.cylinders);146 nlh = read_word(ebda_seg, (uint16_t)&EbdaData->scsi.devices[scsi_device].device_info.lchs.heads);147 nlspt = read_word(ebda_seg, (uint16_t)&EbdaData->scsi.devices[scsi_device].device_info.lchs.spt);146 nlc = ebda_data->scsi.devices[scsi_device].device_info.lchs.cylinders; 147 nlh = ebda_data->scsi.devices[scsi_device].device_info.lchs.heads; 148 nlspt = ebda_data->scsi.devices[scsi_device].device_info.lchs.spt; 148 149 } 149 150 #endif … … 163 164 #endif 164 165 { 165 nph = read_word(ebda_seg, (uint16_t)&EbdaData->ata.devices[device].pchs.heads);166 npspt = read_word(ebda_seg, (uint16_t)&EbdaData->ata.devices[device].pchs.spt);166 nph = ebda_data->ata.devices[device].pchs.heads; 167 npspt = ebda_data->ata.devices[device].pchs.spt; 167 168 } 168 169 #ifdef VBOX_WITH_SCSI 169 170 else { 170 171 scsi_device = VBOX_GET_SCSI_DEVICE(device); 171 nph = read_word(ebda_seg, (uint16_t)&EbdaData->scsi.devices[scsi_device].device_info.pchs.heads);172 npspt = read_word(ebda_seg, (uint16_t)&EbdaData->scsi.devices[scsi_device].device_info.pchs.spt);172 nph = ebda_data->scsi.devices[scsi_device].device_info.pchs.heads; 173 npspt = ebda_data->scsi.devices[scsi_device].device_info.pchs.spt; 173 174 } 174 175 #endif … … 195 196 #endif 196 197 { 197 write_word(ebda_seg,(uint16_t)&EbdaData->ata.devices[device].blksize,count * 0x200);198 ebda_data->ata.devices[device].blksize = count * 0x200; 198 199 status=ata_cmd_data_in(device, ATA_CMD_READ_MULTIPLE, count, cylinder, head, sector, lba, MK_FP(ES, BX)); 199 write_word(ebda_seg,(uint16_t)&EbdaData->ata.devices[device].blksize,0x200);200 ebda_data->ata.devices[device].blksize = 0x200; 200 201 } 201 202 } else { … … 209 210 210 211 // Set nb of sector transferred 211 SET_AL( read_word(ebda_seg, (uint16_t)&EbdaData->ata.trsfsectors));212 SET_AL(ebda_data->ata.trsfsectors); 212 213 213 214 if (status != 0) { … … 233 234 #endif 234 235 { 235 nlc = read_word(ebda_seg, (uint16_t)&EbdaData->ata.devices[device].lchs.cylinders);236 nlh = read_word(ebda_seg, (uint16_t)&EbdaData->ata.devices[device].lchs.heads);237 nlspt = read_word(ebda_seg, (uint16_t)&EbdaData->ata.devices[device].lchs.spt);236 nlc = ebda_data->ata.devices[device].lchs.cylinders; 237 nlh = ebda_data->ata.devices[device].lchs.heads; 238 nlspt = ebda_data->ata.devices[device].lchs.spt; 238 239 } 239 240 #ifdef VBOX_WITH_SCSI 240 241 else { 241 242 scsi_device = VBOX_GET_SCSI_DEVICE(device); 242 nlc = read_word(ebda_seg, (uint16_t)&EbdaData->scsi.devices[scsi_device].device_info.lchs.cylinders);243 nlh = read_word(ebda_seg, (uint16_t)&EbdaData->scsi.devices[scsi_device].device_info.lchs.heads);244 nlspt = read_word(ebda_seg, (uint16_t)&EbdaData->scsi.devices[scsi_device].device_info.lchs.spt);245 } 246 #endif 247 248 count = read_byte(ebda_seg, (uint16_t)&EbdaData->ata.hdcount);243 nlc = ebda_data->scsi.devices[scsi_device].device_info.lchs.cylinders; 244 nlh = ebda_data->scsi.devices[scsi_device].device_info.lchs.heads; 245 nlspt = ebda_data->scsi.devices[scsi_device].device_info.lchs.spt; 246 } 247 #endif 248 249 count = ebda_data->ata.hdcount; 249 250 /* Maximum cylinder number is just one less than the number of cylinders. */ 250 251 nlc = nlc - 1; /* 0 based , last sector not used */ … … 265 266 266 267 // Read the status from controller 267 status = inb( read_word(ebda_seg, (uint16_t)&EbdaData->ata.channels[device/2].iobase1)+ ATA_CB_STAT);268 status = inb(ebda_data->ata.channels[device/2].iobase1 + ATA_CB_STAT); 268 269 if ( (status & ( ATA_CB_STAT_BSY | ATA_CB_STAT_RDY )) == ATA_CB_STAT_RDY ) { 269 270 goto int13_success; … … 281 282 #endif 282 283 { 283 npc = read_word(ebda_seg, (uint16_t)&EbdaData->ata.devices[device].pchs.cylinders);284 nph = read_word(ebda_seg, (uint16_t)&EbdaData->ata.devices[device].pchs.heads);285 npspt = read_word(ebda_seg, (uint16_t)&EbdaData->ata.devices[device].pchs.spt);284 npc = ebda_data->ata.devices[device].pchs.cylinders; 285 nph = ebda_data->ata.devices[device].pchs.heads; 286 npspt = ebda_data->ata.devices[device].pchs.spt; 286 287 } 287 288 #ifdef VBOX_WITH_SCSI 288 289 else { 289 290 scsi_device = VBOX_GET_SCSI_DEVICE(device); 290 npc = read_word(ebda_seg, (uint16_t)&EbdaData->scsi.devices[scsi_device].device_info.pchs.cylinders);291 nph = read_word(ebda_seg, (uint16_t)&EbdaData->scsi.devices[scsi_device].device_info.pchs.heads);292 npspt = read_word(ebda_seg, (uint16_t)&EbdaData->scsi.devices[scsi_device].device_info.pchs.spt);291 npc = ebda_data->scsi.devices[scsi_device].device_info.pchs.cylinders; 292 nph = ebda_data->scsi.devices[scsi_device].device_info.pchs.heads; 293 npspt = ebda_data->scsi.devices[scsi_device].device_info.pchs.spt; 293 294 } 294 295 #endif
Note:
See TracChangeset
for help on using the changeset viewer.