Deleted Added
sdiff udiff text old ( 253120 ) new ( 253450 )
full compact
1/*-
2 * Copyright (c) 1997, Stefan Esser <se@freebsd.org>
3 * Copyright (c) 2000, Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000, BSDi
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/dev/pci/pci.c 253120 2013-07-09 23:12:26Z marius $");
31
32#include "opt_bus.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/malloc.h>
37#include <sys/module.h>
38#include <sys/linker.h>

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

146
147 DEVMETHOD(bus_get_dma_tag, pci_get_dma_tag),
148 DEVMETHOD(bus_get_resource_list,pci_get_resource_list),
149 DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource),
150 DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
151 DEVMETHOD(bus_delete_resource, pci_delete_resource),
152 DEVMETHOD(bus_alloc_resource, pci_alloc_resource),
153 DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
154 DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource),
155 DEVMETHOD(bus_activate_resource, pci_activate_resource),
156 DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource),
157 DEVMETHOD(bus_child_detached, pci_child_detached),
158 DEVMETHOD(bus_child_pnpinfo_str, pci_child_pnpinfo_str_method),
159 DEVMETHOD(bus_child_location_str, pci_child_location_str_method),
160 DEVMETHOD(bus_remap_intr, pci_remap_intr_method),
161
162 /* PCI interface */

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

4267out:
4268 return (res);
4269}
4270
4271struct resource *
4272pci_alloc_resource(device_t dev, device_t child, int type, int *rid,
4273 u_long start, u_long end, u_long count, u_int flags)
4274{
4275 struct pci_devinfo *dinfo = device_get_ivars(child);
4276 struct resource_list *rl = &dinfo->resources;
4277 struct resource_list_entry *rle;
4278 struct resource *res;
4279 pcicfgregs *cfg = &dinfo->cfg;
4280
4281 if (device_get_parent(child) != dev)
4282 return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child,
4283 type, rid, start, end, count, flags));
4284
4285 /*
4286 * Perform lazy resource allocation
4287 */
4288 switch (type) {
4289 case SYS_RES_IRQ:
4290 /*
4291 * Can't alloc legacy interrupt once MSI messages have
4292 * been allocated.
4293 */
4294 if (*rid == 0 && (cfg->msi.msi_alloc > 0 ||
4295 cfg->msix.msix_alloc > 0))

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

4335 return (NULL);
4336 }
4337 }
4338 return (resource_list_alloc(rl, dev, child, type, rid,
4339 start, end, count, flags));
4340}
4341
4342int
4343pci_activate_resource(device_t dev, device_t child, int type, int rid,
4344 struct resource *r)
4345{
4346 struct pci_devinfo *dinfo;
4347 int error;
4348
4349 error = bus_generic_activate_resource(dev, child, type, rid, r);
4350 if (error)

--- 447 unchanged lines hidden ---