Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64 PCI overhaul.



details:   https://anonhg.NetBSD.org/src/rev/251afebeb9a1
branches:  trunk
changeset: 512979:251afebeb9a1
user:      eeh <eeh%NetBSD.org@localhost>
date:      Fri Jul 20 00:07:12 2001 +0000

description:
PCI overhaul.

diffstat:

 sys/arch/sparc64/conf/GENERIC32        |  127 ++++-
 sys/arch/sparc64/dev/ebus.c            |  134 +---
 sys/arch/sparc64/dev/ebusvar.h         |    5 +-
 sys/arch/sparc64/dev/iommu.c           |   32 +-
 sys/arch/sparc64/dev/iommureg.h        |   21 +-
 sys/arch/sparc64/dev/iommuvar.h        |    4 +-
 sys/arch/sparc64/dev/pci_machdep.c     |  506 +++++++++-----------
 sys/arch/sparc64/dev/psycho.c          |  816 +++++++++++++++-----------------
 sys/arch/sparc64/dev/psychoreg.h       |    8 +-
 sys/arch/sparc64/dev/psychovar.h       |    7 +-
 sys/arch/sparc64/dev/sbus.c            |    4 +-
 sys/arch/sparc64/dev/simba.c           |  154 ------
 sys/arch/sparc64/include/openfirm.h    |    6 +-
 sys/arch/sparc64/include/pci_machdep.h |   23 +-
 sys/arch/sparc64/sparc64/ofw_machdep.c |  212 ++++++++-
 15 files changed, 1048 insertions(+), 1011 deletions(-)

diffs (truncated from 2798 to 300 lines):

diff -r 01a94e5986dd -r 251afebeb9a1 sys/arch/sparc64/conf/GENERIC32
--- a/sys/arch/sparc64/conf/GENERIC32   Thu Jul 19 23:59:51 2001 +0000
+++ b/sys/arch/sparc64/conf/GENERIC32   Fri Jul 20 00:07:12 2001 +0000
@@ -1,8 +1,8 @@
-#      $NetBSD: GENERIC32,v 1.17 2001/07/10 15:42:42 matt Exp $
+#      $NetBSD: GENERIC32,v 1.18 2001/07/20 00:07:12 eeh Exp $
 
 include "arch/sparc64/conf/std.sparc64"
 
-#ident                 "GENERIC-$Revision: 1.17 $"
+#ident                 "GENERIC-$Revision: 1.18 $"
 
 maxusers       64
 
@@ -197,9 +197,13 @@
 #upa0  at mainbus0                             # Ultra 1E, Ultra 2, Ex0000
 psycho*        at mainbus0                             # Darwin, Ultra5
 pci*   at psycho?
-pci*   at simba?
-simba* at pci? dev ? function ?                # `APB' support.
+pci*   at ppb?
+ppb*   at pci? dev ? function ?                # `APB' support.
+#pci*  at simba?
+#simba*        at pci? dev ? function ?                # `APB' support.
 ebus*  at pci?                                 # ebus devices
+# XXX 'puc's aren't really bridges, but there's no better place for them here
+puc*   at pci? dev ? function ?                # PCI "universal" comm. cards
 
 #### Standard system devices -- all required for a given architecture
 
@@ -244,6 +248,11 @@
 kbd0   at com?                                 # keyboard
 ms0    at com?                                 # mouse
 
+# PCI serial interfaces
+com*   at puc? port ?                  # 16x50s on "universal" comm boards
+cy*    at pci? dev ? function ?        # Cyclades Cyclom-Y serial boards
+cz*    at pci? dev ? function ?        # Cyclades-Z multi-port serial boards
+
 #### Disk controllers and disks
 
 ## The following flags may be set for the NCR53c94 based esp driver:
@@ -270,6 +279,16 @@
 siop*  at pci?                                 # 53C875 "glm" compatible
 scsibus* at siop?
 
