Skip to content

Commit 23a5fba

Browse files
tpetazzoniLorenzo Pieralisi
authored andcommitted
PCI: Introduce PCI bridge emulated config space common logic
Some PCI host controllers do not expose a configuration space for the root port PCI bridge. Due to this, the Marvell Armada 370/38x/XP PCI controller driver (pci-mvebu) emulates a root port PCI bridge configuration space, and uses that to (among other things) dynamically create the memory windows that correspond to the PCI MEM and I/O regions. Since we now need to add a very similar logic for the Marvell Armada 37xx PCI controller driver (pci-aardvark), instead of duplicating the code, we create in this commit a common logic called pci-bridge-emul. The idea of this logic is to emulate a root port PCI bridge configuration space by providing configuration space read/write operations, and faking behind the scenes the configuration space of a PCI bridge. A PCI host controller driver simply has to call pci_bridge_emul_conf_read() and pci_bridge_emul_conf_write() to read/write the configuration space of the bridge. By default, the PCI bridge configuration space is simply emulated by a chunk of memory, but the PCI host controller can override the behavior of the read and write operations on a per-register basis to do additional actions if needed. We take care of complying with the behavior of the PCI configuration space registers in terms of bits that are read-write, read-only, reserved and write-1-to-clear. Signed-off-by: Thomas Petazzoni <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Reviewed-by: Russell King <[email protected]>
1 parent 684e07e commit 23a5fba

File tree

4 files changed

+536
-0
lines changed

4 files changed

+536
-0
lines changed

drivers/pci/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ config PCI_ECAM
9898
config PCI_LOCKLESS_CONFIG
9999
bool
100100

101+
config PCI_BRIDGE_EMUL
102+
bool
103+
101104
config PCI_IOV
102105
bool "PCI IOV support"
103106
depends on PCI

drivers/pci/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ obj-$(CONFIG_HOTPLUG_PCI) += hotplug/
1919
obj-$(CONFIG_PCI_MSI) += msi.o
2020
obj-$(CONFIG_PCI_ATS) += ats.o
2121
obj-$(CONFIG_PCI_IOV) += iov.o
22+
obj-$(CONFIG_PCI_BRIDGE_EMUL) += pci-bridge-emul.o
2223
obj-$(CONFIG_ACPI) += pci-acpi.o
2324
obj-$(CONFIG_PCI_LABEL) += pci-label.o
2425
obj-$(CONFIG_X86_INTEL_MID) += pci-mid.o

0 commit comments

Comments
 (0)