diff options
-rw-r--r-- | hdata/memory.c | 47 | ||||
-rw-r--r-- | hdata/spira.h | 5 | ||||
-rw-r--r-- | hdata/test/stubs.c | 1 |
3 files changed, 53 insertions, 0 deletions
diff --git a/hdata/memory.c b/hdata/memory.c index 46ad4f7..686c93e 100644 --- a/hdata/memory.c +++ b/hdata/memory.c @@ -474,6 +474,51 @@ static void get_hb_reserved_mem(struct HDIF_common_hdr *ms_vpd) } } +static void parse_trace_reservations(struct HDIF_common_hdr *ms_vpd) +{ + unsigned int size; + int count, i; + + /* + * The trace arrays are only setup when hostboot is explicitly + * configured to enable them. We need to check and gracefully handle + * when they're not present. + */ + + if (!HDIF_get_idata(ms_vpd, MSVPD_IDATA_TRACE_AREAS, &size) || !size) { + prlog(PR_DEBUG, "MS VPD: No trace areas found."); + return; + } + + count = HDIF_get_iarray_size(ms_vpd, MSVPD_IDATA_TRACE_AREAS); + if (count <= 0) { + prlog(PR_DEBUG, "MS VPD: No trace areas found."); + return; + } + + prlog(PR_INFO, "MS VPD: Found %d trace areas\n", count); + + for (i = 0; i < count; i++) { + const struct msvpd_trace *trace_area; + u64 start, end; + + trace_area = HDIF_get_iarray_item(ms_vpd, + MSVPD_IDATA_TRACE_AREAS, i, &size); + + if (!trace_area) + return; /* shouldn't happen */ + + start = be64_to_cpu(trace_area->start) & ~HRMOR_BIT; + end = be64_to_cpu(trace_area->end) & ~HRMOR_BIT; + + prlog(PR_INFO, + "MSVPD: Trace area: 0x%.16"PRIx64"-0x%.16"PRIx64"\n", + start, end); + + mem_reserve_hwbuf("trace-area", start, end - start); + } +} + static bool __memory_parse(struct dt_node *root) { struct HDIF_common_hdr *ms_vpd; @@ -524,6 +569,8 @@ static bool __memory_parse(struct dt_node *root) get_hb_reserved_mem(ms_vpd); + parse_trace_reservations(ms_vpd); + prlog(PR_INFO, "MS VPD: Total MB of RAM: 0x%llx\n", (long long)be64_to_cpu(tcms->total_in_mb)); diff --git a/hdata/spira.h b/hdata/spira.h index abf5da8..bb7ad3e 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -513,6 +513,11 @@ struct msvpd_pmover_bsr_synchro { } __packed; /* Idata index 3: Memory Trace Array */ +#define MSVPD_IDATA_TRACE_AREAS 3 +struct msvpd_trace { + __be64 start, end; + char reserved[16]; +}; /* Idata index 4: UE Address Array */ diff --git a/hdata/test/stubs.c b/hdata/test/stubs.c index 68f55e6..aaecddb 100644 --- a/hdata/test/stubs.c +++ b/hdata/test/stubs.c @@ -99,6 +99,7 @@ STUB(op_display); STUB(fsp_preload_lid); STUB(fsp_wait_lid_loaded); STUB(fsp_adjust_lid_side); +STUB(backtrace); /* Add HW specific stubs here */ static void noop_function(void) {} |