11#define PLATFORM_OVERRIDE_ITEM_SIGNATURE SIGNATURE_32('p','d','o','i')
24#define DRIVER_IMAGE_INFO_SIGNATURE SIGNATURE_32('p','d','i','i')
34#define DEVICE_PATH_STACK_ITEM_SIGNATURE SIGNATURE_32('d','p','s','i')
60 ASSERT (DevicePathStackItem !=
NULL);
61 DevicePathStackItem->Signature = DEVICE_PATH_STACK_ITEM_SIGNATURE;
85 ItemListIndex = mDevicePathStack.BackLink;
89 if (ItemListIndex != &mDevicePathStack) {
91 if (DevicePath !=
NULL) {
95 FreePool (DevicePathStackItem->DevicePath);
101 return EFI_NOT_FOUND;
121 UINTN DevicePathSize;
123 ItemListIndex = mDevicePathStack.BackLink;
124 while (ItemListIndex != &mDevicePathStack) {
128 if (
CompareMem (DevicePath, DevicePathStackItem->DevicePath, DevicePathSize) == 0) {
133 ItemListIndex = ItemListIndex->BackLink;
177 EFI_FV_FILETYPE Type;
180 UINT32 AuthenticationStatus;
189 if (DevicePath ==
NULL) {
190 return EFI_INVALID_PARAMETER;
193 if (*DevicePath ==
NULL) {
194 return EFI_INVALID_PARAMETER;
200 TempDevicePath = *DevicePath;
201 LastDeviceNode = TempDevicePath;
203 LastDeviceNode = TempDevicePath;
208 if (GuidPoint ==
NULL) {
212 return EFI_UNSUPPORTED;
215 if (FileGuid !=
NULL) {
220 return EFI_UNSUPPORTED;
223 FileGuid = GuidPoint;
229 TempDevicePath = *DevicePath;
246 return EFI_UNSUPPORTED;
252 TempDevicePath = *DevicePath;
253 FoundFvHandle =
NULL;
254 Status =
gBS->LocateDevicePath (
255 &gEfiFirmwareVolume2ProtocolGuid,
259 if (!EFI_ERROR (Status)) {
260 Status =
gBS->HandleProtocol (
262 &gEfiFirmwareVolume2ProtocolGuid,
265 if (!EFI_ERROR (Status)) {
269 Status = Fv->ReadFile (
276 &AuthenticationStatus
278 if (!EFI_ERROR (Status)) {
279 return EFI_ALREADY_STARTED;
289 FoundFvHandle =
NULL;
290 Status =
gBS->HandleProtocol (
292 &gEfiLoadedImageProtocolGuid,
293 (VOID **)&LoadedImage
295 if (!EFI_ERROR (Status)) {
296 Status =
gBS->HandleProtocol (
298 &gEfiFirmwareVolume2ProtocolGuid,
301 if (!EFI_ERROR (Status)) {
302 Status = Fv->ReadFile (
309 &AuthenticationStatus
311 if (!EFI_ERROR (Status)) {
322 gBS->LocateHandleBuffer (
324 &gEfiFirmwareVolume2ProtocolGuid,
329 for (Index = 0; Index < FvHandleCount; Index++) {
330 gBS->HandleProtocol (
331 FvHandleBuffer[Index],
332 &gEfiFirmwareVolume2ProtocolGuid,
336 Status = Fv->ReadFile (
343 &AuthenticationStatus
345 if (EFI_ERROR (Status)) {
353 FoundFvHandle = FvHandleBuffer[Index];
365 *DevicePath = NewDevicePath;
369 return EFI_NOT_FOUND;
406 Status =
gRT->GetVariable (Name, VendorGuid,
NULL, &BufferSize, Buffer);
407 if (Status == EFI_BUFFER_TOO_SMALL) {
412 if (Buffer ==
NULL) {
419 Status =
gRT->GetVariable (Name, VendorGuid,
NULL, &BufferSize, Buffer);
420 if (EFI_ERROR (Status)) {
425 *VariableSize = BufferSize;
463 if (DevicePathToConnect ==
NULL) {
468 CopyOfDevicePath = DevicePath;
469 if (DevicePath ==
NULL) {
470 return EFI_OUT_OF_RESOURCES;
481 ASSERT (Instance !=
NULL);
493 PreviousHandle =
NULL;
500 RemainingDevicePath = Instance;
501 Status =
gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle);
503 if (!EFI_ERROR (Status)) {
504 if (Handle == PreviousHandle) {
512 Status =
gDS->Dispatch ();
515 if (!EFI_ERROR (Status)) {
516 PreviousHandle = Handle;
532 gBS->ConnectController (Handle,
NULL, RemainingDevicePath,
FALSE);
539 }
while (!EFI_ERROR (Status) && !
IsDevicePathEnd (RemainingDevicePath));
540 }
while (DevicePath !=
NULL);
542 if (CopyOfDevicePath !=
NULL) {
572 if (MappingDataBase ==
NULL) {
573 return EFI_INVALID_PARAMETER;
577 while (!
IsNull (MappingDataBase, OverrideItemListIndex)) {
582 if (OverrideItem->ControllerDevicePath !=
NULL) {
583 FreePool (OverrideItem->ControllerDevicePath);
591 DriverImageInfo =
CR (ImageInfoListIndex,
DRIVER_IMAGE_INFO, Link, DRIVER_IMAGE_INFO_SIGNATURE);
592 if (DriverImageInfo->DriverImagePath !=
NULL) {
593 FreePool (DriverImageInfo->DriverImagePath);
607 OverrideItemListIndex =
GetNextNode (MappingDataBase, OverrideItemListIndex);
665 VOID *VariableBuffer;
666 UINT8 *VariableIndex;
668 CHAR16 OverrideVariableName[40];
679 if (MappingDataBase ==
NULL) {
680 return EFI_INVALID_PARAMETER;
687 ASSERT ((
UINTN)VariableBuffer %
sizeof (
UINTN) == 0);
688 if (VariableBuffer ==
NULL) {
689 return EFI_NOT_FOUND;
699 VariableIndex = VariableBuffer;
700 if (VariableIndex +
sizeof (UINT32) > (UINT8 *)VariableBuffer + BufferSize) {
706 NotEnd = *(UINT32 *)VariableIndex;
713 VariableIndex = VariableIndex +
sizeof (UINT32);
714 while (VariableIndex < ((UINT8 *)VariableBuffer + BufferSize)) {
718 if (VariableIndex +
sizeof (UINT32) > (UINT8 *)VariableBuffer + BufferSize) {
723 Signature = *(UINT32 *)VariableIndex;
724 if (Signature != PLATFORM_OVERRIDE_ITEM_SIGNATURE) {
733 ASSERT (OverrideItem !=
NULL);
734 OverrideItem->Signature = PLATFORM_OVERRIDE_ITEM_SIGNATURE;
736 VariableIndex = VariableIndex +
sizeof (UINT32);
740 if (VariableIndex +
sizeof (UINT32) >= (UINT8 *)VariableBuffer + BufferSize) {
745 DriverNumber = *(UINT32 *)VariableIndex;
746 OverrideItem->DriverInfoNum = DriverNumber;
747 VariableIndex = VariableIndex +
sizeof (UINT32);
757 VariableIndex += ((
sizeof (UINT32) - ((
UINTN)(VariableIndex))) & (
sizeof (UINT32) - 1));
761 if ((OverrideItem->ControllerDevicePath ==
NULL) || (VariableIndex < (UINT8 *)ControllerDevicePath) ||
762 (VariableIndex > (UINT8 *)VariableBuffer + BufferSize))
771 for (Index = 0; Index < DriverNumber; Index++) {
776 ASSERT (DriverImageInfo !=
NULL);
777 DriverImageInfo->Signature = DRIVER_IMAGE_INFO_SIGNATURE;
785 VariableIndex += ((
sizeof (UINT32) - ((
UINTN)(VariableIndex))) & (
sizeof (UINT32) - 1));
792 if ((DriverImageInfo->DriverImagePath ==
NULL) || (VariableIndex < (UINT8 *)DriverDevicePath) ||
793 (VariableIndex > (UINT8 *)VariableBuffer + BufferSize))
809 return EFI_VOLUME_CORRUPTED;
817 UnicodeSPrint (OverrideVariableName,
sizeof (OverrideVariableName), L
"PlatDriOver%d", VariableNum++);
818 VariableBuffer =
GetVariableAndSize (OverrideVariableName, &gEfiCallerIdGuid, &BufferSize);
819 ASSERT ((
UINTN)VariableBuffer %
sizeof (
UINTN) == 0);
820 if (VariableBuffer ==
NULL) {
822 return EFI_VOLUME_CORRUPTED;
825 }
while (NotEnd != 0);
848 UINTN DevicePathSize;
852 NeededSize +=
sizeof (UINT32);
853 NeededSize +=
sizeof (UINT32);
855 NeededSize += DevicePathSize;
859 NeededSize += ((
sizeof (UINT32) - DevicePathSize) & (
sizeof (UINT32) - 1));
865 DriverImageInfo =
CR (ImageInfoListIndex,
DRIVER_IMAGE_INFO, Link, DRIVER_IMAGE_INFO_SIGNATURE);
867 NeededSize += DevicePathSize;
871 NeededSize += ((
sizeof (UINT32) - DevicePathSize) & (
sizeof (UINT32) - 1));
892 VOID *VariableBuffer;
896 CHAR16 OverrideVariableName[40];
904 if (VariableBuffer ==
NULL) {
905 return EFI_NOT_FOUND;
911 while ((VariableBuffer !=
NULL) && ((*(UINT32 *)VariableBuffer) != 0)) {
913 UnicodeSPrint (OverrideVariableName,
sizeof (OverrideVariableName), L
"PlatDriOver%d", VariableNum);
914 VariableBuffer =
GetVariableAndSize (OverrideVariableName, &gEfiCallerIdGuid, &BufferSize);
921 Status =
gRT->SetVariable (
928 ASSERT (!EFI_ERROR (Status));
929 for (Index = 1; Index < VariableNum; Index++) {
930 UnicodeSPrint (OverrideVariableName,
sizeof (OverrideVariableName), L
"PlatDriOver%d", Index);
931 Status =
gRT->SetVariable (
932 OverrideVariableName,
938 ASSERT (!EFI_ERROR (Status));
960 VOID *VariableBuffer;
961 UINT8 *VariableIndex;
963 CHAR16 OverrideVariableName[40];
970 UINTN VariableNeededSize;
971 UINT64 MaximumVariableStorageSize;
972 UINT64 RemainingVariableStorageSize;
973 UINT64 MaximumVariableSize;
974 UINTN OneItemNeededSize;
976 if (MappingDataBase ==
NULL) {
977 return EFI_INVALID_PARAMETER;
988 gRT->QueryVariableInfo (
990 &MaximumVariableStorageSize,
991 &RemainingVariableStorageSize,
997 while (!
IsNull (MappingDataBase, OverrideItemListIndex)) {
1002 VariableNeededSize =
sizeof (UINT32);
1003 ItemIndex = OverrideItemListIndex;
1008 while (!
IsNull (MappingDataBase, ItemIndex)) {
1014 if ((VariableNeededSize +
1017 ) >= MaximumVariableSize
1024 VariableNeededSize += OneItemNeededSize;
1025 ItemIndex =
GetNextNode (MappingDataBase, ItemIndex);
1029 if (VariableNeededSize ==
sizeof (UINT32)) {
1033 return EFI_OUT_OF_RESOURCES;
1042 ASSERT (VariableBuffer !=
NULL);
1043 ASSERT ((
UINTN)VariableBuffer %
sizeof (
UINTN) == 0);
1048 VariableIndex = VariableBuffer;
1049 *(UINT32 *)VariableIndex = NotEnd;
1050 VariableIndex +=
sizeof (UINT32);
1054 while (OverrideItemListIndex != ItemIndex) {
1055 *(UINT32 *)VariableIndex = PLATFORM_OVERRIDE_ITEM_SIGNATURE;
1056 VariableIndex +=
sizeof (UINT32);
1059 *(UINT32 *)VariableIndex = OverrideItem->DriverInfoNum;
1060 VariableIndex += sizeof (UINT32);
1062 CopyMem (VariableIndex, OverrideItem->ControllerDevicePath,
GetDevicePathSize (OverrideItem->ControllerDevicePath));
1068 VariableIndex += ((
sizeof (UINT32) - ((
UINTN)(VariableIndex))) & (
sizeof (UINT32) - 1));
1074 DriverImageInfo =
CR (ImageInfoListIndex,
DRIVER_IMAGE_INFO, Link, DRIVER_IMAGE_INFO_SIGNATURE);
1080 VariableIndex += ((
sizeof (UINT32) - ((
UINTN)(VariableIndex))) & (
sizeof (UINT32) - 1));
1084 OverrideItemListIndex =
GetNextNode (MappingDataBase, OverrideItemListIndex);
1087 ASSERT (((
UINTN)VariableIndex - (
UINTN)VariableBuffer) == VariableNeededSize);
1089 if (NumIndex == 0) {
1090 UnicodeSPrint (OverrideVariableName,
sizeof (OverrideVariableName), L
"PlatDriOver");
1092 UnicodeSPrint (OverrideVariableName,
sizeof (OverrideVariableName), L
"PlatDriOver%d", NumIndex);
1095 Status =
gRT->SetVariable (
1096 OverrideVariableName,
1104 if (EFI_ERROR (Status)) {
1141 UINTN DriverBindingHandleCount;
1145 if ((BindingHandle ==
NULL) || (ImageHandle ==
NULL)) {
1152 DriverBindingHandleCount = 0;
1153 Status =
gBS->LocateHandleBuffer (
1155 &gEfiDriverBindingProtocolGuid,
1157 &DriverBindingHandleCount,
1158 &DriverBindingHandleBuffer
1160 if (EFI_ERROR (Status) || (DriverBindingHandleCount == 0)) {
1164 for (Index = 0; Index < DriverBindingHandleCount; Index++) {
1165 DriverBindingInterface =
NULL;
1166 Status =
gBS->OpenProtocol (
1167 DriverBindingHandleBuffer[Index],
1168 &gEfiDriverBindingProtocolGuid,
1169 (VOID **)&DriverBindingInterface,
1172 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1174 if (EFI_ERROR (Status)) {
1178 if (DriverBindingInterface->ImageHandle == ImageHandle) {
1179 *BindingHandle = DriverBindingHandleBuffer[Index];
1180 FreePool (DriverBindingHandleBuffer);
1181 return DriverBindingInterface;
1188 FreePool (DriverBindingHandleBuffer);
1189 *BindingHandle =
NULL;
1206 Tpl =
gBS->RaiseTPL (TPL_HIGH_LEVEL);
1207 gBS->RestoreTPL (Tpl);
1248 BOOLEAN ControllerFound;
1251 UINTN ImageHandleCount;
1255 BOOLEAN FoundLastReturned;
1265 UINTN DevicePathSize;
1270 if (ControllerHandle ==
NULL) {
1271 return EFI_INVALID_PARAMETER;
1277 Status =
gBS->HandleProtocol (
1279 &gEfiDevicePathProtocolGuid,
1280 (VOID **)&ControllerDevicePath
1282 if (EFI_ERROR (Status) || (ControllerDevicePath ==
NULL)) {
1283 return EFI_INVALID_PARAMETER;
1289 OverrideItem =
NULL;
1290 ControllerFound =
FALSE;
1293 OverrideItemListIndex =
GetFirstNode (MappingDataBase);
1294 while (!
IsNull (MappingDataBase, OverrideItemListIndex)) {
1298 ControllerDevicePath,
1299 OverrideItem->ControllerDevicePath,
1304 ControllerFound =
TRUE;
1309 OverrideItemListIndex =
GetNextNode (MappingDataBase, OverrideItemListIndex);
1312 if (!ControllerFound) {
1313 return EFI_NOT_FOUND;
1320 if (*DriverImageHandle !=
NULL) {
1321 if (*DriverImageHandle != OverrideItem->LastReturnedImageHandle) {
1322 return EFI_INVALID_PARAMETER;
1336 return EFI_UNSUPPORTED;
1346 DriverImageInfo =
CR (ImageInfoListIndex,
DRIVER_IMAGE_INFO, Link, DRIVER_IMAGE_INFO_SIGNATURE);
1347 if (DriverImageInfo->ImageHandle ==
NULL) {
1351 if ((!DriverImageInfo->UnLoadable) && ((!DriverImageInfo->UnStartable))) {
1352 TempDriverImagePath = DriverImageInfo->DriverImagePath;
1360 if (!EFI_ERROR (Status)) {
1361 FreePool (DriverImageInfo->DriverImagePath);
1362 DriverImageInfo->DriverImagePath = TempDriverImagePath;
1369 ImageHandleCount = 0;
1370 Status =
gBS->LocateHandleBuffer (
1372 &gEfiLoadedImageProtocolGuid,
1377 if (EFI_ERROR (Status) || (ImageHandleCount == 0)) {
1378 return EFI_NOT_FOUND;
1381 for (Index = 0; Index < ImageHandleCount; Index++) {
1385 LoadedImageDevicePath =
NULL;
1386 Status =
gBS->HandleProtocol (
1387 ImageHandleBuffer[Index],
1388 &gEfiLoadedImageDevicePathProtocolGuid,
1389 (VOID **)&LoadedImageDevicePath
1391 if (EFI_ERROR (Status)) {
1401 DriverImageInfo->DriverImagePath,
1402 LoadedImageDevicePath,
1418 DriverBindingHandle =
NULL;
1420 ImageHandleBuffer[Index],
1421 &DriverBindingHandle
1423 ASSERT (DriverBinding !=
NULL);
1424 DriverImageInfo->ImageHandle = ImageHandleBuffer[Index];
1440 TempDriverImagePath = DriverImageInfo->DriverImagePath;
1441 gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &TempDriverImagePath, &Handle);
1445 Status =
gBS->HandleProtocol (
1447 &gEfiBusSpecificDriverOverrideProtocolGuid,
1448 (VOID **)&BusSpecificDriverOverride
1450 if (!EFI_ERROR (Status) && (BusSpecificDriverOverride !=
NULL)) {
1452 Status = BusSpecificDriverOverride->GetDriver (
1453 BusSpecificDriverOverride,
1456 if (!EFI_ERROR (Status)) {
1461 DriverBindingHandle =
NULL;
1464 &DriverBindingHandle
1466 ASSERT (DriverBinding !=
NULL);
1467 DriverImageInfo->ImageHandle = ImageHandle;
1475 TempDriverImagePath = DriverImageInfo->DriverImagePath;
1476 gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &TempDriverImagePath, &Handle);
1477 if (((
DevicePathType (TempDriverImagePath) == MEDIA_DEVICE_PATH) &&
1485 TempDriverImagePath = DriverImageInfo->DriverImagePath;
1486 Status =
gBS->LoadImage (
1489 TempDriverImagePath,
1494 if (!EFI_ERROR (Status)) {
1498 Status =
gBS->StartImage (ImageHandle,
NULL,
NULL);
1499 if (EFI_ERROR (Status)) {
1500 DriverImageInfo->UnStartable =
TRUE;
1501 DriverImageInfo->ImageHandle =
NULL;
1507 DriverBindingHandle =
NULL;
1510 &DriverBindingHandle
1512 ASSERT (DriverBinding !=
NULL);
1513 DriverImageInfo->ImageHandle = ImageHandle;
1522 if (Status == EFI_SECURITY_VIOLATION) {
1523 gBS->UnloadImage (ImageHandle);
1526 DriverImageInfo->UnLoadable =
TRUE;
1527 DriverImageInfo->ImageHandle =
NULL;
1547 FoundLastReturned =
FALSE;
1550 DriverImageInfo =
CR (ImageInfoListIndex,
DRIVER_IMAGE_INFO, Link, DRIVER_IMAGE_INFO_SIGNATURE);
1551 if (DriverImageInfo->ImageHandle !=
NULL) {
1552 if ((*DriverImageHandle ==
NULL) || FoundLastReturned) {
1558 OverrideItem->LastReturnedImageHandle = DriverImageInfo->ImageHandle;
1559 *DriverImageHandle = DriverImageInfo->ImageHandle;
1561 }
else if (*DriverImageHandle == DriverImageInfo->ImageHandle) {
1565 FoundLastReturned =
TRUE;
1572 return EFI_NOT_FOUND;
1598 OUT UINT32 *DriverInfoNum OPTIONAL,
1599 OUT UINT32 *DriverImageNO OPTIONAL
1608 UINTN DevicePathSize;
1610 if (ControllerDevicePath ==
NULL) {
1611 return EFI_INVALID_PARAMETER;
1614 if (MappingDataBase ==
NULL) {
1615 return EFI_INVALID_PARAMETER;
1622 OverrideItem =
NULL;
1623 OverrideItemListIndex =
GetFirstNode (MappingDataBase);
1624 while (!
IsNull (MappingDataBase, OverrideItemListIndex)) {
1629 ControllerDevicePath,
1630 OverrideItem->ControllerDevicePath,
1640 OverrideItemListIndex =
GetNextNode (MappingDataBase, OverrideItemListIndex);
1647 return EFI_NOT_FOUND;
1650 ASSERT (OverrideItem->DriverInfoNum != 0);
1651 if (DriverInfoNum !=
NULL) {
1652 *DriverInfoNum = OverrideItem->DriverInfoNum;
1659 if (DriverImageDevicePath ==
NULL) {
1670 DriverImageInfo =
CR (ImageInfoListIndex,
DRIVER_IMAGE_INFO, Link, DRIVER_IMAGE_INFO_SIGNATURE);
1675 DriverImageDevicePath,
1676 DriverImageInfo->DriverImagePath,
1693 return EFI_NOT_FOUND;
1695 if (DriverImageNO !=
NULL) {
1696 *DriverImageNO = ImageNO;
1728 IN UINT32 DriverImageNO
1738 UINTN DevicePathSize;
1740 if (ControllerDevicePath ==
NULL) {
1741 return EFI_INVALID_PARAMETER;
1744 if (DriverImageDevicePath ==
NULL) {
1745 return EFI_INVALID_PARAMETER;
1748 if (MappingDataBase ==
NULL) {
1749 return EFI_INVALID_PARAMETER;
1757 ControllerDevicePath,
1758 DriverImageDevicePath,
1764 return EFI_ALREADY_STARTED;
1771 OverrideItem =
NULL;
1772 OverrideItemListIndex =
GetFirstNode (MappingDataBase);
1773 while (!
IsNull (MappingDataBase, OverrideItemListIndex)) {
1778 ControllerDevicePath,
1779 OverrideItem->ControllerDevicePath,
1789 OverrideItemListIndex =
GetNextNode (MappingDataBase, OverrideItemListIndex);
1798 ASSERT (OverrideItem !=
NULL);
1799 OverrideItem->Signature = PLATFORM_OVERRIDE_ITEM_SIGNATURE;
1809 ASSERT (DriverImageInfo !=
NULL);
1810 DriverImageInfo->Signature = DRIVER_IMAGE_INFO_SIGNATURE;
1819 if (ImageNO == (DriverImageNO - 1)) {
1824 OverrideItem->DriverInfoNum++;
1838 OverrideItem->DriverInfoNum++;
1873 UINTN DevicePathSize;
1875 if (ControllerDevicePath ==
NULL) {
1876 return EFI_INVALID_PARAMETER;
1879 if (MappingDataBase ==
NULL) {
1880 return EFI_INVALID_PARAMETER;
1887 ControllerDevicePath,
1888 DriverImageDevicePath,
1893 if (EFI_ERROR (Status)) {
1894 return EFI_NOT_FOUND;
1901 OverrideItem =
NULL;
1902 OverrideItemListIndex =
GetFirstNode (MappingDataBase);
1903 while (!
IsNull (MappingDataBase, OverrideItemListIndex)) {
1908 ControllerDevicePath,
1909 OverrideItem->ControllerDevicePath,
1919 OverrideItemListIndex =
GetNextNode (MappingDataBase, OverrideItemListIndex);
1923 ASSERT (OverrideItem->DriverInfoNum != 0);
1928 DriverImageInfo =
CR (ImageInfoListIndex,
DRIVER_IMAGE_INFO, Link, DRIVER_IMAGE_INFO_SIGNATURE);
1930 if (DriverImageDevicePath !=
NULL) {
1937 DriverImageDevicePath,
1938 DriverImageInfo->DriverImagePath,
1944 FreePool (DriverImageInfo->DriverImagePath);
1946 OverrideItem->DriverInfoNum--;
1955 FreePool (DriverImageInfo->DriverImagePath);
1957 OverrideItem->DriverInfoNum--;
1965 if (DriverImageDevicePath ==
NULL) {
1966 ASSERT (OverrideItem->DriverInfoNum == 0);
1972 if (OverrideItem->DriverInfoNum == 0) {
1973 FreePool (OverrideItem->ControllerDevicePath);
1983 return EFI_NOT_FOUND;
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
#define INITIALIZE_LIST_HEAD_VARIABLE(ListHead)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
#define MEDIA_FILEPATH_DP
#define HARDWARE_DEVICE_PATH
UINT8 EFIAPI DevicePathType(IN CONST VOID *Node)
UINT8 EFIAPI DevicePathSubType(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI AppendDevicePathNode(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL)
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DevicePathFromHandle(IN EFI_HANDLE Handle)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI GetNextDevicePathInstance(IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT UINTN *Size)
UINTN EFIAPI GetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DuplicateDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
BOOLEAN EFIAPI IsDevicePathEndType(IN CONST VOID *Node)
VOID EFIAPI SetDevicePathEndNode(OUT VOID *Node)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
EFI_RUNTIME_SERVICES * gRT
#define CR(Record, TYPE, Field, TestSignature)
UINT32 EFI_FV_FILE_ATTRIBUTES
VOID *EFIAPI GetVariableAndSize(IN CHAR16 *Name, IN EFI_GUID *VendorGuid, OUT UINTN *VariableSize)
BOOLEAN EFIAPI CheckExistInStack(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS EFIAPI DeleteDriverImage(IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath, IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath, IN LIST_ENTRY *MappingDataBase)
EFI_TPL GetCurrentTpl(VOID)
EFI_STATUS EFIAPI PushDevPathStack(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS EFIAPI PopDevPathStack(OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
EFI_STATUS EFIAPI DeleteOverridesVariables(VOID)
EFI_STATUS EFIAPI FreeMappingDatabase(IN OUT LIST_ENTRY *MappingDataBase)
EFI_STATUS EFIAPI SaveOverridesMapping(IN LIST_ENTRY *MappingDataBase)
EFI_STATUS EFIAPI CheckMapping(IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath, IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath OPTIONAL, IN LIST_ENTRY *MappingDataBase, OUT UINT32 *DriverInfoNum OPTIONAL, OUT UINT32 *DriverImageNO OPTIONAL)
EFI_STATUS EFIAPI ConnectDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect)
EFI_STATUS EFIAPI InsertDriverImage(IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath, IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath, IN LIST_ENTRY *MappingDataBase, IN UINT32 DriverImageNO)
EFI_STATUS EFIAPI InitOverridesMapping(OUT LIST_ENTRY *MappingDataBase)
EFI_DRIVER_BINDING_PROTOCOL *EFIAPI GetBindingProtocolFromImageHandle(IN EFI_HANDLE ImageHandle, OUT EFI_HANDLE *BindingHandle)
UINTN EFIAPI GetOneItemNeededSize(IN LIST_ENTRY *OverrideItemListIndex)
EFI_STATUS EFIAPI GetDriverFromMapping(IN EFI_HANDLE ControllerHandle, IN OUT EFI_HANDLE *DriverImageHandle, IN LIST_ENTRY *MappingDataBase, IN EFI_HANDLE CallerImageHandle)
EFI_STATUS EFIAPI UpdateFvFileDevicePath(IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, IN EFI_GUID *FileGuid, IN EFI_HANDLE CallerImageHandle)
VOID EFIAPI EfiInitializeFwVolDevicepathNode(IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode, IN CONST EFI_GUID *NameGuid)
EFI_GUID *EFIAPI EfiGetNameGuidFromFwVolDevicePathNode(IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode)
#define EFI_VARIABLE_NON_VOLATILE
LIST_ENTRY DriverInfoList
EFI_HANDLE DeviceHandle
The device handle that the EFI Image was loaded from.