1530d68baSNigel Croxon /*++
2530d68baSNigel Croxon
3530d68baSNigel Croxon Copyright (c) 1998 Intel Corporation
4530d68baSNigel Croxon
5530d68baSNigel Croxon Module Name:
6530d68baSNigel Croxon
7530d68baSNigel Croxon misc.c
8530d68baSNigel Croxon
9530d68baSNigel Croxon Abstract:
10530d68baSNigel Croxon
11530d68baSNigel Croxon Misc EFI support functions
12530d68baSNigel Croxon
13530d68baSNigel Croxon
14530d68baSNigel Croxon
15530d68baSNigel Croxon Revision History
16530d68baSNigel Croxon
17530d68baSNigel Croxon --*/
18530d68baSNigel Croxon
19530d68baSNigel Croxon #include "lib.h"
20530d68baSNigel Croxon
21530d68baSNigel Croxon
22530d68baSNigel Croxon //
23530d68baSNigel Croxon // Additional Known guids
24530d68baSNigel Croxon //
25530d68baSNigel Croxon
26530d68baSNigel Croxon #define SHELL_INTERFACE_PROTOCOL \
27530d68baSNigel Croxon { 0x47c7b223, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
28530d68baSNigel Croxon
29530d68baSNigel Croxon #define ENVIRONMENT_VARIABLE_ID \
30530d68baSNigel Croxon { 0x47c7b224, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
31530d68baSNigel Croxon
32530d68baSNigel Croxon #define DEVICE_PATH_MAPPING_ID \
33530d68baSNigel Croxon { 0x47c7b225, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
34530d68baSNigel Croxon
35530d68baSNigel Croxon #define PROTOCOL_ID_ID \
36530d68baSNigel Croxon { 0x47c7b226, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
37530d68baSNigel Croxon
38530d68baSNigel Croxon #define ALIAS_ID \
39530d68baSNigel Croxon { 0x47c7b227, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
40530d68baSNigel Croxon
41530d68baSNigel Croxon static EFI_GUID ShellInterfaceProtocol = SHELL_INTERFACE_PROTOCOL;
42530d68baSNigel Croxon static EFI_GUID SEnvId = ENVIRONMENT_VARIABLE_ID;
43530d68baSNigel Croxon static EFI_GUID SMapId = DEVICE_PATH_MAPPING_ID;
44530d68baSNigel Croxon static EFI_GUID SProtId = PROTOCOL_ID_ID;
45530d68baSNigel Croxon static EFI_GUID SAliasId = ALIAS_ID;
46530d68baSNigel Croxon
47530d68baSNigel Croxon static struct {
48530d68baSNigel Croxon EFI_GUID *Guid;
49530d68baSNigel Croxon WCHAR *GuidName;
50530d68baSNigel Croxon } KnownGuids[] = {
51530d68baSNigel Croxon { &NullGuid, L"G0" },
52751cbce3SNigel Croxon { &gEfiGlobalVariableGuid, L"EfiVar" },
53530d68baSNigel Croxon
54751cbce3SNigel Croxon { &VariableStoreProtocol, L"VarStore" },
55751cbce3SNigel Croxon { &gEfiDevicePathProtocolGuid, L"DevPath" },
56751cbce3SNigel Croxon { &gEfiLoadedImageProtocolGuid, L"LdImg" },
57751cbce3SNigel Croxon { &gEfiSimpleTextInProtocolGuid, L"TxtIn" },
58751cbce3SNigel Croxon { &gEfiSimpleTextOutProtocolGuid, L"TxtOut" },
59751cbce3SNigel Croxon { &gEfiBlockIoProtocolGuid, L"BlkIo" },
60751cbce3SNigel Croxon { &gEfiBlockIo2ProtocolGuid, L"BlkIo2" },
61751cbce3SNigel Croxon { &gEfiDiskIoProtocolGuid, L"DskIo" },
62751cbce3SNigel Croxon { &gEfiDiskIo2ProtocolGuid, L"DskIo2" },
63751cbce3SNigel Croxon { &gEfiSimpleFileSystemProtocolGuid, L"Fs" },
64751cbce3SNigel Croxon { &gEfiLoadFileProtocolGuid, L"LdFile" },
65751cbce3SNigel Croxon { &gEfiDeviceIoProtocolGuid, L"DevIo" },
66751cbce3SNigel Croxon { &gEfiComponentNameProtocolGuid, L"CName" },
67751cbce3SNigel Croxon { &gEfiComponentName2ProtocolGuid, L"CName2" },
68530d68baSNigel Croxon
69751cbce3SNigel Croxon { &gEfiFileInfoGuid, L"FileInfo" },
70751cbce3SNigel Croxon { &gEfiFileSystemInfoGuid, L"FsInfo" },
71751cbce3SNigel Croxon { &gEfiFileSystemVolumeLabelInfoIdGuid, L"FsVolInfo" },
72530d68baSNigel Croxon
73751cbce3SNigel Croxon { &gEfiUnicodeCollationProtocolGuid, L"Unicode" },
74530d68baSNigel Croxon { &LegacyBootProtocol, L"LegacyBoot" },
75751cbce3SNigel Croxon { &gEfiSerialIoProtocolGuid, L"SerIo" },
76530d68baSNigel Croxon { &VgaClassProtocol, L"VgaClass"},
77751cbce3SNigel Croxon { &gEfiSimpleNetworkProtocolGuid, L"Net" },
78751cbce3SNigel Croxon { &gEfiNetworkInterfaceIdentifierProtocolGuid, L"Nii" },
79751cbce3SNigel Croxon { &gEfiPxeBaseCodeProtocolGuid, L"Pxe" },
80751cbce3SNigel Croxon { &gEfiPxeBaseCodeCallbackProtocolGuid, L"PxeCb" },
81751cbce3SNigel Croxon
82530d68baSNigel Croxon { &TextOutSpliterProtocol, L"TxtOutSplit" },
83530d68baSNigel Croxon { &ErrorOutSpliterProtocol, L"ErrOutSplit" },
84530d68baSNigel Croxon { &TextInSpliterProtocol, L"TxtInSplit" },
85751cbce3SNigel Croxon { &gEfiPcAnsiGuid, L"PcAnsi" },
86751cbce3SNigel Croxon { &gEfiVT100Guid, L"Vt100" },
87751cbce3SNigel Croxon { &gEfiVT100PlusGuid, L"Vt100Plus" },
88751cbce3SNigel Croxon { &gEfiVTUTF8Guid, L"VtUtf8" },
89751cbce3SNigel Croxon { &UnknownDevice, L"UnknownDev" },
90530d68baSNigel Croxon
91530d68baSNigel Croxon { &EfiPartTypeSystemPartitionGuid, L"ESP" },
92530d68baSNigel Croxon { &EfiPartTypeLegacyMbrGuid, L"GPT MBR" },
93530d68baSNigel Croxon
94530d68baSNigel Croxon { &ShellInterfaceProtocol, L"ShellInt" },
95530d68baSNigel Croxon { &SEnvId, L"SEnv" },
96530d68baSNigel Croxon { &SProtId, L"ShellProtId" },
97530d68baSNigel Croxon { &SMapId, L"ShellDevPathMap" },
98530d68baSNigel Croxon { &SAliasId, L"ShellAlias" },
99530d68baSNigel Croxon
1005abc3858SPeter Jones { NULL, L"" }
101530d68baSNigel Croxon };
102530d68baSNigel Croxon
103530d68baSNigel Croxon //
104530d68baSNigel Croxon //
105530d68baSNigel Croxon //
106530d68baSNigel Croxon
107530d68baSNigel Croxon LIST_ENTRY GuidList;
108530d68baSNigel Croxon
109530d68baSNigel Croxon
110530d68baSNigel Croxon VOID
InitializeGuid(VOID)111530d68baSNigel Croxon InitializeGuid (
112530d68baSNigel Croxon VOID
113530d68baSNigel Croxon )
114530d68baSNigel Croxon {
115530d68baSNigel Croxon }
116530d68baSNigel Croxon
117530d68baSNigel Croxon INTN
CompareGuid(IN EFI_GUID * Guid1,IN EFI_GUID * Guid2)118530d68baSNigel Croxon CompareGuid(
119530d68baSNigel Croxon IN EFI_GUID *Guid1,
120530d68baSNigel Croxon IN EFI_GUID *Guid2
121530d68baSNigel Croxon )
122530d68baSNigel Croxon /*++
123530d68baSNigel Croxon
124530d68baSNigel Croxon Routine Description:
125530d68baSNigel Croxon
126530d68baSNigel Croxon Compares to GUIDs
127530d68baSNigel Croxon
128530d68baSNigel Croxon Arguments:
129530d68baSNigel Croxon
130530d68baSNigel Croxon Guid1 - guid to compare
131530d68baSNigel Croxon Guid2 - guid to compare
132530d68baSNigel Croxon
133530d68baSNigel Croxon Returns:
134530d68baSNigel Croxon = 0 if Guid1 == Guid2
135530d68baSNigel Croxon
136530d68baSNigel Croxon --*/
137530d68baSNigel Croxon {
138530d68baSNigel Croxon return RtCompareGuid (Guid1, Guid2);
139530d68baSNigel Croxon }
140530d68baSNigel Croxon
141530d68baSNigel Croxon
142530d68baSNigel Croxon VOID
GuidToString(OUT CHAR16 * Buffer,IN EFI_GUID * Guid)143530d68baSNigel Croxon GuidToString (
144530d68baSNigel Croxon OUT CHAR16 *Buffer,
145530d68baSNigel Croxon IN EFI_GUID *Guid
146530d68baSNigel Croxon )
147530d68baSNigel Croxon {
148530d68baSNigel Croxon
149530d68baSNigel Croxon UINTN Index;
150530d68baSNigel Croxon
151530d68baSNigel Croxon //
152530d68baSNigel Croxon // Else, (for now) use additional internal function for mapping guids
153530d68baSNigel Croxon //
154530d68baSNigel Croxon
155530d68baSNigel Croxon for (Index=0; KnownGuids[Index].Guid; Index++) {
156530d68baSNigel Croxon if (CompareGuid(Guid, KnownGuids[Index].Guid) == 0) {
157*b39be0d5SPete Batard UnicodeSPrint (Buffer, 0, KnownGuids[Index].GuidName);
158530d68baSNigel Croxon return ;
159530d68baSNigel Croxon }
160530d68baSNigel Croxon }
161530d68baSNigel Croxon
162530d68baSNigel Croxon //
163530d68baSNigel Croxon // Else dump it
164530d68baSNigel Croxon //
165530d68baSNigel Croxon
166*b39be0d5SPete Batard UnicodeSPrint (Buffer, 0, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
167530d68baSNigel Croxon Guid->Data1,
168530d68baSNigel Croxon Guid->Data2,
169530d68baSNigel Croxon Guid->Data3,
170530d68baSNigel Croxon Guid->Data4[0],
171530d68baSNigel Croxon Guid->Data4[1],
172530d68baSNigel Croxon Guid->Data4[2],
173530d68baSNigel Croxon Guid->Data4[3],
174530d68baSNigel Croxon Guid->Data4[4],
175530d68baSNigel Croxon Guid->Data4[5],
176530d68baSNigel Croxon Guid->Data4[6],
177530d68baSNigel Croxon Guid->Data4[7]
178530d68baSNigel Croxon );
179530d68baSNigel Croxon }
180