aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2010-06-22 17:57:48 +0900
committerKevin O'Connor <kevin@koconnor.net>2010-07-04 08:52:03 -0400
commitdfd94fafc2a157f4fc64014069e19dc6e6bbac52 (patch)
tree2a82f85be784d0cdc7e24d1ac3b2f7ae83fc214d
parentb9e4721b4244fe2bdaf78396e5aba6cd8555cff0 (diff)
downloadseabios-dfd94fafc2a157f4fc64014069e19dc6e6bbac52.tar.gz
seabios: pciinit: make pci memory space assignment 64bit aware.
make pci memory space assignment 64bit aware. If 64bit memory space is found while assigning pci memory space, clear higher bit and skip to next bar. This patch is preparation for q35 chipset initialization which has 64bit bar. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
-rw-r--r--src/pciinit.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/pciinit.c b/src/pciinit.c
index 488c77b6..b635e44b 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -37,7 +37,12 @@ static void pci_set_io_region_addr(u16 bdf, int region_num, u32 addr)
dprintf(1, "region %d: 0x%08x\n", region_num, addr);
}
-static void pci_bios_allocate_region(u16 bdf, int region_num)
+/*
+ * return value
+ * 0: 32bit BAR
+ * non 0: 64bit BAR
+ */
+static int pci_bios_allocate_region(u16 bdf, int region_num)
{
u32 *paddr;
int ofs;
@@ -71,13 +76,23 @@ static void pci_bios_allocate_region(u16 bdf, int region_num)
pci_set_io_region_addr(bdf, region_num, *paddr);
*paddr += size;
}
+
+ int is_64bit = !(val & PCI_BASE_ADDRESS_SPACE_IO) &&
+ (val & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == PCI_BASE_ADDRESS_MEM_TYPE_64;
+ if (is_64bit) {
+ pci_config_writel(bdf, ofs + 4, 0);
+ }
+ return is_64bit;
}
static void pci_bios_allocate_regions(u16 bdf)
{
int i;
for (i = 0; i < PCI_NUM_REGIONS; i++) {
- pci_bios_allocate_region(bdf, i);
+ int is_64bit = pci_bios_allocate_region(bdf, i);
+ if (is_64bit){
+ i++;
+ }
}
}