#ifndef __ELF_FILE_LOADER_HEADER__ #define __ELF_FILE_LOADER_HEADER__ #define pr_fmt(fmt) "%s: " fmt, __func__ #include //#include //#include struct firmware { size_t size; const uint8_t *data; struct page **pages; /* firmware loader private fields */ void *priv; }; //#include /** * struct resource_table - firmware resource table header * @ver: version number * @num: number of resource entries * @reserved: reserved (must be zero) * @offset: array of offsets pointing at the various resource entries * * A resource table is essentially a list of system resources required * by the remote processor. It may also include configuration entries. * If needed, the remote processor firmware should contain this table * as a dedicated ".resource_table" ELF section. * * Some resources entries are mere announcements, where the host is informed * of specific remoteproc configuration. Other entries require the host to * do something (e.g. allocate a system resource). Sometimes a negotiation * is expected, where the firmware requests a resource, and once allocated, * the host should provide back its details (e.g. address of an allocated * memory region). * * The header of the resource table, as expressed by this structure, * contains a version number (should we need to change this format in the * future), the number of available resource entries, and their offsets * in the table. * * Immediately following this header are the resource entries themselves, * each of which begins with a resource entry header (as described below). */ struct resource_table { uint32_t ver; uint32_t num; uint32_t reserved[2]; uint32_t offset[0]; };// __packed; /** * struct fw_rsc_hdr - firmware resource entry header * @type: resource type * @data: resource data * * Every resource entry begins with a 'struct fw_rsc_hdr' header providing * its @type. The content of the entry itself will immediately follow * this header, and it should be parsed according to the resource type. */ struct fw_rsc_hdr { uint32_t type; uint8_t data[0]; };// __packed; /** * enum fw_resource_type - types of resource entries * * @RSC_CARVEOUT: request for allocation of a physically contiguous * memory region. * @RSC_DEVMEM: request to iommu_map a memory-based peripheral. * @RSC_TRACE: announces the availability of a trace buffer into which * the remote processor will be writing logs. * @RSC_VDEV: declare support for a virtio device, and serve as its * virtio header. * @RSC_INTMEM: (deprecated) request to map into kernel an internal memory * region. * @RSC_CUSTOM: a custom resource type that needs to be handled outside * remoteproc core. * @RSC_LAST: just keep this one at the end * * For more details regarding a specific resource type, please see its * dedicated structure below. * * Please note that these values are used as indices to the rproc_handle_rsc * lookup table, so please keep them sane. Moreover, @RSC_LAST is used to * check the validity of an index before the lookup table is accessed, so * please update it as needed. */ enum fw_resource_type { RSC_CARVEOUT = 0, RSC_DEVMEM = 1, RSC_TRACE = 2, RSC_VDEV = 3, RSC_INTMEM = 4, RSC_CUSTOM = 5, RSC_LAST = 6, }; //#include //#include "remoteproc_internal.h" int load_elf_fw( const char *name, const struct firmware *fw ); int elf_sanity_check( const struct firmware *fw ); uint32_t elf_get_boot_addr( const struct firmware *fw ); int elf_load_segments( const struct firmware *fw ); #endif