From 2adc99b277ab05877ef847bddde45346378f561a Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 10 Jul 2012 11:12:53 +0200 Subject: 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 Signed-off-by: Kevin Wolf --- hw/ide/core.c | 2 ++ hw/ide/qdev.c | 3 +++ 2 files changed, 5 insertions(+) (limited to 'hw/ide') diff --git a/hw/ide/core.c b/hw/ide/core.c index bf1ce8968a..1ca7cdf7d0 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 84097fd4ec..de9db3bf9f 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, -- cgit v1.2.3