Software APIs
sw
device
silicon_creator
lib
boot_svc
boot_svc_next_boot_bl0_slot.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_NEXT_BOOT_BL0_SLOT_H_
6
#define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_BOOT_SVC_BOOT_SVC_NEXT_BOOT_BL0_SLOT_H_
7
8
#include <
stdint.h
>
9
10
#include "
sw/device/lib/base/macros.h
"
11
#include "
sw/device/silicon_creator/lib/base/chip.h
"
12
#include "sw/device/silicon_creator/lib/boot_svc/boot_svc_header.h"
13
#include "sw/device/silicon_creator/lib/error.h"
14
15
#ifdef __cplusplus
16
extern
"C"
{
17
#endif
// __cplusplus
18
19
enum
{
20
/** Next BL0 slot request: `NEXT`. */
21
kBootSvcNextBl0SlotReqType = 0x5458454e,
22
/** Next BL0 slot response: `TXEN`. */
23
kBootSvcNextBl0SlotResType = 0x4e455854,
24
};
25
26
/**
27
* A Next Boot BL0 Slot request message.
28
*/
29
typedef
struct
boot_svc_next_boot_bl0_slot_req
{
30
/**
31
* Boot services message header.
32
*/
33
boot_svc_header_t
header
;
34
/**
35
* BL0 slot to boot on next reboot.
36
*/
37
uint32_t
next_bl0_slot
;
38
/**
39
* BL0 slot to set as the primary boot slot.
40
*/
41
uint32_t
primary_bl0_slot
;
42
}
boot_svc_next_boot_bl0_slot_req_t
;
43
44
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_next_boot_bl0_slot_req_t
, header, 0);
45
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_next_boot_bl0_slot_req_t
, next_bl0_slot,
46
CHIP_BOOT_SVC_MSG_HEADER_SIZE
);
47
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_next_boot_bl0_slot_req_t
, primary_bl0_slot,
48
CHIP_BOOT_SVC_MSG_HEADER_SIZE
+ 4);
49
OT_ASSERT_SIZE
(
boot_svc_next_boot_bl0_slot_req_t
, 52);
50
51
/**
52
* A Next Boot BL0 Slot response message.
53
*/
54
typedef
struct
boot_svc_next_boot_bl0_slot_res
{
55
/**
56
* Boot services message header.
57
*/
58
boot_svc_header_t
header
;
59
/**
60
* Response status from the ROM_EXT.
61
*/
62
rom_error_t
status
;
63
/**
64
* Which slot is primary.
65
*/
66
uint32_t
primary_bl0_slot
;
67
}
boot_svc_next_boot_bl0_slot_res_t
;
68
69
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_next_boot_bl0_slot_res_t
, header, 0);
70
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_next_boot_bl0_slot_res_t
,
status
,
71
CHIP_BOOT_SVC_MSG_HEADER_SIZE
);
72
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_next_boot_bl0_slot_res_t
, primary_bl0_slot,
73
CHIP_BOOT_SVC_MSG_HEADER_SIZE
+ 4);
74
OT_ASSERT_SIZE
(
boot_svc_next_boot_bl0_slot_res_t
, 52);
75
76
/**
77
* Initialize a Next Boot BL0 Slot Request message.
78
*
79
* @param primary_slot Slot to set as primary.
80
* @param next_slot Slot to boot into on reboot.
81
* @param[out] msg Output buffer for the message.
82
*/
83
void
boot_svc_next_boot_bl0_slot_req_init(
84
uint32_t primary_slot, uint32_t next_slot,
85
boot_svc_next_boot_bl0_slot_req_t
*msg);
86
87
/**
88
* Initialize a Next Boot BL0 Slot Response message.
89
*
90
* @param primary_slot Slot that is primary.
91
* @param status Reponse from the ROM_EXT after receiving the request.
92
* @param[out] msg Output buffer for the message.
93
*/
94
void
boot_svc_next_boot_bl0_slot_res_init(
95
rom_error_t
status
, uint32_t primary_slot,
96
boot_svc_next_boot_bl0_slot_res_t
*msg);
97
98
#ifdef __cplusplus
99
}
// extern "C"
100
#endif
// __cplusplus
101
102
#endif
// OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_BOOT_SVC_BOOT_SVC_NEXT_BOOT_BL0_SLOT_H_
Return to
OpenTitan Documentation