Source-Changes-HG archive

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

[src/trunk]: src Update sti(4) from OpenBSD bringing across support for sti @...



details:   https://anonhg.NetBSD.org/src/rev/8ae17d5505dc
branches:  trunk
changeset: 758576:8ae17d5505dc
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Nov 09 12:24:47 2010 +0000

description:
Update sti(4) from OpenBSD bringing across support for sti @ pci.

Thanks to Adam Hoka for testing.

diffstat:

 share/man/man4/sti.4                 |    21 +-
 sys/arch/hp700/conf/GENERIC          |     6 +-
 sys/arch/hp700/conf/files.hp700      |     5 +-
 sys/arch/hp700/dev/sti_pci_machdep.c |    88 ++
 sys/arch/hp700/dev/sti_sgc.c         |   157 ++-
 sys/dev/ic/sti.c                     |  1144 +++++++++++++++++++++++----------
 sys/dev/ic/stireg.h                  |   141 ++-
 sys/dev/ic/stivar.h                  |   136 ++-
 sys/dev/pci/files.pci                |     6 +-
 sys/dev/pci/sti_pci.c                |   431 ++++++++++++
 10 files changed, 1607 insertions(+), 528 deletions(-)

diffs (truncated from 3088 to 300 lines):

diff -r d4e534781cbd -r 8ae17d5505dc share/man/man4/sti.4
--- a/share/man/man4/sti.4      Tue Nov 09 11:48:35 2010 +0000
+++ b/share/man/man4/sti.4      Tue Nov 09 12:24:47 2010 +0000
@@ -1,5 +1,5 @@
-.\"    $NetBSD: sti.4,v 1.1 2004/09/22 16:38:26 jkunz Exp $
-.\"    $OpenBSD: sti.4,v 1.14 2004/06/08 02:54:53 mickey Exp $
+.\"    $NetBSD: sti.4,v 1.2 2010/11/09 12:24:47 skrll Exp $
+.\"    $OpenBSD: sti.4,v 1.19 2007/05/31 19:19:52 jmc Exp $
 .\"
 .\" Copyright (c) 2001 Michael Shalayeff
 .\" All rights reserved.
@@ -25,17 +25,17 @@
 .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\" THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 11, 2001
+.Dd November 9, 2010
 .Dt STI 4
 .Os
 .Sh NAME
 .Nm sti
 .Nd HP Standard Text Interface
 .Sh SYNOPSIS
-.Cd "sti*      at mainbus0 irq ?"
-.Cd "sti*      at phantomas0 irq ?"
-.\" .Cd "sti*  at pci? device ? function ?"
-.Cd "wsdisplay*        at sti? console ?"
+.Cd "sti*      at mainbus0"
+.Cd "sti*      at phantomas?"
+.Cd "sti*      at pci?"
+.Cd "wsdisplay*        at sti?"
 .Sh DESCRIPTION
 The
 .Nm
@@ -46,6 +46,7 @@
 (though not all features or frame buffer depths may be available):
 .Bl -column "Visualize FX10pro" "Bits" "Mem" "3D" "machines" -offset left
 .It "Model" Ta "Bits" Ta "Mem" Ta "3D" Ta "Machines/Cards"
+.It "EVRX" Ta "8" Ta "2" Ta "" Ta "HP9000/425e"
 .\" .It "Timber" Ta "8" Ta "2" Ta "" Ta "HP9000/705/710"
 .It "GRX" Ta "8g" Ta "2" Ta "" Ta "SGC"
 .It "CRX" Ta "8" Ta "2" Ta "" Ta "SGC"
@@ -64,9 +65,9 @@
 .\" .It "Visualize 24" Ta "24" Ta "16" Ta "y" Ta "GSC"
 .\" .It "Visualize 48" Ta "24" Ta "16" Ta "y" Ta "GSC"
 .\" .It "Visualize 48XP" Ta "24" Ta "16" Ta "y" Ta "GSC"
-.\" .It "Visualize FXE" Ta "24" Ta "24" Ta "y" Ta "PCI 32/66"
-.\" .It "Visualize FX2" Ta "24" Ta "24" Ta "y" Ta "PCI 64/66"
-.\" .It "Visualize FX4/FX6" Ta "24" Ta "32" Ta "y" Ta "PCI 64/66"
+.It "Visualize FXE" Ta "24" Ta "24" Ta "y" Ta "PCI 32/66"
+.It "Visualize FX2" Ta "24" Ta "24" Ta "y" Ta "PCI 64/66"
+.It "Visualize FX4/FX6" Ta "24" Ta "32" Ta "y" Ta "PCI 64/66"
 .\" .It "Visualize FX5pro" Ta "24" Ta "64" Ta "y" Ta "PCI 64/66"
 .\" .It "Visualize FX10pro" Ta "24" Ta "128" Ta "y" Ta "PCI 64/66"
 .El
