[Skiboot] [PATCH v2 02/10] pel: replace opal_* prefixes with pel_* for pel definitions.

Mahesh Salgaonkar mahesh at linux.ibm.com
Wed Oct 7 23:09:00 AEDT 2020


All the structures defined in pel.h is as per the PEL (Platform Error Log)
format and it is used for generating PEL error logs for FSP/BMC. However
all definitions start with prefix opal_* giving a impression that these are
defined by OPAL. This patch fixes this by replacing opal_* prefixes with
pel_*. No functionality change.

Signed-off-by: Mahesh Salgaonkar <mahesh at linux.ibm.com>
---
 core/pel.c    |   86 +++++++++++++++++++++++++++++----------------------------
 include/pel.h |   84 ++++++++++++++++++++++++++++----------------------------
 2 files changed, 85 insertions(+), 85 deletions(-)

diff --git a/core/pel.c b/core/pel.c
index 4b2656346..3a200238e 100644
--- a/core/pel.c
+++ b/core/pel.c
@@ -18,24 +18,24 @@ static void create_mtms_section(struct errorlog *elog_data,
 {
 	const struct dt_property *p;
 
-	struct opal_mtms_section *mtms = (struct opal_mtms_section *)
+	struct pel_mtms_section *mtms = (struct pel_mtms_section *)
 				(pel_buffer + *pel_offset);
 
 	mtms->v6header.id = cpu_to_be16(ELOG_SID_MACHINE_TYPE);
 	mtms->v6header.length = cpu_to_be16(MTMS_SECTION_SIZE);
-	mtms->v6header.version = OPAL_EXT_HRD_VER;
+	mtms->v6header.version = PEL_EXT_HRD_VER;
 	mtms->v6header.subtype = 0;
 	mtms->v6header.component_id = cpu_to_be16(elog_data->component_id);
 
 	memset(mtms->model, 0x00, sizeof(mtms->model));
-	memcpy(mtms->model, dt_prop_get(dt_root, "model"), OPAL_SYS_MODEL_LEN);
+	memcpy(mtms->model, dt_prop_get(dt_root, "model"), PEL_SYS_MODEL_LEN);
 
 	memset(mtms->serial_no, 0x00, sizeof(mtms->serial_no));
 	p = dt_find_property(dt_root, "system-id");
 	if (p)
-		memcpy(mtms->serial_no, p->prop, OPAL_SYS_SERIAL_LEN);
+		memcpy(mtms->serial_no, p->prop, PEL_SYS_SERIAL_LEN);
 	else
-		memset(mtms->serial_no, 0, OPAL_SYS_SERIAL_LEN);
+		memset(mtms->serial_no, 0, PEL_SYS_SERIAL_LEN);
 
 	*pel_offset += MTMS_SECTION_SIZE;
 }
@@ -49,42 +49,42 @@ static void create_extended_header_section(struct errorlog *elog_data,
 	uint64_t extd_time;
 	uint32_t extd_date;
 
-	struct opal_extended_header_section *extdhdr =
-			(struct opal_extended_header_section *)
+	struct pel_extended_header_section *extdhdr =
+			(struct pel_extended_header_section *)
 					(pel_buffer + *pel_offset);
 
 	extdhdr->v6header.id = cpu_to_be16(ELOG_SID_EXTENDED_HEADER);
 	extdhdr->v6header.length = cpu_to_be16(EXTENDED_HEADER_SECTION_SIZE);
-	extdhdr->v6header.version = OPAL_EXT_HRD_VER;
+	extdhdr->v6header.version = PEL_EXT_HRD_VER;
 	extdhdr->v6header.subtype = 0;
 	extdhdr->v6header.component_id = cpu_to_be16(elog_data->component_id);
 
 	memset(extdhdr->model, 0x00, sizeof(extdhdr->model));
 	opalmodel = dt_prop_get(dt_root, "model");
-	memcpy(extdhdr->model, opalmodel, OPAL_SYS_MODEL_LEN);
+	memcpy(extdhdr->model, opalmodel, PEL_SYS_MODEL_LEN);
 
 	memset(extdhdr->serial_no, 0x00, sizeof(extdhdr->serial_no));
 	p = dt_find_property(dt_root, "system-id");
 	if (p)
-		memcpy(extdhdr->serial_no, p->prop, OPAL_SYS_SERIAL_LEN);
+		memcpy(extdhdr->serial_no, p->prop, PEL_SYS_SERIAL_LEN);
 	else
-		memset(extdhdr->serial_no, 0, OPAL_SYS_SERIAL_LEN);
+		memset(extdhdr->serial_no, 0, PEL_SYS_SERIAL_LEN);
 
-	memset(extdhdr->opal_release_version, 0x00,
-				sizeof(extdhdr->opal_release_version));
-	memset(extdhdr->opal_subsys_version, 0x00,
-				sizeof(extdhdr->opal_subsys_version));
+	memset(extdhdr->pel_release_version, 0x00,
+				sizeof(extdhdr->pel_release_version));
+	memset(extdhdr->pel_subsys_version, 0x00,
+				sizeof(extdhdr->pel_subsys_version));
 
 	rtc_cache_get_datetime(&extd_date, &extd_time);
 	extdhdr->extended_header_date = cpu_to_be32(extd_date);
 	extdhdr->extended_header_time = cpu_to_be32(extd_time >> 32);
-	extdhdr->opal_symid_len = 0;
+	extdhdr->pel_symid_len = 0;
 
 	*pel_offset += EXTENDED_HEADER_SECTION_SIZE;
 }
 
 /* set src type */
-static void settype(struct opal_src_section *src, uint8_t src_type)
+static void settype(struct pel_src_section *src, uint8_t src_type)
 {
 	char type[4];
 	snprintf(type, sizeof(type), "%02X", src_type);
@@ -92,7 +92,7 @@ static void settype(struct opal_src_section *src, uint8_t src_type)
 }
 
 /* set SRC subsystem type */
-static void setsubsys(struct opal_src_section *src, uint8_t src_subsys)
+static void setsubsys(struct pel_src_section *src, uint8_t src_subsys)
 {
 	char subsys[4];
 	snprintf(subsys, sizeof(subsys), "%02X", src_subsys);
@@ -100,7 +100,7 @@ static void setsubsys(struct opal_src_section *src, uint8_t src_subsys)
 }
 
 /* Ser reason code of SRC */
-static void setrefcode(struct opal_src_section *src, uint16_t src_refcode)
+static void setrefcode(struct pel_src_section *src, uint16_t src_refcode)
 {
 	char refcode[8];
 	snprintf(refcode, sizeof(refcode), "%04X", src_refcode);
@@ -111,24 +111,24 @@ static void setrefcode(struct opal_src_section *src, uint16_t src_refcode)
 static void create_src_section(struct errorlog *elog_data,
 					char *pel_buffer, int *pel_offset)
 {
-	struct opal_src_section *src = (struct opal_src_section *)
+	struct pel_src_section *src = (struct pel_src_section *)
 						(pel_buffer + *pel_offset);
 
 	src->v6header.id = cpu_to_be16(ELOG_SID_PRIMARY_SRC);
 	src->v6header.length = cpu_to_be16(SRC_SECTION_SIZE);
-	src->v6header.version = OPAL_ELOG_VERSION;
-	src->v6header.subtype = OPAL_ELOG_SST;
+	src->v6header.version = PEL_ELOG_VERSION;
+	src->v6header.subtype = PEL_ELOG_SST;
 	src->v6header.component_id = cpu_to_be16(elog_data->component_id);
 
-	src->version = OPAL_SRC_SEC_VER;
+	src->version = PEL_SRC_SEC_VER;
 	src->flags = 0;
-	src->wordcount = OPAL_SRC_MAX_WORD_COUNT;
+	src->wordcount = PEL_SRC_MAX_WORD_COUNT;
 	src->srclength = cpu_to_be16(SRC_LENGTH);
 	settype(src, OPAL_SRC_TYPE_ERROR);
 	setsubsys(src, OPAL_FAILING_SUBSYSTEM);
 	setrefcode(src, elog_data->reason_code);
 	memset(src->hexwords, 0 , (8 * 4));
-	src->hexwords[0] = cpu_to_be32(OPAL_SRC_FORMAT);
+	src->hexwords[0] = cpu_to_be32(PEL_OPAL_SRC_FORMAT);
 	src->hexwords[4] = cpu_to_be32(elog_data->additional_info[0]);
 	src->hexwords[5] = cpu_to_be32(elog_data->additional_info[1]);
 	src->hexwords[6] = cpu_to_be32(elog_data->additional_info[2]);
@@ -140,14 +140,14 @@ static void create_src_section(struct errorlog *elog_data,
 static void create_user_header_section(struct errorlog *elog_data,
 					char *pel_buffer, int *pel_offset)
 {
-	struct opal_user_header_section *usrhdr =
-				(struct opal_user_header_section *)
+	struct pel_user_header_section *usrhdr =
+				(struct pel_user_header_section *)
 						(pel_buffer + *pel_offset);
 
 	usrhdr->v6header.id = cpu_to_be16(ELOG_SID_USER_HEADER);
 	usrhdr->v6header.length = cpu_to_be16(USER_HEADER_SECTION_SIZE);
-	usrhdr->v6header.version = OPAL_ELOG_VERSION;
-	usrhdr->v6header.subtype = OPAL_ELOG_SST;
+	usrhdr->v6header.version = PEL_ELOG_VERSION;
+	usrhdr->v6header.subtype = PEL_ELOG_SST;
 	usrhdr->v6header.component_id = cpu_to_be16(elog_data->component_id);
 
 	usrhdr->subsystem_id = elog_data->subsystem_id;
@@ -172,14 +172,14 @@ static void create_private_header_section(struct errorlog *elog_data,
 {
 	uint64_t ctime;
 	uint32_t cdate;
-	struct opal_private_header_section *privhdr =
-				(struct opal_private_header_section *)
+	struct pel_private_header_section *privhdr =
+				(struct pel_private_header_section *)
 								pel_buffer;
 
 	privhdr->v6header.id = cpu_to_be16(ELOG_SID_PRIVATE_HEADER);
 	privhdr->v6header.length = cpu_to_be16(PRIVATE_HEADER_SECTION_SIZE);
-	privhdr->v6header.version = OPAL_ELOG_VERSION;
-	privhdr->v6header.subtype = OPAL_ELOG_SST;
+	privhdr->v6header.version = PEL_ELOG_VERSION;
+	privhdr->v6header.subtype = PEL_ELOG_SST;
 	privhdr->v6header.component_id = cpu_to_be16(elog_data->component_id);
 	privhdr->plid = cpu_to_be32(elog_data->plid);
 
@@ -192,9 +192,9 @@ static void create_private_header_section(struct errorlog *elog_data,
 	privhdr->creator_subid_lo = 0x00;
 
 	if (elog_data->elog_origin == ORG_SAPPHIRE)
-		privhdr->creator_id = OPAL_CID_SAPPHIRE;
+		privhdr->creator_id = PEL_CID_SAPPHIRE;
 	else
-		privhdr->creator_id = OPAL_CID_POWERNV;
+		privhdr->creator_id = PEL_CID_POWERNV;
 
 	privhdr->log_entry_id = cpu_to_be32(elog_data->plid); /*entry id is updated by FSP*/
 
@@ -206,23 +206,23 @@ static void create_user_defined_section(struct errorlog *elog_data,
 {
 	char *dump = (char *)pel_buffer + *pel_offset;
 	char *opal_buf = (char *)elog_data->user_data_dump;
-	struct opal_user_section *usrhdr;
+	struct pel_user_section *usrhdr;
 	struct elog_user_data_section *opal_usr_data;
-	struct opal_private_header_section *privhdr =
-			 (struct opal_private_header_section *)pel_buffer;
+	struct pel_private_header_section *privhdr =
+			 (struct pel_private_header_section *)pel_buffer;
 	int i;
 
 	for (i = 0; i < elog_data->user_section_count; i++) {
 
-		usrhdr = (struct opal_user_section *)dump;
+		usrhdr = (struct pel_user_section *)dump;
 		opal_usr_data = (struct elog_user_data_section *)opal_buf;
 
 		usrhdr->v6header.id = cpu_to_be16(ELOG_SID_USER_DEFINED);
 		usrhdr->v6header.length = cpu_to_be16(
-					sizeof(struct opal_v6_header) +
+					sizeof(struct pel_v6_header) +
 					be16_to_cpu(opal_usr_data->size));
-		usrhdr->v6header.version = OPAL_ELOG_VERSION;
-		usrhdr->v6header.subtype = OPAL_ELOG_SST;
+		usrhdr->v6header.version = PEL_ELOG_VERSION;
+		usrhdr->v6header.subtype = PEL_ELOG_SST;
 		usrhdr->v6header.component_id = cpu_to_be16(elog_data->component_id);
 
 		memcpy(usrhdr->dump, opal_buf, be16_to_cpu(opal_usr_data->size));
@@ -245,7 +245,7 @@ static size_t pel_user_section_size(struct errorlog *elog_data)
 
 		opal_usr_data = (struct elog_user_data_section *)opal_buf;
 		s = be16_to_cpu(opal_usr_data->size);
-		total += sizeof(struct opal_v6_header) + s;
+		total += sizeof(struct pel_v6_header) + s;
 		opal_buf += s;
 	}
 
diff --git a/include/pel.h b/include/pel.h
index 252d27e2e..fdc30366a 100644
--- a/include/pel.h
+++ b/include/pel.h
@@ -14,27 +14,27 @@
 #define SRC_SECTION_SIZE			80
 #define SRC_SUBSECTION_SIZE			 4
 #define SRC_LENGTH				72
-#define OPAL_MAX_SRC_BYTES			32
+#define PEL_MAX_SRC_BYTES			32
 #define EXTENDED_HEADER_SECTION_SIZE		76
 #define MTMS_SECTION_SIZE			28
 #define IO_EVENT_SECTION_SIZE			16
 
-#define OPAL_ELOG_VERSION		1
-#define OPAL_ELOG_SST			0
-#define OPAL_SRC_MAX_WORD_COUNT		8
+#define PEL_ELOG_VERSION		1
+#define PEL_ELOG_SST			0
+#define PEL_SRC_MAX_WORD_COUNT		8
 
-#define OPAL_SRC_FORMAT         0x80
-#define OPAL_FAILING_SUBSYSTEM  0x82
+#define PEL_OPAL_SRC_FORMAT	0x80
+#define OPAL_FAILING_SUBSYSTEM	0x82
 
-#define OPAL_SYS_MODEL_LEN      8
-#define OPAL_SYS_SERIAL_LEN     12
-#define OPAL_VER_LEN            16
-#define OPAL_SYMPID_LEN         80
-#define OPAL_RC_NONE		0
+#define PEL_SYS_MODEL_LEN      8
+#define PEL_SYS_SERIAL_LEN     12
+#define PEL_VER_LEN            16
+#define PEL_SYMPID_LEN         80
+#define PEL_RC_NONE		0
 
-#define OPAL_IO_MAX_RPC_DATA	216
-#define OPAL_SRC_SEC_VER	0x02
-#define OPAL_EXT_HRD_VER	0x01
+#define PEL_IO_MAX_RPC_DATA	216
+#define PEL_SRC_SEC_VER	0x02
+#define PEL_EXT_HRD_VER	0x01
 
 /* Error log reporting action */
 #define ERRL_ACTION_REPORT     0x2000
@@ -61,7 +61,7 @@ enum elogSectionId {
 };
 
 
-struct opal_v6_header {
+struct pel_v6_header {
 	__be16	id;	/* section id */
 	__be16	length;		/* section length */
 	uint8_t	version;		/* section version */
@@ -72,8 +72,8 @@ struct opal_v6_header {
 /* opal_srctype */
 #define OPAL_SRC_TYPE_ERROR 0xBB
 
-#define OPAL_CID_SAPPHIRE	'K'	/* creator ID for sapphire log */
-#define OPAL_CID_POWERNV	'P'	/* creator ID for powernv log */
+#define PEL_CID_SAPPHIRE	'K'	/* creator ID for sapphire log */
+#define PEL_CID_POWERNV	'P'	/* creator ID for powernv log */
 
 /* Origin of error, elog_origin */
 #define ORG_SAPPHIRE	1
@@ -82,10 +82,10 @@ struct opal_v6_header {
 /* MAX time for error log commit */
 #define ERRORLOG_TIMEOUT_INTERVAL	180
 
-/*struct opal_private head section_ */
-struct opal_private_header_section {
+/*struct pel_private head section_ */
+struct pel_private_header_section {
 
-	struct opal_v6_header v6header;
+	struct pel_v6_header v6header;
 	__be32 create_date;
 	__be32 create_time;
 	__be32 commit_date;
@@ -101,10 +101,10 @@ struct opal_private_header_section {
 	__be32 log_entry_id;		/* Unique log entry id */
 } __packed;
 
-/* opal user header section */
-struct opal_user_header_section {
+/* pel user header section */
+struct pel_user_header_section {
 
-	struct opal_v6_header v6header;
+	struct pel_v6_header v6header;
 
 	uint8_t subsystem_id;	/* subsystem id */
 	uint8_t event_scope;
@@ -117,43 +117,43 @@ struct opal_user_header_section {
 	__be32 reserved_2;
 } __packed;
 
-struct opal_src_section {
-	struct opal_v6_header v6header;
+struct pel_src_section {
+	struct pel_v6_header v6header;
 	uint8_t		version;
 	uint8_t		flags;
 	uint8_t		reserved_0;
 	uint8_t		wordcount;
 	__be16		reserved_1;
 	__be16		srclength;
-	__be32		hexwords[OPAL_SRC_MAX_WORD_COUNT];
-	char		srcstring[OPAL_MAX_SRC_BYTES];
+	__be32		hexwords[PEL_SRC_MAX_WORD_COUNT];
+	char		srcstring[PEL_MAX_SRC_BYTES];
 } __packed;
 
-struct opal_extended_header_section {
-	struct	opal_v6_header v6header;
-	char	model[OPAL_SYS_MODEL_LEN];
-	char	serial_no[OPAL_SYS_SERIAL_LEN];
-	char	opal_release_version[OPAL_VER_LEN];
-	char	opal_subsys_version[OPAL_VER_LEN];
+struct pel_extended_header_section {
+	struct	pel_v6_header v6header;
+	char	model[PEL_SYS_MODEL_LEN];
+	char	serial_no[PEL_SYS_SERIAL_LEN];
+	char	pel_release_version[PEL_VER_LEN];
+	char	pel_subsys_version[PEL_VER_LEN];
 	__be16	reserved_0;
 	__be32	extended_header_date;
 	__be32	extended_header_time;
 	__be16	reserved_1;
 	uint8_t	reserved_2;
-	uint8_t	opal_symid_len;
-	char	opalsymid[OPAL_SYMPID_LEN];
+	uint8_t	pel_symid_len;
+	char	opalsymid[PEL_SYMPID_LEN];
 } __packed;
 
-/* opal MTMS section */
-struct opal_mtms_section {
-	struct opal_v6_header v6header;
-	char        model[OPAL_SYS_MODEL_LEN];
-	char        serial_no[OPAL_SYS_SERIAL_LEN];
+/* pel MTMS section */
+struct pel_mtms_section {
+	struct pel_v6_header v6header;
+	char        model[PEL_SYS_MODEL_LEN];
+	char        serial_no[PEL_SYS_SERIAL_LEN];
 } __packed;
 
 /* User defined section */
-struct opal_user_section {
-	struct opal_v6_header v6header;
+struct pel_user_section {
+	struct pel_v6_header v6header;
 	char dump[1];
 } __packed;
 




More information about the Skiboot mailing list