Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/gehenna-devsw]: src/sys * Add "pcitag_t *pba_bridgetag" to pci_attach_ar...



details:   https://anonhg.NetBSD.org/src/rev/fdb0df837993
branches:  gehenna-devsw
changeset: 527026:fdb0df837993
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu May 16 01:01:31 2002 +0000

description:
* Add "pcitag_t *pba_bridgetag" to pci_attach_args.  This is set to
  NULL for root PCI busses.  For busses behind a bridge, it points to
  a persistent copy of the bridge's pcitag_t.  This can be very useful
  for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
  uses OFW device nodes to enumerate the bus.  When a PCI bus that is
  behind a bridge is attached, pci_attach_hook() allocates a new PCI
  chipset tag for the new bus and sets it's "curnode" to the OFW node
  of the bridge.  This is used as a starting point when enumerating
  that bus.  Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.

diffstat:

 sys/arch/cobalt/dev/gt.c               |  104 ++++++
 sys/arch/dreamcast/dev/g2/gapspci.c    |  152 +++++++++
 sys/arch/evbmips/malta/dev/gt.c        |  226 +++++++++++++
 sys/arch/hpcmips/vr/vrc4172pci.c       |  396 ++++++++++++++++++++++++
 sys/arch/hpcmips/vr/vrpciu.c           |  533 +++++++++++++++++++++++++++++++++
 sys/arch/macppc/pci/bandit.c           |  247 +++++++++++++++
 sys/arch/macppc/pci/grackle.c          |  185 +++++++++++
 sys/arch/macppc/pci/uninorth.c         |  240 ++++++++++++++
 sys/arch/mvmeppc/mvmeppc/mainbus.c     |  145 ++++++++
 sys/arch/prep/prep/mainbus.c           |  180 +++++++++++
 sys/arch/sandpoint/sandpoint/mainbus.c |  173 ++++++++++
 sys/arch/sgimips/pci/macepci.c         |  231 ++++++++++++++
 sys/arch/sparc64/conf/kern.ldscript    |  138 ++++++++
 sys/arch/sparc64/conf/kern32.ldscript  |  139 ++++++++
 sys/arch/x86_64/x86_64/mainbus.c       |  143 ++++++++
 sys/dev/pci/ppb.c                      |  150 +++++++++
 16 files changed, 3382 insertions(+), 0 deletions(-)

diffs (truncated from 3446 to 300 lines):

