EFI_DEVICE_PATH* Remaining;\r
EFI_DEVICE_PATH* NewDevicePath;\r
EFI_STATUS Status;\r
+ EFI_HANDLE PreviousHandle;\r
\r
if ((DevicePath == NULL) || (*DevicePath == NULL) || (Handle == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ PreviousHandle = NULL;\r
do {\r
Remaining = *DevicePath;\r
+\r
// The LocateDevicePath() function locates all devices on DevicePath that support Protocol and returns\r
// the handle to the device that is closest to DevicePath. On output, the device path pointer is modified\r
// to point to the remaining part of the device path\r
Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &Remaining, Handle);\r
+\r
if (!EFI_ERROR (Status)) {\r
- // Recursive = FALSE: We do not want to start all the device tree\r
- Status = gBS->ConnectController (*Handle, NULL, Remaining, FALSE);\r
- }\r
+ if (*Handle == PreviousHandle) {\r
+ //\r
+ // If no forward progress is made try invoking the Dispatcher.\r
+ // A new FV may have been added to the system and new drivers\r
+ // may now be found.\r
+ // Status == EFI_SUCCESS means a driver was dispatched\r
+ // Status == EFI_NOT_FOUND means no new drivers were dispatched\r
+ //\r
+ Status = gDS->Dispatch ();\r
+ }\r
\r
- /*// We need to check if RemainingDevicePath does not point on the last node. Otherwise, calling\r
- // NextDevicePathNode () will return an undetermined Device Path Node\r
- if (!IsDevicePathEnd (RemainingDevicePath)) {\r
- RemainingDevicePath = NextDevicePathNode (RemainingDevicePath);\r
- }*/\r
+ if (!EFI_ERROR (Status)) {\r
+ PreviousHandle = *Handle;\r
+\r
+ // Recursive = FALSE: We do not want to start the whole device tree\r
+ Status = gBS->ConnectController (*Handle, NULL, Remaining, FALSE);\r
+ }\r
+ }\r
} while (!EFI_ERROR (Status) && !IsDevicePathEnd (Remaining));\r
\r
if (!EFI_ERROR (Status)) {\r