This source file includes following definitions.
- acpi_ut_get_region_name
- acpi_ut_get_event_name
- acpi_ut_get_type_name
- acpi_ut_get_object_type_name
- acpi_ut_get_node_name
- acpi_ut_get_descriptor_name
- acpi_ut_get_reference_name
- acpi_ut_get_mutex_name
- acpi_ut_get_notify_name
- acpi_ut_get_argument_type_name
- acpi_ut_valid_object_type
1
2
3
4
5
6
7
8
9
10 #include <acpi/acpi.h>
11 #include "accommon.h"
12 #include "acnamesp.h"
13 #include "amlcode.h"
14
15 #define _COMPONENT ACPI_UTILITIES
16 ACPI_MODULE_NAME("utdecode")
17
18
19
20
21
22 const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES] = {
23 ACPI_NS_NORMAL,
24 ACPI_NS_NORMAL,
25 ACPI_NS_NORMAL,
26 ACPI_NS_NORMAL,
27 ACPI_NS_NORMAL,
28 ACPI_NS_NORMAL,
29 ACPI_NS_NEWSCOPE,
30 ACPI_NS_NORMAL,
31 ACPI_NS_NEWSCOPE,
32 ACPI_NS_NORMAL,
33 ACPI_NS_NORMAL,
34 ACPI_NS_NEWSCOPE,
35 ACPI_NS_NEWSCOPE,
36 ACPI_NS_NEWSCOPE,
37 ACPI_NS_NORMAL,
38 ACPI_NS_NORMAL,
39 ACPI_NS_NORMAL,
40 ACPI_NS_NORMAL,
41 ACPI_NS_NORMAL,
42 ACPI_NS_NORMAL,
43 ACPI_NS_NORMAL,
44 ACPI_NS_NORMAL,
45 ACPI_NS_NORMAL,
46 ACPI_NS_NORMAL,
47 ACPI_NS_NORMAL,
48 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL,
49 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL,
50 ACPI_NS_NEWSCOPE,
51 ACPI_NS_NORMAL,
52 ACPI_NS_NORMAL,
53 ACPI_NS_NORMAL
54 };
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70 const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
71 "SystemMemory",
72 "SystemIO",
73 "PCI_Config",
74 "EmbeddedControl",
75 "SMBus",
76 "SystemCMOS",
77 "PCIBARTarget",
78 "IPMI",
79 "GeneralPurposeIo",
80 "GenericSerialBus",
81 "PlatformCommChannel"
82 };
83
84 const char *acpi_ut_get_region_name(u8 space_id)
85 {
86
87 if (space_id >= ACPI_USER_REGION_BEGIN) {
88 return ("UserDefinedRegion");
89 } else if (space_id == ACPI_ADR_SPACE_DATA_TABLE) {
90 return ("DataTable");
91 } else if (space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) {
92 return ("FunctionalFixedHW");
93 } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) {
94 return ("InvalidSpaceId");
95 }
96
97 return (acpi_gbl_region_types[space_id]);
98 }
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114 static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
115 "PM_Timer",
116 "GlobalLock",
117 "PowerButton",
118 "SleepButton",
119 "RealTimeClock",
120 };
121
122 const char *acpi_ut_get_event_name(u32 event_id)
123 {
124
125 if (event_id > ACPI_EVENT_MAX) {
126 return ("InvalidEventID");
127 }
128
129 return (acpi_gbl_event_types[event_id]);
130 }
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153 static const char acpi_gbl_bad_type[] = "UNDEFINED";
154
155
156
157 static const char *acpi_gbl_ns_type_names[] = {
158 "Untyped",
159 "Integer",
160 "String",
161 "Buffer",
162 "Package",
163 "FieldUnit",
164 "Device",
165 "Event",
166 "Method",
167 "Mutex",
168 "Region",
169 "Power",
170 "Processor",
171 "Thermal",
172 "BufferField",
173 "DdbHandle",
174 "DebugObject",
175 "RegionField",
176 "BankField",
177 "IndexField",
178 "Reference",
179 "Alias",
180 "MethodAlias",
181 "Notify",
182 "AddrHandler",
183 "ResourceDesc",
184 "ResourceFld",
185 "Scope",
186 "Extra",
187 "Data",
188 "Invalid"
189 };
190
191 const char *acpi_ut_get_type_name(acpi_object_type type)
192 {
193
194 if (type > ACPI_TYPE_INVALID) {
195 return (acpi_gbl_bad_type);
196 }
197
198 return (acpi_gbl_ns_type_names[type]);
199 }
200
201 const char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)
202 {
203 ACPI_FUNCTION_TRACE(ut_get_object_type_name);
204
205 if (!obj_desc) {
206 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n"));
207 return_STR("[NULL Object Descriptor]");
208 }
209
210
211
212 if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) &&
213 (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_NAMED)) {
214 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
215 "Invalid object descriptor type: 0x%2.2X [%s] (%p)\n",
216 ACPI_GET_DESCRIPTOR_TYPE(obj_desc),
217 acpi_ut_get_descriptor_name(obj_desc),
218 obj_desc));
219
220 return_STR("Invalid object");
221 }
222
223 return_STR(acpi_ut_get_type_name(obj_desc->common.type));
224 }
225
226
227
228
229
230
231
232
233
234
235
236
237
238 const char *acpi_ut_get_node_name(void *object)
239 {
240 struct acpi_namespace_node *node = (struct acpi_namespace_node *)object;
241
242
243
244 if (!object) {
245 return ("NULL");
246 }
247
248
249
250 if ((object == ACPI_ROOT_OBJECT) || (object == acpi_gbl_root_node)) {
251 return ("\"\\\" ");
252 }
253
254
255
256 if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
257 return ("####");
258 }
259
260
261
262
263
264 acpi_ut_repair_name(node->name.ascii);
265
266
267
268 return (node->name.ascii);
269 }
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285 static const char *acpi_gbl_desc_type_names[] = {
286 "Not a Descriptor",
287 "Cached Object",
288 "State-Generic",
289 "State-Update",
290 "State-Package",
291 "State-Control",
292 "State-RootParseScope",
293 "State-ParseScope",
294 "State-WalkScope",
295 "State-Result",
296 "State-Notify",
297 "State-Thread",
298 "Tree Walk State",
299 "Parse Tree Op",
300 "Operand Object",
301 "Namespace Node"
302 };
303
304 const char *acpi_ut_get_descriptor_name(void *object)
305 {
306
307 if (!object) {
308 return ("NULL OBJECT");
309 }
310
311 if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) {
312 return ("Not a Descriptor");
313 }
314
315 return (acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE(object)]);
316 }
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332 static const char *acpi_gbl_ref_class_names[] = {
333 "Local",
334 "Argument",
335 "RefOf",
336 "Index",
337 "DdbHandle",
338 "Named Object",
339 "Debug"
340 };
341
342 const char *acpi_ut_get_reference_name(union acpi_operand_object *object)
343 {
344
345 if (!object) {
346 return ("NULL Object");
347 }
348
349 if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) {
350 return ("Not an Operand object");
351 }
352
353 if (object->common.type != ACPI_TYPE_LOCAL_REFERENCE) {
354 return ("Not a Reference object");
355 }
356
357 if (object->reference.class > ACPI_REFCLASS_MAX) {
358 return ("Unknown Reference class");
359 }
360
361 return (acpi_gbl_ref_class_names[object->reference.class]);
362 }
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378 static const char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
379 "ACPI_MTX_Interpreter",
380 "ACPI_MTX_Namespace",
381 "ACPI_MTX_Tables",
382 "ACPI_MTX_Events",
383 "ACPI_MTX_Caches",
384 "ACPI_MTX_Memory",
385 };
386
387 const char *acpi_ut_get_mutex_name(u32 mutex_id)
388 {
389
390 if (mutex_id > ACPI_MAX_MUTEX) {
391 return ("Invalid Mutex ID");
392 }
393
394 return (acpi_gbl_mutex_names[mutex_id]);
395 }
396
397 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417 static const char *acpi_gbl_generic_notify[ACPI_GENERIC_NOTIFY_MAX + 1] = {
418 "Bus Check",
419 "Device Check",
420 "Device Wake",
421 "Eject Request",
422 "Device Check Light",
423 "Frequency Mismatch",
424 "Bus Mode Mismatch",
425 "Power Fault",
426 "Capabilities Check",
427 "Device PLD Check",
428 "Reserved",
429 "System Locality Update",
430 "Reserved (was previously Shutdown Request)",
431
432 "System Resource Affinity Update",
433 "Heterogeneous Memory Attributes Update",
434
435 "Error Disconnect Recover"
436
437 };
438
439 static const char *acpi_gbl_device_notify[5] = {
440 "Status Change",
441 "Information Change",
442 "Device-Specific Change",
443 "Device-Specific Change",
444 "Reserved"
445 };
446
447 static const char *acpi_gbl_processor_notify[5] = {
448 "Performance Capability Change",
449 "C-State Change",
450 "Throttling Capability Change",
451 "Guaranteed Change",
452 "Minimum Excursion"
453 };
454
455 static const char *acpi_gbl_thermal_notify[5] = {
456 "Thermal Status Change",
457 "Thermal Trip Point Change",
458 "Thermal Device List Change",
459 "Thermal Relationship Change",
460 "Reserved"
461 };
462
463 const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type)
464 {
465
466
467
468 if (notify_value <= ACPI_GENERIC_NOTIFY_MAX) {
469 return (acpi_gbl_generic_notify[notify_value]);
470 }
471
472
473
474 if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
475 return ("Reserved");
476 }
477
478
479
480 if (notify_value <= ACPI_SPECIFIC_NOTIFY_MAX) {
481 switch (type) {
482 case ACPI_TYPE_ANY:
483 case ACPI_TYPE_DEVICE:
484 return (acpi_gbl_device_notify[notify_value - 0x80]);
485
486 case ACPI_TYPE_PROCESSOR:
487 return (acpi_gbl_processor_notify[notify_value - 0x80]);
488
489 case ACPI_TYPE_THERMAL:
490 return (acpi_gbl_thermal_notify[notify_value - 0x80]);
491
492 default:
493 return ("Target object type does not support notifies");
494 }
495 }
496
497
498
499 if (notify_value <= ACPI_MAX_DEVICE_SPECIFIC_NOTIFY) {
500 return ("Device-Specific");
501 }
502
503
504
505 return ("Hardware-Specific");
506 }
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522 static const char *acpi_gbl_argument_type[20] = {
523 "Unknown ARGP",
524 "ByteData",
525 "ByteList",
526 "CharList",
527 "DataObject",
528 "DataObjectList",
529 "DWordData",
530 "FieldList",
531 "Name",
532 "NameString",
533 "ObjectList",
534 "PackageLength",
535 "SuperName",
536 "Target",
537 "TermArg",
538 "TermList",
539 "WordData",
540 "QWordData",
541 "SimpleName",
542 "NameOrRef"
543 };
544
545 const char *acpi_ut_get_argument_type_name(u32 arg_type)
546 {
547
548 if (arg_type > ARGP_MAX) {
549 return ("Unknown ARGP");
550 }
551
552 return (acpi_gbl_argument_type[arg_type]);
553 }
554
555 #endif
556
557
558
559
560
561
562
563
564
565
566
567
568
569 u8 acpi_ut_valid_object_type(acpi_object_type type)
570 {
571
572 if (type > ACPI_TYPE_LOCAL_MAX) {
573
574
575
576 return (FALSE);
577 }
578
579 return (TRUE);
580 }