blob: 738092db41ea3b6ba80866495a7407ed91ca311c [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{
Yu-Ping Wu8c039502020-04-17 11:36:20 +080054 *severity = VB2_AUXFW_NO_UPDATE;
Tim Wawrzynczak5d874c22019-10-22 15:36:59 -060055 return VB2_SUCCESS;
56}
57
58__attribute__((weak))
59vb2_error_t vb2ex_auxfw_update(void)
60{
61 return VB2_SUCCESS;
62}
63
64__attribute__((weak))
65vb2_error_t vb2ex_auxfw_finalize(struct vb2_context *ctx)
66{
67 return VB2_SUCCESS;
68}
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))
84uint32_t vb2ex_prepare_log_screen(const char *str)
85{
86 return 1;
87}