Source-Changes-HG archive

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

[src/trunk]: src/sys Add a flags argument to gcscpcib_attach().



details:   https://anonhg.NetBSD.org/src/rev/e0a1669acef4
branches:  trunk
changeset: 768982:e0a1669acef4
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Aug 29 18:34:42 2011 +0000

description:
Add a flags argument to gcscpcib_attach().
Add a flag argument which cause the waychdog to not be attached.
Use it to disable the watchdog on loongson-based platforms, where
the CS5536's reset output is not wired to the CPU reset line :(

diffstat:

 sys/arch/evbmips/loongson/dev/gcscpcib_pci.c |   6 +++---
 sys/arch/i386/pci/gcscpcib_pci.c             |   6 +++---
 sys/dev/ic/gcscpcib.c                        |  12 ++++++++----
 sys/dev/ic/gcscpcibvar.h                     |   5 +++--
 4 files changed, 17 insertions(+), 12 deletions(-)

diffs (123 lines):

diff -r 52c80674647d -r e0a1669acef4 sys/arch/evbmips/loongson/dev/gcscpcib_pci.c
--- a/sys/arch/evbmips/loongson/dev/gcscpcib_pci.c      Mon Aug 29 18:32:18 2011 +0000
+++ b/sys/arch/evbmips/loongson/dev/gcscpcib_pci.c      Mon Aug 29 18:34:42 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gcscpcib_pci.c,v 1.1 2011/08/27 13:42:45 bouyer Exp $ */
+/* $NetBSD: gcscpcib_pci.c,v 1.2 2011/08/29 18:34:42 bouyer Exp $ */
 /* $OpenBSD: gcscpcib.c,v 1.6 2007/11/17 17:02:47 mbalmer Exp $        */
 
 /*
@@ -25,7 +25,7 @@
  * machine-dependent attachement.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gcscpcib_pci.c,v 1.1 2011/08/27 13:42:45 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gcscpcib_pci.c,v 1.2 2011/08/29 18:34:42 bouyer Exp $");
 
 
 #include <sys/param.h>
@@ -92,7 +92,7 @@
        /* Attach the PCI-ISA bridge at first */
        pcibattach(parent, self, aux);
        /* then attach gcscpcib itself */
-       gcscpcib_attach(self, &sc->sc_gcscpcib, pa->pa_iot);
+       gcscpcib_attach(self, &sc->sc_gcscpcib, pa->pa_iot, GCSCATTACH_NO_WDT);
 }
 
 uint64_t
diff -r 52c80674647d -r e0a1669acef4 sys/arch/i386/pci/gcscpcib_pci.c
--- a/sys/arch/i386/pci/gcscpcib_pci.c  Mon Aug 29 18:32:18 2011 +0000
+++ b/sys/arch/i386/pci/gcscpcib_pci.c  Mon Aug 29 18:34:42 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gcscpcib_pci.c,v 1.1 2011/08/27 12:47:49 bouyer Exp $ */
+/* $NetBSD: gcscpcib_pci.c,v 1.2 2011/08/29 18:34:42 bouyer Exp $ */
 /* $OpenBSD: gcscpcib.c,v 1.6 2007/11/17 17:02:47 mbalmer Exp $        */
 
 /*
@@ -25,7 +25,7 @@
  * machine-dependent attachement.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gcscpcib_pci.c,v 1.1 2011/08/27 12:47:49 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gcscpcib_pci.c,v 1.2 2011/08/29 18:34:42 bouyer Exp $");
 
 
 #include <sys/param.h>
@@ -92,7 +92,7 @@
        /* Attach the PCI-ISA bridge at first */
        pcibattach(parent, self, aux);
        /* then attach gcscpcib itself */
-       gcscpcib_attach(self, &sc->sc_gcscpcib, pa->pa_iot);
+       gcscpcib_attach(self, &sc->sc_gcscpcib, pa->pa_iot, 0);
 }
 
 uint64_t
