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