x86: qemu: move x86 specific operations out of qfw core
The original implementation of qfw includes several x86 specific
operations, like directly calling outb/inb and using some inline
assembly code which prevents it being ported to other architectures.
This patch adds callback functions and moves those to arch/x86/
Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff --git a/include/qemu_fw_cfg.h b/include/qemu_fw_cfg.h
index f718e09..b0b3b59 100644
--- a/include/qemu_fw_cfg.h
+++ b/include/qemu_fw_cfg.h
@@ -7,11 +7,6 @@
#ifndef __FW_CFG__
#define __FW_CFG__
-#define FW_CONTROL_PORT 0x510
-#define FW_DATA_PORT 0x511
-#define FW_DMA_PORT_LOW 0x514
-#define FW_DMA_PORT_HIGH 0x518
-
#include <linux/list.h>
enum qemu_fwcfg_items {
@@ -97,6 +92,12 @@
__be64 address;
};
+struct fw_cfg_arch_ops {
+ void (*arch_read_pio)(uint16_t selector, uint32_t size,
+ void *address);
+ void (*arch_read_dma)(struct fw_cfg_dma_access *dma);
+};
+
struct bios_linker_entry {
__le32 command;
union {
@@ -148,8 +149,10 @@
/**
* Initialize QEMU fw_cfg interface
+ *
+ * @ops: arch specific read operations
*/
-void qemu_fwcfg_init(void);
+void qemu_fwcfg_init(struct fw_cfg_arch_ops *ops);
void qemu_fwcfg_read_entry(uint16_t entry, uint32_t length, void *address);
int qemu_fwcfg_read_firmware_list(void);