Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 May 2011 18:05:13 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r221704 - stable/8/sys/dev/ichwd
Message-ID:  <201105091805.p49I5D47007200@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Mon May  9 18:05:13 2011
New Revision: 221704
URL: http://svn.freebsd.org/changeset/base/221704

Log:
  MFC r220925,221015,221016:
  - Define new registers offsets
  - Add toggling functions for SMI default setting
  
  Sponsored by:	Sandvine Incorporated

Modified:
  stable/8/sys/dev/ichwd/ichwd.c
  stable/8/sys/dev/ichwd/ichwd.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/ichwd/ichwd.c
==============================================================================
--- stable/8/sys/dev/ichwd/ichwd.c	Mon May  9 17:34:00 2011	(r221703)
+++ stable/8/sys/dev/ichwd/ichwd.c	Mon May  9 18:05:13 2011	(r221704)
@@ -171,6 +171,15 @@ ichwd_smi_enable(struct ichwd_softc *sc)
 }
 
 /*
+ * Check if the watchdog SMI triggering is enabled.
+ */
+static __inline int
+ichwd_smi_is_enabled(struct ichwd_softc *sc)
+{
+	return ((ichwd_read_smi_4(sc, SMI_EN) & SMI_TCO_EN) != 0);
+}
+
+/*
  * Reset the watchdog status bits.
  */
 static __inline void
@@ -488,6 +497,7 @@ ichwd_attach(device_t dev)
 	sc->ev_tag = EVENTHANDLER_REGISTER(watchdog_list, ichwd_event, sc, 0);
 
 	/* disable the SMI handler */
+	sc->smi_enabled = ichwd_smi_is_enabled(sc);
 	ichwd_smi_disable(sc);
 
 	return (0);
@@ -519,7 +529,8 @@ ichwd_detach(device_t dev)
 		ichwd_tmr_disable(sc);
 
 	/* enable the SMI handler */
-	ichwd_smi_enable(sc);
+	if (sc->smi_enabled != 0)
+		ichwd_smi_enable(sc);
 
 	/* deregister event handler */
 	if (sc->ev_tag != NULL)

Modified: stable/8/sys/dev/ichwd/ichwd.h
==============================================================================
--- stable/8/sys/dev/ichwd/ichwd.h	Mon May  9 17:34:00 2011	(r221703)
+++ stable/8/sys/dev/ichwd/ichwd.h	Mon May  9 18:05:13 2011	(r221704)
@@ -45,6 +45,7 @@ struct ichwd_softc {
 	int			 active;
 	unsigned int		 timeout;
 
+	int			 smi_enabled;
 	int			 smi_rid;
 	struct resource		*smi_res;
 	bus_space_tag_t		 smi_bst;
@@ -135,15 +136,19 @@ struct ichwd_softc {
 #define TCO2_STS		0x06 /* TCO Status 2 */
 #define TCO1_CNT		0x08 /* TCO Control 1 */
 #define TCO2_CNT		0x08 /* TCO Control 2 */
+#define TCO_MESSAGE1		0x0c /* TCO Message 1 */
+#define TCO_MESSAGE2		0x0d /* TCO Message 2 */
 
 /* bit definitions for SMI_EN and SMI_STS */
 #define SMI_TCO_EN		0x2000
 #define SMI_TCO_STS		0x2000
+#define SMI_GBL_EN		0x0001
 
 /* timer value mask for TCO_RLD and TCO_TMR */
 #define TCO_TIMER_MASK		0x1f
 
 /* status bits for TCO1_STS */
+#define TCO_NEWCENTURY		0x80 /* set for RTC year roll over (99 to 00) */
 #define TCO_TIMEOUT		0x08 /* timed out */
 #define TCO_INT_STS		0x04 /* data out (DO NOT USE) */
 #define TCO_SMI_STS		0x02 /* data in (DO NOT USE) */
@@ -153,8 +158,10 @@ struct ichwd_softc {
 #define TCO_SECOND_TO_STS	0x02 /* ran down twice */
 
 /* control bits for TCO1_CNT */
-#define TCO_TMR_HALT		0x0800 /* clear to enable WDT */
-#define TCO_CNT_PRESERVE	0x0200 /* preserve these bits */
+#define TCO_TMR_HALT		0x0800		/* clear to enable WDT */
+#define TCO_NMI2SMI_EN		0x0200		/* convert NMIs to SMIs */
+#define TCO_CNT_PRESERVE	TCO_NMI2SMI_EN	/* preserve these bits */
+#define TCO_NMI_NOW		0x0100		/* trigger an NMI */
 
 /*
  * Masks for the TCO timer value field in TCO_RLD.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105091805.p49I5D47007200>