xref: /rk3399_ARM-atf/plat/ti/k3low/common/drivers/firewall/firewall.h (revision e6c3260a923ec2107894bae056cca7c9043d8a67)
1 /*
2  * Copyright (c) 2026, Texas Instruments Inc. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef FIREWALL_H
8 #define FIREWALL_H
9 
10 #include <stdint.h>
11 
12 #include <lib/utils_def.h>
13 
14 #define TFA_HOST_ID		10U
15 #define A53_PRIV_ID		4U
16 #define FW_BACKGROUND_BIT	BIT(8U)
17 
18 /* Firewall IDs */
19 #define DDR_FWL_ID		1U
20 #define OSPI_FWL_ID		97U
21 #define ADC_MCASP_FWL_ID	160U
22 
23 /* Firewall Regions to configure */
24 #define DDR_BG_FWL_REGION	0U
25 #define OSPI_FWL_REGION		0U
26 #define ADC_MCASP_FWL_REGION	0U
27 
28 /* Firewall Control Register Values */
29 #define FWL_CTRL_EN		0xA
30 #define FWL_CTRL_EN_BG		(FWL_CTRL_EN | FW_BACKGROUND_BIT)
31 
32 /* Firewall permission values */
33 #define FWL_PERM_ALL_RW		0xC3BBBB /* RW access to ALL hosts */
34 
35 struct fwl_data {
36 	uint16_t fwl_id;
37 	uint8_t region;
38 };
39 
40 /*
41  * ROM configures some firewalls initially for its use. Re-configure these
42  * firewalls with a permissive configuration so that other users can access
43  * these regions after boot.
44  *
45  * Additionally, configure a permissive background firewall over the DDR
46  */
47 void update_fwl_configs(void);
48 
49 #endif /* FIREWALL_H */
50