[2/4] phb4: Implement fence check

Submitted by Russell Currey on April 10, 2017, 1:57 a.m.

Details

Message ID 20170410015737.9487-3-ruscur@russell.cc
State Superseded
Headers show

Commit Message

Russell Currey April 10, 2017, 1:57 a.m.
Fence detection is missing in PHB4, so implement it.  The mechanism is the
exact same as in PHB3.

Signed-off-by: Russell Currey <ruscur@russell.cc>
---
 hw/phb4.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/hw/phb4.c b/hw/phb4.c
index 6c7bb9fe..2b2d2ab7 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -157,7 +157,14 @@  static inline void phb4_ioda_sel(struct phb4 *p, uint32_t table,
 /* Check if AIB is fenced via PBCQ NFIR */
 static bool phb4_fenced(struct phb4 *p)
 {
-	// FIXME
+	uint64_t nfir;
+
+	xscom_read(p->chip_id, p->pe_stk_xscom + 0x0, &nfir);
+	if (nfir & PPC_BIT(16)) {
+		p->flags |= PHB4_AIB_FENCED;
+		p->state = PHB4_STATE_FENCED;
+		return true;
+	}
 	return false;
 }