diff mbox series

prd: handle GET_ELOG_TIME firmware request from HBRT

Message ID 20261006212230.63530-1-njoop@linux.ibm.com
State New
Headers show
Series prd: handle GET_ELOG_TIME firmware request from HBRT | expand

Commit Message

Nishaanth Joopelli Oct. 6, 2026, 9:22 p.m. UTC
Power10 HBRT sends a PRD_FW_MSG_TYPE_GET_ELOG_TIME (type 0x0f) requestwhich was not handled by skiboot.
Added the message type to the prd_fw_msg enum and a datetime struct to the prd_fw_msg response.

Signed-off-by: Nishaanth Joopelli <njoop@linux.ibm.com>
---
 hw/prd.c             | 26 ++++++++++++++++++++++++++
 include/prd-fw-msg.h |  5 +++++
 2 files changed, 31 insertions(+)
diff mbox series

Patch

diff --git a/hw/prd.c b/hw/prd.c
index e2600171..bf70b831 100644
--- a/hw/prd.c
+++ b/hw/prd.c
@@ -15,6 +15,7 @@ 
 #include <mem_region.h>
 #include <prd-fw-msg.h>
 #include <hostservices.h>
+#include <rtc.h>
 
 enum events {
 	EVENT_ATTN	= 1 << 0,
@@ -635,6 +636,31 @@  static int prd_msg_handle_firmware_req(struct opal_prd_msg *msg)
 			prd_msg_fsp_req = NULL;
 		}
 		break;
+	case PRD_FW_MSG_TYPE_GET_ELOG_TIME:
+	{
+		uint32_t y_m_d;
+		uint64_t h_m_s_ms;
+
+		rc = rtc_cache_get_datetime(&y_m_d, &h_m_s_ms);
+		if (rc) {
+			prlog(PR_DEBUG, "PRD: GET_ELOG_TIME: RTC not available, rc=%d\n", rc);
+			fw_resp->type = cpu_to_be64(PRD_FW_MSG_TYPE_RESP_GENERIC);
+			fw_resp->generic_resp.status = cpu_to_be64(rc);
+			prd_msg->fw_resp.len = cpu_to_be64(PRD_FW_MSG_BASE_SIZE +
+							sizeof(fw_resp->generic_resp));
+			prd_msg->hdr.size = cpu_to_be16(sizeof(*prd_msg));
+			rc = 0;
+			break;
+		}
+		fw_resp->type = cpu_to_be64(PRD_FW_MSG_TYPE_GET_ELOG_TIME);
+		fw_resp->datetime.y_m_d = cpu_to_be32(y_m_d);
+		fw_resp->datetime.h_m_s_ms = cpu_to_be64(h_m_s_ms);
+		prd_msg->fw_resp.len = cpu_to_be64(PRD_FW_MSG_BASE_SIZE +
+						sizeof(fw_resp->datetime));
+		prd_msg->hdr.size = cpu_to_be16(sizeof(*prd_msg));
+		rc = 0;
+		break;
+	}
 	default:
 		prlog(PR_DEBUG, "PRD: Unsupported fw_request type : 0x%llx\n",
 		      be64_to_cpu(fw_req->type));
diff --git a/include/prd-fw-msg.h b/include/prd-fw-msg.h
index d0e5385f..0c3d7107 100644
--- a/include/prd-fw-msg.h
+++ b/include/prd-fw-msg.h
@@ -17,6 +17,7 @@  enum {
 	PRD_FW_MSG_TYPE_HBRT_FSP = 4,
 	PRD_FW_MSG_TYPE_ERROR_LOG = 5,
 	PRD_FW_MSG_TYPE_FSP_HBRT = 6,
+	PRD_FW_MSG_TYPE_GET_ELOG_TIME = 15,
 };
 
 struct prd_fw_msg {
@@ -33,6 +34,10 @@  struct prd_fw_msg {
 		struct {
 			char	data;
 		} mbox_msg;
+		struct {
+			__be32	y_m_d;
+			__be64	h_m_s_ms;
+		} __packed datetime;
 	};
 };