Marc MarĂ | 0a6ed70 | 2015-02-24 22:21:55 +0100 | [diff] [blame] | 1 | /* |
| 2 | * libqos virtio MMIO definitions |
| 3 | * |
| 4 | * Copyright (c) 2014 Marc MarĂ |
| 5 | * |
| 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. |
| 8 | */ |
| 9 | |
| 10 | #ifndef LIBQOS_VIRTIO_MMIO_H |
| 11 | #define LIBQOS_VIRTIO_MMIO_H |
| 12 | |
| 13 | #include "libqos/virtio.h" |
| 14 | |
| 15 | #define QVIRTIO_MMIO_MAGIC_VALUE 0x000 |
| 16 | #define QVIRTIO_MMIO_VERSION 0x004 |
| 17 | #define QVIRTIO_MMIO_DEVICE_ID 0x008 |
| 18 | #define QVIRTIO_MMIO_VENDOR_ID 0x00C |
| 19 | #define QVIRTIO_MMIO_HOST_FEATURES 0x010 |
| 20 | #define QVIRTIO_MMIO_HOST_FEATURES_SEL 0x014 |
| 21 | #define QVIRTIO_MMIO_GUEST_FEATURES 0x020 |
| 22 | #define QVIRTIO_MMIO_GUEST_FEATURES_SEL 0x024 |
| 23 | #define QVIRTIO_MMIO_GUEST_PAGE_SIZE 0x028 |
| 24 | #define QVIRTIO_MMIO_QUEUE_SEL 0x030 |
| 25 | #define QVIRTIO_MMIO_QUEUE_NUM_MAX 0x034 |
| 26 | #define QVIRTIO_MMIO_QUEUE_NUM 0x038 |
| 27 | #define QVIRTIO_MMIO_QUEUE_ALIGN 0x03C |
| 28 | #define QVIRTIO_MMIO_QUEUE_PFN 0x040 |
| 29 | #define QVIRTIO_MMIO_QUEUE_NOTIFY 0x050 |
| 30 | #define QVIRTIO_MMIO_INTERRUPT_STATUS 0x060 |
| 31 | #define QVIRTIO_MMIO_INTERRUPT_ACK 0x064 |
| 32 | #define QVIRTIO_MMIO_DEVICE_STATUS 0x070 |
| 33 | #define QVIRTIO_MMIO_DEVICE_SPECIFIC 0x100 |
| 34 | |
| 35 | typedef struct QVirtioMMIODevice { |
| 36 | QVirtioDevice vdev; |
| 37 | uint64_t addr; |
| 38 | uint32_t page_size; |
| 39 | uint32_t features; /* As it cannot be read later, save it */ |
| 40 | } QVirtioMMIODevice; |
| 41 | |
| 42 | extern const QVirtioBus qvirtio_mmio; |
| 43 | |
| 44 | QVirtioMMIODevice *qvirtio_mmio_init_device(uint64_t addr, uint32_t page_size); |
| 45 | |
| 46 | #endif |