Software APIs
boot_svc_test_lib.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_E2E_BOOT_SVC_BOOT_SVC_TEST_LIB_H_
6 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_EXT_E2E_BOOT_SVC_BOOT_SVC_TEST_LIB_H_
7 #include "sw/device/lib/base/status.h"
8 #include "sw/device/silicon_creator/lib/drivers/retention_sram.h"
9 
10 typedef enum boot_svc_test {
11  kBootSvcTestEmpty = 1,
12  kBootSvcTestNextBl0 = 2,
13  kBootSvcTestBadNextBl0 = 3,
14  kBootSvcTestBl0MinSecVer = 4,
15  kBootSvcTestWakeup = 5,
16  kBootSvcTestPrimaryBl0 = 6,
17 } boot_svc_test_t;
18 
19 typedef enum boot_svc_test_state {
20  kBootSvcTestStateInit = 0,
21  kBootSvcTestStateCheckEmpty,
22  kBootSvcTestStateNextSideB,
23  kBootSvcTestStateReturnSideA,
24  kBootSvcTestStateMinSecAdvance,
25  kBootSvcTestStateMinSecTooFar,
26  kBootSvcTestStateMinSecGoBack,
27  kBootSvcTestStateFinal,
28 } boot_svc_test_state_t;
29 
30 typedef struct boot_svc_retram {
31  // Which boot service test is running.
32  boot_svc_test_t test;
33  // The state of the test.
34  boot_svc_test_state_t state;
35  // The number of boots the test has performed.
36  int boots;
37  // The side we're currently booted to.
38  char current_side;
39  // The primary side.
40  char primary_side;
41  // The owner partition that was booted on each boot.
42  char partition[10];
44 
45 status_t boot_svc_test_init(retention_sram_t *retram, boot_svc_test_t test);
46 
47 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_EXT_E2E_BOOT_SVC_BOOT_SVC_TEST_LIB_H_