svn commit: r335538 - stable/10/sys/dev/amdsbwd

Andriy Gapon avg at FreeBSD.org
Fri Jun 22 09:20:52 UTC 2018


Author: avg
Date: Fri Jun 22 09:20:50 2018
New Revision: 335538
URL: https://svnweb.freebsd.org/changeset/base/335538

Log:
  MFC r333212: amdsbwd: add suspend and resume methods

Modified:
  stable/10/sys/dev/amdsbwd/amdsbwd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/amdsbwd/amdsbwd.c
==============================================================================
--- stable/10/sys/dev/amdsbwd/amdsbwd.c	Fri Jun 22 09:20:00 2018	(r335537)
+++ stable/10/sys/dev/amdsbwd/amdsbwd.c	Fri Jun 22 09:20:50 2018	(r335538)
@@ -100,12 +100,16 @@ static void	amdsbwd_identify(driver_t *driver, device_
 static int	amdsbwd_probe(device_t dev);
 static int	amdsbwd_attach(device_t dev);
 static int	amdsbwd_detach(device_t dev);
+static int	amdsbwd_suspend(device_t dev);
+static int	amdsbwd_resume(device_t dev);
 
 static device_method_t amdsbwd_methods[] = {
 	DEVMETHOD(device_identify,	amdsbwd_identify),
 	DEVMETHOD(device_probe,		amdsbwd_probe),
 	DEVMETHOD(device_attach,	amdsbwd_attach),
 	DEVMETHOD(device_detach,	amdsbwd_detach),
+	DEVMETHOD(device_suspend,	amdsbwd_suspend),
+	DEVMETHOD(device_resume,	amdsbwd_resume),
 #if 0
 	DEVMETHOD(device_shutdown,	amdsbwd_detach),
 #endif
@@ -549,3 +553,30 @@ amdsbwd_detach(device_t dev)
 	return (0);
 }
 
+static int
+amdsbwd_suspend(device_t dev)
+{
+	struct amdsbwd_softc *sc;
+	uint32_t val;
+
+	sc = device_get_softc(dev);
+	val = wdctrl_read(sc);
+	val &= ~AMDSB_WD_RUN;
+	wdctrl_write(sc, val);
+	return (0);
+}
+
+static int
+amdsbwd_resume(device_t dev)
+{
+	struct amdsbwd_softc *sc;
+
+	sc = device_get_softc(dev);
+	wdctrl_write(sc, AMDSB_WD_FIRED);
+	if (sc->active) {
+		amdsbwd_tmr_set(sc, sc->timeout);
+		amdsbwd_tmr_enable(sc);
+		amdsbwd_tmr_reload(sc);
+	}
+	return (0);
+}


More information about the svn-src-all mailing list