diff -r d4e534781cbd -r 8ae17d5505dc sys/arch/hp700/conf/GENERIC
--- a/sys/arch/hp700/conf/GENERIC       Tue Nov 09 11:48:35 2010 +0000
+++ b/sys/arch/hp700/conf/GENERIC       Tue Nov 09 12:24:47 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.102 2010/08/17 00:02:28 dyoung Exp $
+# $NetBSD: GENERIC,v 1.103 2010/11/09 12:24:47 skrll Exp $
 #
 # GENERIC machine description file
 #
@@ -23,7 +23,7 @@
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 options        SYSCTL_INCLUDE_DESCR    # Include sysctl descriptions in kernel
 
-#ident                 "GENERIC-$Revision: 1.102 $"
+#ident                 "GENERIC-$Revision: 1.103 $"
 
 maxusers       32              # estimated number of users
 
@@ -231,6 +231,8 @@
 # STI graphics
 sti*   at mainbus0             # [H]CRX-{8,24,48}[Z] and Visualize graphics
 sti*   at phantomas?           # [H]CRX-{8,24,48}[Z] and Visualize graphics
+#sti*  at uturn?
+sti*   at pci?                 # EG-PCI, FX*
 
 # Basic Bus Support
 lasi*  at mainbus0             # LASI host adapter ( LSI PN??? )
diff -r d4e534781cbd -r 8ae17d5505dc sys/arch/hp700/conf/files.hp700
--- a/sys/arch/hp700/conf/files.hp700   Tue Nov 09 11:48:35 2010 +0000
+++ b/sys/arch/hp700/conf/files.hp700   Tue Nov 09 12:24:47 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.hp700,v 1.23 2010/06/01 10:20:28 skrll Exp $
+#      $NetBSD: files.hp700,v 1.24 2010/11/09 12:24:47 skrll Exp $
 #
 #      $OpenBSD: files.hp700,v 1.31 2001/06/26 02:41:25 mickey Exp $
 #
@@ -150,7 +150,8 @@
 file   arch/hp700/dev/apic.c           elroy
 
 attach sti at gedoens with sti_gedoens
-file   arch/hp700/dev/sti_sgc.c        sti_gedoens
+file   arch/hp700/dev/sti_sgc.c                sti_gedoens
+file   arch/hp700/dev/sti_pci_machdep.c        sti_pci
 
 attach siop at gedoens with siop_gedoens
 file   arch/hp700/dev/siop_sgc.c       siop_gedoens
diff -r d4e534781cbd -r 8ae17d5505dc sys/arch/hp700/dev/sti_pci_machdep.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hp700/dev/sti_pci_machdep.c      Tue Nov 09 12:24:47 2010 +0000
@@ -0,0 +1,88 @@
+/*     $NetBSD: sti_pci_machdep.c,v 1.1 2010/11/09 12:24:47 skrll Exp $        */
+
+/*     $OpenBSD: sti_pci_machdep.c,v 1.2 2009/04/10 17:11:27 miod Exp $        */
+
+/*
+ * Copyright (c) 2007, 2009 Miodrag Vallat.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice, this permission notice, and the disclaimer below
+ * appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/iomod.h>
+#include <machine/autoconf.h>
+
+#include <dev/pci/pcivar.h>
+
+#include <hp700/hp700/machdep.h>
+
+int    sti_pci_is_console(struct pci_attach_args *, bus_addr_t *);
+
+int
+sti_pci_is_console(struct pci_attach_args *paa, bus_addr_t *bases)
+{
+       hppa_hpa_t consaddr;
+       uint32_t cf;
+       int pagezero_cookie;
+       int bar;
+       int rc;
+
+       KASSERT(paa != NULL);
+
+       pagezero_cookie = hp700_pagezero_map();
+       consaddr = (hppa_hpa_t)PAGE0->mem_cons.pz_hpa;
+       hp700_pagezero_unmap(pagezero_cookie);
+       /*
+        * PAGE0 console information will point to one of our BARs,
+        * but depending on the particular sti model, this might not
+        * be the BAR mapping the rom (region #0).
+        *
+        * For example, on Visualize FXe, regions #0, #2 and #3 are
+        * mapped by BAR 0x18, while region #1 is mapped by BAR 0x10,
+        * which matches PAGE0 console address.
+        *
+        * Rather than trying to be smart, reread the region->BAR array
+        * again, and compare the BAR mapping region #1 against PAGE0
+        * values, we simply try all the valid BARs; if any of them
+        * matches what PAGE0 says, then we are the console, and it
+        * doesn't matter which BAR matched.
+        */
+       for (bar = PCI_MAPREG_START; bar <= PCI_MAPREG_PPB_END; ) {
+               bus_addr_t addr;
+               bus_size_t size;
+
+               cf = pci_conf_read(paa->pa_pc, paa->pa_tag, bar);
+
+               rc = pci_mapreg_info(paa->pa_pc, paa->pa_tag, bar,
+                   PCI_MAPREG_TYPE(cf), &addr, &size, NULL);
+
+               if (PCI_MAPREG_TYPE(cf) == PCI_MAPREG_TYPE_IO) {
+                       bar += 4;
+               } else {
+                       if (PCI_MAPREG_MEM_TYPE(cf) ==
+                           PCI_MAPREG_MEM_TYPE_64BIT)
+                               bar += 8;
+                       else
+                               bar += 4;
+               }
+
+               if (rc == 0 && (hppa_hpa_t)addr == consaddr)
+                       return 1;
+       }
+
+       return 0;
+}
diff -r d4e534781cbd -r 8ae17d5505dc sys/arch/hp700/dev/sti_sgc.c
--- a/sys/arch/hp700/dev/sti_sgc.c      Tue Nov 09 11:48:35 2010 +0000
+++ b/sys/arch/hp700/dev/sti_sgc.c      Tue Nov 09 12:24:47 2010 +0000
@@ -1,6 +1,6 @@
-/*     $NetBSD: sti_sgc.c,v 1.19 2010/03/06 19:36:33 skrll Exp $       */
+/*     $NetBSD: sti_sgc.c,v 1.20 2010/11/09 12:24:47 skrll Exp $       */
 
