From owner-svn-src-stable-11@freebsd.org Fri Jun 22 09:20:00 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E05AD101413F; Fri, 22 Jun 2018 09:20:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 922D0864D5; Fri, 22 Jun 2018 09:20:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7339C1EB65; Fri, 22 Jun 2018 09:20:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5M9K0kv028213; Fri, 22 Jun 2018 09:20:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5M9K0Zi028212; Fri, 22 Jun 2018 09:20:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201806220920.w5M9K0Zi028212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 22 Jun 2018 09:20:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335537 - stable/11/sys/dev/amdsbwd X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/dev/amdsbwd X-SVN-Commit-Revision: 335537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2018 09:20:01 -0000 Author: avg Date: Fri Jun 22 09:20:00 2018 New Revision: 335537 URL: https://svnweb.freebsd.org/changeset/base/335537 Log: MFC r333212: amdsbwd: add suspend and resume methods Modified: stable/11/sys/dev/amdsbwd/amdsbwd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/amdsbwd/amdsbwd.c ============================================================================== --- stable/11/sys/dev/amdsbwd/amdsbwd.c Fri Jun 22 09:18:38 2018 (r335536) +++ stable/11/sys/dev/amdsbwd/amdsbwd.c Fri Jun 22 09:20:00 2018 (r335537) @@ -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); +}