summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/Kconfig3
-rw-r--r--arch/x86/config.mk3
-rw-r--r--arch/x86/cpu/Makefile4
-rw-r--r--arch/x86/cpu/start.S13
-rw-r--r--arch/x86/cpu/start16.S2
-rw-r--r--arch/x86/dts/coreboot.dtsi9
-rw-r--r--arch/x86/dts/link.dts36
-rw-r--r--arch/x86/include/asm/arch-coreboot/gpio.h15
-rw-r--r--arch/x86/include/asm/bootm.h12
-rw-r--r--arch/x86/include/asm/config.h3
-rw-r--r--arch/x86/include/asm/gpio.h1
-rw-r--r--arch/x86/include/asm/ibmpc.h10
-rw-r--r--arch/x86/lib/Makefile6
-rw-r--r--arch/x86/lib/bootm.c151
-rw-r--r--arch/x86/lib/zimage.c42
15 files changed, 223 insertions, 87 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ff9935a..0dba8ac 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -4,6 +4,9 @@ menu "x86 architecture"
config SYS_ARCH
default "x86"
+config USE_PRIVATE_LIBGCC
+ default y
+
choice
prompt "Target select"
diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 3106079..3e7fedb 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -28,6 +28,3 @@ PLATFORM_LDFLAGS += --emit-relocs -Bsymbolic -Bsymbolic-functions -m elf_i386
LDFLAGS_FINAL += --gc-sections -pie
LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3
LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3
-
-export NORMAL_LIBGCC = $(shell $(CC) $(PLATFORM_CPPFLAGS) -print-libgcc-file-name)
-CONFIG_USE_PRIVATE_LIBGCC := arch/x86/lib
diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile
index 415bc24..e7bb3e3 100644
--- a/arch/x86/cpu/Makefile
+++ b/arch/x86/cpu/Makefile
@@ -9,5 +9,5 @@
#
extra-y = start.o
-extra-$(CONFIG_X86_RESET_VECTOR) += resetvec.o start16.o
-obj-y = interrupts.o cpu.o
+obj-$(CONFIG_X86_RESET_VECTOR) += resetvec.o start16.o
+obj-y += interrupts.o cpu.o
diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
index 329bb3a..338bab1 100644
--- a/arch/x86/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -85,12 +85,25 @@ car_init_ret:
/* Align global data to 16-byte boundary */
andl $0xfffffff0, %esp
+ /* Zero the global data since it won't happen later */
+ xorl %eax, %eax
+ movl $GENERATED_GBL_DATA_SIZE, %ecx
+ movl %esp, %edi
+ rep stosb
+
/* Setup first parameter to setup_gdt */
movl %esp, %eax
/* Reserve space for global descriptor table */
subl $X86_GDT_SIZE, %esp
+#if defined(CONFIG_SYS_MALLOC_F_LEN)
+ subl $CONFIG_SYS_MALLOC_F_LEN, %esp
+ movl %eax, %edx
+ addl $GD_MALLOC_BASE, %edx
+ movl %esp, (%edx)
+#endif
+
/* Align temporary global descriptor table to 16-byte boundary */
andl $0xfffffff0, %esp
diff --git a/arch/x86/cpu/start16.S b/arch/x86/cpu/start16.S
index 8b9b327..6968fda 100644
--- a/arch/x86/cpu/start16.S
+++ b/arch/x86/cpu/start16.S
@@ -70,7 +70,7 @@ idt_ptr:
* GDT is setup in a safe location in RAM
*/
gdt_ptr:
- .word 0x20 /* limit (32 bytes = 4 GDT entries) */
+ .word 0x1f /* limit (31 bytes = 4 GDT entries - 1) */
.long BOOT_SEG + gdt /* base */
/* Some CPUs are picky about GDT alignment... */
diff --git a/arch/x86/dts/coreboot.dtsi b/arch/x86/dts/coreboot.dtsi
index 4862a59..c8dc4ce 100644
--- a/arch/x86/dts/coreboot.dtsi
+++ b/arch/x86/dts/coreboot.dtsi
@@ -1,13 +1,14 @@
/include/ "skeleton.dtsi"
/ {
- aliases {
- console = "/serial";
+ chosen {
+ stdout-path = "/serial";
};
serial {
- compatible = "ns16550";
- reg-shift = <1>;
+ compatible = "coreboot-uart";
+ reg = <0x3f8 0x10>;
+ reg-shift = <0>;
io-mapped = <1>;
multiplier = <1>;
baudrate = <115200>;
diff --git a/arch/x86/dts/link.dts b/arch/x86/dts/link.dts
index 4a37dac..f2fcb39 100644
--- a/arch/x86/dts/link.dts
+++ b/arch/x86/dts/link.dts
@@ -12,7 +12,23 @@
silent_console = <0>;
};
- gpio: gpio {};
+ gpioa {
+ compatible = "intel,ich6-gpio";
+ reg = <0 0x10>;
+ bank-name = "A";
+ };
+
+ gpiob {
+ compatible = "intel,ich6-gpio";
+ reg = <0x30 0x10>;
+ bank-name = "B";
+ };
+
+ gpioc {
+ compatible = "intel,ich6-gpio";
+ reg = <0x40 0x10>;
+ bank-name = "C";
+ };
serial {
reg = <0x3f8 8>;
@@ -32,4 +48,22 @@
memory-map = <0xff800000 0x00800000>;
};
};
+
+ lpc {
+ compatible = "intel,lpc";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ cros-ec@200 {
+ compatible = "google,cros-ec";
+ reg = <0x204 1 0x200 1 0x880 0x80>;
+
+ /* This describes the flash memory within the EC */
+ #address-cells = <1>;
+ #size-cells = <1>;
+ flash@8000000 {
+ reg = <0x08000000 0x20000>;
+ erase-value = <0xff>;
+ };
+ };
+ };
};
diff --git a/arch/x86/include/asm/arch-coreboot/gpio.h b/arch/x86/include/asm/arch-coreboot/gpio.h
new file mode 100644
index 0000000..3ec1816
--- /dev/null
+++ b/arch/x86/include/asm/arch-coreboot/gpio.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2014, Google Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef _X86_ARCH_GPIO_H_
+#define _X86_ARCH_GPIO_H_
+
+struct ich6_bank_platdata {
+ uint32_t base_addr;
+ const char *bank_name;
+};
+
+#endif /* _X86_ARCH_GPIO_H_ */
diff --git a/arch/x86/include/asm/bootm.h b/arch/x86/include/asm/bootm.h
new file mode 100644
index 0000000..033ab79
--- /dev/null
+++ b/arch/x86/include/asm/bootm.h
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2013, Google Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef ARM_BOOTM_H
+#define ARM_BOOTM_H
+
+void bootm_announce_and_cleanup(void);
+
+#endif
diff --git a/arch/x86/include/asm/config.h b/arch/x86/include/asm/config.h
index f06a15c..ff15828 100644
--- a/arch/x86/include/asm/config.h
+++ b/arch/x86/include/asm/config.h
@@ -8,4 +8,7 @@
#define _ASM_CONFIG_H_
#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_LMB
+#define CONFIG_SYS_BOOT_RAMDISK_HIGH
+
#endif
diff --git a/arch/x86/include/asm/gpio.h b/arch/x86/include/asm/gpio.h
index fe09f31..8bda414 100644
--- a/arch/x86/include/asm/gpio.h
+++ b/arch/x86/include/asm/gpio.h
@@ -6,6 +6,7 @@
#ifndef _X86_GPIO_H_
#define _X86_GPIO_H_
+#include <asm/arch/gpio.h>
#include <asm-generic/gpio.h>
#endif /* _X86_GPIO_H_ */
diff --git a/arch/x86/include/asm/ibmpc.h b/arch/x86/include/asm/ibmpc.h
index 0f9665f..e6d183b 100644
--- a/arch/x86/include/asm/ibmpc.h
+++ b/arch/x86/include/asm/ibmpc.h
@@ -18,14 +18,4 @@
#define SYSCTLA 0x92
#define SLAVE_PIC 0xa0
-#if 1
-#define UART0_BASE 0x3f8
-#define UART1_BASE 0x2f8
-#else
-/* FixMe: uarts swapped */
-#define UART0_BASE 0x2f8
-#define UART1_BASE 0x3f8
-#endif
-
-
#endif
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index f7303ab..25b672a 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -20,9 +20,9 @@ obj-$(CONFIG_SYS_X86_TSC_TIMER) += tsc_timer.o
obj-$(CONFIG_VIDEO_VGA) += video.o
obj-$(CONFIG_CMD_ZBOOT) += zimage.o
-LIBGCC := $(notdir $(NORMAL_LIBGCC))
-extra-y := $(LIBGCC)
+extra-$(CONFIG_USE_PRIVATE_LIBGCC) := lib.a
+NORMAL_LIBGCC = $(shell $(CC) $(PLATFORM_CPPFLAGS) -print-libgcc-file-name)
OBJCOPYFLAGS := --prefix-symbols=__normal_
-$(obj)/$(LIBGCC): $(NORMAL_LIBGCC) FORCE
+$(obj)/lib.a: $(NORMAL_LIBGCC) FORCE
$(call if_changed,objcopy)
diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index ff158dd..4c5c7f5 100644
--- a/arch/x86/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -10,80 +10,161 @@
#include <common.h>
#include <command.h>
+#include <fdt_support.h>
#include <image.h>
#include <u-boot/zlib.h>
#include <asm/bootparam.h>
#include <asm/byteorder.h>
#include <asm/zimage.h>
+#ifdef CONFIG_SYS_COREBOOT
+#include <asm/arch/timestamp.h>
+#endif
#define COMMAND_LINE_OFFSET 0x9000
-/*cmd_boot.c*/
-int do_bootm_linux(int flag, int argc, char * const argv[],
- bootm_headers_t *images)
+/*
+ * Implement a weak default function for boards that optionally
+ * need to clean up the system before jumping to the kernel.
+ */
+__weak void board_final_cleanup(void)
{
- struct boot_params *base_ptr = NULL;
- ulong os_data, os_len;
- image_header_t *hdr;
- void *load_address;
+}
-#if defined(CONFIG_FIT)
- const void *data;
- size_t len;
+void bootm_announce_and_cleanup(void)
+{
+ printf("\nStarting kernel ...\n\n");
+
+#ifdef CONFIG_SYS_COREBOOT
+ timestamp_add_now(TS_U_BOOT_START_KERNEL);
+#endif
+ bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+#ifdef CONFIG_BOOTSTAGE_REPORT
+ bootstage_report();
#endif
+ board_final_cleanup();
+}
- if (flag & BOOTM_STATE_OS_PREP)
- return 0;
- if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
- return 1;
+#if defined(CONFIG_OF_LIBFDT) && !defined(CONFIG_OF_NO_KERNEL)
+int arch_fixup_memory_node(void *blob)
+{
+ bd_t *bd = gd->bd;
+ int bank;
+ u64 start[CONFIG_NR_DRAM_BANKS];
+ u64 size[CONFIG_NR_DRAM_BANKS];
+
+ for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
+ start[bank] = bd->bi_dram[bank].start;
+ size[bank] = bd->bi_dram[bank].size;
+ }
+
+ return fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
+}
+#endif
+/* Subcommand: PREP */
+static int boot_prep_linux(bootm_headers_t *images)
+{
+ char *cmd_line_dest = NULL;
+ image_header_t *hdr;
+ int is_zimage = 0;
+ void *data = NULL;
+ size_t len;
+ int ret;
+
+#ifdef CONFIG_OF_LIBFDT
+ if (images->ft_len) {
+ debug("using: FDT\n");
+ if (image_setup_linux(images)) {
+ puts("FDT creation failed! hanging...");
+ hang();
+ }
+ }
+#endif
if (images->legacy_hdr_valid) {
hdr = images->legacy_hdr_os;
if (image_check_type(hdr, IH_TYPE_MULTI)) {
+ ulong os_data, os_len;
+
/* if multi-part image, we need to get first subimage */
image_multi_getimg(hdr, 0, &os_data, &os_len);
+ data = (void *)os_data;
+ len = os_len;
} else {
/* otherwise get image data */
- os_data = image_get_data(hdr);
- os_len = image_get_data_size(hdr);
+ data = (void *)image_get_data(hdr);
+ len = image_get_data_size(hdr);
}
+ is_zimage = 1;
#if defined(CONFIG_FIT)
- } else if (images->fit_uname_os) {
- int ret;
-
+ } else if (images->fit_uname_os && is_zimage) {
ret = fit_image_get_data(images->fit_hdr_os,
- images->fit_noffset_os, &data, &len);
+ images->fit_noffset_os,
+ (const void **)&data, &len);
if (ret) {
puts("Can't get image data/size!\n");
goto error;
}
- os_data = (ulong)data;
- os_len = (ulong)len;
+ is_zimage = 1;
#endif
- } else {
- puts("Could not find kernel image!\n");
- goto error;
}
-#ifdef CONFIG_CMD_ZBOOT
- base_ptr = load_zimage((void *)os_data, os_len, &load_address);
-#endif
+ if (is_zimage) {
+ void *load_address;
+ char *base_ptr;
- if (NULL == base_ptr) {
- printf("## Kernel loading failed ...\n");
+ base_ptr = (char *)load_zimage(data, len, &load_address);
+ images->os.load = (ulong)load_address;
+ cmd_line_dest = base_ptr + COMMAND_LINE_OFFSET;
+ images->ep = (ulong)base_ptr;
+ } else if (images->ep) {
+ cmd_line_dest = (void *)images->ep + COMMAND_LINE_OFFSET;
+ } else {
+ printf("## Kernel loading failed (no setup) ...\n");
goto error;
}
- if (setup_zimage(base_ptr, (char *)base_ptr + COMMAND_LINE_OFFSET,
+ printf("Setup at %#08lx\n", images->ep);
+ ret = setup_zimage((void *)images->ep, cmd_line_dest,
0, images->rd_start,
- images->rd_end - images->rd_start)) {
+ images->rd_end - images->rd_start);
+
+ if (ret) {
printf("## Setting up boot parameters failed ...\n");
- goto error;
+ return 1;
}
- boot_zimage(base_ptr, load_address);
- /* does not return */
+ return 0;
error:
return 1;
}
+
+/* Subcommand: GO */
+static int boot_jump_linux(bootm_headers_t *images)
+{
+ debug("## Transferring control to Linux (at address %08lx, kernel %08lx) ...\n",
+ images->ep, images->os.load);
+
+ boot_zimage((struct boot_params *)images->ep, (void *)images->os.load);
+ /* does not return */
+
+ return 1;
+}
+
+int do_bootm_linux(int flag, int argc, char * const argv[],
+ bootm_headers_t *images)
+{
+ /* No need for those on x86 */
+ if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
+ return -1;
+
+ if (flag & BOOTM_STATE_OS_PREP)
+ return boot_prep_linux(images);
+
+ if (flag & BOOTM_STATE_OS_GO) {
+ boot_jump_linux(images);
+ return 0;
+ }
+
+ return boot_jump_linux(images);
+}
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index 1dab3cc..b190283 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -18,6 +18,7 @@
#include <asm/ptrace.h>
#include <asm/zimage.h>
#include <asm/byteorder.h>
+#include <asm/bootm.h>
#include <asm/bootparam.h>
#ifdef CONFIG_SYS_COREBOOT
#include <asm/arch/timestamp.h>
@@ -242,41 +243,27 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
hdr->loadflags |= HEAP_FLAG;
}
- if (bootproto >= 0x0202) {
- hdr->cmd_line_ptr = (uintptr_t)cmd_line;
- } else if (bootproto >= 0x0200) {
- setup_base->screen_info.cl_magic = COMMAND_LINE_MAGIC;
- setup_base->screen_info.cl_offset =
- (uintptr_t)cmd_line - (uintptr_t)setup_base;
+ if (cmd_line) {
+ if (bootproto >= 0x0202) {
+ hdr->cmd_line_ptr = (uintptr_t)cmd_line;
+ } else if (bootproto >= 0x0200) {
+ setup_base->screen_info.cl_magic = COMMAND_LINE_MAGIC;
+ setup_base->screen_info.cl_offset =
+ (uintptr_t)cmd_line - (uintptr_t)setup_base;
+
+ hdr->setup_move_size = 0x9100;
+ }
- hdr->setup_move_size = 0x9100;
+ /* build command line at COMMAND_LINE_OFFSET */
+ build_command_line(cmd_line, auto_boot);
}
- /* build command line at COMMAND_LINE_OFFSET */
- build_command_line(cmd_line, auto_boot);
return 0;
}
-/*
- * Implement a weak default function for boards that optionally
- * need to clean up the system before jumping to the kernel.
- */
-__weak void board_final_cleanup(void)
-{
-}
-
void boot_zimage(void *setup_base, void *load_address)
{
- debug("## Transferring control to Linux (at address %08x) ...\n",
- (u32)setup_base);
-
- bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
-#ifdef CONFIG_BOOTSTAGE_REPORT
- bootstage_report();
-#endif
- board_final_cleanup();
-
- printf("\nStarting kernel ...\n\n");
+ bootm_announce_and_cleanup();
#ifdef CONFIG_SYS_COREBOOT
timestamp_add_now(TS_U_BOOT_START_KERNEL);
@@ -295,7 +282,6 @@ void boot_zimage(void *setup_base, void *load_address)
:: [kernel_entry]"a"(load_address),
[boot_params] "S"(setup_base),
"b"(0), "D"(0)
- : "%ebp"
);
}