// SPDX-License-Identifier: GPL-2.0-only/* * This module provides an interface to trigger and test firmware loading. * * It is designed to be used for basic evaluation of the firmware loading * subsystem (for example when validating firmware verification). It lacks * any extra dependencies, and will not normally be loaded by the system * unless explicitly requested by name. */#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt#include<linux/init.h>#include<linux/module.h>#include<linux/printk.h>#include<linux/completion.h>#include<linux/firmware.h>#include<linux/device.h>#include<linux/fs.h>#include<linux/miscdevice.h>#include<linux/sizes.h>#include<linux/slab.h>#include<linux/uaccess.h>#include<linux/delay.h>#include<linux/kthread.h>#include<linux/vmalloc.h>#include<linux/efi_embedded_fw.h>MODULE_IMPORT_NS(TEST_FIRMWARE);#define TEST_FIRMWARE_NAME "test-firmware.bin"#define TEST_FIRMWARE_NUM_REQS 4#define TEST_FIRMWARE_BUF_SIZE SZ_1K#define TEST_UPLOAD_MAX_SIZE SZ_2K#define TEST_UPLOAD_BLK_SIZE 37 /* Avoid powers of two in testing */staticDEFINE_MUTEX(test_fw_mutex);staticconst