| 244 | }; |
| 245 | |
| 246 | static void |
| 247 | loadimage(void *arg, int npending __unused) |
| 248 | { |
| 249 | struct fw_loadimage *fwli = arg; |
| 250 | struct priv_fw *fp; |
| 251 | linker_file_t result; |
| 252 | int error; |
| 253 | |
| 254 | error = linker_reference_module(fwli->imagename, NULL, &result); |
| 255 | if (error != 0) { |
| 256 | if (bootverbose || (fwli->flags & FIRMWARE_GET_NOWARN) == 0) |
| 257 | printf("%s: could not load firmware image, error %d\n", |
| 258 | fwli->imagename, error); |
| 259 | mtx_lock(&firmware_mtx); |
| 260 | goto done; |
| 261 | } |
| 262 | |
| 263 | mtx_lock(&firmware_mtx); |
| 264 | fp = lookup(fwli->imagename); |
| 265 | if (fp == NULL || fp->file != NULL) { |
| 266 | mtx_unlock(&firmware_mtx); |
| 267 | if (fp == NULL) |
| 268 | printf("%s: firmware image loaded, " |
| 269 | "but did not register\n", fwli->imagename); |
| 270 | (void) linker_release_module(fwli->imagename, NULL, NULL); |
| 271 | mtx_lock(&firmware_mtx); |
| 272 | goto done; |
| 273 | } |
| 274 | fp->file = result; /* record the module identity */ |
| 275 | done: |
| 276 | wakeup_one(arg); |
| 277 | mtx_unlock(&firmware_mtx); |
| 278 | } |
| 279 | |
| 280 | /* |
| 281 | * Lookup and potentially load the specified firmware image. |
nothing calls this directly
no test coverage detected