diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2020-01-05 08:05:45 +0200 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2020-01-09 14:37:33 +0000 |
commit | cbf957158806bcd5c733c45baa324559904c609c (patch) | |
tree | 89649e264f785ceb76ce223094b3640135a1b920 /src/include | |
parent | 2a0e3b25ea282491cba9d32a8f35d9a238db83c7 (diff) | |
download | coreboot-cbf957158806bcd5c733c45baa324559904c609c.tar.xz |
drivers/pc80/rtc: Separate {get|set}_option() prototypes
Long-term plan is to support loading runtime configuration
from SPI flash as an alternative, so move these prototypes
outside pc80/.
Change-Id: Iad7b03dc985550da903d56b3deb5bd736013f8f1
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38192
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/option.h | 37 | ||||
-rw-r--r-- | src/include/pc80/mc146818rtc.h | 3 |
2 files changed, 28 insertions, 12 deletions
diff --git a/src/include/option.h b/src/include/option.h index 3a20dcf196..198ca00d02 100644 --- a/src/include/option.h +++ b/src/include/option.h @@ -1,19 +1,38 @@ +/* + * This file is part of the coreboot project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + #ifndef _OPTION_H_ #define _OPTION_H_ -/* - * FIXME: get_option() needs to be abstracted better so that other non-volatile - * storage can be used. This will benefit machines without CMOS as well as those - * without a battery-backed CMOS (e.g. some laptops). - */ -#if CONFIG(USE_OPTION_TABLE) -#include <pc80/mc146818rtc.h> -#else #include <types.h> + +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_option(const char *name, void *val) +{ + if (CONFIG(USE_OPTION_TABLE)) + return cmos_set_option(name, val); + + return CB_CMOS_OTABLE_DISABLED; +} + static inline enum cb_err get_option(void *dest, const char *name) { + if (CONFIG(USE_OPTION_TABLE)) + return cmos_get_option(dest, name); + return CB_CMOS_OTABLE_DISABLED; } -#endif #endif /* _OPTION_H_ */ diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h index 91413d11d5..9cd00b525c 100644 --- a/src/include/pc80/mc146818rtc.h +++ b/src/include/pc80/mc146818rtc.h @@ -181,9 +181,6 @@ int cmos_lb_cks_valid(void); int cmos_checksum_valid(int range_start, int range_end, int cks_loc); void cmos_set_checksum(int range_start, int range_end, int cks_loc); -enum cb_err set_option(const char *name, void *val); -enum cb_err get_option(void *dest, const char *name); - #if CONFIG(CMOS_POST) #if CONFIG(USE_OPTION_TABLE) # include "option_table.h" |