217 |
val = 0; |
val = 0; |
218 |
for (i = 0; i < 4; i++) { |
for (i = 0; i < 4; i++) { |
219 |
if (hd_table[i]) { |
if (hd_table[i]) { |
220 |
int cylinders, heads, sectors; |
int cylinders, heads, sectors, translation; |
221 |
uint8_t translation; |
/* NOTE: bdrv_get_geometry_hint() returns the physical |
222 |
/* NOTE: bdrv_get_geometry_hint() returns the geometry |
geometry. It is always such that: 1 <= sects <= 63, 1 |
223 |
that the hard disk returns. It is always such that: 1 <= |
<= heads <= 16, 1 <= cylinders <= 16383. The BIOS |
224 |
sects <= 63, 1 <= heads <= 16, 1 <= cylinders <= |
geometry can be different if a translation is done. */ |
225 |
16383. The BIOS geometry can be different. */ |
translation = bdrv_get_translation_hint(hd_table[i]); |
226 |
bdrv_get_geometry_hint(hd_table[i], &cylinders, &heads, §ors); |
if (translation == BIOS_ATA_TRANSLATION_AUTO) { |
227 |
if (cylinders <= 1024 && heads <= 16 && sectors <= 63) { |
bdrv_get_geometry_hint(hd_table[i], &cylinders, &heads, §ors); |
228 |
/* No translation. */ |
if (cylinders <= 1024 && heads <= 16 && sectors <= 63) { |
229 |
translation = 0; |
/* No translation. */ |
230 |
|
translation = 0; |
231 |
|
} else { |
232 |
|
/* LBA translation. */ |
233 |
|
translation = 1; |
234 |
|
} |
235 |
} else { |
} else { |
236 |
/* LBA translation. */ |
translation--; |
|
translation = 1; |
|
237 |
} |
} |
238 |
val |= translation << (i * 2); |
val |= translation << (i * 2); |
239 |
} |
} |