mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
174 lines
5.1 KiB
C
Executable File
174 lines
5.1 KiB
C
Executable File
/** @file
|
|
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.
|
|
**/
|
|
|
|
#ifndef OC_DEVICE_PATH_LIB_H
|
|
#define OC_DEVICE_PATH_LIB_H
|
|
|
|
/**
|
|
Append file name to device path.
|
|
|
|
@param[in] DevicePath The device path which to append the file path.
|
|
@param[in] FileName The file name to append to the device path.
|
|
|
|
@retval EFI_SUCCESS The defaults were initialized successfully.
|
|
@retval EFI_INVALID_PARAMETER The parameters passed were invalid.
|
|
@retval EFI_OUT_OF_RESOURCES The system ran out of memory.
|
|
**/
|
|
EFI_DEVICE_PATH_PROTOCOL *
|
|
AppendFileNameDevicePath (
|
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
|
IN CHAR16 *FileName
|
|
);
|
|
|
|
/**
|
|
Locate the node inside the device path specified by Type an SubType values.
|
|
|
|
@param[in] DevicePath The device path used in the search.
|
|
@param[in] Type The Type field of the device path node specified by Node.
|
|
@param[in] SubType The SubType field of the device path node specified by Node.
|
|
|
|
@return Returned is the first Device Path Node with the given type.
|
|
**/
|
|
EFI_DEVICE_PATH_PROTOCOL *
|
|
FindDevicePathNodeWithType (
|
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
|
IN UINT8 Type,
|
|
IN UINT8 SubType OPTIONAL
|
|
);
|
|
|
|
/**
|
|
Check whether device paths are equal.
|
|
|
|
@param[in] DevicePath1 The first device path protocol to compare.
|
|
@param[in] DevicePath2 The second device path protocol to compare.
|
|
|
|
@retval TRUE The device paths matched
|
|
@retval FALSE The device paths were different
|
|
**/
|
|
BOOLEAN
|
|
EFIAPI
|
|
IsDevicePathEqual (
|
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
|
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
|
|
);
|
|
|
|
/**
|
|
Check whether File Device Paths are equal.
|
|
|
|
@param[in] FilePath1 The first device path protocol to compare.
|
|
@param[in] FilePath2 The second device path protocol to compare.
|
|
|
|
@retval TRUE The device paths matched
|
|
@retval FALSE The device paths were different
|
|
**/
|
|
BOOLEAN
|
|
FileDevicePathsEqual (
|
|
IN FILEPATH_DEVICE_PATH *FilePath1,
|
|
IN FILEPATH_DEVICE_PATH *FilePath2
|
|
);
|
|
|
|
/**
|
|
Check whether one device path exists in the other.
|
|
|
|
@param[in] ParentPath The parent device path protocol to check against.
|
|
@param[in] ChildPath The device path protocol of the child device to compare.
|
|
|
|
@retval TRUE The child device path contains the parent device path.
|
|
@retval FALSE The device paths were different
|
|
**/
|
|
BOOLEAN
|
|
EFIAPI
|
|
IsDevicePathChild (
|
|
IN EFI_DEVICE_PATH_PROTOCOL *ParentPath,
|
|
IN EFI_DEVICE_PATH_PROTOCOL *ChildPath
|
|
);
|
|
|
|
/**
|
|
Print debug path to log.
|
|
|
|
@param[in] ErrorLevel Debug error level.
|
|
@param[in] ChildPath Prefixed message.
|
|
@param[in] DevicePath Device path to print.
|
|
**/
|
|
VOID
|
|
DebugPrintDevicePath (
|
|
IN UINTN ErrorLevel,
|
|
IN CONST CHAR8 *Message,
|
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
|
);
|
|
|
|
/**
|
|
Get absolute device path.
|
|
|
|
@param[in] Handle Device handle.
|
|
@param[in] RelativePath Relative device path to handle, optional.
|
|
|
|
@retval New device path or NULL.
|
|
**/
|
|
EFI_DEVICE_PATH_PROTOCOL *
|
|
AbsoluteDevicePath (
|
|
IN EFI_HANDLE Handle,
|
|
IN EFI_DEVICE_PATH_PROTOCOL *RelativePath OPTIONAL
|
|
);
|
|
|
|
/**
|
|
Get trailed (slash-appended) device path for booter paths.
|
|
This way \\smth.efi gets NULL and \\smth gives \\smth\\.
|
|
|
|
@param[in] DevicePath Device path.
|
|
|
|
@retval New device path or NULL.
|
|
**/
|
|
EFI_DEVICE_PATH_PROTOCOL *
|
|
TrailedBooterDevicePath (
|
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
|
);
|
|
|
|
/**
|
|
Fix Apple Boot Device Path to be compatible with conventional UEFI
|
|
implementations.
|
|
|
|
@param[in,out] DevicePath On input, a pointer to the device path to fix.
|
|
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.
|
|
|
|
**/
|
|
BOOLEAN
|
|
OcFixAppleBootDevicePath (
|
|
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
|
);
|
|
|
|
/**
|
|
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.
|
|
|
|
@param FilePath The device path pointing to a load option.
|
|
It could be a short-form device path.
|
|
@param FullPath The full path returned by the routine in last call.
|
|
Set to NULL in first call.
|
|
|
|
@return The next possible full path pointing to the load option.
|
|
Caller is responsible to free the memory.
|
|
**/
|
|
EFI_DEVICE_PATH_PROTOCOL *
|
|
OcGetNextLoadOptionDevicePath (
|
|
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
|
|
IN EFI_DEVICE_PATH_PROTOCOL *FullPath
|
|
);
|
|
|
|
#endif // OC_DEVICE_PATH_LIB_H
|