summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/Makefile.inc11
-rw-r--r--src/arch/x86/boot/coreboot_table.c13
-rw-r--r--src/arch/x86/include/arch/coreboot_tables.h2
-rw-r--r--src/include/cbfs.h3
-rw-r--r--src/pc80/mc146818rtc.c4
-rw-r--r--src/pc80/mc146818rtc_early.c2
6 files changed, 21 insertions, 14 deletions
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 92c4f670ef..6cd475f0f2 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -27,7 +27,10 @@ subdirs-y += smp
OPTION_TABLE_H:=
ifeq ($(CONFIG_HAVE_OPTION_TABLE),y)
-ramstage-srcs += $(obj)/option_table.c
+cbfs-files-y += $(obj)/cmos_layout.bin
+$(obj)/cmos_layout.bin-name = cmos_layout.bin
+$(obj)/cmos_layout.bin-type = 0x01aa
+
OPTION_TABLE_H:=$(obj)/option_table.h
endif
@@ -64,7 +67,7 @@ prebuild-files = \
$(CBFSTOOL) $@ add $(call extract_nth,1,$(file)) $(call extract_nth,2,$(file)) $(call extract_nth,3,$(file)) $(call extract_nth,4,$(file)); )
prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
-$(obj)/coreboot.pre1: $(obj)/coreboot.bootblock $(prebuilt-files) $(CBFSTOOL)
+$(obj)/coreboot.pre1: $(obj)/coreboot.bootblock $$(prebuilt-files) $(CBFSTOOL)
rm -f $@
$(CBFSTOOL) $@ create $(CONFIG_COREBOOT_ROMSIZE_KB)K $(obj)/coreboot.bootblock
$(prebuild-files)
@@ -121,9 +124,9 @@ $(OPTION_TABLE_H): $(objutil)/options/build_opt_tbl $(top)/src/mainboard/$(MAINB
@printf " OPTION $(subst $(obj)/,,$(@))\n"
$(objutil)/options/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --header $@
-$(obj)/option_table.c: $(objutil)/options/build_opt_tbl $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
+$(obj)/cmos_layout.bin: $(objutil)/options/build_opt_tbl $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
@printf " OPTION $(subst $(obj)/,,$(@))\n"
- $(objutil)/options/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --option $@
+ $(objutil)/options/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --binary $@
$(objutil)/options/build_opt_tbl: $(top)/util/options/build_opt_tbl.c $(top)/src/include/pc80/mc146818rtc.h $(top)/src/include/boot/coreboot_tables.h
@printf " HOSTCC $(subst $(obj)/,,$(@))\n"
diff --git a/src/arch/x86/boot/coreboot_table.c b/src/arch/x86/boot/coreboot_table.c
index 484340c96a..3dc8ea612b 100644
--- a/src/arch/x86/boot/coreboot_table.c
+++ b/src/arch/x86/boot/coreboot_table.c
@@ -542,11 +542,14 @@ unsigned long write_coreboot_table(
#if (CONFIG_USE_OPTION_TABLE == 1)
{
- struct lb_record *rec_dest = lb_new_record(head);
- /* Copy the option config table, it's already a lb_record... */
- memcpy(rec_dest, &option_table, option_table.size);
- /* Create cmos checksum entry in coreboot table */
- lb_cmos_checksum(head);
+ struct cmos_option_table option_table = cbfs_find_file("cmos_layout.bin", 0x1aa);
+ if (option_table) {
+ struct lb_record *rec_dest = lb_new_record(head);
+ /* Copy the option config table, it's already a lb_record... */
+ memcpy(rec_dest, &option_table, option_table.size);
+ /* Create cmos checksum entry in coreboot table */
+ lb_cmos_checksum(head);
+ }
}
#endif
/* Record where RAM is located */
diff --git a/src/arch/x86/include/arch/coreboot_tables.h b/src/arch/x86/include/arch/coreboot_tables.h
index 3c9bf98f22..773e053835 100644
--- a/src/arch/x86/include/arch/coreboot_tables.h
+++ b/src/arch/x86/include/arch/coreboot_tables.h
@@ -16,8 +16,6 @@ void lb_memory_range(struct lb_memory *mem,
*/
struct lb_memory *get_lb_mem(void);
-extern struct cmos_option_table option_table;
-
/* defined by mainboard.c if the mainboard requires extra resources */
int add_mainboard_resources(struct lb_memory *mem);
int add_northbridge_resources(struct lb_memory *mem);
diff --git a/src/include/cbfs.h b/src/include/cbfs.h
index c17d13f64f..c1c1e33743 100644
--- a/src/include/cbfs.h
+++ b/src/include/cbfs.h
@@ -71,6 +71,9 @@
#define CBFS_TYPE_VSA 0x51
#define CBFS_TYPE_MBI 0x52
#define CBFS_TYPE_MICROCODE 0x53
+#define CBFS_COMPONENT_CMOS_DEFAULT 0xaa
+#define CBFS_COMPONENT_CMOS_LAYOUT 0x01aa
+
/** this is the master cbfs header - it need to be
located somewhere in the bootblock. Where it
diff --git a/src/pc80/mc146818rtc.c b/src/pc80/mc146818rtc.c
index ce9132596b..32543f01c2 100644
--- a/src/pc80/mc146818rtc.c
+++ b/src/pc80/mc146818rtc.c
@@ -4,6 +4,7 @@
#include <string.h>
#if CONFIG_USE_OPTION_TABLE
#include "option_table.h"
+#include <cbfs.h>
#endif
/* control registers - Moto names
@@ -217,7 +218,6 @@ static int get_cmos_value(unsigned long bit, unsigned long length, void *vret)
int get_option(void *dest, const char *name)
{
- extern struct cmos_option_table option_table;
struct cmos_option_table *ct;
struct cmos_entries *ce;
size_t namelen;
@@ -227,7 +227,7 @@ int get_option(void *dest, const char *name)
namelen = strnlen(name, CMOS_MAX_NAME_LENGTH);
/* find the requested entry record */
- ct=&option_table;
+ ct=cbfs_find_file("cmos_layout.bin", CMOS_COMPONENT_CMOS_LAYOUT);
ce=(struct cmos_entries*)((unsigned char *)ct + ct->header_length);
for(;ce->tag==LB_TAG_OPTION;
ce=(struct cmos_entries*)((unsigned char *)ce + ce->size)) {
diff --git a/src/pc80/mc146818rtc_early.c b/src/pc80/mc146818rtc_early.c
index bb81ca7b65..455ed08ab9 100644
--- a/src/pc80/mc146818rtc_early.c
+++ b/src/pc80/mc146818rtc_early.c
@@ -65,7 +65,7 @@ static inline int do_normal_boot(void)
if (cmos_error() || !cmos_chksum_valid()) {
#if CONFIG_USE_CMOS_RECOVERY
- char *cmos_default = cbfs_find_file("cmos.default", 0xaa);
+ char *cmos_default = cbfs_find_file("cmos.default", CBFS_COMPONENT_CMOS_DEFAULT);
if (cmos_default) {
printk_warning("WARNING - CMOS CORRUPTED. RESTORING DEFAULTS.\n");
/* First 14 bytes are reserved for