coreboot/src/include/option.h
Angel Pons fc44f6e529 option.h: Drop type-unsafe {get,set}_option() API
Change-Id: I5a9852b1fb66d609238ab7324f28a5e397c030ae
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52566
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
2021-04-23 10:13:49 +00:00

31 lines
668 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _OPTION_H_
#define _OPTION_H_
#include <types.h>
void sanitize_cmos(void);
enum cb_err cmos_set_option(const char *name, void *val);
enum cb_err cmos_get_option(void *dest, const char *name);
static inline enum cb_err set_int_option(const char *name, int value)
{
if (CONFIG(USE_OPTION_TABLE))
return cmos_set_option(name, &value);
return CB_CMOS_OTABLE_DISABLED;
}
static inline int get_int_option(const char *name, const int fallback)
{
if (CONFIG(USE_OPTION_TABLE)) {
int value = 0;
if (cmos_get_option(&value, name) == CB_SUCCESS)
return value;
}
return fallback;
}
#endif /* _OPTION_H_ */