Commit Graph

296 Commits

Author SHA1 Message Date
Adrian Warecki 32a5388c10 file_utils: Add file_error function
Added a generic function that displays a file operation error message.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-03-08 14:46:46 +01:00
Adrian Warecki dd15443129 file_utils: Removed duplicated function descriptions
Functions are already described in the header file.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-03-08 14:46:46 +01:00
Przemyslaw Blaszkowski d32db50b61 mtl: add Aria module to extended manifest
Add ARIA module to MTL extended manifest.

Signed-off-by: Przemyslaw Blaszkowski <przemyslaw.blaszkowski@intel.com>
2023-03-06 13:20:34 +00:00
Chao Song 5bc201039d rimage: fix build error
Recent changes introduce build error, fix the build
error.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-03-06 13:17:21 +00:00
Rander Wang 35bc64467a mtl: add eq-iir and fir support
Port from tgl-cavs.toml

Signed-off-by: Rander Wang <rander.wang@intel.com>
2023-03-06 12:23:48 +00:00
Adrian Warecki 6fad35625f rimage: Removed hash context from image structure
Fields related to hash computing have been removed from the image
structure. Removed openssl headers from rimage.h, which made it necessary
to add some missing includes in several files.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-03-02 15:55:03 +01:00
Adrian Warecki 6c7a1512c6 hash: Remove old hash functions
Removed currently unused functions.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-03-02 15:55:03 +01:00
Adrian Warecki d258ea23fc manifest: pkcs1_5: Use new hash functions
Switched to use new hash functions. The parameter list for the rimage_sign
and rimage_verify functions has been simplified. The necessary information
is now included in the hash_context structure. In addition, code fragments
that may be common to different versions of the manifest have been
separated.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-03-02 15:55:03 +01:00
Adrian Warecki 2bd8be35d2 hash: New hash functions
Prepared a new set of functions for computing digest with error handling.
The hash context has been placed into a separate structure. This allows
to conveniently pass the calculated digest along with its length and used
algorithm.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-03-02 15:55:03 +01:00
Adrian Warecki 93c5e8b51f misc_utils: Move byte_swap function to new misc_utils.c file
This function will be used in different places in the code, so I moved it
to a separate file.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-03-02 15:55:03 +01:00
Adrian Warecki 9ce1cc8988 ext_manifest: Fix fw_ext_man_cavs_header version
The version fields in the fw_ext_man_cavs_header structure describe version
of the structure itself, not the image. The correct version number has been
set.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-03-02 07:42:43 +01:00
Adrian Warecki a4ca53c9f1 toml_utils: Adding support for decimal numbers in hex parser
Modified the strtoul function parameter to automatically recognize
the value format. This will avoid the situation when a decimal value
is parsed as hexadecimal.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-02-27 11:22:11 +01:00
Rander Wang 5ebbd6530c rimage: use hex number
Module type is interpreted as hex number

Signed-off-by: Rander Wang <rander.wang@intel.com>
2023-02-27 10:04:54 +01:00
Adrian Warecki 36c0c90769 elf: Use the get_file_size function
Simplified retrieval of file size by using the function get_file_size.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-02-27 07:23:07 +01:00
Adrian Warecki 98c7f7b567 manifest: Use the get_file_size function
Simplified retrieval of file size by using the function get_file_size.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-02-27 07:23:07 +01:00
Adrian Warecki 6a64cb9c1b file_utils: Add a new get_file_size function
The get_file_size function allows to conveniently get the size of the file.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-02-27 07:23:07 +01:00
Adrian Warecki 055ea7eca8 file_utils: manifest: ext_manifest: Add new create_file_name function
A new function create_file_name has been created that prepares the name
of the output file with the given extensions. Unlike the previous solution,
it checks whether the new name will fit in the output buffer.

