| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: virtiovar.h,v 1.1 2011/10/30 12:12:21 hannken Exp $ */ | | 1 | /* $NetBSD: virtiovar.h,v 1.2 2013/12/06 02:39:58 yamt Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2010 Minoura Makoto. | | 4 | * Copyright (c) 2010 Minoura Makoto. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -136,49 +136,26 @@ struct virtio_softc { | | | @@ -136,49 +136,26 @@ struct virtio_softc { |
136 | bool sc_indirect; | | 136 | bool sc_indirect; |
137 | | | 137 | |
138 | int sc_nvqs; /* set by child */ | | 138 | int sc_nvqs; /* set by child */ |
139 | struct virtqueue *sc_vqs; /* set by child */ | | 139 | struct virtqueue *sc_vqs; /* set by child */ |
140 | | | 140 | |
141 | int sc_childdevid; | | 141 | int sc_childdevid; |
142 | device_t sc_child; /* set by child */ | | 142 | device_t sc_child; /* set by child */ |
143 | int (*sc_config_change)(struct virtio_softc*); | | 143 | int (*sc_config_change)(struct virtio_softc*); |
144 | /* set by child */ | | 144 | /* set by child */ |
145 | int (*sc_intrhand)(struct virtio_softc*); | | 145 | int (*sc_intrhand)(struct virtio_softc*); |
146 | /* set by child */ | | 146 | /* set by child */ |
147 | }; | | 147 | }; |
148 | | | 148 | |
149 | /* The standard layout for the ring is a continuous chunk of memory which | | | |
150 | * looks like this. We assume num is a power of 2. | | | |
151 | * | | | |
152 | * struct vring { | | | |
153 | * // The actual descriptors (16 bytes each) | | | |
154 | * struct vring_desc desc[num]; | | | |
155 | * | | | |
156 | * // A ring of available descriptor heads with free-running index. | | | |
157 | * __u16 avail_flags; | | | |
158 | * __u16 avail_idx; | | | |
159 | * __u16 available[num]; | | | |
160 | * | | | |
161 | * // Padding to the next align boundary. | | | |
162 | * char pad[]; | | | |
163 | * | | | |
164 | * // A ring of used descriptor heads with free-running index. | | | |
165 | * __u16 used_flags; | | | |
166 | * __u16 used_idx; | | | |
167 | * struct vring_used_elem used[num]; | | | |
168 | * }; | | | |
169 | * Note: for virtio PCI, align is 4096. | | | |
170 | */ | | | |
171 | | | | |
172 | /* public interface */ | | 149 | /* public interface */ |
173 | uint32_t virtio_negotiate_features(struct virtio_softc*, uint32_t); | | 150 | uint32_t virtio_negotiate_features(struct virtio_softc*, uint32_t); |
174 | | | 151 | |
175 | uint8_t virtio_read_device_config_1(struct virtio_softc *, int); | | 152 | uint8_t virtio_read_device_config_1(struct virtio_softc *, int); |
176 | uint16_t virtio_read_device_config_2(struct virtio_softc *, int); | | 153 | uint16_t virtio_read_device_config_2(struct virtio_softc *, int); |
177 | uint32_t virtio_read_device_config_4(struct virtio_softc *, int); | | 154 | uint32_t virtio_read_device_config_4(struct virtio_softc *, int); |
178 | uint64_t virtio_read_device_config_8(struct virtio_softc *, int); | | 155 | uint64_t virtio_read_device_config_8(struct virtio_softc *, int); |
179 | void virtio_write_device_config_1(struct virtio_softc *, int, uint8_t); | | 156 | void virtio_write_device_config_1(struct virtio_softc *, int, uint8_t); |
180 | void virtio_write_device_config_2(struct virtio_softc *, int, uint16_t); | | 157 | void virtio_write_device_config_2(struct virtio_softc *, int, uint16_t); |
181 | void virtio_write_device_config_4(struct virtio_softc *, int, uint32_t); | | 158 | void virtio_write_device_config_4(struct virtio_softc *, int, uint32_t); |
182 | void virtio_write_device_config_8(struct virtio_softc *, int, uint64_t); | | 159 | void virtio_write_device_config_8(struct virtio_softc *, int, uint64_t); |
183 | | | 160 | |
184 | int virtio_alloc_vq(struct virtio_softc*, struct virtqueue*, int, int, int, | | 161 | int virtio_alloc_vq(struct virtio_softc*, struct virtqueue*, int, int, int, |