19bfb1e36SRyan Stone /*- 2faf139ccSRyan Stone * Copyright (c) 2013-2015 Sandvine Inc. 39bfb1e36SRyan Stone * All rights reserved. 49bfb1e36SRyan Stone * 59bfb1e36SRyan Stone * Redistribution and use in source and binary forms, with or without 69bfb1e36SRyan Stone * modification, are permitted provided that the following conditions 79bfb1e36SRyan Stone * are met: 89bfb1e36SRyan Stone * 1. Redistributions of source code must retain the above copyright 99bfb1e36SRyan Stone * notice, this list of conditions and the following disclaimer. 109bfb1e36SRyan Stone * 2. Redistributions in binary form must reproduce the above copyright 119bfb1e36SRyan Stone * notice, this list of conditions and the following disclaimer in the 129bfb1e36SRyan Stone * documentation and/or other materials provided with the distribution. 139bfb1e36SRyan Stone * 149bfb1e36SRyan Stone * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 159bfb1e36SRyan Stone * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 169bfb1e36SRyan Stone * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 179bfb1e36SRyan Stone * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 189bfb1e36SRyan Stone * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 199bfb1e36SRyan Stone * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 209bfb1e36SRyan Stone * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 219bfb1e36SRyan Stone * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 229bfb1e36SRyan Stone * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 239bfb1e36SRyan Stone * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 249bfb1e36SRyan Stone * SUCH DAMAGE. 259bfb1e36SRyan Stone */ 269bfb1e36SRyan Stone 279bfb1e36SRyan Stone #ifndef _PCI_IOV_PRIVATE_H_ 289bfb1e36SRyan Stone #define _PCI_IOV_PRIVATE_H_ 299bfb1e36SRyan Stone 30e9309eacSRyan Stone struct pci_iov_bar { 31e9309eacSRyan Stone struct resource *res; 32e9309eacSRyan Stone 33e9309eacSRyan Stone pci_addr_t bar_size; 34e9309eacSRyan Stone pci_addr_t bar_shift; 35e9309eacSRyan Stone }; 36e9309eacSRyan Stone 379bfb1e36SRyan Stone struct pcicfg_iov { 38*1f960e64SMark Johnston device_t iov_pf; 399bfb1e36SRyan Stone struct cdev *iov_cdev; 401191f715SRyan Stone nvlist_t *iov_schema; 419bfb1e36SRyan Stone 42e9309eacSRyan Stone struct pci_iov_bar iov_bar[PCIR_MAX_BAR_0 + 1]; 43e9309eacSRyan Stone struct rman rman; 44e9309eacSRyan Stone char rman_name[64]; 45e9309eacSRyan Stone 469bfb1e36SRyan Stone int iov_pos; 479bfb1e36SRyan Stone int iov_num_vfs; 48e9309eacSRyan Stone uint32_t iov_flags; 49e402d55cSJohn Baldwin 50e402d55cSJohn Baldwin uint16_t iov_ctl; 51e402d55cSJohn Baldwin uint32_t iov_page_size; 529bfb1e36SRyan Stone }; 539bfb1e36SRyan Stone 54e9309eacSRyan Stone #define IOV_RMAN_INITED 0x0001 556c3162c4SRyan Stone #define IOV_BUSY 0x0002 56e9309eacSRyan Stone 57e402d55cSJohn Baldwin void pci_iov_cfg_restore(device_t dev, struct pci_devinfo *dinfo); 58e402d55cSJohn Baldwin void pci_iov_cfg_save(device_t dev, struct pci_devinfo *dinfo); 59e402d55cSJohn Baldwin 609bfb1e36SRyan Stone #endif 61