tcg/tests: target/mips: Amend MSA integer multiply tests
[qemu/ar7.git] / tests / ac97-test.c
blobb084e31bff5ffd05caf58a8be29d85a9db619d7b
1 /*
2 * QTest testcase for AC97
4 * Copyright (c) 2014 SUSE LINUX Products GmbH
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 */
10 #include "qemu/osdep.h"
11 #include "libqtest.h"
12 #include "qemu/module.h"
13 #include "libqos/qgraph.h"
14 #include "libqos/pci.h"
16 typedef struct QAC97 QAC97;
18 struct QAC97 {
19 QOSGraphObject obj;
20 QPCIDevice dev;
23 static void *ac97_get_driver(void *obj, const char *interface)
25 QAC97 *ac97 = obj;
27 if (!g_strcmp0(interface, "pci-device")) {
28 return &ac97->dev;
31 fprintf(stderr, "%s not present in e1000e\n", interface);
32 g_assert_not_reached();
35 static void *ac97_create(void *pci_bus, QGuestAllocator *alloc, void *addr)
37 QAC97 *ac97 = g_new0(QAC97, 1);
38 QPCIBus *bus = pci_bus;
40 qpci_device_init(&ac97->dev, bus, addr);
41 ac97->obj.get_driver = ac97_get_driver;
42 return &ac97->obj;
45 static void ac97_register_nodes(void)
47 QOSGraphEdgeOptions opts = {
48 .extra_device_opts = "addr=04.0",
50 add_qpci_address(&opts, &(QPCIAddress) { .devfn = QPCI_DEVFN(4, 0) });
52 qos_node_create_driver("AC97", ac97_create);
53 qos_node_produces("AC97", "pci-device");
54 qos_node_consumes("AC97", "pci-bus", &opts);
57 libqos_init(ac97_register_nodes);