Software APIs
boot_svc_min_bl0_sec_ver.h
1// Copyright lowRISC contributors (OpenTitan project).
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4
5#ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_BOOT_SVC_BOOT_SVC_MIN_BL0_SEC_VER_H_
6#define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_BOOT_SVC_BOOT_SVC_MIN_BL0_SEC_VER_H_
7
8#include <stdint.h>
9
11#include "sw/device/silicon_creator/lib/boot_svc/boot_svc_header.h"
12#include "sw/device/silicon_creator/lib/error.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif // __cplusplus
17
18enum {
19 /** Minimum BL0 security version request: `MSEC` */
20 kBootSvcMinBl0SecVerReqType = 0x4345534d,
21 /** Minimum BL0 security version response: `CESM` */
22 kBootSvcMinBl0SecVerResType = 0x4d534543,
23};
24
25/**
26 * A Set Minimum Security Version request.
27 */
29 /**
30 * Boot services message header.
31 */
32 boot_svc_header_t header;
33 /**
34 * Minimum security version to set.
35 */
37} boot_svc_min_bl0_sec_ver_req_t;
38
39OT_ASSERT_MEMBER_OFFSET(boot_svc_min_bl0_sec_ver_req_t, header, 0);
40OT_ASSERT_MEMBER_OFFSET(boot_svc_min_bl0_sec_ver_req_t, min_bl0_sec_ver,
42OT_ASSERT_SIZE(boot_svc_min_bl0_sec_ver_req_t, 48);
43
44/**
45 * A Set Minimum Security Version response.
46 */
48 /**
49 * Boot services message header.
50 */
51 boot_svc_header_t header;
52 /**
53 * Minimum security version read from flash.
54 */
56 /**
57 * Status response from ROM_EXT.
58 */
59 rom_error_t status;
60} boot_svc_min_bl0_sec_ver_res_t;
61
62OT_ASSERT_MEMBER_OFFSET(boot_svc_min_bl0_sec_ver_res_t, header, 0);
63OT_ASSERT_MEMBER_OFFSET(boot_svc_min_bl0_sec_ver_res_t, min_bl0_sec_ver,
65OT_ASSERT_MEMBER_OFFSET(boot_svc_min_bl0_sec_ver_res_t, status,
67OT_ASSERT_SIZE(boot_svc_min_bl0_sec_ver_res_t, 52);
68
69/**
70 * Initialize a set minimum security version request message.
71 *
72 * @param min_bl0_sec_ver The minimum security version to set.
73 * @param[out] msg Output buffer for the message.
74 */
75void boot_svc_min_bl0_sec_ver_req_init(uint32_t min_bl0_sec_ver,
76 boot_svc_min_bl0_sec_ver_req_t *msg);
77
78/**
79 * Initialize a set minimum security version response message.
80 *
81 * @param min_bl0_sec_ver The minimum security version read from flash.
82 * @param status The result of this request.
83 * @param[out] msg Output buffer for the message.
84 */
85void boot_svc_min_bl0_sec_ver_res_init(uint32_t min_bl0_sec_ver,
86 rom_error_t status,
87 boot_svc_min_bl0_sec_ver_res_t *msg);
88
89#ifdef __cplusplus
90} // extern "C"
91#endif // __cplusplus
92
93#endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_BOOT_SVC_BOOT_SVC_MIN_BL0_SEC_VER_H_