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

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Fri Feb 26 02:32:26 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>
---
 asm/head.S    |  2 +-
 hdata/spira.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/asm/head.S b/asm/head.S
index 6963188..c1db556 100644
--- a/asm/head.S
+++ b/asm/head.S
@@ -729,7 +729,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 e747c1d..4ff33e0 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -1020,12 +1020,57 @@ 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)
+{
+	struct spiras *spiras;
+
+	spiras = (struct spiras *)CPU_TO_BE64(SPIRA_HEAP_BASE);
+
+	/* Validate SPIRA-S signature */
+	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("");
 
 	/*
-- 
2.5.0



More information about the Skiboot mailing list