guid.c revision 76d05dc695b06c4e987bb8078f78032441e1430c
1/*++ 2 3Copyright (c) 1998 Intel Corporation 4 5Module Name: 6 7 misc.c 8 9Abstract: 10 11 Misc EFI support functions 12 13 14 15Revision History 16 17--*/ 18 19#include "lib.h" 20 21 22// 23// Additional Known guids 24// 25 26#define SHELL_INTERFACE_PROTOCOL \ 27 { 0x47c7b223, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 28 29#define ENVIRONMENT_VARIABLE_ID \ 30 { 0x47c7b224, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 31 32#define DEVICE_PATH_MAPPING_ID \ 33 { 0x47c7b225, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 34 35#define PROTOCOL_ID_ID \ 36 { 0x47c7b226, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 37 38#define ALIAS_ID \ 39 { 0x47c7b227, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 40 41static EFI_GUID ShellInterfaceProtocol = SHELL_INTERFACE_PROTOCOL; 42static EFI_GUID SEnvId = ENVIRONMENT_VARIABLE_ID; 43static EFI_GUID SMapId = DEVICE_PATH_MAPPING_ID; 44static EFI_GUID SProtId = PROTOCOL_ID_ID; 45static EFI_GUID SAliasId = ALIAS_ID; 46 47static struct { 48 EFI_GUID *Guid; 49 WCHAR *GuidName; 50} KnownGuids[] = { 51 { &NullGuid, L"G0"}, 52 { &EfiGlobalVariable, L"Efi"}, 53 54 { &VariableStoreProtocol, L"varstore"}, 55 { &DevicePathProtocol, L"dpath"}, 56 { &LoadedImageProtocol, L"image"}, 57 { &TextInProtocol, L"txtin"}, 58 { &TextOutProtocol, L"txtout"}, 59 { &BlockIoProtocol, L"blkio"}, 60 { &DiskIoProtocol, L"diskio"}, 61 { &FileSystemProtocol, L"fs"}, 62 { &LoadFileProtocol, L"load"}, 63 { &DeviceIoProtocol, L"DevIo"}, 64 65 { &GenericFileInfo, L"GenFileInfo"}, 66 { &FileSystemInfo, L"FileSysInfo"}, 67 68 { &UnicodeCollationProtocol, L"unicode"}, 69 { &LegacyBootProtocol, L"LegacyBoot"}, 70 { &SerialIoProtocol, L"serialio"}, 71 { &VgaClassProtocol, L"vgaclass"}, 72 { &SimpleNetworkProtocol, L"net"}, 73 { &NetworkInterfaceIdentifierProtocol, L"nii"}, 74 { &PxeBaseCodeProtocol, L"pxebc"}, 75 { &PxeCallbackProtocol, L"pxecb"}, 76 77 { &VariableStoreProtocol, L"varstore"}, 78 { &LegacyBootProtocol, L"LegacyBoot"}, 79 { &VgaClassProtocol, L"VgaClass"}, 80 { &TextOutSpliterProtocol, L"TxtOutSplit"}, 81 { &ErrorOutSpliterProtocol, L"ErrOutSplit"}, 82 { &TextInSpliterProtocol, L"TxtInSplit"}, 83 { &PcAnsiProtocol, L"PcAnsi"}, 84 { &Vt100Protocol, L"Vt100"}, 85 { &UnknownDevice, L"Unknown Device"}, 86 87 { &EfiPartTypeSystemPartitionGuid, L"ESP"}, 88 { &EfiPartTypeLegacyMbrGuid, L"GPT MBR"}, 89 90 { &ShellInterfaceProtocol, L"ShellInt"}, 91 { &SEnvId, L"SEnv"}, 92 { &SProtId, L"ShellProtId"}, 93 { &SMapId, L"ShellDevPathMap"}, 94 { &SAliasId, L"ShellAlias"}, 95 96 { NULL } 97}; 98 99// 100// 101// 102 103LIST_ENTRY GuidList; 104 105 106VOID 107InitializeGuid ( 108 VOID 109 ) 110{ 111} 112 113INTN 114CompareGuid( 115 IN EFI_GUID *Guid1, 116 IN EFI_GUID *Guid2 117 ) 118/*++ 119 120Routine Description: 121 122 Compares to GUIDs 123 124Arguments: 125 126 Guid1 - guid to compare 127 Guid2 - guid to compare 128 129Returns: 130 = 0 if Guid1 == Guid2 131 132--*/ 133{ 134 return RtCompareGuid (Guid1, Guid2); 135} 136 137 138VOID 139GuidToString ( 140 OUT CHAR16 *Buffer, 141 IN EFI_GUID *Guid 142 ) 143{ 144 145 UINTN Index; 146 147 // 148 // Else, (for now) use additional internal function for mapping guids 149 // 150 151 for (Index=0; KnownGuids[Index].Guid; Index++) { 152 if (CompareGuid(Guid, KnownGuids[Index].Guid) == 0) { 153 SPrint (Buffer, 0, KnownGuids[Index].GuidName); 154 return ; 155 } 156 } 157 158 // 159 // Else dump it 160 // 161 162 SPrint (Buffer, 0, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", 163 Guid->Data1, 164 Guid->Data2, 165 Guid->Data3, 166 Guid->Data4[0], 167 Guid->Data4[1], 168 Guid->Data4[2], 169 Guid->Data4[3], 170 Guid->Data4[4], 171 Guid->Data4[5], 172 Guid->Data4[6], 173 Guid->Data4[7] 174 ); 175} 176