Module Name:    src
Committed By:   bouyer
Date:           Mon Aug 29 18:34:43 UTC 2011

Modified Files:
        src/sys/arch/evbmips/loongson/dev: gcscpcib_pci.c
        src/sys/arch/i386/pci: gcscpcib_pci.c
        src/sys/dev/ic: gcscpcib.c gcscpcibvar.h

Log Message:
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 :(


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbmips/loongson/dev/gcscpcib_pci.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/pci/gcscpcib_pci.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/gcscpcib.c \
    src/sys/dev/ic/gcscpcibvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbmips/loongson/dev/gcscpcib_pci.c
diff -u src/sys/arch/evbmips/loongson/dev/gcscpcib_pci.c:1.1 src/sys/arch/evbmips/loongson/dev/gcscpcib_pci.c:1.2
--- src/sys/arch/evbmips/loongson/dev/gcscpcib_pci.c:1.1	Sat Aug 27 13:42:45 2011
+++ src/sys/arch/evbmips/loongson/dev/gcscpcib_pci.c	Mon Aug 29 18:34:42 2011
@@ -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

Index: src/sys/arch/i386/pci/gcscpcib_pci.c
diff -u src/sys/arch/i386/pci/gcscpcib_pci.c:1.1 src/sys/arch/i386/pci/gcscpcib_pci.c:1.2
--- src/sys/arch/i386/pci/gcscpcib_pci.c:1.1	Sat Aug 27 12:47:49 2011
+++ src/sys/arch/i386/pci/gcscpcib_pci.c	Mon Aug 29 18:34:42 2011
@@ -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

Index: src/sys/dev/ic/gcscpcib.c
diff -u src/sys/dev/ic/gcscpcib.c:1.1 src/sys/dev/ic/gcscpcib.c:1.2
--- src/sys/dev/ic/gcscpcib.c:1.1	Sat Aug 27 12:47:49 2011
+++ src/sys/dev/ic/gcscpcib.c	Mon Aug 29 18:34:42 2011
@@ -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
Index: src/sys/dev/ic/gcscpcibvar.h
diff -u src/sys/dev/ic/gcscpcibvar.h:1.1 src/sys/dev/ic/gcscpcibvar.h:1.2
--- src/sys/dev/ic/gcscpcibvar.h:1.1	Sat Aug 27 12:47:49 2011
+++ src/sys/dev/ic/gcscpcibvar.h	Mon Aug 29 18:34:42 2011
@@ -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);

Reply via email to