]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/bhnd/cores/pmu/bhnd_pmu_if.m
Import Amazon Elastic Network Adapter (ENA) HAL to sys/contrib/
[FreeBSD/FreeBSD.git] / sys / dev / bhnd / cores / pmu / bhnd_pmu_if.m
1 #-
2 # Copyright (c) 2016 Landon Fuller <landon@landonf.org>
3 # All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
7 # are met:
8 # 1. Redistributions of source code must retain the above copyright
9 #    notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 #    notice, this list of conditions and the following disclaimer in the
12 #    documentation and/or other materials provided with the distribution.
13 #
14 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 # IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
18 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
23 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 #
25 # $FreeBSD$
26
27 #include <sys/types.h>
28 #include <sys/bus.h>
29
30 #include <dev/bhnd/bhnd.h>
31
32 INTERFACE bhnd_pmu;
33
34 #
35 # bhnd(4) PMU interface.
36 #
37 # Provides a common PMU and clock control interface.
38 #
39
40 HEADER {
41         struct bhnd_core_pmu_info;
42 }
43
44 /** 
45  * Enabling routing of @p clock (or faster) to a requesting core.
46  *
47  * @param dev PMU device.
48  * @param pinfo PMU info for requesting core.
49  * @param clock Clock requested.
50  *
51  * @retval 0 success
52  * @retval ENODEV If an unsupported clock was requested.
53  */
54 METHOD int core_req_clock {
55         device_t                         dev;
56         struct bhnd_core_pmu_info       *pinfo;
57         bhnd_clock                       clock;
58 };
59
60
61 /** 
62  * Request that @p clocks be powered on behalf of a requesting core.
63  *
64  * This will power any clock sources (XTAL, PLL, etc,) required by
65  * @p clocks and wait until they are ready, discarding any previous
66  * requests from the @p pinfo device.
67  *
68  * Requests from multiple devices are aggregated by the PMU.
69  *
70  * @param dev PMU device.
71  * @param pinfo PMU info for requesting core.
72  * @param clocks Clocks requested.
73  *
74  * @retval 0 success
75  * @retval ENODEV If an unsupported clock was requested.
76  */
77 METHOD int core_en_clocks {
78         device_t                         dev;
79         struct bhnd_core_pmu_info       *pinfo;
80         uint32_t                         clocks;
81 };
82
83 /**
84  * Power up a core-specific external resource.
85  *
86  * @param dev The parent of @p child.
87  * @param pinfo PMU info for requesting core.
88  * @param rsrc The core-specific external resource identifier.
89  *
90  * @retval 0 success
91  * @retval ENODEV If @p rsrc is not supported by this PMU driver.
92  */
93 METHOD int core_req_ext_rsrc {
94         device_t                         dev;
95         struct bhnd_core_pmu_info       *pinfo;
96         u_int                            rsrc;
97 };
98
99 /**
100  * Power down a core-specific external resource.
101  *
102  * @param dev The parent of @p child.
103  * @param pinfo PMU info for requesting core.
104  * @param rsrc The core-specific external resource identifier.
105  *
106  * @retval 0 success
107  * @retval ENODEV If @p rsrc is not supported by this PMU driver.
108  */
109 METHOD int core_release_ext_rsrc {
110         device_t                         dev;
111         struct bhnd_core_pmu_info       *pinfo;
112         u_int                            rsrc;
113 };
114
115 /** 
116  * Release all outstanding requests (clocks, resources, etc) associated with
117  * @p pinfo.
118  *
119  * @param dev PMU device.
120  * @param pinfo PMU info for requesting core.
121  *
122  * @retval 0            success
123  * @retval non-zero    If releasing PMU request state fails, a
124  *                     regular unix error code will be returned, and
125  *                     the request state will be left unmodified.
126  */
127 METHOD int core_release {
128         device_t                         dev;
129         struct bhnd_core_pmu_info       *pinfo;
130 };