diff options
author | Patrick Georgi <patrick.georgi@secunet.com> | 2012-09-24 20:47:03 +0200 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2012-10-14 20:12:11 +0200 |
commit | d357e6283631ce8e3279ef825f677482f1056e50 (patch) | |
tree | 99fce40c5a900f15cf239614c435b1ce282bac97 /payloads/libpayload/drivers | |
parent | c31e3ac2583bb39bb48f255f7fb4dd9df44cd365 (diff) |
libpayload: CMOS access was implemented in a backward way
Instead of having the highlevel functions make use of the lowlevel
functions, it implemented the lowlevel stuff in terms of highlevel.
Change-Id: I530bfe3cbc6f57a6294d86fbf1739e06467a2318
Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Reviewed-on: http://review.coreboot.org/1539
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads/libpayload/drivers')
-rw-r--r-- | payloads/libpayload/drivers/options.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/payloads/libpayload/drivers/options.c b/payloads/libpayload/drivers/options.c index 7122464447..d3ec137a6f 100644 --- a/payloads/libpayload/drivers/options.c +++ b/payloads/libpayload/drivers/options.c @@ -158,13 +158,11 @@ static struct cb_cmos_entries *lookup_cmos_entry(struct cb_cmos_option_table *op int len = name ? strnlen(name, CMOS_MAX_NAME_LENGTH) : 0; /* cmos entries are located right after the option table */ - - for ( cmos_entry = (struct cb_cmos_entries*)((unsigned char *)option_table + option_table->header_length); - cmos_entry->tag == CB_TAG_OPTION; - cmos_entry = (struct cb_cmos_entries*)((unsigned char *)cmos_entry + cmos_entry->size)) { - if (memcmp((const char*)cmos_entry->name, name, len)) - continue; - return cmos_entry; + cmos_entry = first_cmos_entry(option_table); + while (cmos_entry) { + if (memcmp((const char*)cmos_entry->name, name, len) == 0) + return cmos_entry; + cmos_entry = next_cmos_entry(cmos_entry); } printf("ERROR: No such CMOS option (%s)\n", name); @@ -173,7 +171,7 @@ static struct cb_cmos_entries *lookup_cmos_entry(struct cb_cmos_option_table *op struct cb_cmos_entries *first_cmos_entry(struct cb_cmos_option_table *option_table) { - return lookup_cmos_entry(option_table, NULL); + return (struct cb_cmos_entries*)((unsigned char *)option_table + option_table->header_length); } struct cb_cmos_entries *next_cmos_entry(struct cb_cmos_entries *cmos_entry) |