Software APIs
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 
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  */
30  /**
31  * Boot services message header.
32  */
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;
43 
50 
51 /**
52  * A Next Boot BL0 Slot response message.
53  */
55  /**
56  * Boot services message header.
57  */
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;
68 
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,
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,
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_