aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/qemu_fw_cfg.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-02-28 10:06:11 -0500
committerMichael S. Tsirkin <mst@redhat.com>2018-03-19 21:17:40 -0400
commit1f57bc12d87dda2d56b564d35f21b9e6bdb2bb2c (patch)
treed4571d43aab1c544819799cb1ebe9deffde49e24 /drivers/firmware/qemu_fw_cfg.c
parentb1cc4097d15c29725060f86ecec20a1e635a541f (diff)
fw_cfg: add a public uapi header
Create a common header file for well-known values and structures to be shared by the Linux kernel with qemu or other projects. It is based from qemu/docs/specs/fw_cfg.txt which references qemu/include/hw/nvram/fw_cfg_keys.h "for the most up-to-date and authoritative list" & vmcoreinfo.txt. Those files don't have an explicit license, but qemu/hw/nvram/fw_cfg.c is BSD-license, so Michael S. Tsirkin suggested to use the same license. The patch intentionally left out DMA & vmcoreinfo structures & defines, which are added in the commits making usage of it. Suggested-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/firmware/qemu_fw_cfg.c')
-rw-r--r--drivers/firmware/qemu_fw_cfg.c22
1 files changed, 2 insertions, 20 deletions
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
36MODULE_AUTHOR("Gabriel L. Somlo <somlo@cmu.edu>"); 37MODULE_AUTHOR("Gabriel L. Somlo <somlo@cmu.edu>");
37MODULE_DESCRIPTION("QEMU fw_cfg sysfs support"); 38MODULE_DESCRIPTION("QEMU fw_cfg sysfs support");
38MODULE_LICENSE("GPL"); 39MODULE_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 */
52struct 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 */
60static bool fw_cfg_is_mmio; 42static bool fw_cfg_is_mmio;
61static phys_addr_t fw_cfg_p_base; 43static 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
618static const struct acpi_device_id fw_cfg_sysfs_acpi_match[] = { 600static const struct acpi_device_id fw_cfg_sysfs_acpi_match[] = {
619 { "QEMU0002", }, 601 { FW_CFG_ACPI_DEVICE_ID, },
620 {}, 602 {},
621}; 603};
622MODULE_DEVICE_TABLE(acpi, fw_cfg_sysfs_acpi_match); 604MODULE_DEVICE_TABLE(acpi, fw_cfg_sysfs_acpi_match);