util/cse*: Add cse_helpers.{c,h}

This change moves `read_member` and `write_member` helper functions
out of cse_fpt.c and cse_serger.c into cse_helpers.c to avoid
duplication.

BUG=b:189177186,b:189167923

Change-Id: I7b646b29c9058d892bb0fc9824ef1b4340d2510c
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58201
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Furquan Shaikh
2021-10-08 15:18:33 -07:00
parent d7fb6a90e1
commit 555f040772
7 changed files with 76 additions and 84 deletions

View File

@@ -7,14 +7,12 @@
#include <commonlib/region.h>
#include "common.h"
#include "cse_helpers.h"
#define BPDT_SIGNATURE (0x000055AA)
#define BUFF_SIZE_ALIGN (4 * KiB)
#define READ_MEMBER(_buff, _x) read_member(_buff, &(_x), sizeof(_x))
#define WRITE_MEMBER(_buff, _x) write_member(_buff, &(_x), sizeof(_x))
enum bpdt_version {
BPDT_VERSION_1_6 = 1,
BPDT_VERSION_1_7 = 2,
@@ -89,7 +87,4 @@ extern const struct subpart_hdr_ops subpart_hdr_2_ops;
extern const struct subpart_entry_ops subpart_entry_1_ops;
void read_member(struct buffer *buff, void *dst, size_t size);
void write_member(struct buffer *buff, void *src, size_t size);
#endif /* __CBFSTOOL_CSE_SERGER_H__ */