-/*     $OpenBSD: sti_sgc.c,v 1.21 2003/12/22 23:39:06 mickey Exp $     */
+/*     $OpenBSD: sti_sgc.c,v 1.38 2009/02/06 22:51:04 miod Exp $       */
 
 /*
  * Copyright (c) 2000-2003 Michael Shalayeff
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.19 2010/03/06 19:36:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.20 2010/11/09 12:24:47 skrll Exp $");
 
 #include "opt_cputype.h"
 
@@ -59,6 +59,17 @@
 #include <hp700/dev/cpudevs.h>
 #include <hp700/hp700/machdep.h>
 
+#ifdef STIDEBUG
+#define        DPRINTF(s)      do {    \
+       if (stidebug)           \
+               printf s;       \
+} while(0)
+
+extern int stidebug;
+#else
+#define        DPRINTF(s)      /* */
+#endif
+
 #define        STI_ROMSIZE     (sizeof(struct sti_dd) * 4)
 #define        STI_ID_FDDI     0x280b31af      /* Medusa FDDI ROM id */
 
@@ -71,15 +82,25 @@
 #define        STI_GOPT6_REV   0x40
 #define        STI_GOPT7_REV   0x30
 
-/* internal EG */
-#define        STI_INEG_REV    0x60
-#define        STI_INEG_PROM   0xf0011000
+const char sti_sgc_opt[] = {
+       STI_GOPT1_REV,
+       STI_GOPT2_REV,
+       STI_GOPT3_REV,
+       STI_GOPT4_REV,
+       STI_GOPT5_REV,
+       STI_GOPT6_REV,
+       STI_GOPT7_REV
+};
 
 int sti_sgc_probe(device_t, cfdata_t, void *);
 void sti_sgc_attach(device_t, device_t, void *);
 
-CFATTACH_DECL_NEW(sti_gedoens, sizeof(struct sti_softc), sti_sgc_probe, sti_sgc_attach,
-    NULL, NULL);
+void sti_sgc_end_attach(device_t);
+
+extern struct cfdriver sti_cd;
+
+CFATTACH_DECL_NEW(sti_gedoens, sizeof(struct sti_softc), sti_sgc_probe,
+    sti_sgc_attach, NULL, NULL);
 
 paddr_t sti_sgc_getrom(struct confargs *);
 
@@ -93,30 +114,26 @@
        paddr_t rom;
        int pagezero_cookie;
 
-       rom = ca->ca_hpa;
+       pagezero_cookie = hp700_pagezero_map();
+       rom = PAGE0->pd_resv2[1];
+       hp700_pagezero_unmap(pagezero_cookie);
 
-       if (ca->ca_type.iodc_sv_model != HPPA_FIO_GSGC) {
-               return rom;
+       if (ca->ca_type.iodc_sv_model == HPPA_FIO_GSGC) {
+               int i;
+               for (i = sizeof(sti_sgc_opt); i--; )
+                       if (sti_sgc_opt[i] == ca->ca_type.iodc_revision)
+                               break;
+               if (i < 0)
+                       rom = 0;
+       }
+       
+       if (rom < HPPA_IOBEGIN) {
+               if (ca->ca_naddrs > 0)
+                       rom = ca->ca_addrs[0].addr;
+               else
+                       rom = ca->ca_hpa;
        }
 
-       switch (ca->ca_type.iodc_revision) {
-       case STI_GOPT1_REV:
-       case STI_GOPT2_REV:
-       case STI_GOPT3_REV:
-       case STI_GOPT4_REV:
-       case STI_GOPT5_REV:
-       case STI_GOPT6_REV:
-       case STI_GOPT7_REV:
-               /* these share the onboard's prom */
-               pagezero_cookie = hp700_pagezero_map();



Home | Main Index | Thread Index | Old Index