xref: /rk3399_rockchip-uboot/arch/arm/include/asm/omap_sec_common.h (revision 03750231a84da904d6d2809a54d3147dee833f26)
1d86f7afdSAndreas Dannenberg /*
2d86f7afdSAndreas Dannenberg  * (C) Copyright 2016
3d86f7afdSAndreas Dannenberg  * Texas Instruments, <www.ti.com>
4d86f7afdSAndreas Dannenberg  *
5d86f7afdSAndreas Dannenberg  * Andreas Dannenberg <dannenberg@ti.com>
6d86f7afdSAndreas Dannenberg  *
7d86f7afdSAndreas Dannenberg  * SPDX-License-Identifier:	GPL-2.0+
8d86f7afdSAndreas Dannenberg  */
9d86f7afdSAndreas Dannenberg #ifndef	_OMAP_SEC_COMMON_H_
10d86f7afdSAndreas Dannenberg #define	_OMAP_SEC_COMMON_H_
11d86f7afdSAndreas Dannenberg 
12d86f7afdSAndreas Dannenberg #include <common.h>
13d86f7afdSAndreas Dannenberg 
14d86f7afdSAndreas Dannenberg /*
15d86f7afdSAndreas Dannenberg  * Invoke secure ROM API on high-security (HS) device variants. It formats
16d86f7afdSAndreas Dannenberg  * the variable argument list into the format expected by the ROM code before
17d86f7afdSAndreas Dannenberg  * triggering the actual low-level smc entry.
18d86f7afdSAndreas Dannenberg  */
19d86f7afdSAndreas Dannenberg u32 secure_rom_call(u32 service, u32 proc_id, u32 flag, ...);
20d86f7afdSAndreas Dannenberg 
211bb0a21bSAndreas Dannenberg /*
221bb0a21bSAndreas Dannenberg  * Invoke a secure ROM API on high-secure (HS) device variants that can be used
231bb0a21bSAndreas Dannenberg  * to verify a secure blob by authenticating and optionally decrypting it. The
241bb0a21bSAndreas Dannenberg  * exact operation performed depends on how the certificate that was embedded
251bb0a21bSAndreas Dannenberg  * into the blob during the signing/encryption step when the secure blob was
261bb0a21bSAndreas Dannenberg  * first created.
271bb0a21bSAndreas Dannenberg  */
281bb0a21bSAndreas Dannenberg int secure_boot_verify_image(void **p_image, size_t *p_size);
291bb0a21bSAndreas Dannenberg 
306d132b2bSDaniel Allred /*
31*03750231SAndrew F. Davis  * Return the start of secure reserved RAM, if a default start address has
32*03750231SAndrew F. Davis  * not been configured then return a region at the end of the external DRAM.
33*03750231SAndrew F. Davis  */
34*03750231SAndrew F. Davis u32 get_sec_mem_start(void);
35*03750231SAndrew F. Davis 
36*03750231SAndrew F. Davis /*
376d132b2bSDaniel Allred  * Invoke a secure HAL API that allows configuration of the external memory
386d132b2bSDaniel Allred  * firewall regions.
396d132b2bSDaniel Allred  */
406d132b2bSDaniel Allred int secure_emif_firewall_setup(uint8_t region_num, uint32_t start_addr,
416d132b2bSDaniel Allred 			       uint32_t size, uint32_t access_perm,
426d132b2bSDaniel Allred 			       uint32_t initiator_perm);
436d132b2bSDaniel Allred 
446d132b2bSDaniel Allred /*
456d132b2bSDaniel Allred  * Invoke a secure HAL API on high-secure (HS) device variants that reserves a
466d132b2bSDaniel Allred  * region of external memory for secure world use, and protects it using memory
476d132b2bSDaniel Allred  * firewalls that prevent public world access. This API is intended to setaside
486d132b2bSDaniel Allred  * memory that will be used for a secure world OS/TEE.
496d132b2bSDaniel Allred  */
506d132b2bSDaniel Allred int secure_emif_reserve(void);
516d132b2bSDaniel Allred 
526d132b2bSDaniel Allred /*
536d132b2bSDaniel Allred  * Invoke a secure HAL API to lock the external memory firewall configurations.
546d132b2bSDaniel Allred  * After this API is called, none of the HAL APIs for configuring the that
556d132b2bSDaniel Allred  * firewall will be usable (calls to those APIs will return failure and have
566d132b2bSDaniel Allred  * no effect).
576d132b2bSDaniel Allred  */
586d132b2bSDaniel Allred int secure_emif_firewall_lock(void);
596d132b2bSDaniel Allred 
6057de1ea5SHarinarayan Bhatta /*
6157de1ea5SHarinarayan Bhatta  * Invoke a secure HAL API to authenticate and install a Trusted Execution
6257de1ea5SHarinarayan Bhatta  * Environment (TEE) image.
6357de1ea5SHarinarayan Bhatta  */
6457de1ea5SHarinarayan Bhatta int secure_tee_install(u32 tee_image);
6557de1ea5SHarinarayan Bhatta 
66d86f7afdSAndreas Dannenberg #endif /* _OMAP_SEC_COMMON_H_ */
67