Deleted Added
full compact
pci_subr.c (103042) pci_subr.c (106844)
1/*-
2 * Copyright (c) 1994,1995 Stefan Esser, Wolfgang StanglMeier
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 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
1/*-
2 * Copyright (c) 1994,1995 Stefan Esser, Wolfgang StanglMeier
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 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * $FreeBSD: head/sys/dev/pci/pci_pci.c 103042 2002-09-06 22:14:00Z jhb $
30 * $FreeBSD: head/sys/dev/pci/pci_pci.c 106844 2002-11-13 09:42:25Z mdodd $
31 */
32
33/*
34 * PCI:PCI bridge support.
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/kernel.h>
40#include <sys/bus.h>
31 */
32
33/*
34 * PCI:PCI bridge support.
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/kernel.h>
40#include <sys/bus.h>
41#include <sys/sysctl.h>
41
42#include <machine/resource.h>
43
44#include <pci/pcivar.h>
45#include <pci/pcireg.h>
46#include <pci/pcib_private.h>
47
48#include "pcib_if.h"

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

85 sizeof(struct pcib_softc),
86};
87
88devclass_t pcib_devclass;
89
90DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, 0, 0);
91
92/*
42
43#include <machine/resource.h>
44
45#include <pci/pcivar.h>
46#include <pci/pcireg.h>
47#include <pci/pcib_private.h>
48
49#include "pcib_if.h"

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

86 sizeof(struct pcib_softc),
87};
88
89devclass_t pcib_devclass;
90
91DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, 0, 0);
92
93/*
94 * sysctl and tunable vars
95 */
96static int pci_allow_unsupported_io_range = 0;
97TUNABLE_INT("hw.pci.allow_unsupported_io_range",
98 (int *)&pci_allow_unsupported_io_range);
99SYSCTL_DECL(_hw_pci);
100SYSCTL_INT(_hw_pci, OID_AUTO, allow_unsupported_io_range, CTLFLAG_RD,
101 &pci_allow_unsupported_io_range, 0,
102 "Allows the PCI Bridge to pass through an unsupported memory range "
103 "assigned by the BIOS.");
104
105/*
93 * Generic device interface
94 */
95static int
96pcib_probe(device_t dev)
97{
98 if ((pci_get_class(dev) == PCIC_BRIDGE) &&
99 (pci_get_subclass(dev) == PCIS_BRIDGE_PCI)) {
100 device_set_desc(dev, "PCI-PCI bridge");

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

283 /*
284 * Fail the allocation for this range if it's not supported.
285 *
286 * XXX we should probably just fix up the bridge decode and soldier on.
287 */
288 switch (type) {
289 case SYS_RES_IOPORT:
290 if (!pcib_is_isa_io(start)) {
106 * Generic device interface
107 */
108static int
109pcib_probe(device_t dev)
110{
111 if ((pci_get_class(dev) == PCIC_BRIDGE) &&
112 (pci_get_subclass(dev) == PCIS_BRIDGE_PCI)) {
113 device_set_desc(dev, "PCI-PCI bridge");

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

296 /*
297 * Fail the allocation for this range if it's not supported.
298 *
299 * XXX we should probably just fix up the bridge decode and soldier on.
300 */
301 switch (type) {
302 case SYS_RES_IOPORT:
303 if (!pcib_is_isa_io(start)) {
291#ifndef PCI_ALLOW_UNSUPPORTED_IO_RANGE
292 if (start < sc->iobase)
293 start = sc->iobase;
294 if (end > sc->iolimit)
295 end = sc->iolimit;
296 if (end < start)
297 start = 0;
298#else
299 if (start < sc->iobase)
300 printf("start (%lx) < sc->iobase (%x)\n", start, sc->iobase);
301 if (end > sc->iolimit)
302 printf("end (%lx) > sc->iolimit (%x)\n", end, sc->iolimit);
303 if (end < start)
304 printf("end (%lx) < start (%lx)\n", end, start);
305#endif
304 if (!pci_allow_unsupported_io_range) {
305 if (start < sc->iobase)
306 start = sc->iobase;
307 if (end > sc->iolimit)
308 end = sc->iolimit;
309 if (end < start)
310 start = 0;
311 } else {
312 if (start < sc->iobase)
313 printf("start (%lx) < sc->iobase (%x)\n", start,
314 sc->iobase);
315 if (end > sc->iolimit)
316 printf("end (%lx) > sc->iolimit (%x)\n",
317 end, sc->iolimit);
318 if (end < start)
319 printf("end (%lx) < start (%lx)\n", end, start);
320 }
306 }
307 if (!pcib_is_isa_io(start) &&
308 ((start < sc->iobase) || (end > sc->iolimit))) {
309 device_printf(dev, "device %s%d requested unsupported I/O range 0x%lx-0x%lx"
310 " (decoding 0x%x-0x%x)\n",
311 device_get_name(child), device_get_unit(child), start, end,
312 sc->iobase, sc->iolimit);
313 return (NULL);

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

320 /*
321 * XXX will have to decide whether the device making the request is asking
322 * for prefetchable memory or not. If it's coming from another bridge
323 * down the line, do we assume not, or ask the bridge to pass in another
324 * flag as the request bubbles up?
325 */
326 case SYS_RES_MEMORY:
327 if (!pcib_is_isa_mem(start)) {
321 }
322 if (!pcib_is_isa_io(start) &&
323 ((start < sc->iobase) || (end > sc->iolimit))) {
324 device_printf(dev, "device %s%d requested unsupported I/O range 0x%lx-0x%lx"
325 " (decoding 0x%x-0x%x)\n",
326 device_get_name(child), device_get_unit(child), start, end,
327 sc->iobase, sc->iolimit);
328 return (NULL);

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

335 /*
336 * XXX will have to decide whether the device making the request is asking
337 * for prefetchable memory or not. If it's coming from another bridge
338 * down the line, do we assume not, or ask the bridge to pass in another
339 * flag as the request bubbles up?
340 */
341 case SYS_RES_MEMORY:
342 if (!pcib_is_isa_mem(start)) {
328#ifndef PCI_ALLOW_UNSUPPORTED_IO_RANGE
329 if (start < sc->membase && end >= sc->membase)
330 start = sc->membase;
331 if (end > sc->memlimit)
332 end = sc->memlimit;
333 if (end < start)
334 start = 0;
335#else
336 if (start < sc->membase && end > sc->membase)
337 printf("start (%lx) < sc->membase (%x)\n", start, sc->membase);
338 if (end > sc->memlimit)
339 printf("end (%lx) > sc->memlimit (%x)\n", end, sc->memlimit);
340 if (end < start)
341 printf("end (%lx) < start (%lx)\n", end, start);
342#endif
343 if (!pci_allow_unsupported_io_range) {
344 if (start < sc->membase && end >= sc->membase)
345 start = sc->membase;
346 if (end > sc->memlimit)
347 end = sc->memlimit;
348 if (end < start)
349 start = 0;
350 } else {
351 if (start < sc->membase && end > sc->membase)
352 printf("start (%lx) < sc->membase (%x)\n",
353 start, sc->membase);
354 if (end > sc->memlimit)
355 printf("end (%lx) > sc->memlimit (%x)\n",
356 end, sc->memlimit);
357 if (end < start)
358 printf("end (%lx) < start (%lx)\n", end, start);
359 }
343 }
344 if (!pcib_is_isa_mem(start) &&
345 (((start < sc->membase) || (end > sc->memlimit)) &&
346 ((start < sc->pmembase) || (end > sc->pmemlimit)))) {
347 if (bootverbose)
348 device_printf(dev,
349 "device %s%d requested unsupported memory range "
350 "0x%lx-0x%lx (decoding 0x%x-0x%x, 0x%x-0x%x)\n",
351 device_get_name(child), device_get_unit(child), start,
352 end, sc->membase, sc->memlimit, sc->pmembase,
353 sc->pmemlimit);
360 }
361 if (!pcib_is_isa_mem(start) &&
362 (((start < sc->membase) || (end > sc->memlimit)) &&
363 ((start < sc->pmembase) || (end > sc->pmemlimit)))) {
364 if (bootverbose)
365 device_printf(dev,
366 "device %s%d requested unsupported memory range "
367 "0x%lx-0x%lx (decoding 0x%x-0x%x, 0x%x-0x%x)\n",
368 device_get_name(child), device_get_unit(child), start,
369 end, sc->membase, sc->memlimit, sc->pmembase,
370 sc->pmemlimit);
354#ifndef PCI_ALLOW_UNSUPPORTED_IO_RANGE
355 return(NULL);
356#endif
371 if (!pci_allow_unsupported_io_range)
372 return (NULL);
357 }
358 if (bootverbose)
359 device_printf(sc->dev, "device %s%d requested decoded memory range 0x%lx-0x%lx\n",
360 device_get_name(child), device_get_unit(child), start, end);
361 break;
362
363 default:
364 break;

--- 68 unchanged lines hidden ---
373 }
374 if (bootverbose)
375 device_printf(sc->dev, "device %s%d requested decoded memory range 0x%lx-0x%lx\n",
376 device_get_name(child), device_get_unit(child), start, end);
377 break;
378
379 default:
380 break;

--- 68 unchanged lines hidden ---