xref: /openbmc/qemu/tests/qtest/libqos/virtio-mmio.h (revision 8e49197c)
11cf4323eSThomas Huth /*
21cf4323eSThomas Huth  * libqos virtio MMIO definitions
31cf4323eSThomas Huth  *
41cf4323eSThomas Huth  * Copyright (c) 2014 Marc Marí
51cf4323eSThomas Huth  *
61cf4323eSThomas Huth  * This work is licensed under the terms of the GNU GPL, version 2 or later.
71cf4323eSThomas Huth  * See the COPYING file in the top-level directory.
81cf4323eSThomas Huth  */
91cf4323eSThomas Huth 
101cf4323eSThomas Huth #ifndef LIBQOS_VIRTIO_MMIO_H
111cf4323eSThomas Huth #define LIBQOS_VIRTIO_MMIO_H
121cf4323eSThomas Huth 
13*a2ce7dbdSPaolo Bonzini #include "virtio.h"
14*a2ce7dbdSPaolo Bonzini #include "qgraph.h"
151cf4323eSThomas Huth 
161cf4323eSThomas Huth #define QVIRTIO_MMIO_MAGIC_VALUE        0x000
171cf4323eSThomas Huth #define QVIRTIO_MMIO_VERSION            0x004
181cf4323eSThomas Huth #define QVIRTIO_MMIO_DEVICE_ID          0x008
191cf4323eSThomas Huth #define QVIRTIO_MMIO_VENDOR_ID          0x00C
201cf4323eSThomas Huth #define QVIRTIO_MMIO_HOST_FEATURES      0x010
211cf4323eSThomas Huth #define QVIRTIO_MMIO_HOST_FEATURES_SEL  0x014
221cf4323eSThomas Huth #define QVIRTIO_MMIO_GUEST_FEATURES     0x020
231cf4323eSThomas Huth #define QVIRTIO_MMIO_GUEST_FEATURES_SEL 0x024
241cf4323eSThomas Huth #define QVIRTIO_MMIO_GUEST_PAGE_SIZE    0x028
251cf4323eSThomas Huth #define QVIRTIO_MMIO_QUEUE_SEL          0x030
261cf4323eSThomas Huth #define QVIRTIO_MMIO_QUEUE_NUM_MAX      0x034
271cf4323eSThomas Huth #define QVIRTIO_MMIO_QUEUE_NUM          0x038
281cf4323eSThomas Huth #define QVIRTIO_MMIO_QUEUE_ALIGN        0x03C
291cf4323eSThomas Huth #define QVIRTIO_MMIO_QUEUE_PFN          0x040
301cf4323eSThomas Huth #define QVIRTIO_MMIO_QUEUE_NOTIFY       0x050
311cf4323eSThomas Huth #define QVIRTIO_MMIO_INTERRUPT_STATUS   0x060
321cf4323eSThomas Huth #define QVIRTIO_MMIO_INTERRUPT_ACK      0x064
331cf4323eSThomas Huth #define QVIRTIO_MMIO_DEVICE_STATUS      0x070
341cf4323eSThomas Huth #define QVIRTIO_MMIO_DEVICE_SPECIFIC    0x100
351cf4323eSThomas Huth 
361cf4323eSThomas Huth typedef struct QVirtioMMIODevice {
371cf4323eSThomas Huth     QOSGraphObject obj;
381cf4323eSThomas Huth     QVirtioDevice vdev;
391cf4323eSThomas Huth     QTestState *qts;
401cf4323eSThomas Huth     uint64_t addr;
411cf4323eSThomas Huth     uint32_t page_size;
421cf4323eSThomas Huth     uint32_t features; /* As it cannot be read later, save it */
431cf4323eSThomas Huth     uint32_t version;
441cf4323eSThomas Huth } QVirtioMMIODevice;
451cf4323eSThomas Huth 
461cf4323eSThomas Huth extern const QVirtioBus qvirtio_mmio;
471cf4323eSThomas Huth 
481cf4323eSThomas Huth void qvirtio_mmio_init_device(QVirtioMMIODevice *dev, QTestState *qts,
491cf4323eSThomas Huth                               uint64_t addr, uint32_t page_size);
501cf4323eSThomas Huth 
511cf4323eSThomas Huth #endif
52