From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Urq9E-0004EB-9K for qemu-devel@nongnu.org; Wed, 26 Jun 2013 09:52:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Urq98-0007Fj-NM for qemu-devel@nongnu.org; Wed, 26 Jun 2013 09:52:36 -0400 From: Markus Armbruster Date: Wed, 26 Jun 2013 15:52:19 +0200 Message-Id: <1372254743-15808-9-git-send-email-armbru@redhat.com> In-Reply-To: <1372254743-15808-1-git-send-email-armbru@redhat.com> References: <1372254743-15808-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v4 08/12] boot-order-test: Code motion for better readability List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, jan.kiszka@siemens.com, mjt@tls.msk.ru, Alexander Graf , alex.williamson@redhat.com, qemu-ppc@nongnu.org, aviksil@linux.vnet.ibm.com, afaerber@suse.de Cc: Andreas F=C3=A4rber Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Signed-off-by: Markus Armbruster --- 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" =20 -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 =3D read_mc146818(0x70, 0x38); - uint8_t b2 =3D read_mc146818(0x70, 0x3d); +#define NO_QEMU_PROTOS +#include "hw/nvram/fw_cfg.h" +#undef NO_QEMU_PROTOS =20 - return b1 | (b2 << 8); -} +typedef struct { + const char *args; + uint64_t expected_boot; + uint64_t expected_reboot; +} boot_order_test; =20 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); } =20 -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, } } =20 +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 =3D read_mc146818(0x70, 0x38); + uint8_t b2 =3D read_mc146818(0x70, 0x3d); + + return b1 | (b2 << 8); +} + static const boot_order_test test_cases_pc[] =3D { { "", 0x1230, 0x1230 }, @@ -108,10 +112,6 @@ static void test_pc_boot_order(void) test_boot_orders(NULL, read_boot_order_pc, test_cases_pc); } =20 -#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 =3D mm_fw_cfg_init(0xf0000510); --=20 1.7.11.7