Software APIs
ast.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_DRIVERS_AST_H_
6 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_AST_H_
7 
9 #include "sw/device/silicon_creator/lib/drivers/lifecycle.h"
10 #include "sw/device/silicon_creator/lib/error.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /**
17  * Check that the AST is in the expected state.
18  *
19  * @param lc_state The current life cycle state.
20  *
21  * @return an error if the AST is not in the expected state.
22  */
24 rom_error_t ast_check(lifecycle_state_t lc_state);
25 
26 /**
27  * Reports whether the AST has been initialized and the `AST_INIT_DONE`
28  * flag is set.
29  *
30  * @return a hardened bool representing the state of `AST_INIT_DONE`.
31  */
33 hardened_bool_t ast_init_done(void);
34 
35 /**
36  * Conditionally patch the AST registers using data stored in an info partition
37  * used to store manufacturing information.
38  *
39  * The patch is skipped if any of the first to AST words stored in the info
40  * partition are equivalent to 0 or UINT32_MAX.
41  *
42  * This function also calls `ast_check()` before returning.
43  *
44  * @param lc_state The current life cycle state.
45  *
46  * @return an error if the AST is not in the expected state.
47  */
49 rom_error_t ast_patch(lifecycle_state_t lc_state);
50 
51 #ifdef __cplusplus
52 }
53 #endif
54 
55 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_AST_H_