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>
44 #include "firmware.h"
48 MODULE_DESCRIPTION("Multi purpose firmware loading support");
59 * Names of firmware images which have been cached successfully
61 * helper can trace which firmware images have been cached
166 /* Returns 1 for batching firmware requests with the same name */
307 * ZSTD-compressed firmware support
371 * XZ-compressed firmware support
469 /* direct firmware loading support */
473 "/lib/firmware/updates/" UTS_RELEASE,
474 "/lib/firmware/updates",
475 "/lib/firmware/" UTS_RELEASE,
476 "/lib/firmware"
485 MODULE_PARM_DESC(path, "customized firmware image search path with a higher priority than default p…
533 * firmware was not completely loaded. in fw_get_filesystem_firmware()
538 /* load firmware files from the mount namespace of init */ in fw_get_filesystem_firmware()
555 dev_dbg(device, "Loading firmware from %s\n", path); in fw_get_filesystem_firmware()
582 /* firmware holds the ownership of pages */
583 static void firmware_free_data(const struct firmware *fw) in firmware_free_data()
593 /* store the pages buffer info firmware from buf */
594 static void fw_set_page_data(struct fw_priv *fw_priv, struct firmware *fw) in fw_set_page_data()
646 /* add firmware name into devres list */
681 int assign_fw(struct firmware *fw, struct device *device) in assign_fw()
693 * add firmware name into devres list so that we can auto cache in assign_fw()
694 * and uncache firmware for device. in assign_fw()
699 /* don't cache firmware handled without uevent */ in assign_fw()
710 * After caching firmware image is started, let it piggyback in assign_fw()
711 * on request firmware. in assign_fw()
723 /* prepare firmware and firmware_buf structs;
724 * return 0 if a firmware is already assigned, 1 if need to load one,
728 _request_firmware_prepare(struct firmware **firmware_p, const char *name, in _request_firmware_prepare()
732 struct firmware *firmware; in _request_firmware_prepare() local
736 *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); in _request_firmware_prepare()
737 if (!firmware) { in _request_firmware_prepare()
738 dev_err(device, "%s: kmalloc(struct firmware) failed\n", in _request_firmware_prepare()
743 if (firmware_request_builtin_buf(firmware, name, dbuf, size)) { in _request_firmware_prepare()
753 * of requesting firmware. in _request_firmware_prepare()
755 firmware->priv = fw_priv; in _request_firmware_prepare()
760 fw_set_page_data(fw_priv, firmware); in _request_firmware_prepare()
779 static void fw_abort_batch_reqs(struct firmware *fw) in fw_abort_batch_reqs()
796 _request_firmware(const struct firmware **firmware_p, const char *name, in _request_firmware()
800 struct firmware *fw = NULL; in _request_firmware()
820 * We are about to try to access the firmware file. Because we may have been in _request_firmware()
853 "Direct firmware load for %s failed with error %d\n", in _request_firmware()
876 * request_firmware() - send firmware request and wait for it
877 * @firmware_p: pointer to firmware image
878 * @name: name of firmware file
879 * @device: device for which firmware is being loaded
881 * @firmware_p will be used to return a firmware image by the name
886 * @name will be used as $FIRMWARE in the uevent environment and
888 * firmware image for this or any other device.
896 request_firmware(const struct firmware **firmware_p, const char *name, in request_firmware()
912 * @firmware: pointer to firmware image
913 * @name: name of firmware file
914 * @device: device for which firmware is being loaded
919 * failures to find the firmware file with it are still suppressed. It is
923 int firmware_request_nowarn(const struct firmware **firmware, const char *name, in firmware_request_nowarn() argument
930 ret = _request_firmware(firmware, name, device, NULL, 0, 0, in firmware_request_nowarn()
938 * request_firmware_direct() - load firmware directly without usermode helper
939 * @firmware_p: pointer to firmware image
940 * @name: name of firmware file
941 * @device: device for which firmware is being loaded
944 * fall back to usermode helper even if the firmware couldn't be loaded
948 int request_firmware_direct(const struct firmware **firmware_p, in request_firmware_direct()
963 * firmware_request_platform() - request firmware with platform-fw fallback
964 * @firmware: pointer to firmware image
965 * @name: name of firmware file
966 * @device: device for which firmware is being loaded
970 * requested firmware embedded in the platform's main (e.g. UEFI) firmware.
972 int firmware_request_platform(const struct firmware **firmware, in firmware_request_platform() argument
979 ret = _request_firmware(firmware, name, device, NULL, 0, 0, in firmware_request_platform()
987 * firmware_request_cache() - cache firmware for suspend so resume can use it
988 * @name: name of firmware file
989 * @device: device for which firmware should be cached for
992 * require loading firmware on system reboot. This optimization may still
993 * require the firmware present on resume from suspend. This routine can be
994 * used to ensure the firmware is present on resume from suspend in these
1011 * request_firmware_into_buf() - load firmware into a previously allocated buffer
1012 * @firmware_p: pointer to firmware image
1013 * @name: name of firmware file
1014 * @device: device for which firmware is being loaded and DMA region allocated
1015 * @buf: address of buffer to load firmware into
1019 * allocate a buffer to hold the firmware data. Instead, the firmware
1023 * This function doesn't cache firmware either.
1026 request_firmware_into_buf(const struct firmware **firmware_p, const char *name, in request_firmware_into_buf()
1043 * request_partial_firmware_into_buf() - load partial firmware into a previously allocated buffer
1044 * @firmware_p: pointer to firmware image
1045 * @name: name of firmware file
1046 * @device: device for which firmware is being loaded and DMA region allocated
1047 * @buf: address of buffer to load firmware into
1055 request_partial_firmware_into_buf(const struct firmware **firmware_p, in request_partial_firmware_into_buf()
1074 * release_firmware() - release the resource associated with a firmware image
1075 * @fw: firmware resource to release
1077 void release_firmware(const struct firmware *fw) in release_firmware()
1094 void (*cont)(const struct firmware *fw, void *context);
1101 const struct firmware *fw; in request_firmware_work_func()
1117 * @module: module requesting the firmware
1118 * @uevent: sends uevent to copy the firmware image if this flag
1119 * is non-zero else the firmware copy must be done manually.
1120 * @name: name of firmware file
1121 * @device: device for which firmware is being loaded
1124 * @fw may be %NULL if firmware request fails.
1125 * @cont: function will be called asynchronously when the firmware
1133 * requesting firmware in their ->probe() methods, if
1142 void (*cont)(const struct firmware *fw, void *context)) in request_firmware_nowait()
1185 * cache_firmware() - cache one firmware image in kernel memory space
1186 * @fw_name: the firmware image name
1188 * Cache firmware in kernel memory so that drivers can use it when
1189 * system isn't ready for them to request firmware image from userspace.
1191 * nowait version to get the cached firmware without any interacting
1194 * Return 0 if the firmware image has been cached successfully
1201 const struct firmware *fw; in cache_firmware()
1227 * uncache_firmware() - remove one cached firmware image
1228 * @fw_name: the firmware image name
1230 * Uncache one firmware image which has been cached successfully
1233 * Return 0 if the firmware cache has been removed successfully
1240 struct firmware fw; in uncache_firmware()
1365 /* only one cache entry for one firmware */ in dev_cache_fw_image()
1402 * device_cache_fw_images() - cache devices' firmware
1405 * successfully before, the firmware names are recored into the
1409 * time when system is not ready to complete loading firmware.
1428 /* wait for completion of caching firmware for all devices */ in device_cache_fw_images()
1435 * device_uncache_fw_images() - uncache devices' firmware
1497 /* stop caching firmware once syscore_suspend is reached */