1#- 2# Copyright (c) 1998 Doug Rabson 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, this list of conditions and the following disclaimer. 10# 2. Redistributions in binary form must reproduce the above copyright 11# notice, this list of conditions and the following disclaimer in the 12# documentation and/or other materials provided with the distribution. 13# 14# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24# SUCH DAMAGE. 25# 26# $FreeBSD$ 27# 28 29#include <sys/bus.h> 30 31INTERFACE pci; 32 33CODE { 34 static int 35 null_msi_count(device_t dev, device_t child) 36 { 37 return (0); 38 } 39 40 static int 41 null_msix_bar(device_t dev, device_t child) 42 { 43 return (-1); 44 } 45 46 static device_t 47 null_create_iov_child(device_t bus, device_t pf, uint16_t rid, 48 uint16_t vid, uint16_t did) 49 { 50 device_printf(bus, "PCI_IOV not implemented on this bus.\n"); 51 return (NULL); 52 } 53}; 54 55HEADER { 56 struct nvlist; 57} 58 59 60METHOD u_int32_t read_config { 61 device_t dev; 62 device_t child; 63 int reg; 64 int width; 65}; 66 67METHOD void write_config { 68 device_t dev; 69 device_t child; 70 int reg; 71 u_int32_t val; 72 int width; 73}; 74 75METHOD int get_powerstate { 76 device_t dev; 77 device_t child; 78}; 79 80METHOD int set_powerstate { 81 device_t dev; 82 device_t child; 83 int state; 84}; 85 86METHOD int get_vpd_ident { 87 device_t dev; 88 device_t child; 89 const char **identptr; 90}; 91 92METHOD int get_vpd_readonly { 93 device_t dev; 94 device_t child; 95 const char *kw; 96 const char **vptr; 97}; 98 99METHOD int enable_busmaster { 100 device_t dev; 101 device_t child; 102}; 103 104METHOD int disable_busmaster { 105 device_t dev; 106 device_t child; 107}; 108 109METHOD int enable_io { 110 device_t dev; 111 device_t child; 112 int space; 113}; 114 115METHOD int disable_io { 116 device_t dev; 117 device_t child; 118 int space; 119}; 120 121METHOD int assign_interrupt { 122 device_t dev; 123 device_t child; 124}; 125 126METHOD int find_cap { 127 device_t dev; 128 device_t child; 129 int capability; 130 int *capreg; 131}; 132 133METHOD int find_extcap { 134 device_t dev; 135 device_t child; 136 int capability; 137 int *capreg; 138}; 139 140METHOD int find_htcap { 141 device_t dev; 142 device_t child; 143 int capability; 144 int *capreg; 145}; 146 147METHOD int alloc_msi { 148 device_t dev; 149 device_t child; 150 int *count; 151}; 152 153METHOD int alloc_msix { 154 device_t dev; 155 device_t child; 156 int *count; 157}; 158 159METHOD void enable_msi { 160 device_t dev; 161 device_t child; 162 uint64_t address; 163 uint16_t data; 164}; 165 166METHOD void enable_msix { 167 device_t dev; 168 device_t child; 169 u_int index; 170 uint64_t address; 171 uint32_t data; 172}; 173 174METHOD void disable_msi { 175 device_t dev; 176 device_t child; 177}; 178 179METHOD int remap_msix { 180 device_t dev; 181 device_t child; 182 int count; 183 const u_int *vectors; 184}; 185 186METHOD int release_msi { 187 device_t dev; 188 device_t child; 189}; 190 191METHOD int msi_count { 192 device_t dev; 193 device_t child; 194} DEFAULT null_msi_count; 195 196METHOD int msix_count { 197 device_t dev; 198 device_t child; 199} DEFAULT null_msi_count; 200 201METHOD int msix_pba_bar { 202 device_t dev; 203 device_t child; 204} DEFAULT null_msix_bar; 205 206METHOD int msix_table_bar { 207 device_t dev; 208 device_t child; 209} DEFAULT null_msix_bar; 210 211METHOD uint16_t get_rid { 212 device_t dev; 213 device_t child; 214}; 215 216METHOD struct pci_devinfo * alloc_devinfo { 217 device_t dev; 218}; 219 220METHOD void child_added { 221 device_t dev; 222 device_t child; 223}; 224 225METHOD int iov_attach { 226 device_t dev; 227 device_t child; 228 struct nvlist *pf_schema; 229 struct nvlist *vf_schema; 230}; 231 232METHOD int iov_detach { 233 device_t dev; 234 device_t child; 235}; 236 237METHOD device_t create_iov_child { 238 device_t bus; 239 device_t pf; 240 uint16_t rid; 241 uint16_t vid; 242 uint16_t did; 243} DEFAULT null_create_iov_child; 244