A new file_utils.c file has been prepared, into which generic functions to
simplify the use of files will be moved.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-02-27 07:23:07 +01:00
Adrian Warecki fed69d453f toml_utils: adsp_config: Moved generic parser functions to toml_utils
A set of functions which make it easier to parse toml files has been
separated into a new file.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-02-24 07:29:55 +01:00
Adrian Warecki 0931d9cc4b main: heap_adsp release fix
In image re-signing mode or if there are no input files, the memory
allocated for heap_adsp was not released.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-02-23 10:43:40 +01:00
Chao Song 3aa199fb07 config: mtl: set init_config for micsel
The micsel module will use base config extension,
init_config should be one for it.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-02-16 20:57:47 +02:00
Chao Song d48ad6b67b adsp_config: add dump for init_config
This patch adds dump for init_config for debug.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-02-14 16:23:24 +00:00
Chao Song ffd0542127 adsp_config: make the default value zero for init_config
The init_config is used to indicate if base config extension is
used (1) or not (0). Its default value is used if not specified
in module config, the default value for init_config should be zero
instead of one.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-02-14 16:23:24 +00:00
Libin Yang cb9c880b6e config: tgl-cavs: add kpb, selector and kd support
Add KPB, Selector and KD module config

Signed-off-by: Libin Yang <libin.yang@intel.com>
2023-02-14 16:23:06 +00:00
Libin Yang bf23b5ea00 config: mtl: set KDTEST module_type to 8
KDTEST module_type should be 8

Signed-off-by: Libin Yang <libin.yang@intel.com>
2023-02-14 16:23:06 +00:00
Guennadi Liakhovetski 3863e94fa5 Don't convert ROM addresses to cached aliases
We don't include ROM sections into the output image. If conversion is
applied to them, they end up in the SRAM address range, which then
generates corrupted images.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-02-14 09:58:11 +02:00
Ranjani Sridharan 1e0a85b44a config:tgl/tglh: Do not set cached/uncached address aliases
tgl.toml and tgl-h.toml are only used for xtos builds.

