diff options
Diffstat (limited to 'drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuifboardobj.h')
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuifboardobj.h | 204 |
1 files changed, 204 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuifboardobj.h b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuifboardobj.h new file mode 100644 index 00000000..ee5dfd06 --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuifboardobj.h | |||
@@ -0,0 +1,204 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | * DEALINGS IN THE SOFTWARE. | ||
21 | */ | ||
22 | #ifndef _GPMUIFBOARDOBJ_H_ | ||
23 | #define _GPMUIFBOARDOBJ_H_ | ||
24 | |||
25 | #include <nvgpu/flcnif_cmn.h> | ||
26 | #include "ctrl/ctrlboardobj.h" | ||
27 | |||
28 | /* | ||
29 | * Base structure describing a BOARDOBJ for communication between Kernel and | ||
30 | * PMU. | ||
31 | */ | ||
32 | struct nv_pmu_boardobj { | ||
33 | u8 type; | ||
34 | }; | ||
35 | |||
36 | /* | ||
37 | * Base structure describing a BOARDOBJ for Query interface between Kernel and | ||
38 | * PMU. | ||
39 | */ | ||
40 | struct nv_pmu_boardobj_query { | ||
41 | u8 type; | ||
42 | }; | ||
43 | |||
44 | /* | ||
45 | * Virtual base structure describing a BOARDOBJGRP interface between Kernel and | ||
46 | * PMU. | ||
47 | */ | ||
48 | struct nv_pmu_boardobjgrp_super { | ||
49 | u8 type; | ||
50 | u8 class_id; | ||
51 | u8 obj_slots; | ||
52 | u8 rsvd; | ||
53 | }; | ||
54 | |||
55 | struct nv_pmu_boardobjgrp { | ||
56 | struct nv_pmu_boardobjgrp_super super; | ||
57 | u32 obj_mask; | ||
58 | }; | ||
59 | |||
60 | struct nv_pmu_boardobjgrp_e32 { | ||
61 | struct nv_pmu_boardobjgrp_super super; | ||
62 | struct ctrl_boardobjgrp_mask_e32 obj_mask; | ||
63 | }; | ||
64 | |||
65 | struct nv_pmu_boardobjgrp_e255 { | ||
66 | struct nv_pmu_boardobjgrp_super super; | ||
67 | struct ctrl_boardobjgrp_mask_e255 obj_mask; | ||
68 | }; | ||
69 | |||
70 | struct nv_pmu_boardobj_cmd_grp_payload { | ||
71 | struct pmu_allocation_v3 dmem_buf; | ||
72 | struct flcn_mem_desc_v0 fb; | ||
73 | u8 hdr_size; | ||
74 | u8 entry_size; | ||
75 | }; | ||
76 | |||
77 | struct nv_pmu_boardobj_cmd_grp { | ||
78 | u8 cmd_type; | ||
79 | u8 pad[2]; | ||
80 | u8 class_id; | ||
81 | struct nv_pmu_boardobj_cmd_grp_payload grp; | ||
82 | }; | ||
83 | |||
84 | #define NV_PMU_BOARDOBJ_GRP_ALLOC_OFFSET \ | ||
85 | (NV_OFFSETOF(NV_PMU_BOARDOBJ_CMD_GRP, grp)) | ||
86 | |||
87 | struct nv_pmu_boardobj_cmd { | ||
88 | union { | ||
89 | u8 cmd_type; | ||
90 | struct nv_pmu_boardobj_cmd_grp grp; | ||
91 | struct nv_pmu_boardobj_cmd_grp grp_set; | ||
92 | struct nv_pmu_boardobj_cmd_grp grp_get_status; | ||
93 | }; | ||
94 | }; | ||
95 | |||
96 | struct nv_pmu_boardobj_msg_grp { | ||
97 | u8 msg_type; | ||
98 | bool b_success; | ||
99 | flcn_status flcn_status; | ||
100 | u8 class_id; | ||
101 | }; | ||
102 | |||
103 | struct nv_pmu_boardobj_msg { | ||
104 | union { | ||
105 | u8 msg_type; | ||
106 | struct nv_pmu_boardobj_msg_grp grp; | ||
107 | struct nv_pmu_boardobj_msg_grp grp_set; | ||
108 | struct nv_pmu_boardobj_msg_grp grp_get_status; | ||
109 | }; | ||
110 | }; | ||
111 | |||
112 | /* | ||
113 | * Macro generating structures describing classes which implement | ||
114 | * NV_PMU_BOARDOBJGRP via the NV_PMU_BOARDBOBJ_CMD_GRP SET interface. | ||
115 | * | ||
116 | * @para _eng Name of implementing engine in which this structure is | ||
117 | * found. | ||
118 | * @param _class Class ID of Objects within Board Object Group. | ||
119 | * @param _slots Max number of elements this group can contain. | ||
120 | */ | ||
121 | #define NV_PMU_BOARDOBJ_GRP_SET_MAKE(_eng, _class, _slots) \ | ||
122 | NV_PMU_MAKE_ALIGNED_STRUCT( \ | ||
123 | nv_pmu_##_eng##_##_class##_boardobjgrp_set_header, one_structure); \ | ||
124 | NV_PMU_MAKE_ALIGNED_UNION( \ | ||
125 | nv_pmu_##_eng##_##_class##_boardobj_set_union, one_union); \ | ||
126 | struct nv_pmu_##_eng##_##_class##_boardobj_grp_set { \ | ||
127 | union nv_pmu_##_eng##_##_class##_boardobjgrp_set_header_aligned hdr; \ | ||
128 | union nv_pmu_##_eng##_##_class##_boardobj_set_union_aligned objects[(_slots)];\ | ||
129 | } | ||
130 | |||
131 | /* | ||
132 | * Macro generating structures describing classes which implement | ||
133 | * NV_PMU_BOARDOBJGRP_E32 via the NV_PMU_BOARDBOBJ_CMD_GRP SET interface. | ||
134 | * | ||
135 | * @para _eng Name of implementing engine in which this structure is | ||
136 | * found. | ||
137 | * @param _class Class ID of Objects within Board Object Group. | ||
138 | */ | ||
139 | #define NV_PMU_BOARDOBJ_GRP_SET_MAKE_E32(_eng, _class) \ | ||
140 | NV_PMU_BOARDOBJ_GRP_SET_MAKE(_eng, _class, \ | ||
141 | CTRL_BOARDOBJGRP_E32_MAX_OBJECTS) | ||
142 | |||
143 | /* | ||
144 | * Macro generating structures describing classes which implement | ||
145 | * NV_PMU_BOARDOBJGRP_E255 via the NV_PMU_BOARDBOBJ_CMD_GRP SET interface. | ||
146 | * | ||
147 | * @para _eng Name of implementing engine in which this structure is | ||
148 | * found. | ||
149 | * @param _class Class ID of Objects within Board Object Group. | ||
150 | */ | ||
151 | #define NV_PMU_BOARDOBJ_GRP_SET_MAKE_E255(_eng, _class) \ | ||
152 | NV_PMU_BOARDOBJ_GRP_SET_MAKE(_eng, _class, \ | ||
153 | CTRL_BOARDOBJGRP_E255_MAX_OBJECTS) | ||
154 | |||
155 | /* | ||
156 | * Macro generating structures for querying dynamic state for classes which | ||
157 | * implement NV_PMU_BOARDOBJGRP via the NV_PMU_BOARDOBJ_CMD_GRP GET_STATUS | ||
158 | * interface. | ||
159 | * | ||
160 | * @para _eng Name of implementing engine in which this structure is | ||
161 | * found. | ||
162 | * @param _class Class ID of Objects within Board Object Group. | ||
163 | * @param _slots Max number of elements this group can contain. | ||
164 | */ | ||
165 | #define NV_PMU_BOARDOBJ_GRP_GET_STATUS_MAKE(_eng, _class, _slots) \ | ||
166 | NV_PMU_MAKE_ALIGNED_STRUCT( \ | ||
167 | nv_pmu_##_eng##_##_class##_boardobjgrp_get_status_header, struct); \ | ||
168 | NV_PMU_MAKE_ALIGNED_UNION( \ | ||
169 | nv_pmu_##_eng##_##_class##_boardobj_get_status_union, union); \ | ||
170 | struct nv_pmu_##_eng##_##_class##_boardobj_grp_get_status { \ | ||
171 | union nv_pmu_##_eng##_##_class##_boardobjgrp_get_status_header_aligned \ | ||
172 | hdr; \ | ||
173 | union nv_pmu_##_eng##_##_class##_boardobj_get_status_union_aligned \ | ||
174 | objects[(_slots)]; \ | ||
175 | } | ||
176 | |||
177 | /* | ||
178 | * Macro generating structures for querying dynamic state for classes which | ||
179 | * implement NV_PMU_BOARDOBJGRP_E32 via the NV_PMU_BOARDOBJ_CMD_GRP GET_STATUS | ||
180 | * interface. | ||
181 | * | ||
182 | * @para _eng Name of implementing engine in which this structure is | ||
183 | * found. | ||
184 | * @param _class Class ID of Objects within Board Object Group. | ||
185 | */ | ||
186 | #define NV_PMU_BOARDOBJ_GRP_GET_STATUS_MAKE_E32(_eng, _class) \ | ||
187 | NV_PMU_BOARDOBJ_GRP_GET_STATUS_MAKE(_eng, _class, \ | ||
188 | CTRL_BOARDOBJGRP_E32_MAX_OBJECTS) | ||
189 | |||
190 | /* | ||
191 | * Macro generating structures for querying dynamic state for classes which | ||
192 | * implement NV_PMU_BOARDOBJGRP_E255 via the NV_PMU_BOARDOBJ_CMD_GRP GET_STATUS | ||
193 | * interface. | ||
194 | * | ||
195 | * @para _eng Name of implementing engine in which this structure is | ||
196 | * found. | ||
197 | * @param _class Class ID of Objects within Board Object Group. | ||
198 | */ | ||
199 | #define NV_PMU_BOARDOBJ_GRP_GET_STATUS_MAKE_E255(_eng, _class) \ | ||
200 | NV_PMU_BOARDOBJ_GRP_GET_STATUS_MAKE(_eng, _class, \ | ||
201 | CTRL_BOARDOBJGRP_E255_MAX_OBJECTS) | ||
202 | |||
203 | |||
204 | #endif /* _GPMUIFBOARDOBJ_H_ */ | ||