Lines Matching full:firmware
3 * main.c - Multi purpose firmware loading support
24 #include <linux/firmware.h>
41 #include "firmware.h"
45 MODULE_DESCRIPTION("Multi purpose firmware loading support");
56 * Names of firmware images which have been cached successfully
58 * helper can trace which firmware images have been cached
94 /* Builtin firmware support */
101 static void fw_copy_to_prealloc_buf(struct firmware *fw, in fw_copy_to_prealloc_buf()
109 static bool fw_get_builtin_firmware(struct firmware *fw, const char *name, in fw_get_builtin_firmware()
127 static bool fw_is_builtin_firmware(const struct firmware *fw) in fw_is_builtin_firmware()
138 #else /* Module case - no builtin firmware support */
140 static inline bool fw_get_builtin_firmware(struct firmware *fw, in fw_get_builtin_firmware()
147 static inline bool fw_is_builtin_firmware(const struct firmware *fw) in fw_is_builtin_firmware()
209 /* Returns 1 for batching firmware requests with the same name */
340 * XZ-compressed firmware support
438 /* direct firmware loading support */
442 "/lib/firmware/updates/" UTS_RELEASE,
443 "/lib/firmware/updates",
444 "/lib/firmware/" UTS_RELEASE,
445 "/lib/firmware"
454 MODULE_PARM_DESC(path, "customized firmware image search path with a higher priority than default p…
533 /* firmware holds the ownership of pages */
534 static void firmware_free_data(const struct firmware *fw) in firmware_free_data()
544 /* store the pages buffer info firmware from buf */
545 static void fw_set_page_data(struct fw_priv *fw_priv, struct firmware *fw) in fw_set_page_data()
600 /* add firmware name into devres list */
635 int assign_fw(struct firmware *fw, struct device *device, in assign_fw()
648 * add firmware name into devres list so that we can auto cache in assign_fw()
649 * and uncache firmware for device. in assign_fw()
654 /* don't cache firmware handled without uevent */ in assign_fw()
665 * After caching firmware image is started, let it piggyback in assign_fw()
666 * on request firmware. in assign_fw()
680 /* prepare firmware and firmware_buf structs;
681 * return 0 if a firmware is already assigned, 1 if need to load one,
685 _request_firmware_prepare(struct firmware **firmware_p, const char *name, in _request_firmware_prepare()
689 struct firmware *firmware; in _request_firmware_prepare() local
693 *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); in _request_firmware_prepare()
694 if (!firmware) { in _request_firmware_prepare()
695 dev_err(device, "%s: kmalloc(struct firmware) failed\n", in _request_firmware_prepare()
700 if (fw_get_builtin_firmware(firmware, name, dbuf, size)) { in _request_firmware_prepare()
710 * of requesting firmware. in _request_firmware_prepare()
712 firmware->priv = fw_priv; in _request_firmware_prepare()
717 fw_set_page_data(fw_priv, firmware); in _request_firmware_prepare()
736 static void fw_abort_batch_reqs(struct firmware *fw) in fw_abort_batch_reqs()
751 _request_firmware(const struct firmware **firmware_p, const char *name, in _request_firmware()
755 struct firmware *fw = NULL; in _request_firmware()
781 "Direct firmware load for %s failed with error %d\n", in _request_firmware()
799 * request_firmware() - send firmware request and wait for it
800 * @firmware_p: pointer to firmware image
801 * @name: name of firmware file
802 * @device: device for which firmware is being loaded
804 * @firmware_p will be used to return a firmware image by the name
809 * @name will be used as $FIRMWARE in the uevent environment and
811 * firmware image for this or any other device.
819 request_firmware(const struct firmware **firmware_p, const char *name, in request_firmware()
835 * @firmware: pointer to firmware image
836 * @name: name of firmware file
837 * @device: device for which firmware is being loaded
842 * however, however failures to find the firmware file with it are still
846 int firmware_request_nowarn(const struct firmware **firmware, const char *name, in firmware_request_nowarn() argument
853 ret = _request_firmware(firmware, name, device, NULL, 0, in firmware_request_nowarn()
861 * request_firmware_direct() - load firmware directly without usermode helper
862 * @firmware_p: pointer to firmware image
863 * @name: name of firmware file
864 * @device: device for which firmware is being loaded
867 * fall back to usermode helper even if the firmware couldn't be loaded
871 int request_firmware_direct(const struct firmware **firmware_p, in request_firmware_direct()
886 * firmware_request_cache() - cache firmware for suspend so resume can use it
887 * @name: name of firmware file
888 * @device: device for which firmware should be cached for
891 * require loading firmware on system reboot. This optimization may still
892 * require the firmware present on resume from suspend. This routine can be
893 * used to ensure the firmware is present on resume from suspend in these
910 * request_firmware_into_buf() - load firmware into a previously allocated buffer
911 * @firmware_p: pointer to firmware image
912 * @name: name of firmware file
913 * @device: device for which firmware is being loaded and DMA region allocated
914 * @buf: address of buffer to load firmware into
918 * allocate a buffer to hold the firmware data. Instead, the firmware
922 * This function doesn't cache firmware either.
925 request_firmware_into_buf(const struct firmware **firmware_p, const char *name, in request_firmware_into_buf()
942 * release_firmware() - release the resource associated with a firmware image
943 * @fw: firmware resource to release
945 void release_firmware(const struct firmware *fw) in release_firmware()
962 void (*cont)(const struct firmware *fw, void *context);
969 const struct firmware *fw; in request_firmware_work_func()
985 * @module: module requesting the firmware
986 * @uevent: sends uevent to copy the firmware image if this flag
987 * is non-zero else the firmware copy must be done manually.
988 * @name: name of firmware file
989 * @device: device for which firmware is being loaded
992 * @fw may be %NULL if firmware request fails.
993 * @cont: function will be called asynchronously when the firmware
1001 * requesting firmware in their ->probe() methods, if
1010 void (*cont)(const struct firmware *fw, void *context)) in request_firmware_nowait()
1053 * cache_firmware() - cache one firmware image in kernel memory space
1054 * @fw_name: the firmware image name
1056 * Cache firmware in kernel memory so that drivers can use it when
1057 * system isn't ready for them to request firmware image from userspace.
1059 * nowait version to get the cached firmware without any interacting
1062 * Return 0 if the firmware image has been cached successfully
1069 const struct firmware *fw; in cache_firmware()
1095 * uncache_firmware() - remove one cached firmware image
1096 * @fw_name: the firmware image name
1098 * Uncache one firmware image which has been cached successfully
1101 * Return 0 if the firmware cache has been removed successfully
1108 struct firmware fw; in uncache_firmware()
1234 /* only one cache entry for one firmware */ in dev_cache_fw_image()
1271 * device_cache_fw_images() - cache devices' firmware
1274 * successfully before, the firmware names are recored into the
1278 * time when system is not ready to complete loading firmware.
1297 /* wait for completion of caching firmware for all devices */ in device_cache_fw_images()
1304 * device_uncache_fw_images() - uncache devices' firmware
1366 /* stop caching firmware once syscore_suspend is reached */