summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRicardo Quesada <ricardoq@google.com>2021-09-03 17:01:45 -0700
committerFurquan Shaikh <furquan@google.com>2021-09-10 22:53:19 +0000
commitb28a035ea081be668311d70106b843c0204963fa (patch)
treec7aa26034131f22f5e4a0965615568ef59ef4448 /src
parent49a96a94634ca146969293c8f1ac12dba6bbd231 (diff)
elog: move MAX_EVENT_SIZE to commonlib/bsd/include
Moves MAX_EVENT_SIZE to commonlib/bsd/include, and renames it ELOG_MAX_EVENT_SIZE to give it an "scoped" name. The moving is needed because this defined will be used from util/cbfstool (see next CL in the chain). BUG=b:172210863 TEST=compiles Ok Change-Id: I86b06d257dda5b325a8478a044045b2a63fb1a84 Signed-off-by: Ricardo Quesada <ricardoq@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/57394 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/commonlib/bsd/include/commonlib/bsd/elog.h3
-rw-r--r--src/drivers/elog/elog.c6
-rw-r--r--src/include/elog.h2
3 files changed, 6 insertions, 5 deletions
diff --git a/src/commonlib/bsd/include/commonlib/bsd/elog.h b/src/commonlib/bsd/include/commonlib/bsd/elog.h
index d428b5d4d6..ab3fa4b5e6 100644
--- a/src/commonlib/bsd/include/commonlib/bsd/elog.h
+++ b/src/commonlib/bsd/include/commonlib/bsd/elog.h
@@ -311,6 +311,9 @@ struct elog_event_extended_event {
} __packed;
+/* Only the 7-LSB are used for size */
+#define ELOG_MAX_EVENT_SIZE 0x7F
+
enum cb_err elog_verify_header(const struct elog_header *header);
const struct event_header *elog_get_next_event(const struct event_header *event);
const void *event_get_data(const struct event_header *event);
diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index 69567c0f4d..ca2ec6ecd6 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -246,7 +246,7 @@ static size_t elog_is_event_valid(size_t offset)
if (len < (sizeof(*event) + sizeof(checksum)))
return 0;
- if (len > MAX_EVENT_SIZE)
+ if (len > ELOG_MAX_EVENT_SIZE)
return 0;
event = elog_get_event_buffer(offset, len);
@@ -613,7 +613,7 @@ int elog_clear(void)
static int elog_find_flash(void)
{
size_t total_size;
- size_t reserved_space = ELOG_MIN_AVAILABLE_ENTRIES * MAX_EVENT_SIZE;
+ size_t reserved_space = ELOG_MIN_AVAILABLE_ENTRIES * ELOG_MAX_EVENT_SIZE;
struct region_device *rdev = &elog_state.nv_dev;
elog_debug("%s()\n", __func__);
@@ -801,7 +801,7 @@ int elog_add_event_raw(u8 event_type, void *data, u8 data_size)
/* Header + Data + Checksum */
event_size = sizeof(*event) + data_size + 1;
- if (event_size > MAX_EVENT_SIZE) {
+ if (event_size > ELOG_MAX_EVENT_SIZE) {
printk(BIOS_ERR, "ELOG: Event(%X) data size too "
"big (%d)\n", event_type, event_size);
return -1;
diff --git a/src/include/elog.h b/src/include/elog.h
index 206018d03f..29904cdb33 100644
--- a/src/include/elog.h
+++ b/src/include/elog.h
@@ -6,8 +6,6 @@
#include <commonlib/bsd/elog.h>
#include <stdint.h>
-#define MAX_EVENT_SIZE 0x7F
-
#if CONFIG(ELOG)
/* Eventlog backing storage must be initialized before calling elog_init(). */
extern int elog_init(void);