diff -r 52c80674647d -r e0a1669acef4 sys/dev/ic/gcscpcib.c
--- a/sys/dev/ic/gcscpcib.c     Mon Aug 29 18:32:18 2011 +0000
+++ b/sys/dev/ic/gcscpcib.c     Mon Aug 29 18:34:42 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gcscpcib.c,v 1.1 2011/08/27 12:47:49 bouyer Exp $ */
+/* $NetBSD: gcscpcib.c,v 1.2 2011/08/29 18:34:42 bouyer Exp $ */
 /* $OpenBSD: gcscpcib.c,v 1.6 2007/11/17 17:02:47 mbalmer Exp $        */
 
 /*
@@ -24,7 +24,7 @@
  * AMD CS5535/CS5536 series LPC bridge also containing timer, watchdog and GPIO.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gcscpcib.c,v 1.1 2011/08/27 12:47:49 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gcscpcib.c,v 1.2 2011/08/29 18:34:42 bouyer Exp $");
 
 #include "gpio.h"
 
@@ -84,7 +84,7 @@
 
 void
 gcscpcib_attach(device_t self, struct gcscpcib_softc *sc,
-    bus_space_tag_t iot)
+    bus_space_tag_t iot, int flags)
 {
        struct timecounter *tc = &sc->sc_timecounter;
        bus_addr_t wdtbase;
@@ -109,6 +109,9 @@
        tc->tc_priv = sc;
        tc_init(tc);
 
+       if (flags & GCSCATTACH_NO_WDT)
+               goto gpio;
+
        /* Attach the watchdog timer */
        wdtbase = gcsc_rdmsr(MSR_LBAR_MFGPT) & 0xffff;
        if (bus_space_map(sc->sc_iot, wdtbase, 64, 0, &sc->sc_ioh)) {
@@ -295,10 +298,11 @@
                        period * AMD553X_WDT_TICK);
 
        /* enable watchdog action */
-       DPRINTF(("%s: enable watchdog action. (MFGPT0_CMP2= %d)\n", __func__,
+       DPRINTF(("%s: enable watchdog action. (MFGPT0_CMP2= %d)", __func__,
                bus_space_read_2(sc->sc_iot, sc->sc_ioh,
                         AMD553X_MFGPTX_CMP2(sc->sc_wdt_mfgpt))));
        AMD553X_MFGPTx_NR_ENABLE(sc->sc_wdt_mfgpt, AMD553X_MFGPT0_C2_RSTEN);
+       DPRINTF((" AMD553X_MFGPT_NR 0x%" PRIx64 "\n", gcsc_rdmsr(AMD553X_MFGPT_NR)));
 }
 
 static int
diff -r 52c80674647d -r e0a1669acef4 sys/dev/ic/gcscpcibvar.h
--- a/sys/dev/ic/gcscpcibvar.h  Mon Aug 29 18:32:18 2011 +0000
+++ b/sys/dev/ic/gcscpcibvar.h  Mon Aug 29 18:34:42 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gcscpcibvar.h,v 1.1 2011/08/27 12:47:49 bouyer Exp $ */
+/* $NetBSD: gcscpcibvar.h,v 1.2 2011/08/29 18:34:42 bouyer Exp $ */
 /* $OpenBSD: gcscpcib.c,v 1.6 2007/11/17 17:02:47 mbalmer Exp $        */
 
 /*
@@ -45,7 +45,8 @@
 #endif
 };
 
-void gcscpcib_attach(device_t, struct gcscpcib_softc *, bus_space_tag_t);
+void gcscpcib_attach(device_t, struct gcscpcib_softc *, bus_space_tag_t, int);
+#define GCSCATTACH_NO_WDT      0x0001 /* do not attach watchdog */
 
 uint64_t gcsc_rdmsr(uint);
 void     gcsc_wrmsr(uint, uint64_t);



Home | Main Index | Thread Index | Old Index