2 * Copyright (C) 2013, The AROS Development Team
4 * Author: Jason S. McMullan <jason.mcmullan@gmail.com>
6 * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
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] = {
40 ACPI_STATUS
OnDescend (
48 ACPI_DEVICE_INFO
*info
;
50 for (i
= 0; i
< NestingLevel
; i
++)
53 err
= AcpiGetObjectInfo(Object
, &info
);
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
);
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]");
73 for (i
= 0; i
< 8; i
++) {
75 if ((info
->Valid
& (1 << i
)) == 0)
78 for (j
= 0; j
< NestingLevel
; j
++)
82 switch (info
->Valid
& (1 << i
)) {
85 if (info
->CurrentStatus
& ACPI_STA_DEVICE_PRESENT
)
87 if (info
->CurrentStatus
& ACPI_STA_DEVICE_ENABLED
)
89 if (info
->CurrentStatus
& ACPI_STA_DEVICE_UI
)
91 if (info
->CurrentStatus
& ACPI_STA_DEVICE_OK
)
93 if (info
->CurrentStatus
& ACPI_STA_BATTERY_PRESENT
)
98 Printf("_ADR: 0x%llx\n", info
->Address
);
101 Printf("_HID: %s\n",info
->HardwareId
.String
);
104 Printf("_UID: %s\n",info
->UniqueId
.String
);
107 Printf("_SUB: %s\n",info
->SubsystemId
.String
);
111 for (j
= 0; j
< info
->CompatibleIdList
.Count
; j
++) {
112 Printf(" %s", info
->CompatibleIdList
.Ids
[j
].String
);
116 case ACPI_VALID_SXDS
:
118 for (j
= 0; j
< 4; j
++) {
119 if (info
->HighestDstates
[j
] != 0xff)
120 Printf(" %d", info
->HighestDstates
[j
]);
124 case ACPI_VALID_SXWS
:
126 for (j
= 0; j
< 5; j
++) {
127 if (info
->LowestDstates
[j
] != 0xff)
128 Printf(" %d", info
->LowestDstates
[j
]);
140 ACPI_STATUS
OnAscend (
146 /* Nothing at the moment */
151 AROS_SH0(ACPIInfo
, 1.0)
155 AcpiWalkNamespace(ACPI_TYPE_ANY
, ACPI_ROOT_OBJECT
, (UINT32
)~0, OnDescend
, OnAscend
, NULL
, NULL
);