]>
Commit | Line | Data |
---|---|---|
1c7955c4 PX |
1 | /* |
2 | * QEMU emulation of common X86 IOMMU | |
3 | * | |
4 | * Copyright (C) 2016 Peter Xu, Red Hat <[email protected]> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | ||
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | ||
16 | * You should have received a copy of the GNU General Public License along | |
17 | * with this program; if not, see <http://www.gnu.org/licenses/>. | |
18 | */ | |
19 | ||
20 | #include "qemu/osdep.h" | |
21 | #include "hw/sysbus.h" | |
22 | #include "hw/boards.h" | |
23 | #include "hw/i386/x86-iommu.h" | |
24 | ||
25 | static void x86_iommu_realize(DeviceState *dev, Error **errp) | |
26 | { | |
27 | X86IOMMUClass *x86_class = X86_IOMMU_GET_CLASS(dev); | |
28 | if (x86_class->realize) { | |
29 | x86_class->realize(dev, errp); | |
30 | } | |
31 | } | |
32 | ||
33 | static void x86_iommu_class_init(ObjectClass *klass, void *data) | |
34 | { | |
35 | DeviceClass *dc = DEVICE_CLASS(klass); | |
36 | dc->realize = x86_iommu_realize; | |
37 | } | |
38 | ||
39 | static const TypeInfo x86_iommu_info = { | |
40 | .name = TYPE_X86_IOMMU_DEVICE, | |
41 | .parent = TYPE_SYS_BUS_DEVICE, | |
42 | .instance_size = sizeof(X86IOMMUState), | |
43 | .class_init = x86_iommu_class_init, | |
44 | .class_size = sizeof(X86IOMMUClass), | |
45 | .abstract = true, | |
46 | }; | |
47 | ||
48 | static void x86_iommu_register_types(void) | |
49 | { | |
50 | type_register_static(&x86_iommu_info); | |
51 | } | |
52 | ||
53 | type_init(x86_iommu_register_types) |