diff options
-rw-r--r-- | MAINTAINERS | 1 | ||||
-rw-r--r-- | drivers/firmware/qemu_fw_cfg.c | 22 | ||||
-rw-r--r-- | include/uapi/linux/qemu_fw_cfg.h | 66 |
3 files changed, 69 insertions, 20 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 4623caf8d72d..fc2c373f24a0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -11368,6 +11368,7 @@ M: "Michael S. Tsirkin" <mst@redhat.com> | |||
11368 | L: qemu-devel@nongnu.org | 11368 | L: qemu-devel@nongnu.org |
11369 | S: Maintained | 11369 | S: Maintained |
11370 | F: drivers/firmware/qemu_fw_cfg.c | 11370 | F: drivers/firmware/qemu_fw_cfg.c |
11371 | F: include/uapi/linux/qemu_fw_cfg.h | ||
11371 | 11372 | ||
11372 | QIB DRIVER | 11373 | QIB DRIVER |
11373 | M: Dennis Dalessandro <dennis.dalessandro@intel.com> | 11374 | M: Dennis Dalessandro <dennis.dalessandro@intel.com> |
diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c index 45bfc389b226..5de6bb406fb6 100644 --- a/drivers/firmware/qemu_fw_cfg.c +++ b/drivers/firmware/qemu_fw_cfg.c | |||
@@ -32,30 +32,12 @@ | |||
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
34 | #include <linux/ioport.h> | 34 | #include <linux/ioport.h> |
35 | #include <uapi/linux/qemu_fw_cfg.h> | ||
35 | 36 | ||
36 | MODULE_AUTHOR("Gabriel L. Somlo <somlo@cmu.edu>"); | 37 | MODULE_AUTHOR("Gabriel L. Somlo <somlo@cmu.edu>"); |
37 | MODULE_DESCRIPTION("QEMU fw_cfg sysfs support"); | 38 | MODULE_DESCRIPTION("QEMU fw_cfg sysfs support"); |
38 | MODULE_LICENSE("GPL"); | 39 | MODULE_LICENSE("GPL"); |
39 | 40 | ||
40 | /* selector key values for "well-known" fw_cfg entries */ | ||
41 | #define FW_CFG_SIGNATURE 0x00 | ||
42 | #define FW_CFG_ID 0x01 | ||
43 | #define FW_CFG_FILE_DIR 0x19 | ||
44 | |||
45 | /* size in bytes of fw_cfg signature */ | ||
46 | #define FW_CFG_SIG_SIZE 4 | ||
47 | |||
48 | /* fw_cfg "file name" is up to 56 characters (including terminating nul) */ | ||
49 | #define FW_CFG_MAX_FILE_PATH 56 | ||
50 | |||
51 | /* fw_cfg file directory entry type */ | ||
52 | struct fw_cfg_file { | ||
53 | u32 size; | ||
54 | u16 select; | ||
55 | u16 reserved; | ||
56 | char name[FW_CFG_MAX_FILE_PATH]; | ||
57 | }; | ||
58 | |||
59 | /* fw_cfg device i/o register addresses */ | 41 | /* fw_cfg device i/o register addresses */ |
60 | static bool fw_cfg_is_mmio; | 42 | static bool fw_cfg_is_mmio; |
61 | static phys_addr_t fw_cfg_p_base; | 43 | static phys_addr_t fw_cfg_p_base; |
@@ -616,7 +598,7 @@ MODULE_DEVICE_TABLE(of, fw_cfg_sysfs_mmio_match); | |||
616 | 598 | ||
617 | #ifdef CONFIG_ACPI | 599 | #ifdef CONFIG_ACPI |
618 | static const struct acpi_device_id fw_cfg_sysfs_acpi_match[] = { | 600 | static const struct acpi_device_id fw_cfg_sysfs_acpi_match[] = { |
619 | { "QEMU0002", }, | 601 | { FW_CFG_ACPI_DEVICE_ID, }, |
620 | {}, | 602 | {}, |
621 | }; | 603 | }; |
622 | MODULE_DEVICE_TABLE(acpi, fw_cfg_sysfs_acpi_match); | 604 | MODULE_DEVICE_TABLE(acpi, fw_cfg_sysfs_acpi_match); |
diff --git a/include/uapi/linux/qemu_fw_cfg.h b/include/uapi/linux/qemu_fw_cfg.h new file mode 100644 index 000000000000..c698ac3812f6 --- /dev/null +++ b/include/uapi/linux/qemu_fw_cfg.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /* SPDX-License-Identifier: BSD-3-Clause */ | ||
2 | #ifndef _LINUX_FW_CFG_H | ||
3 | #define _LINUX_FW_CFG_H | ||
4 | |||
5 | #include <linux/types.h> | ||
6 | |||
7 | #define FW_CFG_ACPI_DEVICE_ID "QEMU0002" | ||
8 | |||
9 | /* selector key values for "well-known" fw_cfg entries */ | ||
10 | #define FW_CFG_SIGNATURE 0x00 | ||
11 | #define FW_CFG_ID 0x01 | ||
12 | #define FW_CFG_UUID 0x02 | ||
13 | #define FW_CFG_RAM_SIZE 0x03 | ||
14 | #define FW_CFG_NOGRAPHIC 0x04 | ||
15 | #define FW_CFG_NB_CPUS 0x05 | ||
16 | #define FW_CFG_MACHINE_ID 0x06 | ||
17 | #define FW_CFG_KERNEL_ADDR 0x07 | ||
18 | #define FW_CFG_KERNEL_SIZE 0x08 | ||
19 | #define FW_CFG_KERNEL_CMDLINE 0x09 | ||
20 | #define FW_CFG_INITRD_ADDR 0x0a | ||
21 | #define FW_CFG_INITRD_SIZE 0x0b | ||
22 | #define FW_CFG_BOOT_DEVICE 0x0c | ||
23 | #define FW_CFG_NUMA 0x0d | ||
24 | #define FW_CFG_BOOT_MENU 0x0e | ||
25 | #define FW_CFG_MAX_CPUS 0x0f | ||
26 | #define FW_CFG_KERNEL_ENTRY 0x10 | ||
27 | #define FW_CFG_KERNEL_DATA 0x11 | ||
28 | #define FW_CFG_INITRD_DATA 0x12 | ||
29 | #define FW_CFG_CMDLINE_ADDR 0x13 | ||
30 | #define FW_CFG_CMDLINE_SIZE 0x14 | ||
31 | #define FW_CFG_CMDLINE_DATA 0x15 | ||
32 | #define FW_CFG_SETUP_ADDR 0x16 | ||
33 | #define FW_CFG_SETUP_SIZE 0x17 | ||
34 | #define FW_CFG_SETUP_DATA 0x18 | ||
35 | #define FW_CFG_FILE_DIR 0x19 | ||
36 | |||
37 | #define FW_CFG_FILE_FIRST 0x20 | ||
38 | #define FW_CFG_FILE_SLOTS_MIN 0x10 | ||
39 | |||
40 | #define FW_CFG_WRITE_CHANNEL 0x4000 | ||
41 | #define FW_CFG_ARCH_LOCAL 0x8000 | ||
42 | #define FW_CFG_ENTRY_MASK (~(FW_CFG_WRITE_CHANNEL | FW_CFG_ARCH_LOCAL)) | ||
43 | |||
44 | #define FW_CFG_INVALID 0xffff | ||
45 | |||
46 | /* width in bytes of fw_cfg control register */ | ||
47 | #define FW_CFG_CTL_SIZE 0x02 | ||
48 | |||
49 | /* fw_cfg "file name" is up to 56 characters (including terminating nul) */ | ||
50 | #define FW_CFG_MAX_FILE_PATH 56 | ||
51 | |||
52 | /* size in bytes of fw_cfg signature */ | ||
53 | #define FW_CFG_SIG_SIZE 4 | ||
54 | |||
55 | /* FW_CFG_ID bits */ | ||
56 | #define FW_CFG_VERSION 0x01 | ||
57 | |||
58 | /* fw_cfg file directory entry type */ | ||
59 | struct fw_cfg_file { | ||
60 | __be32 size; | ||
61 | __be16 select; | ||
62 | __u16 reserved; | ||
63 | char name[FW_CFG_MAX_FILE_PATH]; | ||
64 | }; | ||
65 | |||
66 | #endif | ||