+# PCI SCSI controllers (untested)
+adv*   at pci? dev ? function ?        # AdvanSys 1200[A,B], 9xx[U,UA] SCSI
+adw*   at pci? dev ? function ?        # AdvanSys 9x0UW[D], 3940U[2,3]W SCSI
+ahc*   at pci? dev ? function ?        # Adaptec [23]94x, aic78x0 SCSI
+bha*   at pci? dev ? function ?        # BusLogic 9xx SCSI
+dpt*   at pci? dev ? function ?        # DPT SmartCache/SmartRAID
+pcscp* at pci? dev ? function ?        # AMD 53c974 PCscsi-PCI SCSI
+
+scsibus* at scsi?
+
 ## These entries find devices on all SCSI busses and assign
 ## unit numbers dynamically.
 sd*    at scsibus? target ? lun ?              # SCSI disks
@@ -282,13 +301,22 @@
 
 # PCI IDE.
 pciide* at pci ? dev ? function ? flags 0x0000
-wd*     at pciide? channel ? drive ? flags 0x0000
+wd*     at pciide? channel ? drive ? flags 0x0000 #flags 0x0ff0
 atapibus* at pciide? channel ?
 
 cd*    at atapibus? drive ? flags 0x0000       # ATAPI CD-ROM drives
 sd*    at atapibus? drive ? flags 0x0000       # ATAPI disk drives
 uk*    at atapibus? drive ? flags 0x0000       # ATAPI unknown
 
+# RAID controllers and devices (untested)
+cac*   at pci? dev ? function ?        # Compaq PCI array controllers
+mlx*   at pci? dev ? function ?        # Mylex DAC960 & DEC SWXCR family
+twe*   at pci? dev ? function ?        # 3ware Escalade RAID controllers
+
+ld*    at cac? unit ?                  # logical disk devices
+ld*    at twe? unit ?
+ld*    at mlx? unit ?
+
 ## Floppy controller and drive found on SPARCstations.
 
 # need share with the sparc, and everyone else.  needs to use auxio.
@@ -340,26 +368,85 @@
 hme*           at sbus? slot ? offset ?
 hme*           at pci? dev ? function ?        # network "hme" compatible
 
-## Davicom 9102 (as used in Netra X1)
-tlp*           at pci? dev ? function ?        # supported by `tulip' driver
-
-# MII/PHY support
-# XXX: only nsphy "tested"
-exphy*         at mii? phy ?           # 3Com internal PHYs
-icsphy*                at mii? phy ?           # Integrated Circuit Systems ICS1890
-inphy*         at mii? phy ?           # Intel 82555 PHYs
-lxtphy*                at mii? phy ?           # Level One LXT-970 PHYs
-nsphy*         at mii? phy ?           # NS83840 PHYs
-qsphy*         at mii? phy ?           # Quality Semiconductor QS6612 PHYs
-sqphy*         at mii? phy ?           # Seeq 80220/80221/80223 PHYs
-tlphy*         at mii? phy ?           # ThunderLAN PHYs
-ukphy*         at mii? phy ?           # generic unknown PHYs
-
 ## qec/be, qec/hme
 qec*           at sbus? slot ? offset ?
 be*            at qec?
 qe*            at qec?
 
