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>
This commit is contained in:
Angel Pons 2020-06-07 18:01:56 +02:00 committed by Felix Held
parent 3e241f54d2
commit af36b29735
1 changed files with 36 additions and 0 deletions

View File

@ -80,6 +80,42 @@ void pci_write_config32(const struct device *dev, u16 reg, u32 val)
#endif
#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)