summaryrefslogtreecommitdiff
path: root/include/fs_loader.h
AgeCommit message (Collapse)Author
2025-10-09fw_loader: Split from fs_loader into separate library fileMarek Vasut
The script based firmware loader does not use anything from the fs_loader implementation. Separate it into its own library source file and convert the mediatek PHY to use this separate code. This should reduce the amount of code that is pulled in alongside the firmware loader, as the FS loader is no longer included. Signed-off-by: Marek Vasut <[email protected]>
2025-10-07misc: fs_loader: Use buffer pointer in request_firmware_into_buf_via_script()Marek Vasut
Use plain buffer pointer in request_firmware_into_buf_via_script() instead of a pointer to pointer. The later is not necessary as the request_firmware_into_buf_via_script() does not modify the buffer pointer. Update the mediatek driver to match. Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Weijie Gao <[email protected]>
2025-09-18misc: fs_loader: allow returning actual firmware data size in ↵Weijie Gao
request_firmware_into_buf_via_script() It's important to return the actual firmware data size as some firmware files may have no checksum and need the size as the only way for firmware validation check. Signed-off-by: Weijie Gao <[email protected]>
2025-08-26misc: fs_loader: Add request_firmware_into_buf_via_script() for flexible ↵Lucien.Jheng
firmware loading via U-Boot script This commit introduces a new API, request_firmware_into_buf_via_script(), to the fs_loader framework. This function allows firmware to be loaded into memory using a user-defined U-Boot script, providing greater flexibility for firmware loading scenarios that cannot be handled by static file paths or device/partition selection alone. Key features: - The API runs a specified U-Boot script (by name), which is responsible for loading the firmware into memory by any means (e.g., load from MMC, USB, network, etc.). - The script must set two environment variables: 'fw_addr' (the memory address where the firmware is loaded) and 'fw_size' (the size of the firmware in bytes). - The function validates these variables, copies the firmware into a newly allocated buffer (using memdup), and returns the pointer via the provided double pointer argument. - The maximum allowed firmware size is checked to prevent buffer overflows. - The environment variables are cleared after use to avoid stale data. - Detailed error messages are provided for all failure conditions to aid debugging. Usage example: 1. Define a U-Boot script in the environment that loads the firmware and sets the required variables: => env set my_fw_script 'load mmc 0:1 ${loadaddr} firmware.bin && env set fw_addr ${loadaddr} && env set fw_size ${filesize}' 2. In your code, call the new API: void *fw_buf = NULL; int ret = request_firmware_into_buf_via_script(&fw_buf, 0x46000000, "my_fw_script"); if (ret < 0) return ret; This approach allows board integrators and users to customize the firmware loading process without modifying the source code, simply by changing the script in the U-Boot environment. Signed-off-by: Lucien.Jheng <[email protected]> Reviewed-by: Marek Vasut <[email protected]> [trini: Fix printf of size_t needing to use %zx] Signed-off-by: Tom Rini <[email protected]>
2023-01-12misc: fs_loader: Add function to get the chosen loaderSean Anderson
The fs_loader device is used to pull in settings via the chosen node. However, there was no library function for this, so arria10 was doing it explicitly. This function subsumes that, and uses ofnode_get_chosen_node instead of navigating the device tree directly. Because fs_loader pulls its config from the environment by default, it's fine to create a device with nothing backing it at all. Doing this allows enabling CONFIG_FS_LOADER without needing to modify the device tree. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2020-12-13dm: treewide: Rename ..._platdata variables to just ..._platSimon Glass
Try to maintain some consistency between these variables by using _plat as a suffix for them. Signed-off-by: Simon Glass <[email protected]>
2020-08-03fs: fs-loader: Drop dm.h header fileSimon Glass
This header file should not be included in other header files. Remove it and use a forward declaration instead. Signed-off-by: Simon Glass <[email protected]>
2019-01-15misc: fs_loader: Switching private data allocation to DM auto allocationTien Fong Chee
Switching private data manual allocation to driver model auto allocation so users no longer need to deallocate themself because this would be deallocated by driver model when the device is no longer required. Signed-off-by: Tien Fong Chee <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2018-09-28common: Generic loader for file systemTien Fong Chee
This is file system generic loader which can be used to load the file image from the storage into target such as memory. The consumer driver would then use this loader to program whatever, ie. the FPGA device. Signed-off-by: Tien Fong Chee <[email protected]>