diff options
author | Julius Werner <jwerner@chromium.org> | 2014-12-08 13:39:14 -0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-04-14 09:03:28 +0200 |
commit | 44cf870cb08b48dacdd6652baa15dba93fbc6216 (patch) | |
tree | 36a23e947289e3f7644dc4a65700bae177a59835 /src/arch/arm | |
parent | efcee767deed9d10628764eb9143724dd206d5fa (diff) |
timer: Reestablish init_timer(), consolidate timer initialization calls
We have known for a while that the old x86 model of calling init_timer()
in ramstage doesn't make sense on other archs (and is questionable in
general), and finally removed it with CL:219719. However, now timer
initialization is completely buried in the platform code, and it's hard
to ensure it is done in time to set up timestamps. For three out of four
non-x86 SoC vendors we have brought up for now, the timers need some
kind of SoC-specific initialization.
This patch reintroduces init_timer() as a weak function that can be
overridden by platform code. The call in ramstage is restricted to x86
(and should probably eventually be removed from there as well), and
other archs should call them at the earliest reasonable point in their
bootblock. (Only changing arm for now since arm64 and mips bootblocks
are still in very early state and should sync up to features in arm once
their requirements are better understood.) This allows us to move
timestamp_init() into arch code, so that we can rely on timestamps
being available at a well-defined point and initialize our base value as
early as possible. (Platforms who know that their timers start at zero
can still safely call timestamp_init(0) again from platform code.)
BRANCH=None
BUG=None
TEST=Booted Pinky, Blaze and Storm, compiled Daisy and Pit.
Change-Id: I1b064ba3831c0c5b7965b1d88a6f4a590789c891
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: ffaebcd3785c4ce998ac1536e9fdd46ce3f52bfa
Original-Change-Id: Iece1614b7442d4fa9ca981010e1c8497bdea308d
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/234062
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/9606
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/arch/arm')
-rw-r--r-- | src/arch/arm/armv4/bootblock_simple.c | 6 | ||||
-rw-r--r-- | src/arch/arm/armv7/bootblock_simple.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/arch/arm/armv4/bootblock_simple.c b/src/arch/arm/armv4/bootblock_simple.c index 26646eebf5..eea2dd6847 100644 --- a/src/arch/arm/armv4/bootblock_simple.c +++ b/src/arch/arm/armv4/bootblock_simple.c @@ -24,7 +24,9 @@ #include <bootblock_common.h> #include <cbfs.h> #include <console/console.h> +#include <delay.h> #include <program_loading.h> +#include <timestamp.h> __attribute__((weak)) void bootblock_mainboard_early_init(void) { /* no-op */ } __attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ } @@ -32,6 +34,10 @@ __attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ } void main(void) { + init_timer(); + if (IS_ENABLED(CONFIG_HAS_PRECBMEM_TIMESTAMP_REGION)) + timestamp_init(timestamp_get()); + bootblock_mainboard_early_init(); if (CONFIG_BOOTBLOCK_CONSOLE) { diff --git a/src/arch/arm/armv7/bootblock_simple.c b/src/arch/arm/armv7/bootblock_simple.c index 564db5b80a..b8b60c8701 100644 --- a/src/arch/arm/armv7/bootblock_simple.c +++ b/src/arch/arm/armv7/bootblock_simple.c @@ -24,8 +24,10 @@ #include <bootblock_common.h> #include <cbfs.h> #include <console/console.h> +#include <delay.h> #include <program_loading.h> #include <smp/node.h> +#include <timestamp.h> __attribute__((weak)) void bootblock_mainboard_early_init(void) { /* no-op */ } __attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ } @@ -33,6 +35,10 @@ __attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ } void main(void) { + init_timer(); + if (IS_ENABLED(CONFIG_HAS_PRECBMEM_TIMESTAMP_REGION)) + timestamp_init(timestamp_get()); + bootblock_mainboard_early_init(); #if CONFIG_BOOTBLOCK_CONSOLE |