[coreboot] New patch to review for coreboot: 48d13cb libpayload: CMOS access was implemented in a backward way

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Tue Sep 25 11:05:34 CEST 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/1539

-gerrit

commit 48d13cb21288bfe31dcf749f6521f5a814b5960c
Author: Patrick Georgi <patrick.georgi at secunet.com>
Date:   Mon Sep 24 20:47:03 2012 +0200

    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 at secunet.com>
---
 payloads/libpayload/drivers/options.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/payloads/libpayload/drivers/options.c b/payloads/libpayload/drivers/options.c
index eac4a0c..4df3f19 100644
--- a/payloads/libpayload/drivers/options.c
+++ b/payloads/libpayload/drivers/options.c
@@ -159,12 +159,11 @@ static struct cb_cmos_entries *lookup_cmos_entry(struct cb_cmos_option_table *op
 
 	/* 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;
+	for (   cmos_entry = first_cmos_entry(option_table);
+		cmos_entry;
+		cmos_entry = next_cmos_entry(cmos_entry)) {
+		if (memcmp((const char*)cmos_entry->name, name, len) == 0)
+			return cmos_entry;
 	}
 
 	printf("ERROR: No such CMOS option (%s)\n", name);
@@ -173,7 +172,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)




More information about the coreboot mailing list