Deleted Added
full compact
psycho.c (93066) psycho.c (93067)
1/*
2 * Copyright (c) 1999, 2000 Matthew R. Green
3 * All rights reserved.
4 * Copyright 2001 by Thomas Moestl <tmm@FreeBSD.org>. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * from: NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp
30 *
1/*
2 * Copyright (c) 1999, 2000 Matthew R. Green
3 * All rights reserved.
4 * Copyright 2001 by Thomas Moestl <tmm@FreeBSD.org>. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * from: NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp
30 *
31 * $FreeBSD: head/sys/sparc64/pci/psycho.c 93066 2002-03-24 01:51:29Z tmm $
31 * $FreeBSD: head/sys/sparc64/pci/psycho.c 93067 2002-03-24 02:11:06Z tmm $
32 */
33
34/*
35 * Support for `psycho' and `psycho+' UPA to PCI bridge and
36 * UltraSPARC IIi and IIe `sabre' PCI controllers.
37 */
38
39#include "opt_psycho.h"

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

473 sc->sc_dmat->dmamap_load = psycho_dmamap_load;
474 sc->sc_dmat->dmamap_unload = psycho_dmamap_unload;
475 sc->sc_dmat->dmamap_sync = psycho_dmamap_sync;
476 sc->sc_dmat->dmamem_alloc = psycho_dmamem_alloc;
477 sc->sc_dmat->dmamem_free = psycho_dmamem_free;
478 /* XXX: register as root dma tag (kluge). */
479 sparc64_root_dma_tag = sc->sc_dmat;
480
32 */
33
34/*
35 * Support for `psycho' and `psycho+' UPA to PCI bridge and
36 * UltraSPARC IIi and IIe `sabre' PCI controllers.
37 */
38
39#include "opt_psycho.h"

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

473 sc->sc_dmat->dmamap_load = psycho_dmamap_load;
474 sc->sc_dmat->dmamap_unload = psycho_dmamap_unload;
475 sc->sc_dmat->dmamap_sync = psycho_dmamap_sync;
476 sc->sc_dmat->dmamem_alloc = psycho_dmamem_alloc;
477 sc->sc_dmat->dmamem_free = psycho_dmamem_free;
478 /* XXX: register as root dma tag (kluge). */
479 sparc64_root_dma_tag = sc->sc_dmat;
480
481 if ((sc->sc_nintrmap = OF_getprop_alloc(sc->sc_node, "interrupt-map",
482 sizeof(*sc->sc_intrmap), (void **)&sc->sc_intrmap)) == -1 ||
483 OF_getprop(sc->sc_node, "interrupt-map-mask", &sc->sc_intrmapmsk,
484 sizeof(sc->sc_intrmapmsk)) == -1) {
485 if (sc->sc_intrmap != NULL) {
486 free(sc->sc_intrmap, M_OFWPROP);
487 sc->sc_intrmap = NULL;
488 }
489 }
490
491 /* Register the softc, this is needed for paired psychos. */
492 if (psycho_ndevs < sizeof(psycho_softcs) / sizeof(psycho_softcs[0]))
493 psycho_softcs[psycho_ndevs] = sc;
494 else
495 device_printf(dev, "XXX: bump the number of psycho_softcs");
496 psycho_ndevs++;
497 /*
498 * And finally, if we're a sabre or the first of a pair of psycho's to

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

612 /*
613 * Initialize the interrupt registers of all devices hanging from
614 * the host bridge directly or indirectly via PCI-PCI bridges.
615 * The MI code (and the PCI spec) assume that this is done during
616 * system initialization, however the firmware does not do this
617 * at least on some models, and we probably shouldn't trust that
618 * the firmware uses the same model as this driver if it does.
619 */
481 /* Register the softc, this is needed for paired psychos. */
482 if (psycho_ndevs < sizeof(psycho_softcs) / sizeof(psycho_softcs[0]))
483 psycho_softcs[psycho_ndevs] = sc;
484 else
485 device_printf(dev, "XXX: bump the number of psycho_softcs");
486 psycho_ndevs++;
487 /*
488 * And finally, if we're a sabre or the first of a pair of psycho's to

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

602 /*
603 * Initialize the interrupt registers of all devices hanging from
604 * the host bridge directly or indirectly via PCI-PCI bridges.
605 * The MI code (and the PCI spec) assume that this is done during
606 * system initialization, however the firmware does not do this
607 * at least on some models, and we probably shouldn't trust that
608 * the firmware uses the same model as this driver if it does.
609 */
620 ofw_pci_init_intr(dev, sc->sc_node, sc->sc_intrmap, sc->sc_nintrmap,
621 &sc->sc_intrmapmsk);
610 ofw_pci_init_intr(dev, sc->sc_node);
622
623 device_add_child(dev, "pci", device_get_unit(dev));
624 return (bus_generic_attach(dev));
625}
626
627static void
628psycho_set_intr(struct psycho_softc *sc, int index,
629 device_t dev, bus_addr_t map, int iflags, driver_intr_t handler)

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

961 default:
962 panic("psycho_write_config: bad width");
963 }
964}
965
966static int
967psycho_route_interrupt(device_t bus, device_t dev, int pin)
968{
611
612 device_add_child(dev, "pci", device_get_unit(dev));
613 return (bus_generic_attach(dev));
614}
615
616static void
617psycho_set_intr(struct psycho_softc *sc, int index,
618 device_t dev, bus_addr_t map, int iflags, driver_intr_t handler)

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

950 default:
951 panic("psycho_write_config: bad width");
952 }
953}
954
955static int
956psycho_route_interrupt(device_t bus, device_t dev, int pin)
957{
958 int intline;
969
970 /*
959
960 /*
971 * Since we preinitialize all interrupt line registers, this should not
972 * happen for any built-in device.
973 * Devices on bridges that route interrupts cannot work now - the
974 * interrupt pin mappings are not known from the firmware...
961 * XXX: ugly loathsome hack:
962 * We can't use ofw_pci_route_intr() here; the device passed may be
963 * the one of a bridge, so the original device can't be recovered.
964 *
965 * We need to use the firmware to route interrupts, however it has
966 * no interface which could be used to interpret intpins; instead,
967 * all assignments are done by device.
968 *
969 * The MI pci code will try to reroute interrupts of 0, although they
970 * are correct; all other interrupts are preinitialized, so if we
971 * get here, the intline is either 0 (so return 0), or we hit a
972 * device which was not preinitialized (e.g. hotplugged stuff), in
973 * which case we are lost.
975 */
974 */
976 panic("psycho_route_interrupt");
975 return (0);
977}
978
979static int
980psycho_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
981{
982 struct psycho_softc *sc;
983
984 sc = (struct psycho_softc *)device_get_softc(dev);

--- 359 unchanged lines hidden ---
976}
977
978static int
979psycho_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
980{
981 struct psycho_softc *sc;
982
983 sc = (struct psycho_softc *)device_get_softc(dev);

--- 359 unchanged lines hidden ---