+# PCI network interfaces
+#      UT marks untested.
+an*    at pci? dev ? function ?        # Aironet PC4500/PC4800 (802.11) UT
+de*    at pci? dev ? function ?        # DEC 21x4x-based Ethernet UT
+en*    at pci? dev ? function ?        # ENI/Adaptec ATM UT
+# XXX causes ICE
+#ep*   at pci? dev ? function ?        # 3Com 3c59x
+ex*    at pci? dev ? function ?        # 3Com 90x[B] UT
+epic*  at pci? dev ? function ?        # SMC EPIC/100 Ethernet UT
+esh*   at pci? dev ? function ?        # Essential HIPPI card UT
+fpa*   at pci? dev ? function ?        # DEC DEFPA FDDI UT
+fxp*   at pci? dev ? function ?        # Intel EtherExpress PRO 10+/100B UT
+le*    at pci? dev ? function ?        # PCnet-PCI Ethernet UT
+# XXX uses vtophys()
+#lmc*  at pci? dev ? function ?        # Lan Media Corp SSI/HSSI/DS3
+ne*    at pci? dev ? function ?        # NE2000-compatible Ethernet UT
+ntwoc* at pci? dev ? function ?        # Riscom/N2 PCI Sync Serial UT
+rtk*   at pci? dev ? function ?        # Realtek 8129/8139 UT
+sip*   at pci? dev ? function ?        # SiS 900 Ethernet UT
+ti*    at pci? dev ? function ?        # Alteon ACEnic gigabit Ethernet UT
+# XXX uses vtophys()
+#tl*   at pci? dev ? function ?        # ThunderLAN-based Ethernet
+tlp*   at pci? dev ? function ?        # DECchip 21x4x (and clones) Ethernet
+#options       TLP_MATCH_21040
+#options       TLP_MATCH_21041
+#options       TLP_MATCH_21140
+#options       TLP_MATCH_21142
+vr*    at pci? dev ? function ?        # VIA Rhine Fast Ethernet
+
+# MII/PHY support
+# XXX: only nsphy "tested"
+dmphy* at mii? phy ?                   # Davicom DM9101 PHYs
+exphy* at mii? phy ?                   # 3Com internal PHYs
+icsphy*        at mii? phy ?                   # Integrated Circuit Systems ICS1890
+inphy* at mii? phy ?                   # Intel 82555 PHYs
+iophy* at mii? phy ?                   # Intel 82553 PHYs
+lxtphy*        at mii? phy ?                   # Level One LXT-970 PHYs
+nsphy* at mii? phy ?                   # NS83840 PHYs
+nsphyter* at mii? phy ?                        # NS83843 PHYs
+qsphy* at mii? phy ?                   # Quality Semiconductor QS6612 PHYs
+sqphy* at mii? phy ?                   # Seeq 80220/80221/80223 PHYs
+tlphy* at mii? phy ?                   # ThunderLAN PHYs
+tqphy* at mii? phy ?                   # TDK Semiconductor PHYs
+ukphy* at mii? phy ?                   # generic unknown PHYs
+
+# PCI USB controllers
+#ohci* at pci? dev ? function ?                        # Open Host Controller
+
+#usb*  at ohci?                                        # USB bus support
+#uhub* at usb?                                         # USB Hubs
+#uhub* at uhub? port ? configuration ? interface ?
+
+#uhid* at uhub? port ? configuration ? interface ?     # USB Generic HID
+#ulpt* at uhub? port ? configuration ? interface ?     # USB Printer
+
+#umodem*       at uhub? port ? configuration ?                 # USB Modem
+#ucom* at umodem?
+
+#umass*        at uhub? port ? configuration ? interface ?     # USB Mass Storage
+#atapibus* at umass? channel ?
+#scsibus* at umass? channel ?
+
+#uaudio*       at uhub? port ? configuration ?                 # USB audio
+
+# USB Ethernet adapters
+#aue*  at uhub? port ?         # ADMtek AN986 Pegasus based adapters
+#cue*  at uhub? port ?         # CATC USB-EL1201A based adapters
+#kue*  at uhub? port ?         # Kawasaki LSI KL5KUSB101B based adapters
+
+#uscanner* at uhub? port ?                             # USB scanners
+#uyap* at uhub? port ?                                 # Y@P firmware loader
+#ugen* at uhub? port ? configuration ? interface ?     # USB Generic driver
+
+
 ## Loopback network interface; required
 pseudo-device  loop
 
