Software APIs
imm_section_epmp.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_ROM_EXT_IMM_SECTION_IMM_SECTION_EPMP_H_
6 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_EXT_IMM_SECTION_IMM_SECTION_EPMP_H_
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include "sw/device/silicon_creator/lib/error.h"
13 #include "sw/device/silicon_creator/lib/manifest.h"
14 
15 /**
16  * Reconfigure ePMP entries to lower priority.
17  *
18  * ePMP will be reconfigured to:
19  * 0: ROM ----- ----
20  * 1: ROM TOR LX-R
21  * 2: ROM NAPOT L--R
22  * 3: ------- ----- ----
23  * 4: ------- ----- ----
24  * 5: ------- ----- ----
25  * 6: IM_EXT ----- ----
26  * 7: IM_EXT TOR LX-R
27  * 8:[MU_EXT ----- ----]
28  * 9:[MU_EXT TOR LX-R]
29  * 10: VIRTUAL NAPOT L--R
30  * 11: STACK NA4 L---
31  * 12: RvDM NAPOT LXWR
32  * 13: FLASH NAPOT L--R
33  * 14: MMIO NAPOT L-WR
34  * 15: RAM NAPOT L-WR
35  *
36  * Mutable ROM_EXT segment (8 & 9) won't be configured by this function.
37  * `imm_section_epmp_mutable_rx` will configure them when we are ready to
38  * jump back to ROM.
39  *
40  * Entries 6~12 can be recycled in Owner SW stage.
41  *
42  * @return The result of the operation.
43  */
45 rom_error_t imm_section_epmp_reconfigure(void);
46 
47 /**
48  * Configure the Mutable ROM_EXT text segment with read-execute permissions.
49  *
50  * 8: MU_EXT ----- ----
51  * 9: MU_EXT TOR LX-R
52  *
53  * Note: When address translation is enabled, the manifest argument should
54  * point to the one in the virtual space.
55  *
56  * @param manifest Pointer to the rom_ext manifest.
57  * @return The result of the operation.
58  */
60 rom_error_t imm_section_epmp_mutable_rx(const manifest_t *manifest);
61 
62 #ifdef __cplusplus
63 } // extern "C"
64 #endif
65 
66 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_EXT_IMM_SECTION_IMM_SECTION_EPMP_H_