- Timestamp:
- Apr 25, 2007 9:19:53 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevATA.cpp
r2269 r2334 1055 1055 memset(p, 0, 512); 1056 1056 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); 1058 1058 p[3] = RT_H2LE_U16(s->cCHSHeads); 1059 1059 /* Block size; obsolete, but required for the BIOS. */ … … 1075 1075 p[52] = RT_H2LE_U16(240); /* DMA transfer cycle */ 1076 1076 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); 1078 1078 p[55] = RT_H2LE_U16(s->cCHSHeads); 1079 1079 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); 1082 1082 if (s->cMultSectors) 1083 1083 p[59] = RT_H2LE_U16(0x100 | s->cMultSectors); … … 3691 3691 cCHSHeads = iEndHead + 1; 3692 3692 cCHSSectors = iEndSector; 3693 cCHSCylinders = s->cTotalSectors / (cCHSHeads * cCHSSectors);3693 cCHSCylinders = RT_MIN(s->cTotalSectors / (cCHSHeads * cCHSSectors), 16383); 3694 3694 if (cCHSCylinders >= 1) 3695 3695 { … … 3697 3697 *pcSectors = cCHSSectors; 3698 3698 *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)); 3700 3700 return VINF_SUCCESS; 3701 3701 } … … 5277 5277 if (pIf->cCHSSectors == 63 && (pIf->cCHSHeads != 16 || pIf->cCHSCylinders >= 1024)) 5278 5278 { 5279 pIf->cCHSCylinders = pIf->cTotalSectors / 63 / 16;5279 pIf->cCHSCylinders = RT_MIN(pIf->cTotalSectors / 63 / 16, 16383); 5280 5280 pIf->cCHSHeads = 16; 5281 5281 pIf->cCHSSectors = 63; … … 5303 5303 { 5304 5304 uint64_t cCHSCylinders = pIf->cTotalSectors / (16 * 63); 5305 pIf->cCHSCylinders = (uint32_t)RT_M AX(cCHSCylinders, 1);5305 pIf->cCHSCylinders = (uint32_t)RT_MIN(RT_MAX(cCHSCylinders, 1), 16383); 5306 5306 pIf->cCHSHeads = 16; 5307 5307 pIf->cCHSSectors = 63;
Note:
See TracChangeset
for help on using the changeset viewer.