HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/30009
Change subject: include/device/pci_ops.h: Don't use device_t ......................................................................
include/device/pci_ops.h: Don't use device_t
Use of device_t is deprecated.
Change-Id: Idadb93a561ca8bf4382eba0eb404087ecf34cce7 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/include/device/pci_ops.h 1 file changed, 60 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/30009/1
diff --git a/src/include/device/pci_ops.h b/src/include/device/pci_ops.h index 5e60e8d..c79abdd 100644 --- a/src/include/device/pci_ops.h +++ b/src/include/device/pci_ops.h @@ -12,36 +12,29 @@ void pci_write_config8(struct device *dev, unsigned int where, u8 val); void pci_write_config16(struct device *dev, unsigned int where, u16 val); void pci_write_config32(struct device *dev, unsigned int where, u32 val); - -#endif - -/* - * Use device_t here as the functions are to be used with either - * __SIMPLE_DEVICE__ defined or undefined. - */ static __always_inline -void pci_or_config8(device_t dev, unsigned int where, u8 ormask) +void pci_or_config8(struct device *dev, unsigned int where, u8 ormask) { u8 value = pci_read_config8(dev, where); pci_write_config8(dev, where, value | ormask); }
static __always_inline -void pci_or_config16(device_t dev, unsigned int where, u16 ormask) +void pci_or_config16(struct device *dev, unsigned int where, u16 ormask) { u16 value = pci_read_config16(dev, where); pci_write_config16(dev, where, value | ormask); }
static __always_inline -void pci_or_config32(device_t dev, unsigned int where, u32 ormask) +void pci_or_config32(struct device *dev, unsigned int where, u32 ormask) { u32 value = pci_read_config32(dev, where); pci_write_config32(dev, where, value | ormask); }
static __always_inline -void pci_update_config8(device_t dev, int reg, u8 mask, u8 or) +void pci_update_config8(struct device *dev, int reg, u8 mask, u8 or) { u8 reg8;
@@ -52,7 +45,7 @@ }
static __always_inline -void pci_update_config16(device_t dev, int reg, u16 mask, u16 or) +void pci_update_config16(struct device *dev, int reg, u16 mask, u16 or) { u16 reg16;
@@ -63,7 +56,7 @@ }
static __always_inline -void pci_update_config32(device_t dev, int reg, u32 mask, u32 or) +void pci_update_config32(struct device *dev, int reg, u32 mask, u32 or) { u32 reg32;
@@ -72,7 +65,61 @@ reg32 |= or; pci_write_config32(dev, reg, reg32); } +#else +static __always_inline +void pci_or_config8(pci_devfn_t dev, unsigned int where, u8 ormask) +{ + u8 value = pci_read_config8(dev, where); + pci_write_config8(dev, where, value | ormask); +}
+static __always_inline +void pci_or_config16(pci_devfn_t dev, unsigned int where, u16 ormask) +{ + u16 value = pci_read_config16(dev, where); + pci_write_config16(dev, where, value | ormask); +} + +static __always_inline +void pci_or_config32(pci_devfn_t dev, unsigned int where, u32 ormask) +{ + u32 value = pci_read_config32(dev, where); + pci_write_config32(dev, where, value | ormask); +} + +static __always_inline +void pci_update_config8(pci_devfn_t dev, int reg, u8 mask, u8 or) +{ + u8 reg8; + + reg8 = pci_read_config8(dev, reg); + reg8 &= mask; + reg8 |= or; + pci_write_config8(dev, reg, reg8); +} + +static __always_inline +void pci_update_config16(pci_devfn_t dev, int reg, u16 mask, u16 or) +{ + u16 reg16; + + reg16 = pci_read_config16(dev, reg); + reg16 &= mask; + reg16 |= or; + pci_write_config16(dev, reg, reg16); +} + +static __always_inline +void pci_update_config32(pci_devfn_t dev, int reg, u32 mask, u32 or) +{ + u32 reg32; + + reg32 = pci_read_config32(dev, reg); + reg32 &= mask; + reg32 |= or; + pci_write_config32(dev, reg, reg32); +} +#endif /* !__SIMPLE_DEVICE__ */ const struct pci_bus_operations *pci_bus_default_ops(struct device *dev);
#endif /* PCI_OPS_H */