4 * Copyright (c) 2011 Linaro Limited
7 * Peter Maydell <peter.maydell@linaro.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, see <http://www.gnu.org/licenses/>.
22 #ifndef HW_VIRTIO_MMIO_H
23 #define HW_VIRTIO_MMIO_H
25 #include "hw/virtio/virtio-bus.h"
26 #include "qom/object.h"
30 #define TYPE_VIRTIO_MMIO_BUS "virtio-mmio-bus"
31 #define VIRTIO_MMIO_BUS(obj) \
32 OBJECT_CHECK(VirtioBusState, (obj), TYPE_VIRTIO_MMIO_BUS)
33 #define VIRTIO_MMIO_BUS_GET_CLASS(obj) \
34 OBJECT_GET_CLASS(VirtioBusClass, (obj), TYPE_VIRTIO_MMIO_BUS)
35 #define VIRTIO_MMIO_BUS_CLASS(klass) \
36 OBJECT_CLASS_CHECK(VirtioBusClass, (klass), TYPE_VIRTIO_MMIO_BUS)
39 #define TYPE_VIRTIO_MMIO "virtio-mmio"
40 typedef struct VirtIOMMIOProxy VirtIOMMIOProxy
;
41 #define VIRTIO_MMIO(obj) \
42 OBJECT_CHECK(VirtIOMMIOProxy, (obj), TYPE_VIRTIO_MMIO)
44 #define VIRT_MAGIC 0x74726976 /* 'virt' */
45 #define VIRT_VERSION 2
46 #define VIRT_VERSION_LEGACY 1
47 #define VIRT_VENDOR 0x554D4551 /* 'QEMU' */
49 typedef struct VirtIOMMIOQueue
{
57 struct VirtIOMMIOProxy
{
59 SysBusDevice parent_obj
;
63 /* Guest accessible state needing migration and reset */
64 uint32_t host_features_sel
;
65 uint32_t guest_features_sel
;
66 uint32_t guest_page_shift
;
69 bool format_transport_address
;
70 /* Fields only used for non-legacy (v2) devices */
71 uint32_t guest_features
[2];
72 VirtIOMMIOQueue vqs
[VIRTIO_QUEUE_MAX
];