Date: Thu, 11 Jun 2020 09:16:38 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 204521] [new driver] [request] Port rtsx from OpenBSD to FreeBSD Message-ID: <bug-204521-227-9FVc7xvgVB@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-204521-227@https.bugs.freebsd.org/bugzilla/> References: <bug-204521-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D204521 --- Comment #195 from Gary Jennejohn <gljennjohn@gmail.com> --- This is the code I have in my test version of the driver for suspend/resume= .=20 Never tested, but it might save some time. NOTE that this is copy/paste so = the formatting will probably need to be fixed! /* * Device suspend routine. * do what rtsx_activate in OpenBSD does */ static int rtsx_suspend(device_t dev) { struct rtsx_softc *sc =3D device_get_softc(dev); int i; uint16_t reg; RTSX_LOCK(sc); i =3D 0; for (reg =3D 0xFDA0; reg < 0xFDAE; reg++) (void)rtsx_read(sc, reg, &sc->regs[i++]); for (reg =3D 0xFD52; reg < 0xFD69; reg++) (void)rtsx_read(sc, reg, &sc->regs[i++]); for (reg =3D 0xFE20; reg < 0xFE34; reg++) (void)rtsx_read(sc, reg, &sc->regs[i++]); sc->regs4[0] =3D READ4(sc, RTSX_HCBAR); sc->regs4[1] =3D READ4(sc, RTSX_HCBCTLR); sc->regs4[2] =3D READ4(sc, RTSX_HDBAR); sc->regs4[3] =3D READ4(sc, RTSX_HDBCTLR); sc->regs4[4] =3D READ4(sc, RTSX_HAIMR); sc->regs4[5] =3D READ4(sc, RTSX_BIER); /* Not saving RTSX_BIPR. */ RTSX_UNLOCK(sc); return (0); } /* * Device resume routine. * do what rtsx_activate in OpenBSD does */ static int rtsx_resume(device_t dev) { struct rtsx_softc *sc =3D device_get_softc(dev); int i; uint16_t reg; RTSX_LOCK(sc); WRITE4(sc, RTSX_HCBAR, sc->regs4[0]); WRITE4(sc, RTSX_HCBCTLR, sc->regs4[1]); WRITE4(sc, RTSX_HDBAR, sc->regs4[2]); WRITE4(sc, RTSX_HDBCTLR, sc->regs4[3]); WRITE4(sc, RTSX_HAIMR, sc->regs4[4]); WRITE4(sc, RTSX_BIER, sc->regs4[5]); /* Not writing RTSX_BIPR since doing so would clear it. */ i =3D 0; for (reg =3D 0xFDA0; reg < 0xFDAE; reg++) (void)rtsx_write(sc, reg, 0xff, sc->regs[i++]); for (reg =3D 0xFD52; reg < 0xFD69; reg++) (void)rtsx_write(sc, reg, 0xff, sc->regs[i++]); for (reg =3D 0xFE20; reg < 0xFE34; reg++) (void)rtsx_write(sc, reg, 0xff, sc->regs[i++]); RTSX_UNLOCK(sc); return (0); } --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-204521-227-9FVc7xvgVB>