diff options
Diffstat (limited to 'drivers/gpu/nvgpu/pmuif/gpmuifboardobj.h')
-rw-r--r-- | drivers/gpu/nvgpu/pmuif/gpmuifboardobj.h | 196 |
1 files changed, 196 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/pmuif/gpmuifboardobj.h b/drivers/gpu/nvgpu/pmuif/gpmuifboardobj.h new file mode 100644 index 00000000..7a061472 --- /dev/null +++ b/drivers/gpu/nvgpu/pmuif/gpmuifboardobj.h | |||
@@ -0,0 +1,196 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | */ | ||
13 | #ifndef _GPMUIFBOARDOBJ_H_ | ||
14 | #define _GPMUIFBOARDOBJ_H_ | ||
15 | |||
16 | #include "gk20a/gk20a.h" | ||
17 | #include "gk20a/pmu_gk20a.h" | ||
18 | #include "ctrl/ctrlboardobj.h" | ||
19 | |||
20 | /* | ||
21 | * Base structure describing a BOARDOBJ for communication between Kernel and | ||
22 | * PMU. | ||
23 | */ | ||
24 | struct nv_pmu_boardobj { | ||
25 | u8 type; | ||
26 | }; | ||
27 | |||
28 | /* | ||
29 | * Base structure describing a BOARDOBJ for Query interface between Kernel and | ||
30 | * PMU. | ||
31 | */ | ||
32 | struct nv_pmu_boardobj_query { | ||
33 | u8 type; | ||
34 | }; | ||
35 | |||
36 | /* | ||
37 | * Virtual base structure describing a BOARDOBJGRP interface between Kernel and | ||
38 | * PMU. | ||
39 | */ | ||
40 | struct nv_pmu_boardobjgrp_super { | ||
41 | u8 type; | ||
42 | u8 class_id; | ||
43 | u8 obj_slots; | ||
44 | u8 rsvd; | ||
45 | }; | ||
46 | |||
47 | struct nv_pmu_boardobjgrp { | ||
48 | struct nv_pmu_boardobjgrp_super super; | ||
49 | u32 obj_mask; | ||
50 | }; | ||
51 | |||
52 | struct nv_pmu_boardobjgrp_e32 { | ||
53 | struct nv_pmu_boardobjgrp_super super; | ||
54 | struct ctrl_boardobjgrp_mask_e32 obj_mask; | ||
55 | }; | ||
56 | |||
57 | struct nv_pmu_boardobjgrp_e255 { | ||
58 | struct nv_pmu_boardobjgrp_super super; | ||
59 | struct ctrl_boardobjgrp_mask_e255 obj_mask; | ||
60 | }; | ||
61 | |||
62 | struct nv_pmu_boardobj_cmd_grp_payload { | ||
63 | struct pmu_allocation_v3 dmem_buf; | ||
64 | struct flcn_mem_desc_v0 fb; | ||
65 | u8 hdr_size; | ||
66 | u8 entry_size; | ||
67 | }; | ||
68 | |||
69 | struct nv_pmu_boardobj_cmd_grp { | ||
70 | u8 cmd_type; | ||
71 | u8 pad[2]; | ||
72 | u8 class_id; | ||
73 | struct nv_pmu_boardobj_cmd_grp_payload grp; | ||
74 | }; | ||
75 | |||
76 | #define NV_PMU_BOARDOBJ_GRP_ALLOC_OFFSET \ | ||
77 | (NV_OFFSETOF(NV_PMU_BOARDOBJ_CMD_GRP, grp)) | ||
78 | |||
79 | struct nv_pmu_boardobj_cmd { | ||
80 | union { | ||
81 | u8 cmd_type; | ||
82 | struct nv_pmu_boardobj_cmd_grp grp; | ||
83 | struct nv_pmu_boardobj_cmd_grp grp_set; | ||
84 | struct nv_pmu_boardobj_cmd_grp grp_get_status; | ||
85 | }; | ||
86 | }; | ||
87 | |||
88 | struct nv_pmu_boardobj_msg_grp { | ||
89 | u8 msg_type; | ||
90 | bool b_success; | ||
91 | flcn_status flcn_status; | ||
92 | u8 class_id; | ||
93 | }; | ||
94 | |||
95 | struct nv_pmu_boardobj_msg { | ||
96 | union { | ||
97 | u8 msg_type; | ||
98 | struct nv_pmu_boardobj_msg_grp grp; | ||
99 | struct nv_pmu_boardobj_msg_grp grp_set; | ||
100 | struct nv_pmu_boardobj_msg_grp grp_get_status; | ||
101 | }; | ||
102 | }; | ||
103 | |||
104 | /* | ||
105 | * Macro generating structures describing classes which implement | ||
106 | * NV_PMU_BOARDOBJGRP via the NV_PMU_BOARDBOBJ_CMD_GRP SET interface. | ||
107 | * | ||
108 | * @para _eng Name of implementing engine in which this structure is | ||
109 | * found. | ||
110 | * @param _class Class ID of Objects within Board Object Group. | ||
111 | * @param _slots Max number of elements this group can contain. | ||
112 | */ | ||
113 | #define NV_PMU_BOARDOBJ_GRP_SET_MAKE(_eng, _class, _slots) \ | ||
114 | NV_PMU_MAKE_ALIGNED_STRUCT( \ | ||
115 | nv_pmu_##_eng##_##_class##_boardobjgrp_set_header, one_structure); \ | ||
116 | NV_PMU_MAKE_ALIGNED_UNION( \ | ||
117 | nv_pmu_##_eng##_##_class##_boardobj_set_union, one_union); \ | ||
118 | struct nv_pmu_##_eng##_##_class##_boardobj_grp_set { \ | ||
119 | union nv_pmu_##_eng##_##_class##_boardobjgrp_set_header_aligned hdr; \ | ||
120 | union nv_pmu_##_eng##_##_class##_boardobj_set_union_aligned objects[(_slots)];\ | ||
121 | } | ||
122 | |||
123 | /* | ||
124 | * Macro generating structures describing classes which implement | ||
125 | * NV_PMU_BOARDOBJGRP_E32 via the NV_PMU_BOARDBOBJ_CMD_GRP SET interface. | ||
126 | * | ||
127 | * @para _eng Name of implementing engine in which this structure is | ||
128 | * found. | ||
129 | * @param _class Class ID of Objects within Board Object Group. | ||
130 | */ | ||
131 | #define NV_PMU_BOARDOBJ_GRP_SET_MAKE_E32(_eng, _class) \ | ||
132 | NV_PMU_BOARDOBJ_GRP_SET_MAKE(_eng, _class, \ | ||
133 | CTRL_BOARDOBJGRP_E32_MAX_OBJECTS) | ||
134 | |||
135 | /* | ||
136 | * Macro generating structures describing classes which implement | ||
137 | * NV_PMU_BOARDOBJGRP_E255 via the NV_PMU_BOARDBOBJ_CMD_GRP SET interface. | ||
138 | * | ||
139 | * @para _eng Name of implementing engine in which this structure is | ||
140 | * found. | ||
141 | * @param _class Class ID of Objects within Board Object Group. | ||
142 | */ | ||
143 | #define NV_PMU_BOARDOBJ_GRP_SET_MAKE_E255(_eng, _class) \ | ||
144 | NV_PMU_BOARDOBJ_GRP_SET_MAKE(_eng, _class, \ | ||
145 | CTRL_BOARDOBJGRP_E255_MAX_OBJECTS) | ||
146 | |||
147 | /* | ||
148 | * Macro generating structures for querying dynamic state for classes which | ||
149 | * implement NV_PMU_BOARDOBJGRP via the NV_PMU_BOARDOBJ_CMD_GRP GET_STATUS | ||
150 | * interface. | ||
151 | * | ||
152 | * @para _eng Name of implementing engine in which this structure is | ||
153 | * found. | ||
154 | * @param _class Class ID of Objects within Board Object Group. | ||
155 | * @param _slots Max number of elements this group can contain. | ||
156 | */ | ||
157 | #define NV_PMU_BOARDOBJ_GRP_GET_STATUS_MAKE(_eng, _class, _slots) \ | ||
158 | NV_PMU_MAKE_ALIGNED_STRUCT( \ | ||
159 | nv_pmu_##_eng##_##_class##_boardobjgrp_get_status_header, struct); \ | ||
160 | NV_PMU_MAKE_ALIGNED_UNION( \ | ||
161 | nv_pmu_##_eng##_##_class##_boardobj_get_status_union, union); \ | ||
162 | struct nv_pmu_##_eng##_##_class##_boardobj_grp_get_status { \ | ||
163 | union nv_pmu_##_eng##_##_class##_boardobjgrp_get_status_header_aligned \ | ||
164 | hdr; \ | ||
165 | union nv_pmu_##_eng##_##_class##_boardobj_get_status_union_aligned \ | ||
166 | objects[(_slots)]; \ | ||
167 | } | ||
168 | |||
169 | /* | ||
170 | * Macro generating structures for querying dynamic state for classes which | ||
171 | * implement NV_PMU_BOARDOBJGRP_E32 via the NV_PMU_BOARDOBJ_CMD_GRP GET_STATUS | ||
172 | * interface. | ||
173 | * | ||
174 | * @para _eng Name of implementing engine in which this structure is | ||
175 | * found. | ||
176 | * @param _class Class ID of Objects within Board Object Group. | ||
177 | */ | ||
178 | #define NV_PMU_BOARDOBJ_GRP_GET_STATUS_MAKE_E32(_eng, _class) \ | ||
179 | NV_PMU_BOARDOBJ_GRP_GET_STATUS_MAKE(_eng, _class, \ | ||
180 | CTRL_BOARDOBJGRP_E32_MAX_OBJECTS) | ||
181 | |||
182 | /* | ||
183 | * Macro generating structures for querying dynamic state for classes which | ||
184 | * implement NV_PMU_BOARDOBJGRP_E255 via the NV_PMU_BOARDOBJ_CMD_GRP GET_STATUS | ||
185 | * interface. | ||
186 | * | ||
187 | * @para _eng Name of implementing engine in which this structure is | ||
188 | * found. | ||
189 | * @param _class Class ID of Objects within Board Object Group. | ||
190 | */ | ||
191 | #define NV_PMU_BOARDOBJ_GRP_GET_STATUS_MAKE_E255(_eng, _class) \ | ||
192 | NV_PMU_BOARDOBJ_GRP_GET_STATUS_MAKE(_eng, _class, \ | ||
193 | CTRL_BOARDOBJGRP_E255_MAX_OBJECTS) | ||
194 | |||
195 | |||
196 | #endif /* _GPMUIFBOARDOBJ_H_ */ | ||