Revision 40b6ecc6 hw/pc.c
b/hw/pc.c | ||
---|---|---|
215 | 215 |
cmos_init_hd(0x1a, 0x24, hd_table[1]); |
216 | 216 |
|
217 | 217 |
val = 0; |
218 |
for (i = 0; i < 4; i++) |
|
218 |
for (i = 0; i < 4; i++) {
|
|
219 | 219 |
if (hd_table[i]) { |
220 | 220 |
int cylinders, heads, sectors; |
221 | 221 |
uint8_t translation; |
222 |
|
|
222 |
/* NOTE: bdrv_get_geometry_hint() returns the geometry |
|
223 |
that the hard disk returns. It is always such that: 1 <= |
|
224 |
sects <= 63, 1 <= heads <= 16, 1 <= cylinders <= |
|
225 |
16383. The BIOS geometry can be different. */ |
|
223 | 226 |
bdrv_get_geometry_hint(hd_table[i], &cylinders, &heads, §ors); |
224 | 227 |
if (cylinders <= 1024 && heads <= 16 && sectors <= 63) { |
225 | 228 |
/* No translation. */ |
226 | 229 |
translation = 0; |
227 |
} else if (cylinders * heads > 131072) {
|
|
230 |
} else { |
|
228 | 231 |
/* LBA translation. */ |
229 | 232 |
translation = 1; |
230 |
} else { |
|
231 |
/* LARGE translation. */ |
|
232 |
translation = 2; |
|
233 | 233 |
} |
234 |
|
|
235 | 234 |
val |= translation << (i * 2); |
236 | 235 |
} |
236 |
} |
|
237 | 237 |
rtc_set_memory(s, 0x39, val); |
238 | 238 |
|
239 | 239 |
/* Disable check of 0x55AA signature on the last two bytes of |
Also available in: Unified diff