Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bhnd/bhnd_bus_if.m
Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | CODE { | ||||
} | } | ||||
static bhnd_attach_type | static bhnd_attach_type | ||||
bhnd_bus_null_get_attach_type(device_t dev, device_t child) | bhnd_bus_null_get_attach_type(device_t dev, device_t child) | ||||
{ | { | ||||
panic("bhnd_bus_get_attach_type unimplemented"); | panic("bhnd_bus_get_attach_type unimplemented"); | ||||
} | } | ||||
static bhnd_clksrc | |||||
bhnd_bus_null_pwrctl_get_clksrc(device_t dev, device_t child, | |||||
bhnd_clock clock) | |||||
{ | |||||
return (BHND_CLKSRC_UNKNOWN); | |||||
} | |||||
static int | static int | ||||
bhnd_bus_null_pwrctl_gate_clock(device_t dev, device_t child, | |||||
bhnd_clock clock) | |||||
{ | |||||
return (ENODEV); | |||||
} | |||||
static int | |||||
bhnd_bus_null_pwrctl_ungate_clock(device_t dev, device_t child, | |||||
bhnd_clock clock) | |||||
{ | |||||
return (ENODEV); | |||||
} | |||||
static int | |||||
bhnd_bus_null_read_board_info(device_t dev, device_t child, | bhnd_bus_null_read_board_info(device_t dev, device_t child, | ||||
struct bhnd_board_info *info) | struct bhnd_board_info *info) | ||||
{ | { | ||||
panic("bhnd_bus_read_boardinfo unimplemented"); | panic("bhnd_bus_read_boardinfo unimplemented"); | ||||
} | } | ||||
static void | static void | ||||
bhnd_bus_null_child_added(device_t dev, device_t child) | bhnd_bus_null_child_added(device_t dev, device_t child) | ||||
{ | { | ||||
} | } | ||||
static int | static int | ||||
bhnd_bus_null_alloc_pmu(device_t dev, device_t child) | bhnd_bus_null_alloc_pmu(device_t dev, device_t child) | ||||
{ | { | ||||
panic("bhnd_bus_alloc_pmu unimplemented"); | panic("bhnd_bus_alloc_pmu unimplemented"); | ||||
} | } | ||||
static int | static int | ||||
bhnd_bus_null_release_pmu(device_t dev, device_t child) | bhnd_bus_null_release_pmu(device_t dev, device_t child) | ||||
{ | { | ||||
panic("bhnd_bus_release_pmu unimplemented"); | panic("bhnd_bus_release_pmu unimplemented"); | ||||
} | } | ||||
static int | static int | ||||
bhnd_bus_null_get_clock_latency(device_t dev, device_t child, | |||||
bhnd_clock clock, u_int *latency) | |||||
{ | |||||
panic("bhnd_pmu_get_clock_latency unimplemented"); | |||||
} | |||||
static int | |||||
bhnd_bus_null_get_clock_freq(device_t dev, device_t child, | |||||
bhnd_clock clock, u_int *freq) | |||||
{ | |||||
panic("bhnd_pmu_get_clock_freq unimplemented"); | |||||
} | |||||
static int | |||||
bhnd_bus_null_request_clock(device_t dev, device_t child, | bhnd_bus_null_request_clock(device_t dev, device_t child, | ||||
bhnd_clock clock) | bhnd_clock clock) | ||||
{ | { | ||||
panic("bhnd_bus_request_clock unimplemented"); | panic("bhnd_bus_request_clock unimplemented"); | ||||
} | } | ||||
static int | static int | ||||
bhnd_bus_null_enable_clocks(device_t dev, device_t child, | bhnd_bus_null_enable_clocks(device_t dev, device_t child, | ||||
▲ Show 20 Lines • Show All 495 Lines • ▼ Show 20 Lines | |||||
* @retval non-zero error | * @retval non-zero error | ||||
*/ | */ | ||||
METHOD int suspend_hw { | METHOD int suspend_hw { | ||||
device_t dev; | device_t dev; | ||||
device_t child; | device_t child; | ||||
} DEFAULT bhnd_bus_null_suspend_hw; | } DEFAULT bhnd_bus_null_suspend_hw; | ||||
/** | /** | ||||
* If supported by the chipset, return the clock source for the given clock. | * Allocate per-core PMU resources and enable PMU request handling for @p child. | ||||
* | * | ||||
* This function is only supported on early PWRCTL-equipped chipsets | * The region containing the core's PMU register block (if any) must be | ||||
* that expose clock management via their host bridge interface. Currently, | * allocated via bus_alloc_resource(9) (or bhnd_alloc_resource) before | ||||
* this includes PCI (not PCIe) devices, with ChipCommon core revisions 0-9. | * calling BHND_BUS_ALLOC_PMU(), and must not be released until after | ||||
* calling BHND_BUS_RELEASE_PMU(). | |||||
* | * | ||||
* @param dev The parent of @p child. | * @param dev The parent of @p child. | ||||
* @param child The bhnd device requesting a clock source. | * @param child The requesting bhnd device. | ||||
* @param clock The clock for which a clock source will be returned. | |||||
* | * | ||||
* @retval bhnd_clksrc The clock source for @p clock. | * @retval 0 success | ||||
* @retval BHND_CLKSRC_UNKNOWN If @p clock is unsupported, or its | * @retval non-zero if enabling per-core PMU request handling fails, a | ||||
* clock source is not known to the bus. | * regular unix error code will be returned. | ||||
*/ | */ | ||||
METHOD bhnd_clksrc pwrctl_get_clksrc { | METHOD int alloc_pmu { | ||||
device_t dev; | device_t dev; | ||||
device_t child; | device_t child; | ||||
bhnd_clock clock; | } DEFAULT bhnd_bus_null_alloc_pmu; | ||||
} DEFAULT bhnd_bus_null_pwrctl_get_clksrc; | |||||
/** | /** | ||||
* If supported by the chipset, gate the clock source for @p clock | * Release per-core PMU resources allocated for @p child. Any | ||||
* outstanding PMU requests are discarded. | |||||
* | * | ||||
* 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 The parent of @p child. | * @param dev The parent of @p child. | ||||
* @param child The bhnd device requesting clock gating. | * @param child The requesting bhnd 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. | |||||
*/ | */ | ||||
METHOD int pwrctl_gate_clock { | METHOD int release_pmu { | ||||
device_t dev; | device_t dev; | ||||
device_t child; | device_t child; | ||||
bhnd_clock clock; | } DEFAULT bhnd_bus_null_release_pmu; | ||||
} DEFAULT bhnd_bus_null_pwrctl_gate_clock; | |||||
/** | /** | ||||
* If supported by the chipset, ungate the clock source for @p clock | * Return the transition latency required for @p clock in microseconds, if | ||||
* known. | |||||
* | * | ||||
* This function is only supported on early PWRCTL-equipped chipsets | * The BHND_CLOCK_HT latency value is suitable for use as the D11 core's | ||||
* that expose clock management via their host bridge interface. Currently, | * 'fastpwrup_dly' value. | ||||
* this includes PCI (not PCIe) devices, with ChipCommon core revisions 0-9. | |||||
* | * | ||||
* @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 parent of @p child. | * @param dev The parent of @p child. | ||||
* @param child The bhnd device requesting clock gating. | * @param child The requesting bhnd device. | ||||
* @param clock The clock to be enabled. | * @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 0 success | ||||
* @retval ENODEV If bus-level clock source management is not supported. | * @retval ENODEV If the transition latency for @p clock is not available. | ||||
* @retval ENXIO If bus-level management of @p clock is not supported. | |||||
*/ | */ | ||||
METHOD int pwrctl_ungate_clock { | METHOD int get_clock_latency { | ||||
device_t dev; | device_t dev; | ||||
device_t child; | device_t child; | ||||
bhnd_clock clock; | bhnd_clock clock; | ||||
} DEFAULT bhnd_bus_null_pwrctl_ungate_clock; | u_int *latency; | ||||
} DEFAULT bhnd_bus_null_get_clock_latency; | |||||
/** | /** | ||||
* Allocate and enable per-core PMU request handling for @p child. | * Return the frequency for @p clock in Hz, if known. | ||||
* | * | ||||
* The region containing the core's PMU register block (if any) must be | |||||
* allocated via bus_alloc_resource(9) (or bhnd_alloc_resource) before | |||||
* calling BHND_BUS_ALLOC_PMU(), and must not be released until after | |||||
* calling BHND_BUS_RELEASE_PMU(). | |||||
* | |||||
* @param dev The parent of @p child. | * @param dev The parent of @p child. | ||||
* @param child The requesting bhnd device. | * @param child The requesting bhnd device. | ||||
*/ | * @param clock The clock to be queried. | ||||
METHOD int alloc_pmu { | * @param[out] freq On success, the frequency of @p clock in Hz. | ||||
device_t dev; | |||||
device_t child; | |||||
} DEFAULT bhnd_bus_null_alloc_pmu; | |||||
/** | |||||
* Release per-core PMU resources allocated for @p child. Any | |||||
* outstanding PMU requests are discarded. | |||||
* | * | ||||
* @param dev The parent of @p child. | * @note A driver must ask the bhnd bus to allocate PMU request state | ||||
* @param child The requesting bhnd device. | * via BHND_BUS_ALLOC_PMU() before querying PMU clocks. | ||||
* | |||||
* @retval 0 success | |||||
* @retval ENODEV If the frequency for @p clock is not available. | |||||
*/ | */ | ||||
METHOD int release_pmu { | METHOD int get_clock_freq { | ||||
device_t dev; | device_t dev; | ||||
device_t child; | device_t child; | ||||
} DEFAULT bhnd_bus_null_release_pmu; | bhnd_clock clock; | ||||
u_int *freq; | |||||
} DEFAULT bhnd_bus_null_get_clock_freq; | |||||
/** | /** | ||||
* Request that @p clock (or faster) be routed to @p child. | * Request that @p clock (or faster) be routed to @p child. | ||||
* | * | ||||
* @note A driver must ask the bhnd bus to allocate PMU request state | * @note A driver must ask the bhnd bus to allocate PMU request state | ||||
* via BHND_BUS_ALLOC_PMU() before it can request clock resources. | * via BHND_BUS_ALLOC_PMU() before it can request clock resources. | ||||
* | * | ||||
* @note Any outstanding PMU clock requests will be discarded upon calling | * @note Any outstanding PMU clock requests will be discarded upon calling | ||||
* BHND_BUS_RESET_HW() or BHND_BUS_SUSPEND_HW(). | * BHND_BUS_RESET_HW() or BHND_BUS_SUSPEND_HW(). | ||||
* | * | ||||
* @param dev The parent of @p child. | * @param dev The parent of @p child. | ||||
* @param child The bhnd device requesting @p clock. | * @param child The bhnd device requesting @p clock. | ||||
* @param clock The requested clock source. | * @param clock The requested clock source. | ||||
* | * | ||||
* @retval 0 success | * @retval 0 success | ||||
* @retval ENODEV If an unsupported clock was requested. | * @retval ENODEV If an unsupported clock was requested. | ||||
* @retval ENXIO If the PMU has not been initialized or is otherwise unvailable. | * @retval ETIMEDOUT If the clock request succeeds, but the clock is not | ||||
* detected as ready within the PMU's maximum transition | |||||
* delay. This should not occur in normal operation. | |||||
*/ | */ | ||||
METHOD int request_clock { | METHOD int request_clock { | ||||
device_t dev; | device_t dev; | ||||
device_t child; | device_t child; | ||||
bhnd_clock clock; | bhnd_clock clock; | ||||
} DEFAULT bhnd_bus_null_request_clock; | } DEFAULT bhnd_bus_null_request_clock; | ||||
/** | /** | ||||
* Request that @p clocks be powered on behalf of @p child. | * Request that @p clocks be powered on behalf of @p child. | ||||
* | * | ||||
* This will power on clock sources (e.g. XTAL, PLL, etc) required for | * This will power on clock sources (e.g. XTAL, PLL, etc) required for | ||||
* @p clocks and wait until they are ready, discarding any previous | * @p clocks and wait until they are ready, discarding any previous | ||||
* requests by @p child. | * requests by @p child. | ||||
* | * | ||||
* @note A driver must ask the bhnd bus to allocate PMU request state | * @note A driver must ask the bhnd bus to allocate PMU request state | ||||
* via BHND_BUS_ALLOC_PMU() before it can request clock resources. | * via BHND_BUS_ALLOC_PMU() before it can request clock resources. | ||||
* | * | ||||
* @note Any outstanding PMU clock requests will be discarded upon calling | * @note Any outstanding PMU clock requests will be discarded upon calling | ||||
* BHND_BUS_RESET_HW() or BHND_BUS_SUSPEND_HW(). | * BHND_BUS_RESET_HW() or BHND_BUS_SUSPEND_HW(). | ||||
* | * | ||||
* @param dev The parent of @p child. | * @param dev The parent of @p child. | ||||
* @param child The bhnd device requesting @p clock. | * @param child The bhnd device requesting @p clock. | ||||
* @param clock The requested clock source. | * @param clock The requested clock source. | ||||
* | * | ||||
* @retval 0 success | * @retval 0 success | ||||
* @retval ENODEV If an unsupported clock was requested. | * @retval ENODEV If an unsupported clock was requested. | ||||
* @retval ENXIO If the PMU has not been initialized or is otherwise unvailable. | * @retval ETIMEDOUT If the clock request succeeds, but the clock is not | ||||
* detected as ready within the PMU's maximum transition | |||||
* delay. This should not occur in normal operation. | |||||
*/ | */ | ||||
METHOD int enable_clocks { | METHOD int enable_clocks { | ||||
device_t dev; | device_t dev; | ||||
device_t child; | device_t child; | ||||
uint32_t clocks; | uint32_t clocks; | ||||
} DEFAULT bhnd_bus_null_enable_clocks; | } DEFAULT bhnd_bus_null_enable_clocks; | ||||
/** | /** | ||||
* Power up an external PMU-managed resource assigned to @p child. | * Power up an external PMU-managed resource assigned to @p child. | ||||
* | * | ||||
* @note A driver must ask the bhnd bus to allocate PMU request state | * @note A driver must ask the bhnd bus to allocate PMU request state | ||||
* via BHND_BUS_ALLOC_PMU() before it can request PMU resources. | * via BHND_BUS_ALLOC_PMU() before it can request PMU resources. | ||||
* | * | ||||
* @note Any outstanding PMU resource requests will be released upon calling | * @note Any outstanding PMU resource requests will be released upon calling | ||||
* BHND_BUS_RESET_HW() or BHND_BUS_SUSPEND_HW(). | * BHND_BUS_RESET_HW() or BHND_BUS_SUSPEND_HW(). | ||||
* | * | ||||
* @param dev The parent of @p child. | * @param dev The parent of @p child. | ||||
* @param child The bhnd device requesting @p rsrc. | * @param child The bhnd device requesting @p rsrc. | ||||
* @param rsrc The core-specific external resource identifier. | * @param rsrc The core-specific external resource identifier. | ||||
* | * | ||||
* @retval 0 success | * @retval 0 success | ||||
* @retval ENODEV If the PMU does not support @p rsrc. | * @retval ENODEV If the PMU does not support @p rsrc. | ||||
* @retval ENXIO If the PMU has not been initialized or is otherwise unvailable. | * @retval ETIMEDOUT If the clock request succeeds, but the clock is not | ||||
* detected as ready within the PMU's maximum transition | |||||
* delay. This should not occur in normal operation. | |||||
*/ | */ | ||||
METHOD int request_ext_rsrc { | METHOD int request_ext_rsrc { | ||||
device_t dev; | device_t dev; | ||||
device_t child; | device_t child; | ||||
u_int rsrc; | u_int rsrc; | ||||
} DEFAULT bhnd_bus_null_request_ext_rsrc; | } DEFAULT bhnd_bus_null_request_ext_rsrc; | ||||
/** | /** | ||||
* Power down an external PMU-managed resource assigned to @p child. | * Power down an external PMU-managed resource assigned to @p child. | ||||
* | * | ||||
* @note A driver must ask the bhnd bus to allocate PMU request state | * @note A driver must ask the bhnd bus to allocate PMU request state | ||||
* via BHND_BUS_ALLOC_PMU() before it can request PMU resources. | * via BHND_BUS_ALLOC_PMU() before it can request PMU resources. | ||||
* | * | ||||
* @param dev The parent of @p child. | * @param dev The parent of @p child. | ||||
* @param child The bhnd device requesting @p rsrc. | * @param child The bhnd device requesting @p rsrc. | ||||
* @param rsrc The core-specific external resource number. | * @param rsrc The core-specific external resource number. | ||||
* | * | ||||
* @retval 0 success | * @retval 0 success | ||||
* @retval ENODEV If the PMU does not support @p rsrc. | * @retval ENODEV If the PMU does not support @p rsrc. | ||||
* @retval ENXIO If the PMU has not been initialized or is otherwise unvailable. | * @retval ETIMEDOUT If the clock request succeeds, but the clock is not | ||||
* detected as ready within the PMU's maximum transition | |||||
* delay. This should not occur in normal operation. | |||||
*/ | */ | ||||
METHOD int release_ext_rsrc { | METHOD int release_ext_rsrc { | ||||
device_t dev; | device_t dev; | ||||
device_t child; | device_t child; | ||||
u_int rsrc; | u_int rsrc; | ||||
} DEFAULT bhnd_bus_null_release_ext_rsrc; | } DEFAULT bhnd_bus_null_release_ext_rsrc; | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 796 Lines • Show Last 20 Lines |