summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2021-10-14 18:22:30 +0200
committerNico Huber <nico.h@gmx.de>2021-11-09 11:04:35 +0000
commite01e25d4fc1d57fd84f5043f3b0b84c596bb5253 (patch)
tree2e2c2b59eab2c85e2f8eb25c027f402004137f9b /src
parentafe18986070ca6a755eda104624f0dd4756ae96a (diff)
pci_mmio_cfg: Gather everything MMCONF (ECAM) related
To ease code sharing with other MMIO-based configuration mechanisms, move everything MMCONF (more specifically ECAM) related to one spot and guard it. Change-Id: Idda2320c331499dabbee7447f1ad3e81340f2a25 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/58332 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Shelley Chen <shchen@google.com> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/include/device/pci_mmio_cfg.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/include/device/pci_mmio_cfg.h b/src/include/device/pci_mmio_cfg.h
index e873abc32c..557adcb0ca 100644
--- a/src/include/device/pci_mmio_cfg.h
+++ b/src/include/device/pci_mmio_cfg.h
@@ -7,10 +7,6 @@
#include <device/mmio.h>
#include <device/pci_type.h>
-/* By not assigning this to CONFIG_MMCONF_BASE_ADDRESS here we
- * prevent some sub-optimal constant folding. */
-extern u8 *const pci_mmconf;
-
/* Using a unique datatype for MMIO writes makes the pointers to _not_
* qualify for pointer aliasing with any other objects in memory.
*
@@ -29,12 +25,28 @@ union pci_bank {
uint32_t reg32[4096 / sizeof(uint32_t)];
};
+#if CONFIG(MMCONF_SUPPORT)
+
+#if CONFIG_MMCONF_BASE_ADDRESS == 0
+#error "CONFIG_MMCONF_BASE_ADDRESS undefined!"
+#endif
+
+#if CONFIG_MMCONF_BUS_NUMBER * MiB != CONFIG_MMCONF_LENGTH
+#error "CONFIG_MMCONF_LENGTH does not correspond with CONFIG_MMCONF_BUS_NUMBER!"
+#endif
+
+/* By not assigning this to CONFIG_MMCONF_BASE_ADDRESS here we
+ prevent some sub-optimal constant folding. */
+extern u8 *const pci_mmconf;
+
static __always_inline
volatile union pci_bank *pcicfg(pci_devfn_t dev)
{
return (void *)&pci_mmconf[PCI_DEVFN_OFFSET(dev)];
}
+#endif
+
static __always_inline
uint8_t pci_mmio_read_config8(pci_devfn_t dev, uint16_t reg)
{
@@ -95,18 +107,6 @@ uint32_t *pci_mmio_config32_addr(pci_devfn_t dev, uint16_t reg)
return (uint32_t *)&pcicfg(dev)->reg32[reg / sizeof(uint32_t)];
}
-#if CONFIG(MMCONF_SUPPORT)
-
-#if CONFIG_MMCONF_BASE_ADDRESS == 0
-#error "CONFIG_MMCONF_BASE_ADDRESS undefined!"
-#endif
-
-#if CONFIG_MMCONF_BUS_NUMBER * MiB != CONFIG_MMCONF_LENGTH
-#error "CONFIG_MMCONF_LENGTH does not correspond with CONFIG_MMCONF_BUS_NUMBER!"
-#endif
-
-#endif
-
/* Avoid name collisions as different stages have different signature
* for these functions. The _s_ stands for simple, fundamental IO or
* MMIO variant.