summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu-Ping Wu <yupingso@chromium.org>2022-03-17 18:07:53 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-07 10:23:08 +0000
commit847ee5a830e4dc1d00fab2eb70465e3cddd1fb27 (patch)
tree8df7c2f3091c54e2141feb7b8531b2a97011e7cc
parentbc952540dfeb2f2441e24a33965f62cc12681f96 (diff)
downloadvboot-firmware-guybrush-14500.B.tar.gz
With a series of UI callback functions removed from depthcharge (see the long CL list in Cq-Depend below), now we can remove them from vboot2 API. BUG=b:172339016 TEST=make runtests -j TEST=emerge-corsola libpayload depthcharge BRANCH=none Cq-Depend: chromium:3581323, chromium:3581320, chromium:3587669 Cq-Depend: chromium:3611670, chromium:3631467, chromium:3631405 Cq-Depend: chromium:3677727, chromium:3681952 Change-Id: Icccaf81b8a6f16780bf68a6f1f3aa01689fc9ed8 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3682754 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org>
-rw-r--r--Android.mk2
-rw-r--r--Makefile2
-rw-r--r--firmware/2lib/2stub.c92
-rw-r--r--firmware/2lib/include/2api.h141
-rw-r--r--firmware/2lib/include/2return_codes.h15
-rw-r--r--firmware/stub/vboot_api_stub.c25
6 files changed, 34 insertions, 243 deletions
diff --git a/Android.mk b/Android.mk
index c54a3b73..e0ba6aa4 100644
--- a/Android.mk
+++ b/Android.mk
@@ -67,7 +67,6 @@ VBSF_SRCS += \
firmware/stub/vboot_api_stub_sf.c
VBSLK_SRCS += \
- firmware/stub/vboot_api_stub.c \
firmware/stub/vboot_api_stub_disk.c \
firmware/stub/vboot_api_stub_stream.c
@@ -169,4 +168,3 @@ LOCAL_GENERATED_SOURCES := $(generated_sources)/futility_cmds.c
LOCAL_STATIC_LIBRARIES := libvboot_util-host
LOCAL_SHARED_LIBRARIES := libcrypto-host
include $(BUILD_HOST_EXECUTABLE)
-
diff --git a/Makefile b/Makefile
index 9d82d0a2..5f5b7066 100644
--- a/Makefile
+++ b/Makefile
@@ -430,7 +430,6 @@ ifeq (${FIRMWARE_ARCH},)
# TODO: split out other stub funcs too
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_stream.c \
firmware/2lib/2stub.c
@@ -522,7 +521,6 @@ HOSTLIB_SRCS = \
firmware/lib/cgptlib/crc32.c \
firmware/lib/gpt_misc.c \
firmware/stub/tpm_lite_stub.c \
- firmware/stub/vboot_api_stub.c \
firmware/stub/vboot_api_stub_disk.c \
futility/dump_kernel_config_lib.c \
$(CROSSYSTEM_ARCH_C) \
diff --git a/firmware/2lib/2stub.c b/firmware/2lib/2stub.c
index da754ad4..ef0bbd8a 100644
--- a/firmware/2lib/2stub.c
+++ b/firmware/2lib/2stub.c
@@ -38,11 +38,12 @@ void vb2ex_abort(void)
}
__attribute__((weak))
-uint32_t vb2ex_mtime(void)
+vb2_error_t vb2ex_commit_data(struct vb2_context *ctx)
{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return tv.tv_sec * VB2_MSEC_PER_SEC + tv.tv_usec / VB2_USEC_PER_MSEC;
+ ctx->flags &= ~VB2_CONTEXT_SECDATA_FIRMWARE_CHANGED;
+ ctx->flags &= ~VB2_CONTEXT_SECDATA_KERNEL_CHANGED;
+ ctx->flags &= ~VB2_CONTEXT_NVDATA_CHANGED;
+ return VB2_SUCCESS;
}
__attribute__((weak))
@@ -162,102 +163,41 @@ vb2_error_t vb2ex_auxfw_finalize(struct vb2_context *ctx)
/* UI-related stubs */
__attribute__((weak))
-const char *vb2ex_get_debug_info(struct vb2_context *ctx)
-{
- return NULL;
-}
-
-__attribute__((weak))
-const char *vb2ex_get_firmware_log(int reset)
-{
- return NULL;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_diag_get_storage_health(const char **out)
-{
- *out = "mock";
- return VB2_SUCCESS;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_diag_get_storage_test_log(const char **out)
-{
- *out = "mock";
- return VB2_SUCCESS;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_diag_memory_quick_test(int reset, const char **out)
+vb2_error_t vb2ex_broken_screen_ui(struct vb2_context *ctx)
{
- *out = "mock";
return VB2_SUCCESS;
}
__attribute__((weak))
-vb2_error_t vb2ex_diag_memory_full_test(int reset, const char **out)
+vb2_error_t vb2ex_manual_recovery_ui(struct vb2_context *ctx)
{
- *out = "mock";
return VB2_SUCCESS;
}
__attribute__((weak))
-void vb2ex_msleep(uint32_t msec)
-{
-}
-
-__attribute__((weak))
-void vb2ex_beep(uint32_t msec, uint32_t frequency)
-{
-}
-
-__attribute__((weak))
-uint32_t vb2ex_get_locale_count(void)
-{
- return 0;
-}
-
-__attribute__((weak))
-uint32_t vb2ex_get_altfw_count(void)
-{
- return 0;
-}
-
-__attribute__((weak))
-int vb2ex_physical_presence_pressed(void)
-{
- return 0;
-}
-
-__attribute__((weak))
-vb2_error_t vb2ex_commit_data(struct vb2_context *ctx)
+vb2_error_t vb2ex_developer_ui(struct vb2_context *ctx)
{
- ctx->flags &= ~VB2_CONTEXT_SECDATA_FIRMWARE_CHANGED;
- ctx->flags &= ~VB2_CONTEXT_SECDATA_KERNEL_CHANGED;
- ctx->flags &= ~VB2_CONTEXT_NVDATA_CHANGED;
return VB2_SUCCESS;
}
__attribute__((weak))
-vb2_error_t vb2ex_broken_screen_ui(struct vb2_context *ctx)
+vb2_error_t vb2ex_diagnostic_ui(struct vb2_context *ctx)
{
return VB2_SUCCESS;
}
-__attribute__((weak))
-vb2_error_t vb2ex_manual_recovery_ui(struct vb2_context *ctx)
-{
- return VB2_SUCCESS;
-}
+/*****************************************************************************/
+/* Timer-related stubs */
__attribute__((weak))
-vb2_error_t vb2ex_developer_ui(struct vb2_context *ctx)
+uint32_t vb2ex_mtime(void)
{
- return VB2_SUCCESS;
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return tv.tv_sec * VB2_MSEC_PER_SEC + tv.tv_usec / VB2_USEC_PER_MSEC;
}
__attribute__((weak))
-vb2_error_t vb2ex_diagnostic_ui(struct vb2_context *ctx)
+void vb2ex_msleep(uint32_t msec)
{
- return VB2_SUCCESS;
}
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index 4b68c81e..b740f6dd 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -1439,7 +1439,8 @@ vb2_error_t vb2ex_ec_vboot_done(struct vb2_context *ctx);
vb2_error_t vb2ex_ec_battery_cutoff(void);
/*****************************************************************************/
-/* Functions for UI display. */
+/* Functions for firmware UI. */
+/* TODO(b/172339016): Remove vb2ex_*_ui(). */
/**
* UI for a non-manual recovery ("BROKEN").
@@ -1488,76 +1489,6 @@ vb2_error_t vb2ex_developer_ui(struct vb2_context *ctx);
*/
vb2_error_t vb2ex_diagnostic_ui(struct vb2_context *ctx);
-/* Helpers for bitmask operations */
-#define VB2_SET_BIT(mask, index) ((mask) |= ((uint32_t)1 << (index)))
-#define VB2_CLR_BIT(mask, index) ((mask) &= ~((uint32_t)1 << (index)))
-#define VB2_GET_BIT(mask, index) ((mask) & ((uint32_t)1 << (index)))
-
-/**
- * Check that physical presence button is currently pressed by the user.
- *
- * @return 1 for pressed, 0 for not.
- */
-int vb2ex_physical_presence_pressed(void);
-
-/**
- * Get the number of supported locales.
- *
- * @return Number of locales. 0 if none or on error.
- */
-uint32_t vb2ex_get_locale_count(void);
-
-/**
- * Return the number of available alternate bootloaders.
- *
- * @return Number of alternate bootloaders. 0 if none or on error.
- */
-uint32_t vb2ex_get_altfw_count(void);
-
-/**
- * Run alternate bootloader.
- *
- * @param altfw_id ID of alternate bootloader to run, where
- * altfw_id <= vb2ex_get_altfw_count(). 0 for default,
- * which corresponds to an alternate bootloader in
- * the range 1 <= altfw_id <= vb2ex_getfw_count().
- * @return VB2_SUCCESS, or error code on error.
- */
-vb2_error_t vb2ex_run_altfw(uint32_t altfw_id);
-
-/**
- * Delay for at least the specified number of milliseconds.
- *
- * @param msec Duration in milliseconds.
- */
-void vb2ex_msleep(uint32_t msec);
-
-/**
- * Play a beep tone of the specified frequency in Hz for the duration msec.
- *
- * This is effectively a sleep call that makes noise. The implementation may
- * beep at a fixed frequency if frequency support is not available. Regardless
- * of whether any errors occur, the callback is expected to delay for the
- * specified duration before returning.
- *
- * @param msec Duration of beep in milliseconds.
- * @param frequency Sound frequency in Hz.
- */
-void vb2ex_beep(uint32_t msec, uint32_t frequency);
-
-/**
- * Get the full debug info string.
- *
- * Return a pointer to the full debug info string which is guaranteed to be
- * null-terminated. The function implementation should manage string memory
- * internally. Subsequent calls may update the string and return the same
- * pointer, or return a new pointer if necessary.
- *
- * @param ctx Vboot context
- * @return The pointer to the full debug info string. NULL on error.
- */
-const char *vb2ex_get_debug_info(struct vb2_context *ctx);
-
/**
* Get the vboot debug info.
*
@@ -1570,67 +1501,6 @@ const char *vb2ex_get_debug_info(struct vb2_context *ctx);
*/
char *vb2api_get_debug_info(struct vb2_context *ctx);
-/**
- * Get the full firmware log string.
- *
- * Return a pointer to the full firmware log string which is guaranteed to be
- * null-terminated. The function implementation should snapshot the full
- * firmware log when it is called. If `reset` is not zero, it will reset the
- * firmware log snapshot.
- *
- * @param reset Discard the current firmware log snapshot and
- * reacquire a new one.
- * @return The pointer to the full firmware log string. NULL on error.
- */
-const char *vb2ex_get_firmware_log(int reset);
-
-/**
- * Get the health info of the storage.
- *
- * @param out For returning a read-only pointer of full log string which is
- * guaranteed to be null-terminated. The function will manage
- * memory internally, so the returned pointer will only be valid
- * until next call.
- * @return VB2_SUCCESS, or error code on error.
- */
-vb2_error_t vb2ex_diag_get_storage_health(const char **out);
-
-/**
- * Get the storage self-test log.
- *
- * @param out For returning a read-only pointer of full log string which is
- * guaranteed to be null-terminated. The function will manage
- * memory internally, so the returned pointer will only be valid
- * until next call.
- * @return The status of storage test. VB2_SUCCESS means the test is finished,
- * regardless of passing or failing. VB2_ERROR_EX_DIAG_TEST_RUNNING means
- * the test is still running. VB2_ERROR_EX_UNIMPLEMENTED means the storage
- * self-test is not supported on this device. Other non-zero codes for internal
- * errors.
- */
-vb2_error_t vb2ex_diag_get_storage_test_log(const char **out);
-
-/**
- * Get the memory diagnostic status. When it is called, it will take over the
- * control for a short period of time running memory test, and then return the
- * result of current status. If `reset` is not zero, it will reset the memory
- * test state.
- *
- * @param reset Discard the current memory test result and re-initialize
- * a new test.
- * @param out For returning a read-only pointer of full log string which is
- * guaranteed to be null-terminated. The function will manage
- * memory internally, so the returned pointer will only be valid
- * until next call.
- * @return The status of memory test. VB2_SUCCESS means the test is finished,
- * regardless of passing or failing. VB2_ERROR_EX_DIAG_TEST_RUNNING means
- * the test is still running but the output buffer was unchanged.
- * VB2_ERROR_EX_DIAG_TEST_UPDATED means the test is still running and the output
- * buffer was updated. Other non-zero codes for internal errors.
- */
-vb2_error_t vb2ex_diag_memory_quick_test(int reset, const char **out);
-vb2_error_t vb2ex_diag_memory_full_test(int reset, const char **out);
-
/*****************************************************************************/
/* Timer. */
@@ -1644,4 +1514,11 @@ vb2_error_t vb2ex_diag_memory_full_test(int reset, const char **out);
*/
uint32_t vb2ex_mtime(void);
+/**
+ * Delay for at least the specified number of milliseconds.
+ *
+ * @param msec Duration in milliseconds.
+ */
+void vb2ex_msleep(uint32_t msec);
+
#endif /* VBOOT_REFERENCE_2API_H_ */
diff --git a/firmware/2lib/include/2return_codes.h b/firmware/2lib/include/2return_codes.h
index 176c2c6b..ca30ffa7 100644
--- a/firmware/2lib/include/2return_codes.h
+++ b/firmware/2lib/include/2return_codes.h
@@ -754,14 +754,17 @@ enum vb2_return_code {
* Deprecated: functionality removed with legacy UI (b/167643628) */
VB2_ERROR_DEPRECATED_EX_SET_VENDOR_DATA,
- /* The memory test is running but the output buffer was unchanged. */
- VB2_ERROR_EX_DIAG_TEST_RUNNING,
+ /* The memory test is running but the output buffer was unchanged.
+ Deprecated with b/172339016. */
+ VB2_ERROR_DEPRECATED_EX_DIAG_TEST_RUNNING,
- /* The memory test is running and the output buffer was updated. */
- VB2_ERROR_EX_DIAG_TEST_UPDATED,
+ /* The memory test is running and the output buffer was updated.
+ Deprecated with b/172339016. */
+ VB2_ERROR_DEPRECATED_EX_DIAG_TEST_UPDATED,
- /* The memory test initialization failed. */
- VB2_ERROR_EX_DIAG_TEST_INIT_FAILED,
+ /* The memory test initialization failed.
+ Deprecated with b/172339016. */
+ VB2_ERROR_DEPRECATED_EX_DIAG_TEST_INIT_FAILED,
/**********************************************************************
* LoadKernel errors
diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c
deleted file mode 100644
index 9335c8b3..00000000
--- a/firmware/stub/vboot_api_stub.c
+++ /dev/null
@@ -1,25 +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 <stdint.h>
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include "2api.h"
-#include "2common.h"
-#include "vboot_api.h"
-#include "vboot_test.h"
-
-__attribute__((weak))
-vb2_error_t vb2ex_run_altfw(uint32_t altfw_id)
-{
- return VB2_SUCCESS;
-}