linux-user: Add strace support for printing arguments of some clock and time functions
[qemu/ar7.git] / tests / qtest / libqos / arm-n800-machine.c
blobff2049c3a7eb38410cee411376058c8d337a5526
1 /*
2 * libqos driver framework
4 * Copyright (c) 2019 Red Hat, Inc.
6 * Author: Paolo Bonzini <pbonzini@redhat.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1 as published by the Free Software Foundation.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, see <http://www.gnu.org/licenses/>
21 #include "qemu/osdep.h"
22 #include "libqtest.h"
23 #include "malloc.h"
24 #include "qgraph.h"
25 #include "i2c.h"
27 #define ARM_PAGE_SIZE 4096
28 #define N800_RAM_START 0x80000000
29 #define N800_RAM_END 0x88000000
31 typedef struct QN800Machine QN800Machine;
33 struct QN800Machine {
34 QOSGraphObject obj;
35 QGuestAllocator alloc;
36 OMAPI2C i2c_1;
39 static void *n800_get_driver(void *object, const char *interface)
41 QN800Machine *machine = object;
42 if (!g_strcmp0(interface, "memory")) {
43 return &machine->alloc;
46 fprintf(stderr, "%s not present in arm/n800\n", interface);
47 g_assert_not_reached();
50 static QOSGraphObject *n800_get_device(void *obj, const char *device)
52 QN800Machine *machine = obj;
53 if (!g_strcmp0(device, "omap_i2c")) {
54 return &machine->i2c_1.obj;
57 fprintf(stderr, "%s not present in arm/n800\n", device);
58 g_assert_not_reached();
61 static void n800_destructor(QOSGraphObject *obj)
63 QN800Machine *machine = (QN800Machine *) obj;
64 alloc_destroy(&machine->alloc);
67 static void *qos_create_machine_arm_n800(QTestState *qts)
69 QN800Machine *machine = g_new0(QN800Machine, 1);
71 alloc_init(&machine->alloc, 0,
72 N800_RAM_START,
73 N800_RAM_END,
74 ARM_PAGE_SIZE);
75 machine->obj.get_device = n800_get_device;
76 machine->obj.get_driver = n800_get_driver;
77 machine->obj.destructor = n800_destructor;
79 omap_i2c_init(&machine->i2c_1, qts, 0x48070000);
80 return &machine->obj;
83 static void n800_register_nodes(void)
85 QOSGraphEdgeOptions edge = {
86 .extra_device_opts = "bus=i2c-bus.0"
88 qos_node_create_machine("arm/n800", qos_create_machine_arm_n800);
89 qos_node_contains("arm/n800", "omap_i2c", &edge, NULL);
92 libqos_init(n800_register_nodes);