@@ -225,31 +225,35 @@ static const struct nx_xstop_bit_info nx_pbi_xstop_bits[] = {
};
static struct lock hmi_lock = LOCK_UNLOCKED;
+static bool xscom_addrs_valid;
static uint32_t malf_alert_scom;
static uint32_t nx_status_reg;
static uint32_t nx_dma_engine_fir;
static uint32_t nx_pbi_fir;
-static int setup_scom_addresses(void)
+void hmi_setup_xscom_addrs(void)
{
+ xscom_addrs_valid = true;
+
switch (proc_gen) {
case proc_gen_p8:
malf_alert_scom = P8_MALFUNC_ALERT;
nx_status_reg = P8_NX_STATUS_REG;
nx_dma_engine_fir = P8_NX_DMA_ENGINE_FIR;
nx_pbi_fir = P8_NX_PBI_FIR;
- return 1;
+ return;
case proc_gen_p9:
malf_alert_scom = P9_MALFUNC_ALERT;
nx_status_reg = P9_NX_STATUS_REG;
nx_dma_engine_fir = P9_NX_DMA_ENGINE_FIR;
nx_pbi_fir = P9_NX_PBI_FIR;
- return 1;
+ return;
default:
+ xscom_addrs_valid = false;
prerror("HMI: %s: Unknown CPU type\n", __func__);
break;
}
- return 0;
+ return;
}
static int queue_hmi_event(struct OpalHMIEvent *hmi_evt, int recover)
@@ -583,8 +587,8 @@ static void decode_malfunction(struct OpalHMIEvent *hmi_evt)
uint64_t malf_alert;
bool event_generated = false;
- if (!setup_scom_addresses()) {
- prerror("HMI: Failed to setup scom addresses\n");
+ if (!xscom_addrs_valid) {
+ prerror("HMI: xscom addresses invalid\n");
/* Send an unknown HMI event. */
hmi_evt->u.xstop_error.xstop_type = CHECKSTOP_TYPE_UNKNOWN;
hmi_evt->u.xstop_error.xstop_reason = 0;
@@ -756,6 +756,9 @@ void xscom_init(void)
xstop_xscom.addr, xstop_xscom.fir_bit);
} else
prlog(PR_DEBUG, "XSTOP: ibm,sw-checkstop-fir prop not found\n");
+
+ /* Setup HMI xscom addresses. */
+ hmi_setup_xscom_addrs();
}
void xscom_used_by_console(void)
@@ -248,4 +248,7 @@ extern bool xscom_ok(void);
extern int64_t xscom_read_cfam_chipid(uint32_t partid, uint32_t *chip_id);
extern int64_t xscom_trigger_xstop(void);
+/* HMI xscom setup function */
+extern void hmi_setup_xscom_addrs(void);
+
#endif /* __XSCOM_H */