64 lines
2.4 KiB
Diff
64 lines
2.4 KiB
Diff
|
|
From 0f13c505e833761a336bc4619b05afc373ebfdaa Mon Sep 17 00:00:00 2001
|
||
|
|
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
||
|
|
Date: Thu, 21 Mar 2024 05:59:43 +0000
|
||
|
|
Subject: [PATCH] hw/block/hd-geometry: Do not override specified
|
||
|
|
bios-chs-trans mainline inclusion commit
|
||
|
|
fd8a68ad6823d33bedeba20a22857867a1c3890e category: bugfix
|
||
|
|
|
||
|
|
---------------------------------------------------------------
|
||
|
|
|
||
|
|
For small disk images (<4 GiB), QEMU and SeaBIOS default to the
|
||
|
|
LARGE/ECHS disk translation method, but it is not uncommon for other
|
||
|
|
BIOS software to use LBA in these cases as well. Some operating
|
||
|
|
system boot loaders (e.g., NT 4) do not handle LARGE translations
|
||
|
|
outside of fixed configurations. See, e.g., Q154052:
|
||
|
|
|
||
|
|
"When starting an x86 based computer, Ntdetect.com retrieves and
|
||
|
|
stores Interrupt 13 information. . . If the disk controller is using a
|
||
|
|
32 sector/64 head translation scheme, this boundary will be 1 GB. If
|
||
|
|
the controller uses 63 sector/255 head translation [AUTHOR: i.e.,
|
||
|
|
LBA], the limit will be 4 GB."
|
||
|
|
|
||
|
|
To accommodate these situations, hd_geometry_guess() now follows the
|
||
|
|
disk translation specified by the user even when the ATA disk geometry
|
||
|
|
is guessed.
|
||
|
|
|
||
|
|
hd_geometry_guess():
|
||
|
|
* Only set the disk translation when translation is AUTO.
|
||
|
|
* Show the soon-to-be active translation (*ptrans) in the trace rather
|
||
|
|
than what was guessed.
|
||
|
|
|
||
|
|
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/56
|
||
|
|
Buglink: https://bugs.launchpad.net/qemu/+bug/1745312
|
||
|
|
|
||
|
|
Signed-off-by: Lev Kujawski <lkujaw@member.fsf.org>
|
||
|
|
Message-Id: <20220707204045.999544-1-lkujaw@member.fsf.org>
|
||
|
|
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||
|
|
|
||
|
|
Signed-off-by: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
||
|
|
---
|
||
|
|
hw/block/hd-geometry.c | 7 ++++++-
|
||
|
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/hw/block/hd-geometry.c b/hw/block/hd-geometry.c
|
||
|
|
index dcbccee294..67462f1752 100644
|
||
|
|
--- a/hw/block/hd-geometry.c
|
||
|
|
+++ b/hw/block/hd-geometry.c
|
||
|
|
@@ -150,7 +150,12 @@ void hd_geometry_guess(BlockBackend *blk,
|
||
|
|
translation = BIOS_ATA_TRANSLATION_NONE;
|
||
|
|
}
|
||
|
|
if (ptrans) {
|
||
|
|
- *ptrans = translation;
|
||
|
|
+ if (*ptrans == BIOS_ATA_TRANSLATION_AUTO) {
|
||
|
|
+ *ptrans = translation;
|
||
|
|
+ } else {
|
||
|
|
+ /* Defer to the translation specified by the user. */
|
||
|
|
+ translation = *ptrans;
|
||
|
|
+ }
|
||
|
|
}
|
||
|
|
trace_hd_geometry_guess(blk, *pcyls, *pheads, *psecs, translation);
|
||
|
|
}
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|