mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
hd-geometry: Compute BIOS CHS translation in one place
Currently, it is split between hd_geometry_guess() and pc_cmos_init_late(). Confusing. info qtree shows the result of the former. Also confusing. Fold the part done in pc_cmos_init_late() into hd_geometry_guess(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
4e4e6e319b
commit
2adc99b277
5 changed files with 18 additions and 16 deletions
19
hw/pc.c
19
hw/pc.c
|
@ -290,7 +290,7 @@ static void pc_cmos_init_late(void *opaque)
|
|||
int16_t cylinders;
|
||||
int8_t heads, sectors;
|
||||
int val;
|
||||
int i;
|
||||
int i, trans;
|
||||
|
||||
val = 0;
|
||||
if (ide_get_geometry(arg->idebus[0], 0,
|
||||
|
@ -313,20 +313,9 @@ static void pc_cmos_init_late(void *opaque)
|
|||
geometry can be different if a translation is done. */
|
||||
if (ide_get_geometry(arg->idebus[i / 2], i % 2,
|
||||
&cylinders, &heads, §ors) >= 0) {
|
||||
int translation = ide_get_bios_chs_trans(arg->idebus[i / 2],
|
||||
i % 2);
|
||||
if (translation == BIOS_ATA_TRANSLATION_AUTO) {
|
||||
if (cylinders <= 1024 && heads <= 16 && sectors <= 63) {
|
||||
/* No translation. */
|
||||
translation = 0;
|
||||
} else {
|
||||
/* LBA translation. */
|
||||
translation = 1;
|
||||
}
|
||||
} else {
|
||||
translation--;
|
||||
}
|
||||
val |= translation << (i * 2);
|
||||
trans = ide_get_bios_chs_trans(arg->idebus[i / 2], i % 2) - 1;
|
||||
assert((trans & ~3) == 0);
|
||||
val |= trans << (i * 2);
|
||||
}
|
||||
}
|
||||
rtc_set_memory(s, 0x39, val);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue