Indentation fix, cleanup.
[AROS.git] / arch / all-pc / acpica / generate / aros / ACPIInfo.c
blobaebf4cb091bad7293390495616798ff4e8f6c9da
1 /*
2 * Copyright (C) 2013, The AROS Development Team
3 * All right reserved.
4 * Author: Jason S. McMullan <jason.mcmullan@gmail.com>
6 * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
7 *
8 * $Id$
9 */
11 #include <proto/exec.h>
12 #include <proto/dos.h>
13 #include <proto/acpica.h>
15 #define SH_GLOBAL_SYSBASE 1
16 #define SH_GLOBAL_DOSBASE 1
18 #include <aros/shcommands.h>
20 const char * const TypeMap[ACPI_TYPE_EXTERNAL_MAX+1] = {
21 "Any",
22 "Integer",
23 "String",
24 "Buffer",
25 "Package",
26 "FieldUnit",
27 "Device",
28 "Event",
29 "Method",
30 "Mutex",
31 "Region",
32 "Power",
33 "Processor",
34 "Thermal",
35 "BufferField",
36 "DDBHandle",
37 "DebugObject"
40 ACPI_STATUS OnDescend (
41 ACPI_HANDLE Object,
42 UINT32 NestingLevel,
43 void *Context,
44 void **ReturnValue)
46 int i;
47 ACPI_STATUS err;
48 ACPI_DEVICE_INFO *info;
50 for (i = 0; i < NestingLevel; i++)
51 Printf(" ");
53 err = AcpiGetObjectInfo(Object, &info);
54 if (err == AE_OK) {
56 Printf("%c%c%c%c.",
57 (info->Name >> 24) & 0xff,
58 (info->Name >> 16) & 0xff,
59 (info->Name >> 8) & 0xff,
60 (info->Name >> 0) & 0xff);
61 if (info->Type > ACPI_TYPE_EXTERNAL_MAX) {
62 Printf("Type%ld", info->Type);
63 } else {
64 Printf("%s", TypeMap[info->Type]);
66 if (info->Type == ACPI_TYPE_METHOD) {
67 Printf("(%ld)", info->ParamCount);
69 if (info->Flags & ACPI_PCI_ROOT_BRIDGE) {
70 Printf(" [PCI Root Bridge]");
72 Printf("\n");
73 for (i = 0; i < 8; i++) {
74 int j;
75 if ((info->Valid & (1 << i)) == 0)
76 continue;
78 for (j = 0; j < NestingLevel; j++)
79 Printf(" ");
80 Printf(" ");
82 switch (info->Valid & (1 << i)) {
83 case ACPI_VALID_STA:
84 Printf("_STA: [");
85 if (info->CurrentStatus & ACPI_STA_DEVICE_PRESENT)
86 Printf(" Present");
87 if (info->CurrentStatus & ACPI_STA_DEVICE_ENABLED)
88 Printf(" Enabled");
89 if (info->CurrentStatus & ACPI_STA_DEVICE_UI)
90 Printf(" UI");
91 if (info->CurrentStatus & ACPI_STA_DEVICE_OK)
92 Printf(" Ok");
93 if (info->CurrentStatus & ACPI_STA_BATTERY_PRESENT)
94 Printf(" Battery");
95 Printf(" ]\n");
96 break;
97 case ACPI_VALID_ADR:
98 Printf("_ADR: 0x%llx\n", info->Address);
99 break;
100 case ACPI_VALID_HID:
101 Printf("_HID: %s\n",info->HardwareId.String);
102 break;
103 case ACPI_VALID_UID:
104 Printf("_UID: %s\n",info->UniqueId.String);
105 break;
106 case ACPI_VALID_SUB:
107 Printf("_SUB: %s\n",info->SubsystemId.String);
108 break;
109 case ACPI_VALID_CID:
110 Printf("_CID: [");
111 for (j = 0; j < info->CompatibleIdList.Count; j++) {
112 Printf(" %s", info->CompatibleIdList.Ids[j].String);
114 Printf(" ]\n");
115 break;
116 case ACPI_VALID_SXDS:
117 Printf("_SxD:");
118 for (j = 0; j < 4; j++) {
119 if (info->HighestDstates[j] != 0xff)
120 Printf(" %d", info->HighestDstates[j]);
122 Printf("\n");
123 break;
124 case ACPI_VALID_SXWS:
125 Printf("_SxW:");
126 for (j = 0; j < 5; j++) {
127 if (info->LowestDstates[j] != 0xff)
128 Printf(" %d", info->LowestDstates[j]);
130 Printf("\n");
131 break;
132 default: break;
137 return err;
140 ACPI_STATUS OnAscend (
141 ACPI_HANDLE Object,
142 UINT32 NestingLevel,
143 void *Context,
144 void **ReturnValue)
146 /* Nothing at the moment */
148 return AE_OK;
151 AROS_SH0(ACPIInfo, 1.0)
153 AROS_SHCOMMAND_INIT
155 AcpiWalkNamespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, (UINT32)~0, OnDescend, OnAscend, NULL, NULL);
157 return RETURN_OK;
159 AROS_SHCOMMAND_EXIT