[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/1] Fix qemu could not boot windows vm which converted from phy-partition



Hi,

When booting up windows VM which converted by dd windows physical
partition,
it failed with "Error Loading Operating System", the partition build on
scsi/raid controller. The root cause is qemu and hvmloader could not
calaulated C/H/S correctly, then ntloader could not found the root
partition.

Signed-off-by: zhenzhong.duan <zhenzhong.duan@xxxxxxxxxx>
Signed-off-by: Joe Jin <joe.jin@xxxxxxxxxx>
diff -urNp xen-3.4.0/qemu-xen.git/block.c xen-3.4.0_lba/qemu-xen.git/block.c
--- xen-3.4.0/qemu-xen.git/block.c      2010-08-02 15:32:21.000000000 +0800
+++ xen-3.4.0_lba/qemu-xen.git/block.c  2010-08-02 13:37:56.000000000 +0800
@@ -884,7 +884,12 @@ void bdrv_guess_geometry(BlockDriverStat
         *psecs = secs;
     } else {
         if (guess_disk_lchs(bs, &cylinders, &heads, &secs) == 0) {
-            if (heads > 16) {
+            if(secs==32){
+                *pcyls = cylinders;
+                *pheads = heads;
+                *psecs = secs;
+                 bdrv_set_translation_hint(bs, BIOS_ATA_TRANSLATION_LBA);
+            } else if (heads > 16) {
                 /* if heads > 16, it means that a BIOS LBA
                    translation was active, so the default
                    hardware geometry is OK */
diff -urNp xen-3.4.0/tools/firmware/rombios/rombios.c 
xen-3.4.0_lba/tools/firmware/rombios/rombios.c
--- xen-3.4.0/tools/firmware/rombios/rombios.c  2009-05-19 02:20:46.000000000 
+0800
+++ xen-3.4.0_lba/tools/firmware/rombios/rombios.c      2010-08-02 
15:46:43.000000000 +0800
@@ -2740,8 +2740,7 @@ void ata_detect( )
         case ATA_TRANSLATION_NONE:
           break;
         case ATA_TRANSLATION_LBA:
-          spt = 63;
-          sectors_low /= 63;
+          sectors_low /= spt;
           heads = sectors_low / 1024;
           if (heads>128) heads = 255;
           else if (heads>64) heads = 128;
@@ -5442,6 +5441,7 @@ int13_harddisk(EHAX, DS, ES, DI, SI, BP,
   Bit16u npc, nph, npspt, nlc, nlh, nlspt;
   Bit16u size, count;
   Bit8u  device, status;
+  Bit8u  translation;
 
   BX_DEBUG_INT13_HD("int13_harddisk: AX=%04x BX=%04x CX=%04x DX=%04x 
ES=%04x\n", AX, BX, CX, DX, ES);
 
@@ -5512,8 +5512,10 @@ int13_harddisk(EHAX, DS, ES, DI, SI, BP,
       nph   = read_word(ebda_seg, &EbdaData->ata.devices[device].pchs.heads);
       npspt = read_word(ebda_seg, &EbdaData->ata.devices[device].pchs.spt);
 
+       translation = 
read_byte(ebda_seg,&EbdaData->ata.devices[device].translation);
+
       // if needed, translate lchs to lba, and execute command
-      if ( (nph != nlh) || (npspt != nlspt)) {
+      if ( (nph != nlh) || (npspt != nlspt) || (translation == 
(ATA_TRANSLATION_LBA))) {
         lba_low = ((((Bit32u)cylinder * (Bit32u)nlh) + (Bit32u)head) * 
(Bit32u)nlspt) + (Bit32u)sector - 1;
         lba_high = 0;
         sector = 0; // this forces the command to be lba
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.