13 Commits

Author SHA1 Message Date
Dmitry Baryshkov
fbace0b23e Handle "path not set in sysfs" without extra warnings
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>
2025-12-30 07:47:45 +02:00
Dmitry Baryshkov
8ce2895666 Use correct paths when firmware path isn't set in sysfs
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>
2025-12-30 07:43:43 +02:00
Dmitry Baryshkov
5f7a33d8ed Pass down the length of the buffer when calculating firmware paths
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>
2025-12-30 07:43:21 +02:00
Dzmitry Sankouski
4946411bbb Use firmware load path from sysfs
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>
2025-05-06 19:43:10 +03:00
Jeremy Linton
10997ba7c4 pd-mapper: Add ability to decompress .xz json files
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>
2023-09-01 09:55:20 -05:00
Amit Pundir
352a39cd0c ANDROID: pd-mapper: Use /vendor/firmware path for AOSP
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
2023-01-17 22:59:13 -06:00
Brian Masney
b4c1e362f1 correct SIGSEGV when firmware is not present
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>
2023-01-17 22:58:43 -06:00
Amit Pundir
9d78fc0c61 pd-mapper: Null terminate firmware_value string
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>
2022-02-08 10:14:15 -08:00
Khem Raj
d7fe25fa6e pd-mapper: Include limits.h for PATH_MAX
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>
2020-10-22 16:03:40 -07:00
Bjorn Andersson
ab5074fdd5 pd-mapper: Use remoteproc firmware to find jsons
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>
2020-03-14 22:35:16 -07:00
Bjorn Andersson
1048a84703 pd-mapper: Load JSON files
Load mappings from JSON files instead of hard coding only the WLAN.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-03-14 22:35:16 -07:00
opendata26
79ac237b42 use pd_map for name checking
pd_maps is always the same,  pd_map however is incremented

signed-off-by Craig Tatlor <ctatlor97@gmail.com>
2018-09-25 13:44:21 -07:00
Bjorn Andersson
a427ad436e pd-mapper: Initial implementation
This implements the minimum scope of pd-mapper in order to trigger
loading of wlan firmware on SDM845.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-06-29 15:50:04 -07:00