@@ -483,11 +483,33 @@ static enum fpga_sec_err m10bmc_sec_cancel(struct fpga_sec_mgr *smgr)
return ret ? FPGA_SEC_ERR_RW_ERROR : FPGA_SEC_ERR_NONE;
}
+#define HW_ERRINFO_POISON GENMASK(31, 0)
+static u64 m10bmc_sec_hw_errinfo(struct fpga_sec_mgr *smgr)
+{
+ struct m10bmc_sec *sec = smgr->priv;
+ u32 auth_result = HW_ERRINFO_POISON;
+ u32 doorbell = HW_ERRINFO_POISON;
+
+ switch (smgr->err_code) {
+ case FPGA_SEC_ERR_HW_ERROR:
+ case FPGA_SEC_ERR_TIMEOUT:
+ case FPGA_SEC_ERR_BUSY:
+ case FPGA_SEC_ERR_WEAROUT:
+ m10bmc_sys_read(sec->m10bmc, M10BMC_DOORBELL, &doorbell);
+ m10bmc_sys_read(sec->m10bmc, M10BMC_AUTH_RESULT, &auth_result);
+
+ return (u64)doorbell << 32 | (u64)auth_result;
+ default:
+ return 0;
+ }
+}
+
static const struct fpga_sec_mgr_ops m10bmc_sops = {
.prepare = m10bmc_sec_prepare,
.write_blk = m10bmc_sec_write_blk,
.poll_complete = m10bmc_sec_poll_complete,
.cancel = m10bmc_sec_cancel,
+ .get_hw_errinfo = m10bmc_sec_hw_errinfo,
};
static int m10bmc_secure_probe(struct platform_device *pdev)