vbox的更動 39346 路徑 trunk/src/VBox/Devices/PC/BIOS-new/disk.c
- 時間撮記:
- 2011-11-17 下午02:31:57 (13 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/PC/BIOS-new/disk.c
r39340 r39346 73 73 uint16_t count; 74 74 uint8_t device, status; 75 uint8_t scsi_device;76 75 ebda_data_t __far *ebda_data; 77 76 … … 132 131 } 133 132 134 #ifdef VBOX_WITH_SCSI 135 if (!VBOX_IS_SCSI_DEVICE(device)) 136 #endif 137 { 138 nlc = ebda_data->bdisk.devices[device].lchs.cylinders; 139 nlh = ebda_data->bdisk.devices[device].lchs.heads; 140 nlspt = ebda_data->bdisk.devices[device].lchs.spt; 141 } 142 #ifdef VBOX_WITH_SCSI 143 else { 144 scsi_device = VBOX_GET_SCSI_DEVICE(device); 145 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; 149 } 150 #endif 151 152 // sanity check on cyl heads, sec 133 /* Get the logical CHS geometry. */ 134 nlc = ebda_data->bdisk.devices[device].lchs.cylinders; 135 nlh = ebda_data->bdisk.devices[device].lchs.heads; 136 nlspt = ebda_data->bdisk.devices[device].lchs.spt; 137 138 /* Sanity check the geometry. */ 153 139 if( (cylinder >= nlc) || (head >= nlh) || (sector > nlspt )) { 154 140 BX_INFO("%s: function %02x, disk %02x, parameters out of range %04x/%04x/%04x!\n", __func__, GET_AH(), GET_DL(), cylinder, head, sector); … … 160 146 goto int13_success; 161 147 162 #ifdef VBOX_WITH_SCSI 163 if (!VBOX_IS_SCSI_DEVICE(device)) 164 #endif 165 { 166 nph = ebda_data->bdisk.devices[device].pchs.heads; 167 npspt = ebda_data->bdisk.devices[device].pchs.spt; 168 } 169 #ifdef VBOX_WITH_SCSI 170 else { 171 scsi_device = VBOX_GET_SCSI_DEVICE(device); 172 nph = ebda_data->scsi.devices[scsi_device].device_info.pchs.heads; 173 npspt = ebda_data->scsi.devices[scsi_device].device_info.pchs.spt; 174 } 175 #endif 176 177 // if needed, translate lchs to lba, and execute command 178 #ifdef VBOX_WITH_SCSI 148 /* Now get relevant the physical geometry information. */ 149 nph = ebda_data->bdisk.devices[device].pchs.heads; 150 npspt = ebda_data->bdisk.devices[device].pchs.spt; 151 152 /* If required, translate LCHS to LBA and execute command. */ 153 //@todo: The IS_SCSI_DEVICE check should be redundant... 179 154 if (( (nph != nlh) || (npspt != nlspt)) || VBOX_IS_SCSI_DEVICE(device)) { 180 155 lba = ((((uint32_t)cylinder * (uint32_t)nlh) + (uint32_t)head) * (uint32_t)nlspt) + (uint32_t)sector - 1; 181 156 sector = 0; // this forces the command to be lba 182 157 } 183 #else184 if (( (nph != nlh) || (npspt != nlspt)) ) {185 lba = ((((uint32_t)cylinder * (uint32_t)nlh) + (uint32_t)head) * (uint32_t)nlspt) + (uint32_t)sector - 1;186 sector = 0; // this forces the command to be lba187 }188 #endif189 158 190 159 if ( GET_AH() == 0x02 ) … … 229 198 case 0x08: /* read disk drive parameters */ 230 199 231 // Get logical geometry from table 232 #ifdef VBOX_WITH_SCSI 233 if (!VBOX_IS_SCSI_DEVICE(device)) 234 #endif 235 { 236 nlc = ebda_data->bdisk.devices[device].lchs.cylinders; 237 nlh = ebda_data->bdisk.devices[device].lchs.heads; 238 nlspt = ebda_data->bdisk.devices[device].lchs.spt; 239 } 240 #ifdef VBOX_WITH_SCSI 241 else { 242 scsi_device = VBOX_GET_SCSI_DEVICE(device); 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 200 /* Get the logical geometry from internal table. */ 201 nlc = ebda_data->bdisk.devices[device].lchs.cylinders; 202 nlh = ebda_data->bdisk.devices[device].lchs.heads; 203 nlspt = ebda_data->bdisk.devices[device].lchs.spt; 248 204 249 205 count = ebda_data->bdisk.hdcount; … … 277 233 case 0x15: /* read disk drive size */ 278 234 279 // Get physical geometry from table 280 #ifdef VBOX_WITH_SCSI 281 if (!VBOX_IS_SCSI_DEVICE(device)) 282 #endif 283 { 284 npc = ebda_data->bdisk.devices[device].pchs.cylinders; 285 nph = ebda_data->bdisk.devices[device].pchs.heads; 286 npspt = ebda_data->bdisk.devices[device].pchs.spt; 287 } 288 #ifdef VBOX_WITH_SCSI 289 else { 290 scsi_device = VBOX_GET_SCSI_DEVICE(device); 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; 294 } 295 #endif 296 297 // Compute sector count seen by int13 235 /* Get the physical geometry from internal table. */ 236 npc = ebda_data->bdisk.devices[device].pchs.cylinders; 237 nph = ebda_data->bdisk.devices[device].pchs.heads; 238 npspt = ebda_data->bdisk.devices[device].pchs.spt; 239 240 /* Calculate sector count seen by old style INT 13h. */ 298 241 lba = (uint32_t)npc * (uint32_t)nph * (uint32_t)npspt; 299 242 CX = lba >> 16; … … 346 289 uint16_t size, count; 347 290 uint8_t device, status; 348 uint8_t scsi_device;349 291 ebda_data_t __far *ebda_data; 350 292 int13ext_t __far *i13_ext; … … 402 344 lba = i13_ext->lba1; 403 345 404 #ifdef VBOX_WITH_SCSI405 if (VBOX_IS_SCSI_DEVICE(device))406 {407 if (lba >= ebda_data->scsi.devices[VBOX_GET_SCSI_DEVICE(device)].device_info.sectors ) {408 BX_INFO("%s: function %02x. LBA out of range\n", __func__, GET_AH());409 goto int13x_fail;410 }411 }412 else413 #endif414 346 if (lba >= ebda_data->bdisk.devices[device].sectors) { 415 347 BX_INFO("%s: function %02x. LBA out of range\n", __func__, GET_AH()); … … 475 407 size = dpt->size; 476 408 477 / / Buffer is too small478 if (size < 0x1a)409 /* Check if buffer is large enough. */ 410 if (size < 0x1a) 479 411 goto int13x_fail; 480 412 481 / / EDD 1.x482 if (size >= 0x1a) {413 /* Fill in EDD 1.x table. */ 414 if (size >= 0x1a) { 483 415 uint16_t blksize; 484 416 485 #ifdef VBOX_WITH_SCSI 486 if (!VBOX_IS_SCSI_DEVICE(device)) 487 #endif 488 { 489 npc = ebda_data->bdisk.devices[device].pchs.cylinders; 490 nph = ebda_data->bdisk.devices[device].pchs.heads; 491 npspt = ebda_data->bdisk.devices[device].pchs.spt; 492 lba = ebda_data->bdisk.devices[device].sectors; 493 blksize = ebda_data->bdisk.devices[device].blksize; 494 } 495 #ifdef VBOX_WITH_SCSI 496 else { 497 scsi_device = VBOX_GET_SCSI_DEVICE(device); 498 npc = ebda_data->scsi.devices[scsi_device].device_info.pchs.cylinders; 499 nph = ebda_data->scsi.devices[scsi_device].device_info.pchs.heads; 500 npspt = ebda_data->scsi.devices[scsi_device].device_info.pchs.spt; 501 lba = ebda_data->scsi.devices[scsi_device].device_info.sectors; 502 blksize = ebda_data->scsi.devices[scsi_device].device_info.blksize; 503 } 504 #endif 417 npc = ebda_data->bdisk.devices[device].pchs.cylinders; 418 nph = ebda_data->bdisk.devices[device].pchs.heads; 419 npspt = ebda_data->bdisk.devices[device].pchs.spt; 420 lba = ebda_data->bdisk.devices[device].sectors; 421 blksize = ebda_data->bdisk.devices[device].blksize; 422 505 423 dpt->size = 0x1a; 506 424 dpt->infos = 0x02; // geometry is valid … … 513 431 } 514 432 515 / / EDD 2.x516 if (size >= 0x1e) {433 /* Fill in EDD 2.x table. */ 434 if (size >= 0x1e) { 517 435 uint8_t channel, irq, mode, checksum, i, translation; 518 436 uint16_t iobase1, iobase2, options; … … 555 473 } 556 474 557 / / EDD 3.x475 /* Fill in EDD 3.x table. */ 558 476 if(size >= 0x42) { 559 477 uint8_t channel, iface, checksum, i;
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器