xref: /openbmc/qemu/tests/qtest/ipoctal232-test.c (revision 907b5105)
11e8a1faeSThomas Huth /*
21e8a1faeSThomas Huth  * QTest testcase for IndustryPack Octal-RS232
31e8a1faeSThomas Huth  *
41e8a1faeSThomas Huth  * Copyright (c) 2014 SUSE LINUX Products GmbH
51e8a1faeSThomas Huth  *
61e8a1faeSThomas Huth  * This work is licensed under the terms of the GNU GPL, version 2 or later.
71e8a1faeSThomas Huth  * See the COPYING file in the top-level directory.
81e8a1faeSThomas Huth  */
91e8a1faeSThomas Huth 
101e8a1faeSThomas Huth #include "qemu/osdep.h"
11*907b5105SMarc-André Lureau #include "libqtest.h"
121e8a1faeSThomas Huth #include "qemu/module.h"
131e8a1faeSThomas Huth #include "libqos/qgraph.h"
141e8a1faeSThomas Huth 
151e8a1faeSThomas Huth typedef struct QIpoctal232 QIpoctal232;
161e8a1faeSThomas Huth 
171e8a1faeSThomas Huth struct QIpoctal232 {
181e8a1faeSThomas Huth     QOSGraphObject obj;
191e8a1faeSThomas Huth };
201e8a1faeSThomas Huth 
211e8a1faeSThomas Huth /* Tests only initialization so far. TODO: Replace with functional tests */
nop(void * obj,void * data,QGuestAllocator * alloc)221e8a1faeSThomas Huth static void nop(void *obj, void *data, QGuestAllocator *alloc)
231e8a1faeSThomas Huth {
241e8a1faeSThomas Huth }
251e8a1faeSThomas Huth 
ipoctal232_create(void * pci_bus,QGuestAllocator * alloc,void * addr)261e8a1faeSThomas Huth static void *ipoctal232_create(void *pci_bus, QGuestAllocator *alloc,
271e8a1faeSThomas Huth                                void *addr)
281e8a1faeSThomas Huth {
291e8a1faeSThomas Huth     QIpoctal232 *ipoctal232 = g_new0(QIpoctal232, 1);
301e8a1faeSThomas Huth 
311e8a1faeSThomas Huth     return &ipoctal232->obj;
321e8a1faeSThomas Huth }
331e8a1faeSThomas Huth 
ipoctal232_register_nodes(void)341e8a1faeSThomas Huth static void ipoctal232_register_nodes(void)
351e8a1faeSThomas Huth {
361e8a1faeSThomas Huth     qos_node_create_driver("ipoctal232", ipoctal232_create);
371e8a1faeSThomas Huth     qos_node_consumes("ipoctal232", "ipack", &(QOSGraphEdgeOptions) {
381e8a1faeSThomas Huth         .extra_device_opts = "bus=ipack0.0",
391e8a1faeSThomas Huth     });
401e8a1faeSThomas Huth }
411e8a1faeSThomas Huth 
421e8a1faeSThomas Huth libqos_init(ipoctal232_register_nodes);
431e8a1faeSThomas Huth 
register_ipoctal232_test(void)441e8a1faeSThomas Huth static void register_ipoctal232_test(void)
451e8a1faeSThomas Huth {
461e8a1faeSThomas Huth     qos_add_test("nop", "ipoctal232", nop, NULL);
471e8a1faeSThomas Huth }
481e8a1faeSThomas Huth 
491e8a1faeSThomas Huth libqos_init(register_ipoctal232_test);
50