Deleted Added
full compact
virtio_pci.c (280803) virtio_pci.c (267312)
1/*-
2 * Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.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

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

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/* Driver for the VirtIO PCI interface. */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.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

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

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/* Driver for the VirtIO PCI interface. */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: stable/10/sys/dev/virtio/pci/virtio_pci.c 280803 2015-03-29 07:46:59Z mav $");
30__FBSDID("$FreeBSD: stable/10/sys/dev/virtio/pci/virtio_pci.c 267312 2014-06-10 03:23:35Z bryanv $");
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bus.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/malloc.h>
38
39#include <machine/bus.h>
40#include <machine/resource.h>
41#include <sys/bus.h>
42#include <sys/rman.h>
43
44#include <dev/pci/pcivar.h>
45#include <dev/pci/pcireg.h>
46
47#include <dev/virtio/virtio.h>
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bus.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/malloc.h>
38
39#include <machine/bus.h>
40#include <machine/resource.h>
41#include <sys/bus.h>
42#include <sys/rman.h>
43
44#include <dev/pci/pcivar.h>
45#include <dev/pci/pcireg.h>
46
47#include <dev/virtio/virtio.h>
48#include <dev/virtio/virtio_config.h>
48#include <dev/virtio/virtqueue.h>
49#include <dev/virtio/pci/virtio_pci.h>
50
51#include "virtio_bus_if.h"
52#include "virtio_if.h"
53
54struct vtpci_interrupt {
55 struct resource *vti_irq;

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

164static int vtpci_vq_shared_intr_filter(void *);
165static void vtpci_vq_shared_intr(void *);
166static int vtpci_vq_intr_filter(void *);
167static void vtpci_vq_intr(void *);
168static void vtpci_config_intr(void *);
169
170#define vtpci_setup_msi_interrupt vtpci_setup_legacy_interrupt
171
49#include <dev/virtio/virtqueue.h>
50#include <dev/virtio/pci/virtio_pci.h>
51
52#include "virtio_bus_if.h"
53#include "virtio_if.h"
54
55struct vtpci_interrupt {
56 struct resource *vti_irq;

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

165static int vtpci_vq_shared_intr_filter(void *);
166static void vtpci_vq_shared_intr(void *);
167static int vtpci_vq_intr_filter(void *);
168static void vtpci_vq_intr(void *);
169static void vtpci_config_intr(void *);
170
171#define vtpci_setup_msi_interrupt vtpci_setup_legacy_interrupt
172
172#define VIRTIO_PCI_CONFIG(_sc) \
173 VIRTIO_PCI_CONFIG_OFF((((_sc)->vtpci_flags & VTPCI_FLAG_MSIX)) != 0)
174
175/*
176 * I/O port read/write wrappers.
177 */
178#define vtpci_read_config_1(sc, o) bus_read_1((sc)->vtpci_res, (o))
179#define vtpci_read_config_2(sc, o) bus_read_2((sc)->vtpci_res, (o))
180#define vtpci_read_config_4(sc, o) bus_read_4((sc)->vtpci_res, (o))
181#define vtpci_write_config_1(sc, o, v) bus_write_1((sc)->vtpci_res, (o), (v))
182#define vtpci_write_config_2(sc, o, v) bus_write_2((sc)->vtpci_res, (o), (v))

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

725vtpci_describe_features(struct vtpci_softc *sc, const char *msg,
726 uint64_t features)
727{
728 device_t dev, child;
729
730 dev = sc->vtpci_dev;
731 child = sc->vtpci_child_dev;
732
173/*
174 * I/O port read/write wrappers.
175 */
176#define vtpci_read_config_1(sc, o) bus_read_1((sc)->vtpci_res, (o))
177#define vtpci_read_config_2(sc, o) bus_read_2((sc)->vtpci_res, (o))
178#define vtpci_read_config_4(sc, o) bus_read_4((sc)->vtpci_res, (o))
179#define vtpci_write_config_1(sc, o, v) bus_write_1((sc)->vtpci_res, (o), (v))
180#define vtpci_write_config_2(sc, o, v) bus_write_2((sc)->vtpci_res, (o), (v))

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

723vtpci_describe_features(struct vtpci_softc *sc, const char *msg,
724 uint64_t features)
725{
726 device_t dev, child;
727
728 dev = sc->vtpci_dev;
729 child = sc->vtpci_child_dev;
730
733 if (device_is_attached(child) || bootverbose == 0)
731 if (device_is_attached(child) && bootverbose == 0)
734 return;
735
736 virtio_describe(dev, msg, features, sc->vtpci_child_feat_desc);
737}
738
739static void
740vtpci_probe_and_attach_child(struct vtpci_softc *sc)
741{

--- 588 unchanged lines hidden ---
732 return;
733
734 virtio_describe(dev, msg, features, sc->vtpci_child_feat_desc);
735}
736
737static void
738vtpci_probe_and_attach_child(struct vtpci_softc *sc)
739{

--- 588 unchanged lines hidden ---