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-changelog

[Xen-changelog] [xen-4.0-testing] hvmloader: fix off-by-one-bit error wh

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.0-testing] hvmloader: fix off-by-one-bit error when initialising PCI devices
From: "Xen patchbot-4.0-testing" <patchbot-4.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 10 Nov 2010 10:55:11 -0800
Delivery-date: Wed, 10 Nov 2010 11:04:02 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1289398605 0
# Node ID ec0c3f773c3e2e3f125bc99582c5db1032be3ae7
# Parent  750c0c1e4606c91cd800701ca02e9e180e21c4c5
hvmloader: fix off-by-one-bit error when initialising PCI devices

hvmloader is responsible for - amoungst other things - initialising
the PCI device BARs prior to loading the guest BIOS.  The previous
code only probed for devfn up to 128.  The lower 3 bits are function
IDs so this meant that only devices in slots 0-15 were actually being
initialized.

Signed-off-by: Alex Zeffertt <alex.zeffertt@xxxxxxxxxxxxx>
Acked-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
xen-unstable changeset:   22383:cba667fb80cf
xen-unstable date:        Wed Nov 10 13:58:16 2010 +0000

hvmloader: Fix 22383:cba667fb80cf iterating over defns 0..255

We need to declare devfn as wider than 8 bits for a loop 0<devfn<256
to terminate.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
xen-unstable changeset:   22384:c19e3371f31b
xen-unstable date:        Wed Nov 10 14:15:23 2010 +0000
---
 tools/firmware/hvmloader/hvmloader.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff -r 750c0c1e4606 -r ec0c3f773c3e tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Tue Nov 09 20:42:20 2010 +0000
+++ b/tools/firmware/hvmloader/hvmloader.c      Wed Nov 10 14:16:45 2010 +0000
@@ -196,7 +196,7 @@ static void pci_setup(void)
     outb(0x4d1, (uint8_t)(PCI_ISA_IRQ_MASK >> 8));
 
     /* Scan the PCI bus and map resources. */
-    for ( devfn = 0; devfn < 128; devfn++ )
+    for ( devfn = 0; devfn < 256; devfn++ )
     {
         class     = pci_readw(devfn, PCI_CLASS_DEVICE);
         vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
@@ -466,11 +466,10 @@ static int scan_option_rom(
  */
 static int scan_etherboot_nic(uint32_t copy_rom_dest)
 {
-    uint8_t devfn;
-    uint16_t class, vendor_id, device_id;
+    uint16_t class, vendor_id, device_id, devfn;
     int rom_size = 0;
 
-    for ( devfn = 0; (devfn < 128) && !rom_size; devfn++ )
+    for ( devfn = 0; (devfn < 256) && !rom_size; devfn++ )
     {
         class     = pci_readw(devfn, PCI_CLASS_DEVICE);
         vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
@@ -494,10 +493,9 @@ static int pci_load_option_roms(uint32_t
 static int pci_load_option_roms(uint32_t rom_base_addr)
 {
     uint32_t option_rom_addr, rom_phys_addr = rom_base_addr;
-    uint16_t vendor_id, device_id;
-    uint8_t devfn, class;
-
-    for ( devfn = 0; devfn < 128; devfn++ )
+    uint16_t vendor_id, device_id, devfn, class;
+
+    for ( devfn = 0; devfn < 256; devfn++ )
     {
         class     = pci_readb(devfn, PCI_CLASS_DEVICE + 1);
         vendor_id = pci_readw(devfn, PCI_VENDOR_ID);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.0-testing] hvmloader: fix off-by-one-bit error when initialising PCI devices, Xen patchbot-4.0-testing <=