1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * These are the qemu firmware config interface defines and structs.
5 * Copied over from qemu source tree,
6 * include/standard-headers/linux/qemu_fw_cfg.h and modified accordingly.
23 FW_CFG_KERNEL_CMDLINE
,
42 #define FW_CFG_FILE_FIRST 0x20
43 #define FW_CFG_FILE_SLOTS 0x10
44 #define FW_CFG_MAX_ENTRY (FW_CFG_FILE_FIRST+FW_CFG_FILE_SLOTS)
46 #define FW_CFG_WRITE_CHANNEL 0x4000
47 #define FW_CFG_ARCH_LOCAL 0x8000
48 #define FW_CFG_ENTRY_MASK ~(FW_CFG_WRITE_CHANNEL | FW_CFG_ARCH_LOCAL)
50 #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0)
51 #define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1)
52 #define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2)
53 #define FW_CFG_E820_TABLE (FW_CFG_ARCH_LOCAL + 3)
54 #define FW_CFG_HPET (FW_CFG_ARCH_LOCAL + 4)
56 #define FW_CFG_INVALID 0xffff
58 /* width in bytes of fw_cfg control register */
59 #define FW_CFG_CTL_SIZE 0x02
61 /* fw_cfg "file name" is up to 56 characters (including terminating nul) */
62 #define FW_CFG_MAX_FILE_PATH 56
64 /* size in bytes of fw_cfg signature */
65 #define FW_CFG_SIG_SIZE 4
67 typedef struct FWCfgFile
{
68 uint32_t size
; /* file size */
69 uint16_t select
; /* write this to 0x510 to read it */
71 char name
[FW_CFG_MAX_FILE_PATH
];
74 typedef struct FWCfgFiles
{
77 } __packed FWCfgFiles
;
79 typedef struct FwCfgE820Entry
{
83 } __packed FwCfgE820Entry
__attribute((__aligned__(4)));
86 #define SMBIOS_FIELD_ENTRY 0
87 #define SMBIOS_TABLE_ENTRY 1
89 typedef struct FwCfgSmbios
{
94 } __packed FwCfgSmbios
;
97 #define FW_CFG_VERSION 0x01
98 #define FW_CFG_VERSION_DMA 0x02
100 /* FW_CFG_DMA_CONTROL bits */
101 #define FW_CFG_DMA_CTL_ERROR 0x01
102 #define FW_CFG_DMA_CTL_READ 0x02
103 #define FW_CFG_DMA_CTL_SKIP 0x04
104 #define FW_CFG_DMA_CTL_SELECT 0x08
105 #define FW_CFG_DMA_CTL_WRITE 0x10
107 #define FW_CFG_DMA_SIGNATURE 0x51454d5520434647ULL /* "QEMU CFG" */
109 /* Control as first field allows for different structures selected by this
110 * field, which might be useful in the future
112 typedef struct FwCfgDmaAccess
{
116 } __packed FwCfgDmaAccess
;
118 #endif /* FW_CFG_IF_H */