From 20a8b41d50f2b07e709488af3570692c5dd0cb05 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:31 +0000 Subject: x86: Remove unused portion of link script Since we don't have real-mode code now, we can remove this chunk of the link script. Signed-off-by: Simon Glass Acked-by: Graeme Russ --- arch/x86/cpu/u-boot.lds | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'arch/x86/cpu') diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds index 2d6911a..b4ecd4b 100644 --- a/arch/x86/cpu/u-boot.lds +++ b/arch/x86/cpu/u-boot.lds @@ -79,18 +79,6 @@ SECTIONS /DISCARD/ : { *(.interp*) } /DISCARD/ : { *(.gnu*) } - /* 16bit realmode trampoline code */ - .realmode REALMODE_BASE : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) } - - __realmode_start = LOADADDR(.realmode); - __realmode_size = SIZEOF(.realmode); - - /* 16bit BIOS emulation code (just enough to boot Linux) */ - .bios 0 : AT ( LOADADDR(.realmode) + SIZEOF(.realmode) ) { KEEP(*(.bios)) } - - __bios_start = LOADADDR(.bios); - __bios_size = SIZEOF(.bios); - #ifdef CONFIG_X86_RESET_VECTOR /* -- cgit v1.1 From 7282d834cd47cabc481a5cbe6e686ef40751436f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:33 +0000 Subject: x86: Declare global_data pointer when it is used Several files use the global_data pointer without declaring it. This works because the declaration is currently a NOP. But still it is better to fix this so that x86 lines up with other archs. Signed-off-by: Simon Glass --- arch/x86/cpu/interrupts.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/x86/cpu') diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c index 6dc74e3..e733bcb 100644 --- a/arch/x86/cpu/interrupts.c +++ b/arch/x86/cpu/interrupts.c @@ -37,6 +37,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + #define DECLARE_INTERRUPT(x) \ ".globl irq_"#x"\n" \ ".hidden irq_"#x"\n" \ -- cgit v1.1 From c78a62acdfbc0a1cc75ee934f7897b9e99bd3e8d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:34 +0000 Subject: x86: Implement panic output for coreboot panic_puts() can be called in early boot to display a message. It might help with early debugging. Signed-off-by: Simon Glass Reviewed-by: Tom Wai-Hong Tam --- arch/x86/cpu/coreboot/coreboot.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'arch/x86/cpu') diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index f8e28f0..4a7dae49 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -135,3 +136,12 @@ int board_final_cleanup(void) return 0; } + +void panic_puts(const char *str) +{ + NS16550_t port = (NS16550_t)0x3f8; + + NS16550_init(port, 1); + while (*str) + NS16550_putc(port, *str++); +} -- cgit v1.1 From 7949703a9582ec60cf841c595acd3bbe86933cd3 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:35 +0000 Subject: x86: Rationalise kernel booting logic and bootstage The 'Starting linux' message appears twice in the code, but both call through the same place. Unify these and add calls to bootstage to mark the occasion. Signed-off-by: Simon Glass Reviewed-by: Michael Spang Acked-by: Graeme Russ --- arch/x86/cpu/cpu.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'arch/x86/cpu') diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index 1a2f85c..7a914a5 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -120,6 +120,11 @@ void setup_gdt(gd_t *id, u64 *gdt_addr) int __weak x86_cleanup_before_linux(void) { +#ifdef CONFIG_BOOTSTAGE_STASH + bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH, + CONFIG_BOOTSTAGE_STASH_SIZE); +#endif + return 0; } -- cgit v1.1 From e761ecdbb83e3151ffea5b531523256c57e62527 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:36 +0000 Subject: x86: Add TSC timer This timer runs at a rate that can be calculated, well over 100MHz. It is ideal for accurate timing and does not need interrupt servicing. Tidy up some old broken and unneeded implementations at the same time. To provide a consistent view of boot time, we use the same time base as coreboot. Use the base timestamp supplied by coreboot as U-Boot's base time. Signed-off-by: Simon Glass base Signed-off-by: Simon Glass --- arch/x86/cpu/coreboot/timestamp.c | 4 +++- arch/x86/cpu/timer.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'arch/x86/cpu') diff --git a/arch/x86/cpu/coreboot/timestamp.c b/arch/x86/cpu/coreboot/timestamp.c index 2ca7a57..d26718e 100644 --- a/arch/x86/cpu/coreboot/timestamp.c +++ b/arch/x86/cpu/coreboot/timestamp.c @@ -39,7 +39,9 @@ static struct timestamp_table *ts_table __attribute__((section(".data"))); void timestamp_init(void) { ts_table = lib_sysinfo.tstamp_table; - timer_set_tsc_base(ts_table->base_time); +#ifdef CONFIG_SYS_X86_TSC_TIMER + timer_set_base(ts_table->base_time); +#endif timestamp_add_now(TS_U_BOOT_INITTED); } diff --git a/arch/x86/cpu/timer.c b/arch/x86/cpu/timer.c index 149109d..f95fce5 100644 --- a/arch/x86/cpu/timer.c +++ b/arch/x86/cpu/timer.c @@ -10,8 +10,11 @@ #include +/* Temporary patch to maintain bisectability, removed in next commit */ +#ifndef CONFIG_SYS_X86_TSC_TIMER unsigned long timer_get_us(void) { printf("timer_get_us used but not implemented.\n"); return 0; } +#endif -- cgit v1.1 From 29756d44470f684e785a895e1f7d680e61764b58 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:37 +0000 Subject: x86: Remove old broken timer implementation Tidy up some old broken and unneeded implementations. These are not used by coreboot or anything else now. Signed-off-by: Simon Glass Reviewed-by: Gabe Black Reviewed-by: Michael Spang Reviewed-by: Vadim Bendebury Acked-by: Graeme Russ --- arch/x86/cpu/Makefile | 2 +- arch/x86/cpu/timer.c | 20 -------------------- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 arch/x86/cpu/timer.c (limited to 'arch/x86/cpu') diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile index 7b520f8..cddf0dd 100644 --- a/arch/x86/cpu/Makefile +++ b/arch/x86/cpu/Makefile @@ -30,7 +30,7 @@ LIB = $(obj)lib$(CPU).o START-y = start.o START-$(CONFIG_X86_RESET_VECTOR) += resetvec.o start16.o -COBJS = interrupts.o cpu.o timer.o +COBJS = interrupts.o cpu.o SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) diff --git a/arch/x86/cpu/timer.c b/arch/x86/cpu/timer.c deleted file mode 100644 index f95fce5..0000000 --- a/arch/x86/cpu/timer.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2011 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - */ - -#include - -/* Temporary patch to maintain bisectability, removed in next commit */ -#ifndef CONFIG_SYS_X86_TSC_TIMER -unsigned long timer_get_us(void) -{ - printf("timer_get_us used but not implemented.\n"); - return 0; -} -#endif -- cgit v1.1 From 5397d8058c15eafc227eb7ff8703008b5c89b4a9 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:47 +0000 Subject: x86: Support adding coreboot timestanps to bootstage Coreboot provides a lot of useful timing information. Provide a facility to add this to bootstage on start-up. Signed-off-by: Simon Glass --- arch/x86/cpu/coreboot/timestamp.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'arch/x86/cpu') diff --git a/arch/x86/cpu/coreboot/timestamp.c b/arch/x86/cpu/coreboot/timestamp.c index d26718e..bd3558a 100644 --- a/arch/x86/cpu/coreboot/timestamp.c +++ b/arch/x86/cpu/coreboot/timestamp.c @@ -61,3 +61,41 @@ void timestamp_add_now(enum timestamp_id id) { timestamp_add(id, rdtsc()); } + +int timestamp_add_to_bootstage(void) +{ + uint i; + + if (!ts_table) + return -1; + + for (i = 0; i < ts_table->num_entries; i++) { + struct timestamp_entry *tse = &ts_table->entries[i]; + const char *name = NULL; + + switch (tse->entry_id) { + case TS_START_ROMSTAGE: + name = "start-romstage"; + break; + case TS_BEFORE_INITRAM: + name = "before-initram"; + break; + case TS_DEVICE_INITIALIZE: + name = "device-initialize"; + break; + case TS_DEVICE_DONE: + name = "device-done"; + break; + case TS_SELFBOOT_JUMP: + name = "selfboot-jump"; + break; + } + if (name) { + bootstage_add_record(0, name, BOOTSTAGEF_ALLOC, + tse->entry_stamp / + get_tbclk_mhz()); + } + } + + return 0; +} -- cgit v1.1 From 8f0278eab4410de57ea6a32a8e5a50614a28084f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 17 Apr 2013 16:13:48 +0000 Subject: x86: Add coreboot timestamps Add selected coreboot timestamps into bootstage to get a unified view of the boot timings. Signed-off-by: Simon Glass --- arch/x86/cpu/coreboot/coreboot.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'arch/x86/cpu') diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index 4a7dae49..14cb699 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -91,6 +91,9 @@ void show_boot_progress(int val) int last_stage_init(void) { + if (gd->flags & GD_FLG_COLD_BOOT) + timestamp_add_to_bootstage(); + return 0; } -- cgit v1.1