Deleted Added
full compact
macio.c (157895) macio.c (174782)
1/*-
2 * Copyright 2002 by Peter Grehan. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright 2002 by Peter Grehan. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/powerpc/powermac/macio.c 157895 2006-04-20 04:19:10Z imp $
27 * $FreeBSD: head/sys/powerpc/powermac/macio.c 174782 2007-12-19 18:00:50Z marcel $
28 */
29
30/*
31 * Driver for KeyLargo/Pangea, the MacPPC south bridge ASIC.
32 */
33
34#include <sys/param.h>
35#include <sys/systm.h>

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

364static struct resource *
365macio_alloc_resource(device_t bus, device_t child, int type, int *rid,
366 u_long start, u_long end, u_long count, u_int flags)
367{
368 struct macio_softc *sc;
369 int needactivate;
370 struct resource *rv;
371 struct rman *rm;
28 */
29
30/*
31 * Driver for KeyLargo/Pangea, the MacPPC south bridge ASIC.
32 */
33
34#include <sys/param.h>
35#include <sys/systm.h>

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

364static struct resource *
365macio_alloc_resource(device_t bus, device_t child, int type, int *rid,
366 u_long start, u_long end, u_long count, u_int flags)
367{
368 struct macio_softc *sc;
369 int needactivate;
370 struct resource *rv;
371 struct rman *rm;
372 bus_space_tag_t tagval;
373 u_long adjstart, adjend, adjcount;
374 struct macio_devinfo *dinfo;
375 struct resource_list_entry *rle;
376
377 sc = device_get_softc(bus);
378 dinfo = device_get_ivars(child);
379
380 needactivate = flags & RF_ACTIVE;

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

403 else if (end > rle->end)
404 adjend = rle->end;
405 else
406 adjend = end;
407
408 adjcount = adjend - adjstart;
409
410 rm = &sc->sc_mem_rman;
372 u_long adjstart, adjend, adjcount;
373 struct macio_devinfo *dinfo;
374 struct resource_list_entry *rle;
375
376 sc = device_get_softc(bus);
377 dinfo = device_get_ivars(child);
378
379 needactivate = flags & RF_ACTIVE;

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

402 else if (end > rle->end)
403 adjend = rle->end;
404 else
405 adjend = end;
406
407 adjcount = adjend - adjstart;
408
409 rm = &sc->sc_mem_rman;
411
412 tagval = PPC_BUS_SPACE_MEM;
413 break;
414
415 case SYS_RES_IRQ:
416 rle = resource_list_find(&dinfo->mdi_resources, SYS_RES_IRQ,
417 *rid);
418 if (rle == NULL) {
419 if (dinfo->mdi_ninterrupts >= 5) {
420 device_printf(bus,

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

426 dinfo->mdi_ninterrupts, start, start, 1);
427
428 dinfo->mdi_interrupts[dinfo->mdi_ninterrupts] = start;
429 dinfo->mdi_ninterrupts++;
430 }
431
432 return (resource_list_alloc(&dinfo->mdi_resources, bus, child,
433 type, rid, start, end, count, flags));
410 break;
411
412 case SYS_RES_IRQ:
413 rle = resource_list_find(&dinfo->mdi_resources, SYS_RES_IRQ,
414 *rid);
415 if (rle == NULL) {
416 if (dinfo->mdi_ninterrupts >= 5) {
417 device_printf(bus,

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

423 dinfo->mdi_ninterrupts, start, start, 1);
424
425 dinfo->mdi_interrupts[dinfo->mdi_ninterrupts] = start;
426 dinfo->mdi_ninterrupts++;
427 }
428
429 return (resource_list_alloc(&dinfo->mdi_resources, bus, child,
430 type, rid, start, end, count, flags));
434 break;
435
436 default:
437 device_printf(bus, "unknown resource request from %s\n",
438 device_get_nameunit(child));
439 return (NULL);
440 }
441
442 rv = rman_reserve_resource(rm, adjstart, adjend, adjcount, flags,
443 child);
444 if (rv == NULL) {
445 device_printf(bus,
446 "failed to reserve resource %#lx - %#lx (%#lx) for %s\n",
447 adjstart, adjend, adjcount, device_get_nameunit(child));
448 return (NULL);
449 }
450
451 rman_set_rid(rv, *rid);
431
432 default:
433 device_printf(bus, "unknown resource request from %s\n",
434 device_get_nameunit(child));
435 return (NULL);
436 }
437
438 rv = rman_reserve_resource(rm, adjstart, adjend, adjcount, flags,
439 child);
440 if (rv == NULL) {
441 device_printf(bus,
442 "failed to reserve resource %#lx - %#lx (%#lx) for %s\n",
443 adjstart, adjend, adjcount, device_get_nameunit(child));
444 return (NULL);
445 }
446
447 rman_set_rid(rv, *rid);
452 rman_set_bustag(rv, tagval);
448 rman_set_bustag(rv, &bs_le_tag);
453 rman_set_bushandle(rv, rman_get_start(rv));
454
455 if (needactivate) {
456 if (bus_activate_resource(child, type, *rid, rv) != 0) {
457 device_printf(bus,
458 "failed to activate resource for %s\n",
459 device_get_nameunit(child));
460 rman_release_resource(rv);

--- 82 unchanged lines hidden ---
449 rman_set_bushandle(rv, rman_get_start(rv));
450
451 if (needactivate) {
452 if (bus_activate_resource(child, type, *rid, rv) != 0) {
453 device_printf(bus,
454 "failed to activate resource for %s\n",
455 device_get_nameunit(child));
456 rman_release_resource(rv);

--- 82 unchanged lines hidden ---