Software APIs
boot_svc_enter_rescue.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_ENTER_RESCUE_H_
6#define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_BOOT_SVC_BOOT_SVC_ENTER_RESCUE_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 /** Enter rescue request: `ERSQ`. */
20 kBootSvcEnterRescueReqType = 0x51535245,
21 /** Enter rescue response: `QSRE`. */
22 kBootSvcEnterRescueResType = 0x45525351,
23};
24
25/**
26 * An Enter Rescue request.
27 */
29 /**
30 * Boot services message header.
31 */
32 boot_svc_header_t header;
33 /**
34 * Command rescue to ignore the rescue trigger one time.
35 */
36 uint32_t skip_once;
37} boot_svc_enter_rescue_req_t;
38
39OT_ASSERT_MEMBER_OFFSET(boot_svc_enter_rescue_req_t, header, 0);
40OT_ASSERT_MEMBER_OFFSET(boot_svc_enter_rescue_req_t, skip_once,
42OT_ASSERT_SIZE(boot_svc_enter_rescue_req_t, CHIP_BOOT_SVC_MSG_HEADER_SIZE + 4);
43
44/**
45 * An Enter Rescue response.
46 */
48 /**
49 * Boot services message header.
50 */
51 boot_svc_header_t header;
52 /**
53 * Response status from the ROM_EXT.
54 */
55 uint32_t status;
56} boot_svc_enter_rescue_res_t;
57
58OT_ASSERT_MEMBER_OFFSET(boot_svc_enter_rescue_res_t, header, 0);
59OT_ASSERT_MEMBER_OFFSET(boot_svc_enter_rescue_res_t, status,
61OT_ASSERT_SIZE(boot_svc_enter_rescue_res_t, 48);
62
63/**
64 * Initialize an enter rescue request.
65 *
66 * @param skip_once Ignore the rescue trigger on the next boot.
67 * @param[out] msg Output buffer for the message.
68 */
69void boot_svc_enter_rescue_req_init(uint32_t skip_once,
70 boot_svc_enter_rescue_req_t *msg);
71
72/**
73 * Initialize an enter rescue response.
74 *
75 * @param status Reponse from the ROM_EXT after receiving the request.
76 * @param[out] msg Output buffer for the message.
77 */
78void boot_svc_enter_rescue_res_init(rom_error_t status,
79 boot_svc_enter_rescue_res_t *msg);
80
81#ifdef __cplusplus
82} // extern "C"
83#endif // __cplusplus
84
85#endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_BOOT_SVC_BOOT_SVC_ENTER_RESCUE_H_