Deleted Added
full compact
virtio.c (227652) virtio.c (238360)
1/*-
2 * Copyright (c) 2011, Bryan Venteicher <bryanv@daemoninthecloset.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2011, Bryan Venteicher <bryanv@daemoninthecloset.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/virtio/virtio.c 227652 2011-11-18 05:43:43Z grehan $");
28__FBSDID("$FreeBSD: head/sys/dev/virtio/virtio.c 238360 2012-07-11 02:57:19Z grehan $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kernel.h>
33#include <sys/malloc.h>
34#include <sys/module.h>
35#include <sys/sbuf.h>
36

--- 44 unchanged lines hidden (view full) ---

81 for (ident = virtio_ident_table; ident->name != NULL; ident++) {
82 if (ident->devid == devid)
83 return (ident->name);
84 }
85
86 return (NULL);
87}
88
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kernel.h>
33#include <sys/malloc.h>
34#include <sys/module.h>
35#include <sys/sbuf.h>
36

--- 44 unchanged lines hidden (view full) ---

81 for (ident = virtio_ident_table; ident->name != NULL; ident++) {
82 if (ident->devid == devid)
83 return (ident->name);
84 }
85
86 return (NULL);
87}
88
89int
90virtio_get_device_type(device_t dev)
91{
92 uintptr_t devtype;
93
94 devtype = -1;
95
96 BUS_READ_IVAR(device_get_parent(dev), dev,
97 VIRTIO_IVAR_DEVTYPE, &devtype);
98
99 return ((int) devtype);
100}
101
102void
89void
103virtio_set_feature_desc(device_t dev,
104 struct virtio_feature_desc *feature_desc)
105{
106
107 BUS_WRITE_IVAR(device_get_parent(dev), dev,
108 VIRTIO_IVAR_FEATURE_DESC, (uintptr_t) feature_desc);
109}
110
111void
112virtio_describe(device_t dev, const char *msg,
113 uint64_t features, struct virtio_feature_desc *feature_desc)
114{
115 struct sbuf sb;
116 uint64_t val;
117 char *buf;
118 const char *name;
119 int n;

--- 59 unchanged lines hidden (view full) ---

179
180 return (NULL);
181}
182
183/*
184 * VirtIO bus method wrappers.
185 */
186
90virtio_describe(device_t dev, const char *msg,
91 uint64_t features, struct virtio_feature_desc *feature_desc)
92{
93 struct sbuf sb;
94 uint64_t val;
95 char *buf;
96 const char *name;
97 int n;

--- 59 unchanged lines hidden (view full) ---

157
158 return (NULL);
159}
160
161/*
162 * VirtIO bus method wrappers.
163 */
164
165void
166virtio_read_ivar(device_t dev, int ivar, uintptr_t *val)
167{
168
169 *val = -1;
170 BUS_READ_IVAR(device_get_parent(dev), dev, ivar, val);
171}
172
173void
174virtio_write_ivar(device_t dev, int ivar, uintptr_t val)
175{
176
177 BUS_WRITE_IVAR(device_get_parent(dev), dev, ivar, val);
178}
179
187uint64_t
188virtio_negotiate_features(device_t dev, uint64_t child_features)
189{
190
191 return (VIRTIO_BUS_NEGOTIATE_FEATURES(device_get_parent(dev),
192 child_features));
193}
194

--- 89 unchanged lines hidden ---
180uint64_t
181virtio_negotiate_features(device_t dev, uint64_t child_features)
182{
183
184 return (VIRTIO_BUS_NEGOTIATE_FEATURES(device_get_parent(dev),
185 child_features));
186}
187

--- 89 unchanged lines hidden ---