Changeset 1014 in vbox
- Timestamp:
- Feb 21, 2007 5:54:21 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 18870
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevPcBios.cpp
r837 r1014 408 408 } 409 409 else if (cCylinders <= 1024 && cHeads <= 16 && cSectors <= 63) 410 { 411 /* Disk <= 512 MByte not needing LBA translation. */ 410 412 enmTranslation = PDMBIOSTRANSLATION_NONE; 413 } 414 else if (cSectors != 63 || (cHeads != 16 && cHeads != 32 && cHeads != 64 && cHeads != 128 && cHeads != 255)) 415 { 416 /* Disk with strange geometry. Using LBA here can 417 * break booting of the guest OS. Especially operating 418 * systems from Microsoft are sensitive to BIOS CHS not 419 * matching what the partition table says. */ 420 enmTranslation = PDMBIOSTRANSLATION_NONE; 421 } 411 422 else 412 423 enmTranslation = PDMBIOSTRANSLATION_LBA; … … 748 759 if (VBOX_FAILURE(rc)) 749 760 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 750 N_("Configuration error: Querying \"%s\" as a string failed"), 761 N_("Configuration error: Querying \"%s\" as a string failed"), 751 762 pszParam); 752 763 if (!strcmp(psz, "DVD") || !strcmp(psz, "CDROM")) … … 939 950 if (VBOX_FAILURE(rc)) 940 951 return rc; 941 rc = PDMDevHlpROMRegister(pDevIns, (uint32_t)-g_cbPcBiosBinary, g_cbPcBiosBinary, 952 rc = PDMDevHlpROMRegister(pDevIns, (uint32_t)-g_cbPcBiosBinary, g_cbPcBiosBinary, 942 953 &g_abPcBiosBinary[0], "PC BIOS - 0xffffffff"); 943 954 if (VBOX_FAILURE(rc)) … … 947 958 * Register the MMIO region for the BIOS Logo: 0x000d0000 to 0x000dffff (64k) 948 959 */ 949 rc = PDMDevHlpMMIORegister(pDevIns, 0x000d0000, 0x00010000, 0, 960 rc = PDMDevHlpMMIORegister(pDevIns, 0x000d0000, 0x00010000, 0, 950 961 logoMMIOWrite, logoMMIORead, NULL, "PC BIOS - Logo Buffer"); 951 962 if (VBOX_FAILURE(rc)) -
trunk/src/VBox/Devices/Storage/DevATA.cpp
r778 r1014 3661 3661 cCHSSectors = iEndSector; 3662 3662 cCHSCylinders = s->cTotalSectors / (cCHSHeads * cCHSSectors); 3663 if (cCHSCylinders >= 1 && cCHSCylinders <= 16383)3663 if (cCHSCylinders >= 1) 3664 3664 { 3665 cCHSCylinders = RT_MIN(cCHSCylinders, 16383); 3665 3666 *pcHeads = cCHSHeads; 3666 3667 *pcSectors = cCHSSectors; … … 5220 5221 else if (VBOX_FAILURE(rc)) 5221 5222 { 5222 rc = ataGuessDiskLCHS(pIf, &pIf->cCHSCylinders, &pIf->cCHSHeads, &pIf->cCHSSectors); 5223 if (VBOX_SUCCESS(rc) && pIf->cCHSHeads <= 16 /* if cCHSHeads > 16, it means that a BIOS LBA translation was active, so the default hardware geometry is OK. */ 5224 ) 5223 PDMBIOSTRANSLATION enmTranslation; 5224 rc = pIf->pDrvBlockBios->pfnGetTranslation(pIf->pDrvBlockBios, &enmTranslation); 5225 AssertRC(rc); 5226 5227 if (enmTranslation == PDMBIOSTRANSLATION_AUTO) 5225 5228 { 5226 /* Disable any translation to be in sync with the logical geometry */ 5227 PDMBIOSTRANSLATION enmTranslation; 5228 rc = pIf->pDrvBlockBios->pfnGetTranslation(pIf->pDrvBlockBios, &enmTranslation); 5229 if (VBOX_FAILURE(rc) || enmTranslation == PDMBIOSTRANSLATION_AUTO) 5230 pIf->pDrvBlockBios->pfnSetTranslation(pIf->pDrvBlockBios, PDMBIOSTRANSLATION_NONE); 5229 /* Image contains no geometry information, detect geometry. */ 5230 rc = ataGuessDiskLCHS(pIf, &pIf->cCHSCylinders, &pIf->cCHSHeads, &pIf->cCHSSectors); 5231 if (VBOX_SUCCESS(rc)) 5232 { 5233 /* Set the disk geometry information. */ 5234 rc = pIf->pDrvBlockBios->pfnSetGeometry(pIf->pDrvBlockBios, pIf->cCHSCylinders, pIf->cCHSHeads, pIf->cCHSSectors); 5235 } 5236 else 5237 { 5238 /* Flag geometry as invalid, will be replaced below by the 5239 * default geometry. */ 5240 pIf->cCHSCylinders = 0; 5241 } 5231 5242 } 5232 else 5243 /* If there is no geometry, use standard physical disk geometry. 5244 * This uses LCHS to LBA translation in the BIOS (which selects 5245 * the logical sector count 63 and the logical head count to be 5246 * the smallest of 16,32,64,128,255 which makes the logical 5247 * cylinder count smaller than 1024 - if that's not possible, it 5248 * uses 255 heads, so up to about 8 GByte maximum with the 5249 * standard int13 interface, which supports 1024 cylinders). */ 5250 if (!pIf->cCHSCylinders) 5233 5251 { 5234 /* If no geometry, use a standard physical disk geometry. */5235 5252 uint64_t cCHSCylinders = pIf->cTotalSectors / (16 * 63); 5236 pIf->cCHSCylinders = (uint32_t)RT_MIN(RT_MAX(cCHSCylinders, 2), 16383);5253 pIf->cCHSCylinders = (uint32_t)RT_MIN(RT_MAX(cCHSCylinders, 1), 16383); 5237 5254 pIf->cCHSHeads = 16; 5238 5255 pIf->cCHSSectors = 63; 5256 /* Set the disk geometry information. */ 5257 rc = pIf->pDrvBlockBios->pfnSetGeometry(pIf->pDrvBlockBios, pIf->cCHSCylinders, pIf->cCHSHeads, pIf->cCHSSectors); 5239 5258 } 5240 pIf->pDrvBlockBios->pfnSetGeometry(pIf->pDrvBlockBios, pIf->cCHSCylinders, pIf->cCHSHeads, pIf->cCHSSectors);5241 5259 } 5242 5260 LogRel(("PIIX3 ATA: LUN#%d: disk, CHS=%d/%d/%d, total number of sectors %Ld\n", pIf->iLUN, pIf->cCHSCylinders, pIf->cCHSHeads, pIf->cCHSSectors, pIf->cTotalSectors));
Note:
See TracChangeset
for help on using the changeset viewer.