[PATCH 1/4] ACPI/APEI: Add erst_get_size() API

From: Muralidhara M K
Date: Wed Nov 29 2023 - 02:51:07 EST


From: Muralidhara M K <muralidhara.mk@xxxxxxx>

Support API for size of a record in the ERST.

Co-developed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@xxxxxxx>
Signed-off-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@xxxxxxx>
Signed-off-by: Muralidhara M K <muralidhara.mk@xxxxxxx>
---
drivers/acpi/apei/erst.c | 9 +++++++++
include/acpi/apei.h | 1 +
2 files changed, 10 insertions(+)

diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index bf65e3461531..aae1c133095a 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -420,6 +420,15 @@ static int erst_get_erange(struct erst_erange *range)
return 0;
}

+u64 erst_get_size(void)
+{
+ if (erst_disable)
+ return 0;
+
+ return erst_erange.size;
+}
+EXPORT_SYMBOL_GPL(erst_get_size);
+
static ssize_t __erst_get_record_count(void)
{
struct apei_exec_context ctx;
diff --git a/include/acpi/apei.h b/include/acpi/apei.h
index dc60f7db5524..3b34f463ea44 100644
--- a/include/acpi/apei.h
+++ b/include/acpi/apei.h
@@ -41,6 +41,7 @@ static inline void acpi_hest_init(void) { }

int erst_write(const struct cper_record_header *record);
ssize_t erst_get_record_count(void);
+u64 erst_get_size(void);
int erst_get_record_id_begin(int *pos);
int erst_get_record_id_next(int *pos, u64 *record_id);
void erst_get_record_id_end(void);
--
2.25.1