WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [Patch] avoid unnecessary loading NIC rom.

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [Patch] avoid unnecessary loading NIC rom.
From: Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>
Date: Thu, 18 Dec 2008 22:45:57 +0900
Delivery-date: Thu, 18 Dec 2008 05:46:22 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.18 (X11/20081119)
Hi,

When we don't specify PXE boot in guest configuration file,
it is not necessary for hvmloader to load PXE option ROM.
This patch avoid unncessary loading the rom.
It can save shadow memory area for option ROMs.

Signed-off-by: Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>

Best Regards,

Akio Takebe
diff -r a76b4e00e186 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Tue Dec 16 13:14:25 2008 +0000
+++ b/tools/firmware/hvmloader/hvmloader.c      Thu Dec 18 22:38:18 2008 +0900
@@ -423,19 +423,28 @@
 {
     uint8_t devfn;
     uint16_t class, vendor_id, device_id;
+    uint16_t bootdev;
+    uint16_t seq_nr;
 
-    for ( devfn = 0; devfn < 128; devfn++ )
-    {
-        class     = pci_readw(devfn, PCI_CLASS_DEVICE);
-        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
-        device_id = pci_readw(devfn, PCI_DEVICE_ID);
+    for (seq_nr=0; seq_nr<3; seq_nr++ ){
+        bootdev = cmos_inb(0x3d);
+        bootdev |= ((cmos_inb(0x38) & 0xf0) << 4);
+        bootdev >>= 4 * seq_nr;
+        bootdev &= 0xf;
+       if ( bootdev == 4 ){
+            for ( devfn = 0; devfn < 128; devfn++ ){
+                class     = pci_readw(devfn, PCI_CLASS_DEVICE);
+                vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
+                device_id = pci_readw(devfn, PCI_DEVICE_ID);
 
-        /* We're only interested in NICs. */
-        if ( (vendor_id != 0xffff) &&
-             (device_id != 0xffff) &&
-             (class == 0x0200) )
-            return scan_option_rom(
-                devfn, vendor_id, device_id, etherboot, copy_rom_dest);
+                /* We're only interested in NICs. */
+                if ( (vendor_id != 0xffff) &&
+                     (device_id != 0xffff) &&
+                     (class == 0x0200) )
+                    return scan_option_rom(devfn, vendor_id, 
+                               device_id, etherboot, copy_rom_dest);
+            }
+        }
     }
 
     return 0;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel