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

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Sat Feb 13 02:38:09 AEDT 2016


Update NACA structure to point to "Hypervisor portion of SPIRA-H structure".
So that FSP can make sure of it and pass SPIRA-S to OPAL, instead of 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>
CC: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 asm/head.S    |  2 +-
 hdata/spira.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 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..f6f0d13 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -1020,12 +1020,60 @@ static void hostservices_parse(void)
 	hservices_from_hdat(dt_blob, size);
 }
 
+/*
+ * Legacy SPIRA is begin deprecated and we have new SPIRA-H and SPIRA-S
+ * structures. But on older system (p7?) will continue to support 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.
+ *
+ * XXX: This seems to be working on both old and new format. But we have
+ *      to cross check with FW folks and confirm.
+ */
+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.1.0



More information about the Skiboot mailing list