summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2021-01-18 15:47:36 +0800
committerCommit Bot <commit-bot@chromium.org>2021-04-28 05:48:57 +0000
commit2067409974132e672dd82b2345c5e77c146e64ee (patch)
treef20103133766b23afcabc40c0f89be96524a2eaf
parent00f38c493e757819b6e6ee7f0094a9270d016ce0 (diff)
downloadvboot-2067409974132e672dd82b2345c5e77c146e64ee.tar.gz
vboot: add weak __attribute__ tag to stub functions
Function stubs in vboot2 namespace are all marked with __attribute__((weak)) tags, whereas those in vboot1 are not. Add the tag to stubs in vboot1 for consistency. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I8e54ef82882bd80720f810c17f41e902af244ead Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2635673 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2847875 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--firmware/stub/vboot_api_stub.c21
-rw-r--r--firmware/stub/vboot_api_stub_disk.c4
-rw-r--r--firmware/stub/vboot_api_stub_init.c2
-rw-r--r--firmware/stub/vboot_api_stub_stream.c3
4 files changed, 30 insertions, 0 deletions
diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c
index fe1c13d8..f5bc9fc4 100644
--- a/firmware/stub/vboot_api_stub.c
+++ b/firmware/stub/vboot_api_stub.c
@@ -18,65 +18,78 @@
#include "vboot_api.h"
#include "vboot_test.h"
+__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_bootloader_count(void)
{
return 0;
}
+__attribute__((weak))
uint32_t VbExKeyboardRead(void)
{
return 0;
}
+__attribute__((weak))
uint32_t VbExKeyboardReadWithFlags(uint32_t *flags_ptr)
{
return 0;
}
+__attribute__((weak))
int vb2ex_physical_presence_pressed(void)
{
return 0;
}
+__attribute__((weak))
uint32_t VbExIsShutdownRequested(void)
{
return 0;
}
+__attribute__((weak))
int vb2ex_ec_trusted(void)
{
return 1;
}
+__attribute__((weak))
vb2_error_t vb2ex_ec_running_rw(int *in_rw)
{
*in_rw = 0;
return VB2_SUCCESS;
}
+__attribute__((weak))
vb2_error_t vb2ex_ec_jump_to_rw(void)
{
return VB2_SUCCESS;
}
+__attribute__((weak))
vb2_error_t vb2ex_ec_disable_jump(void)
{
return VB2_SUCCESS;
}
+__attribute__((weak))
vb2_error_t vb2ex_ec_hash_image(enum vb2_firmware_selection select,
const uint8_t **hash, int *hash_size)
{
@@ -87,6 +100,7 @@ vb2_error_t vb2ex_ec_hash_image(enum vb2_firmware_selection select,
return VB2_SUCCESS;
}
+__attribute__((weak))
vb2_error_t vb2ex_ec_get_expected_image_hash(enum vb2_firmware_selection select,
const uint8_t **hash, int *hash_size)
{
@@ -97,37 +111,44 @@ vb2_error_t vb2ex_ec_get_expected_image_hash(enum vb2_firmware_selection select,
return VB2_SUCCESS;
}
+__attribute__((weak))
vb2_error_t vb2ex_ec_update_image(enum vb2_firmware_selection select)
{
return VB2_SUCCESS;
}
+__attribute__((weak))
vb2_error_t vb2ex_ec_protect(enum vb2_firmware_selection select)
{
return VB2_SUCCESS;
}
+__attribute__((weak))
vb2_error_t vb2ex_ec_vboot_done(struct vb2_context *ctx)
{
return VB2_SUCCESS;
}
+__attribute__((weak))
vb2_error_t vb2ex_ec_battery_cutoff(void)
{
return VB2_SUCCESS;
}
+__attribute__((weak))
vb2_error_t vb2ex_auxfw_check(enum vb2_auxfw_update_severity *severity)
{
*severity = VB2_AUXFW_NO_UPDATE;
return VB2_SUCCESS;
}
+__attribute__((weak))
vb2_error_t vb2ex_auxfw_update(void)
{
return VB2_SUCCESS;
}
+__attribute__((weak))
vb2_error_t VbExLegacy(enum VbAltFwIndex_t altfw_num)
{
return VB2_SUCCESS;
diff --git a/firmware/stub/vboot_api_stub_disk.c b/firmware/stub/vboot_api_stub_disk.c
index 7dc413fb..3244dc65 100644
--- a/firmware/stub/vboot_api_stub_disk.c
+++ b/firmware/stub/vboot_api_stub_disk.c
@@ -16,6 +16,7 @@
#include "vboot_api.h"
+__attribute__((weak))
vb2_error_t VbExDiskGetInfo(VbDiskInfo** infos_ptr, uint32_t* count,
uint32_t disk_flags)
{
@@ -25,6 +26,7 @@ vb2_error_t VbExDiskGetInfo(VbDiskInfo** infos_ptr, uint32_t* count,
}
+__attribute__((weak))
vb2_error_t VbExDiskFreeInfo(VbDiskInfo* infos_ptr,
VbExDiskHandle_t preserve_handle)
{
@@ -32,6 +34,7 @@ vb2_error_t VbExDiskFreeInfo(VbDiskInfo* infos_ptr,
}
+__attribute__((weak))
vb2_error_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start,
uint64_t lba_count, void* buffer)
{
@@ -39,6 +42,7 @@ vb2_error_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start,
}
+__attribute__((weak))
vb2_error_t VbExDiskWrite(VbExDiskHandle_t handle, uint64_t lba_start,
uint64_t lba_count, const void* buffer)
{
diff --git a/firmware/stub/vboot_api_stub_init.c b/firmware/stub/vboot_api_stub_init.c
index bd5c0c2b..8fffc05f 100644
--- a/firmware/stub/vboot_api_stub_init.c
+++ b/firmware/stub/vboot_api_stub_init.c
@@ -13,6 +13,7 @@
#include "2common.h"
#include "vboot_api.h"
+__attribute__((weak))
uint32_t vb2ex_mtime(void)
{
struct timeval tv;
@@ -20,6 +21,7 @@ uint32_t vb2ex_mtime(void)
return tv.tv_sec * VB2_MSEC_PER_SEC + tv.tv_usec / VB2_USEC_PER_MSEC;
}
+__attribute__((weak))
vb2_error_t vb2ex_commit_data(struct vb2_context *ctx)
{
ctx->flags &= ~VB2_CONTEXT_SECDATA_FIRMWARE_CHANGED;
diff --git a/firmware/stub/vboot_api_stub_stream.c b/firmware/stub/vboot_api_stub_stream.c
index ae0a6745..68e7ec7d 100644
--- a/firmware/stub/vboot_api_stub_stream.c
+++ b/firmware/stub/vboot_api_stub_stream.c
@@ -25,6 +25,7 @@ struct disk_stream {
uint64_t sectors_left;
};
+__attribute__((weak))
vb2_error_t VbExStreamOpen(VbExDiskHandle_t handle, uint64_t lba_start,
uint64_t lba_count, VbExStream_t *stream)
{
@@ -45,6 +46,7 @@ vb2_error_t VbExStreamOpen(VbExDiskHandle_t handle, uint64_t lba_start,
return VB2_SUCCESS;
}
+__attribute__((weak))
vb2_error_t VbExStreamRead(VbExStream_t stream, uint32_t bytes, void *buffer)
{
struct disk_stream *s = (struct disk_stream *)stream;
@@ -73,6 +75,7 @@ vb2_error_t VbExStreamRead(VbExStream_t stream, uint32_t bytes, void *buffer)
return VB2_SUCCESS;
}
+__attribute__((weak))
void VbExStreamClose(VbExStream_t stream)
{
struct disk_stream *s = (struct disk_stream *)stream;