[Skiboot] [PATCH v3 5/6] VAS: Define OPAL_VAS_READ_FIR interface

Sukadev Bhattiprolu sukadev at linux.vnet.ibm.com
Wed Nov 30 16:36:28 AEDT 2016


Implement the OPAL_VAS_READ_FIR interface to read a Fault Isolation
Register (FIR) in VAS. Linux kernel can use this interface to dump these
registers in case of a fault from VAS.

Signed-off-by: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
---

Changelog[v2]
	[Alistair Popple]: Return OPAL_PARAMETER for invalid FIR index.
---
 core/vas.c         | 32 ++++++++++++++++++++++++++++++++
 include/opal-api.h |  3 ++-
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/core/vas.c b/core/vas.c
index d8d72e7..abe99a3 100644
--- a/core/vas.c
+++ b/core/vas.c
@@ -88,6 +88,38 @@ __attrconst uint64_t vas_get_wcbs_bar(int chipid)
 	return wcbs;
 }
 
+/*
+ * Read the Fault Isolation Register (FIR) identified by @idx for chip
+ * @chip_id.
+ */
+static int opal_vas_read_fir(uint32_t chip_id, int idx, uint64_t *val)
+{
+	struct proc_chip *chip;
+	uint64_t reg;
+
+	chip = get_chip(chip_id);
+	if (!chip)
+		return OPAL_PARAMETER;
+
+	/* FIRs 1,2,4,5 are write-only, just return 0 in them. */
+	switch (idx) {
+		case 0:	reg = VAS_FIR0; break;
+		case 3:	reg = VAS_FIR3; break;
+		case 6:	reg = VAS_FIR6; break;
+		case 7:	reg = VAS_FIR7; break;
+
+		case 1:
+		case 2:
+		case 4:
+		case 5: *val = 0ULL; return OPAL_SUCCESS;
+
+		default: return OPAL_PARAMETER;
+	}
+
+	return vas_scom_read(chip, reg, val);
+}
+opal_call(OPAL_VAS_READ_FIR, opal_vas_read_fir, 3);
+
 static int init_north_ctl(struct proc_chip *chip)
 {
 	uint64_t val = 0ULL;
diff --git a/include/opal-api.h b/include/opal-api.h
index 05ff51d..9705ebd 100644
--- a/include/opal-api.h
+++ b/include/opal-api.h
@@ -181,7 +181,8 @@
 #define OPAL_INT_SET_MFRR			125
 #define OPAL_PCI_TCE_KILL			126
 #define OPAL_NMMU_SET_PTCR			127
-#define OPAL_LAST				127
+#define OPAL_VAS_READ_FIR			128
+#define OPAL_LAST				128
 
 /* Device tree flags */
 
-- 
2.7.4



More information about the Skiboot mailing list