svn commit: r328176 - in head/sys/dev/bhnd: cores/chipc/pwrctl siba
Landon J. Fuller
landonf at FreeBSD.org
Fri Jan 19 21:58:50 UTC 2018
Author: landonf
Date: Fri Jan 19 21:58:48 2018
New Revision: 328176
URL: https://svnweb.freebsd.org/changeset/base/328176
Log:
bhnd(4): fix a few bugs in pwrctl/fixed-clock device support.
- Do not panic on siba(4) detach when the bhnd(4) bus calls
bhnd_get_pmu_info() on a PMU-less device.
- Fix bhnd_pwrctl attach/detach on fixed-clock devices:
- Treat bhnd_pwrctl_updateclk() as a no-op on fixed-clock devices.
- Use bhnd_pwrctl_updateclk() to perform the appropriate clock
transition on detach.
Sponsored by: The FreeBSD Foundation
Modified:
head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.c
head/sys/dev/bhnd/siba/siba.c
Modified: head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.c
==============================================================================
--- head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.c Fri Jan 19 21:56:22 2018 (r328175)
+++ head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.c Fri Jan 19 21:58:48 2018 (r328176)
@@ -209,13 +209,13 @@ bhnd_pwrctl_detach(device_t dev)
if ((error = bhnd_deregister_provider(dev, BHND_SERVICE_ANY)))
return (error);
+ /* Update clock state */
PWRCTL_LOCK(sc);
-
- if ((error = bhnd_pwrctl_setclk(sc, BHND_CLOCK_DYN)))
+ error = bhnd_pwrctl_updateclk(sc, BHND_PWRCTL_WAR_DOWN);
+ PWRCTL_UNLOCK(sc);
+ if (error)
return (error);
- PWRCTL_UNLOCK(sc);
-
STAILQ_FOREACH_SAFE(clkres, &sc->clkres_list, cr_link, crnext)
free(clkres, M_DEVBUF);
@@ -343,6 +343,10 @@ bhnd_pwrctl_updateclk(struct bhnd_pwrctl_softc *sc, bh
bhnd_clock clock;
PWRCTL_LOCK_ASSERT(sc, MA_OWNED);
+
+ /* Nothing to update on fixed clock devices */
+ if (PWRCTL_QUIRK(sc, FIXED_CLK))
+ return (0);
/* Default clock target */
clock = BHND_CLOCK_DYN;
Modified: head/sys/dev/bhnd/siba/siba.c
==============================================================================
--- head/sys/dev/bhnd/siba/siba.c Fri Jan 19 21:56:22 2018 (r328175)
+++ head/sys/dev/bhnd/siba/siba.c Fri Jan 19 21:58:48 2018 (r328176)
@@ -170,9 +170,9 @@ siba_read_ivar(device_t dev, device_t child, int index
case SIBA_PMU_PWRCTL:
case SIBA_PMU_FIXED:
- panic("bhnd_get_pmu_info() called with siba PMU state "
- "%d", dinfo->pmu_state);
- return (ENXIO);
+ *result = (uintptr_t)NULL;
+ SIBA_UNLOCK(sc);
+ return (0);
}
panic("invalid PMU state: %d", dinfo->pmu_state);
More information about the svn-src-head
mailing list