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 9 * notice unmodified, this list of conditions, and the following 10 * disclaimer. --- 11 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: head/sys/dev/virtio/pci/virtio_pci.c 252707 2013-07-04 17:57:26Z 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 --- 443 unchanged lines hidden (view full) --- 482 sc = device_get_softc(dev); 483 error = 0; 484 485 if (sc->vtpci_nvqs != 0) 486 return (EALREADY); 487 if (nvqs <= 0 || nvqs > VIRTIO_MAX_VIRTQUEUES) 488 return (EINVAL); 489 |
490 for (idx = 0; idx < nvqs; idx++) { 491 vqx = &sc->vtpci_vqx[idx]; 492 info = &vq_info[idx]; 493 494 vtpci_select_virtqueue(sc, idx); 495 size = vtpci_read_config_2(sc, VIRTIO_PCI_QUEUE_NUM); 496 497 error = virtqueue_alloc(dev, idx, size, VIRTIO_PCI_VRING_ALIGN, --- 778 unchanged lines hidden --- |