/work/fu-intel-me-struct.c
Line | Count | Source |
1 | | /* |
2 | | * This file is auto-generated, do not modify! |
3 | | * |
4 | | * SPDX-License-Identifier: LGPL-2.1-or-later |
5 | | */ |
6 | | |
7 | | #include "config.h" |
8 | | |
9 | | #include <glib.h> |
10 | | |
11 | | #include "fu-intel-me-struct.h" |
12 | | #include "fu-byte-array.h" |
13 | | #include "fu-bytes.h" |
14 | | #include "fu-mem-private.h" |
15 | | #include "fu-string.h" |
16 | | |
17 | | #ifdef G_LOG_DOMAIN |
18 | | #undef G_LOG_DOMAIN |
19 | | #endif |
20 | 0 | #define G_LOG_DOMAIN "FuStruct" |
21 | | |
22 | | /** |
23 | | * fu_intel_me_family_to_string: |
24 | | * @val: value, e.g. %FU_INTEL_ME_FAMILY_SPS |
25 | | * |
26 | | * Converts an enumerated value to a string. |
27 | | * |
28 | | * Returns: identifier string |
29 | | **/ |
30 | | const gchar * |
31 | | fu_intel_me_family_to_string(FuIntelMeFamily val) |
32 | 0 | { |
33 | 0 | if (val == FU_INTEL_ME_FAMILY_SPS) |
34 | 0 | return "sps"; |
35 | 0 | if (val == FU_INTEL_ME_FAMILY_TXE) |
36 | 0 | return "txe"; |
37 | 0 | if (val == FU_INTEL_ME_FAMILY_ME) |
38 | 0 | return "me"; |
39 | 0 | if (val == FU_INTEL_ME_FAMILY_CSME11) |
40 | 0 | return "csme11"; |
41 | 0 | if (val == FU_INTEL_ME_FAMILY_CSME16) |
42 | 0 | return "csme16"; |
43 | 0 | if (val == FU_INTEL_ME_FAMILY_CSME18) |
44 | 0 | return "csme18"; |
45 | 0 | return NULL; |
46 | 0 | } |
47 | | |
48 | | /** |
49 | | * fu_intel_me_issue_to_string: |
50 | | * @val: value, e.g. %FU_INTEL_ME_ISSUE_NOT_VULNERABLE |
51 | | * |
52 | | * Converts an enumerated value to a string. |
53 | | * |
54 | | * Returns: identifier string |
55 | | **/ |
56 | | const gchar * |
57 | | fu_intel_me_issue_to_string(FuIntelMeIssue val) |
58 | 0 | { |
59 | 0 | if (val == FU_INTEL_ME_ISSUE_NOT_VULNERABLE) |
60 | 0 | return "not-vulnerable"; |
61 | 0 | if (val == FU_INTEL_ME_ISSUE_VULNERABLE) |
62 | 0 | return "vulnerable"; |
63 | 0 | if (val == FU_INTEL_ME_ISSUE_PATCHED) |
64 | 0 | return "patched"; |
65 | 0 | return NULL; |
66 | 0 | } |
67 | | |
68 | | /** |
69 | | * fu_me_hfs_cws_to_string: |
70 | | * @val: value, e.g. %FU_ME_HFS_CWS_INITIALIZING |
71 | | * |
72 | | * Converts an enumerated value to a string. |
73 | | * |
74 | | * Returns: identifier string |
75 | | **/ |
76 | | const gchar * |
77 | | fu_me_hfs_cws_to_string(FuMeHfsCws val) |
78 | 0 | { |
79 | 0 | if (val == FU_ME_HFS_CWS_RESET) |
80 | 0 | return "reset"; |
81 | 0 | if (val == FU_ME_HFS_CWS_INITIALIZING) |
82 | 0 | return "initializing"; |
83 | 0 | if (val == FU_ME_HFS_CWS_RECOVERY) |
84 | 0 | return "recovery"; |
85 | 0 | if (val == FU_ME_HFS_CWS_TEST) |
86 | 0 | return "test"; |
87 | 0 | if (val == FU_ME_HFS_CWS_DISABLED) |
88 | 0 | return "disabled"; |
89 | 0 | if (val == FU_ME_HFS_CWS_NORMAL) |
90 | 0 | return "normal"; |
91 | 0 | if (val == FU_ME_HFS_CWS_WAIT) |
92 | 0 | return "wait"; |
93 | 0 | if (val == FU_ME_HFS_CWS_TRANSITION) |
94 | 0 | return "transition"; |
95 | 0 | if (val == FU_ME_HFS_CWS_INVALID_CPU) |
96 | 0 | return "invalid-cpu"; |
97 | 0 | if (val == FU_ME_HFS_CWS_HALT) |
98 | 0 | return "halt"; |
99 | 0 | return NULL; |
100 | 0 | } |
101 | | |
102 | | |
103 | | /** |
104 | | * fu_me_hfs_mode_to_string: |
105 | | * @val: value, e.g. %FU_ME_HFS_MODE___RESERVED |
106 | | * |
107 | | * Converts an enumerated value to a string. |
108 | | * |
109 | | * Returns: identifier string |
110 | | **/ |
111 | | static const gchar * |
112 | | fu_me_hfs_mode_to_string(FuMeHfsMode val) |
113 | 0 | { |
114 | 0 | if (val == FU_ME_HFS_MODE_NORMAL) |
115 | 0 | return "normal"; |
116 | 0 | if (val == FU_ME_HFS_MODE___RESERVED) |
117 | 0 | return "--reserved"; |
118 | 0 | if (val == FU_ME_HFS_MODE_DEBUG) |
119 | 0 | return "debug"; |
120 | 0 | if (val == FU_ME_HFS_MODE_DISABLE) |
121 | 0 | return "disable"; |
122 | 0 | if (val == FU_ME_HFS_MODE_OVERRIDE_JUMPER) |
123 | 0 | return "override-jumper"; |
124 | 0 | if (val == FU_ME_HFS_MODE_OVERRIDE_MEI) |
125 | 0 | return "override-mei"; |
126 | 0 | if (val == FU_ME_HFS_MODE_UNKNOWN6) |
127 | 0 | return "unknown6"; |
128 | 0 | if (val == FU_ME_HFS_MODE_ENHANCED_DEBUG) |
129 | 0 | return "enhanced-debug"; |
130 | 0 | return NULL; |
131 | 0 | } |
132 | | |
133 | | |
134 | | /** |
135 | | * fu_me_hfs_enforcement_policy_to_string: |
136 | | * @val: value, e.g. %FU_ME_HFS_ENFORCEMENT_POLICY_SHUTDOWN_TO |
137 | | * |
138 | | * Converts an enumerated value to a string. |
139 | | * |
140 | | * Returns: identifier string |
141 | | **/ |
142 | | static const gchar * |
143 | | fu_me_hfs_enforcement_policy_to_string(FuMeHfsEnforcementPolicy val) |
144 | 0 | { |
145 | 0 | if (val == FU_ME_HFS_ENFORCEMENT_POLICY_NOTHING) |
146 | 0 | return "nothing"; |
147 | 0 | if (val == FU_ME_HFS_ENFORCEMENT_POLICY_SHUTDOWN_TO) |
148 | 0 | return "shutdown-to"; |
149 | 0 | if (val == FU_ME_HFS_ENFORCEMENT_POLICY_SHUTDOWN_NOW) |
150 | 0 | return "shutdown-now"; |
151 | 0 | if (val == FU_ME_HFS_ENFORCEMENT_POLICY_SHUTDOWN_30MINS) |
152 | 0 | return "shutdown-30mins"; |
153 | 0 | return NULL; |
154 | 0 | } |
155 | | |
156 | | |
157 | | /** |
158 | | * fu_struct_intel_me_hfsts_ref: (skip): |
159 | | **/ |
160 | | FuStructIntelMeHfsts * |
161 | | fu_struct_intel_me_hfsts_ref(FuStructIntelMeHfsts *st) |
162 | 0 | { |
163 | 0 | g_return_val_if_fail(st != NULL, NULL); |
164 | 0 | st->refcount++; |
165 | 0 | return st; |
166 | 0 | } |
167 | | /** |
168 | | * fu_struct_intel_me_hfsts_unref: (skip): |
169 | | **/ |
170 | | void |
171 | | fu_struct_intel_me_hfsts_unref(FuStructIntelMeHfsts *st) |
172 | 0 | { |
173 | 0 | g_return_if_fail(st != NULL); |
174 | 0 | if (st->refcount == 0) { |
175 | 0 | g_critical("FuStructIntelMeHfsts refcount already zero"); |
176 | 0 | return; |
177 | 0 | } |
178 | 0 | if (--st->refcount > 0) |
179 | 0 | return; |
180 | 0 | if (st->buf != NULL) |
181 | 0 | g_byte_array_unref(st->buf); |
182 | 0 | g_free(st); |
183 | 0 | } |
184 | | /** |
185 | | * fu_struct_intel_me_hfsts_new_internal: (skip): |
186 | | **/ |
187 | | FuStructIntelMeHfsts * |
188 | | fu_struct_intel_me_hfsts_new_internal(void) |
189 | 0 | { |
190 | 0 | FuStructIntelMeHfsts *st = g_new0(FuStructIntelMeHfsts, 1); |
191 | 0 | st->refcount = 1; |
192 | 0 | return st; |
193 | 0 | } |
194 | | |
195 | | /* getters */ |
196 | | /** |
197 | | * fu_struct_intel_me_hfsts_get_value: (skip): |
198 | | **/ |
199 | | guint32 |
200 | | fu_struct_intel_me_hfsts_get_value(const FuStructIntelMeHfsts *st) |
201 | 0 | { |
202 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
203 | 0 | return fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
204 | 0 | } |
205 | | |
206 | | /* setters */ |
207 | | /** |
208 | | * fu_struct_intel_me_hfsts_set_value: (skip): |
209 | | **/ |
210 | | void |
211 | | fu_struct_intel_me_hfsts_set_value(FuStructIntelMeHfsts *st, guint32 value) |
212 | 0 | { |
213 | 0 | g_return_if_fail(st != NULL); |
214 | 0 | fu_memwrite_uint32(st->buf->data + 0, value, G_LITTLE_ENDIAN); |
215 | 0 | } |
216 | | /** |
217 | | * fu_struct_intel_me_hfsts_new: (skip): |
218 | | **/ |
219 | | FuStructIntelMeHfsts * |
220 | | fu_struct_intel_me_hfsts_new(void) |
221 | 0 | { |
222 | 0 | FuStructIntelMeHfsts *st = fu_struct_intel_me_hfsts_new_internal(); |
223 | 0 | st->buf = g_byte_array_sized_new(4); |
224 | 0 | fu_byte_array_set_size(st->buf, 4, 0x0); |
225 | 0 | return st; |
226 | 0 | } |
227 | | /** |
228 | | * fu_struct_intel_me_hfsts_to_string: (skip): |
229 | | **/ |
230 | | gchar * |
231 | | fu_struct_intel_me_hfsts_to_string(const FuStructIntelMeHfsts *st) |
232 | 0 | { |
233 | 0 | g_autoptr(GString) str = g_string_new("FuStructIntelMeHfsts:\n"); |
234 | 0 | g_return_val_if_fail(st != NULL, NULL); |
235 | 0 | g_string_append_printf(str, " value: 0x%x\n", |
236 | 0 | (guint) fu_struct_intel_me_hfsts_get_value(st)); |
237 | 0 | if (str->len > 0) |
238 | 0 | g_string_set_size(str, str->len - 1); |
239 | 0 | return g_string_free(g_steal_pointer(&str), FALSE); |
240 | 0 | } |
241 | | gboolean |
242 | | fu_struct_intel_me_hfsts_validate_internal(FuStructIntelMeHfsts *st, GError **error) |
243 | 0 | { |
244 | 0 | g_return_val_if_fail(st != NULL, FALSE); |
245 | 0 | return TRUE; |
246 | 0 | } |
247 | | static gboolean |
248 | | fu_struct_intel_me_hfsts_parse_internal(FuStructIntelMeHfsts *st, GError **error) |
249 | 0 | { |
250 | 0 | if (g_getenv("FWUPD_VERBOSE") != NULL) { |
251 | 0 | g_autofree gchar *str = fu_struct_intel_me_hfsts_to_string(st); |
252 | 0 | g_debug("%s", str); |
253 | 0 | } |
254 | 0 | if (!fu_struct_intel_me_hfsts_validate_internal(st, error)) |
255 | 0 | return FALSE; |
256 | 0 | return TRUE; |
257 | 0 | } |
258 | | |
259 | | /** |
260 | | * fu_struct_intel_me_hfsts_parse: (skip): |
261 | | **/ |
262 | | FuStructIntelMeHfsts * |
263 | | fu_struct_intel_me_hfsts_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error) |
264 | 0 | { |
265 | 0 | g_autoptr(FuStructIntelMeHfsts) st = fu_struct_intel_me_hfsts_new_internal(); |
266 | 0 | g_return_val_if_fail(buf != NULL, NULL); |
267 | 0 | g_return_val_if_fail(error == NULL || *error == NULL, NULL); |
268 | 0 | if (!fu_memchk_read(bufsz, offset, 4, error)) { |
269 | 0 | g_prefix_error_literal(error, "invalid struct FuStructIntelMeHfsts: "); |
270 | 0 | return NULL; |
271 | 0 | } |
272 | 0 | st->buf = g_byte_array_new(); |
273 | 0 | g_byte_array_append(st->buf, buf + offset, 4); |
274 | 0 | if (!fu_struct_intel_me_hfsts_parse_internal(st, error)) |
275 | 0 | return NULL; |
276 | 0 | return g_steal_pointer(&st); |
277 | 0 | } |
278 | | /** |
279 | | * fu_mei_csme11_hfsts1_ref: (skip): |
280 | | **/ |
281 | | FuMeiCsme11Hfsts1 * |
282 | | fu_mei_csme11_hfsts1_ref(FuMeiCsme11Hfsts1 *st) |
283 | 0 | { |
284 | 0 | g_return_val_if_fail(st != NULL, NULL); |
285 | 0 | st->refcount++; |
286 | 0 | return st; |
287 | 0 | } |
288 | | /** |
289 | | * fu_mei_csme11_hfsts1_unref: (skip): |
290 | | **/ |
291 | | void |
292 | | fu_mei_csme11_hfsts1_unref(FuMeiCsme11Hfsts1 *st) |
293 | 0 | { |
294 | 0 | g_return_if_fail(st != NULL); |
295 | 0 | if (st->refcount == 0) { |
296 | 0 | g_critical("FuMeiCsme11Hfsts1 refcount already zero"); |
297 | 0 | return; |
298 | 0 | } |
299 | 0 | if (--st->refcount > 0) |
300 | 0 | return; |
301 | 0 | if (st->buf != NULL) |
302 | 0 | g_byte_array_unref(st->buf); |
303 | 0 | g_free(st); |
304 | 0 | } |
305 | | /** |
306 | | * fu_mei_csme11_hfsts1_new_internal: (skip): |
307 | | **/ |
308 | | static FuMeiCsme11Hfsts1 * |
309 | | fu_mei_csme11_hfsts1_new_internal(void) |
310 | 0 | { |
311 | 0 | FuMeiCsme11Hfsts1 *st = g_new0(FuMeiCsme11Hfsts1, 1); |
312 | 0 | st->refcount = 1; |
313 | 0 | return st; |
314 | 0 | } |
315 | | |
316 | | /* getters */ |
317 | | /** |
318 | | * fu_mei_csme11_hfsts1_get_working_state: (skip): |
319 | | **/ |
320 | | FuMeHfsCws |
321 | | fu_mei_csme11_hfsts1_get_working_state(const FuMeiCsme11Hfsts1 *st) |
322 | 0 | { |
323 | 0 | guint32 val; |
324 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
325 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(FuMeHfsCws), 0x0); |
326 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
327 | 0 | return (val >> 0) & 15; |
328 | 0 | } |
329 | | /** |
330 | | * fu_mei_csme11_hfsts1_get_mfg_mode: (skip): |
331 | | **/ |
332 | | guint32 |
333 | | fu_mei_csme11_hfsts1_get_mfg_mode(const FuMeiCsme11Hfsts1 *st) |
334 | 0 | { |
335 | 0 | guint32 val; |
336 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
337 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(guint32), 0x0); |
338 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
339 | 0 | return (val >> 4) & 1; |
340 | 0 | } |
341 | | /** |
342 | | * fu_mei_csme11_hfsts1_get_operation_mode: (skip): |
343 | | **/ |
344 | | FuMeHfsMode |
345 | | fu_mei_csme11_hfsts1_get_operation_mode(const FuMeiCsme11Hfsts1 *st) |
346 | 0 | { |
347 | 0 | guint32 val; |
348 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
349 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(FuMeHfsMode), 0x0); |
350 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
351 | 0 | return (val >> 16) & 15; |
352 | 0 | } |
353 | | |
354 | | /* setters */ |
355 | | /** |
356 | | * fu_mei_csme11_hfsts1_to_string: (skip): |
357 | | **/ |
358 | | gchar * |
359 | | fu_mei_csme11_hfsts1_to_string(const FuMeiCsme11Hfsts1 *st) |
360 | 0 | { |
361 | 0 | g_autoptr(GString) str = g_string_new("FuMeiCsme11Hfsts1:\n"); |
362 | 0 | g_return_val_if_fail(st != NULL, NULL); |
363 | 0 | { |
364 | 0 | const gchar *tmp = fu_me_hfs_cws_to_string(fu_mei_csme11_hfsts1_get_working_state(st)); |
365 | 0 | if (tmp != NULL) { |
366 | 0 | g_string_append_printf(str, " working_state: 0x%x [%s]\n", (guint) fu_mei_csme11_hfsts1_get_working_state(st), tmp); |
367 | 0 | } else { |
368 | 0 | g_string_append_printf(str, " working_state: 0x%x\n", (guint) fu_mei_csme11_hfsts1_get_working_state(st)); |
369 | 0 | } |
370 | 0 | } |
371 | 0 | g_string_append_printf(str, " mfg_mode: 0x%x\n", |
372 | 0 | (guint) fu_mei_csme11_hfsts1_get_mfg_mode(st)); |
373 | 0 | { |
374 | 0 | const gchar *tmp = fu_me_hfs_mode_to_string(fu_mei_csme11_hfsts1_get_operation_mode(st)); |
375 | 0 | if (tmp != NULL) { |
376 | 0 | g_string_append_printf(str, " operation_mode: 0x%x [%s]\n", (guint) fu_mei_csme11_hfsts1_get_operation_mode(st), tmp); |
377 | 0 | } else { |
378 | 0 | g_string_append_printf(str, " operation_mode: 0x%x\n", (guint) fu_mei_csme11_hfsts1_get_operation_mode(st)); |
379 | 0 | } |
380 | 0 | } |
381 | 0 | if (str->len > 0) |
382 | 0 | g_string_set_size(str, str->len - 1); |
383 | 0 | return g_string_free(g_steal_pointer(&str), FALSE); |
384 | 0 | } |
385 | | static gboolean |
386 | | fu_mei_csme11_hfsts1_validate_internal(FuMeiCsme11Hfsts1 *st, GError **error) |
387 | 0 | { |
388 | 0 | g_return_val_if_fail(st != NULL, FALSE); |
389 | 0 | return TRUE; |
390 | 0 | } |
391 | | static gboolean |
392 | | fu_mei_csme11_hfsts1_parse_internal(FuMeiCsme11Hfsts1 *st, GError **error) |
393 | 0 | { |
394 | 0 | if (g_getenv("FWUPD_VERBOSE") != NULL) { |
395 | 0 | g_autofree gchar *str = fu_mei_csme11_hfsts1_to_string(st); |
396 | 0 | g_debug("%s", str); |
397 | 0 | } |
398 | 0 | if (!fu_mei_csme11_hfsts1_validate_internal(st, error)) |
399 | 0 | return FALSE; |
400 | 0 | return TRUE; |
401 | 0 | } |
402 | | |
403 | | /** |
404 | | * fu_mei_csme11_hfsts1_parse: (skip): |
405 | | **/ |
406 | | FuMeiCsme11Hfsts1 * |
407 | | fu_mei_csme11_hfsts1_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error) |
408 | 0 | { |
409 | 0 | g_autoptr(FuMeiCsme11Hfsts1) st = fu_mei_csme11_hfsts1_new_internal(); |
410 | 0 | g_return_val_if_fail(buf != NULL, NULL); |
411 | 0 | g_return_val_if_fail(error == NULL || *error == NULL, NULL); |
412 | 0 | if (!fu_memchk_read(bufsz, offset, 4, error)) { |
413 | 0 | g_prefix_error_literal(error, "invalid struct FuMeiCsme11Hfsts1: "); |
414 | 0 | return NULL; |
415 | 0 | } |
416 | 0 | st->buf = g_byte_array_new(); |
417 | 0 | g_byte_array_append(st->buf, buf + offset, 4); |
418 | 0 | if (!fu_mei_csme11_hfsts1_parse_internal(st, error)) |
419 | 0 | return NULL; |
420 | 0 | return g_steal_pointer(&st); |
421 | 0 | } |
422 | | /** |
423 | | * fu_mei_csme11_hfsts2_ref: (skip): |
424 | | **/ |
425 | | FuMeiCsme11Hfsts2 * |
426 | | fu_mei_csme11_hfsts2_ref(FuMeiCsme11Hfsts2 *st) |
427 | 0 | { |
428 | 0 | g_return_val_if_fail(st != NULL, NULL); |
429 | 0 | st->refcount++; |
430 | 0 | return st; |
431 | 0 | } |
432 | | /** |
433 | | * fu_mei_csme11_hfsts2_unref: (skip): |
434 | | **/ |
435 | | void |
436 | | fu_mei_csme11_hfsts2_unref(FuMeiCsme11Hfsts2 *st) |
437 | 0 | { |
438 | 0 | g_return_if_fail(st != NULL); |
439 | 0 | if (st->refcount == 0) { |
440 | 0 | g_critical("FuMeiCsme11Hfsts2 refcount already zero"); |
441 | 0 | return; |
442 | 0 | } |
443 | 0 | if (--st->refcount > 0) |
444 | 0 | return; |
445 | 0 | if (st->buf != NULL) |
446 | 0 | g_byte_array_unref(st->buf); |
447 | 0 | g_free(st); |
448 | 0 | } |
449 | | |
450 | | /* getters */ |
451 | | |
452 | | /* setters */ |
453 | | /** |
454 | | * fu_mei_csme11_hfsts3_ref: (skip): |
455 | | **/ |
456 | | FuMeiCsme11Hfsts3 * |
457 | | fu_mei_csme11_hfsts3_ref(FuMeiCsme11Hfsts3 *st) |
458 | 0 | { |
459 | 0 | g_return_val_if_fail(st != NULL, NULL); |
460 | 0 | st->refcount++; |
461 | 0 | return st; |
462 | 0 | } |
463 | | /** |
464 | | * fu_mei_csme11_hfsts3_unref: (skip): |
465 | | **/ |
466 | | void |
467 | | fu_mei_csme11_hfsts3_unref(FuMeiCsme11Hfsts3 *st) |
468 | 0 | { |
469 | 0 | g_return_if_fail(st != NULL); |
470 | 0 | if (st->refcount == 0) { |
471 | 0 | g_critical("FuMeiCsme11Hfsts3 refcount already zero"); |
472 | 0 | return; |
473 | 0 | } |
474 | 0 | if (--st->refcount > 0) |
475 | 0 | return; |
476 | 0 | if (st->buf != NULL) |
477 | 0 | g_byte_array_unref(st->buf); |
478 | 0 | g_free(st); |
479 | 0 | } |
480 | | |
481 | | /* getters */ |
482 | | |
483 | | /* setters */ |
484 | | /** |
485 | | * fu_mei_csme11_hfsts4_ref: (skip): |
486 | | **/ |
487 | | FuMeiCsme11Hfsts4 * |
488 | | fu_mei_csme11_hfsts4_ref(FuMeiCsme11Hfsts4 *st) |
489 | 0 | { |
490 | 0 | g_return_val_if_fail(st != NULL, NULL); |
491 | 0 | st->refcount++; |
492 | 0 | return st; |
493 | 0 | } |
494 | | /** |
495 | | * fu_mei_csme11_hfsts4_unref: (skip): |
496 | | **/ |
497 | | void |
498 | | fu_mei_csme11_hfsts4_unref(FuMeiCsme11Hfsts4 *st) |
499 | 0 | { |
500 | 0 | g_return_if_fail(st != NULL); |
501 | 0 | if (st->refcount == 0) { |
502 | 0 | g_critical("FuMeiCsme11Hfsts4 refcount already zero"); |
503 | 0 | return; |
504 | 0 | } |
505 | 0 | if (--st->refcount > 0) |
506 | 0 | return; |
507 | 0 | if (st->buf != NULL) |
508 | 0 | g_byte_array_unref(st->buf); |
509 | 0 | g_free(st); |
510 | 0 | } |
511 | | |
512 | | /* getters */ |
513 | | |
514 | | /* setters */ |
515 | | /** |
516 | | * fu_mei_csme11_hfsts5_ref: (skip): |
517 | | **/ |
518 | | FuMeiCsme11Hfsts5 * |
519 | | fu_mei_csme11_hfsts5_ref(FuMeiCsme11Hfsts5 *st) |
520 | 0 | { |
521 | 0 | g_return_val_if_fail(st != NULL, NULL); |
522 | 0 | st->refcount++; |
523 | 0 | return st; |
524 | 0 | } |
525 | | /** |
526 | | * fu_mei_csme11_hfsts5_unref: (skip): |
527 | | **/ |
528 | | void |
529 | | fu_mei_csme11_hfsts5_unref(FuMeiCsme11Hfsts5 *st) |
530 | 0 | { |
531 | 0 | g_return_if_fail(st != NULL); |
532 | 0 | if (st->refcount == 0) { |
533 | 0 | g_critical("FuMeiCsme11Hfsts5 refcount already zero"); |
534 | 0 | return; |
535 | 0 | } |
536 | 0 | if (--st->refcount > 0) |
537 | 0 | return; |
538 | 0 | if (st->buf != NULL) |
539 | 0 | g_byte_array_unref(st->buf); |
540 | 0 | g_free(st); |
541 | 0 | } |
542 | | |
543 | | /* getters */ |
544 | | |
545 | | /* setters */ |
546 | | /** |
547 | | * fu_mei_csme11_hfsts6_ref: (skip): |
548 | | **/ |
549 | | FuMeiCsme11Hfsts6 * |
550 | | fu_mei_csme11_hfsts6_ref(FuMeiCsme11Hfsts6 *st) |
551 | 0 | { |
552 | 0 | g_return_val_if_fail(st != NULL, NULL); |
553 | 0 | st->refcount++; |
554 | 0 | return st; |
555 | 0 | } |
556 | | /** |
557 | | * fu_mei_csme11_hfsts6_unref: (skip): |
558 | | **/ |
559 | | void |
560 | | fu_mei_csme11_hfsts6_unref(FuMeiCsme11Hfsts6 *st) |
561 | 0 | { |
562 | 0 | g_return_if_fail(st != NULL); |
563 | 0 | if (st->refcount == 0) { |
564 | 0 | g_critical("FuMeiCsme11Hfsts6 refcount already zero"); |
565 | 0 | return; |
566 | 0 | } |
567 | 0 | if (--st->refcount > 0) |
568 | 0 | return; |
569 | 0 | if (st->buf != NULL) |
570 | 0 | g_byte_array_unref(st->buf); |
571 | 0 | g_free(st); |
572 | 0 | } |
573 | | /** |
574 | | * fu_mei_csme11_hfsts6_new_internal: (skip): |
575 | | **/ |
576 | | static FuMeiCsme11Hfsts6 * |
577 | | fu_mei_csme11_hfsts6_new_internal(void) |
578 | 0 | { |
579 | 0 | FuMeiCsme11Hfsts6 *st = g_new0(FuMeiCsme11Hfsts6, 1); |
580 | 0 | st->refcount = 1; |
581 | 0 | return st; |
582 | 0 | } |
583 | | |
584 | | /* getters */ |
585 | | /** |
586 | | * fu_mei_csme11_hfsts6_get_force_boot_guard_acm: (skip): |
587 | | **/ |
588 | | guint32 |
589 | | fu_mei_csme11_hfsts6_get_force_boot_guard_acm(const FuMeiCsme11Hfsts6 *st) |
590 | 0 | { |
591 | 0 | guint32 val; |
592 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
593 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(guint32), 0x0); |
594 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
595 | 0 | return (val >> 0) & 1; |
596 | 0 | } |
597 | | /** |
598 | | * fu_mei_csme11_hfsts6_get_error_enforce_policy: (skip): |
599 | | **/ |
600 | | FuMeHfsEnforcementPolicy |
601 | | fu_mei_csme11_hfsts6_get_error_enforce_policy(const FuMeiCsme11Hfsts6 *st) |
602 | 0 | { |
603 | 0 | guint32 val; |
604 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
605 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(FuMeHfsEnforcementPolicy), 0x0); |
606 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
607 | 0 | return (val >> 6) & 3; |
608 | 0 | } |
609 | | /** |
610 | | * fu_mei_csme11_hfsts6_get_verified_boot: (skip): |
611 | | **/ |
612 | | guint32 |
613 | | fu_mei_csme11_hfsts6_get_verified_boot(const FuMeiCsme11Hfsts6 *st) |
614 | 0 | { |
615 | 0 | guint32 val; |
616 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
617 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(guint32), 0x0); |
618 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
619 | 0 | return (val >> 9) & 1; |
620 | 0 | } |
621 | | /** |
622 | | * fu_mei_csme11_hfsts6_get_boot_guard_disable: (skip): |
623 | | **/ |
624 | | guint32 |
625 | | fu_mei_csme11_hfsts6_get_boot_guard_disable(const FuMeiCsme11Hfsts6 *st) |
626 | 0 | { |
627 | 0 | guint32 val; |
628 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
629 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(guint32), 0x0); |
630 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
631 | 0 | return (val >> 28) & 1; |
632 | 0 | } |
633 | | /** |
634 | | * fu_mei_csme11_hfsts6_get_fpf_soc_lock: (skip): |
635 | | **/ |
636 | | guint32 |
637 | | fu_mei_csme11_hfsts6_get_fpf_soc_lock(const FuMeiCsme11Hfsts6 *st) |
638 | 0 | { |
639 | 0 | guint32 val; |
640 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
641 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(guint32), 0x0); |
642 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
643 | 0 | return (val >> 30) & 1; |
644 | 0 | } |
645 | | |
646 | | /* setters */ |
647 | | /** |
648 | | * fu_mei_csme11_hfsts6_to_string: (skip): |
649 | | **/ |
650 | | static gchar * |
651 | | fu_mei_csme11_hfsts6_to_string(const FuMeiCsme11Hfsts6 *st) |
652 | 0 | { |
653 | 0 | g_autoptr(GString) str = g_string_new("FuMeiCsme11Hfsts6:\n"); |
654 | 0 | g_return_val_if_fail(st != NULL, NULL); |
655 | 0 | g_string_append_printf(str, " force_boot_guard_acm: 0x%x\n", |
656 | 0 | (guint) fu_mei_csme11_hfsts6_get_force_boot_guard_acm(st)); |
657 | 0 | { |
658 | 0 | const gchar *tmp = fu_me_hfs_enforcement_policy_to_string(fu_mei_csme11_hfsts6_get_error_enforce_policy(st)); |
659 | 0 | if (tmp != NULL) { |
660 | 0 | g_string_append_printf(str, " error_enforce_policy: 0x%x [%s]\n", (guint) fu_mei_csme11_hfsts6_get_error_enforce_policy(st), tmp); |
661 | 0 | } else { |
662 | 0 | g_string_append_printf(str, " error_enforce_policy: 0x%x\n", (guint) fu_mei_csme11_hfsts6_get_error_enforce_policy(st)); |
663 | 0 | } |
664 | 0 | } |
665 | 0 | g_string_append_printf(str, " verified_boot: 0x%x\n", |
666 | 0 | (guint) fu_mei_csme11_hfsts6_get_verified_boot(st)); |
667 | 0 | g_string_append_printf(str, " boot_guard_disable: 0x%x\n", |
668 | 0 | (guint) fu_mei_csme11_hfsts6_get_boot_guard_disable(st)); |
669 | 0 | g_string_append_printf(str, " fpf_soc_lock: 0x%x\n", |
670 | 0 | (guint) fu_mei_csme11_hfsts6_get_fpf_soc_lock(st)); |
671 | 0 | if (str->len > 0) |
672 | 0 | g_string_set_size(str, str->len - 1); |
673 | 0 | return g_string_free(g_steal_pointer(&str), FALSE); |
674 | 0 | } |
675 | | static gboolean |
676 | | fu_mei_csme11_hfsts6_validate_internal(FuMeiCsme11Hfsts6 *st, GError **error) |
677 | 0 | { |
678 | 0 | g_return_val_if_fail(st != NULL, FALSE); |
679 | 0 | return TRUE; |
680 | 0 | } |
681 | | static gboolean |
682 | | fu_mei_csme11_hfsts6_parse_internal(FuMeiCsme11Hfsts6 *st, GError **error) |
683 | 0 | { |
684 | 0 | if (g_getenv("FWUPD_VERBOSE") != NULL) { |
685 | 0 | g_autofree gchar *str = fu_mei_csme11_hfsts6_to_string(st); |
686 | 0 | g_debug("%s", str); |
687 | 0 | } |
688 | 0 | if (!fu_mei_csme11_hfsts6_validate_internal(st, error)) |
689 | 0 | return FALSE; |
690 | 0 | return TRUE; |
691 | 0 | } |
692 | | |
693 | | /** |
694 | | * fu_mei_csme11_hfsts6_parse: (skip): |
695 | | **/ |
696 | | FuMeiCsme11Hfsts6 * |
697 | | fu_mei_csme11_hfsts6_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error) |
698 | 0 | { |
699 | 0 | g_autoptr(FuMeiCsme11Hfsts6) st = fu_mei_csme11_hfsts6_new_internal(); |
700 | 0 | g_return_val_if_fail(buf != NULL, NULL); |
701 | 0 | g_return_val_if_fail(error == NULL || *error == NULL, NULL); |
702 | 0 | if (!fu_memchk_read(bufsz, offset, 4, error)) { |
703 | 0 | g_prefix_error_literal(error, "invalid struct FuMeiCsme11Hfsts6: "); |
704 | 0 | return NULL; |
705 | 0 | } |
706 | 0 | st->buf = g_byte_array_new(); |
707 | 0 | g_byte_array_append(st->buf, buf + offset, 4); |
708 | 0 | if (!fu_mei_csme11_hfsts6_parse_internal(st, error)) |
709 | 0 | return NULL; |
710 | 0 | return g_steal_pointer(&st); |
711 | 0 | } |
712 | | /** |
713 | | * fu_mei_csme18_hfsts1_ref: (skip): |
714 | | **/ |
715 | | FuMeiCsme18Hfsts1 * |
716 | | fu_mei_csme18_hfsts1_ref(FuMeiCsme18Hfsts1 *st) |
717 | 0 | { |
718 | 0 | g_return_val_if_fail(st != NULL, NULL); |
719 | 0 | st->refcount++; |
720 | 0 | return st; |
721 | 0 | } |
722 | | /** |
723 | | * fu_mei_csme18_hfsts1_unref: (skip): |
724 | | **/ |
725 | | void |
726 | | fu_mei_csme18_hfsts1_unref(FuMeiCsme18Hfsts1 *st) |
727 | 0 | { |
728 | 0 | g_return_if_fail(st != NULL); |
729 | 0 | if (st->refcount == 0) { |
730 | 0 | g_critical("FuMeiCsme18Hfsts1 refcount already zero"); |
731 | 0 | return; |
732 | 0 | } |
733 | 0 | if (--st->refcount > 0) |
734 | 0 | return; |
735 | 0 | if (st->buf != NULL) |
736 | 0 | g_byte_array_unref(st->buf); |
737 | 0 | g_free(st); |
738 | 0 | } |
739 | | /** |
740 | | * fu_mei_csme18_hfsts1_new_internal: (skip): |
741 | | **/ |
742 | | static FuMeiCsme18Hfsts1 * |
743 | | fu_mei_csme18_hfsts1_new_internal(void) |
744 | 0 | { |
745 | 0 | FuMeiCsme18Hfsts1 *st = g_new0(FuMeiCsme18Hfsts1, 1); |
746 | 0 | st->refcount = 1; |
747 | 0 | return st; |
748 | 0 | } |
749 | | |
750 | | /* getters */ |
751 | | /** |
752 | | * fu_mei_csme18_hfsts1_get_spi_protection_mode: (skip): |
753 | | **/ |
754 | | guint32 |
755 | | fu_mei_csme18_hfsts1_get_spi_protection_mode(const FuMeiCsme18Hfsts1 *st) |
756 | 0 | { |
757 | 0 | guint32 val; |
758 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
759 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(guint32), 0x0); |
760 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
761 | 0 | return (val >> 4) & 1; |
762 | 0 | } |
763 | | /** |
764 | | * fu_mei_csme18_hfsts1_get_operation_mode: (skip): |
765 | | **/ |
766 | | FuMeHfsMode |
767 | | fu_mei_csme18_hfsts1_get_operation_mode(const FuMeiCsme18Hfsts1 *st) |
768 | 0 | { |
769 | 0 | guint32 val; |
770 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
771 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(FuMeHfsMode), 0x0); |
772 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
773 | 0 | return (val >> 16) & 15; |
774 | 0 | } |
775 | | |
776 | | /* setters */ |
777 | | /** |
778 | | * fu_mei_csme18_hfsts1_to_string: (skip): |
779 | | **/ |
780 | | static gchar * |
781 | | fu_mei_csme18_hfsts1_to_string(const FuMeiCsme18Hfsts1 *st) |
782 | 0 | { |
783 | 0 | g_autoptr(GString) str = g_string_new("FuMeiCsme18Hfsts1:\n"); |
784 | 0 | g_return_val_if_fail(st != NULL, NULL); |
785 | 0 | g_string_append_printf(str, " spi_protection_mode: 0x%x\n", |
786 | 0 | (guint) fu_mei_csme18_hfsts1_get_spi_protection_mode(st)); |
787 | 0 | { |
788 | 0 | const gchar *tmp = fu_me_hfs_mode_to_string(fu_mei_csme18_hfsts1_get_operation_mode(st)); |
789 | 0 | if (tmp != NULL) { |
790 | 0 | g_string_append_printf(str, " operation_mode: 0x%x [%s]\n", (guint) fu_mei_csme18_hfsts1_get_operation_mode(st), tmp); |
791 | 0 | } else { |
792 | 0 | g_string_append_printf(str, " operation_mode: 0x%x\n", (guint) fu_mei_csme18_hfsts1_get_operation_mode(st)); |
793 | 0 | } |
794 | 0 | } |
795 | 0 | if (str->len > 0) |
796 | 0 | g_string_set_size(str, str->len - 1); |
797 | 0 | return g_string_free(g_steal_pointer(&str), FALSE); |
798 | 0 | } |
799 | | static gboolean |
800 | | fu_mei_csme18_hfsts1_validate_internal(FuMeiCsme18Hfsts1 *st, GError **error) |
801 | 0 | { |
802 | 0 | g_return_val_if_fail(st != NULL, FALSE); |
803 | 0 | return TRUE; |
804 | 0 | } |
805 | | static gboolean |
806 | | fu_mei_csme18_hfsts1_parse_internal(FuMeiCsme18Hfsts1 *st, GError **error) |
807 | 0 | { |
808 | 0 | if (g_getenv("FWUPD_VERBOSE") != NULL) { |
809 | 0 | g_autofree gchar *str = fu_mei_csme18_hfsts1_to_string(st); |
810 | 0 | g_debug("%s", str); |
811 | 0 | } |
812 | 0 | if (!fu_mei_csme18_hfsts1_validate_internal(st, error)) |
813 | 0 | return FALSE; |
814 | 0 | return TRUE; |
815 | 0 | } |
816 | | |
817 | | /** |
818 | | * fu_mei_csme18_hfsts1_parse: (skip): |
819 | | **/ |
820 | | FuMeiCsme18Hfsts1 * |
821 | | fu_mei_csme18_hfsts1_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error) |
822 | 0 | { |
823 | 0 | g_autoptr(FuMeiCsme18Hfsts1) st = fu_mei_csme18_hfsts1_new_internal(); |
824 | 0 | g_return_val_if_fail(buf != NULL, NULL); |
825 | 0 | g_return_val_if_fail(error == NULL || *error == NULL, NULL); |
826 | 0 | if (!fu_memchk_read(bufsz, offset, 4, error)) { |
827 | 0 | g_prefix_error_literal(error, "invalid struct FuMeiCsme18Hfsts1: "); |
828 | 0 | return NULL; |
829 | 0 | } |
830 | 0 | st->buf = g_byte_array_new(); |
831 | 0 | g_byte_array_append(st->buf, buf + offset, 4); |
832 | 0 | if (!fu_mei_csme18_hfsts1_parse_internal(st, error)) |
833 | 0 | return NULL; |
834 | 0 | return g_steal_pointer(&st); |
835 | 0 | } |
836 | | /** |
837 | | * fu_mei_csme18_hfsts2_ref: (skip): |
838 | | **/ |
839 | | FuMeiCsme18Hfsts2 * |
840 | | fu_mei_csme18_hfsts2_ref(FuMeiCsme18Hfsts2 *st) |
841 | 0 | { |
842 | 0 | g_return_val_if_fail(st != NULL, NULL); |
843 | 0 | st->refcount++; |
844 | 0 | return st; |
845 | 0 | } |
846 | | /** |
847 | | * fu_mei_csme18_hfsts2_unref: (skip): |
848 | | **/ |
849 | | void |
850 | | fu_mei_csme18_hfsts2_unref(FuMeiCsme18Hfsts2 *st) |
851 | 0 | { |
852 | 0 | g_return_if_fail(st != NULL); |
853 | 0 | if (st->refcount == 0) { |
854 | 0 | g_critical("FuMeiCsme18Hfsts2 refcount already zero"); |
855 | 0 | return; |
856 | 0 | } |
857 | 0 | if (--st->refcount > 0) |
858 | 0 | return; |
859 | 0 | if (st->buf != NULL) |
860 | 0 | g_byte_array_unref(st->buf); |
861 | 0 | g_free(st); |
862 | 0 | } |
863 | | |
864 | | /* getters */ |
865 | | |
866 | | /* setters */ |
867 | | /** |
868 | | * fu_mei_csme18_hfsts3_ref: (skip): |
869 | | **/ |
870 | | FuMeiCsme18Hfsts3 * |
871 | | fu_mei_csme18_hfsts3_ref(FuMeiCsme18Hfsts3 *st) |
872 | 0 | { |
873 | 0 | g_return_val_if_fail(st != NULL, NULL); |
874 | 0 | st->refcount++; |
875 | 0 | return st; |
876 | 0 | } |
877 | | /** |
878 | | * fu_mei_csme18_hfsts3_unref: (skip): |
879 | | **/ |
880 | | void |
881 | | fu_mei_csme18_hfsts3_unref(FuMeiCsme18Hfsts3 *st) |
882 | 0 | { |
883 | 0 | g_return_if_fail(st != NULL); |
884 | 0 | if (st->refcount == 0) { |
885 | 0 | g_critical("FuMeiCsme18Hfsts3 refcount already zero"); |
886 | 0 | return; |
887 | 0 | } |
888 | 0 | if (--st->refcount > 0) |
889 | 0 | return; |
890 | 0 | if (st->buf != NULL) |
891 | 0 | g_byte_array_unref(st->buf); |
892 | 0 | g_free(st); |
893 | 0 | } |
894 | | |
895 | | /* getters */ |
896 | | |
897 | | /* setters */ |
898 | | /** |
899 | | * fu_mei_csme18_hfsts4_ref: (skip): |
900 | | **/ |
901 | | FuMeiCsme18Hfsts4 * |
902 | | fu_mei_csme18_hfsts4_ref(FuMeiCsme18Hfsts4 *st) |
903 | 0 | { |
904 | 0 | g_return_val_if_fail(st != NULL, NULL); |
905 | 0 | st->refcount++; |
906 | 0 | return st; |
907 | 0 | } |
908 | | /** |
909 | | * fu_mei_csme18_hfsts4_unref: (skip): |
910 | | **/ |
911 | | void |
912 | | fu_mei_csme18_hfsts4_unref(FuMeiCsme18Hfsts4 *st) |
913 | 0 | { |
914 | 0 | g_return_if_fail(st != NULL); |
915 | 0 | if (st->refcount == 0) { |
916 | 0 | g_critical("FuMeiCsme18Hfsts4 refcount already zero"); |
917 | 0 | return; |
918 | 0 | } |
919 | 0 | if (--st->refcount > 0) |
920 | 0 | return; |
921 | 0 | if (st->buf != NULL) |
922 | 0 | g_byte_array_unref(st->buf); |
923 | 0 | g_free(st); |
924 | 0 | } |
925 | | |
926 | | /* getters */ |
927 | | |
928 | | /* setters */ |
929 | | /** |
930 | | * fu_mei_csme18_hfsts5_ref: (skip): |
931 | | **/ |
932 | | FuMeiCsme18Hfsts5 * |
933 | | fu_mei_csme18_hfsts5_ref(FuMeiCsme18Hfsts5 *st) |
934 | 0 | { |
935 | 0 | g_return_val_if_fail(st != NULL, NULL); |
936 | 0 | st->refcount++; |
937 | 0 | return st; |
938 | 0 | } |
939 | | /** |
940 | | * fu_mei_csme18_hfsts5_unref: (skip): |
941 | | **/ |
942 | | void |
943 | | fu_mei_csme18_hfsts5_unref(FuMeiCsme18Hfsts5 *st) |
944 | 0 | { |
945 | 0 | g_return_if_fail(st != NULL); |
946 | 0 | if (st->refcount == 0) { |
947 | 0 | g_critical("FuMeiCsme18Hfsts5 refcount already zero"); |
948 | 0 | return; |
949 | 0 | } |
950 | 0 | if (--st->refcount > 0) |
951 | 0 | return; |
952 | 0 | if (st->buf != NULL) |
953 | 0 | g_byte_array_unref(st->buf); |
954 | 0 | g_free(st); |
955 | 0 | } |
956 | | /** |
957 | | * fu_mei_csme18_hfsts5_new_internal: (skip): |
958 | | **/ |
959 | | static FuMeiCsme18Hfsts5 * |
960 | | fu_mei_csme18_hfsts5_new_internal(void) |
961 | 0 | { |
962 | 0 | FuMeiCsme18Hfsts5 *st = g_new0(FuMeiCsme18Hfsts5, 1); |
963 | 0 | st->refcount = 1; |
964 | 0 | return st; |
965 | 0 | } |
966 | | |
967 | | /* getters */ |
968 | | /** |
969 | | * fu_mei_csme18_hfsts5_get_btg_acm_active: (skip): |
970 | | **/ |
971 | | guint32 |
972 | | fu_mei_csme18_hfsts5_get_btg_acm_active(const FuMeiCsme18Hfsts5 *st) |
973 | 0 | { |
974 | 0 | guint32 val; |
975 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
976 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(guint32), 0x0); |
977 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
978 | 0 | return (val >> 0) & 1; |
979 | 0 | } |
980 | | /** |
981 | | * fu_mei_csme18_hfsts5_get_valid: (skip): |
982 | | **/ |
983 | | guint32 |
984 | | fu_mei_csme18_hfsts5_get_valid(const FuMeiCsme18Hfsts5 *st) |
985 | 0 | { |
986 | 0 | guint32 val; |
987 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
988 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(guint32), 0x0); |
989 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
990 | 0 | return (val >> 1) & 1; |
991 | 0 | } |
992 | | /** |
993 | | * fu_mei_csme18_hfsts5_get_acm_done_sts: (skip): |
994 | | **/ |
995 | | guint32 |
996 | | fu_mei_csme18_hfsts5_get_acm_done_sts(const FuMeiCsme18Hfsts5 *st) |
997 | 0 | { |
998 | 0 | guint32 val; |
999 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
1000 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(guint32), 0x0); |
1001 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
1002 | 0 | return (val >> 8) & 1; |
1003 | 0 | } |
1004 | | |
1005 | | /* setters */ |
1006 | | /** |
1007 | | * fu_mei_csme18_hfsts5_to_string: (skip): |
1008 | | **/ |
1009 | | static gchar * |
1010 | | fu_mei_csme18_hfsts5_to_string(const FuMeiCsme18Hfsts5 *st) |
1011 | 0 | { |
1012 | 0 | g_autoptr(GString) str = g_string_new("FuMeiCsme18Hfsts5:\n"); |
1013 | 0 | g_return_val_if_fail(st != NULL, NULL); |
1014 | 0 | g_string_append_printf(str, " btg_acm_active: 0x%x\n", |
1015 | 0 | (guint) fu_mei_csme18_hfsts5_get_btg_acm_active(st)); |
1016 | 0 | g_string_append_printf(str, " valid: 0x%x\n", |
1017 | 0 | (guint) fu_mei_csme18_hfsts5_get_valid(st)); |
1018 | 0 | g_string_append_printf(str, " acm_done_sts: 0x%x\n", |
1019 | 0 | (guint) fu_mei_csme18_hfsts5_get_acm_done_sts(st)); |
1020 | 0 | if (str->len > 0) |
1021 | 0 | g_string_set_size(str, str->len - 1); |
1022 | 0 | return g_string_free(g_steal_pointer(&str), FALSE); |
1023 | 0 | } |
1024 | | static gboolean |
1025 | | fu_mei_csme18_hfsts5_validate_internal(FuMeiCsme18Hfsts5 *st, GError **error) |
1026 | 0 | { |
1027 | 0 | g_return_val_if_fail(st != NULL, FALSE); |
1028 | 0 | return TRUE; |
1029 | 0 | } |
1030 | | static gboolean |
1031 | | fu_mei_csme18_hfsts5_parse_internal(FuMeiCsme18Hfsts5 *st, GError **error) |
1032 | 0 | { |
1033 | 0 | if (g_getenv("FWUPD_VERBOSE") != NULL) { |
1034 | 0 | g_autofree gchar *str = fu_mei_csme18_hfsts5_to_string(st); |
1035 | 0 | g_debug("%s", str); |
1036 | 0 | } |
1037 | 0 | if (!fu_mei_csme18_hfsts5_validate_internal(st, error)) |
1038 | 0 | return FALSE; |
1039 | 0 | return TRUE; |
1040 | 0 | } |
1041 | | |
1042 | | /** |
1043 | | * fu_mei_csme18_hfsts5_parse: (skip): |
1044 | | **/ |
1045 | | FuMeiCsme18Hfsts5 * |
1046 | | fu_mei_csme18_hfsts5_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error) |
1047 | 0 | { |
1048 | 0 | g_autoptr(FuMeiCsme18Hfsts5) st = fu_mei_csme18_hfsts5_new_internal(); |
1049 | 0 | g_return_val_if_fail(buf != NULL, NULL); |
1050 | 0 | g_return_val_if_fail(error == NULL || *error == NULL, NULL); |
1051 | 0 | if (!fu_memchk_read(bufsz, offset, 4, error)) { |
1052 | 0 | g_prefix_error_literal(error, "invalid struct FuMeiCsme18Hfsts5: "); |
1053 | 0 | return NULL; |
1054 | 0 | } |
1055 | 0 | st->buf = g_byte_array_new(); |
1056 | 0 | g_byte_array_append(st->buf, buf + offset, 4); |
1057 | 0 | if (!fu_mei_csme18_hfsts5_parse_internal(st, error)) |
1058 | 0 | return NULL; |
1059 | 0 | return g_steal_pointer(&st); |
1060 | 0 | } |
1061 | | /** |
1062 | | * fu_mei_csme18_hfsts6_ref: (skip): |
1063 | | **/ |
1064 | | FuMeiCsme18Hfsts6 * |
1065 | | fu_mei_csme18_hfsts6_ref(FuMeiCsme18Hfsts6 *st) |
1066 | 0 | { |
1067 | 0 | g_return_val_if_fail(st != NULL, NULL); |
1068 | 0 | st->refcount++; |
1069 | 0 | return st; |
1070 | 0 | } |
1071 | | /** |
1072 | | * fu_mei_csme18_hfsts6_unref: (skip): |
1073 | | **/ |
1074 | | void |
1075 | | fu_mei_csme18_hfsts6_unref(FuMeiCsme18Hfsts6 *st) |
1076 | 0 | { |
1077 | 0 | g_return_if_fail(st != NULL); |
1078 | 0 | if (st->refcount == 0) { |
1079 | 0 | g_critical("FuMeiCsme18Hfsts6 refcount already zero"); |
1080 | 0 | return; |
1081 | 0 | } |
1082 | 0 | if (--st->refcount > 0) |
1083 | 0 | return; |
1084 | 0 | if (st->buf != NULL) |
1085 | 0 | g_byte_array_unref(st->buf); |
1086 | 0 | g_free(st); |
1087 | 0 | } |
1088 | | /** |
1089 | | * fu_mei_csme18_hfsts6_new_internal: (skip): |
1090 | | **/ |
1091 | | static FuMeiCsme18Hfsts6 * |
1092 | | fu_mei_csme18_hfsts6_new_internal(void) |
1093 | 0 | { |
1094 | 0 | FuMeiCsme18Hfsts6 *st = g_new0(FuMeiCsme18Hfsts6, 1); |
1095 | 0 | st->refcount = 1; |
1096 | 0 | return st; |
1097 | 0 | } |
1098 | | |
1099 | | /* getters */ |
1100 | | /** |
1101 | | * fu_mei_csme18_hfsts6_get_fpf_soc_configuration_lock: (skip): |
1102 | | **/ |
1103 | | guint32 |
1104 | | fu_mei_csme18_hfsts6_get_fpf_soc_configuration_lock(const FuMeiCsme18Hfsts6 *st) |
1105 | 0 | { |
1106 | 0 | guint32 val; |
1107 | 0 | g_return_val_if_fail(st != NULL, 0x0); |
1108 | 0 | g_return_val_if_fail(st->buf->len >= sizeof(guint32), 0x0); |
1109 | 0 | val = fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN); |
1110 | 0 | return (val >> 30) & 1; |
1111 | 0 | } |
1112 | | |
1113 | | /* setters */ |
1114 | | /** |
1115 | | * fu_mei_csme18_hfsts6_to_string: (skip): |
1116 | | **/ |
1117 | | static gchar * |
1118 | | fu_mei_csme18_hfsts6_to_string(const FuMeiCsme18Hfsts6 *st) |
1119 | 0 | { |
1120 | 0 | g_autoptr(GString) str = g_string_new("FuMeiCsme18Hfsts6:\n"); |
1121 | 0 | g_return_val_if_fail(st != NULL, NULL); |
1122 | 0 | g_string_append_printf(str, " fpf_soc_configuration_lock: 0x%x\n", |
1123 | 0 | (guint) fu_mei_csme18_hfsts6_get_fpf_soc_configuration_lock(st)); |
1124 | 0 | if (str->len > 0) |
1125 | 0 | g_string_set_size(str, str->len - 1); |
1126 | 0 | return g_string_free(g_steal_pointer(&str), FALSE); |
1127 | 0 | } |
1128 | | static gboolean |
1129 | | fu_mei_csme18_hfsts6_validate_internal(FuMeiCsme18Hfsts6 *st, GError **error) |
1130 | 0 | { |
1131 | 0 | g_return_val_if_fail(st != NULL, FALSE); |
1132 | 0 | return TRUE; |
1133 | 0 | } |
1134 | | static gboolean |
1135 | | fu_mei_csme18_hfsts6_parse_internal(FuMeiCsme18Hfsts6 *st, GError **error) |
1136 | 0 | { |
1137 | 0 | if (g_getenv("FWUPD_VERBOSE") != NULL) { |
1138 | 0 | g_autofree gchar *str = fu_mei_csme18_hfsts6_to_string(st); |
1139 | 0 | g_debug("%s", str); |
1140 | 0 | } |
1141 | 0 | if (!fu_mei_csme18_hfsts6_validate_internal(st, error)) |
1142 | 0 | return FALSE; |
1143 | 0 | return TRUE; |
1144 | 0 | } |
1145 | | |
1146 | | /** |
1147 | | * fu_mei_csme18_hfsts6_parse: (skip): |
1148 | | **/ |
1149 | | FuMeiCsme18Hfsts6 * |
1150 | | fu_mei_csme18_hfsts6_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error) |
1151 | 0 | { |
1152 | 0 | g_autoptr(FuMeiCsme18Hfsts6) st = fu_mei_csme18_hfsts6_new_internal(); |
1153 | 0 | g_return_val_if_fail(buf != NULL, NULL); |
1154 | 0 | g_return_val_if_fail(error == NULL || *error == NULL, NULL); |
1155 | 0 | if (!fu_memchk_read(bufsz, offset, 4, error)) { |
1156 | 0 | g_prefix_error_literal(error, "invalid struct FuMeiCsme18Hfsts6: "); |
1157 | 0 | return NULL; |
1158 | 0 | } |
1159 | 0 | st->buf = g_byte_array_new(); |
1160 | 0 | g_byte_array_append(st->buf, buf + offset, 4); |
1161 | 0 | if (!fu_mei_csme18_hfsts6_parse_internal(st, error)) |
1162 | 0 | return NULL; |
1163 | 0 | return g_steal_pointer(&st); |
1164 | 0 | } |