Changeset 6299 in vbox for trunk/src/VBox/Devices/PC
- Timestamp:
- Jan 9, 2008 4:31:54 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevPcBios.cpp
r6291 r6299 332 332 * Initializes the CMOS data for one harddisk. 333 333 */ 334 static void pcbiosCmosInitHardDisk(PPDMDEVINS pDevIns, int offType, int offInfo, PPDMIBLOCKBIOS pBlockBios) 335 { 336 PDMMEDIAGEOMETRY LCHSGeometry; 337 int rc = pBlockBios->pfnGetLCHSGeometry(pBlockBios, &LCHSGeometry); 338 if (VBOX_SUCCESS(rc)) 339 { 340 Log2(("%s: offInfo=%#x: LCHS=%d/%d/%d\n", __FUNCTION__, offInfo, LCHSGeometry.cCylinders, LCHSGeometry.cHeads, LCHSGeometry.cSectors)); 341 if (offType) 342 pcbiosCmosWrite(pDevIns, offType, 48); 343 /* Cylinders low */ 344 pcbiosCmosWrite(pDevIns, offInfo + 0, RT_MIN(LCHSGeometry.cCylinders, 1024) & 0xff); 345 /* Cylinders high */ 346 pcbiosCmosWrite(pDevIns, offInfo + 1, RT_MIN(LCHSGeometry.cCylinders, 1024) >> 8); 347 /* Heads */ 348 pcbiosCmosWrite(pDevIns, offInfo + 2, LCHSGeometry.cHeads); 349 /* Landing zone low */ 350 pcbiosCmosWrite(pDevIns, offInfo + 3, 0xff); 351 /* Landing zone high */ 352 pcbiosCmosWrite(pDevIns, offInfo + 4, 0xff); 353 /* Write precomp low */ 354 pcbiosCmosWrite(pDevIns, offInfo + 5, 0xff); 355 /* Write precomp high */ 356 pcbiosCmosWrite(pDevIns, offInfo + 6, 0xff); 357 /* Sectors */ 358 pcbiosCmosWrite(pDevIns, offInfo + 7, LCHSGeometry.cSectors); 359 return; 360 } 334 static void pcbiosCmosInitHardDisk(PPDMDEVINS pDevIns, int offType, int offInfo, PCPDMMEDIAGEOMETRY pLCHSGeometry) 335 { 336 Log2(("%s: offInfo=%#x: LCHS=%d/%d/%d\n", __FUNCTION__, offInfo, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors)); 361 337 if (offType) 362 pcbiosCmosWrite(pDevIns, offType, 0); 338 pcbiosCmosWrite(pDevIns, offType, 48); 339 /* Cylinders low */ 340 pcbiosCmosWrite(pDevIns, offInfo + 0, RT_MIN(pLCHSGeometry->cCylinders, 1024) & 0xff); 341 /* Cylinders high */ 342 pcbiosCmosWrite(pDevIns, offInfo + 1, RT_MIN(pLCHSGeometry->cCylinders, 1024) >> 8); 343 /* Heads */ 344 pcbiosCmosWrite(pDevIns, offInfo + 2, pLCHSGeometry->cHeads); 345 /* Landing zone low */ 346 pcbiosCmosWrite(pDevIns, offInfo + 3, 0xff); 347 /* Landing zone high */ 348 pcbiosCmosWrite(pDevIns, offInfo + 4, 0xff); 349 /* Write precomp low */ 350 pcbiosCmosWrite(pDevIns, offInfo + 5, 0xff); 351 /* Write precomp high */ 352 pcbiosCmosWrite(pDevIns, offInfo + 6, 0xff); 353 /* Sectors */ 354 pcbiosCmosWrite(pDevIns, offInfo + 7, pLCHSGeometry->cSectors); 363 355 } 364 356 … … 576 568 AssertRC(rc); 577 569 } 570 if (i < 4) 571 { 572 /* Award BIOS extended drive types for first to fourth disk. 573 * Used by the BIOS for setting the logical geometry. */ 574 int offType, offInfo; 575 switch (i) 576 { 577 case 0: 578 offType = 0x19; 579 offInfo = 0x1e; 580 break; 581 case 1: 582 offType = 0x1a; 583 offInfo = 0x26; 584 break; 585 case 2: 586 offType = 0x00; 587 offInfo = 0x67; 588 break; 589 case 3: 590 default: 591 offType = 0x00; 592 offInfo = 0x70; 593 break; 594 } 595 pcbiosCmosInitHardDisk(pDevIns, offInfo, offType, 596 &LCHSGeometry); 597 } 578 598 LogRel(("DevPcBios: ATA LUN#%d LCHS=%u/%u/%u\n", i, LCHSGeometry.cCylinders, LCHSGeometry.cHeads, LCHSGeometry.cSectors)); 579 pcbiosCmosWrite(pDevIns, 0x40 + i * 4, LCHSGeometry.cCylinders & 0xff);580 pcbiosCmosWrite(pDevIns, 0x41 + i * 4, LCHSGeometry.cCylinders >> 8);581 pcbiosCmosWrite(pDevIns, 0x42 + i * 4, LCHSGeometry.cHeads & 0xff);582 pcbiosCmosWrite(pDevIns, 0x43 + i * 4, LCHSGeometry.cSectors & 0xff);583 599 } 584 600 } … … 587 603 u32 = (apHDs[0] ? 0xf0 : 0) | (apHDs[1] ? 0x0f : 0); 588 604 pcbiosCmosWrite(pDevIns, 0x12, u32); 589 /* Award BIOS extended drive types for first and second disk, and590 * extended drive types for third and fourth disk. Used by the BIOS. */591 if (apHDs[0])592 pcbiosCmosInitHardDisk(pDevIns, 0x19, 0x1e, apHDs[0]);593 if (apHDs[1])594 pcbiosCmosInitHardDisk(pDevIns, 0x1a, 0x26, apHDs[1]);595 if (apHDs[2])596 pcbiosCmosInitHardDisk(pDevIns, 0x00, 0x67, apHDs[2]);597 if (apHDs[3])598 pcbiosCmosInitHardDisk(pDevIns, 0x00, 0x70, apHDs[3]);599 605 600 606 LogFlow(("%s: returns VINF_SUCCESS\n", __FUNCTION__)); … … 1280 1286 ("g_cbPcBiosBinary=%#x\n", g_cbPcBiosBinary)); 1281 1287 cb = RT_MIN(g_cbPcBiosBinary, 128 * _1K); 1282 rc = PDMDevHlpROMRegister(pDevIns, 0x00100000 - cb, cb, &g_abPcBiosBinary[g_cbPcBiosBinary - cb], 1288 rc = PDMDevHlpROMRegister(pDevIns, 0x00100000 - cb, cb, &g_abPcBiosBinary[g_cbPcBiosBinary - cb], 1283 1289 false /* fShadow */, "PC BIOS - 0xfffff"); 1284 1290 if (VBOX_FAILURE(rc)) 1285 1291 return rc; 1286 rc = PDMDevHlpROMRegister(pDevIns, (uint32_t)-g_cbPcBiosBinary, g_cbPcBiosBinary, &g_abPcBiosBinary[0], 1292 rc = PDMDevHlpROMRegister(pDevIns, (uint32_t)-g_cbPcBiosBinary, g_cbPcBiosBinary, &g_abPcBiosBinary[0], 1287 1293 false /* fShadow */, "PC BIOS - 0xffffffff"); 1288 1294 if (VBOX_FAILURE(rc)) … … 1518 1524 */ 1519 1525 if (pu8LanBoot) 1520 rc = PDMDevHlpROMRegister(pDevIns, VBOX_LANBOOT_SEG << 4, cbFileLanBoot, pu8LanBoot, 1526 rc = PDMDevHlpROMRegister(pDevIns, VBOX_LANBOOT_SEG << 4, cbFileLanBoot, pu8LanBoot, 1521 1527 true /* fShadow */, "Net Boot ROM"); 1522 1528
Note:
See TracChangeset
for help on using the changeset viewer.