Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42145 )
Change subject: include/device/pci_ops.h: Add bitwise AND ops ......................................................................
include/device/pci_ops.h: Add bitwise AND ops
For the sake of completeness, we should provide these operations.
Change-Id: Ia28af94ec86319c7380d8377f7e24e5cdf55dd9c Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/include/device/pci_ops.h 1 file changed, 36 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/45/42145/1
diff --git a/src/include/device/pci_ops.h b/src/include/device/pci_ops.h index 3c28d48..680deb9 100644 --- a/src/include/device/pci_ops.h +++ b/src/include/device/pci_ops.h @@ -82,6 +82,42 @@
#if ENV_PCI_SIMPLE_DEVICE static __always_inline +void pci_and_config8(pci_devfn_t dev, u16 reg, u8 andmask) +#else +static __always_inline +void pci_and_config8(const struct device *dev, u16 reg, u8 andmask) +#endif +{ + u8 value = pci_read_config8(dev, reg); + pci_write_config8(dev, reg, value & andmask); +} + +#if ENV_PCI_SIMPLE_DEVICE +static __always_inline +void pci_and_config16(pci_devfn_t dev, u16 reg, u16 andmask) +#else +static __always_inline +void pci_and_config16(const struct device *dev, u16 reg, u16 andmask) +#endif +{ + u16 value = pci_read_config16(dev, reg); + pci_write_config16(dev, reg, value & andmask); +} + +#if ENV_PCI_SIMPLE_DEVICE +static __always_inline +void pci_and_config32(pci_devfn_t dev, u16 reg, u32 andmask) +#else +static __always_inline +void pci_and_config32(const struct device *dev, u16 reg, u32 andmask) +#endif +{ + u32 value = pci_read_config32(dev, reg); + pci_write_config32(dev, reg, value & andmask); +} + +#if ENV_PCI_SIMPLE_DEVICE +static __always_inline void pci_or_config8(pci_devfn_t dev, u16 reg, u8 ormask) #else static __always_inline
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42145 )
Change subject: include/device/pci_ops.h: Add bitwise AND ops ......................................................................
Patch Set 1: Code-Review+1
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42145 )
Change subject: include/device/pci_ops.h: Add bitwise AND ops ......................................................................
Patch Set 1: Code-Review+1
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42145 )
Change subject: include/device/pci_ops.h: Add bitwise AND ops ......................................................................
Patch Set 1: Code-Review+2
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/42145 )
Change subject: include/device/pci_ops.h: Add bitwise AND ops ......................................................................
include/device/pci_ops.h: Add bitwise AND ops
For the sake of completeness, we should provide these operations.
Change-Id: Ia28af94ec86319c7380d8377f7e24e5cdf55dd9c Signed-off-by: Angel Pons th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/42145 Reviewed-by: Nico Huber nico.h@gmx.de Reviewed-by: Kyösti Mälkki kyosti.malkki@gmail.com Reviewed-by: Paul Menzel paulepanter@users.sourceforge.net Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/include/device/pci_ops.h 1 file changed, 36 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Kyösti Mälkki: Looks good to me, but someone else must approve Nico Huber: Looks good to me, but someone else must approve Paul Menzel: Looks good to me, approved
diff --git a/src/include/device/pci_ops.h b/src/include/device/pci_ops.h index 3c28d48..680deb9 100644 --- a/src/include/device/pci_ops.h +++ b/src/include/device/pci_ops.h @@ -82,6 +82,42 @@
#if ENV_PCI_SIMPLE_DEVICE static __always_inline +void pci_and_config8(pci_devfn_t dev, u16 reg, u8 andmask) +#else +static __always_inline +void pci_and_config8(const struct device *dev, u16 reg, u8 andmask) +#endif +{ + u8 value = pci_read_config8(dev, reg); + pci_write_config8(dev, reg, value & andmask); +} + +#if ENV_PCI_SIMPLE_DEVICE +static __always_inline +void pci_and_config16(pci_devfn_t dev, u16 reg, u16 andmask) +#else +static __always_inline +void pci_and_config16(const struct device *dev, u16 reg, u16 andmask) +#endif +{ + u16 value = pci_read_config16(dev, reg); + pci_write_config16(dev, reg, value & andmask); +} + +#if ENV_PCI_SIMPLE_DEVICE +static __always_inline +void pci_and_config32(pci_devfn_t dev, u16 reg, u32 andmask) +#else +static __always_inline +void pci_and_config32(const struct device *dev, u16 reg, u32 andmask) +#endif +{ + u32 value = pci_read_config32(dev, reg); + pci_write_config32(dev, reg, value & andmask); +} + +#if ENV_PCI_SIMPLE_DEVICE +static __always_inline void pci_or_config8(pci_devfn_t dev, u16 reg, u8 ormask) #else static __always_inline