Autodoc formatting fixes.
[AROS.git] / arch / all-pc / acpi / scansdt.c
blob89a0f23c9c734fb87cc51d06dd99ae6a9cd47ca1
1 #include <resources/acpi.h>
2 #include <utility/hooks.h>
4 /*****************************************************************************
6 NAME */
7 #include <proto/acpi.h>
9 AROS_LH3(ULONG, ACPI_ScanSDT,
11 /* SYNOPSIS */
12 AROS_LHA(ULONG, id, D0),
13 AROS_LHA(const struct Hook *, hook, A0),
14 AROS_LHA(APTR, userdata, A1),
16 /* LOCATION */
17 struct ACPIBase *, ACPIBase, 5, Acpi)
19 /* FUNCTION
20 Scan multiple system description tables with the given signature.
22 INPUTS
23 id - a signature of the table(s) to scan. Supply ACPI_ID_ALL
24 to enumerate all tables.
25 hook - a hook to call. The hook will be called with 'object'
26 argument set to table pointer, and 'paramPacket' set to
27 'userdata' argument. You can pass a NULL here in order just
28 to count the number of tables.
29 userdata - a user-supplied data to pass to the hook.
31 RESULT
32 Total number of processed tables. The table is considered processed if
33 either supplied hook returns nonzero value, or there's no hook supplied.
35 NOTES
36 Root tables, containing no data but only pointers to other tables
37 (like RSDT and XSDT) are not included in the scan.
39 EXAMPLE
41 BUGS
43 SEE ALSO
44 ACPI_FindSDT()
46 INTERNALS
48 ******************************************************************************/
50 AROS_LIBFUNC_INIT
52 ULONG count = 0;
53 struct ACPI_TABLE_DEF_HEADER *header;
54 ULONG i;
56 for (i = 0; i < ACPIBase->ACPIB_SDT_Count; i++)
58 header = ACPIBase->ACPIB_SDT_Entry[i];
60 if ((id == ACPI_ID_ALL) || (id == header->signature))
62 if (hook)
64 BOOL res = CALLHOOKPKT((struct Hook *)hook, header, userdata);
66 if (res)
67 count++;
69 else
70 count++;
74 return count;
76 AROS_LIBFUNC_EXIT