diff -r 01a94e5986dd -r 251afebeb9a1 sys/arch/sparc64/dev/ebus.c
--- a/sys/arch/sparc64/dev/ebus.c       Thu Jul 19 23:59:51 2001 +0000
+++ b/sys/arch/sparc64/dev/ebus.c       Fri Jul 20 00:07:12 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ebus.c,v 1.22 2001/06/04 20:56:52 mrg Exp $    */
+/*     $NetBSD: ebus.c,v 1.23 2001/07/20 00:07:12 eeh Exp $    */
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -49,7 +49,7 @@
 #define EDB_BUSMAP     0x08
 #define EDB_BUSDMA     0x10
 #define EDB_INTR       0x20
-int ebus_debug = 0;
+int ebus_debug = 0x0;
 #define DPRINTF(l, s)   do { if (ebus_debug & l) printf s; } while (0)
 #else
 #define DPRINTF(l, s)
@@ -67,6 +67,7 @@
 #define _SPARC_BUS_DMA_PRIVATE
 #include <machine/bus.h>
 #include <machine/autoconf.h>
+#include <machine/openfirm.h>
 
 #include <dev/pci/pcivar.h>
 #include <dev/pci/pcireg.h>
@@ -124,13 +125,24 @@
        void *aux;
 {
        struct pci_attach_args *pa = aux;
+       int node;
 
+       /* Only attach if there's a PROM node. */
+       node = PCITAG_NODE(pa->pa_tag);
+       if (node == -1) return (0);
+
+       /* Match a real ebus */
        if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
            PCI_VENDOR(pa->pa_id) == PCI_VENDOR_SUN &&
-           PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SUN_EBUS &&
-           ebus_find_node(pa))
+           PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SUN_EBUS)
                return (1);
 
+       /* Or a PCI-ISA bridge XXX I hope this is on-board. */
+       if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
+           PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_ISA) {
+               return (1);
+       }
+
        return (0);
 }
 
@@ -157,12 +169,13 @@
            PCI_REVISION(pa->pa_class));
 
        sc->sc_parent = (struct psycho_softc *)parent;
-       sc->sc_bustag = pa->pa_memt;
+       sc->sc_memtag = pa->pa_memt;
+       sc->sc_iotag = pa->pa_iot;
        sc->sc_childbustag = ebus_alloc_bus_tag(sc, PCI_MEMORY_BUS_SPACE);
        sc->sc_dmatag = ebus_alloc_dma_tag(sc, pa->pa_dmat);
 
-       node = ebus_find_node(pa);
-       if (node == 0)
+       node = PCITAG_NODE(pa->pa_tag);
+       if (node == -1)
                panic("could not find ebus node");
 
        sc->sc_node = node;
@@ -295,6 +308,7 @@
        return (UNCONF);
 }
 
+
 /*
  * find the INO values for each interrupt and fill them in.
  *
@@ -313,11 +327,11 @@
        int i, j, k;
 
        if (sc->sc_nintmap == 0) {
-               /*
-                * If there is no interrupt map in the ebus node,
-                * assume that the child's `interrupt' property is
-                * already in a format suitable for the parent bus.
-                */
+               for (i = 0; i < ea->ea_nintrs; i++) {
+                       OF_mapintr(ea->ea_node, &ea->ea_intrs[i],
+                               sizeof(ea->ea_intrs[0]),
+                               sizeof(ea->ea_intrs[0]));
+               }
                return;
        }
 
@@ -358,72 +372,6 @@
        }
 }
 
-/*
- * what is our OFW node?  this depends on our pci chipset tag
- * having it's "node" value set to the OFW node of the PCI bus,
- * see the simba driver.
- */
-int
-ebus_find_node(pa)
-       struct pci_attach_args *pa;
-{
-       int node = pa->pa_pc->node;
-       int n, *ap;
-       int pcibus, bus, dev, fn;
-
-       DPRINTF(EDB_PROM, ("ebus_find_node: looking at pci node %08x\n", node));
-
-       /* pull the PCI bus out of the pa_tag */
-       pcibus = (pa->pa_tag >> 16) & 0xff;



Home | Main Index | Thread Index | Old Index