summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dev/arm/RealView.py5
-rw-r--r--src/dev/arm/realview.cc27
-rw-r--r--src/dev/arm/realview.hh3
3 files changed, 32 insertions, 3 deletions
diff --git a/src/dev/arm/RealView.py b/src/dev/arm/RealView.py
index 13ab50b70..ee5993a88 100644
--- a/src/dev/arm/RealView.py
+++ b/src/dev/arm/RealView.py
@@ -180,7 +180,10 @@ class RealView(Platform):
type = 'RealView'
cxx_header = "dev/arm/realview.hh"
system = Param.System(Parent.any, "system")
+ pci_io_base = Param.Addr(0, "Base address of PCI IO Space")
pci_cfg_base = Param.Addr(0, "Base address of PCI Configuraiton Space")
+ pci_cfg_gen_offsets = Param.Bool(False, "Should the offsets used for PCI cfg access"
+ " be compatible with the pci-generic-host or the legacy host bridge?")
mem_start_addr = Param.Addr(0, "Start address of main memory")
max_mem_size = Param.Addr('256MB', "Maximum amount of RAM supported by platform")
@@ -597,6 +600,8 @@ class VExpress_EMM(RealView):
self.mmc_fake.clk_domain = clkdomain
class VExpress_EMM64(VExpress_EMM):
+ pci_io_base = 0x2f000000
+ pci_cfg_gen_offsets = True
def setupBootLoader(self, mem_bus, cur_sys, loc):
self.nvmem = SimpleMemory(range = AddrRange(0, size = '64MB'))
self.nvmem.port = mem_bus.master
diff --git a/src/dev/arm/realview.cc b/src/dev/arm/realview.cc
index 18208b402..0409f888d 100644
--- a/src/dev/arm/realview.cc
+++ b/src/dev/arm/realview.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009 ARM Limited
+ * Copyright (c) 2009, 2014 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -63,6 +63,21 @@ RealView::RealView(const Params *p)
{}
void
+RealView::initState()
+{
+ Addr junk;
+ bool has_gen_pci_host;
+ has_gen_pci_host = system->kernelSymtab->findAddress("gen_pci_setup", junk);
+
+ if (has_gen_pci_host && !params()->pci_cfg_gen_offsets)
+ warn("Kernel supports generic PCI host but PCI Config offsets "
+ "configured for legacy. Set pci_cfg_gen_offsets to True");
+ if (has_gen_pci_host && !params()->pci_io_base)
+ warn("Kernel supports generic PCI host but PCI IO base is set "
+ "to 0. Set pci_io_base to the start of PCI IO space");
+}
+
+void
RealView::postConsoleInt()
{
warn_once("Don't know what interrupt to post for console.\n");
@@ -100,13 +115,19 @@ RealView::calcPciConfigAddr(int bus, int dev, int func)
{
if (bus != 0)
return ULL(-1);
- return params()->pci_cfg_base | ((func & 7) << 16) | ((dev & 0x1f) << 19);
+
+ Addr cfg_offset = 0;
+ if (params()->pci_cfg_gen_offsets)
+ cfg_offset |= ((func & 7) << 12) | ((dev & 0x1f) << 15);
+ else
+ cfg_offset |= ((func & 7) << 16) | ((dev & 0x1f) << 19);
+ return params()->pci_cfg_base | cfg_offset;
}
Addr
RealView::calcPciIOAddr(Addr addr)
{
- return addr;
+ return params()->pci_io_base + addr;
}
Addr
diff --git a/src/dev/arm/realview.hh b/src/dev/arm/realview.hh
index 38fa040d5..5129069d4 100644
--- a/src/dev/arm/realview.hh
+++ b/src/dev/arm/realview.hh
@@ -79,6 +79,9 @@ class RealView : public Platform
*/
RealView(const Params *p);
+ /** In init do some checks to help verify we're setup correctly */
+ virtual void initState();
+
/** Give platform a pointer to interrupt controller */
void setGic(BaseGic *_gic) { gic = _gic; }