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/hd-geometry.c | |
parent | 4e4e6e319b5508289da0f2966f63c841c832b847 (diff) |
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/hd-geometry.c')
-rw-r--r-- | hw/hd-geometry.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/hw/hd-geometry.c b/hw/hd-geometry.c index 74678a656..1cdb9fb75 100644 --- a/hw/hd-geometry.c +++ b/hw/hd-geometry.c @@ -125,7 +125,7 @@ void hd_geometry_guess(BlockDriverState *bs, if (guess_disk_lchs(bs, &cylinders, &heads, &secs) < 0) { /* no LCHS guess: use a standard physical disk geometry */ guess_chs_for_size(bs, pcyls, pheads, psecs); - translation = BIOS_ATA_TRANSLATION_AUTO; + translation = hd_bios_chs_auto_trans(*pcyls, *pheads, *psecs); } else if (heads > 16) { /* LCHS guess with heads > 16 means that a BIOS LBA translation was active, so a standard physical disk @@ -148,3 +148,10 @@ void hd_geometry_guess(BlockDriverState *bs, } trace_hd_geometry_guess(bs, *pcyls, *pheads, *psecs, translation); } + +int hd_bios_chs_auto_trans(uint32_t cyls, uint32_t heads, uint32_t secs) +{ + return cyls <= 1024 && heads <= 16 && secs <= 63 + ? BIOS_ATA_TRANSLATION_NONE + : BIOS_ATA_TRANSLATION_LBA; +} |