diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-05-20 11:35:15 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-05-26 12:26:36 +0000 |
commit | 07056feba09dc13f5817d708c363ed256a0f94ab (patch) | |
tree | 06a45e125520da62f286d16be4833d5644dc4564 /src/include | |
parent | b2a4c27a2fa2348b5b9589a8e228cdd34feb459b (diff) |
option: Decouple API from CMOS backend
Prepare to allow using other backends to store options.
Change-Id: I3f838d27bf476207c6dc8f2c1f15c3fa9ae47d87
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/54727
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/option.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/include/option.h b/src/include/option.h index 74a6bbbfc2..40893788f3 100644 --- a/src/include/option.h +++ b/src/include/option.h @@ -7,25 +7,23 @@ void sanitize_cmos(void); -enum cb_err cmos_set_uint_option(const char *name, unsigned int *value); -enum cb_err cmos_get_uint_option(unsigned int *dest, const char *name); +#if !CONFIG(USE_OPTION_TABLE) -static inline enum cb_err set_uint_option(const char *name, unsigned int value) +static inline unsigned int get_uint_option(const char *name, const unsigned int fallback) { - if (CONFIG(USE_OPTION_TABLE)) - return cmos_set_uint_option(name, &value); - - return CB_CMOS_OTABLE_DISABLED; + return fallback; } -static inline unsigned int get_uint_option(const char *name, const unsigned int fallback) +static inline enum cb_err set_uint_option(const char *name, unsigned int value) { - if (CONFIG(USE_OPTION_TABLE)) { - unsigned int value = 0; - if (cmos_get_uint_option(&value, name) == CB_SUCCESS) - return value; - } - return fallback; + return CB_CMOS_OTABLE_DISABLED; } +#else /* USE_OPTION_TABLE */ + +unsigned int get_uint_option(const char *name, const unsigned int fallback); +enum cb_err set_uint_option(const char *name, unsigned int value); + +#endif /* USE_OPTION_TABLE? */ + #endif /* _OPTION_H_ */ |