xref: /openbmc/qemu/tests/qtest/lpc-ich9-test.c (revision 7c08eefc)
1 /*
2  * QTest testcases for ich9 case
3  *
4  * Copyright (c) 2020 Li Qiang <liq3ea@gmail.com>
5  *
6  * This work is licensed under the terms of the GNU GPL, version 2 or later.
7  * See the COPYING file in the top-level directory.
8  */
9 
10 #include "qemu/osdep.h"
11 
12 #include "libqtest.h"
13 
14 static void test_lp1878642_pci_bus_get_irq_level_assert(void)
15 {
16     QTestState *s;
17 
18     s = qtest_init("-M pc-q35-5.0 "
19                    "-nographic -monitor none -serial none");
20 
21     qtest_outl(s, 0xcf8, 0x8000f840); /* PMBASE */
22     qtest_outl(s, 0xcfc, 0x5d00);
23     qtest_outl(s, 0xcf8, 0x8000f844); /* ACPI_CTRL */
24     qtest_outl(s, 0xcfc, 0xeb);
25     qtest_outw(s, 0x5d02, 0x205d);
26     qtest_quit(s);
27 }
28 
29 int main(int argc, char **argv)
30 {
31     const char *arch = qtest_get_arch();
32 
33     g_test_init(&argc, &argv, NULL);
34 
35     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
36         qtest_add_func("ich9/test_lp1878642_pci_bus_get_irq_level_assert",
37                        test_lp1878642_pci_bus_get_irq_level_assert);
38     }
39 
40     return g_test_run();
41 }
42