Comments
Patch
@@ -131,7 +131,7 @@ tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(
tests/test-mul64$(EXESUF): tests/test-mul64.o libqemuutil.a
libqos-obj-y = tests/libqos/pci.o tests/libqos/fw_cfg.o
-libqos-pc-obj-y = $(libqos-obj-y) tests/libqos/pci-pc.o
+libqos-pc-obj-y = $(libqos-obj-y) tests/libqos/pci-pc.o tests/libqos/fw_cfg-pc.o
tests/rtc-test$(EXESUF): tests/rtc-test.o
tests/m48t59-test$(EXESUF): tests/m48t59-test.o
@@ -2,38 +2,11 @@
#include "libqtest.h"
#include "hw/fw_cfg.h"
-#include "libqos/fw_cfg.h"
+#include "libqos/fw_cfg-pc.h"
#include <string.h>
#include <glib.h>
-/* PC specific */
-
-static void pc_fw_cfg_select(QFWCFG *fw_cfg, uint16_t key)
-{
- outw(0x510, key);
-}
-
-static void pc_fw_cfg_read(QFWCFG *fw_cfg, void *data, size_t len)
-{
- uint8_t *ptr = data;
- int i;
-
- for (i = 0; i < len; i++) {
- ptr[i] = inb(0x511);
- }
-}
-
-static QFWCFG *pc_fw_cfg_init(void)
-{
- QFWCFG *fw_cfg = g_malloc0(sizeof(*fw_cfg));
-
- fw_cfg->select = pc_fw_cfg_select;
- fw_cfg->read = pc_fw_cfg_read;
-
- return fw_cfg;
-}
-
static uint64_t ram_size = 128 << 20;
static uint16_t nb_cpus = 1;
static uint16_t max_cpus = 1;
new file mode 100644
@@ -0,0 +1,28 @@
+#include "libqos/fw_cfg-pc.h"
+#include "libqtest.h"
+#include <glib.h>
+
+static void pc_fw_cfg_select(QFWCFG *fw_cfg, uint16_t key)
+{
+ outw(0x510, key);
+}
+
+static void pc_fw_cfg_read(QFWCFG *fw_cfg, void *data, size_t len)
+{
+ uint8_t *ptr = data;
+ int i;
+
+ for (i = 0; i < len; i++) {
+ ptr[i] = inb(0x511);
+ }
+}
+
+QFWCFG *pc_fw_cfg_init(void)
+{
+ QFWCFG *fw_cfg = g_malloc0(sizeof(*fw_cfg));
+
+ fw_cfg->select = pc_fw_cfg_select;
+ fw_cfg->read = pc_fw_cfg_read;
+
+ return fw_cfg;
+}
new file mode 100644
@@ -0,0 +1,8 @@
+#ifndef LIBQOS_FW_CFG_PC_H
+#define LIBQOS_FW_CFG_PC_H
+
+#include "libqos/fw_cfg.h"
+
+QFWCFG *pc_fw_cfg_init(void);
+
+#endif
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> --- tests/Makefile | 2 +- tests/fw_cfg-test.c | 29 +---------------------------- tests/libqos/fw_cfg-pc.c | 28 ++++++++++++++++++++++++++++ tests/libqos/fw_cfg-pc.h | 8 ++++++++ 4 files changed, 38 insertions(+), 29 deletions(-) create mode 100644 tests/libqos/fw_cfg-pc.c create mode 100644 tests/libqos/fw_cfg-pc.h