Skip to content

Commit bb77cca

Browse files
committed
Loader: continue booting if the driver is already loaded
1 parent 41b1731 commit bb77cca

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

Application/Loader/Loader.c

+12-14
Original file line numberDiff line numberDiff line change
@@ -266,20 +266,19 @@ StartAndConfigureDriver(
266266
Print(L"[LOADER] StartImage failed: %llx (%r).\r\n", Status, Status);
267267
goto Exit;
268268
}
269-
270-
Status = gBS->LocateProtocol(&gEfiGuardDriverProtocolGuid,
271-
NULL,
272-
(VOID**)&EfiGuardDriverProtocol);
273-
if (EFI_ERROR(Status))
274-
{
275-
Print(L"[LOADER] LocateProtocol failed: %llx (%r).\r\n", Status, Status);
276-
goto Exit;
277-
}
278269
}
279270
else
280271
{
272+
ASSERT_EFI_ERROR(Status);
281273
Print(L"[LOADER] The driver is already loaded.\r\n");
282-
Status = EFI_ALREADY_STARTED;
274+
}
275+
276+
Status = gBS->LocateProtocol(&gEfiGuardDriverProtocolGuid,
277+
NULL,
278+
(VOID**)&EfiGuardDriverProtocol);
279+
if (EFI_ERROR(Status))
280+
{
281+
Print(L"[LOADER] LocateProtocol failed: %llx (%r).\r\n", Status, Status);
283282
goto Exit;
284283
}
285284

@@ -424,7 +423,9 @@ TryBootOptionsInOrder(
424423
// Print what we're booting
425424
if (ConvertedPath != NULL)
426425
{
427-
Print(L"Booting %Sdevice path %S...\r\n", IsLegacy ? L"legacy " : L"", ConvertedPath);
426+
Print(L"Booting \"%S\"...\r\n -> %S = %S\r\n",
427+
(BootOptions[Index].Description != NULL ? BootOptions[Index].Description : L"<null description>"),
428+
IsLegacy ? L"Legacy path" : L"Path", ConvertedPath);
428429
FreePool(ConvertedPath);
429430
}
430431

@@ -580,9 +581,6 @@ UefiMain(
580581
// Locate, load, start and configure the driver
581582
//
582583
CONST EFI_STATUS DriverStatus = StartAndConfigureDriver(ImageHandle, SystemTable);
583-
if (DriverStatus == EFI_ALREADY_STARTED)
584-
return EFI_SUCCESS;
585-
586584
if (EFI_ERROR(DriverStatus))
587585
{
588586
Print(L"\r\nERROR: driver load failed with status %llx (%r).\r\n"

0 commit comments

Comments
 (0)