xref: /openbmc/qemu/tests/qtest/ipoctal232-test.c (revision 1e8a1fae)
1*1e8a1faeSThomas Huth /*
2*1e8a1faeSThomas Huth  * QTest testcase for IndustryPack Octal-RS232
3*1e8a1faeSThomas Huth  *
4*1e8a1faeSThomas Huth  * Copyright (c) 2014 SUSE LINUX Products GmbH
5*1e8a1faeSThomas Huth  *
6*1e8a1faeSThomas Huth  * This work is licensed under the terms of the GNU GPL, version 2 or later.
7*1e8a1faeSThomas Huth  * See the COPYING file in the top-level directory.
8*1e8a1faeSThomas Huth  */
9*1e8a1faeSThomas Huth 
10*1e8a1faeSThomas Huth #include "qemu/osdep.h"
11*1e8a1faeSThomas Huth #include "libqtest.h"
12*1e8a1faeSThomas Huth #include "qemu/module.h"
13*1e8a1faeSThomas Huth #include "libqos/qgraph.h"
14*1e8a1faeSThomas Huth 
15*1e8a1faeSThomas Huth typedef struct QIpoctal232 QIpoctal232;
16*1e8a1faeSThomas Huth 
17*1e8a1faeSThomas Huth struct QIpoctal232 {
18*1e8a1faeSThomas Huth     QOSGraphObject obj;
19*1e8a1faeSThomas Huth };
20*1e8a1faeSThomas Huth 
21*1e8a1faeSThomas Huth /* Tests only initialization so far. TODO: Replace with functional tests */
22*1e8a1faeSThomas Huth static void nop(void *obj, void *data, QGuestAllocator *alloc)
23*1e8a1faeSThomas Huth {
24*1e8a1faeSThomas Huth }
25*1e8a1faeSThomas Huth 
26*1e8a1faeSThomas Huth static void *ipoctal232_create(void *pci_bus, QGuestAllocator *alloc,
27*1e8a1faeSThomas Huth                                void *addr)
28*1e8a1faeSThomas Huth {
29*1e8a1faeSThomas Huth     QIpoctal232 *ipoctal232 = g_new0(QIpoctal232, 1);
30*1e8a1faeSThomas Huth 
31*1e8a1faeSThomas Huth     return &ipoctal232->obj;
32*1e8a1faeSThomas Huth }
33*1e8a1faeSThomas Huth 
34*1e8a1faeSThomas Huth static void ipoctal232_register_nodes(void)
35*1e8a1faeSThomas Huth {
36*1e8a1faeSThomas Huth     qos_node_create_driver("ipoctal232", ipoctal232_create);
37*1e8a1faeSThomas Huth     qos_node_consumes("ipoctal232", "ipack", &(QOSGraphEdgeOptions) {
38*1e8a1faeSThomas Huth         .extra_device_opts = "bus=ipack0.0",
39*1e8a1faeSThomas Huth     });
40*1e8a1faeSThomas Huth }
41*1e8a1faeSThomas Huth 
42*1e8a1faeSThomas Huth libqos_init(ipoctal232_register_nodes);
43*1e8a1faeSThomas Huth 
44*1e8a1faeSThomas Huth static void register_ipoctal232_test(void)
45*1e8a1faeSThomas Huth {
46*1e8a1faeSThomas Huth     qos_add_test("nop", "ipoctal232", nop, NULL);
47*1e8a1faeSThomas Huth }
48*1e8a1faeSThomas Huth 
49*1e8a1faeSThomas Huth libqos_init(register_ipoctal232_test);
50