Lines Matching full:firmware
3 * main.c - Multi purpose firmware loading support
7 * Please see Documentation/driver-api/firmware/ for more information.
26 #include <linux/firmware.h>
43 #include "firmware.h"
47 MODULE_DESCRIPTION("Multi purpose firmware loading support");
58 * Names of firmware images which have been cached successfully
60 * helper can trace which firmware images have been cached
96 /* Builtin firmware support */
103 static void fw_copy_to_prealloc_buf(struct firmware *fw, in fw_copy_to_prealloc_buf()
111 static bool fw_get_builtin_firmware(struct firmware *fw, const char *name, in fw_get_builtin_firmware()
129 static bool fw_is_builtin_firmware(const struct firmware *fw) in fw_is_builtin_firmware()
140 #else /* Module case - no builtin firmware support */
142 static inline bool fw_get_builtin_firmware(struct firmware *fw, in fw_get_builtin_firmware()
149 static inline bool fw_is_builtin_firmware(const struct firmware *fw) in fw_is_builtin_firmware()
224 /* Returns 1 for batching firmware requests with the same name */
367 * XZ-compressed firmware support
465 /* direct firmware loading support */
469 "/lib/firmware/updates/" UTS_RELEASE,
470 "/lib/firmware/updates",
471 "/lib/firmware/" UTS_RELEASE,
472 "/lib/firmware"
481 MODULE_PARM_DESC(path, "customized firmware image search path with a higher priority than default p…
529 * firmware was not completely loaded. in fw_get_filesystem_firmware()
534 /* load firmware files from the mount namespace of init */ in fw_get_filesystem_firmware()
551 dev_dbg(device, "Loading firmware from %s\n", path); in fw_get_filesystem_firmware()
578 /* firmware holds the ownership of pages */
579 static void firmware_free_data(const struct firmware *fw) in firmware_free_data()
589 /* store the pages buffer info firmware from buf */
590 static void fw_set_page_data(struct fw_priv *fw_priv, struct firmware *fw) in fw_set_page_data()
642 /* add firmware name into devres list */
677 int assign_fw(struct firmware *fw, struct device *device) in assign_fw()
689 * add firmware name into devres list so that we can auto cache in assign_fw()
690 * and uncache firmware for device. in assign_fw()
695 /* don't cache firmware handled without uevent */ in assign_fw()
706 * After caching firmware image is started, let it piggyback in assign_fw()
707 * on request firmware. in assign_fw()
719 /* prepare firmware and firmware_buf structs;
720 * return 0 if a firmware is already assigned, 1 if need to load one,
724 _request_firmware_prepare(struct firmware **firmware_p, const char *name, in _request_firmware_prepare()
728 struct firmware *firmware; in _request_firmware_prepare() local
732 *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); in _request_firmware_prepare()
733 if (!firmware) { in _request_firmware_prepare()
734 dev_err(device, "%s: kmalloc(struct firmware) failed\n", in _request_firmware_prepare()
739 if (fw_get_builtin_firmware(firmware, name, dbuf, size)) { in _request_firmware_prepare()
749 * of requesting firmware. in _request_firmware_prepare()
751 firmware->priv = fw_priv; in _request_firmware_prepare()
756 fw_set_page_data(fw_priv, firmware); in _request_firmware_prepare()
775 static void fw_abort_batch_reqs(struct firmware *fw) in fw_abort_batch_reqs()
792 _request_firmware(const struct firmware **firmware_p, const char *name, in _request_firmware()
796 struct firmware *fw = NULL; in _request_firmware()
830 "Direct firmware load for %s failed with error %d\n", in _request_firmware()
850 * request_firmware() - send firmware request and wait for it
851 * @firmware_p: pointer to firmware image
852 * @name: name of firmware file
853 * @device: device for which firmware is being loaded
855 * @firmware_p will be used to return a firmware image by the name
860 * @name will be used as $FIRMWARE in the uevent environment and
862 * firmware image for this or any other device.
870 request_firmware(const struct firmware **firmware_p, const char *name, in request_firmware()
886 * @firmware: pointer to firmware image
887 * @name: name of firmware file
888 * @device: device for which firmware is being loaded
893 * failures to find the firmware file with it are still suppressed. It is
897 int firmware_request_nowarn(const struct firmware **firmware, const char *name, in firmware_request_nowarn() argument
904 ret = _request_firmware(firmware, name, device, NULL, 0, 0, in firmware_request_nowarn()
912 * request_firmware_direct() - load firmware directly without usermode helper
913 * @firmware_p: pointer to firmware image
914 * @name: name of firmware file
915 * @device: device for which firmware is being loaded
918 * fall back to usermode helper even if the firmware couldn't be loaded
922 int request_firmware_direct(const struct firmware **firmware_p, in request_firmware_direct()
937 * firmware_request_platform() - request firmware with platform-fw fallback
938 * @firmware: pointer to firmware image
939 * @name: name of firmware file
940 * @device: device for which firmware is being loaded
944 * requested firmware embedded in the platform's main (e.g. UEFI) firmware.
946 int firmware_request_platform(const struct firmware **firmware, in firmware_request_platform() argument
953 ret = _request_firmware(firmware, name, device, NULL, 0, 0, in firmware_request_platform()
961 * firmware_request_cache() - cache firmware for suspend so resume can use it
962 * @name: name of firmware file
963 * @device: device for which firmware should be cached for
966 * require loading firmware on system reboot. This optimization may still
967 * require the firmware present on resume from suspend. This routine can be
968 * used to ensure the firmware is present on resume from suspend in these
985 * request_firmware_into_buf() - load firmware into a previously allocated buffer
986 * @firmware_p: pointer to firmware image
987 * @name: name of firmware file
988 * @device: device for which firmware is being loaded and DMA region allocated
989 * @buf: address of buffer to load firmware into
993 * allocate a buffer to hold the firmware data. Instead, the firmware
997 * This function doesn't cache firmware either.
1000 request_firmware_into_buf(const struct firmware **firmware_p, const char *name, in request_firmware_into_buf()
1017 * request_partial_firmware_into_buf() - load partial firmware into a previously allocated buffer
1018 * @firmware_p: pointer to firmware image
1019 * @name: name of firmware file
1020 * @device: device for which firmware is being loaded and DMA region allocated
1021 * @buf: address of buffer to load firmware into
1029 request_partial_firmware_into_buf(const struct firmware **firmware_p, in request_partial_firmware_into_buf()
1048 * release_firmware() - release the resource associated with a firmware image
1049 * @fw: firmware resource to release
1051 void release_firmware(const struct firmware *fw) in release_firmware()
1068 void (*cont)(const struct firmware *fw, void *context);
1075 const struct firmware *fw; in request_firmware_work_func()
1091 * @module: module requesting the firmware
1092 * @uevent: sends uevent to copy the firmware image if this flag
1093 * is non-zero else the firmware copy must be done manually.
1094 * @name: name of firmware file
1095 * @device: device for which firmware is being loaded
1098 * @fw may be %NULL if firmware request fails.
1099 * @cont: function will be called asynchronously when the firmware
1107 * requesting firmware in their ->probe() methods, if
1116 void (*cont)(const struct firmware *fw, void *context)) in request_firmware_nowait()
1159 * cache_firmware() - cache one firmware image in kernel memory space
1160 * @fw_name: the firmware image name
1162 * Cache firmware in kernel memory so that drivers can use it when
1163 * system isn't ready for them to request firmware image from userspace.
1165 * nowait version to get the cached firmware without any interacting
1168 * Return 0 if the firmware image has been cached successfully
1175 const struct firmware *fw; in cache_firmware()
1201 * uncache_firmware() - remove one cached firmware image
1202 * @fw_name: the firmware image name
1204 * Uncache one firmware image which has been cached successfully
1207 * Return 0 if the firmware cache has been removed successfully
1214 struct firmware fw; in uncache_firmware()
1339 /* only one cache entry for one firmware */ in dev_cache_fw_image()
1376 * device_cache_fw_images() - cache devices' firmware
1379 * successfully before, the firmware names are recored into the
1383 * time when system is not ready to complete loading firmware.
1402 /* wait for completion of caching firmware for all devices */ in device_cache_fw_images()
1409 * device_uncache_fw_images() - uncache devices' firmware
1471 /* stop caching firmware once syscore_suspend is reached */