Kyösti Mälkki has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/31677 )
Change subject: device/pci_ops: Avoid name collisions ......................................................................
device/pci_ops: Avoid name collisions
Having different signatures for the PCI config accessors prevents them from having the same name in different stages.
For now, work around this using __SIMPLE_DEVICE__.
Change-Id: I20f56cfe3ac7dc4421e62a99ca91f39a857c0ccf Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com Reviewed-on: https://review.coreboot.org/c/31677 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Aaron Durbin adurbin@chromium.org Reviewed-by: Felix Held felix-coreboot@felixheld.de --- M src/arch/x86/include/arch/pci_io_cfg.h M src/include/device/pci_mmio_cfg.h M src/include/device/pci_ops.h 3 files changed, 37 insertions(+), 17 deletions(-)
Approvals: build bot (Jenkins): Verified Aaron Durbin: Looks good to me, approved Felix Held: Looks good to me, approved
diff --git a/src/arch/x86/include/arch/pci_io_cfg.h b/src/arch/x86/include/arch/pci_io_cfg.h index d02e640..3e2129f 100644 --- a/src/arch/x86/include/arch/pci_io_cfg.h +++ b/src/arch/x86/include/arch/pci_io_cfg.h @@ -78,43 +78,48 @@ }
#if !IS_ENABLED(CONFIG_MMCONF_SUPPORT) -#ifdef __SIMPLE_DEVICE__ + +/* Avoid name collisions as different stages have different signature + * for these functions. The _s_ stands for simple, fundamental IO or + * MMIO variant. + */ + static __always_inline -uint8_t pci_read_config8(pci_devfn_t dev, unsigned int where) +uint8_t pci_s_read_config8(pci_devfn_t dev, unsigned int where) { return pci_io_read_config8(dev, where); }
static __always_inline -uint16_t pci_read_config16(pci_devfn_t dev, unsigned int where) +uint16_t pci_s_read_config16(pci_devfn_t dev, unsigned int where) { return pci_io_read_config16(dev, where); }
static __always_inline -uint32_t pci_read_config32(pci_devfn_t dev, unsigned int where) +uint32_t pci_s_read_config32(pci_devfn_t dev, unsigned int where) { return pci_io_read_config32(dev, where); }
static __always_inline -void pci_write_config8(pci_devfn_t dev, unsigned int where, uint8_t value) +void pci_s_write_config8(pci_devfn_t dev, unsigned int where, uint8_t value) { pci_io_write_config8(dev, where, value); }
static __always_inline -void pci_write_config16(pci_devfn_t dev, unsigned int where, uint16_t value) +void pci_s_write_config16(pci_devfn_t dev, unsigned int where, uint16_t value) { pci_io_write_config16(dev, where, value); }
static __always_inline -void pci_write_config32(pci_devfn_t dev, unsigned int where, uint32_t value) +void pci_s_write_config32(pci_devfn_t dev, unsigned int where, uint32_t value) { pci_io_write_config32(dev, where, value); } -#endif /* __SIMPLE_DEVICE__ */ + #endif
#endif /* _PCI_IO_CFG_H */ diff --git a/src/include/device/pci_mmio_cfg.h b/src/include/device/pci_mmio_cfg.h index 0545001..d7ada4d 100644 --- a/src/include/device/pci_mmio_cfg.h +++ b/src/include/device/pci_mmio_cfg.h @@ -72,43 +72,46 @@
#if IS_ENABLED(CONFIG_MMCONF_SUPPORT)
-#ifdef __SIMPLE_DEVICE__ +/* Avoid name collisions as different stages have different signature + * for these functions. The _s_ stands for simple, fundamental IO or + * MMIO variant. + */ + static __always_inline -uint8_t pci_read_config8(pci_devfn_t dev, unsigned int where) +uint8_t pci_s_read_config8(pci_devfn_t dev, unsigned int where) { return pci_mmio_read_config8(dev, where); }
static __always_inline -uint16_t pci_read_config16(pci_devfn_t dev, unsigned int where) +uint16_t pci_s_read_config16(pci_devfn_t dev, unsigned int where) { return pci_mmio_read_config16(dev, where); }
static __always_inline -uint32_t pci_read_config32(pci_devfn_t dev, unsigned int where) +uint32_t pci_s_read_config32(pci_devfn_t dev, unsigned int where) { return pci_mmio_read_config32(dev, where); }
static __always_inline -void pci_write_config8(pci_devfn_t dev, unsigned int where, uint8_t value) +void pci_s_write_config8(pci_devfn_t dev, unsigned int where, uint8_t value) { pci_mmio_write_config8(dev, where, value); }
static __always_inline -void pci_write_config16(pci_devfn_t dev, unsigned int where, uint16_t value) +void pci_s_write_config16(pci_devfn_t dev, unsigned int where, uint16_t value) { pci_mmio_write_config16(dev, where, value); }
static __always_inline -void pci_write_config32(pci_devfn_t dev, unsigned int where, uint32_t value) +void pci_s_write_config32(pci_devfn_t dev, unsigned int where, uint32_t value) { pci_mmio_write_config32(dev, where, value); } -#endif /* __SIMPLE_DEVICE__ */
#endif
diff --git a/src/include/device/pci_ops.h b/src/include/device/pci_ops.h index 1cf5b77..6bcb3e9 100644 --- a/src/include/device/pci_ops.h +++ b/src/include/device/pci_ops.h @@ -5,7 +5,19 @@ #include <device/device.h> #include <arch/pci_ops.h>
-#ifndef __SIMPLE_DEVICE__ +#ifdef __SIMPLE_DEVICE__ + +/* Avoid name collisions as different stages have different signature + * for these functions. The _s_ stands for simple, fundamental IO or + * MMIO variant. + */ +#define pci_read_config8 pci_s_read_config8 +#define pci_read_config16 pci_s_read_config16 +#define pci_read_config32 pci_s_read_config32 +#define pci_write_config8 pci_s_write_config8 +#define pci_write_config16 pci_s_write_config16 +#define pci_write_config32 pci_s_write_config32 +#else u8 pci_read_config8(struct device *dev, unsigned int where); u16 pci_read_config16(struct device *dev, unsigned int where); u32 pci_read_config32(struct device *dev, unsigned int where);