Print this page
re #13879 make libsqlite a real shared lib (tweaks)
Fix rebuild after pull (remove files left in the way)
Make sqlite.h SQLITE_VERSION more predictable.
OS-5 Integrate virtio drivers
integration cleanup (copyrights, cddl 1.0)
port of illumos-1562
1562 Integrate the virtio core module
Reviewed by: Dmitry Yusupov <Dmitry.Yusupov@nexenta.com>
Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
Approved by: Garrett D'Amore <garrett@damore.org>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/io/virtio/virtioreg.h
+++ new/usr/src/uts/common/io/virtio/virtioreg.h
1 1 /*
2 2 * Copyright (c) 2010 Minoura Makoto.
3 - * Copyright (c) 2012 Nexenta Systems, Inc.
4 - * All rights reserved.
5 3 *
6 4 * Redistribution and use in source and binary forms, with or without
7 5 * modification, are permitted provided that the following conditions
8 6 * are met:
9 7 * 1. Redistributions of source code must retain the above copyright
10 8 * notice, this list of conditions and the following disclaimer.
11 9 * 2. Redistributions in binary form must reproduce the above copyright
12 10 * notice, this list of conditions and the following disclaimer in the
13 11 * documentation and/or other materials provided with the distribution.
14 12 *
15 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 23 */
26 24
27 25 /*
28 26 * Part of the file derived from `Virtio PCI Card Specification v0.8.6 DRAFT'
29 27 * Appendix A.
30 28 */
31 29
32 30 /*
33 31 * An interface for efficient virtio implementation.
34 32 *
35 33 * This header is BSD licensed so anyone can use the definitions
36 34 * to implement compatible drivers/servers.
37 35 *
38 36 * Copyright 2007, 2009, IBM Corporation
39 37 * All rights reserved.
40 38 *
41 39 * Redistribution and use in source and binary forms, with or without
42 40 * modification, are permitted provided that the following conditions
43 41 * are met:
44 42 * 1. Redistributions of source code must retain the above copyright
45 43 * notice, this list of conditions and the following disclaimer.
46 44 * 2. Redistributions in binary form must reproduce the above copyright
47 45 * notice, this list of conditions and the following disclaimer in the
48 46 * documentation and/or other materials provided with the distribution.
49 47 * 3. Neither the name of IBM nor the names of its contributors
50 48 * may be used to endorse or promote products derived from this software
51 49 * without specific prior written permission.
52 50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
53 51 * ``AS IS'' ANDANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
54 52 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
↓ open down ↓ |
40 lines elided |
↑ open up ↑ |
55 53 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
56 54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 60 * SUCH DAMAGE.
63 61 */
64 62
63 +/*
64 + * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
65 + */
65 66
66 67 #ifndef __VIRTIOREG_H__
67 68 #define __VIRTIOREG_H__
68 69
69 70 #include <sys/types.h>
70 71
71 72 #define PCI_VENDOR_QUMRANET 0x1af4
72 73 #define PCI_DEV_VIRTIO_MIN 0x1000
73 74 #define PCI_DEV_VIRTIO_MAX 0x103f
74 75 #define VIRTIO_PCI_ABI_VERSION 0
75 76
76 77 /* Virtio product id (subsystem) */
77 78 #define PCI_PRODUCT_VIRTIO_NETWORK 1
78 79 #define PCI_PRODUCT_VIRTIO_BLOCK 2
79 80 #define PCI_PRODUCT_VIRTIO_CONSOLE 3
80 81 #define PCI_PRODUCT_VIRTIO_ENTROPY 4
81 82 #define PCI_PRODUCT_VIRTIO_BALLOON 5
82 83 #define PCI_PRODUCT_VIRTIO_9P 9
83 84
84 85 /* Virtio header */
85 86 #define VIRTIO_CONFIG_DEVICE_FEATURES 0 /* 32bit */
86 87 #define VIRTIO_CONFIG_GUEST_FEATURES 4 /* 32bit */
87 88
88 89 #define VIRTIO_F_NOTIFY_ON_EMPTY (1<<24)
89 90 #define VIRTIO_F_RING_INDIRECT_DESC (1<<28)
90 91 #define VIRTIO_F_BAD_FEATURE (1<<30)
91 92
92 93 #define VIRTIO_CONFIG_QUEUE_ADDRESS 8 /* 32bit */
93 94 #define VIRTIO_CONFIG_QUEUE_SIZE 12 /* 16bit */
94 95 #define VIRTIO_CONFIG_QUEUE_SELECT 14 /* 16bit */
95 96 #define VIRTIO_CONFIG_QUEUE_NOTIFY 16 /* 16bit */
96 97 #define VIRTIO_CONFIG_DEVICE_STATUS 18 /* 8bit */
97 98
98 99 #define VIRTIO_CONFIG_DEVICE_STATUS_RESET 0
99 100 #define VIRTIO_CONFIG_DEVICE_STATUS_ACK 1
100 101 #define VIRTIO_CONFIG_DEVICE_STATUS_DRIVER 2
101 102 #define VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK 4
102 103 #define VIRTIO_CONFIG_DEVICE_STATUS_FAILED 128
103 104
104 105 #define VIRTIO_CONFIG_ISR_STATUS 19 /* 8bit */
105 106 #define VIRTIO_CONFIG_ISR_CONFIG_CHANGE 2
106 107
107 108 #define VIRTIO_CONFIG_CONFIG_VECTOR 20 /* 16bit, optional */
108 109 #define VIRTIO_CONFIG_QUEUE_VECTOR 22
109 110
110 111 #define VIRTIO_CONFIG_DEVICE_CONFIG_NOMSIX 20
111 112 #define VIRTIO_CONFIG_DEVICE_CONFIG_MSIX 24
112 113
113 114 #define VIRTIO_MSI_NO_VECTOR 0xffff
114 115
115 116 /* Virtqueue */
116 117 /* This marks a buffer as continuing via the next field. */
117 118 #define VRING_DESC_F_NEXT 1
118 119 /*
119 120 * This marks a buffer as write-only, from the devices's perspective.
120 121 * (otherwise read-only).
121 122 */
122 123 #define VRING_DESC_F_WRITE 2
123 124 /* This means the buffer contains a list of buffer descriptors. */
124 125 #define VRING_DESC_F_INDIRECT 4
125 126
126 127 /*
127 128 * The Host uses this in used->flags to advise the Guest: don't kick me
128 129 * when you add a buffer. It's unreliable, so it's simply an
129 130 * optimization. Guest will still kick if it's out of buffers.
130 131 */
131 132 #define VRING_USED_F_NO_NOTIFY 1
132 133 /*
133 134 * The Guest uses this in avail->flags to advise the Host: don't
134 135 * interrupt me when you consume a buffer. It's unreliable, so it's
135 136 * simply an optimization.
136 137 */
137 138 #define VRING_AVAIL_F_NO_INTERRUPT 1
138 139
139 140 /*
140 141 * Virtio ring descriptors: 16 bytes.
141 142 * These can chain together via "next".
142 143 */
143 144 struct vring_desc {
144 145 /* Address (guest-physical). */
145 146 uint64_t addr;
146 147 /* Length. */
147 148 uint32_t len;
148 149 /* The flags as indicated above. */
149 150 uint16_t flags;
150 151 /* We chain unused descriptors via this, too */
151 152 uint16_t next;
152 153 } __attribute__((packed));
153 154
154 155 struct vring_avail {
155 156 uint16_t flags;
156 157 uint16_t idx;
157 158 uint16_t ring[];
158 159 } __attribute__((packed));
159 160
160 161 /* u32 is used here for ids for padding reasons. */
161 162 struct vring_used_elem {
162 163 /* Index of start of used descriptor chain. */
163 164 uint32_t id;
164 165 /* Total length of the descriptor chain which was written to. */
165 166 uint32_t len;
166 167 } __attribute__((packed));
167 168
168 169 struct vring_used {
169 170 uint16_t flags;
170 171 uint16_t idx;
171 172 struct vring_used_elem ring[];
172 173 } __attribute__((packed));
173 174
174 175
175 176 /* Got nothing to do with the system page size, just a confusing name. */
176 177 #define VIRTIO_PAGE_SIZE (4096)
177 178
178 179 #endif /* __VIRTIOREG_H__ */
|
↓ open down ↓ |
104 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX