Stop printing the obscure warning about path being too long when the
firmware path isn't set in sysfs.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Swap arguments to concat_path, passing "/lib/firmware" into the first
argument and keeping the second one (firmware-path from remoteproc).
Fixes: 4946411bbb ("Use firmware load path from sysfs")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Stop using sizeof(char*) to get the size of the buffer. Instead pass
down the correct length. Also removing the hidden knowledge of the
buffer being PATH_LEN bytes.
Fixes: 4946411bbb ("Use firmware load path from sysfs")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Some distributions override firmware loading path
using /sys/module/firmware_class/parameters/path.
Kernel supports it, teach pd-mapper to support it too.
Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Co-authored-by: Alexey Minnekhanov <alexeymin@postmarketos.org>
Many distros and ship Linux firmware in compressed form.
In the case of fedora that is .xz format, so lets add the
ability for pd-mapper to understand LZMA compressed JSON files.
Signed-off-by: Jeremy Linton <lintonrjeremy@gmail.com>
pd-mapper will fail to start due to a SIGSEGV when any of the firmware
for the various remoteprocs are not present. ltrace isolated where the
problem was:
....
strlen("qcom/sc8280xp/LENOVO/21BX/qcadsp"...) = 41
dirname(0xfffff9b66450, 0xfffff9b683b0, 36, 0xfffffff) = 0xfffff9b66450
strcat("/lib/firmware/", "qcom/sc8280xp/LENOVO/21BX") = "/lib/firmware/qcom/sc8280xp/LENO"...
opendir("/lib/firmware/qcom/sc8280xp/LENO"...) = nil
readdir(nil <no return ...>
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++
With this fix, pd-mapper now displays the following messages when the
firmware is not present:
pd-mapper: Cannot open /lib/firmware/qcom/sc8280xp/LENOVO/21BX: No such file or directory
pd-mapper: Cannot open /lib/firmware/qcom/sc8280xp/LENOVO/21BX: No such file or directory
no pd maps available
Signed-off-by: Brian Masney <bmasney@redhat.com>
Null terminate firmware_value string to prevent
strlen() read past the end of buffer error on AOSP.
Otherwise pd-mapper will crash:
console:/ # pd-mapper
FORTIFY: strlen: detected read past end of buffer
Aborted
134|console:/ #
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Fixes
pd-mapper.c:199:22: error: 'PATH_MAX' undeclared (first use in this function); did you mean 'AF_MAX'?
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Traverse the remoteproc class and use the firmware location for each one
to search for json files and load these.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>