arm-trusted-firmware/drivers/arm/ethosn/ethosn_big_fw.h
Mikael Olsson 313b776f85 feat(ethos-n): add NPU firmware validation
When the Arm(R) Ethos(TM)-N NPU driver is built with TZMP1 support, it
will now validate the NPU firmware binary that BL2 is expected to load
into the protected memory location specified by
ARM_ETHOSN_NPU_IMAGE_BASE.

Juno has been updated with a new BL31 memory mapping to allow the SiP
service to read the protected memory that contains the NPU firmware
binary.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I633256ab7dd4f8f5a6f864c8c98a66bf9dfc37f3
2023-04-04 11:37:12 +02:00

36 lines
828 B
C

/*
* Copyright (c) 2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <stdbool.h>
#include <stdint.h>
/*
* Big FW binary structure.
* Must be kept in sync with the Arm(R) Ethos(TM)-N NPU firmware binary layout.
*/
struct ethosn_big_fw {
uint32_t fw_magic;
uint32_t fw_ver_major;
uint32_t fw_ver_minor;
uint32_t fw_ver_patch;
uint32_t arch_min;
uint32_t arch_max;
uint32_t offset;
uint32_t size;
uint32_t code_offset;
uint32_t code_size;
uint32_t ple_offset;
uint32_t ple_size;
uint32_t vector_table_offset;
uint32_t vector_table_size;
uint32_t unpriv_stack_offset;
uint32_t unpriv_stack_size;
uint32_t priv_stack_offset;
uint32_t priv_stack_size;
} __packed;
bool ethosn_big_fw_verify_header(const struct ethosn_big_fw *big_fw,
uint32_t npu_arch_ver);