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

[Xen-changelog] [xen-unstable] hvmloader: Expand iomem allocation pool to 0xf0000000-0xfc000000.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1201000690 0
# Node ID b006c58b055e779391d579656bdd77a3984d5e2e
# Parent  824ffb1efa9ccd2dc5c900ec66ce42c0cac65819
hvmloader: Expand iomem allocation pool to 0xf0000000-0xfc000000.

Check for exhaustion of allocation pool, warn user, and fail to
initialise the relevant PCI BAR.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 tools/firmware/hvmloader/acpi/build.c |    2 +-
 tools/firmware/hvmloader/hvmloader.c  |   33 ++++++++++++++++++++++++---------
 2 files changed, 25 insertions(+), 10 deletions(-)

diff -r 824ffb1efa9c -r b006c58b055e tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c     Tue Jan 22 10:54:00 2008 +0000
+++ b/tools/firmware/hvmloader/acpi/build.c     Tue Jan 22 11:18:10 2008 +0000
@@ -76,7 +76,7 @@ static int construct_bios_info_table(uin
     bios_info->com2_present = uart_exists(0x2f8);
 
     bios_info->pci_min = 0xf0000000;
-    bios_info->pci_len = 0x05000000;
+    bios_info->pci_len = 0x0c000000;
 
     return align16(sizeof(*bios_info));
 }
diff -r 824ffb1efa9c -r b006c58b055e tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Tue Jan 22 10:54:00 2008 +0000
+++ b/tools/firmware/hvmloader/hvmloader.c      Tue Jan 22 11:18:10 2008 +0000
@@ -183,10 +183,16 @@ static void apic_setup(void)
 
 static void pci_setup(void)
 {
-    uint32_t devfn, bar_reg, bar_data, bar_sz, cmd;
-    uint32_t *base, io_base = 0xc000, mem_base = HVM_BELOW_4G_MMIO_START;
+    uint32_t base, devfn, bar_reg, bar_data, bar_sz, cmd;
     uint16_t class, vendor_id, device_id;
     unsigned int bar, pin, link, isa_irq;
+
+    /* Resources assignable to PCI devices via BARs. */
+    struct resource {
+        uint32_t base, max;
+    } *resource;
+    struct resource mem_resource = { 0xf0000000, 0xfc000000 };
+    struct resource io_resource  = { 0xc000, 0x10000 };
 
     /* Create a list of device BARs in descending order of size. */
     struct bars {
@@ -301,22 +307,31 @@ static void pci_setup(void)
         if ( (bar_data & PCI_BASE_ADDRESS_SPACE) ==
              PCI_BASE_ADDRESS_SPACE_MEMORY )
         {
-            base = &mem_base;
+            resource = &mem_resource;
             bar_data &= ~PCI_BASE_ADDRESS_MEM_MASK;
         }
         else
         {
-            base = &io_base;
+            resource = &io_resource;
             bar_data &= ~PCI_BASE_ADDRESS_IO_MASK;
         }
 
-        *base = (*base + bar_sz - 1) & ~(bar_sz - 1);
-        bar_data |= *base;
-        *base += bar_sz;
+        base = (resource->base + bar_sz - 1) & ~(bar_sz - 1);
+        bar_data |= base;
+        base += bar_sz;
+
+        if ( (base < resource->base) || (base > resource->max) )
+        {
+            printf("pci dev %02x:%x bar %02x size %08x: no space for "
+                   "resource!\n", devfn>>3, devfn&7, bar_reg, bar_sz);
+            continue;
+        }
+
+        resource->base = base;
 
         pci_writel(devfn, bar_reg, bar_data);
-        printf("pci dev %02x:%x bar %02x size %08x: %08x %08x/%08x\n",
-               devfn>>3, devfn&7, bar_reg, bar_sz, bar_data, i, nr_bars);
+        printf("pci dev %02x:%x bar %02x size %08x: %08x\n",
+               devfn>>3, devfn&7, bar_reg, bar_sz, bar_data);
 
         /* Now enable the memory or I/O mapping. */
         cmd = pci_readw(devfn, PCI_COMMAND);

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


 


Rackspace

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