[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 7/8] libqos: add fw_cfg-pc
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [RFC PATCH 7/8] libqos: add fw_cfg-pc |
Date: |
Tue, 5 Mar 2013 07:53:31 -0600 |
Signed-off-by: Anthony Liguori <address@hidden>
---
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
diff --git a/tests/Makefile b/tests/Makefile
index 7e436c0..bfeee5e 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -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
diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c
index 99643c0..03d62c8 100644
--- a/tests/fw_cfg-test.c
+++ b/tests/fw_cfg-test.c
@@ -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;
diff --git a/tests/libqos/fw_cfg-pc.c b/tests/libqos/fw_cfg-pc.c
new file mode 100644
index 0000000..9a5c1f8
--- /dev/null
+++ b/tests/libqos/fw_cfg-pc.c
@@ -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;
+}
diff --git a/tests/libqos/fw_cfg-pc.h b/tests/libqos/fw_cfg-pc.h
new file mode 100644
index 0000000..ba8c819
--- /dev/null
+++ b/tests/libqos/fw_cfg-pc.h
@@ -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
--
1.8.0
- [Qemu-devel] [RFC PATCH 0/8] libqos support, Anthony Liguori, 2013/03/05
- [Qemu-devel] [RFC PATCH 7/8] libqos: add fw_cfg-pc,
Anthony Liguori <=
- [Qemu-devel] [RFC PATCH 4/8] pci: foreach, Anthony Liguori, 2013/03/05
- [Qemu-devel] [RFC PATCH 8/8] libqos: add malloc, Anthony Liguori, 2013/03/05
- [Qemu-devel] [RFC PATCH 2/8] i440fx-test: add test to compare default register values against spec, Anthony Liguori, 2013/03/05
- [Qemu-devel] [RFC PATCH 3/8] i440fx-test: add test for PAM functionality, Anthony Liguori, 2013/03/05
- [Qemu-devel] [RFC PATCH 6/8] libqos: fw_cfg, Anthony Liguori, 2013/03/05
- [Qemu-devel] [RFC PATCH 1/8] qtest: add libqos, Anthony Liguori, 2013/03/05