libpayload: Add get_option_from()
authorPatrick Georgi <patrick.georgi@secunet.com>
Tue, 12 Jul 2011 09:40:29 +0000 (11:40 +0200)
committerPatrick Georgi <patrick@georgi-clan.de>
Wed, 14 Sep 2011 05:42:20 +0000 (07:42 +0200)
This function allows reading the nvram configuration table from
locations other than the cbtable.

Change-Id: I56c9973a9ea45ad7bf0185b70d11c9ce5d0e0e1b
Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Reviewed-on: http://review.coreboot.org/213
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marcj303@gmail.com>
payloads/libpayload/drivers/options.c
payloads/libpayload/include/libpayload.h

index 1c692f46e0dd89eee06a30c8f24e9280efd83ea9..fdb4be34bbc6d48b70e7a1da42a2bcc91b81e777 100644 (file)
@@ -93,9 +93,8 @@ static int get_cmos_value(u32 bitnum, u32 len, void *valptr)
        return 0;
 }
 
-int get_option(void *dest, char *name)
+int get_option_from(struct cb_cmos_option_table *option_table, void *dest, char *name)
 {
-       struct cb_cmos_option_table *option_table = phys_to_virt(lib_sysinfo.option_table);
        struct cb_cmos_entries *cmos_entry;
        int len = strnlen(name, CMOS_MAX_NAME_LENGTH);
 
@@ -118,3 +117,9 @@ int get_option(void *dest, char *name)
        printf("ERROR: No such CMOS option (%s)\n", name);
        return 1;
 }
+
+int get_option(void *dest, char *name)
+{
+       struct cb_cmos_option_table *option_table = phys_to_virt(lib_sysinfo.option_table);
+       return get_option_from(option_table, dest, name);
+}
index 6ce7548b3d4d1877628e676f395ff05713073cdc..80eaaa40b7d18059234d5984f27d3639d2656a83 100644 (file)
@@ -194,6 +194,7 @@ void video_console_set_cursor(unsigned int cursorx, unsigned int cursory);
 
 /* drivers/option.c */
 void fix_options_checksum(void);
+int get_option_from(struct cb_cmos_option_table *option_table, void *dest, char *name);
 int get_option(void *dest, char *name);
 
 /**