VirtualBox

Changeset 2334

Show
Ignore:
Timestamp:
04/25/07 11:19:53 (2 years ago)
Author:
vboxsync
Message:

Do the 16383 cylinder clipping earlier (again). Needed for the new
virtual disk support which needs the clipped geometry everywhere.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r2269 r2334  
    10551055    memset(p, 0, 512); 
    10561056    p[0] = RT_H2LE_U16(0x0040); 
    1057     p[1] = RT_H2LE_U16(RT_MIN(s->cCHSCylinders, 16383)); 
     1057    p[1] = RT_H2LE_U16(s->cCHSCylinders); 
    10581058    p[3] = RT_H2LE_U16(s->cCHSHeads); 
    10591059    /* Block size; obsolete, but required for the BIOS. */ 
     
    10751075    p[52] = RT_H2LE_U16(240); /* DMA transfer cycle */ 
    10761076    p[53] = RT_H2LE_U16(1 | 1 << 1 | 1 << 2); /* words 54-58,64-70,88 valid */ 
    1077     p[54] = RT_H2LE_U16(RT_MIN(s->cCHSCylinders, 16383)); 
     1077    p[54] = RT_H2LE_U16(s->cCHSCylinders); 
    10781078    p[55] = RT_H2LE_U16(s->cCHSHeads); 
    10791079    p[56] = RT_H2LE_U16(s->cCHSSectors); 
    1080     p[57] = RT_H2LE_U16(RT_MIN(s->cCHSCylinders, 16383) * s->cCHSHeads * s->cCHSSectors); 
    1081     p[58] = RT_H2LE_U16(RT_MIN(s->cCHSCylinders, 16383) * s->cCHSHeads * s->cCHSSectors >> 16); 
     1080    p[57] = RT_H2LE_U16(s->cCHSCylinders * s->cCHSHeads * s->cCHSSectors); 
     1081    p[58] = RT_H2LE_U16(s->cCHSCylinders * s->cCHSHeads * s->cCHSSectors >> 16); 
    10821082    if (s->cMultSectors) 
    10831083        p[59] = RT_H2LE_U16(0x100 | s->cMultSectors); 
     
    36913691            cCHSHeads = iEndHead + 1; 
    36923692            cCHSSectors = iEndSector; 
    3693             cCHSCylinders = s->cTotalSectors / (cCHSHeads * cCHSSectors); 
     3693            cCHSCylinders = RT_MIN(s->cTotalSectors / (cCHSHeads * cCHSSectors), 16383); 
    36943694            if (cCHSCylinders >= 1) 
    36953695            { 
     
    36973697                *pcSectors = cCHSSectors; 
    36983698                *pcCylinders = cCHSCylinders; 
    3699                 Log(("%s: LCHS=%d %d %d\n", __FUNCTION__, cCHSCylinders, cCHSHeads, cCHSSectors)); 
     3699                Log(("%s: probed LCHS=%d %d %d\n", __FUNCTION__, cCHSCylinders, cCHSHeads, cCHSSectors)); 
    37003700                return VINF_SUCCESS; 
    37013701            } 
     
    52775277                    if (pIf->cCHSSectors == 63 && (pIf->cCHSHeads != 16 || pIf->cCHSCylinders >= 1024)) 
    52785278                    { 
    5279                         pIf->cCHSCylinders = pIf->cTotalSectors / 63 / 16
     5279                        pIf->cCHSCylinders = RT_MIN(pIf->cTotalSectors / 63 / 16, 16383)
    52805280                        pIf->cCHSHeads = 16; 
    52815281                        pIf->cCHSSectors = 63; 
     
    53035303            { 
    53045304                uint64_t cCHSCylinders = pIf->cTotalSectors / (16 * 63); 
    5305                 pIf->cCHSCylinders = (uint32_t)RT_MAX(cCHSCylinders, 1); 
     5305                pIf->cCHSCylinders = (uint32_t)RT_MIN(RT_MAX(cCHSCylinders, 1), 16383); 
    53065306                pIf->cCHSHeads = 16; 
    53075307                pIf->cCHSSectors = 63; 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy