summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorJianjun Wang <jianjun.wang@mediatek.com>2022-03-02 10:20:26 +0800
committerHung-Te Lin <hungte@chromium.org>2022-03-08 08:25:36 +0000
commit8565b94a5396f8112a9b86c1c7529217dd603c17 (patch)
tree27e54396d7816d924b95660401a11c0424752eb7 /src/include
parent0e834a94556854751a321d28acf20605c75aa4da (diff)
device/mmio.h: Move readXp/writeXp helpers to device/mmio.h
These helpers are not architecture dependent and it might be used for different platform. Signed-off-by: Jianjun Wang <jianjun.wang@mediatek.com> Change-Id: Ic13a94d91affb7cf65a2f22f08ea39ed671bc8e8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/62561 Reviewed-by: Yu-Ping Wu <yupingso@google.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/device/mmio.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/include/device/mmio.h b/src/include/device/mmio.h
index 3c9a83363f..7c8e2bd2fa 100644
--- a/src/include/device/mmio.h
+++ b/src/include/device/mmio.h
@@ -207,4 +207,44 @@ static inline void buffer_to_fifo32(const void *buffer, size_t size, void *fifo,
#define READ32_BITFIELD(addr, name) \
EXTRACT_BITFIELD(read32(addr), name)
+static __always_inline uint8_t read8p(const uintptr_t addr)
+{
+ return read8((void *)addr);
+}
+
+static __always_inline uint16_t read16p(const uintptr_t addr)
+{
+ return read16((void *)addr);
+}
+
+static __always_inline uint32_t read32p(const uintptr_t addr)
+{
+ return read32((void *)addr);
+}
+
+static __always_inline uint64_t read64p(const uintptr_t addr)
+{
+ return read64((void *)addr);
+}
+
+static __always_inline void write8p(const uintptr_t addr, const uint8_t value)
+{
+ write8((void *)addr, value);
+}
+
+static __always_inline void write16p(const uintptr_t addr, const uint16_t value)
+{
+ write16((void *)addr, value);
+}
+
+static __always_inline void write32p(const uintptr_t addr, const uint32_t value)
+{
+ write32((void *)addr, value);
+}
+
+static __always_inline void write64p(const uintptr_t addr, const uint64_t value)
+{
+ write64((void *)addr, value);
+}
+
#endif /* __DEVICE_MMIO_H__ */