[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 08/12] boot-order-test: Code motion for better re
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH v4 08/12] boot-order-test: Code motion for better readability |
Date: |
Wed, 26 Jun 2013 15:52:19 +0200 |
Cc: Andreas Färber <address@hidden>
Cc: Alexander Graf <address@hidden>
Cc: address@hidden
Signed-off-by: Markus Armbruster <address@hidden>
---
tests/boot-order-test.c | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/tests/boot-order-test.c b/tests/boot-order-test.c
index 78249fc..c711c71 100644
--- a/tests/boot-order-test.c
+++ b/tests/boot-order-test.c
@@ -15,19 +15,15 @@
#include "libqos/fw_cfg.h"
#include "libqtest.h"
-static uint8_t read_mc146818(uint16_t port, uint8_t reg)
-{
- outb(port, reg);
- return inb(port + 1);
-}
-
-static uint64_t read_boot_order_pc(void)
-{
- uint8_t b1 = read_mc146818(0x70, 0x38);
- uint8_t b2 = read_mc146818(0x70, 0x3d);
+#define NO_QEMU_PROTOS
+#include "hw/nvram/fw_cfg.h"
+#undef NO_QEMU_PROTOS
- return b1 | (b2 << 8);
-}
+typedef struct {
+ const char *args;
+ uint64_t expected_boot;
+ uint64_t expected_reboot;
+} boot_order_test;
static void test_a_boot_order(const char *machine,
const char *test_args,
@@ -57,12 +53,6 @@ static void test_a_boot_order(const char *machine,
g_free(args);
}
-typedef struct {
- const char *args;
- uint64_t expected_boot;
- uint64_t expected_reboot;
-} boot_order_test;
-
static void test_boot_orders(const char *machine,
uint64_t (*read_boot_order)(void),
const boot_order_test *tests)
@@ -77,6 +67,20 @@ static void test_boot_orders(const char *machine,
}
}
+static uint8_t read_mc146818(uint16_t port, uint8_t reg)
+{
+ outb(port, reg);
+ return inb(port + 1);
+}
+
+static uint64_t read_boot_order_pc(void)
+{
+ uint8_t b1 = read_mc146818(0x70, 0x38);
+ uint8_t b2 = read_mc146818(0x70, 0x3d);
+
+ return b1 | (b2 << 8);
+}
+
static const boot_order_test test_cases_pc[] = {
{ "",
0x1230, 0x1230 },
@@ -108,10 +112,6 @@ static void test_pc_boot_order(void)
test_boot_orders(NULL, read_boot_order_pc, test_cases_pc);
}
-#define NO_QEMU_PROTOS
-#include "hw/nvram/fw_cfg.h"
-#undef NO_QEMU_PROTOS
-
static uint64_t read_boot_order_pmac(void)
{
QFWCFG *fw_cfg = mm_fw_cfg_init(0xf0000510);
--
1.7.11.7
- [Qemu-devel] [PATCH v4 00/12] Boot order tests, Markus Armbruster, 2013/06/26
- [Qemu-devel] [PATCH v4 03/12] libqos: include dependencies, Markus Armbruster, 2013/06/26
- [Qemu-devel] [PATCH v4 09/12] boot-order-test: Add tests for PowerPC PREP, Markus Armbruster, 2013/06/26
- [Qemu-devel] [PATCH v4 10/12] boot-order-test: Add tests for Sun4m, Markus Armbruster, 2013/06/26
- [Qemu-devel] [PATCH v4 02/12] boot-order-test: New; covering just PC for now, Markus Armbruster, 2013/06/26
- [Qemu-devel] [PATCH v4 05/12] boot-order-test: Add tests for PowerMacs, Markus Armbruster, 2013/06/26
- [Qemu-devel] [PATCH v4 01/12] qtest: Don't reset on qtest chardev connect, Markus Armbruster, 2013/06/26
- [Qemu-devel] [PATCH v4 04/12] libqos: Add support for memory-mapped fw_cfg, Markus Armbruster, 2013/06/26
- [Qemu-devel] [PATCH v4 11/12] libqos: Generalize I/O-mapped fw_cfg, Markus Armbruster, 2013/06/26
- [Qemu-devel] [PATCH v4 08/12] boot-order-test: Code motion for better readability,
Markus Armbruster <=
- [Qemu-devel] [PATCH v4 06/12] boot-order-test: Cover -boot once in ppc tests, Markus Armbruster, 2013/06/26
- [Qemu-devel] [PATCH v4 12/12] boot-order-test: Add tests for Sun4u, Markus Armbruster, 2013/06/26
- [Qemu-devel] [PATCH v4 07/12] boot-order-test: Better separate target-specific and generic parts, Markus Armbruster, 2013/06/26