@@ -721,6 +721,8 @@ typedef struct PCIDevice {
static uint32_t pci_bios_io_addr;
static uint32_t pci_bios_mem_addr;
static uint32_t pci_bios_bigmem_addr;
+static uint32_t pci_bios_prefmem_addr;
+
/* host irqs corresponding to PCI irqs A-D */
static uint8_t pci_irqs[4] = { 10, 10, 11, 11 };
static PCIDevice i440_pcidev;
@@ -938,6 +940,11 @@ static void piix4_pm_enable(PCIDevice *d)
#endif
}
+static void pci_align_addr(uint32_t *paddr, uint32_t size)
+{
+ *paddr = (*paddr + size - 1) & ~(size - 1);
+}
+
static void pci_bios_init_device(PCIDevice *d)
{
int class;
@@ -1007,11 +1014,13 @@ static void pci_bios_init_device(PCIDevice *d)
size = (~(val & ~0xf)) + 1;
if (val & PCI_ADDRESS_SPACE_IO)
paddr = &pci_bios_io_addr;
+ else if (val & PCI_ADDRESS_SPACE_MEM_PREFETCH)
+ paddr = &pci_bios_prefmem_addr;
else if (size >= 0x04000000)
paddr = &pci_bios_bigmem_addr;
else
paddr = &pci_bios_mem_addr;
- *paddr = (*paddr + size - 1) & ~(size - 1);
+ pci_align_addr(paddr, size);
pci_set_io_region_addr(d, i, *paddr);
*paddr += size;
}
@@ -1072,6 +1081,11 @@ void pci_bios_init(void)
pci_bios_bigmem_addr = ram_size;
if (pci_bios_bigmem_addr < 0x90000000)
pci_bios_bigmem_addr = 0x90000000;
+ pci_bios_prefmem_addr = pci_bios_bigmem_addr + 0x08000000;
+ pci_align_addr(&pci_bios_prefmem_addr, 0x08000000);
+ if (pci_bios_prefmem_addr >= 0xe0000000) {
+ pci_bios_prefmem_addr = 0xf800000;
+ }
pci_for_each_device(pci_bios_init_bridges);
make pci space assigner preferchable memory aware. This is needed for PCI bridge support because memory space and prefetchable memory space is filtered differently beased on memory base/limit and prefetchable memory base/limit by pci bridge. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> --- rombios32.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)