[Skiboot] [PATCH 03/16] phb4: Add register access helpers

Michael Neuling mikey at neuling.org
Wed Jul 12 12:06:42 AEST 2017


From: Benjamin Herrenschmidt <benh at kernel.crashing.org>

Those will pick between ASB (ie, XSCOM) accesses and direct MMIO
based on PHB flags, thus allowing transparent access whether the
PHB is fenced or not.

Mark as unused for now so we don't get a warning.

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 hw/phb4.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/hw/phb4.c b/hw/phb4.c
index 9e5a0a56ac..ea16130e31 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -155,6 +155,22 @@ static inline void phb4_write_reg_asb(struct phb4 *p,
 #endif
 }
 
+static __unused uint64_t phb4_read_reg(struct phb4 *p, uint32_t offset)
+{
+	if (p->flags & PHB4_CFG_USE_ASB)
+		return phb4_read_reg_asb(p, offset);
+	else
+		return in_be64(p->regs + offset);
+}
+
+static __unused void phb4_write_reg(struct phb4 *p, uint32_t offset, uint64_t val)
+{
+	if (p->flags & PHB4_CFG_USE_ASB)
+		phb4_write_reg_asb(p, offset, val);
+	else
+		return out_be64(p->regs + offset, val);
+}
+
 /* Helper to select an IODA table entry */
 static inline void phb4_ioda_sel(struct phb4 *p, uint32_t table,
 				 uint32_t addr, bool autoinc)
-- 
2.11.0



More information about the Skiboot mailing list