summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2021-01-18 16:11:13 +0800
committerCommit Bot <commit-bot@chromium.org>2021-04-28 05:49:00 +0000
commit1cb0dfea1bd1aa58a2d1c2b0cf5a996297a536f0 (patch)
tree6e612ff9da677c6667ece3b207769dbf3cf284d4
parentc0dd5221a95f830642f77c724370c42192679c5b (diff)
downloadvboot-1cb0dfea1bd1aa58a2d1c2b0cf5a996297a536f0.tar.gz
vboot: merge vboot_api_stub_init.c into vboot2 namespace
Move vb2ex_mtime stub from vboot_api_stub_init into 2lib/2stub.c in vboot2 namespace. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Ica27630090f854e1abc56acae0294b68deb74a0f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2635676 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2847878 Reviewed-by: Nick Vaccaro <nvaccaro@google.com> Tested-by: Nick Vaccaro <nvaccaro@google.com> Commit-Queue: Chung-Sheng Wu <chungsheng@chromium.org>
-rw-r--r--Android.mk1
-rw-r--r--Makefile2
-rw-r--r--firmware/2lib/2stub.c22
-rw-r--r--firmware/stub/vboot_api_stub_init.c22
4 files changed, 19 insertions, 28 deletions
diff --git a/Android.mk b/Android.mk
index 64d89e19..628b6053 100644
--- a/Android.mk
+++ b/Android.mk
@@ -62,7 +62,6 @@ VBSLK_SRCS = \
VBINIT_SRCS += \
firmware/stub/tpm_lite_stub.c \
firmware/stub/utility_stub.c \
- firmware/stub/vboot_api_stub_init.c \
firmware/stub/vboot_api_stub_region.c
VBSF_SRCS += \
diff --git a/Makefile b/Makefile
index 3a72d3d3..763e1f22 100644
--- a/Makefile
+++ b/Makefile
@@ -434,7 +434,6 @@ FWLIB_SRCS += \
firmware/stub/tpm_lite_stub.c \
firmware/stub/vboot_api_stub.c \
firmware/stub/vboot_api_stub_disk.c \
- firmware/stub/vboot_api_stub_init.c \
firmware/stub/vboot_api_stub_stream.c \
firmware/2lib/2stub.c
endif
@@ -515,7 +514,6 @@ HOSTLIB_SRCS = \
firmware/stub/tpm_lite_stub.c \
firmware/stub/vboot_api_stub.c \
firmware/stub/vboot_api_stub_disk.c \
- firmware/stub/vboot_api_stub_init.c \
futility/dump_kernel_config_lib.c \
$(CROSSYSTEM_ARCH_C) \
host/lib/chromeos_config.c \
diff --git a/firmware/2lib/2stub.c b/firmware/2lib/2stub.c
index 1454f77e..d26ee745 100644
--- a/firmware/2lib/2stub.c
+++ b/firmware/2lib/2stub.c
@@ -8,10 +8,15 @@
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
+#include <sys/time.h>
#include "2api.h"
+#include "2common.h"
#include "2sysincludes.h"
+/*****************************************************************************/
+/* General utility stubs */
+
__attribute__((weak))
void vb2ex_printf(const char *func, const char *fmt, ...)
{
@@ -33,10 +38,11 @@ void vb2ex_abort(void)
}
__attribute__((weak))
-vb2_error_t vb2ex_tpm_clear_owner(struct vb2_context *ctx)
+uint32_t vb2ex_mtime(void)
{
- fprintf(stderr, "%s: function not implemented\n", __func__);
- return VB2_ERROR_EX_UNIMPLEMENTED;
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return tv.tv_sec * VB2_MSEC_PER_SEC + tv.tv_usec / VB2_USEC_PER_MSEC;
}
__attribute__((weak))
@@ -48,6 +54,16 @@ vb2_error_t vb2ex_read_resource(struct vb2_context *ctx,
return VB2_ERROR_EX_UNIMPLEMENTED;
}
+/*****************************************************************************/
+/* TPM-related stubs */
+
+__attribute__((weak))
+vb2_error_t vb2ex_tpm_clear_owner(struct vb2_context *ctx)
+{
+ fprintf(stderr, "%s: function not implemented\n", __func__);
+ return VB2_ERROR_EX_UNIMPLEMENTED;
+}
+
__attribute__((weak))
vb2_error_t vb2ex_tpm_set_mode(enum vb2_tpm_mode mode_val)
{
diff --git a/firmware/stub/vboot_api_stub_init.c b/firmware/stub/vboot_api_stub_init.c
deleted file mode 100644
index 80684126..00000000
--- a/firmware/stub/vboot_api_stub_init.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (c) 2013 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.
- *
- * Stub implementations of firmware-provided API functions.
- */
-
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-#include "2common.h"
-#include "vboot_api.h"
-
-__attribute__((weak))
-uint32_t vb2ex_mtime(void)
-{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return tv.tv_sec * VB2_MSEC_PER_SEC + tv.tv_usec / VB2_USEC_PER_MSEC;
-}