diff options
author | Gabe Black <gabeblack@chromium.org> | 2011-08-08 16:51:04 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:59:30 -0700 |
commit | ecc8c1e8ec9339a11a6dd79a3bd4ed65da79b189 (patch) | |
tree | 09948befd54961ce85f91307e0b373d35edfeaa0 /board/chromebook-x86 | |
parent | dc900f1de50a5e0d329433cb3957d40c689062b7 (diff) |
Makes the VbExGetTimer vboot callback function board specific
The timer_get_us function which is called by the existing implementation of
VbExGetTimer isn't trivial to implement on x86. The vboot source says that the
TSC is an appropriate time source to return from this function. This change
makes the VbExGetTimer function per board so that it can use rdtsc instead of
timer_get_us.
BUG=chrome-os-partner:4552
TEST=Built and booted on x86-alex, and built on tegra2_kaen.
Signed-off-by: Gabe Black <gabeblack@google.com>
Change-Id: I335d5ae98949cd05c42dc3f30c52931bdf63a623
Reviewed-on: http://gerrit.chromium.org/gerrit/5544
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Diffstat (limited to 'board/chromebook-x86')
-rw-r--r-- | board/chromebook-x86/vbexport/Makefile | 1 | ||||
-rw-r--r-- | board/chromebook-x86/vbexport/utility.c | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/board/chromebook-x86/vbexport/Makefile b/board/chromebook-x86/vbexport/Makefile index 327f0b2e41b..b46b1112ea5 100644 --- a/board/chromebook-x86/vbexport/Makefile +++ b/board/chromebook-x86/vbexport/Makefile @@ -13,6 +13,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)libvbexport_board.a COBJS-$(CONFIG_CHROMEOS_VBEXPORT) += nvstorage.o +COBJS-$(CONFIG_CHROMEOS_VBEXPORT) += utility.o COBJS := $(COBJS-y) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/board/chromebook-x86/vbexport/utility.c b/board/chromebook-x86/vbexport/utility.c new file mode 100644 index 00000000000..21d9ca7fc0a --- /dev/null +++ b/board/chromebook-x86/vbexport/utility.c @@ -0,0 +1,22 @@ +/* + * 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 <common.h> + +/* Import the definition of vboot_wrapper interfaces. */ +#include <vboot_api.h> + +uint64_t VbExGetTimer(void) +{ + uint32_t high, low; + + __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)); + return ((uint64_t)high << 32) | (uint64_t)low; +} |