boot-order-test: Code motion for better readability
Cc: Andreas Färber <afaerber@suse.de> Cc: Alexander Graf <agraf@suse.de> Cc: qemu-ppc@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372254743-15808-9-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
aea6a16907
commit
484986e242
@ -15,19 +15,15 @@
|
|||||||
#include "libqos/fw_cfg.h"
|
#include "libqos/fw_cfg.h"
|
||||||
#include "libqtest.h"
|
#include "libqtest.h"
|
||||||
|
|
||||||
static uint8_t read_mc146818(uint16_t port, uint8_t reg)
|
#define NO_QEMU_PROTOS
|
||||||
{
|
#include "hw/nvram/fw_cfg.h"
|
||||||
outb(port, reg);
|
#undef NO_QEMU_PROTOS
|
||||||
return inb(port + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint64_t read_boot_order_pc(void)
|
typedef struct {
|
||||||
{
|
const char *args;
|
||||||
uint8_t b1 = read_mc146818(0x70, 0x38);
|
uint64_t expected_boot;
|
||||||
uint8_t b2 = read_mc146818(0x70, 0x3d);
|
uint64_t expected_reboot;
|
||||||
|
} boot_order_test;
|
||||||
return b1 | (b2 << 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_a_boot_order(const char *machine,
|
static void test_a_boot_order(const char *machine,
|
||||||
const char *test_args,
|
const char *test_args,
|
||||||
@ -57,12 +53,6 @@ static void test_a_boot_order(const char *machine,
|
|||||||
g_free(args);
|
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,
|
static void test_boot_orders(const char *machine,
|
||||||
uint64_t (*read_boot_order)(void),
|
uint64_t (*read_boot_order)(void),
|
||||||
const boot_order_test *tests)
|
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[] = {
|
static const boot_order_test test_cases_pc[] = {
|
||||||
{ "",
|
{ "",
|
||||||
0x1230, 0x1230 },
|
0x1230, 0x1230 },
|
||||||
@ -108,10 +112,6 @@ static void test_pc_boot_order(void)
|
|||||||
test_boot_orders(NULL, read_boot_order_pc, test_cases_pc);
|
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)
|
static uint64_t read_boot_order_pmac(void)
|
||||||
{
|
{
|
||||||
QFWCFG *fw_cfg = mm_fw_cfg_init(0xf0000510);
|
QFWCFG *fw_cfg = mm_fw_cfg_init(0xf0000510);
|
||||||
|
Loading…
Reference in New Issue
Block a user