From cbf957158806bcd5c733c45baa324559904c609c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Sun, 5 Jan 2020 08:05:45 +0200 Subject: drivers/pc80/rtc: Separate {get|set}_option() prototypes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/38192 Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/include/option.h | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'src/include/option.h') 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 -#else #include + +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_ */ -- cgit v1.2.3