Patchwork nvramtool: Fix CMOS layout initialization using option table

login
register
about
Submitter Mathias Krause
Date 2011-03-08 18:48:34
Message ID <4D767A02.1020902@secunet.com>
Download mbox | patch
Permalink /patch/2756/
State Accepted
Commit r6440
Headers show

Comments

Mathias Krause - 2011-03-08 18:48:34
Move get_layout_from_cmos_table() to accessors/layout-bin.c so
process_layout() will do its check against the right cmos_table.

This bug was introduced with r6314.
Mathias Krause - 2011-03-09 10:45:48
On 08.03.2011 19:48, Mathias Krause wrote:
> Move get_layout_from_cmos_table() to accessors/layout-bin.c so
> process_layout() will do its check against the right cmos_table.
> 
> This bug was introduced with r6314.
> 

Forgot the most important part! Of course:

Signed-off-by: Mathias Krause <mathias.krause@secunet.com>
Peter Stuge - 2011-03-10 06:38:40
Mathias Krause wrote:
> On 08.03.2011 19:48, Mathias Krause wrote:
> > Move get_layout_from_cmos_table() to accessors/layout-bin.c so
> > process_layout() will do its check against the right cmos_table.
> > 
> > This bug was introduced with r6314.
> > 
> 
> Forgot the most important part! Of course:
> 
> Signed-off-by: Mathias Krause <mathias.krause@secunet.com>

Acked-by: Peter Stuge <peter@stuge.se>

Patch

Index: util/nvramtool/accessors/layout-bin.c
===================================================================
--- util/nvramtool/accessors/layout-bin.c	(Revision 6437)
+++ util/nvramtool/accessors/layout-bin.c	(Arbeitskopie)
@@ -84,6 +84,20 @@ 
 }
 
 /****************************************************************************
+ * get_layout_from_cmos_table
+ *
+ * Find the CMOS table which is stored within the coreboot table and set the
+ * global variable cmos_table to point to it.
+ ****************************************************************************/
+void get_layout_from_cmos_table(void)
+{
+	get_lbtable();
+	cmos_table = (const struct cmos_option_table *)
+	    find_lbrec(LB_TAG_CMOS_OPTION_TABLE);
+	process_layout();
+}
+
+/****************************************************************************
  * process_cmos_table
  *
  * Extract layout information from the CMOS option table and store it in our
Index: util/nvramtool/lbtable.c
===================================================================
--- util/nvramtool/lbtable.c	(Revision 6437)
+++ util/nvramtool/lbtable.c	(Arbeitskopie)
@@ -63,7 +63,6 @@ 
 					    unsigned long end,
 					    int *bad_header_count,
 					    int *bad_table_count);
-static const struct lb_record *find_lbrec(uint32_t tag);
 static const char *lbrec_tag_to_str(uint32_t tag);
 static void memory_print_fn(const struct lb_record *rec);
 static void mainboard_print_fn(const struct lb_record *rec);
@@ -215,11 +214,6 @@ 
 /* Pointer to coreboot table. */
 static const struct lb_header *lbtable = NULL;
 
-/* The CMOS option table is located within the coreboot table.  It tells us
- * where the CMOS parameters are located in the nonvolatile RAM.
- */
-static const struct cmos_option_table *cmos_table = NULL;
-
 static const hexdump_format_t format =
     { 12, 4, "            ", " | ", " ", " | ", '.' };
 
@@ -303,21 +297,6 @@ 
 }
 
 /****************************************************************************
- * get_layout_from_cmos_table
- *
- * Find the CMOS table which is stored within the coreboot table and set the
- * global variable cmos_table to point to it.
- ****************************************************************************/
-void get_layout_from_cmos_table(void)
-{
-
-	get_lbtable();
-	cmos_table = (const struct cmos_option_table *)
-	    find_lbrec(LB_TAG_CMOS_OPTION_TABLE);
-	process_layout();
-}
-
-/****************************************************************************
  * dump_lbtable
  *
  * Do a low-level dump of the coreboot table.
@@ -538,7 +517,7 @@ 
  * Find the record in the coreboot table that matches 'tag'.  Return pointer
  * to record on success or NULL if record not found.
  ****************************************************************************/
-static const struct lb_record *find_lbrec(uint32_t tag)
+const struct lb_record *find_lbrec(uint32_t tag)
 {
 	const char *p;
 	uint32_t bytes_processed;
Index: util/nvramtool/lbtable.h
===================================================================
--- util/nvramtool/lbtable.h	(Revision 6437)
+++ util/nvramtool/lbtable.h	(Arbeitskopie)
@@ -39,6 +39,7 @@ 
 void dump_lbtable(void);
 void list_lbtable_choices(void);
 void list_lbtable_item(const char item[]);
+const struct lb_record *find_lbrec(uint32_t tag);
 
 void process_layout(void);
 #endif				/* LBTABLE_H */