Resend to fix address error in CC box

On 05/23/2016 04:48 AM, Zhiqiang Hou wrote:
> From: Hou Zhiqiang <zhiqiang....@nxp.com>
> 
> The FSL Primary Protected Application (PPA) is a software component
> loaded during boot which runs in TrustZone and remains resident
> after boot.
> 
> Signed-off-by: Hou Zhiqiang <zhiqiag....@nxp.com>
> ---
> V4:
>  - Moved secure firmware validation API to this patch.
>  - Moved secure firmware getting supported PSCI version API to this patch.
> 
> V3:
>  - Refactor the code.
>  - Add PPA firmware version info output.
> 
<snip>

> +int sec_firmware_validate(void)
> +{
> +     void *ppa_addr;
> +
> +#ifdef CONFIG_SYS_LS_PPA_FW_IN_NOR
> +     ppa_addr = (void *)CONFIG_SYS_LS_PPA_FW_ADDR;
> +#else
> +#error "No CONFIG_SYS_LS_PPA_FW_IN_xxx defined"
> +#endif
> +
> +     return ppa_firmware_validate(ppa_addr);
> +}

You are returning 0 when the image is valid. This function name is confusing.
How about declare it as bool, and change the name to is_sec_firmware_valid()?

> +
> +#ifdef CONFIG_ARMV8_PSCI
> +unsigned int sec_firmware_support_psci_version(void)
> +{
> +     unsigned int psci_ver = 0;
> +
> +     if (!sec_firmware_validate())
> +             psci_ver = ppa_support_psci_version();
> +
> +     return psci_ver;
> +}
> +#endif
> +
> +int ppa_init_pre(u64 *entry)
> +{
> +     u64 ppa_ram_addr;
> +     const void *raw_image_addr;
> +     size_t raw_image_size = 0;
> +     size_t ppa_ram_size = ppa_get_dram_block_size();
> +     int ret;
> +
> +     debug("fsl-ppa: ppa size(0x%lx)\n", ppa_ram_size);
> +
> +     /*
> +      * The PPA must be stored in secure memory.
> +      * Append PPA to secure mmu table.
> +      */
> +     ppa_ram_addr = (gd->secure_ram & MEM_RESERVE_SECURE_ADDR_MASK) +
> +                     gd->arch.tlb_size;
> +

Should we check "if (gd->secure_ram & MEM_RESERVE_SECURE_SECURED)" before using
the secure memory?

York
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to