blob: 782ad42cb707c781a0fa8620e817ac97e85f2bd3 [file] [log] [blame]
Randall Spanglerda2b49c2014-06-10 17:03:40 -07001/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 *
5 * Stub API implementations which should be implemented by the caller.
6 */
7
Bill Richardson40890c52015-01-26 13:48:32 -08008#include <stdarg.h>
Julius Wernerac15a152020-09-01 15:31:14 -07009#include <stdlib.h>
Bill Richardson40890c52015-01-26 13:48:32 -080010#include <stdio.h>
11
Randall Spanglerda2b49c2014-06-10 17:03:40 -070012#include "2api.h"
Joel Kitchingffd42a82019-08-29 13:58:52 +080013#include "2sysincludes.h"
Randall Spanglerda2b49c2014-06-10 17:03:40 -070014
Julius Wernerf10e9092014-12-16 19:24:54 -080015__attribute__((weak))
Bill Richardson40890c52015-01-26 13:48:32 -080016void vb2ex_printf(const char *func, const char *fmt, ...)
17{
Julius Werner5160e692019-03-05 13:56:41 -080018#ifdef VBOOT_DEBUG
Bill Richardson40890c52015-01-26 13:48:32 -080019 va_list ap;
20 va_start(ap, fmt);
Randall Spanglera6094782017-01-20 14:54:47 -080021 if (func)
22 fprintf(stderr, "%s: ", func);
Bill Richardson40890c52015-01-26 13:48:32 -080023 vfprintf(stderr, fmt, ap);
24 va_end(ap);
Julius Werner5160e692019-03-05 13:56:41 -080025#endif
Bill Richardson40890c52015-01-26 13:48:32 -080026}
27
28__attribute__((weak))
Joel Kitchinge6700f42019-07-31 14:12:30 +080029vb2_error_t vb2ex_tpm_clear_owner(struct vb2_context *ctx)
Randall Spanglerda2b49c2014-06-10 17:03:40 -070030{
Joel Kitching231112a2019-04-25 18:16:06 +080031 fprintf(stderr, "%s: function not implemented\n", __func__);
Joel Kitchinga1df89d2018-12-03 14:39:57 +080032 return VB2_ERROR_EX_UNIMPLEMENTED;
Randall Spanglerda2b49c2014-06-10 17:03:40 -070033}
34
Julius Wernerf10e9092014-12-16 19:24:54 -080035__attribute__((weak))
Joel Kitchinge6700f42019-07-31 14:12:30 +080036vb2_error_t vb2ex_read_resource(struct vb2_context *ctx,
37 enum vb2_resource_index index, uint32_t offset,
38 void *buf, uint32_t size)
Randall Spanglerda2b49c2014-06-10 17:03:40 -070039{
Joel Kitching231112a2019-04-25 18:16:06 +080040 fprintf(stderr, "%s: function not implemented\n", __func__);
Joel Kitchinga1df89d2018-12-03 14:39:57 +080041 return VB2_ERROR_EX_UNIMPLEMENTED;
Randall Spanglerda2b49c2014-06-10 17:03:40 -070042}
Julius Wernerf10e9092014-12-16 19:24:54 -080043
44__attribute__((weak))
Joel Kitchinge6700f42019-07-31 14:12:30 +080045vb2_error_t vb2ex_tpm_set_mode(enum vb2_tpm_mode mode_val)
Matt Delco08bf6802019-02-13 15:54:24 -080046{
Joel Kitching231112a2019-04-25 18:16:06 +080047 fprintf(stderr, "%s: function not implemented\n", __func__);
Joel Kitchinga1df89d2018-12-03 14:39:57 +080048 return VB2_ERROR_EX_UNIMPLEMENTED;
Matt Delco08bf6802019-02-13 15:54:24 -080049}
Joel Kitchingaaf39432019-09-11 14:15:45 +080050
51__attribute__((weak))
Tim Wawrzynczak5d874c22019-10-22 15:36:59 -060052vb2_error_t vb2ex_auxfw_check(enum vb2_auxfw_update_severity *severity)
53{
Joel Kitchinga5c13bc2020-09-24 17:13:31 +080054 *severity = VB2_AUXFW_NO_UPDATE;
55 return VB2_SUCCESS;
Tim Wawrzynczak5d874c22019-10-22 15:36:59 -060056}
57
58__attribute__((weak))
59vb2_error_t vb2ex_auxfw_update(void)
60{
Joel Kitchinga5c13bc2020-09-24 17:13:31 +080061 return VB2_SUCCESS;
Tim Wawrzynczak5d874c22019-10-22 15:36:59 -060062}
63
64__attribute__((weak))
65vb2_error_t vb2ex_auxfw_finalize(struct vb2_context *ctx)
66{
Joel Kitchinga5c13bc2020-09-24 17:13:31 +080067 return VB2_SUCCESS;
Tim Wawrzynczak5d874c22019-10-22 15:36:59 -060068}
69
70__attribute__((weak))
Joel Kitchingaaf39432019-09-11 14:15:45 +080071void vb2ex_abort(void)
72{
73 /* Stub simply exits. */
Julius Wernerac15a152020-09-01 15:31:14 -070074 abort();
Joel Kitchingaaf39432019-09-11 14:15:45 +080075}
Hsuan Ting Chenb92543c2020-06-19 13:28:06 +080076
77__attribute__((weak))
78const char *vb2ex_get_debug_info(struct vb2_context *ctx)
79{
80 return NULL;
81}
82
83__attribute__((weak))
Hsuan Ting Chen4e5ce422020-09-15 15:30:00 +080084const char *vb2ex_get_firmware_log(int reset)
Hsuan Ting Chen8196d4e2020-07-30 13:52:34 +080085{
86 return NULL;
87}
88
89__attribute__((weak))
Yu-Ping Wuabcd6d22020-11-06 11:24:22 +080090uint32_t vb2ex_prepare_log_screen(enum vb2_screen screen, uint32_t locale_id,
91 const char *str)
Hsuan Ting Chenb92543c2020-06-19 13:28:06 +080092{
93 return 1;
94}
Meng-Huan Yu2fb76832020-08-24 16:17:56 +080095
96__attribute__((weak))
97const char *vb2ex_get_diagnostic_storage(void)
98{
99 return "mock";
100}
101
102__attribute__((weak))
103vb2_error_t vb2ex_diag_memory_quick_test(int reset, const char **out)
104{
105 *out = "mock";
106 return VB2_SUCCESS;
107}
108
109__attribute__((weak))
110vb2_error_t vb2ex_diag_memory_full_test(int reset, const char **out)
111{
112 *out = "mock";
113 return VB2_SUCCESS;
114}