summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2013-07-26 08:53:59 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2016-12-06 20:45:22 +0100
commit48c389e69ebb3922594ccdd4664e7645d399920a (patch)
treeebae3bc4498102ead65928528e9378decc075b3e /src/arch/x86
parent154768b902384bc53d30eefa83f89e79eaf4ec2f (diff)
downloadcoreboot-48c389e69ebb3922594ccdd4664e7645d399920a.tar.xz
PCI ops: Define read-modify-write routines globally
Change-Id: I7d64f46bb4ec3229879a60159efc8a8408512acd Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/17690 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/include/arch/io.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/arch/x86/include/arch/io.h b/src/arch/x86/include/arch/io.h
index 0d4be8662a..0d1cadfb28 100644
--- a/src/arch/x86/include/arch/io.h
+++ b/src/arch/x86/include/arch/io.h
@@ -374,4 +374,37 @@ void pci_or_config32(device_t dev, unsigned int where, u32 ormask)
pci_write_config32(dev, where, value | ormask);
}
+static inline __attribute__ ((always_inline))
+void pci_update_config8(device_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 inline __attribute__ ((always_inline))
+void pci_update_config16(device_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 inline __attribute__ ((always_inline))
+void pci_update_config32(device_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