317dfb69f92f6d606b3a7f0ab5b668cfc5735deb
1 #include <aros/debug.h>
2 #include <resources/acpi.h>
4 /*****************************************************************************
7 #include <proto/acpi.h>
9 AROS_LH1(APTR
, ACPI_FindSDT
,
12 AROS_LHA(ULONG
, id
, D0
),
15 struct ACPIBase
*, ACPIBase
, 1, Acpi
)
18 Locate a system description table with a given 4-character ID
21 id - a table ID (use ACPI_MAKE_ID() macro to get it)
24 A pointer to a table or NULL if can't be found
27 Some systems may include duplicating tables, often it's MADT.
28 In this case a table with the latest revision number will
39 ******************************************************************************/
43 struct ACPI_TABLE_DEF_HEADER
*found
= NULL
;
44 struct ACPI_TABLE_DEF_HEADER
*header
;
47 D(bug("[ACPI] acpi_LocateSDT('%4.4s')\n", &id
));
49 /* Locate the table. */
50 for (i
= 0; i
< ACPIBase
->ACPIB_SDT_Count
; i
++)
52 header
= ACPIBase
->ACPIB_SDT_Entry
[i
];
54 if (header
->signature
== id
)
56 D(bug("[ACPI] acpi_LocateSDT: Table %4.4s pointer 0x%p rev %u\n", &header
->signature
, header
, header
->revision
));
59 * Some firmwares have a strange thing - they contain multiple tables with the same signature
60 * and different revisions. A common example is MADT table.
61 * Here we select a table with the latest revision. ACPI specs don't say anything clear
63 * Such behavior is exposed for example by MacMini EFI.
65 if ((found
== NULL
) || (header
->revision
> found
->revision
))