1 /*
2  * Copyright (c) 2015 - 2020, Broadcom
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef CMN_PLAT_UTIL_H
8 #define CMN_PLAT_UTIL_H
9 
10 #include <lib/mmio.h>
11 
12 /* BOOT source */
13 #define BOOT_SOURCE_MASK	7
14 #define BOOT_SOURCE_QSPI	0
15 #define BOOT_SOURCE_NAND	1
16 #define BOOT_SOURCE_SPI_NAND	2
17 #define BOOT_SOURCE_UART	3
18 #define BOOT_SOURCE_RES4	4
19 #define BOOT_SOURCE_EMMC	5
20 #define BOOT_SOURCE_ATE		6
21 #define BOOT_SOURCE_USB		7
22 #define BOOT_SOURCE_MAX		8
23 #define BOOT_SOURCE_UNKNOWN	(-1)
24 
25 #define KHMAC_SHA256_KEY_SIZE	32
26 
27 #define SOFT_PWR_UP_RESET_L0	0
28 #define SOFT_SYS_RESET_L1	1
29 #define SOFT_RESET_L3		0x3
30 
31 #define BOOT_SOURCE_SOFT_DATA_OFFSET	8
32 #define BOOT_SOURCE_SOFT_ENABLE_OFFSET	14
33 #define BOOT_SOURCE_SOFT_ENABLE_MASK	BIT(BOOT_SOURCE_SOFT_ENABLE_OFFSET)
34 
35 typedef struct _key {
36 	uint8_t  hmac_sha256[KHMAC_SHA256_KEY_SIZE];
37 } cmn_key_t;
38 
39 uint32_t boot_source_get(void);
40 void bl1_platform_wait_events(void);
41 void plat_soft_reset(uint32_t reset);
42 
43 #endif
44