Software APIs
rom_ext_boot_policy_ptrs.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_ROM_EXT_BOOT_POLICY_PTRS_H_
6 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_EXT_ROM_EXT_BOOT_POLICY_PTRS_H_
7 
10 #include "sw/device/silicon_creator/lib/manifest.h"
11 
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif // __cplusplus
17 
18 static_assert((TOP_EARLGREY_EFLASH_SIZE_BYTES % 2) == 0,
19  "Flash size is not divisible by 2");
20 
21 #ifdef OT_PLATFORM_RV32
22 /**
23  * Returns a pointer to the manifest of the first owner boot stage image stored
24  * in flash slot A.
25  *
26  * @return Pointer to the manifest of the first owner boot stage image in slot
27  * A.
28  */
30 inline const manifest_t *rom_ext_boot_policy_manifest_a_get(void) {
31  return (const manifest_t *)(TOP_EARLGREY_EFLASH_BASE_ADDR +
32  CHIP_ROM_EXT_SIZE_MAX);
33 }
34 
35 /**
36  * Returns a pointer to the manifest of the first owner boot stage image stored
37  * in flash slot B.
38  *
39  * @return Pointer to the manifest of the first owner boot stage image in slot
40  * B.
41  */
43 inline const manifest_t *rom_ext_boot_policy_manifest_b_get(void) {
44  return (const manifest_t *)(TOP_EARLGREY_EFLASH_BASE_ADDR +
46  CHIP_ROM_EXT_SIZE_MAX);
47 }
48 #else
49 /**
50  * Declarations for the functions above that should be defined in tests.
51  */
52 const manifest_t *rom_ext_boot_policy_manifest_a_get(void);
53 const manifest_t *rom_ext_boot_policy_manifest_b_get(void);
54 #endif
55 
56 #ifdef __cplusplus
57 } // extern "C"
58 #endif // __cplusplus
59 
60 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_EXT_ROM_EXT_BOOT_POLICY_PTRS_H_