59 return (BOOLEAN)(Name1 == Name2);
90 ASSERT (TableGuid !=
NULL);
91 ASSERT (Table !=
NULL);
102 return EFI_NOT_FOUND;
138 IN VOID *NotifyContext OPTIONAL,
139 OUT VOID **Registration
145 ASSERT (ProtocolGuid !=
NULL);
147 ASSERT (Registration !=
NULL);
153 Status =
gBS->CreateEvent (
166 Status =
gBS->RegisterProtocolNotify (
179 gBS->SignalEvent (Event);
209 IN CONST VOID *NotifyContext OPTIONAL,
210 OUT VOID *Registration OPTIONAL
215 VOID *RegistrationLocal;
217 ASSERT (Name !=
NULL);
219 ASSERT (NotifyTpl <= TPL_HIGH_LEVEL);
224 Status =
gBS->CreateEvent (
228 (VOID *)NotifyContext,
237 if (Registration !=
NULL) {
238 RegistrationLocal = Registration;
240 RegistrationLocal = &RegistrationLocal;
247 Status =
gBS->RegisterProtocolNotify (
279 ASSERT (Name !=
NULL);
282 Status =
gBS->InstallProtocolInterface (
290 Status =
gBS->UninstallProtocolInterface (
321 if (EventGroup ==
NULL) {
322 return EFI_INVALID_PARAMETER;
325 Status =
gBS->CreateEventEx (
333 if (EFI_ERROR (Status)) {
337 Status =
gBS->SignalEvent (Event);
338 gBS->CloseEvent (Event);
381 Tpl =
gBS->RaiseTPL (TPL_HIGH_LEVEL);
382 gBS->RestoreTPL (Tpl);
411 ASSERT (Priority <= TPL_HIGH_LEVEL);
413 Lock->Tpl = Priority;
414 Lock->OwnerTpl = TPL_APPLICATION;
415 Lock->Lock = EfiLockReleased;
439 ASSERT (
Lock->Lock == EfiLockReleased);
442 Lock->Lock = EfiLockAcquired;
468 ASSERT (
Lock->Lock != EfiLockUninitialized);
470 if (
Lock->Lock == EfiLockAcquired) {
474 return EFI_ACCESS_DENIED;
479 Lock->Lock = EfiLockAcquired;
506 ASSERT (
Lock->Lock == EfiLockAcquired);
508 Tpl =
Lock->OwnerTpl;
510 Lock->Lock = EfiLockReleased;
512 gBS->RestoreTPL (Tpl);
547 VOID *ManagedInterface;
549 ASSERT (ProtocolGuid !=
NULL);
551 Status =
gBS->OpenProtocol (
557 EFI_OPEN_PROTOCOL_BY_DRIVER
559 if (!EFI_ERROR (Status)) {
566 return EFI_UNSUPPORTED;
569 if (Status != EFI_ALREADY_STARTED) {
570 return EFI_UNSUPPORTED;
608 ASSERT (ProtocolGuid !=
NULL);
614 Status =
gBS->OpenProtocolInformation (
620 if (EFI_ERROR (Status)) {
621 return EFI_UNSUPPORTED;
627 Status = EFI_UNSUPPORTED;
628 for (Index = 0; Index < EntryCount; Index++) {
629 if ((OpenInfoBuffer[Index].ControllerHandle == ChildHandle) &&
630 ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0))
654 IN CONST CHAR8 *SupportedLanguages,
660 while (*SupportedLanguages != 0) {
661 for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] !=
';'; Index++) {
664 if ((
AsciiStrnCmp (SupportedLanguages, TargetLanguage, Index) == 0) && (TargetLanguage[Index] == 0)) {
668 SupportedLanguages += Index;
669 for ( ; *SupportedLanguages != 0 && *SupportedLanguages ==
';'; SupportedLanguages++) {
673 return EFI_UNSUPPORTED;
710 IN CONST CHAR8 *SupportedLanguages,
712 OUT CHAR16 **UnicodeString
718 if ((Language ==
NULL) || (UnicodeString ==
NULL)) {
719 return EFI_INVALID_PARAMETER;
726 if ((SupportedLanguages ==
NULL) || (UnicodeStringTable ==
NULL)) {
727 return EFI_UNSUPPORTED;
733 while (*SupportedLanguages != 0) {
738 while (UnicodeStringTable->Language !=
NULL) {
743 *UnicodeString = UnicodeStringTable->UnicodeString;
747 UnicodeStringTable++;
750 return EFI_UNSUPPORTED;
753 SupportedLanguages += 3;
756 return EFI_UNSUPPORTED;
803 IN CONST CHAR8 *SupportedLanguages,
805 OUT CHAR16 **UnicodeString,
806 IN BOOLEAN Iso639Language
811 CHAR8 *LanguageString;
816 if ((Language ==
NULL) || (UnicodeString ==
NULL)) {
817 return EFI_INVALID_PARAMETER;
824 if ((SupportedLanguages ==
NULL) || (UnicodeStringTable ==
NULL)) {
825 return EFI_UNSUPPORTED;
832 if (Iso639Language) {
833 while (*SupportedLanguages != 0) {
839 SupportedLanguages += 3;
849 return EFI_UNSUPPORTED;
855 while (UnicodeStringTable->Language !=
NULL) {
856 LanguageString = UnicodeStringTable->Language;
857 while (0 != *LanguageString) {
858 for (Index = 0; LanguageString[Index] != 0 && LanguageString[Index] !=
';'; Index++) {
861 if (
AsciiStrnCmp (LanguageString, Language, Index) == 0) {
862 *UnicodeString = UnicodeStringTable->UnicodeString;
866 LanguageString += Index;
867 for (Index = 0; LanguageString[Index] != 0 && LanguageString[Index] ==
';'; Index++) {
871 UnicodeStringTable++;
874 return EFI_UNSUPPORTED;
914 IN CONST CHAR8 *SupportedLanguages,
919 UINTN NumberOfEntries;
922 UINTN UnicodeStringLength;
927 if ((Language ==
NULL) || (UnicodeString ==
NULL) || (UnicodeStringTable ==
NULL)) {
928 return EFI_INVALID_PARAMETER;
934 if (SupportedLanguages ==
NULL) {
935 return EFI_UNSUPPORTED;
941 if (UnicodeString[0] == 0) {
942 return EFI_INVALID_PARAMETER;
948 while (*SupportedLanguages != 0) {
954 if (*UnicodeStringTable !=
NULL) {
955 OldUnicodeStringTable = *UnicodeStringTable;
956 while (OldUnicodeStringTable->Language !=
NULL) {
958 return EFI_ALREADY_STARTED;
961 OldUnicodeStringTable++;
972 if (NewUnicodeStringTable ==
NULL) {
973 return EFI_OUT_OF_RESOURCES;
980 if (*UnicodeStringTable !=
NULL) {
982 NewUnicodeStringTable,
991 NewUnicodeStringTable[NumberOfEntries].Language =
AllocateCopyPool (3, Language);
992 if (NewUnicodeStringTable[NumberOfEntries].Language ==
NULL) {
994 return EFI_OUT_OF_RESOURCES;
1000 for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++) {
1007 (UnicodeStringLength + 1) *
sizeof (CHAR16),
1010 if (NewUnicodeStringTable[NumberOfEntries].UnicodeString ==
NULL) {
1011 FreePool (NewUnicodeStringTable[NumberOfEntries].Language);
1013 return EFI_OUT_OF_RESOURCES;
1019 NewUnicodeStringTable[NumberOfEntries + 1].Language =
NULL;
1020 NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString =
NULL;
1025 if (*UnicodeStringTable !=
NULL) {
1032 *UnicodeStringTable = NewUnicodeStringTable;
1037 SupportedLanguages += 3;
1040 return EFI_UNSUPPORTED;
1089 IN CONST CHAR8 *SupportedLanguages,
1091 IN CONST CHAR16 *UnicodeString,
1092 IN BOOLEAN Iso639Language
1095 UINTN NumberOfEntries;
1098 UINTN UnicodeStringLength;
1101 CHAR8 *LanguageString;
1106 if ((Language ==
NULL) || (UnicodeString ==
NULL) || (UnicodeStringTable ==
NULL)) {
1107 return EFI_INVALID_PARAMETER;
1113 if (SupportedLanguages ==
NULL) {
1114 return EFI_UNSUPPORTED;
1120 if (UnicodeString[0] == 0) {
1121 return EFI_INVALID_PARAMETER;
1128 if (Iso639Language) {
1129 while (*SupportedLanguages != 0) {
1135 SupportedLanguages += 3;
1145 return EFI_UNSUPPORTED;
1151 NumberOfEntries = 0;
1152 if (*UnicodeStringTable !=
NULL) {
1153 OldUnicodeStringTable = *UnicodeStringTable;
1154 while (OldUnicodeStringTable->Language !=
NULL) {
1155 LanguageString = OldUnicodeStringTable->Language;
1157 while (*LanguageString != 0) {
1158 for (Index = 0; LanguageString[Index] != 0 && LanguageString[Index] !=
';'; Index++) {
1161 if (
AsciiStrnCmp (Language, LanguageString, Index) == 0) {
1162 return EFI_ALREADY_STARTED;
1165 LanguageString += Index;
1166 for ( ; *LanguageString != 0 && *LanguageString ==
';'; LanguageString++) {
1170 OldUnicodeStringTable++;
1181 if (NewUnicodeStringTable ==
NULL) {
1182 return EFI_OUT_OF_RESOURCES;
1189 if (*UnicodeStringTable !=
NULL) {
1191 NewUnicodeStringTable,
1192 *UnicodeStringTable,
1201 if (NewUnicodeStringTable[NumberOfEntries].Language ==
NULL) {
1203 return EFI_OUT_OF_RESOURCES;
1209 for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++) {
1215 NewUnicodeStringTable[NumberOfEntries].UnicodeString =
AllocateCopyPool (
StrSize (UnicodeString), UnicodeString);
1216 if (NewUnicodeStringTable[NumberOfEntries].UnicodeString ==
NULL) {
1217 FreePool (NewUnicodeStringTable[NumberOfEntries].Language);
1219 return EFI_OUT_OF_RESOURCES;
1225 NewUnicodeStringTable[NumberOfEntries + 1].Language =
NULL;
1226 NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString =
NULL;
1231 if (*UnicodeStringTable !=
NULL) {
1238 *UnicodeStringTable = NewUnicodeStringTable;
1266 if (UnicodeStringTable ==
NULL) {
1273 for (Index = 0; UnicodeStringTable[Index].Language !=
NULL; Index++) {
1277 FreePool (UnicodeStringTable[Index].Language);
1282 if (UnicodeStringTable[Index].UnicodeString !=
NULL) {
1283 FreePool (UnicodeStringTable[Index].UnicodeString);
1327 ASSERT (Name !=
NULL && Guid !=
NULL && Value !=
NULL);
1338 Status =
gRT->GetVariable ((CHAR16 *)Name, (
EFI_GUID *)Guid,
NULL, &BufferSize, *Value);
1339 if (Status != EFI_BUFFER_TOO_SMALL) {
1347 ASSERT (*Value !=
NULL);
1348 if (*Value ==
NULL) {
1349 return EFI_OUT_OF_RESOURCES;
1355 Status =
gRT->GetVariable ((CHAR16 *)Name, (
EFI_GUID *)Guid,
NULL, &BufferSize, *Value);
1356 if (EFI_ERROR (Status)) {
1398 OUT UINT32 *Attr OPTIONAL
1404 ASSERT (Name !=
NULL && Guid !=
NULL && Value !=
NULL);
1419 Status =
gRT->GetVariable ((CHAR16 *)Name, (
EFI_GUID *)Guid, Attr, &BufferSize, *Value);
1420 if (Status != EFI_BUFFER_TOO_SMALL) {
1428 ASSERT (*Value !=
NULL);
1429 if (*Value ==
NULL) {
1430 return EFI_OUT_OF_RESOURCES;
1436 Status =
gRT->GetVariable ((CHAR16 *)Name, (
EFI_GUID *)Guid, Attr, &BufferSize, *Value);
1437 if (EFI_ERROR (Status)) {
1476 return GetVariable2 (Name, &gEfiGlobalVariableGuid, Value, Size);
1523 IN CONST CHAR8 *SupportedLanguages,
1530 UINTN CompareLength;
1531 UINTN LanguageLength;
1532 CONST CHAR8 *Supported;
1533 CHAR8 *BestLanguage;
1535 ASSERT (SupportedLanguages !=
NULL);
1538 while ((Language =
VA_ARG (Args, CHAR8 *)) !=
NULL) {
1548 if (Iso639Language == 0) {
1549 for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] !=
';'; LanguageLength++) {
1556 while (LanguageLength > 0) {
1560 for (Supported = SupportedLanguages; *Supported !=
'\0'; Supported += CompareLength) {
1564 if (Iso639Language == 0) {
1568 for ( ; *Supported !=
'\0' && *Supported ==
';'; Supported++) {
1574 for (CompareLength = 0; Supported[CompareLength] != 0 && Supported[CompareLength] !=
';'; CompareLength++) {
1580 if (LanguageLength > CompareLength) {
1588 if (
AsciiStrnCmp (Supported, Language, LanguageLength) == 0) {
1594 if (BestLanguage ==
NULL) {
1598 return CopyMem (BestLanguage, Supported, CompareLength);
1602 if (Iso639Language != 0) {
1611 for (LanguageLength--; LanguageLength > 0 && Language[LanguageLength] !=
'-'; LanguageLength--) {
1664 if ((Protocol ==
NULL) || (NoProtocols ==
NULL) || (Buffer ==
NULL)) {
1665 return EFI_INVALID_PARAMETER;
1677 Status =
gBS->LocateHandleBuffer (
1684 if (EFI_ERROR (Status)) {
1691 Status =
gBS->AllocatePool (
1693 NoHandles *
sizeof (VOID *),
1696 if (EFI_ERROR (Status)) {
1700 gBS->FreePool (HandleBuffer);
1701 return EFI_OUT_OF_RESOURCES;
1704 ZeroMem (*Buffer, NoHandles *
sizeof (VOID *));
1712 for (Index = 0, *NoProtocols = 0; Index < NoHandles; Index++) {
1713 Status =
gBS->HandleProtocol (
1714 HandleBuffer[Index],
1716 &((*Buffer)[*NoProtocols])
1718 if (!EFI_ERROR (Status)) {
1726 gBS->FreePool (HandleBuffer);
1731 if (*NoProtocols == 0) {
1732 gBS->FreePool (*Buffer);
1734 return EFI_NOT_FOUND;
1810 IN UINT64 Attributes
1818 CHAR16 *AlignedPathName;
1823 return EFI_INVALID_PARAMETER;
1828 if (FilePath ==
NULL) {
1829 return EFI_INVALID_PARAMETER;
1835 Status =
gBS->LocateDevicePath (
1836 &gEfiSimpleFileSystemProtocolGuid,
1840 if (EFI_ERROR (Status)) {
1844 Status =
gBS->OpenProtocol (
1846 &gEfiSimpleFileSystemProtocolGuid,
1847 (VOID **)&FileSystem,
1850 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1852 if (EFI_ERROR (Status)) {
1860 Status = FileSystem->OpenVolume (FileSystem, &LastFile);
1861 if (EFI_ERROR (Status)) {
1872 Status = EFI_INVALID_PARAMETER;
1884 AlignedPathName =
NULL;
1889 SIZE_OF_FILEPATH_DEVICE_PATH),
1892 if (AlignedPathName ==
NULL) {
1893 Status = EFI_OUT_OF_RESOURCES;
1897 PathName = AlignedPathName;
1903 Status = LastFile->Open (
1915 if (AlignedPathName !=
NULL) {
1919 if (EFI_ERROR (Status)) {
1926 LastFile->Close (LastFile);
1927 LastFile = NextFile;
1935 LastFile->Close (LastFile);
1941 ASSERT (EFI_ERROR (Status));
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
INTN EFIAPI AsciiStrnCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString, IN UINTN Length)
UINT32 EFIAPI ReadUnaligned24(IN CONST UINT32 *Buffer)
UINTN EFIAPI AsciiStrSize(IN CONST CHAR8 *String)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define MEDIA_FILEPATH_DP
UINT8 EFIAPI DevicePathType(IN CONST VOID *Node)
UINTN EFIAPI DevicePathNodeLength(IN CONST VOID *Node)
UINT8 EFIAPI DevicePathSubType(IN CONST VOID *Node)
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
EFI_RUNTIME_SERVICES * gRT
#define VA_ARG(Marker, TYPE)
#define VA_START(Marker, Parameter)
#define ASSERT_EFI_ERROR(StatusParameter)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
VOID EFIAPI NotifyFunction(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI Lock(IN EFI_SMM_ACCESS2_PROTOCOL *This)
EFI_STATUS EFIAPI AddUnicodeString2(IN CONST CHAR8 *Language, IN CONST CHAR8 *SupportedLanguages, IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable, IN CONST CHAR16 *UnicodeString, IN BOOLEAN Iso639Language)
EFI_STATUS EFIAPI EfiOpenFileByDevicePath(IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath, OUT EFI_FILE_PROTOCOL **File, IN UINT64 OpenMode, IN UINT64 Attributes)
EFI_TPL EFIAPI EfiGetCurrentTpl(VOID)
VOID EFIAPI EfiReleaseLock(IN EFI_LOCK *Lock)
EFI_STATUS EFIAPI EfiNamedEventListen(IN CONST EFI_GUID *Name, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN CONST VOID *NotifyContext OPTIONAL, OUT VOID *Registration OPTIONAL)
EFI_STATUS EFIAPI GetEfiGlobalVariable2(IN CONST CHAR16 *Name, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
EFI_STATUS EFIAPI EfiTestChildHandle(IN CONST EFI_HANDLE ControllerHandle, IN CONST EFI_HANDLE ChildHandle, IN CONST EFI_GUID *ProtocolGuid)
EFI_STATUS EFIAPI EfiAcquireLockOrFail(IN EFI_LOCK *Lock)
VOID EFIAPI EfiEventEmptyFunction(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI EfiGetSystemConfigurationTable(IN EFI_GUID *TableGuid, OUT VOID **Table)
EFI_STATUS EFIAPI LookupUnicodeString(IN CONST CHAR8 *Language, IN CONST CHAR8 *SupportedLanguages, IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable, OUT CHAR16 **UnicodeString)
EFI_STATUS EFIAPI EfiNamedEventSignal(IN CONST EFI_GUID *Name)
EFI_STATUS EFIAPI EfiEventGroupSignal(IN CONST EFI_GUID *EventGroup)
EFI_STATUS EFIAPI GetVariable2(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
VOID EFIAPI EfiAcquireLock(IN EFI_LOCK *Lock)
EFI_STATUS EFIAPI GetVariable3(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL, OUT UINT32 *Attr OPTIONAL)
BOOLEAN CompareIso639LanguageCode(IN CONST CHAR8 *Language1, IN CONST CHAR8 *Language2)
EFI_LOCK *EFIAPI EfiInitializeLock(IN OUT EFI_LOCK *Lock, IN EFI_TPL Priority)
EFI_STATUS EFIAPI LookupUnicodeString2(IN CONST CHAR8 *Language, IN CONST CHAR8 *SupportedLanguages, IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable, OUT CHAR16 **UnicodeString, IN BOOLEAN Iso639Language)
EFI_STATUS EFIAPI EfiTestManagedDevice(IN CONST EFI_HANDLE ControllerHandle, IN CONST EFI_HANDLE DriverBindingHandle, IN CONST EFI_GUID *ProtocolGuid)
EFI_STATUS EFIAPI UefiLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI IsLanguageSupported(IN CONST CHAR8 *SupportedLanguages, IN CONST CHAR8 *TargetLanguage)
EFI_STATUS EFIAPI EfiLocateProtocolBuffer(IN EFI_GUID *Protocol, OUT UINTN *NoProtocols, OUT VOID ***Buffer)
EFI_EVENT EFIAPI EfiCreateProtocolNotifyEvent(IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID *NotifyContext OPTIONAL, OUT VOID **Registration)
EFI_STATUS EFIAPI AddUnicodeString(IN CONST CHAR8 *Language, IN CONST CHAR8 *SupportedLanguages, IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable, IN CONST CHAR16 *UnicodeString)
EFI_STATUS EFIAPI FreeUnicodeStringTable(IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable)
CHAR8 *EFIAPI GetBestLanguage(IN CONST CHAR8 *SupportedLanguages, IN UINTN Iso639Language,...)
VOID(EFIAPI * EFI_EVENT_NOTIFY)(IN EFI_EVENT Event, IN VOID *Context)
EFI_CONFIGURATION_TABLE * ConfigurationTable
UINTN NumberOfTableEntries