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} boot_svc_enter_rescue_req_t;
34
35OT_ASSERT_MEMBER_OFFSET(boot_svc_enter_rescue_req_t, header, 0);
36OT_ASSERT_SIZE(boot_svc_enter_rescue_req_t, CHIP_BOOT_SVC_MSG_HEADER_SIZE);
37
38/**
39 * An Enter Rescue response.
40 */
42 /**
43 * Boot services message header.
44 */
45 boot_svc_header_t header;
46 /**
47 * Response status from the ROM_EXT.
48 */
49 uint32_t status;
50} boot_svc_enter_rescue_res_t;
51
52OT_ASSERT_MEMBER_OFFSET(boot_svc_enter_rescue_res_t, header, 0);
53OT_ASSERT_MEMBER_OFFSET(boot_svc_enter_rescue_res_t, status,
55OT_ASSERT_SIZE(boot_svc_enter_rescue_res_t, 48);
56
57/**
58 * Initialize an enter rescue request.
59 *
60 * @param[out] msg Output buffer for the message.
61 */
62void boot_svc_enter_rescue_req_init(boot_svc_enter_rescue_req_t *msg);
63
64/**
65 * Initialize an enter rescue response.
66 *
67 * @param status Reponse from the ROM_EXT after receiving the request.
68 * @param[out] msg Output buffer for the message.
69 */
70void boot_svc_enter_rescue_res_init(rom_error_t status,
71 boot_svc_enter_rescue_res_t *msg);
72
73#ifdef __cplusplus
74} // extern "C"
75#endif // __cplusplus
76
77#endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_BOOT_SVC_BOOT_SVC_ENTER_RESCUE_H_