[Skiboot] [PATCH v3 4/6] hdata: Enable SPIRA-H

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Thu Mar 10 01:27:46 AEDT 2016


Update the SPIRA-H pointer in the NACA so that the FSP can build and pass
the SPIRA-S structure to OPAL instead of the legacy SPIRA. Older systems
(which does not support SPIRA-H) ignores SPIRA-H pointer and continue to
pass legacy SPIRA.

"spira" is a global structure and referred everywhere inside hdata dir. Once
we enable SPIRA-H we get data in SPIRA-S area, not in legacy spira. Hence
fixup spira structure, so that we don't break building device tree.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
Changes in v3:
  - Added condition check to fix hdata test case

 asm/head.S    |  2 +-
 hdata/spira.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 hdata/spira.h |  2 ++
 3 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/asm/head.S b/asm/head.S
index 192de55..5335846 100644
--- a/asm/head.S
+++ b/asm/head.S
@@ -737,7 +737,7 @@ init_replicated_sprs:
 	. = 0x4000
 .global naca
 naca:
-	.llong	0			/* 0x0000 : Reserved */
+	.llong	spirah			/* 0x0000 : SPIRA-H  */
 	.llong	0			/* 0x0008 : Reserved */
 	.llong	0			/* 0x0010 : Reserved */
 	.llong	hv_release_data		/* 0x0018 : HV release data */
diff --git a/hdata/spira.c b/hdata/spira.c
index b8ef0b0..5c5f064 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -193,6 +193,9 @@ __section(".spirah.data") struct spirah spirah = {
 	},
 };
 
+/* The service processor SPIRA-S structure */
+struct spiras *spiras;
+
 /* Overridden for testing. */
 #ifndef spira_check_ptr
 bool spira_check_ptr(const void *ptr, const char *file, unsigned int line)
@@ -1039,12 +1042,59 @@ static void hostservices_parse(void)
 	hservices_from_hdat(dt_blob, size);
 }
 
+/*
+ * Legacy SPIRA is being deprecated and we have new SPIRA-H/S structures.
+ * But on older system (p7?) we will continue to get legacy SPIRA.
+ *
+ * SPIRA-S is initialized and provided by FSP. We use SPIRA-S signature
+ * to identify supported format. Also if required adjust spira pointer.
+ */
+static void fixup_spira(void)
+{
+#if !defined(TEST)
+	spiras = (struct spiras *)CPU_TO_BE64(SPIRA_HEAP_BASE);
+#endif
+
+	/* Validate SPIRA-S signature */
+	if (!spiras)
+		return;
+	if (!(spiras->hdr.d1f0 == CPU_TO_BE16(0xd1f0)))
+		return;
+	if (memcmp(spiras->hdr.id, SPIRAS_HDIF_SIG, sizeof(spiras->hdr.id)))
+		return;
+
+	prlog(PR_NOTICE, "SPIRA-S found.\n");
+
+	spira.ntuples.sp_subsys = spiras->ntuples.sp_subsys;
+	spira.ntuples.ipl_parms = spiras->ntuples.ipl_parms;
+	spira.ntuples.nt_enclosure_vpd = spiras->ntuples.nt_enclosure_vpd;
+	spira.ntuples.slca = spiras->ntuples.slca;
+	spira.ntuples.backplane_vpd = spiras->ntuples.backplane_vpd;
+	spira.ntuples.system_vpd = spiras->ntuples.system_vpd;
+	spira.ntuples.proc_init = spirah.ntuples.proc_init;
+	spira.ntuples.clock_vpd = spiras->ntuples.clock_vpd;
+	spira.ntuples.anchor_vpd = spiras->ntuples.anchor_vpd;
+	spira.ntuples.op_panel_vpd = spiras->ntuples.op_panel_vpd;
+	spira.ntuples.misc_cec_fru_vpd = spiras->ntuples.misc_cec_fru_vpd;
+	spira.ntuples.ms_vpd = spiras->ntuples.ms_vpd;
+	spira.ntuples.cec_iohub_fru = spiras->ntuples.cec_iohub_fru;
+	spira.ntuples.cpu_ctrl = spirah.ntuples.cpu_ctrl;
+	spira.ntuples.mdump_src = spirah.ntuples.mdump_src;
+	spira.ntuples.mdump_dst = spirah.ntuples.mdump_dst;
+	spira.ntuples.mdump_res  = spirah.ntuples.mdump_res;
+	spira.ntuples.pcia = spiras->ntuples.pcia;
+	spira.ntuples.proc_chip = spiras->ntuples.proc_chip;
+	spira.ntuples.hs_data = spiras->ntuples.hs_data;
+}
+
 void parse_hdat(bool is_opal, uint32_t master_cpu)
 {
 	cpu_type = PVR_TYPE(mfspr(SPR_PVR));
 
 	prlog(PR_DEBUG, "Parsing HDAT...\n");
 
+	fixup_spira();
+
 	dt_root = dt_new_root("");
 
 	/*
diff --git a/hdata/spira.h b/hdata/spira.h
index ba3cef1..f283969 100644
--- a/hdata/spira.h
+++ b/hdata/spira.h
@@ -146,6 +146,8 @@ struct spiras {
 	u8			reserved[0x1c0];
 } __packed __align(0x100);
 
+extern struct spiras *spiras;
+
 
 /* This macro can be used to check the validity of a pointer returned
  * by one of the HDIF API functions. It returns true if the pointer
-- 
2.5.0



More information about the Skiboot mailing list