mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
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
This commit is contained in:
parent
5ad00fa2cf
commit
1c8edc1ed8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=328176
@ -209,12 +209,12 @@ 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)))
|
||||
return (error);
|
||||
|
||||
error = bhnd_pwrctl_updateclk(sc, BHND_PWRCTL_WAR_DOWN);
|
||||
PWRCTL_UNLOCK(sc);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
STAILQ_FOREACH_SAFE(clkres, &sc->clkres_list, cr_link, crnext)
|
||||
free(clkres, M_DEVBUF);
|
||||
@ -344,6 +344,10 @@ bhnd_pwrctl_updateclk(struct bhnd_pwrctl_softc *sc, bhnd_pwrctl_wars wars)
|
||||
|
||||
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;
|
||||
|
||||
|
@ -170,9 +170,9 @@ siba_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user