162306a36Sopenharmony_ci/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license.  When using or
462306a36Sopenharmony_ci * redistributing this file, you may do so under either license.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Copyright(c) 2022 Intel Corporation. All rights reserved.
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/*
1062306a36Sopenharmony_ci * Extended manifest is a place to store metadata about firmware, known during
1162306a36Sopenharmony_ci * compilation time - for example firmware version or used compiler.
1262306a36Sopenharmony_ci * Given information are read on host side before firmware startup.
1362306a36Sopenharmony_ci * This part of output binary is not signed.
1462306a36Sopenharmony_ci */
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#ifndef __SOF_FIRMWARE_EXT_MANIFEST4_H__
1762306a36Sopenharmony_ci#define __SOF_FIRMWARE_EXT_MANIFEST4_H__
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#include <linux/uuid.h>
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/* In ASCII  $AE1 */
2262306a36Sopenharmony_ci#define SOF_EXT_MAN4_MAGIC_NUMBER	0x31454124
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#define MAX_MODULE_NAME_LEN		8
2562306a36Sopenharmony_ci#define MAX_FW_BINARY_NAME		8
2662306a36Sopenharmony_ci#define DEFAULT_HASH_SHA256_LEN		32
2762306a36Sopenharmony_ci#define SOF_MAN4_FW_HDR_OFFSET		0x2000
2862306a36Sopenharmony_ci#define SOF_MAN4_FW_HDR_OFFSET_CAVS_1_5	0x284
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci/*********************************************************************
3162306a36Sopenharmony_ci *	extended manifest		(struct sof_ext_manifest4_hdr)
3262306a36Sopenharmony_ci *-------------------
3362306a36Sopenharmony_ci *	css_manifest hdr
3462306a36Sopenharmony_ci *-------------------
3562306a36Sopenharmony_ci *	offset reserved for future
3662306a36Sopenharmony_ci *-------------------
3762306a36Sopenharmony_ci *	fw_hdr				(struct sof_man4_fw_binary_header)
3862306a36Sopenharmony_ci *-------------------
3962306a36Sopenharmony_ci *	module_entry[0]			(struct sof_man4_module)
4062306a36Sopenharmony_ci *-------------------
4162306a36Sopenharmony_ci *	module_entry[1]
4262306a36Sopenharmony_ci *-------------------
4362306a36Sopenharmony_ci *	...
4462306a36Sopenharmony_ci *-------------------
4562306a36Sopenharmony_ci *	module_entry[n]
4662306a36Sopenharmony_ci *-------------------
4762306a36Sopenharmony_ci *	module_config[0]		(struct sof_man4_module_config)
4862306a36Sopenharmony_ci *-------------------
4962306a36Sopenharmony_ci *	module_config[1]
5062306a36Sopenharmony_ci *-------------------
5162306a36Sopenharmony_ci *	...
5262306a36Sopenharmony_ci *-------------------
5362306a36Sopenharmony_ci *	module_config[m]
5462306a36Sopenharmony_ci *-------------------
5562306a36Sopenharmony_ci *	FW content
5662306a36Sopenharmony_ci *-------------------
5762306a36Sopenharmony_ci *********************************************************************/
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_cistruct sof_ext_manifest4_hdr {
6062306a36Sopenharmony_ci	uint32_t id;
6162306a36Sopenharmony_ci	uint32_t len; /* length of extension manifest */
6262306a36Sopenharmony_ci	uint16_t version_major; /* header version */
6362306a36Sopenharmony_ci	uint16_t version_minor;
6462306a36Sopenharmony_ci	uint32_t num_module_entries;
6562306a36Sopenharmony_ci} __packed;
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_cistruct sof_man4_fw_binary_header {
6862306a36Sopenharmony_ci	/* This part must be unchanged to be backward compatible with SPT-LP ROM */
6962306a36Sopenharmony_ci	uint32_t id;
7062306a36Sopenharmony_ci	uint32_t len; /* sizeof(sof_man4_fw_binary_header) in bytes */
7162306a36Sopenharmony_ci	uint8_t name[MAX_FW_BINARY_NAME];
7262306a36Sopenharmony_ci	uint32_t preload_page_count; /* number of pages of preloaded image */
7362306a36Sopenharmony_ci	uint32_t fw_image_flags;
7462306a36Sopenharmony_ci	uint32_t feature_mask;
7562306a36Sopenharmony_ci	uint16_t major_version; /* Firmware version */
7662306a36Sopenharmony_ci	uint16_t minor_version;
7762306a36Sopenharmony_ci	uint16_t hotfix_version;
7862306a36Sopenharmony_ci	uint16_t build_version;
7962306a36Sopenharmony_ci	uint32_t num_module_entries;
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci	/* This part may change to contain any additional data for BaseFw that is skipped by ROM */
8262306a36Sopenharmony_ci	uint32_t hw_buf_base_addr;
8362306a36Sopenharmony_ci	uint32_t hw_buf_length;
8462306a36Sopenharmony_ci	uint32_t load_offset; /* This value is used by ROM */
8562306a36Sopenharmony_ci} __packed;
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_cistruct sof_man4_segment_desc {
8862306a36Sopenharmony_ci	uint32_t flags;
8962306a36Sopenharmony_ci	uint32_t v_base_addr;
9062306a36Sopenharmony_ci	uint32_t file_offset;
9162306a36Sopenharmony_ci} __packed;
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_cistruct sof_man4_module {
9462306a36Sopenharmony_ci	uint32_t id;
9562306a36Sopenharmony_ci	uint8_t name[MAX_MODULE_NAME_LEN];
9662306a36Sopenharmony_ci	guid_t uuid;
9762306a36Sopenharmony_ci	uint32_t type;
9862306a36Sopenharmony_ci	uint8_t hash[DEFAULT_HASH_SHA256_LEN];
9962306a36Sopenharmony_ci	uint32_t entry_point;
10062306a36Sopenharmony_ci	uint16_t cfg_offset;
10162306a36Sopenharmony_ci	uint16_t cfg_count;
10262306a36Sopenharmony_ci	uint32_t affinity_mask;
10362306a36Sopenharmony_ci	uint16_t instance_max_count;
10462306a36Sopenharmony_ci	uint16_t instance_stack_size;
10562306a36Sopenharmony_ci	struct sof_man4_segment_desc	segments[3];
10662306a36Sopenharmony_ci} __packed;
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_cistruct sof_man4_module_config {
10962306a36Sopenharmony_ci	uint32_t par[4];	/* module parameters */
11062306a36Sopenharmony_ci	uint32_t is_bytes;	/* actual size of instance .bss (bytes) */
11162306a36Sopenharmony_ci	uint32_t cps;		/* cycles per second */
11262306a36Sopenharmony_ci	uint32_t ibs;		/* input buffer size (bytes) */
11362306a36Sopenharmony_ci	uint32_t obs;		/* output buffer size (bytes) */
11462306a36Sopenharmony_ci	uint32_t module_flags;	/* flags, reserved for future use */
11562306a36Sopenharmony_ci	uint32_t cpc;		/* cycles per single run */
11662306a36Sopenharmony_ci	uint32_t obls;		/* output block size, reserved for future use */
11762306a36Sopenharmony_ci} __packed;
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci#endif /* __SOF_FIRMWARE_EXT_MANIFEST4_H__ */
120