Sergii Dmytruk 04bd965143 util: add smmstoretool for editing SMMSTORE
Offline SMMSTORE variable modification tool.  Can be used to
pre-configure ROM image or debug EFI state stored in a dump.

Change-Id: I6c1c06f1d0c39c13b5be76a3070f09b715aca6e0
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79080
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
2024-03-09 23:22:55 +00:00

45 lines
965 B
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef SMMSTORETOOL__VS_H__
#define SMMSTORETOOL__VS_H__
#include <stdbool.h>
#include "udk2017.h"
#include "utils.h"
// Variable store is part of firmware volume. This unit doesn't deal with its
// header only with data that follows.
struct var_t {
uint8_t reserved;
uint32_t attrs;
EFI_GUID guid;
CHAR16 *name;
size_t name_size; // in bytes
uint8_t *data;
size_t data_size; // in bytes
struct var_t *next;
};
struct var_store_t {
struct var_t *vars;
bool auth_vars;
};
struct var_store_t vs_load(struct mem_range_t vs_data, bool auth_vars);
bool vs_store(struct var_store_t *vs, struct mem_range_t vs_data);
struct var_t *vs_new_var(struct var_store_t *vs);
struct var_t *vs_find(struct var_store_t *vs,
const char name[],
const EFI_GUID *guid);
void vs_delete(struct var_store_t *vs, struct var_t *var);
void vs_free(struct var_store_t *vs);
#endif // SMMSTORETOOL__VS_H__