Lines Matching +full:firmware +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0
12 #include "firmware.h"
15 * firmware fallback mechanism
19 * use small loading timeout for caching devices' firmware because all these
20 * firmware images have been loaded successfully at lease once, also system is
21 * ready for completing firmware loading now. The maximum size of firmware in
57 if (!fw_priv->need_uevent || !only_kill_custom) in kill_pending_fw_fallback_reqs()
64 * fw_load_sysfs_fallback() - load a firmware via the sysfs fallback mechanism
65 * @fw_sysfs: firmware sysfs information for the firmware to load
68 * In charge of constructing a sysfs fallback interface for firmware loading.
73 struct device *f_dev = &fw_sysfs->dev; in fw_load_sysfs_fallback()
74 struct fw_priv *fw_priv = fw_sysfs->fw_priv; in fw_load_sysfs_fallback()
77 if (!fw_priv->data) in fw_load_sysfs_fallback()
78 fw_priv->is_paged_buf = true; in fw_load_sysfs_fallback()
91 retval = -EINTR; in fw_load_sysfs_fallback()
94 list_add(&fw_priv->pending_list, &pending_fw_head); in fw_load_sysfs_fallback()
97 if (fw_priv->opt_flags & FW_OPT_UEVENT) { in fw_load_sysfs_fallback()
98 fw_priv->need_uevent = true; in fw_load_sysfs_fallback()
100 dev_dbg(f_dev, "firmware: requesting %s\n", fw_priv->fw_name); in fw_load_sysfs_fallback()
101 kobject_uevent(&fw_sysfs->dev.kobj, KOBJ_ADD); in fw_load_sysfs_fallback()
107 if (retval < 0 && retval != -ENOENT) { in fw_load_sysfs_fallback()
114 if (retval == -ERESTARTSYS) in fw_load_sysfs_fallback()
115 retval = -EINTR; in fw_load_sysfs_fallback()
116 } else if (fw_priv->is_paged_buf && !fw_priv->data) in fw_load_sysfs_fallback()
117 retval = -ENOMEM; in fw_load_sysfs_fallback()
126 static int fw_load_from_user_helper(struct firmware *firmware, in fw_load_from_user_helper() argument
127 const char *name, struct device *device, in fw_load_from_user_helper() argument
138 dev_dbg(device, "firmware: %s loading timed out\n", in fw_load_from_user_helper()
139 name); in fw_load_from_user_helper()
140 return -EBUSY; in fw_load_from_user_helper()
145 dev_err(device, "firmware: %s will not be loaded\n", in fw_load_from_user_helper()
146 name); in fw_load_from_user_helper()
151 fw_sysfs = fw_create_instance(firmware, name, device, opt_flags); in fw_load_from_user_helper()
157 fw_sysfs->fw_priv = firmware->priv; in fw_load_from_user_helper()
161 ret = assign_fw(firmware, device); in fw_load_from_user_helper()
183 pr_info_once("Ignoring firmware sysfs fallback due to sysctl knob\n"); in fw_run_sysfs_fallback()
190 /* Also permit LSMs and IMA to fail firmware sysfs fallback */ in fw_run_sysfs_fallback()
199 * firmware_fallback_sysfs() - use the fallback mechanism to find firmware
200 * @fw: pointer to firmware image
201 * @name: name of firmware file to look for
202 * @device: device for which firmware is being loaded
203 * @opt_flags: options to control firmware loading behaviour, as defined by
207 * This function is called if direct lookup for the firmware failed, it enables
209 * interface. Userspace is in charge of loading the firmware through the sysfs
220 int firmware_fallback_sysfs(struct firmware *fw, const char *name, in firmware_fallback_sysfs() argument
230 name); in firmware_fallback_sysfs()
233 name); in firmware_fallback_sysfs()
234 return fw_load_from_user_helper(fw, name, device, opt_flags); in firmware_fallback_sysfs()