diff mbox series

[v9,08/25] hdata: Adjust various structure offset after relocation

Message ID 20190712111802.23560-9-hegdevasant@linux.vnet.ibm.com
State Accepted
Headers show
Series MPIPL support | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (4db38a36b31045f0a116d388ddeac850b38c8680)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Vasant Hegde July 12, 2019, 11:17 a.m. UTC
ntuple addresses in SPIRAH are relative to payload base. Update various
addresses after relocation so that hostboot can access new address to
capture dump.

Note that we update relocated SPIRAH. So future if we add early OPAL
crash support, hostboot can still collect dump using origianl skiboot
base.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 hdata/spira.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
diff mbox series

Patch

diff --git a/hdata/spira.c b/hdata/spira.c
index 328c3479b..b5ec20db9 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -1600,6 +1600,27 @@  static void fixup_spira(void)
 	spira.ntuples.node_stb_data = spiras->ntuples.node_stb_data;
 }
 
+/*
+ * All the data structure addresses are relative to payload base. Hence adjust
+ * structures that are needed to capture OPAL dump during MPIPL.
+ */
+static void update_spirah_addr(void)
+{
+#if !defined(TEST)
+	extern uint32_t naca;
+	uint64_t *spirah_offset = (uint64_t *)&naca;
+	uint64_t *spira_offset = (uint64_t *)((u64)(&naca) + 0x30);
+
+	if (proc_gen < proc_gen_p9)
+		return;
+
+	*spirah_offset = SPIRAH_OFF;
+	*spira_offset = SPIRA_OFF;
+	spirah.ntuples.hs_data_area.addr = CPU_TO_BE64(SPIRA_HEAP_BASE - SKIBOOT_BASE);
+	spirah.ntuples.mdump_res.addr = CPU_TO_BE64(MDRT_TABLE_BASE - SKIBOOT_BASE);
+#endif
+}
+
 int parse_hdat(bool is_opal)
 {
 	cpu_type = PVR_TYPE(mfspr(SPR_PVR));
@@ -1608,6 +1629,8 @@  int parse_hdat(bool is_opal)
 
 	fixup_spira();
 
+	update_spirah_addr();
+
 	/*
 	 * Basic DT root stuff
 	 */