qemu: add rom loading via fw_cfg

Add support for loading roms using the qemu fw_cfg interface,
modeled after the existing cbfs support.  Use it to look for
vgabios (vgaroms/*) and option roms (genroms/*).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/src/paravirt.h b/src/paravirt.h
index 29a2c04..4cef48e 100644
--- a/src/paravirt.h
+++ b/src/paravirt.h
@@ -31,6 +31,7 @@
 #define QEMU_CFG_NUMA			0x0d
 #define QEMU_CFG_BOOT_MENU		0x0e
 #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)
@@ -53,4 +54,15 @@
 void qemu_cfg_get_numa_data(u64 *data, int n);
 u16 qemu_cfg_get_max_cpus(void);
 
+typedef struct QemuCfgFile {
+    u32  size;        /* file size */
+    u16  select;      /* write this to 0x510 to read it */
+    u16  reserved;
+    char name[56];
+} QemuCfgFile;
+
+u16 qemu_cfg_first_file(QemuCfgFile *entry);
+u16 qemu_cfg_next_file(QemuCfgFile *entry);
+u32 qemu_cfg_read_file(QemuCfgFile *entry, void *dst, u32 maxlen);
+
 #endif