mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
pc-testdev: add I/O port to test memory.c auto split/combine
The ports at 0xe8..0xeb have impl.min/max_access_size == 1, so that memory accesses are split and combined by the memory core. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1374501278-31549-29-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
e7342aa39b
commit
d2f5ea9704
2 changed files with 117 additions and 0 deletions
|
@ -190,6 +190,100 @@ static void test_endianness(gconstpointer data)
|
|||
g_free(args);
|
||||
}
|
||||
|
||||
static void test_endianness_split(gconstpointer data)
|
||||
{
|
||||
const TestCase *test = data;
|
||||
char *args;
|
||||
|
||||
args = g_strdup_printf("-display none -M %s%s%s -device pc-testdev",
|
||||
test->machine,
|
||||
test->superio ? " -device " : "",
|
||||
test->superio ?: "");
|
||||
qtest_start(args);
|
||||
isa_outl(test, 0xe8, 0x87654321);
|
||||
g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654321);
|
||||
g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765);
|
||||
g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4321);
|
||||
|
||||
isa_outw(test, 0xea, 0x8866);
|
||||
g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x88664321);
|
||||
g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8866);
|
||||
g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4321);
|
||||
|
||||
isa_outw(test, 0xe8, 0x4422);
|
||||
g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x88664422);
|
||||
g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8866);
|
||||
g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4422);
|
||||
|
||||
isa_outb(test, 0xeb, 0x87);
|
||||
g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87664422);
|
||||
g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8766);
|
||||
|
||||
isa_outb(test, 0xea, 0x65);
|
||||
g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654422);
|
||||
g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765);
|
||||
g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4422);
|
||||
|
||||
isa_outb(test, 0xe9, 0x43);
|
||||
g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654322);
|
||||
g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765);
|
||||
g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4322);
|
||||
|
||||
isa_outb(test, 0xe8, 0x21);
|
||||
g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654321);
|
||||
g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765);
|
||||
g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4321);
|
||||
qtest_quit(global_qtest);
|
||||
g_free(args);
|
||||
}
|
||||
|
||||
static void test_endianness_combine(gconstpointer data)
|
||||
{
|
||||
const TestCase *test = data;
|
||||
char *args;
|
||||
|
||||
args = g_strdup_printf("-display none -M %s%s%s -device pc-testdev",
|
||||
test->machine,
|
||||
test->superio ? " -device " : "",
|
||||
test->superio ?: "");
|
||||
qtest_start(args);
|
||||
isa_outl(test, 0xe0, 0x87654321);
|
||||
g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87654321);
|
||||
g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765);
|
||||
g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4321);
|
||||
|
||||
isa_outw(test, 0xe2, 0x8866);
|
||||
g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x88664321);
|
||||
g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8866);
|
||||
g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4321);
|
||||
|
||||
isa_outw(test, 0xe0, 0x4422);
|
||||
g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x88664422);
|
||||
g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8866);
|
||||
g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4422);
|
||||
|
||||
isa_outb(test, 0xe3, 0x87);
|
||||
g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87664422);
|
||||
g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8766);
|
||||
|
||||
isa_outb(test, 0xe2, 0x65);
|
||||
g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87654422);
|
||||
g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765);
|
||||
g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4422);
|
||||
|
||||
isa_outb(test, 0xe1, 0x43);
|
||||
g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87654322);
|
||||
g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765);
|
||||
g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4322);
|
||||
|
||||
isa_outb(test, 0xe0, 0x21);
|
||||
g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87654321);
|
||||
g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765);
|
||||
g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4321);
|
||||
qtest_quit(global_qtest);
|
||||
g_free(args);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *arch = qtest_get_arch();
|
||||
|
@ -206,6 +300,14 @@ int main(int argc, char **argv)
|
|||
path = g_strdup_printf("/%s/endianness/%s",
|
||||
arch, test_cases[i].machine);
|
||||
g_test_add_data_func(path, &test_cases[i], test_endianness);
|
||||
|
||||
path = g_strdup_printf("/%s/endianness/split/%s",
|
||||
arch, test_cases[i].machine);
|
||||
g_test_add_data_func(path, &test_cases[i], test_endianness_split);
|
||||
|
||||
path = g_strdup_printf("/%s/endianness/combine/%s",
|
||||
arch, test_cases[i].machine);
|
||||
g_test_add_data_func(path, &test_cases[i], test_endianness_combine);
|
||||
}
|
||||
|
||||
ret = g_test_run();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue