revert between 56095 -> 55830 in arch
[AROS.git] / rom / efi / findconfigtable.c
blobe21f5b23dd281915548b12610a59b41497e0f3aa
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
7 #include <libraries/uuid.h>
9 #include <string.h>
11 #ifdef DEBUG_UUID
13 static void PRINT_UUID(uuid_t *id)
15 unsigned int i;
17 bug("[EFI] Table UUID: 0x%08X-%04X-%04X-%02X%02X-",
18 id->time_low, id->time_mid, id->time_hi_and_version,
19 id->clock_seq_hi_and_reserved, id->clock_seq_low);
21 for (i = 0; i < sizeof(id->node); i++)
22 bug("%02X", id->node[i]);
24 RawPutChar('\n');
27 #else
28 #define PRINT_UUID(id)
29 #endif
31 /*****************************************************************************
33 NAME */
34 #include <proto/efi.h>
36 AROS_LH1(void *, EFI_FindConfigTable,
38 /* SYNOPSIS */
39 AROS_LHA(const uuid_t *, Guid, A0),
41 /* LOCATION */
42 struct EFIBase *, EFIBase, 1, Efi)
44 /* FUNCTION
45 Locate a configuration table by GUID
47 INPUTS
48 Guid - a pointer to a GUID structure
50 RESULT
51 A pointer to a table or NULL if nothing found.
53 NOTES
55 EXAMPLE
57 BUGS
59 SEE ALSO
61 INTERNALS
63 ******************************************************************************/
65 AROS_LIBFUNC_INIT
67 struct EFI_Config *conf = EFIBase->System->ConfigTable;
68 IPTR i;
70 /* Safety */
71 if (!conf)
72 return NULL;
74 for (i = 0; i < EFIBase->System->NumEntries; i++)
76 PRINT_UUID(&conf[i].VendorGUID);
78 if (!memcmp(&conf[i].VendorGUID, Guid, sizeof(uuid_t)))
80 return conf[i].Table;
84 return NULL;
86 AROS_LIBFUNC_EXIT