[coreboot] Patch set updated for coreboot: 69470aa libpayload: Add iterators for CMOS variables

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Fri Feb 3 11:57:36 CET 2012


Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/587

-gerrit

commit 69470aacda54a628fb7d6437198fc2eddb314009
Author: Patrick Georgi <patrick.georgi at secunet.com>
Date:   Mon Jan 16 15:39:57 2012 +0100

    libpayload: Add iterators for CMOS variables
    
    Provide functions that pick the first CMOS variable defined
    in the cmos layout, and from there, the next one.
    
    Change-Id: Ie98146de7f6273089fc6fc0b232a4b94337cf8a3
    Signed-off-by: Patrick Georgi <patrick.georgi at secunet.com>
---
 payloads/libpayload/drivers/options.c    |   14 ++++++++++++++
 payloads/libpayload/include/libpayload.h |    2 ++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/payloads/libpayload/drivers/options.c b/payloads/libpayload/drivers/options.c
index 1b98cda..10d165e 100644
--- a/payloads/libpayload/drivers/options.c
+++ b/payloads/libpayload/drivers/options.c
@@ -171,6 +171,20 @@ static struct cb_cmos_entries *lookup_cmos_entry(struct cb_cmos_option_table *op
 	return NULL;
 }
 
+struct cb_cmos_entries *first_cmos_entry(struct cb_cmos_option_table *option_table)
+{
+	return lookup_cmos_entry(option_table, "");
+}
+
+struct cb_cmos_entries *next_cmos_entry(struct cb_cmos_entries *cmos_entry)
+{
+	struct cb_cmos_entries *next = (struct cb_cmos_entries*)((unsigned char *)cmos_entry + cmos_entry->size);
+	if (next->tag == CB_TAG_OPTION)
+		return next;
+	else
+		return NULL;
+}
+
 /* Either value or text must be NULL. Returns the field that matches "the other" for a given config_id */
 static struct cb_cmos_enums *lookup_cmos_enum_core(struct cb_cmos_option_table *option_table, int config_id, u8 *value, char *text)
 {
diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h
index 488ad48..53d6672 100644
--- a/payloads/libpayload/include/libpayload.h
+++ b/payloads/libpayload/include/libpayload.h
@@ -206,6 +206,8 @@ struct cb_cmos_option_table *get_system_option_table(void);
 int options_checksum_valid(const struct nvram_accessor *nvram);
 void fix_options_checksum_with(const struct nvram_accessor *nvram);
 void fix_options_checksum(void);
+struct cb_cmos_entries *first_cmos_entry(struct cb_cmos_option_table *option_table);
+struct cb_cmos_entries *next_cmos_entry(struct cb_cmos_entries *cur);
 int get_option_with(const struct nvram_accessor *nvram, struct cb_cmos_option_table *option_table, void *dest, char *name);
 int get_option_from(struct cb_cmos_option_table *option_table, void *dest, char *name);
 int get_option(void *dest, char *name);




More information about the coreboot mailing list