Patchwork [1.0] scsi-disk: guess geometry

login
register
mail settings
Submitter Paolo Bonzini
Date Nov. 15, 2011, 3:57 p.m.
Message ID <1321372670-12682-1-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/125816/
State New
Headers show

Comments

Paolo Bonzini - Nov. 15, 2011, 3:57 p.m.
Old operating systems rely on correct geometry to convert from CHS
addresses to LBA.  Providing correct data is necessary for them to boot.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
	This fixes booting the FreeDOS image on bochs.sf.net with
	virtio-scsi.  I haven't tested with LSI option ROMs, but
	it should qualify for 1.0.

 hw/scsi-disk.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Kevin Wolf - Nov. 18, 2011, 12:38 p.m.
Am 15.11.2011 16:57, schrieb Paolo Bonzini:
> Old operating systems rely on correct geometry to convert from CHS
> addresses to LBA.  Providing correct data is necessary for them to boot.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> 	This fixes booting the FreeDOS image on bochs.sf.net with
> 	virtio-scsi.  I haven't tested with LSI option ROMs, but
> 	it should qualify for 1.0.

Thanks, applied to the block-stable branch (for 1.0)

Kevin

Patch

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 16a4714..cd77780 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -828,7 +828,7 @@  static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf,
             break;
         }
         /* if a geometry hint is available, use it */
-        bdrv_get_geometry_hint(bdrv, &cylinders, &heads, &secs);
+        bdrv_guess_geometry(bdrv, &cylinders, &heads, &secs);
         p[2] = (cylinders >> 16) & 0xff;
         p[3] = (cylinders >> 8) & 0xff;
         p[4] = cylinders & 0xff;
@@ -862,7 +862,7 @@  static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf,
         p[2] = 5000 >> 8;
         p[3] = 5000 & 0xff;
         /* if a geometry hint is available, use it */
-        bdrv_get_geometry_hint(bdrv, &cylinders, &heads, &secs);
+        bdrv_guess_geometry(bdrv, &cylinders, &heads, &secs);
         p[4] = heads & 0xff;
         p[5] = secs & 0xff;
         p[6] = s->qdev.blocksize >> 8;