VirtualBox

Changeset 48744 in vbox for trunk/src


Ignore:
Timestamp:
Sep 27, 2013 6:21:23 PM (11 years ago)
Author:
vboxsync
Message:

Devices/Storage: Support different sector sizes, booting from images with a sector size != 512 is not supported

Location:
trunk/src/VBox/Devices/Storage
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevAHCI.cpp

    r48721 r48744  
    30213021    if (pAhciPort->cbSector != 512)
    30223022    {
     3023        uint32_t cSectorSizeInWords = pAhciPort->cbSector / sizeof(uint16_t);
    30233024        /* Enable reporting of logical sector size. */
    3024         p[106] |= RT_H2LE_U16(RT_BIT(12));
    3025         p[117] = RT_H2LE_U16(pAhciPort->cbSector);
    3026         p[118] = RT_H2LE_U16(pAhciPort->cbSector >> 16);
     3025        p[106] |= RT_H2LE_U16(RT_BIT(12) | RT_BIT(14));
     3026        p[117] = RT_H2LE_U16(cSectorSizeInWords);
     3027        p[118] = RT_H2LE_U16(cSectorSizeInWords >> 16);
    30273028    }
    30283029
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r48721 r48744  
    12111211    p[3] = RT_H2LE_U16(s->PCHSGeometry.cHeads);
    12121212    /* Block size; obsolete, but required for the BIOS. */
    1213     p[5] = RT_H2LE_U16(512);
     1213    p[5] = RT_H2LE_U16(s->cbSector);
    12141214    p[6] = RT_H2LE_U16(s->PCHSGeometry.cSectors);
    12151215    ataPadString((uint8_t *)(p + 10), s->szSerialNumber, ATA_SERIAL_NUMBER_LENGTH); /* serial number */
     
    12921292    if (s->cbSector != 512)
    12931293    {
     1294        uint32_t cSectorSizeInWords = s->cbSector / sizeof(uint16_t);
    12941295        /* Enable reporting of logical sector size. */
    1295         p[106] |= RT_H2LE_U16(RT_BIT(12));
    1296         p[117] = RT_H2LE_U16(s->cbSector);
    1297         p[118] = RT_H2LE_U16(s->cbSector >> 16);
     1296        p[106] |= RT_H2LE_U16(RT_BIT(12) | RT_BIT(14));
     1297        p[117] = RT_H2LE_U16(cSectorSizeInWords);
     1298        p[118] = RT_H2LE_U16(cSectorSizeInWords >> 16);
    12981299    }
    12991300
     
    16331634    bool fRedo;
    16341635
    1635     cSectors = s->cbElementaryTransfer / 512;
     1636    cSectors = s->cbElementaryTransfer / s->cbSector;
    16361637    Assert(cSectors);
    16371638    iLBA = ataGetSector(s);
     
    16711672    bool fRedo;
    16721673
    1673     cSectors = s->cbElementaryTransfer / 512;
     1674    cSectors = s->cbElementaryTransfer / s->cbSector;
    16741675    Assert(cSectors);
    16751676    iLBA = ataGetSector(s);
     
    37993800        pIf->cTotalSectors = pIf->pDrvBlock->pfnGetSize(pIf->pDrvBlock) / 2048;
    38003801    else
    3801         pIf->cTotalSectors = pIf->pDrvBlock->pfnGetSize(pIf->pDrvBlock) / 512;
     3802        pIf->cTotalSectors = pIf->pDrvBlock->pfnGetSize(pIf->pDrvBlock) / pIf->cbSector;
    38023803
    38033804    LogRel(("PIIX3 ATA: LUN#%d: CD/DVD, total number of sectors %Ld, passthrough unchanged\n", pIf->iLUN, pIf->cTotalSectors));
     
    42134214                goto abort_cmd;
    42144215            s->fDMA = true;
    4215             ataStartTransfer(s, (s->uATARegNSectorHOB << 8 | s->uATARegNSector) * 512, PDMBLOCKTXDIR_TO_DEVICE, ATAFN_BT_NULL, ATAFN_SS_TRIM, false);
     4216            ataStartTransfer(s, (s->uATARegNSectorHOB << 8 | s->uATARegNSector) * s->cbSector, PDMBLOCKTXDIR_TO_DEVICE, ATAFN_BT_NULL, ATAFN_SS_TRIM, false);
    42164217            break;
    42174218        default:
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r47829 r48744  
    16211621    LogFlowFunc(("\n"));
    16221622    PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface);
    1623     uint32_t cb = 512;
     1623    uint32_t cb = VDGetSectorSize(pThis->pDisk, VD_LAST_IMAGE);
    16241624    LogFlowFunc(("returns %u\n", cb));
    16251625    return cb;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette