OpenCore
1.0.4
OpenCore Bootloader
|
Go to the source code of this file.
Data Structures | |
struct | APPLE_BOOT_DP_PATCH_CONTEXT |
Macros | |
#define | MSG_APPLE_NVME_NAMESPACE_DP 0x22 |
Functions | |
EFI_DEVICE_PATH_PROTOCOL * | AppendFileNameDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CHAR16 *FileName) |
EFI_DEVICE_PATH_PROTOCOL * | FindDevicePathEndNode (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath) |
EFI_DEVICE_PATH_PROTOCOL * | FindDevicePathNodeWithType (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN UINT8 Type, IN UINT8 SubType OPTIONAL) |
BOOLEAN EFIAPI | IsDevicePathEqual (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2) |
BOOLEAN | FileDevicePathsEqual (IN FILEPATH_DEVICE_PATH *FilePath1, IN FILEPATH_DEVICE_PATH *FilePath2) |
BOOLEAN EFIAPI | IsDevicePathChild (IN EFI_DEVICE_PATH_PROTOCOL *ParentPath, IN EFI_DEVICE_PATH_PROTOCOL *ChildPath) |
EFI_DEVICE_PATH_PROTOCOL * | AbsoluteDevicePath (IN EFI_HANDLE Handle, IN EFI_DEVICE_PATH_PROTOCOL *RelativePath OPTIONAL) |
EFI_DEVICE_PATH_PROTOCOL * | TrailedBooterDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath) |
UINTN | OcFileDevicePathNameSize (IN CONST FILEPATH_DEVICE_PATH *FilePath) |
UINTN | OcFileDevicePathNameLen (IN CONST FILEPATH_DEVICE_PATH *FilePath) |
UINTN | OcFileDevicePathFullNameLen (IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) |
UINTN | OcFileDevicePathFullNameSize (IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) |
VOID | OcFileDevicePathFullName (OUT CHAR16 *PathName, IN CONST FILEPATH_DEVICE_PATH *FilePath, IN UINTN PathNameSize) |
CHAR16 * | OcCopyDevicePathFullName (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT EFI_DEVICE_PATH_PROTOCOL **FileDevicePath OPTIONAL) |
EFI_DEVICE_PATH_PROTOCOL * | OcAppendDevicePathInstanceDedupe (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance) |
UINTN | OcGetNumDevicePathInstances (IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) |
INTN | OcFixAppleBootDevicePathNode (IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode, OUT APPLE_BOOT_DP_PATCH_CONTEXT *RestoreContext OPTIONAL, IN EFI_HANDLE ValidDevice OPTIONAL) |
VOID | OcFixAppleBootDevicePathNodeRestore (IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode, IN CONST APPLE_BOOT_DP_PATCH_CONTEXT *RestoreContext) |
VOID | OcFixAppleBootDevicePathNodeRestoreFree (IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN OUT APPLE_BOOT_DP_PATCH_CONTEXT *RestoreContext) |
INTN | OcFixAppleBootDevicePath (IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT EFI_DEVICE_PATH_PROTOCOL **RemainingDevicePath) |
EFI_DEVICE_PATH_PROTOCOL * | OcGetNextLoadOptionDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN EFI_DEVICE_PATH_PROTOCOL *FullPath) |
BOOLEAN | OcDevicePathHasFilePathSuffix (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONST CHAR16 *Suffix, IN UINTN SuffixLen) |
Copyright (C) 2016, The HermitCrabs Lab. All rights reserved.
All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Definition in file OcDevicePathLib.h.
#define MSG_APPLE_NVME_NAMESPACE_DP 0x22 |
Apple MacPro5,1 includes NVMe driver, however, it contains a typo in MSG_SASEX_DP. Instead of 0x16 aka 22 (SasEx) it uses 0x22 aka 34 (Unspecified). Here we replace it with the "right" value. Reference: https://forums.macrumors.com/posts/28169441.
Definition at line 24 of file OcDevicePathLib.h.
EFI_DEVICE_PATH_PROTOCOL * AbsoluteDevicePath | ( | IN EFI_HANDLE | Handle, |
IN EFI_DEVICE_PATH_PROTOCOL *RelativePath | OPTIONAL ) |
Get absolute device path.
[in] | Handle | Device handle. |
[in] | RelativePath | Relative device path to handle, optional. |
New | device path or NULL. |
Definition at line 112 of file OcDevicePathLib.c.
EFI_DEVICE_PATH_PROTOCOL * AppendFileNameDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath, |
IN CHAR16 * | FileName ) |
Append file name to device path.
[in] | DevicePath | The device path which to append the file path. |
[in] | FileName | The file name to append to the device path. |
EFI_SUCCESS | The defaults were initialized successfully. |
EFI_INVALID_PARAMETER | The parameters passed were invalid. |
EFI_OUT_OF_RESOURCES | The system ran out of memory. |
Definition at line 33 of file OcDevicePathLib.c.
BOOLEAN FileDevicePathsEqual | ( | IN FILEPATH_DEVICE_PATH * | FilePath1, |
IN FILEPATH_DEVICE_PATH * | FilePath2 ) |
Check whether File Device Paths are equal.
[in] | FilePath1 | The first device path protocol to compare. |
[in] | FilePath2 | The second device path protocol to compare. |
TRUE | The device paths matched |
FALSE | The device paths were different |
Definition at line 1107 of file OcDevicePathLib.c.
EFI_DEVICE_PATH_PROTOCOL * FindDevicePathEndNode | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath | ) |
Locate the terminating node inside the device path.
[in] | DevicePath | The device path used in the search. |
Definition at line 74 of file OcDevicePathLib.c.
EFI_DEVICE_PATH_PROTOCOL * FindDevicePathNodeWithType | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath, |
IN UINT8 | Type, | ||
IN UINT8 SubType | OPTIONAL ) |
Locate the node inside the device path specified by Type an SubType values.
[in] | DevicePath | The device path used in the search. |
[in] | Type | The Type field of the device path node specified by Node. |
[in] | SubType | The SubType field of the device path node specified by Node. |
Definition at line 86 of file OcDevicePathLib.c.
BOOLEAN EFIAPI IsDevicePathChild | ( | IN EFI_DEVICE_PATH_PROTOCOL * | ParentPath, |
IN EFI_DEVICE_PATH_PROTOCOL * | ChildPath ) |
Check whether one device path exists in the other.
[in] | ParentPath | The parent device path protocol to check against. |
[in] | ChildPath | The device path protocol of the child device to compare. |
TRUE | The child device path contains the parent device path. |
FALSE | The device paths were different |
Definition at line 1219 of file OcDevicePathLib.c.
BOOLEAN EFIAPI IsDevicePathEqual | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath1, |
IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath2 ) |
Check whether device paths are equal.
[in] | DevicePath1 | The first device path protocol to compare. |
[in] | DevicePath2 | The second device path protocol to compare. |
TRUE | The device paths matched |
FALSE | The device paths were different |
Definition at line 1209 of file OcDevicePathLib.c.
EFI_DEVICE_PATH_PROTOCOL * OcAppendDevicePathInstanceDedupe | ( | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath | OPTIONAL, |
IN CONST EFI_DEVICE_PATH_PROTOCOL * | DevicePathInstance ) |
Duplicate device path with DevicePathInstance appended if it is not present.
[in] | DevicePath | Device Path to append new instance to, optional. |
[in] | DevicePathInstance | Device Path instance to append. |
New | Device Path or NULL. |
Definition at line 1424 of file OcDevicePathLib.c.
CHAR16 * OcCopyDevicePathFullName | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath, |
OUT EFI_DEVICE_PATH_PROTOCOL **FileDevicePath | OPTIONAL ) |
Retrieves full file path from device path allocating it on pool.
[in] | DevicePath | Device path to extract file path from. |
[out] | FileDevicePath | Pointer to file path part of the device path, optional. |
NULL | when missing. |
Definition at line 1379 of file OcDevicePathLib.c.
BOOLEAN OcDevicePathHasFilePathSuffix | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath, |
IN CONST CHAR16 * | Suffix, | ||
IN UINTN | SuffixLen ) |
Definition at line 1495 of file OcDevicePathLib.c.
VOID OcFileDevicePathFullName | ( | OUT CHAR16 * | PathName, |
IN CONST FILEPATH_DEVICE_PATH * | FilePath, | ||
IN UINTN | PathNameSize ) |
Retrieve the full file path described by FilePath. The caller is expected to call OcFileDevicePathFullNameSize() or ensure its guarantees are met.
[out] | PathName | On output, the full file path of FilePath. |
[in] | FilePath | The File Device Path to inspect. |
[in] | PathNameSize | The size, in bytes, of PathName. Must equal the actual full file path size. |
Definition at line 1343 of file OcDevicePathLib.c.
UINTN OcFileDevicePathFullNameLen | ( | IN CONST EFI_DEVICE_PATH_PROTOCOL * | DevicePath | ) |
Retrieve the length of the full file path described by DevicePath.
[in] | DevicePath | The Device Path to inspect. |
0 | DevicePath does not start with a File Path node or contains non-terminating nodes that are not File Path nodes. |
Definition at line 1271 of file OcDevicePathLib.c.
UINTN OcFileDevicePathFullNameSize | ( | IN CONST EFI_DEVICE_PATH_PROTOCOL * | DevicePath | ) |
Retrieve the size of the full file path described by DevicePath.
[in] | DevicePath | The Device Path to inspect. |
0 | DevicePath does not start with a File Path node or contains non-terminating nodes that are not File Path nodes. |
Definition at line 1316 of file OcDevicePathLib.c.
UINTN OcFileDevicePathNameLen | ( | IN CONST FILEPATH_DEVICE_PATH * | FilePath | ) |
Returns the length of PathName.
[in] | FilePath | The file Device Path node to inspect. |
Name | length in characters (without trailing zero). |
Definition at line 1238 of file OcDevicePathLib.c.
UINTN OcFileDevicePathNameSize | ( | IN CONST FILEPATH_DEVICE_PATH * | FilePath | ) |
Returns the size of PathName.
[in] | FilePath | The file Device Path node to inspect. |
Name | size in bytes. |
Definition at line 1228 of file OcDevicePathLib.c.
INTN OcFixAppleBootDevicePath | ( | IN OUT EFI_DEVICE_PATH_PROTOCOL ** | DevicePath, |
OUT EFI_DEVICE_PATH_PROTOCOL ** | RemainingDevicePath ) |
Fix Apple Boot Device Path to be compatible with conventional UEFI implementations. In case -1 is returned and the first node could not be located or fixed, DevicePath's original state will be preserved. In all other cases, it may be destroyed.
[in,out] | DevicePath | A pointer to the device path to fix. It must be a pool memory buffer. On success, may be updated with a reallocated pool memory buffer. |
[in,out] | RemainingDevicePath | A pointer the remaining part of the device path is returned into. |
Note, RemainingDevicePath will always point into DevicePath after this function completes. RemainingDevicePath being equal to DevicePath means that we failed to advance, and this device path is likely a short form device path or something completely not valid.
-1 | *DevicePath could not be fixed. |
0 | *DevicePath was not modified and may be valid. |
1 | *DevicePath was fixed and may be valid. |
Definition at line 822 of file OcDevicePathLib.c.
INTN OcFixAppleBootDevicePathNode | ( | IN OUT EFI_DEVICE_PATH_PROTOCOL ** | DevicePath, |
IN OUT EFI_DEVICE_PATH_PROTOCOL ** | DevicePathNode, | ||
OUT APPLE_BOOT_DP_PATCH_CONTEXT *RestoreContext | OPTIONAL, | ||
IN EFI_HANDLE ValidDevice | OPTIONAL ) |
Fix Apple Boot Device Path node to be compatible with conventional UEFI implementations.
[in,out] | DevicePath | A pointer to the device path to fix a node of. It must be a pool memory buffer. On success, may be updated with a reallocated pool memory buffer. |
[in,out] | DevicePathNode | A pointer to the device path node to fix. It must be a node of *DevicePath. On success, may be updated with the corresponding node of *DevicePath. |
[out] | RestoreContext | A pointer to a context that can be used to restore DevicePathNode's original content in the case of failure. On success, data may need to be freed. |
[in] | ValidDevice | A device handle pointing to previous valid device path if any. |
-1 | DevicePathNode could not be fixed. |
0 | DevicePathNode was not modified and may be valid. |
1 | DevicePathNode was fixed and may be valid. |
Definition at line 590 of file OcDevicePathLib.c.
VOID OcFixAppleBootDevicePathNodeRestore | ( | IN OUT EFI_DEVICE_PATH_PROTOCOL ** | DevicePath, |
IN OUT EFI_DEVICE_PATH_PROTOCOL ** | DevicePathNode, | ||
IN CONST APPLE_BOOT_DP_PATCH_CONTEXT * | RestoreContext ) |
Restore the original content of DevicePathNode before calling OcFixAppleBootDevicePathNode() with RestoreContext. Modifying a device path and then restoring a node may lead to lost updates.
[in,out] | DevicePath | A pointer to the device path to restore a node of. May be updated with the previous pool memory buffer. |
[in,out] | DevicePathNode | A pointer to the device path node to restore. It must be a node of *DevicePath. May be updated with the corresponding node of *DevicePath. |
[out] | RestoreContext | A pointer to a context that was used to call OcFixAppleBootDevicePathNode(). All resources are freed. |
Definition at line 211 of file OcDevicePathLib.c.
VOID OcFixAppleBootDevicePathNodeRestoreFree | ( | IN CONST EFI_DEVICE_PATH_PROTOCOL * | DevicePathNode, |
IN OUT APPLE_BOOT_DP_PATCH_CONTEXT * | RestoreContext ) |
Definition at line 283 of file OcDevicePathLib.c.
EFI_DEVICE_PATH_PROTOCOL * OcGetNextLoadOptionDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath, |
IN EFI_DEVICE_PATH_PROTOCOL * | FullPath ) |
Get the next possible full path pointing to the load option. The routine doesn't guarantee the returned full path points to an existing file, and it also doesn't guarantee the existing file is a valid load option.
FilePath | The device path pointing to a load option. It could be a short-form device path. |
FullPath | The full path returned by the routine in last call. Set to NULL in first call. |
Definition at line 1055 of file ExpandDevicePath.c.
UINTN OcGetNumDevicePathInstances | ( | IN CONST EFI_DEVICE_PATH_PROTOCOL * | DevicePath | ) |
Calculate number of device path instances.
[in] | DevicePath | Device Path to calculate instances in. |
Number | of instances in device path. |
Definition at line 1475 of file OcDevicePathLib.c.
EFI_DEVICE_PATH_PROTOCOL * TrailedBooterDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath | ) |
Get trailed (slash-appended) device path for booter paths. This way \smth.efi gets NULL and \smth gives \smth\.
[in] | DevicePath | Device path. |
New | device path or NULL. |
Definition at line 139 of file OcDevicePathLib.c.