Software APIs
manifest.c
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 #include "sw/device/silicon_creator/lib/manifest.h"
6 
8 
9 #if defined(OPENTITAN_IS_ENGLISHBREAKFAST)
10 #include "hw/top_englishbreakfast/sw/autogen/top_englishbreakfast.h"
11 #define EFLASH_SIZE_BYES TOP_ENGLISHBREAKFAST_EFLASH_SIZE_BYTES
12 #elif defined(OPENTITAN_IS_EARLGREY)
14 #define EFLASH_SIZE_BYES TOP_EARLGREY_EFLASH_SIZE_BYTES
15 #elif defined(OPENTITAN_IS_DARJEELING)
16 #include "hw/top_darjeeling/sw/autogen/top_darjeeling.h"
17 #define EFLASH_SIZE_BYES TOP_DARJEELING_RAM_MAIN_SIZE_BYTES
18 #else
19 #error unsupported top
20 #endif
21 
23  "`CHIP_ROM_EXT_SIZE_MIN` is too small");
24 static_assert(CHIP_ROM_EXT_SIZE_MAX >= CHIP_ROM_EXT_SIZE_MIN,
25  "`CHIP_ROM_EXT_SIZE_MAX` is too small");
26 static_assert(CHIP_ROM_EXT_RESIZABLE_SIZE_MAX >= CHIP_ROM_EXT_SIZE_MAX,
27  "`CHIP_ROM_EXT_RESIZABLE_SIZE_MAX` is too small");
28 static_assert(CHIP_BL0_SIZE_MIN >= CHIP_MANIFEST_SIZE,
29  "`CHIP_BL0_SIZE_MIN` is too small");
30 static_assert(CHIP_BL0_SIZE_MAX >= CHIP_BL0_SIZE_MIN,
31  "`CHIP_BL0_SIZE_MAX` is too small");
32 static_assert(CHIP_BL0_SIZE_MAX <=
33  ((EFLASH_SIZE_BYES / 2) - CHIP_ROM_EXT_SIZE_MAX),
34  "`CHIP_BL0_SIZE_MAX` is too large");
35 
36 // Extern declarations for the inline functions in the manifest header.
37 extern rom_error_t manifest_check(const manifest_t *manifest);
38 extern manifest_digest_region_t manifest_digest_region_get(
39  const manifest_t *manifest);
40 extern epmp_region_t manifest_code_region_get(const manifest_t *manifest);
41 extern uintptr_t manifest_entry_point_get(const manifest_t *manifest);
42 extern rom_error_t manifest_ext_get_spx_key(
43  const manifest_t *manifest, const manifest_ext_spx_key_t **spx_key);
44 extern rom_error_t manifest_ext_get_spx_signature(
45  const manifest_t *manifest,
46  const manifest_ext_spx_signature_t **spx_signature);