summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2011-08-09 09:43:40 -0700
committerSimon Glass <sjg@chromium.org>2011-08-29 10:59:32 -0700
commitb5330c3bc3e2d2240a1d79c6b084d3de0e199d95 (patch)
tree620bf00129f4ee3cc8759941de2280389ee57329 /arch/x86
parentf8dbba10ee02dd18c09d52f94c945e3201a4805b (diff)
Enable OF_CONTROL for Alex.
This change makes the Alex u-boot use configuration settings coming from the device tree supplied by coreboot through the coreboot table. The device tree now includes the necessary console configuration information. Code is added to retrieve the device tree pointer from the coreboot table, the appropriate coreboot structures and tag values are being duplicated in arch/i386/include/asm/ic/coreboot/tables.h. The pointer to the FDT is added to the global data structure, it is initialized as soon as it is retrieved from the coreboot table. For some reason placing the global data structure anywhere but in the .data segment causes the system to crash. This phenomenon will be investigated shortly, this commit is an intermediate step to get the device tree handover used by other coreboot/u-boot contributors. Core retrieving the device tree from CBFS is not needed anymore and gets removed. BUG=chrome-os-partner:5248 TEST=manual . build the new image and program it on Alex . restart the target, observe the console output The target boots all the way to u-boot prompt. Change-Id: I087cf70362ede0873be37fa5a98aa66a0b979d8f Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/6132 Reviewed-by: Stefan Reinauer <reinauer@google.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/cpu/coreboot/tables.c10
-rw-r--r--arch/x86/include/asm/ic/coreboot/sysinfo.h6
-rw-r--r--arch/x86/include/asm/ic/coreboot/tables.h7
-rw-r--r--arch/x86/lib/board.c27
4 files changed, 45 insertions, 5 deletions
diff --git a/arch/x86/cpu/coreboot/tables.c b/arch/x86/cpu/coreboot/tables.c
index e693f4457d..2cb4a426ab 100644
--- a/arch/x86/cpu/coreboot/tables.c
+++ b/arch/x86/cpu/coreboot/tables.c
@@ -28,6 +28,7 @@
* SUCH DAMAGE.
*/
+#include <common.h>
#include <asm/ic/coreboot/ipchecksum.h>
#include <asm/ic/coreboot/sysinfo.h>
#include <asm/ic/coreboot/tables.h>
@@ -116,6 +117,11 @@ static void cb_parse_gpios(unsigned char *ptr, struct sysinfo_t *info)
info->gpios[i] = gpios->gpios[i];
}
+static void cb_parse_fdt(unsigned char *ptr, struct sysinfo_t *info)
+{
+ info->sys_fdt = (struct fdt_header *)(((struct cb_fdt *)ptr) + 1);
+}
+
static void cb_parse_framebuffer(unsigned char *ptr, struct sysinfo_t *info)
{
info->framebuffer = (struct cb_framebuffer *)ptr;
@@ -216,6 +222,10 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
break;
case CB_TAG_GPIO:
cb_parse_gpios(ptr, info);
+ break;
+ case CB_TAG_FDT:
+ cb_parse_fdt(ptr, info);
+ break;
}
ptr += rec->size;
diff --git a/arch/x86/include/asm/ic/coreboot/sysinfo.h b/arch/x86/include/asm/ic/coreboot/sysinfo.h
index 86caaa339d..e02735346b 100644
--- a/arch/x86/include/asm/ic/coreboot/sysinfo.h
+++ b/arch/x86/include/asm/ic/coreboot/sysinfo.h
@@ -32,6 +32,9 @@
#include <compiler.h>
#include <asm/ic/coreboot/tables.h>
+#ifdef CONFIG_OF_CONTROL
+#include <fdt.h>
+#endif
/* Allow a maximum of 16 memory range definitions. */
#define SYSINFO_MAX_MEM_RANGES 16
@@ -75,6 +78,9 @@ struct sysinfo_t {
struct cb_gpio gpios[SYSINFO_MAX_GPIOS];
unsigned long *mbtable; /** Pointer to the multiboot table */
+#ifdef CONFIG_OF_CONTROL
+ struct fdt_header *sys_fdt;
+#endif
};
extern struct sysinfo_t lib_sysinfo;
diff --git a/arch/x86/include/asm/ic/coreboot/tables.h b/arch/x86/include/asm/ic/coreboot/tables.h
index e9a0c7ba96..b581e7285f 100644
--- a/arch/x86/include/asm/ic/coreboot/tables.h
+++ b/arch/x86/include/asm/ic/coreboot/tables.h
@@ -181,6 +181,13 @@ struct cb_gpios {
struct cb_gpio gpios[0];
};
+#define CB_TAG_FDT 0x0014
+struct cb_fdt {
+ uint32_t tag;
+ uint32_t size; /* size of the entire entry */
+ /* the actual FDT gets placed here */
+};
+
#define CB_TAG_CMOS_OPTION_TABLE 0x00c8
struct cb_cmos_option_table {
u32 tag;
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index c882a55bd7..2acd7a725e 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -56,8 +56,17 @@
*/
#undef XTRN_DECLARE_GLOBAL_DATA_PTR
#define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */
+#ifdef CONFIG_OF_CONTROL
+/*
+ * Place it in the initialized data segment, we were started by a bootstrap
+ * which already intialized memory.
+ */
+static gd_t gd_before_relocation = { .env_buf = { 0x20 } };
+DECLARE_GLOBAL_DATA_PTR = &gd_before_relocation;
+#else
+/* place it at a fixed location */
DECLARE_GLOBAL_DATA_PTR = (gd_t *) (CONFIG_SYS_INIT_GD_ADDR);
-
+#endif
/* Exports from the Linker Script */
extern ulong __text_start;
@@ -187,8 +196,6 @@ init_fnc_t *init_sequence_r[] = {
NULL,
};
-gd_t *gd;
-
static int calculate_relocation_address(void)
{
void *text_start = &__text_start;
@@ -264,6 +271,16 @@ void board_init_f(ulong boot_flags)
{
init_fnc_t **init_fnc_ptr;
+ /*
+ * TODO(vbendeb): find the reason for the crash and fix it. Then the
+ * below two lines will be removed.
+ *
+ * This is a hack to work around the problem with the system crashing
+ * when the gd is located at a fixed address in memory. We use the
+ * structure located in the .data segment instead, and make it look as
+ * if it was initialized by the assembler startup code.
+ */
+ memset(gd, 0, sizeof(*gd));
gd->flags = boot_flags;
for (init_fnc_ptr = init_sequence_f; *init_fnc_ptr; ++init_fnc_ptr) {
@@ -273,6 +290,8 @@ void board_init_f(ulong boot_flags)
gd->flags |= GD_FLG_RELOC;
+ printf("Relocating to %p\n", (void *)gd->relocaddr);
+
/* Enter the relocated U-Boot! */
relocate_code(gd->start_addr_sp, gd, gd->relocaddr);
@@ -297,8 +316,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
/* compiler optimization barrier needed for GCC >= 3.4 */
__asm__ __volatile__("": : :"memory");
- gd->blob = NULL;
-
gd->bd = &bd_data;
memset (gd->bd, 0, sizeof (bd_t));
show_boot_progress(0x22);