diff options
Diffstat (limited to 'sys/dev/bhnd/bhnd.h')
-rw-r--r-- | sys/dev/bhnd/bhnd.h | 116 |
1 files changed, 48 insertions, 68 deletions
diff --git a/sys/dev/bhnd/bhnd.h b/sys/dev/bhnd/bhnd.h index b4e441b92d78..96e8e93a6a24 100644 --- a/sys/dev/bhnd/bhnd.h +++ b/sys/dev/bhnd/bhnd.h @@ -52,8 +52,6 @@ #include "nvram/bhnd_nvram.h" -struct bhnd_core_pmu_info; - extern devclass_t bhnd_devclass; extern devclass_t bhnd_hostb_devclass; extern devclass_t bhnd_nvram_devclass; @@ -155,7 +153,7 @@ BHND_ACCESSOR(vendor_name, VENDOR_NAME, const char *); BHND_ACCESSOR(device_name, DEVICE_NAME, const char *); BHND_ACCESSOR(core_index, CORE_INDEX, u_int); BHND_ACCESSOR(core_unit, CORE_UNIT, int); -BHND_ACCESSOR(pmu_info, PMU_INFO, struct bhnd_core_pmu_info *); +BHND_ACCESSOR(pmu_info, PMU_INFO, void *); #undef BHND_ACCESSOR @@ -859,67 +857,6 @@ bhnd_suspend_hw(device_t dev) } /** - * If supported by the chipset, return the clock source for the given clock. - * - * This function is only supported on early PWRCTL-equipped chipsets - * that expose clock management via their host bridge interface. Currently, - * this includes PCI (not PCIe) devices, with ChipCommon core revisions 0-9. - * - * @param dev A bhnd bus child device. - * @param clock The clock for which a clock source will be returned. - * - * @retval bhnd_clksrc The clock source for @p clock. - * @retval BHND_CLKSRC_UNKNOWN If @p clock is unsupported, or its - * clock source is not known to the bus. - */ -static inline bhnd_clksrc -bhnd_pwrctl_get_clksrc(device_t dev, bhnd_clock clock) -{ - return (BHND_BUS_PWRCTL_GET_CLKSRC(device_get_parent(dev), dev, clock)); -} - -/** - * If supported by the chipset, gate @p clock - * - * This function is only supported on early PWRCTL-equipped chipsets - * that expose clock management via their host bridge interface. Currently, - * this includes PCI (not PCIe) devices, with ChipCommon core revisions 0-9. - * - * @param dev A bhnd bus child device. - * @param clock The clock to be disabled. - * - * @retval 0 success - * @retval ENODEV If bus-level clock source management is not supported. - * @retval ENXIO If bus-level management of @p clock is not supported. - */ -static inline int -bhnd_pwrctl_gate_clock(device_t dev, bhnd_clock clock) -{ - return (BHND_BUS_PWRCTL_GATE_CLOCK(device_get_parent(dev), dev, clock)); -} - -/** - * If supported by the chipset, ungate @p clock - * - * This function is only supported on early PWRCTL-equipped chipsets - * that expose clock management via their host bridge interface. Currently, - * this includes PCI (not PCIe) devices, with ChipCommon core revisions 0-9. - * - * @param dev A bhnd bus child device. - * @param clock The clock to be enabled. - * - * @retval 0 success - * @retval ENODEV If bus-level clock source management is not supported. - * @retval ENXIO If bus-level management of @p clock is not supported. - */ -static inline int -bhnd_pwrctl_ungate_clock(device_t dev, bhnd_clock clock) -{ - return (BHND_BUS_PWRCTL_UNGATE_CLOCK(device_get_parent(dev), dev, - clock)); -} - -/** * Return the BHND attachment type of the parent bhnd bus. * * @param dev A bhnd bus child device. @@ -1066,8 +1003,7 @@ bhnd_unmap_intr(device_t dev, rman_res_t irq) * calling bhnd_alloc_pmu(), and must not be released until after * calling bhnd_release_pmu(). * - * @param dev The parent of @p child. - * @param child The requesting bhnd device. + * @param dev The requesting bhnd device. * * @retval 0 success * @retval non-zero If allocating PMU request state otherwise fails, a @@ -1083,8 +1019,7 @@ bhnd_alloc_pmu(device_t dev) * Release any per-core PMU resources allocated for @p child. Any outstanding * PMU requests are are discarded. * - * @param dev The parent of @p child. - * @param child The requesting bhnd device. + * @param dev The requesting bhnd device. * * @retval 0 success * @retval non-zero If releasing PMU request state otherwise fails, a @@ -1097,6 +1032,51 @@ bhnd_release_pmu(device_t dev) return (BHND_BUS_RELEASE_PMU(device_get_parent(dev), dev)); } +/** + * Return the transition latency required for @p clock in microseconds, if + * known. + * + * The BHND_CLOCK_HT latency value is suitable for use as the D11 core's + * 'fastpwrup_dly' value. + * + * @note A driver must ask the bhnd bus to allocate PMU request state + * via BHND_BUS_ALLOC_PMU() before querying PMU clocks. + * + * @param dev The requesting bhnd device. + * @param clock The clock to be queried for transition latency. + * @param[out] latency On success, the transition latency of @p clock in + * microseconds. + * + * @retval 0 success + * @retval ENODEV If the transition latency for @p clock is not available. + */ +static inline int +bhnd_get_clock_latency(device_t dev, bhnd_clock clock, u_int *latency) +{ + return (BHND_BUS_GET_CLOCK_LATENCY(device_get_parent(dev), dev, clock, + latency)); +} + +/** + * Return the frequency for @p clock in Hz, if known. + * + * @param dev The requesting bhnd device. + * @param clock The clock to be queried. + * @param[out] freq On success, the frequency of @p clock in Hz. + * + * @note A driver must ask the bhnd bus to allocate PMU request state + * via BHND_BUS_ALLOC_PMU() before querying PMU clocks. + * + * @retval 0 success + * @retval ENODEV If the frequency for @p clock is not available. + */ +static inline int +bhnd_get_clock_freq(device_t dev, bhnd_clock clock, u_int *freq) +{ + return (BHND_BUS_GET_CLOCK_FREQ(device_get_parent(dev), dev, clock, + freq)); +} + /** * Request that @p clock (or faster) be routed to @p dev. * |