Lines Matching +full:firmware +full:- +full:name

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2020-2021 The FreeBSD Foundation
36 #include <sys/firmware.h>
43 #include <linux/firmware.h>
44 #undef firmware
46 MALLOC_DEFINE(M_LKPI_FW, "lkpifw", "LinuxKPI firmware");
62 const struct firmware *fbdfw;
70 return (-EINVAL);
80 * Linux can have a path in the firmware which is hard to replicate
81 * for auto-firmware-module-loading.
82 * On FreeBSD, depending on what people do, the firmware will either
84 * driver author has to deal with herself (requesting the special name).
85 * We also optionally flatten '/'s and '.'s as some firmware modules do.
86 * We probe in the least-of-work order avoiding memory operations.
87 * It will be preferred to build the firmware .ko in a well matching
88 * way rather than adding more name-mangling-hacks here in the future
91 /* (1) Try the original name. */
93 /* (2) Try any name removed of path, if we have not yet. */
103 /* (3) Flatten '/', '.' and '-' to '_' and try with adjusted name. */
106 strchr(fw_name, '-'))) {
118 while ((p = strchr(fwimg, '-')) != NULL)
133 device_printf(dev->bsddev, "could not load firmware "
135 return (-ENOENT);
138 device_printf(dev->bsddev,"successfully loaded firmware image '%s'\n",
140 lfw->fbdfw = fbdfw;
141 lfw->data = (const uint8_t *)fbdfw->data;
142 lfw->size = fbdfw->datasize;
157 if (lfwt->cont == NULL)
160 _linuxkpi_request_firmware(lfwt->fw_name, &fw, lfwt->dev,
161 lfwt->gfp, true, true);
164 * Linux seems to run the callback if it cannot find the firmware.
167 lfwt->cont(fw, lfwt->drv);
183 lfwt->gfp = gfp;
184 lfwt->fw_name = fw_name;
185 lfwt->dev = dev;
186 lfwt->drv = drv;
187 lfwt->cont = cont;
188 TASK_INIT(&lfwt->fw_task, 0, lkpi_fw_task, lfwt);
189 error = taskqueue_enqueue(taskqueue_thread, &lfwt->fw_task);
192 return (-error);
221 if (fw->fbdfw)
222 firmware_put(fw->fbdfw, FIRMWARE_UNLOAD);
239 if ((offset + buflen) >= lfw->size) {
241 return (-ERANGE);
244 memcpy(buf, lfw->data + offset, buflen);