Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42147 )
Change subject: pci_ops.h: Turn and/or ops into update wrappers ......................................................................
pci_ops.h: Turn and/or ops into update wrappers
Tested with BUILD_TIMELESS=1, Asus P8Z77-V LX2 does not change.
Change-Id: I2d3779967f357dd380928869c630a1996fdd60ec Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/include/device/pci_ops.h 1 file changed, 66 insertions(+), 72 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/47/42147/1
diff --git a/src/include/device/pci_ops.h b/src/include/device/pci_ops.h index 680deb9..cdf02d6 100644 --- a/src/include/device/pci_ops.h +++ b/src/include/device/pci_ops.h @@ -82,78 +82,6 @@
#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 -void pci_or_config8(const struct device *dev, u16 reg, u8 ormask) -#endif -{ - u8 value = pci_read_config8(dev, reg); - pci_write_config8(dev, reg, value | ormask); -} - -#if ENV_PCI_SIMPLE_DEVICE -static __always_inline -void pci_or_config16(pci_devfn_t dev, u16 reg, u16 ormask) -#else -static __always_inline -void pci_or_config16(const struct device *dev, u16 reg, u16 ormask) -#endif -{ - u16 value = pci_read_config16(dev, reg); - pci_write_config16(dev, reg, value | ormask); -} - -#if ENV_PCI_SIMPLE_DEVICE -static __always_inline -void pci_or_config32(pci_devfn_t dev, u16 reg, u32 ormask) -#else -static __always_inline -void pci_or_config32(const struct device *dev, u16 reg, u32 ormask) -#endif -{ - u32 value = pci_read_config32(dev, reg); - pci_write_config32(dev, reg, value | ormask); -} - -#if ENV_PCI_SIMPLE_DEVICE -static __always_inline void pci_update_config8(pci_devfn_t dev, u16 reg, u8 mask, u8 or) #else static __always_inline @@ -200,6 +128,72 @@ pci_write_config32(dev, reg, reg32); }
+#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 +{ + pci_update_config8(dev, reg, andmask, 0); +} + +#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 +{ + pci_update_config16(dev, reg, andmask, 0); +} + +#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 +{ + pci_update_config32(dev, reg, andmask, 0); +} + +#if ENV_PCI_SIMPLE_DEVICE +static __always_inline +void pci_or_config8(pci_devfn_t dev, u16 reg, u8 ormask) +#else +static __always_inline +void pci_or_config8(const struct device *dev, u16 reg, u8 ormask) +#endif +{ + pci_update_config8(dev, reg, 0xff, ormask); +} + +#if ENV_PCI_SIMPLE_DEVICE +static __always_inline +void pci_or_config16(pci_devfn_t dev, u16 reg, u16 ormask) +#else +static __always_inline +void pci_or_config16(const struct device *dev, u16 reg, u16 ormask) +#endif +{ + pci_update_config16(dev, reg, 0xffff, ormask); +} + +#if ENV_PCI_SIMPLE_DEVICE +static __always_inline +void pci_or_config32(pci_devfn_t dev, u16 reg, u32 ormask) +#else +static __always_inline +void pci_or_config32(const struct device *dev, u16 reg, u32 ormask) +#endif +{ + pci_update_config32(dev, reg, 0xffffffff, ormask); +} + u16 pci_s_find_next_capability(pci_devfn_t dev, u16 cap, u16 last); u16 pci_s_find_capability(pci_devfn_t dev, u16 cap);
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42147 )
Change subject: pci_ops.h: Turn and/or ops into update wrappers ......................................................................
Patch Set 1: Code-Review+2
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42147 )
Change subject: pci_ops.h: Turn and/or ops into update wrappers ......................................................................
Patch Set 1: Code-Review+1
Hello build bot (Jenkins), Nico Huber, Paul Menzel, Aaron Durbin,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/42147
to look at the new patch set (#2).
Change subject: pci_ops.h: Turn and/or ops into update wrappers ......................................................................
pci_ops.h: Turn and/or ops into update wrappers
Tested with BUILD_TIMELESS=1, Asus P8Z77-V LX2 does not change.
Change-Id: I2d3779967f357dd380928869c630a1996fdd60ec Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/include/device/pci_ops.h 1 file changed, 66 insertions(+), 72 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/47/42147/2
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/42147 )
Change subject: pci_ops.h: Turn and/or ops into update wrappers ......................................................................
pci_ops.h: Turn and/or ops into update wrappers
Tested with BUILD_TIMELESS=1, Asus P8Z77-V LX2 does not change.
Change-Id: I2d3779967f357dd380928869c630a1996fdd60ec Signed-off-by: Angel Pons th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/42147 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Nico Huber nico.h@gmx.de Reviewed-by: Paul Menzel paulepanter@users.sourceforge.net --- M src/include/device/pci_ops.h 1 file changed, 66 insertions(+), 72 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Paul Menzel: Looks good to me, but someone else must approve
diff --git a/src/include/device/pci_ops.h b/src/include/device/pci_ops.h index 680deb9..cdf02d6 100644 --- a/src/include/device/pci_ops.h +++ b/src/include/device/pci_ops.h @@ -82,78 +82,6 @@
#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 -void pci_or_config8(const struct device *dev, u16 reg, u8 ormask) -#endif -{ - u8 value = pci_read_config8(dev, reg); - pci_write_config8(dev, reg, value | ormask); -} - -#if ENV_PCI_SIMPLE_DEVICE -static __always_inline -void pci_or_config16(pci_devfn_t dev, u16 reg, u16 ormask) -#else -static __always_inline -void pci_or_config16(const struct device *dev, u16 reg, u16 ormask) -#endif -{ - u16 value = pci_read_config16(dev, reg); - pci_write_config16(dev, reg, value | ormask); -} - -#if ENV_PCI_SIMPLE_DEVICE -static __always_inline -void pci_or_config32(pci_devfn_t dev, u16 reg, u32 ormask) -#else -static __always_inline -void pci_or_config32(const struct device *dev, u16 reg, u32 ormask) -#endif -{ - u32 value = pci_read_config32(dev, reg); - pci_write_config32(dev, reg, value | ormask); -} - -#if ENV_PCI_SIMPLE_DEVICE -static __always_inline void pci_update_config8(pci_devfn_t dev, u16 reg, u8 mask, u8 or) #else static __always_inline @@ -200,6 +128,72 @@ pci_write_config32(dev, reg, reg32); }
+#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 +{ + pci_update_config8(dev, reg, andmask, 0); +} + +#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 +{ + pci_update_config16(dev, reg, andmask, 0); +} + +#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 +{ + pci_update_config32(dev, reg, andmask, 0); +} + +#if ENV_PCI_SIMPLE_DEVICE +static __always_inline +void pci_or_config8(pci_devfn_t dev, u16 reg, u8 ormask) +#else +static __always_inline +void pci_or_config8(const struct device *dev, u16 reg, u8 ormask) +#endif +{ + pci_update_config8(dev, reg, 0xff, ormask); +} + +#if ENV_PCI_SIMPLE_DEVICE +static __always_inline +void pci_or_config16(pci_devfn_t dev, u16 reg, u16 ormask) +#else +static __always_inline +void pci_or_config16(const struct device *dev, u16 reg, u16 ormask) +#endif +{ + pci_update_config16(dev, reg, 0xffff, ormask); +} + +#if ENV_PCI_SIMPLE_DEVICE +static __always_inline +void pci_or_config32(pci_devfn_t dev, u16 reg, u32 ormask) +#else +static __always_inline +void pci_or_config32(const struct device *dev, u16 reg, u32 ormask) +#endif +{ + pci_update_config32(dev, reg, 0xffffffff, ormask); +} + u16 pci_s_find_next_capability(pci_devfn_t dev, u16 cap, u16 last); u16 pci_s_find_capability(pci_devfn_t dev, u16 cap);