Move elog_internal.h to commonlib/bsd/include/bsd/. And rename it from elog_internal.h to elog.h. Since this file will be included from util/ it also converts the "uNN" types into "uintNN_t" types. The two defines that are not used by util/ are moved to drivers/elog/elog.c, the only file that includes them. Move also the function elog_verify_header() from drivers/elog/, to commonlib/bsd/elog.c since this function will be called from util/ as well. The rationale behind moving elog's defines & structs to commonlib/bsd/include is to make them available to util/ tools and/or payloads (should it be needed in the future). The files that are being relicensed to BSD were coded by Duncan Laurie, and he is Ok with the relicense. BUG=b:172210863 Signed-off-by: Ricardo Quesada <ricardoq@google.com> Change-Id: Ia1aefea705ddd417a1d9e978bb18ab6d9a60cad6 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56404 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
26 lines
530 B
C
26 lines
530 B
C
/* SPDX-License-Identifier: BSD-3-Clause */
|
|
|
|
#include <commonlib/bsd/elog.h>
|
|
#include <stddef.h>
|
|
|
|
/*
|
|
* verify and validate if header is a valid coreboot Event Log header.
|
|
* return CB_ERR if invalid, otherwise CB_SUCCESS.
|
|
*/
|
|
enum cb_err elog_verify_header(const struct elog_header *header)
|
|
{
|
|
if (header == NULL)
|
|
return CB_ERR;
|
|
|
|
if (header->magic != ELOG_SIGNATURE)
|
|
return CB_ERR;
|
|
|
|
if (header->version != ELOG_VERSION)
|
|
return CB_ERR;
|
|
|
|
if (header->header_size != sizeof(*header))
|
|
return CB_ERR;
|
|
|
|
return CB_SUCCESS;
|
|
}
|