| 1 |
/* |
| 2 |
* Copyright (c) 2023, Arm Limited. All rights reserved. |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: BSD-3-Clause |
| 5 |
*/ |
| 6 |
|
| 7 |
#include <stdbool.h> |
| 8 |
#include <stdint.h> |
| 9 |
|
| 10 |
/* |
| 11 |
* Big FW binary structure. |
| 12 |
* Must be kept in sync with the Arm(R) Ethos(TM)-N NPU firmware binary layout. |
| 13 |
*/ |
| 14 |
struct ethosn_big_fw { |
| 15 |
uint32_t fw_magic; |
| 16 |
uint32_t fw_ver_major; |
| 17 |
uint32_t fw_ver_minor; |
| 18 |
uint32_t fw_ver_patch; |
| 19 |
uint32_t arch_min; |
| 20 |
uint32_t arch_max; |
| 21 |
uint32_t offset; |
| 22 |
uint32_t size; |
| 23 |
uint32_t code_offset; |
| 24 |
uint32_t code_size; |
| 25 |
uint32_t ple_offset; |
| 26 |
uint32_t ple_size; |
| 27 |
uint32_t vector_table_offset; |
| 28 |
uint32_t vector_table_size; |
| 29 |
uint32_t unpriv_stack_offset; |
| 30 |
uint32_t unpriv_stack_size; |
| 31 |
uint32_t priv_stack_offset; |
| 32 |
uint32_t priv_stack_size; |
| 33 |
} __packed; |
| 34 |
|
| 35 |
bool ethosn_big_fw_verify_header(const struct ethosn_big_fw *big_fw, |
| 36 |
uint32_t npu_arch_ver); |