[SeaBIOS] [PATCH 2/3] paravirt: move some fw_cfg bits to header file.
Gerd Hoffmann
kraxel at redhat.com
Wed Jun 13 10:51:56 CEST 2018
Also unstatic some qemu_cfg_* functions.
This allows ramfb vgabios accessing fw_cfg.
Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
src/fw/paravirt.h | 27 +++++++++++++++++++++++++++
src/fw/paravirt.c | 30 +++---------------------------
2 files changed, 30 insertions(+), 27 deletions(-)
diff --git a/src/fw/paravirt.h b/src/fw/paravirt.h
index a14d83e101..ae4440d878 100644
--- a/src/fw/paravirt.h
+++ b/src/fw/paravirt.h
@@ -10,6 +10,30 @@
#define PF_XEN (1<<1)
#define PF_KVM (1<<2)
+// List of QEMU fw_cfg entries. DO NOT ADD MORE. (All new content
+// should be passed via the fw_cfg "file" interface.)
+#define QEMU_CFG_SIGNATURE 0x00
+#define QEMU_CFG_ID 0x01
+#define QEMU_CFG_UUID 0x02
+#define QEMU_CFG_NOGRAPHIC 0x04
+#define QEMU_CFG_NUMA 0x0d
+#define QEMU_CFG_BOOT_MENU 0x0e
+#define QEMU_CFG_NB_CPUS 0x05
+#define QEMU_CFG_MAX_CPUS 0x0f
+#define QEMU_CFG_FILE_DIR 0x19
+#define QEMU_CFG_ARCH_LOCAL 0x8000
+#define QEMU_CFG_ACPI_TABLES (QEMU_CFG_ARCH_LOCAL + 0)
+#define QEMU_CFG_SMBIOS_ENTRIES (QEMU_CFG_ARCH_LOCAL + 1)
+#define QEMU_CFG_IRQ0_OVERRIDE (QEMU_CFG_ARCH_LOCAL + 2)
+#define QEMU_CFG_E820_TABLE (QEMU_CFG_ARCH_LOCAL + 3)
+
+struct QemuCfgFile {
+ u32 size; /* file size */
+ u16 select; /* write this to 0x510 to read it */
+ u16 reserved;
+ char name[56];
+};
+
typedef struct QemuCfgDmaAccess {
u32 control;
u32 length;
@@ -56,6 +80,9 @@ void qemu_platform_setup(void);
void qemu_cfg_init(void);
u16 qemu_get_present_cpus_count(void);
+void qemu_cfg_read(void *buf, int len);
+void qemu_cfg_read_entry(void *buf, int e, int len);
+void qemu_cfg_write_entry(void *buf, int e, int len);
int qemu_cfg_write_file(void *src, struct romfile_s *file, u32 offset, u32 len);
int qemu_cfg_write_file_simple(void *src, u16 key, u32 offset, u32 len);
u16 qemu_get_romfile_key(struct romfile_s *file);
diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c
index 0770c47b12..4cfaec220f 100644
--- a/src/fw/paravirt.c
+++ b/src/fw/paravirt.c
@@ -206,23 +206,6 @@ qemu_platform_setup(void)
* QEMU firmware config (fw_cfg) interface
****************************************************************/
-// List of QEMU fw_cfg entries. DO NOT ADD MORE. (All new content
-// should be passed via the fw_cfg "file" interface.)
-#define QEMU_CFG_SIGNATURE 0x00
-#define QEMU_CFG_ID 0x01
-#define QEMU_CFG_UUID 0x02
-#define QEMU_CFG_NOGRAPHIC 0x04
-#define QEMU_CFG_NUMA 0x0d
-#define QEMU_CFG_BOOT_MENU 0x0e
-#define QEMU_CFG_NB_CPUS 0x05
-#define QEMU_CFG_MAX_CPUS 0x0f
-#define QEMU_CFG_FILE_DIR 0x19
-#define QEMU_CFG_ARCH_LOCAL 0x8000
-#define QEMU_CFG_ACPI_TABLES (QEMU_CFG_ARCH_LOCAL + 0)
-#define QEMU_CFG_SMBIOS_ENTRIES (QEMU_CFG_ARCH_LOCAL + 1)
-#define QEMU_CFG_IRQ0_OVERRIDE (QEMU_CFG_ARCH_LOCAL + 2)
-#define QEMU_CFG_E820_TABLE (QEMU_CFG_ARCH_LOCAL + 3)
-
static void
qemu_cfg_select(u16 f)
{
@@ -247,7 +230,7 @@ qemu_cfg_dma_transfer(void *address, u32 length, u32 control)
}
}
-static void
+void
qemu_cfg_read(void *buf, int len)
{
if (len == 0) {
@@ -290,7 +273,7 @@ qemu_cfg_skip(int len)
}
}
-static void
+void
qemu_cfg_read_entry(void *buf, int e, int len)
{
if (qemu_cfg_dma_enabled()) {
@@ -303,7 +286,7 @@ qemu_cfg_read_entry(void *buf, int e, int len)
}
}
-static void
+void
qemu_cfg_write_entry(void *buf, int e, int len)
{
if (qemu_cfg_dma_enabled()) {
@@ -561,13 +544,6 @@ qemu_cfg_legacy(void)
}
}
-struct QemuCfgFile {
- u32 size; /* file size */
- u16 select; /* write this to 0x510 to read it */
- u16 reserved;
- char name[56];
-};
-
void qemu_cfg_init(void)
{
if (!runningOnQEMU())
--
2.9.3
More information about the SeaBIOS
mailing list