diff -r d14c022cf0fb -r fdb0df837993 sys/arch/cobalt/dev/gt.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/cobalt/dev/gt.c  Thu May 16 01:01:31 2002 +0000
@@ -0,0 +1,104 @@
+/*     $NetBSD: gt.c,v 1.5.2.2 2002/05/16 01:01:36 thorpej Exp $       */
+
+/*
+ * Copyright (c) 2000 Soren S. Jorvang.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/ioctl.h>
+#include <sys/select.h>
+#include <sys/tty.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/conf.h>
+#include <sys/file.h>
+#include <sys/uio.h>
+#include <sys/kernel.h>
+#include <sys/syslog.h>
+#include <sys/types.h>
+#include <sys/device.h>
+
+#include <machine/intr.h>
+#include <machine/bus.h>
+
+#include <dev/pci/pcivar.h>
+#include "pci.h"
+
+struct gt_softc {
+       struct device   sc_dev;
+};
+
+static int     gt_match(struct device *, struct cfdata *, void *);
+static void    gt_attach(struct device *, struct device *, void *);
+static int     gt_print(void *aux, const char *pnp);
+
+struct cfattach gt_ca = {
+       sizeof(struct gt_softc), gt_match, gt_attach
+};
+
+static int
+gt_match(parent, match, aux)
+       struct device *parent;
+       struct cfdata *match;
+       void *aux;
+{
+       return 1;
+}
+
+static void
+gt_attach(parent, self, aux)
+       struct device *parent;
+       struct device *self;
+       void *aux;
+{
+       struct pcibus_attach_args pba;
+
+       printf("\n");
+
+       /* XXX */
+       *((volatile u_int32_t *)0xb4000c00) =
+               (*((volatile u_int32_t *)0xb4000c00) & ~0x6) | 0x2;
+
+#if NPCI > 0
+       pba.pba_busname = "pci";
+       pba.pba_dmat = &pci_bus_dma_tag;
+       pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
+       pba.pba_bus = 0;
+       pba.pba_bridgetag = NULL;
+       pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
+               PCI_FLAGS_MRL_OKAY | /*PCI_FLAGS_MRM_OKAY|*/ PCI_FLAGS_MWI_OKAY;
+       config_found(self, &pba, gt_print);
+#endif
+       return;
+}
+
+static int
+gt_print(aux, pnp)
+       void *aux;
+       const char *pnp;
+{
+       /* XXX */
+       return 0;
+}
diff -r d14c022cf0fb -r fdb0df837993 sys/arch/dreamcast/dev/g2/gapspci.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/dreamcast/dev/g2/gapspci.c       Thu May 16 01:01:31 2002 +0000
@@ -0,0 +1,152 @@
+/*     $NetBSD: gapspci.c,v 1.3.2.2 2002/05/16 01:01:36 thorpej Exp $  */
+
+/*-
+ * Copyright (c) 2001 Marcus Comstedt
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by Marcus Comstedt.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/conf.h>
+#include <sys/mbuf.h>
+
+#include <machine/cpu.h>
+#include <machine/bus.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+
+#include <dev/pci/pcidevs.h>
+
+#include <dreamcast/dev/g2/g2busvar.h>
+#include <dreamcast/dev/g2/gapspcivar.h>
+
+int    gaps_match(struct device *, struct cfdata *, void *);
+void   gaps_attach(struct device *, struct device *, void *);
+
+int    gaps_print(void *, const char *);
+
+struct cfattach gapspci_ca = {
+       sizeof(struct gaps_softc), 
+       gaps_match,
+       gaps_attach,
+};
+
+int
+gaps_match(struct device *parent, struct cfdata *match, void *aux)
+{
+       struct g2bus_attach_args *ga = aux;
+       char idbuf[16];
+       bus_space_handle_t tmp_memh;
+
+       if(strcmp("gapspci", match->cf_driver->cd_name))
+               return 0;
+
+       if (bus_space_map(ga->ga_memt, 0x01001400, 0x100, 0, &tmp_memh) != 0)
+               return 0;
+
+       bus_space_read_region_1(ga->ga_memt, tmp_memh, 0,
+                               idbuf, sizeof(idbuf));
+
+       bus_space_unmap(ga->ga_memt, tmp_memh, 0x100);
+
+       if(strncmp(idbuf, "GAPSPCI_BRIDGE_2", 16))
+               return 0;
+
+       return (1);
+}
+
+void
+gaps_attach(struct device *parent, struct device *self, void *aux)
+{
+       struct g2bus_attach_args *ga = aux;
+       struct gaps_softc *sc = (void *) self;
+       struct pcibus_attach_args pba;
+       int i;
+
+       printf(": SEGA GAPS PCI Bridge\n");
+
+       sc->sc_memt = ga->ga_memt;
+
+       sc->sc_dmabase = 0x1840000;
+       sc->sc_dmasize = 32768;
+
+       if (bus_space_map(sc->sc_memt, 0x01001400, 0x100,
+                         0, &sc->sc_gaps_memh) != 0)
+               panic("gaps_attach: can't map GAPS register space");
+
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x18, 0x5a14a501);
+
+       for(i=0; i<1000000; i++)
+         ;
+       
+       if(bus_space_read_4(sc->sc_memt, sc->sc_gaps_memh, 0x18) != 1)
+               panic("gaps_attach: GAPS PCI bridge not responding");
+
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x20, 0x1000000);
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x24, 0x1000000);
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x28, sc->sc_dmabase);
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x2c,
+                         sc->sc_dmabase + sc->sc_dmasize);
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x14, 1);
+       bus_space_write_4(sc->sc_memt, sc->sc_gaps_memh, 0x34, 1);
+
+       gaps_pci_init(sc);
+       gaps_dma_init(sc);
+
+       memset(&pba, 0, sizeof(pba));
+
+       pba.pba_busname = "pci";
+       pba.pba_memt = sc->sc_memt;
+       pba.pba_dmat = &sc->sc_dmat;
+       pba.pba_bus = 0;
+       pba.pba_bridgetag = NULL;
+       pba.pba_flags = PCI_FLAGS_MEM_ENABLED;
+       pba.pba_pc = &sc->sc_pc;
+
+       (void) config_found(self, &pba, gaps_print);
+}
+
+int
+gaps_print(void *aux, const char *pnp)
+{
+       struct pcibus_attach_args *pba = aux;
+
+       if (pnp)
+               printf("%s at %s", pba->pba_busname, pnp);
+       printf(" bus %d", pba->pba_bus);
+
+       return (UNCONF);
+}
diff -r d14c022cf0fb -r fdb0df837993 sys/arch/evbmips/malta/dev/gt.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbmips/malta/dev/gt.c   Thu May 16 01:01:31 2002 +0000
@@ -0,0 +1,226 @@
+/*     $NetBSD: gt.c,v 1.2.2.2 2002/05/16 01:01:37 thorpej Exp $       */
+
+/*
+ * Copyright 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe and Simon Burge for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN



Home | Main Index | Thread Index | Old Index