提交 39f95660 编写于 作者: D Download-Fritz

OcDevicePathLib: Return the number of fixed Apple DP nodes

上级 327d4b7d
......@@ -143,10 +143,11 @@ TrailedBooterDevicePath (
On output, the device path pointer is modified to
point to the remaining part of the device path.
@returns Whether the device path has been fixed successfully.
@retval -1 DevicePath could not be fixed.
@retval other The number of fixed nodes in DevicePath.
**/
BOOLEAN
INTN
OcFixAppleBootDevicePath (
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
);
......
......@@ -333,7 +333,7 @@ InternalGetDefaultBootEntry (
OC_BOOT_ENTRY *BootEntry;
EFI_STATUS Status;
BOOLEAN Result;
INTN NumPatchedNodes;
UINT32 BootNextAttributes;
UINTN BootNextSize;
......@@ -475,7 +475,7 @@ InternalGetDefaultBootEntry (
DebugPrintDevicePath (DEBUG_INFO, "OCB: Default DP pre-fix", UefiDevicePath);
UefiRemainingDevicePath = UefiDevicePath;
Result = OcFixAppleBootDevicePath (&UefiRemainingDevicePath);
NumPatchedNodes = OcFixAppleBootDevicePath (&UefiRemainingDevicePath);
DebugPrintDevicePath (
DEBUG_INFO,
......@@ -488,7 +488,7 @@ InternalGetDefaultBootEntry (
UefiRemainingDevicePath
);
if (!Result) {
if (NumPatchedNodes == -1) {
DEBUG ((DEBUG_WARN, "OCB: Failed to fix the default boot Device Path,\n"));
return NULL;
}
......@@ -535,7 +535,6 @@ InternalGetDefaultBootEntry (
&UefiRemainingDevicePath,
&DeviceHandle
);
if (EFI_ERROR (Status)) {
continue;
}
......
......@@ -220,14 +220,17 @@ TrailedBooterDevicePath (
On output, the device path pointer is modified to
point to the remaining part of the device path.
@returns Whether the device path has been fixed successfully.
@retval -1 DevicePath could not be fixed.
@retval other The number of fixed nodes in DevicePath.
**/
BOOLEAN
INTN
OcFixAppleBootDevicePath (
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
)
{
INTN Result;
EFI_DEVICE_PATH_PROTOCOL *OriginalDevPath;
EFI_DEV_PATH_PTR InvalidNode;
......@@ -246,8 +249,18 @@ OcFixAppleBootDevicePath (
// modified and success is returned.
//
OriginalDevPath = *DevicePath;
//
// Failure will be returned explicitly within the loop. If this loop is run
// only once, it means the Device Path had already been valid. Hence, Result
// will be 0 on termination. Shall any switch-case continue, which it needs
// to in order to patch subsequent nodes, Result will be incremented.
//
Result = -1;
while (TRUE) {
if (Result != MAX_INTN) {
++Result;
}
RemainingDevPath = OriginalDevPath;
gBS->LocateDevicePath (
&gEfiDevicePathProtocolGuid,
......@@ -277,7 +290,7 @@ OcFixAppleBootDevicePath (
continue;
}
return FALSE;
return -1;
}
case MSG_SASEX_DP:
......@@ -299,7 +312,7 @@ OcFixAppleBootDevicePath (
continue;
}
return FALSE;
return -1;
}
default:
......@@ -325,7 +338,7 @@ OcFixAppleBootDevicePath (
continue;
}
return FALSE;
return -1;
}
case ACPI_EXTENDED_DP:
......@@ -351,7 +364,7 @@ OcFixAppleBootDevicePath (
continue;
}
return FALSE;
return -1;
}
default:
......@@ -361,7 +374,7 @@ OcFixAppleBootDevicePath (
}
}
return TRUE;
return Result;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册