Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Virtio platform device driver
0003  *
0004  * Copyright 2011, ARM Ltd.
0005  *
0006  * Based on Virtio PCI driver by Anthony Liguori, copyright IBM Corp. 2007
0007  *
0008  * This header is BSD licensed so anyone can use the definitions to implement
0009  * compatible drivers/servers.
0010  *
0011  * Redistribution and use in source and binary forms, with or without
0012  * modification, are permitted provided that the following conditions
0013  * are met:
0014  * 1. Redistributions of source code must retain the above copyright
0015  *    notice, this list of conditions and the following disclaimer.
0016  * 2. Redistributions in binary form must reproduce the above copyright
0017  *    notice, this list of conditions and the following disclaimer in the
0018  *    documentation and/or other materials provided with the distribution.
0019  * 3. Neither the name of IBM nor the names of its contributors
0020  *    may be used to endorse or promote products derived from this software
0021  *    without specific prior written permission.
0022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
0023  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0025  * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
0026  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0027  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0028  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0029  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0030  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0031  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0032  * SUCH DAMAGE.
0033  */
0034 
0035 #ifndef _LINUX_VIRTIO_MMIO_H
0036 #define _LINUX_VIRTIO_MMIO_H
0037 
0038 /*
0039  * Control registers
0040  */
0041 
0042 /* Magic value ("virt" string) - Read Only */
0043 #define VIRTIO_MMIO_MAGIC_VALUE     0x000
0044 
0045 /* Virtio device version - Read Only */
0046 #define VIRTIO_MMIO_VERSION     0x004
0047 
0048 /* Virtio device ID - Read Only */
0049 #define VIRTIO_MMIO_DEVICE_ID       0x008
0050 
0051 /* Virtio vendor ID - Read Only */
0052 #define VIRTIO_MMIO_VENDOR_ID       0x00c
0053 
0054 /* Bitmask of the features supported by the device (host)
0055  * (32 bits per set) - Read Only */
0056 #define VIRTIO_MMIO_DEVICE_FEATURES 0x010
0057 
0058 /* Device (host) features set selector - Write Only */
0059 #define VIRTIO_MMIO_DEVICE_FEATURES_SEL 0x014
0060 
0061 /* Bitmask of features activated by the driver (guest)
0062  * (32 bits per set) - Write Only */
0063 #define VIRTIO_MMIO_DRIVER_FEATURES 0x020
0064 
0065 /* Activated features set selector - Write Only */
0066 #define VIRTIO_MMIO_DRIVER_FEATURES_SEL 0x024
0067 
0068 
0069 #ifndef VIRTIO_MMIO_NO_LEGACY /* LEGACY DEVICES ONLY! */
0070 
0071 /* Guest's memory page size in bytes - Write Only */
0072 #define VIRTIO_MMIO_GUEST_PAGE_SIZE 0x028
0073 
0074 #endif
0075 
0076 
0077 /* Queue selector - Write Only */
0078 #define VIRTIO_MMIO_QUEUE_SEL       0x030
0079 
0080 /* Maximum size of the currently selected queue - Read Only */
0081 #define VIRTIO_MMIO_QUEUE_NUM_MAX   0x034
0082 
0083 /* Queue size for the currently selected queue - Write Only */
0084 #define VIRTIO_MMIO_QUEUE_NUM       0x038
0085 
0086 
0087 #ifndef VIRTIO_MMIO_NO_LEGACY /* LEGACY DEVICES ONLY! */
0088 
0089 /* Used Ring alignment for the currently selected queue - Write Only */
0090 #define VIRTIO_MMIO_QUEUE_ALIGN     0x03c
0091 
0092 /* Guest's PFN for the currently selected queue - Read Write */
0093 #define VIRTIO_MMIO_QUEUE_PFN       0x040
0094 
0095 #endif
0096 
0097 
0098 /* Ready bit for the currently selected queue - Read Write */
0099 #define VIRTIO_MMIO_QUEUE_READY     0x044
0100 
0101 /* Queue notifier - Write Only */
0102 #define VIRTIO_MMIO_QUEUE_NOTIFY    0x050
0103 
0104 /* Interrupt status - Read Only */
0105 #define VIRTIO_MMIO_INTERRUPT_STATUS    0x060
0106 
0107 /* Interrupt acknowledge - Write Only */
0108 #define VIRTIO_MMIO_INTERRUPT_ACK   0x064
0109 
0110 /* Device status register - Read Write */
0111 #define VIRTIO_MMIO_STATUS      0x070
0112 
0113 /* Selected queue's Descriptor Table address, 64 bits in two halves */
0114 #define VIRTIO_MMIO_QUEUE_DESC_LOW  0x080
0115 #define VIRTIO_MMIO_QUEUE_DESC_HIGH 0x084
0116 
0117 /* Selected queue's Available Ring address, 64 bits in two halves */
0118 #define VIRTIO_MMIO_QUEUE_AVAIL_LOW 0x090
0119 #define VIRTIO_MMIO_QUEUE_AVAIL_HIGH    0x094
0120 
0121 /* Selected queue's Used Ring address, 64 bits in two halves */
0122 #define VIRTIO_MMIO_QUEUE_USED_LOW  0x0a0
0123 #define VIRTIO_MMIO_QUEUE_USED_HIGH 0x0a4
0124 
0125 /* Shared memory region id */
0126 #define VIRTIO_MMIO_SHM_SEL             0x0ac
0127 
0128 /* Shared memory region length, 64 bits in two halves */
0129 #define VIRTIO_MMIO_SHM_LEN_LOW         0x0b0
0130 #define VIRTIO_MMIO_SHM_LEN_HIGH        0x0b4
0131 
0132 /* Shared memory region base address, 64 bits in two halves */
0133 #define VIRTIO_MMIO_SHM_BASE_LOW        0x0b8
0134 #define VIRTIO_MMIO_SHM_BASE_HIGH       0x0bc
0135 
0136 /* Configuration atomicity value */
0137 #define VIRTIO_MMIO_CONFIG_GENERATION   0x0fc
0138 
0139 /* The config space is defined by each driver as
0140  * the per-driver configuration space - Read Write */
0141 #define VIRTIO_MMIO_CONFIG      0x100
0142 
0143 
0144 
0145 /*
0146  * Interrupt flags (re: interrupt status & acknowledge registers)
0147  */
0148 
0149 #define VIRTIO_MMIO_INT_VRING       (1 << 0)
0150 #define VIRTIO_MMIO_INT_CONFIG      (1 << 1)
0151 
0152 #endif