Path: blob/main/sys/contrib/edk2/Include/Protocol/DevicePathUtilities.h
48383 views
/** @file1EFI_DEVICE_PATH_UTILITIES_PROTOCOL as defined in UEFI 2.0.2Use to create and manipulate device paths and device nodes.34Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>5SPDX-License-Identifier: BSD-2-Clause-Patent67**/89#ifndef __DEVICE_PATH_UTILITIES_PROTOCOL_H__10#define __DEVICE_PATH_UTILITIES_PROTOCOL_H__1112///13/// Device Path Utilities protocol14///15#define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \16{ \170x379be4e, 0xd706, 0x437d, {0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } \18}1920/**21Returns the size of the device path, in bytes.2223@param DevicePath Points to the start of the EFI device path.2425@return Size Size of the specified device path, in bytes, including the end-of-path tag.26@retval 0 DevicePath is NULL2728**/29typedef30UINTN31(EFIAPI *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE)(32IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath33);3435/**36Create a duplicate of the specified path.3738@param DevicePath Points to the source EFI device path.3940@retval Pointer A pointer to the duplicate device path.41@retval NULL insufficient memory or DevicePath is NULL4243**/44typedef45EFI_DEVICE_PATH_PROTOCOL *46(EFIAPI *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH)(47IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath48);4950/**51Create a new path by appending the second device path to the first.52If Src1 is NULL and Src2 is non-NULL, then a duplicate of Src2 is returned.53If Src1 is non-NULL and Src2 is NULL, then a duplicate of Src1 is returned.54If Src1 and Src2 are both NULL, then a copy of an end-of-device-path is returned.5556@param Src1 Points to the first device path.57@param Src2 Points to the second device path.5859@retval Pointer A pointer to the newly created device path.60@retval NULL Memory could not be allocated6162**/63typedef64EFI_DEVICE_PATH_PROTOCOL *65(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_PATH)(66IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,67IN CONST EFI_DEVICE_PATH_PROTOCOL *Src268);6970/**71Creates a new path by appending the device node to the device path.72If DeviceNode is NULL then a copy of DevicePath is returned.73If DevicePath is NULL then a copy of DeviceNode, followed by an end-of-device path device node is returned.74If both DeviceNode and DevicePath are NULL then a copy of an end-of-device-path device node is returned.7576@param DevicePath Points to the device path.77@param DeviceNode Points to the device node.7879@retval Pointer A pointer to the allocated device node.80@retval NULL There was insufficient memory.8182**/83typedef84EFI_DEVICE_PATH_PROTOCOL *85(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_NODE)(86IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,87IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode88);8990/**91Creates a new path by appending the specified device path instance to the specified device path.9293@param DevicePath Points to the device path. If NULL, then ignored.94@param DevicePathInstance Points to the device path instance.9596@retval Pointer A pointer to the newly created device path97@retval NULL Memory could not be allocated or DevicePathInstance is NULL.9899**/100typedef101EFI_DEVICE_PATH_PROTOCOL *102(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE)(103IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,104IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance105);106107/**108Creates a copy of the current device path instance and returns a pointer to the next device path109instance.110111@param DevicePathInstance On input, this holds the pointer to the current device path112instance. On output, this holds the pointer to the next113device path instance or NULL if there are no more device114path instances in the device path.115@param DevicePathInstanceSize On output, this holds the size of the device path instance,116in bytes or zero, if DevicePathInstance is NULL.117If NULL, then the instance size is not output.118119@retval Pointer A pointer to the copy of the current device path instance.120@retval NULL DevicePathInstace was NULL on entry or there was insufficient memory.121122**/123typedef124EFI_DEVICE_PATH_PROTOCOL *125(EFIAPI *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE)(126IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,127OUT UINTN *DevicePathInstanceSize128);129130/**131Creates a device node132133@param NodeType NodeType is the device node type (EFI_DEVICE_PATH.Type) for134the new device node.135@param NodeSubType NodeSubType is the device node sub-type136EFI_DEVICE_PATH.SubType) for the new device node.137@param NodeLength NodeLength is the length of the device node138(EFI_DEVICE_PATH.Length) for the new device node.139140@retval Pointer A pointer to the newly created device node.141@retval NULL NodeLength is less than142the size of the header or there was insufficient memory.143144**/145typedef146EFI_DEVICE_PATH_PROTOCOL *147(EFIAPI *EFI_DEVICE_PATH_UTILS_CREATE_NODE)(148IN UINT8 NodeType,149IN UINT8 NodeSubType,150IN UINT16 NodeLength151);152153/**154Returns whether a device path is multi-instance.155156@param DevicePath Points to the device path. If NULL, then ignored.157158@retval TRUE The device path has more than one instance159@retval FALSE The device path is empty or contains only a single instance.160161**/162typedef163BOOLEAN164(EFIAPI *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE)(165IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath166);167168///169/// This protocol is used to creates and manipulates device paths and device nodes.170///171typedef struct {172EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;173EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath;174EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath;175EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode;176EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance;177EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance;178EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance;179EFI_DEVICE_PATH_UTILS_CREATE_NODE CreateDeviceNode;180} EFI_DEVICE_PATH_UTILITIES_PROTOCOL;181182extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid;183184#endif185186187