Suggested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-02-10 19:00:14 +02:00
Guennadi Liakhovetski 9b507ecc82 config: set cached and uncached aliases for affected platforms
Set cached and uncached address aliases for all Intel ADSP platforms,
supported by Zephyr.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-02-10 15:06:15 +00:00
Guennadi Liakhovetski def9d51d7d Fix regression - make default return code an error
A recent commit ec649f37d6 ("Convert all ELF addresses to cached
for calculations") had a bug: it assumed a call to
parse_uint32_hex_key() for an absent key would return an error by
default, which isn't the case. To force it set the default return
code to an error value.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-02-10 15:06:15 +00:00
Ranjani Sridharan d48ae7aada config: mtl: Set init_config for smart amp
Smart amp needs the base config extension during module init.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-02-09 12:06:52 +00:00
Ranjani Sridharan b5d762290f config: tgl-cavs: set init_config for smart test
Smart amp needs the base config extension during init.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-02-09 12:06:52 +00:00
Ranjani Sridharan 15ea48177a src: adsp_config: Use reserved bits for module init config
Use some of the reserved bits to add a new field, init_config, in struct
sof_man_module_type. This will be used to specify the type of payload
that the module expects. For now, the 2 options are to have the base
config only or the base config with an extension that contains the pin
formats. This can be extended in the future to support additional
options for modules that need more than the base config or base config +
extension.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-02-09 12:06:52 +00:00
Guennadi Liakhovetski ec649f37d6 Convert all ELF addresses to cached for calculations
Rimage calculates sizes of ELF sections, for which it has to use
addresses from the same address space: either all cached or all
uncached. The ELF image itself can contain mixed addresses. Convert
all to cached for internal calculations.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-02-09 12:03:58 +00:00
Chao Song 7bc3cfc946 config: mtl: add smart amp test module config
This patch adds smart amp test module config for mtl.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-02-01 14:50:59 +02:00
Chao Song 3da7739b5f config: correct module config load_type
The load_type in extended manifest is used to indicate
if a module is a built-in module(0) or a loadable(1)
module.

We don't have loadable module yet, so load_type should
be zero for all modules.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-02-01 14:50:14 +02:00
Chao Song bc7d49dcfc config: align module_type with mtl for tgl and tgl-h
The module_type member in module config should be assigned
according to the mod_type enum. Previously, for tgl and tgl-h,
it is assigned in an incremental way, which is wrong. MTL assigns
module_type in the correct way, so align the module_type with
mtl for tgl and tgl-h in this patch.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-02-01 14:50:14 +02:00
Jaska Uimonen bdf48ee7e6 config: tgl-cavs: add fir and iir eq module config
This patch adds module config for fir and iir eq module.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2023-01-24 15:37:41 +00:00
Guennadi Liakhovetski ba8534bb23 Fix bitmap according to the IMR type
When the IMR type is set to 4, the default bitmap field #4 must be
0x10.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-01-04 11:07:30 +00:00
Guennadi Liakhovetski f3eef3cfb6 Fix IMR type parsing
The IMR type can be specified either in the TOML configuration file
or on the command line. The command line value should override the
one from the configuration file. But the current code overwrites the
configuration file value with the default value even if no value has
been specified on the command line, which is wrong. Fix this by using
the default value when reading the configuration file and only
overwriting it when the respective command line parameter is used.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-01-04 11:07:30 +00:00
Guennadi Liakhovetski bdba8259fe Add a command line option to set an Intel-specific PV bit
Add a '-p' command line flag to set Intel reserved bit in IMR area.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-01-04 11:07:30 +00:00
Chao Song 1c48208850 config: tgl-cavs: add smart amp test module config
This patch adds module config for smart amp test module.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-12-21 14:59:50 +00:00
Tinghan Shen 082b6261c9 config: Add mt8188.toml
Add mt8188.toml to support sof-mt8188.ri binary build.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
2022-12-15 11:48:52 +08:00
Gongjun Song 65f345a52e rimage: add src support
Add src's params to rimage

Signed-off-by: Gongjun Song <gongjun.song@intel.com>
2022-11-25 14:56:53 +00:00
Rander Wang fe5b959adb rimage: correct module type
Currently some module types are incorrect and it was set by the change
sequence. The module type is used by windows driver not Linux driver.
It is defined in the following enum definition in cavs_ext_manifest.h.

UpDwMix module type is 5, Mux is 6 kpb is 11, and Selector is 12. The
module ASRC, GAIN, PROBE are type of efx (9) according to spec.

enum mod_type {
        ebasefw = 0,
        emixin,
        emixout,
        ecopier,
        epeakvol,
        eupdwmix,
        emux,
        esrc,
        ewov,
        efx,
        eaec,
        ekpb,
        emicselect,
        efxf,   /*i.e.SmartAmp */
        eaudclass,
        efakecopier,
        eiodriver,
        ewhm,
        egdbstub,
        esensing,
        emax,
        einvalid = emax
} ;

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-11-22 16:39:04 +01:00
Rander Wang f51ff46635 rimage: remove incorrect module order check
The original check for "i - 1 == type" is used to make
sure that all modules in toml file are in order from 0
to max continuously. But the problem is that some modules
are not supported now or some modules share the same module
type of efx, so this check is incorrect.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-11-22 16:39:04 +01:00
Ievgen Ganakov 6623073ca8 config: mtl: add kpb module
Add KPB module config

Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
2022-11-08 09:25:12 +00:00
Ievgen Ganakov 85a2d1ebc9 config: mtl: add kd module
Add KD module config

Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
2022-11-08 09:25:12 +00:00
Kwasowiec, Fabiola 3ee717eebc probe: mtl.toml invaliv probe type
error: invalid type 16error: key 'module' parsing error
probe module type is 10,which is treated hexally

Signed-off-by: Kwasowiec, Fabiola <fabiola.kwasowiec@intel.com>
2022-10-13 15:26:46 +02:00
Kwasowiec, Fabiola 1f4a36e21f mux: fix module type
error: invalid type /error: key 'module' parsing error

Signed-off-by: Kwasowiec, Fabiola <fabiola.kwasowiec@intel.com>
2022-10-13 14:51:27 +02:00
Kwasowiec, Fabiola dcfd11bc4d mux: add mux cfg to list of modules
No mux in the manifest

Signed-off-by: Kwasowiec, Fabiola <fabiola.kwasowiec@intel.com>
2022-10-10 16:19:43 +02:00
Jaska Uimonen d957e0368b rimage: make ace15 signing to support openssl3
Ace signing is currently missing openssl3 support, so let's add it.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2022-09-28 12:16:15 +01:00