2 * QTest testcase for eepro100 NIC
4 * Copyright (c) 2013-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.
10 #include "qemu/osdep.h"
11 #include "libqos/libqtest.h"
12 #include "qemu/module.h"
13 #include "libqos/qgraph.h"
14 #include "libqos/pci.h"
16 typedef struct QEEPRO100 QEEPRO100
;
23 static const char *models
[] = {
39 static void *eepro100_get_driver(void *obj
, const char *interface
)
41 QEEPRO100
*eepro100
= obj
;
43 if (!g_strcmp0(interface
, "pci-device")) {
44 return &eepro100
->dev
;
47 fprintf(stderr
, "%s not present in eepro100\n", interface
);
48 g_assert_not_reached();
51 static void *eepro100_create(void *pci_bus
, QGuestAllocator
*alloc
, void *addr
)
53 QEEPRO100
*eepro100
= g_new0(QEEPRO100
, 1);
54 QPCIBus
*bus
= pci_bus
;
56 qpci_device_init(&eepro100
->dev
, bus
, addr
);
57 eepro100
->obj
.get_driver
= eepro100_get_driver
;
59 return &eepro100
->obj
;
62 static void eepro100_register_nodes(void)
65 QOSGraphEdgeOptions opts
= {
66 .extra_device_opts
= "addr=04.0",
69 add_qpci_address(&opts
, &(QPCIAddress
) { .devfn
= QPCI_DEVFN(4, 0) });
70 for (i
= 0; i
< ARRAY_SIZE(models
); i
++) {
71 qos_node_create_driver(models
[i
], eepro100_create
);
72 qos_node_consumes(models
[i
], "pci-bus", &opts
);
73 qos_node_produces(models
[i
], "pci-device");
77 libqos_init(eepro100_register_nodes
);