This source file includes following definitions.
- object_type_from_bios_object_id
- enum_id_from_bios_object_id
- gpu_id_from_bios_object_id
- encoder_id_from_bios_object_id
- connector_id_from_bios_object_id
- generic_id_from_bios_object_id
- id_from_bios_object_id
- object_id_from_bios_object_id
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #include "bios_parser_common.h"
27 #include "include/grph_object_ctrl_defs.h"
28
29 static enum object_type object_type_from_bios_object_id(uint32_t bios_object_id)
30 {
31 uint32_t bios_object_type = (bios_object_id & OBJECT_TYPE_MASK)
32 >> OBJECT_TYPE_SHIFT;
33 enum object_type object_type;
34
35 switch (bios_object_type) {
36 case GRAPH_OBJECT_TYPE_GPU:
37 object_type = OBJECT_TYPE_GPU;
38 break;
39 case GRAPH_OBJECT_TYPE_ENCODER:
40 object_type = OBJECT_TYPE_ENCODER;
41 break;
42 case GRAPH_OBJECT_TYPE_CONNECTOR:
43 object_type = OBJECT_TYPE_CONNECTOR;
44 break;
45 case GRAPH_OBJECT_TYPE_ROUTER:
46 object_type = OBJECT_TYPE_ROUTER;
47 break;
48 case GRAPH_OBJECT_TYPE_GENERIC:
49 object_type = OBJECT_TYPE_GENERIC;
50 break;
51 default:
52 object_type = OBJECT_TYPE_UNKNOWN;
53 break;
54 }
55
56 return object_type;
57 }
58
59 static enum object_enum_id enum_id_from_bios_object_id(uint32_t bios_object_id)
60 {
61 uint32_t bios_enum_id =
62 (bios_object_id & ENUM_ID_MASK) >> ENUM_ID_SHIFT;
63 enum object_enum_id id;
64
65 switch (bios_enum_id) {
66 case GRAPH_OBJECT_ENUM_ID1:
67 id = ENUM_ID_1;
68 break;
69 case GRAPH_OBJECT_ENUM_ID2:
70 id = ENUM_ID_2;
71 break;
72 case GRAPH_OBJECT_ENUM_ID3:
73 id = ENUM_ID_3;
74 break;
75 case GRAPH_OBJECT_ENUM_ID4:
76 id = ENUM_ID_4;
77 break;
78 case GRAPH_OBJECT_ENUM_ID5:
79 id = ENUM_ID_5;
80 break;
81 case GRAPH_OBJECT_ENUM_ID6:
82 id = ENUM_ID_6;
83 break;
84 case GRAPH_OBJECT_ENUM_ID7:
85 id = ENUM_ID_7;
86 break;
87 default:
88 id = ENUM_ID_UNKNOWN;
89 break;
90 }
91
92 return id;
93 }
94
95 static uint32_t gpu_id_from_bios_object_id(uint32_t bios_object_id)
96 {
97 return (bios_object_id & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT;
98 }
99
100 static enum encoder_id encoder_id_from_bios_object_id(uint32_t bios_object_id)
101 {
102 uint32_t bios_encoder_id = gpu_id_from_bios_object_id(bios_object_id);
103 enum encoder_id id;
104
105 switch (bios_encoder_id) {
106 case ENCODER_OBJECT_ID_INTERNAL_LVDS:
107 id = ENCODER_ID_INTERNAL_LVDS;
108 break;
109 case ENCODER_OBJECT_ID_INTERNAL_TMDS1:
110 id = ENCODER_ID_INTERNAL_TMDS1;
111 break;
112 case ENCODER_OBJECT_ID_INTERNAL_TMDS2:
113 id = ENCODER_ID_INTERNAL_TMDS2;
114 break;
115 case ENCODER_OBJECT_ID_INTERNAL_DAC1:
116 id = ENCODER_ID_INTERNAL_DAC1;
117 break;
118 case ENCODER_OBJECT_ID_INTERNAL_DAC2:
119 id = ENCODER_ID_INTERNAL_DAC2;
120 break;
121 case ENCODER_OBJECT_ID_INTERNAL_LVTM1:
122 id = ENCODER_ID_INTERNAL_LVTM1;
123 break;
124 case ENCODER_OBJECT_ID_HDMI_INTERNAL:
125 id = ENCODER_ID_INTERNAL_HDMI;
126 break;
127 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:
128 id = ENCODER_ID_INTERNAL_KLDSCP_TMDS1;
129 break;
130 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
131 id = ENCODER_ID_INTERNAL_KLDSCP_DAC1;
132 break;
133 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
134 id = ENCODER_ID_INTERNAL_KLDSCP_DAC2;
135 break;
136 case ENCODER_OBJECT_ID_MVPU_FPGA:
137 id = ENCODER_ID_EXTERNAL_MVPU_FPGA;
138 break;
139 case ENCODER_OBJECT_ID_INTERNAL_DDI:
140 id = ENCODER_ID_INTERNAL_DDI;
141 break;
142 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
143 id = ENCODER_ID_INTERNAL_UNIPHY;
144 break;
145 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
146 id = ENCODER_ID_INTERNAL_KLDSCP_LVTMA;
147 break;
148 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
149 id = ENCODER_ID_INTERNAL_UNIPHY1;
150 break;
151 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
152 id = ENCODER_ID_INTERNAL_UNIPHY2;
153 break;
154 case ENCODER_OBJECT_ID_ALMOND:
155 id = ENCODER_ID_EXTERNAL_NUTMEG;
156 break;
157 case ENCODER_OBJECT_ID_TRAVIS:
158 id = ENCODER_ID_EXTERNAL_TRAVIS;
159 break;
160 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY3:
161 id = ENCODER_ID_INTERNAL_UNIPHY3;
162 break;
163 default:
164 id = ENCODER_ID_UNKNOWN;
165 ASSERT(0);
166 break;
167 }
168
169 return id;
170 }
171
172 static enum connector_id connector_id_from_bios_object_id(
173 uint32_t bios_object_id)
174 {
175 uint32_t bios_connector_id = gpu_id_from_bios_object_id(bios_object_id);
176
177 enum connector_id id;
178
179 switch (bios_connector_id) {
180 case CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I:
181 id = CONNECTOR_ID_SINGLE_LINK_DVII;
182 break;
183 case CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I:
184 id = CONNECTOR_ID_DUAL_LINK_DVII;
185 break;
186 case CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D:
187 id = CONNECTOR_ID_SINGLE_LINK_DVID;
188 break;
189 case CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D:
190 id = CONNECTOR_ID_DUAL_LINK_DVID;
191 break;
192 case CONNECTOR_OBJECT_ID_VGA:
193 id = CONNECTOR_ID_VGA;
194 break;
195 case CONNECTOR_OBJECT_ID_HDMI_TYPE_A:
196 id = CONNECTOR_ID_HDMI_TYPE_A;
197 break;
198 case CONNECTOR_OBJECT_ID_LVDS:
199 id = CONNECTOR_ID_LVDS;
200 break;
201 case CONNECTOR_OBJECT_ID_PCIE_CONNECTOR:
202 id = CONNECTOR_ID_PCIE;
203 break;
204 case CONNECTOR_OBJECT_ID_HARDCODE_DVI:
205 id = CONNECTOR_ID_HARDCODE_DVI;
206 break;
207 case CONNECTOR_OBJECT_ID_DISPLAYPORT:
208 id = CONNECTOR_ID_DISPLAY_PORT;
209 break;
210 case CONNECTOR_OBJECT_ID_eDP:
211 id = CONNECTOR_ID_EDP;
212 break;
213 case CONNECTOR_OBJECT_ID_MXM:
214 id = CONNECTOR_ID_MXM;
215 break;
216 default:
217 id = CONNECTOR_ID_UNKNOWN;
218 break;
219 }
220
221 return id;
222 }
223
224 static enum generic_id generic_id_from_bios_object_id(uint32_t bios_object_id)
225 {
226 uint32_t bios_generic_id = gpu_id_from_bios_object_id(bios_object_id);
227
228 enum generic_id id;
229
230 switch (bios_generic_id) {
231 case GENERIC_OBJECT_ID_MXM_OPM:
232 id = GENERIC_ID_MXM_OPM;
233 break;
234 case GENERIC_OBJECT_ID_GLSYNC:
235 id = GENERIC_ID_GLSYNC;
236 break;
237 case GENERIC_OBJECT_ID_STEREO_PIN:
238 id = GENERIC_ID_STEREO;
239 break;
240 default:
241 id = GENERIC_ID_UNKNOWN;
242 break;
243 }
244
245 return id;
246 }
247
248 static uint32_t id_from_bios_object_id(enum object_type type,
249 uint32_t bios_object_id)
250 {
251 switch (type) {
252 case OBJECT_TYPE_GPU:
253 return gpu_id_from_bios_object_id(bios_object_id);
254 case OBJECT_TYPE_ENCODER:
255 return (uint32_t)encoder_id_from_bios_object_id(bios_object_id);
256 case OBJECT_TYPE_CONNECTOR:
257 return (uint32_t)connector_id_from_bios_object_id(
258 bios_object_id);
259 case OBJECT_TYPE_GENERIC:
260 return generic_id_from_bios_object_id(bios_object_id);
261 default:
262 return 0;
263 }
264 }
265
266 struct graphics_object_id object_id_from_bios_object_id(uint32_t bios_object_id)
267 {
268 enum object_type type;
269 enum object_enum_id enum_id;
270 struct graphics_object_id go_id = { 0 };
271
272 type = object_type_from_bios_object_id(bios_object_id);
273
274 if (OBJECT_TYPE_UNKNOWN == type)
275 return go_id;
276
277 enum_id = enum_id_from_bios_object_id(bios_object_id);
278
279 if (ENUM_ID_UNKNOWN == enum_id)
280 return go_id;
281
282 go_id = dal_graphics_object_id_init(
283 id_from_bios_object_id(type, bios_object_id), enum_id, type);
284
285 return go_id;
286 }
287
288