diff options
author | Markus Armbruster <armbru@redhat.com> | 2012-07-10 11:12:53 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-07-17 16:48:32 +0200 |
commit | 2adc99b277ab05877ef847bddde45346378f561a (patch) | |
tree | da0313df8aa57f7ec78584464783689f7a6dae71 /hw/ide | |
parent | 4e4e6e319b5508289da0f2966f63c841c832b847 (diff) | |
download | qemu-2adc99b277ab05877ef847bddde45346378f561a.zip qemu-2adc99b277ab05877ef847bddde45346378f561a.tar.gz qemu-2adc99b277ab05877ef847bddde45346378f561a.tar.bz2 |
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>
Diffstat (limited to 'hw/ide')
-rw-r--r-- | hw/ide/core.c | 2 | ||||
-rw-r--r-- | hw/ide/qdev.c | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c index bf1ce89..1ca7cdf 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2091,6 +2091,8 @@ void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0, trans = dinfo->trans; if (!cyls && !heads && !secs) { hd_geometry_guess(dinfo->bdrv, &cyls, &heads, &secs, &trans); + } else if (trans == BIOS_ATA_TRANSLATION_AUTO) { + trans = hd_bios_chs_auto_trans(cyls, heads, secs); } if (ide_init_drive(&bus->ifs[i], dinfo->bdrv, dinfo->media_cd ? IDE_CD : IDE_HD, NULL, diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 84097fd..de9db3b 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -171,6 +171,9 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind) hd_geometry_guess(dev->conf.bs, &dev->conf.cyls, &dev->conf.heads, &dev->conf.secs, &dev->chs_trans); + } else if (dev->chs_trans == BIOS_ATA_TRANSLATION_AUTO) { + dev->chs_trans = hd_bios_chs_auto_trans(dev->conf.cyls, + dev->conf.heads, dev->conf.secs); } if (ide_init_drive(s, dev->conf.bs, kind, |