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: releng/10.3/sys/dev/pci/pci_if.m 294340 2016-01-19 21:08:31Z jhb $ 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 47 48METHOD u_int32_t read_config { 49 device_t dev; 50 device_t child; 51 int reg; 52 int width; 53}; 54 55METHOD void write_config { 56 device_t dev; 57 device_t child; 58 int reg; 59 u_int32_t val; 60 int width; 61}; 62 63METHOD int get_powerstate { 64 device_t dev; 65 device_t child; 66}; 67 68METHOD int set_powerstate { 69 device_t dev; 70 device_t child; 71 int state; 72}; 73 74METHOD int get_vpd_ident { 75 device_t dev; 76 device_t child; 77 const char **identptr; 78}; 79 80METHOD int get_vpd_readonly { 81 device_t dev; 82 device_t child; 83 const char *kw; 84 const char **vptr; 85}; 86 87METHOD int enable_busmaster { 88 device_t dev; 89 device_t child; 90}; 91 92METHOD int disable_busmaster { 93 device_t dev; 94 device_t child; 95}; 96 97METHOD int enable_io { 98 device_t dev; 99 device_t child; 100 int space; 101}; 102 103METHOD int disable_io { 104 device_t dev; 105 device_t child; 106 int space; 107}; 108 109METHOD int assign_interrupt { 110 device_t dev; 111 device_t child; 112}; 113 114METHOD int find_cap { 115 device_t dev; 116 device_t child; 117 int capability; 118 int *capreg; 119}; 120 121METHOD int find_extcap { 122 device_t dev; 123 device_t child; 124 int capability; 125 int *capreg; 126}; 127 128METHOD int find_htcap { 129 device_t dev; 130 device_t child; 131 int capability; 132 int *capreg; 133}; 134 135METHOD int alloc_msi { 136 device_t dev; 137 device_t child; 138 int *count; 139}; 140 141METHOD int alloc_msix { 142 device_t dev; 143 device_t child; 144 int *count; 145}; 146 147METHOD void enable_msi { 148 device_t dev; 149 device_t child; 150 uint64_t address; 151 uint16_t data; 152}; 153 154METHOD void enable_msix { 155 device_t dev; 156 device_t child; 157 u_int index; 158 uint64_t address; 159 uint32_t data; 160}; 161 162METHOD void disable_msi { 163 device_t dev; 164 device_t child; 165}; 166 167METHOD int remap_msix { 168 device_t dev; 169 device_t child; 170 int count; 171 const u_int *vectors; 172}; 173 174METHOD int release_msi { 175 device_t dev; 176 device_t child; 177}; 178 179METHOD int msi_count { 180 device_t dev; 181 device_t child; 182} DEFAULT null_msi_count; 183 184METHOD int msix_count { 185 device_t dev; 186 device_t child; 187} DEFAULT null_msi_count; 188 189METHOD int msix_pba_bar { 190 device_t dev; 191 device_t child; 192} DEFAULT null_msix_bar; 193 194METHOD int msix_table_bar { 195 device_t dev; 196 device_t child; 197} DEFAULT null_msix_bar; 198 199METHOD uint16_t get_rid { 200 device_t dev; 201 device_t child; 202}; 203 204METHOD void child_added { 205 device_t dev; 206 device_t child; 207}; 208