Refactor crashlog initialization to use the PMT namespace pre-decode hook:
- Add pmt_crashlog_pre_decode() to parse type/version, select the
crashlog_info, initialize the control mutex, and set entry->attr_grp.
- Simplify pmt_crashlog_header_decode() to only read header fields from
the discovery table.
- Wire the namespace with .pmt_pre_decode = pmt_crashlog_pre_decode.
This separates structural initialization from header parsing, aligning
crashlog with the PMT class pre/post decode flow.
Signed-off-by: David E. Box <[email protected]>
---
drivers/platform/x86/intel/pmt/crashlog.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/x86/intel/pmt/crashlog.c
b/drivers/platform/x86/intel/pmt/crashlog.c
index b0393c9c5b4b..f936daf99e4d 100644
--- a/drivers/platform/x86/intel/pmt/crashlog.c
+++ b/drivers/platform/x86/intel/pmt/crashlog.c
@@ -496,11 +496,9 @@ static const struct crashlog_info
*select_crashlog_info(u32 type, u32 version)
return &crashlog_type1_ver2;
}
-static int pmt_crashlog_header_decode(struct intel_pmt_entry *entry,
- struct device *dev)
+static int pmt_crashlog_pre_decode(struct intel_vsec_device *ivdev,
+ struct intel_pmt_entry *entry)
{
- void __iomem *disc_table = entry->disc_table;
- struct intel_pmt_header *header = &entry->header;
struct crashlog_entry *crashlog;
u32 version;
u32 type;
@@ -513,6 +511,16 @@ static int pmt_crashlog_header_decode(struct
intel_pmt_entry *entry,
mutex_init(&crashlog->control_mutex);
crashlog->info = select_crashlog_info(type, version);
+ entry->attr_grp = crashlog->info->attr_grp;
+
+ return 0;
+}
+
+static int pmt_crashlog_header_decode(struct intel_pmt_entry *entry,
+ struct device *dev)
+{
+ void __iomem *disc_table = entry->disc_table;
+ struct intel_pmt_header *header = &entry->header;
header->access_type = GET_ACCESS(readl(disc_table));
header->guid = readl(disc_table + GUID_OFFSET);
@@ -521,8 +529,6 @@ static int pmt_crashlog_header_decode(struct
intel_pmt_entry *entry,
/* Size is measured in DWORDS, but accessor returns bytes */
header->size = GET_SIZE(readl(disc_table + SIZE_OFFSET));
- entry->attr_grp = crashlog->info->attr_grp;
-
return 0;
}
@@ -530,6 +536,7 @@ static DEFINE_XARRAY_ALLOC(crashlog_array);
static struct intel_pmt_namespace pmt_crashlog_ns = {
.name = "crashlog",
.xa = &crashlog_array,
+ .pmt_pre_decode = pmt_crashlog_pre_decode,
.pmt_header_decode = pmt_crashlog_header_decode,
};
--
2.43.0