diff options
Diffstat (limited to 'src/arch/x86/include/arch/io.h')
-rw-r--r-- | src/arch/x86/include/arch/io.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/arch/x86/include/arch/io.h b/src/arch/x86/include/arch/io.h index 0d1cadfb28..1ab69966a8 100644 --- a/src/arch/x86/include/arch/io.h +++ b/src/arch/x86/include/arch/io.h @@ -246,6 +246,60 @@ typedef u32 device_t; #include <arch/pci_io_cfg.h> #include <arch/pci_mmio_cfg.h> +static inline __attribute__((always_inline)) +uint8_t pci_read_config8(pci_devfn_t dev, unsigned int where) +{ + if (IS_ENABLED(CONFIG_MMCONF_SUPPORT_DEFAULT)) + return pci_mmio_read_config8(dev, where); + else + return pci_io_read_config8(dev, where); +} + +static inline __attribute__((always_inline)) +uint16_t pci_read_config16(pci_devfn_t dev, unsigned int where) +{ + if (IS_ENABLED(CONFIG_MMCONF_SUPPORT_DEFAULT)) + return pci_mmio_read_config16(dev, where); + else + return pci_io_read_config16(dev, where); +} + +static inline __attribute__((always_inline)) +uint32_t pci_read_config32(pci_devfn_t dev, unsigned int where) +{ + if (IS_ENABLED(CONFIG_MMCONF_SUPPORT_DEFAULT)) + return pci_mmio_read_config32(dev, where); + else + return pci_io_read_config32(dev, where); +} + +static inline __attribute__((always_inline)) +void pci_write_config8(pci_devfn_t dev, unsigned int where, uint8_t value) +{ + if (IS_ENABLED(CONFIG_MMCONF_SUPPORT_DEFAULT)) + pci_mmio_write_config8(dev, where, value); + else + pci_io_write_config8(dev, where, value); +} + +static inline __attribute__((always_inline)) +void pci_write_config16(pci_devfn_t dev, unsigned int where, uint16_t value) +{ + if (IS_ENABLED(CONFIG_MMCONF_SUPPORT_DEFAULT)) + pci_mmio_write_config16(dev, where, value); + else + pci_io_write_config16(dev, where, value); +} + +static inline __attribute__((always_inline)) +void pci_write_config32(pci_devfn_t dev, unsigned where, uint32_t value) +{ + if (IS_ENABLED(CONFIG_MMCONF_SUPPORT_DEFAULT)) + pci_mmio_write_config32(dev, where, value); + else + pci_io_write_config32(dev, where, value); +} + #define PCI_DEV_INVALID (0xffffffffU) static inline pci_devfn_t pci_io_locate_device(unsigned pci_id, pci_devfn_t dev) { |