VirtualBox

Ignore:
Timestamp:
Oct 28, 2015 8:17:18 PM (9 years ago)
Author:
vboxsync
Message:

EFI/Firmware: 'svn merge /vendor/edk2/UDK2010.SR1 /vendor/edk2/current .', reverting and removing files+dirs listed in ReadMe.vbox, resolving conflicts with help from ../UDK2014.SP1/. This is a raw untested merge.

Location:
trunk/src/VBox/Devices/EFI/Firmware
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware

  • trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c

    r48674 r58459  
    99  on a Handle.
    1010
    11   Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
     11  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    1212  This program and the accompanying materials                         
    1313  are licensed and made available under the terms and conditions of the BSD License         
     
    2121
    2222
    23 #include <Uefi.h>
    24 
    25 #include <Library/DevicePathLib.h>
    26 #include <Library/BaseMemoryLib.h>
    27 #include <Library/DebugLib.h>
    28 #include <Library/MemoryAllocationLib.h>
    29 #include <Library/UefiBootServicesTableLib.h>
    30 #include <Library/BaseLib.h>
    31 
    32 //
    33 // Template for an end-of-device path node.
    34 //
    35 GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_PROTOCOL  mUefiDevicePathLibEndDevicePath = {
    36   END_DEVICE_PATH_TYPE,
    37   END_ENTIRE_DEVICE_PATH_SUBTYPE,
    38   {
    39     END_DEVICE_PATH_LENGTH,
    40     0
    41   }
    42 };
    43 
    44 /**
    45   Returns the Type field of a device path node.
    46 
    47   Returns the Type field of the device path node specified by Node.
    48 
    49   If Node is NULL, then ASSERT().
    50 
    51   @param  Node      A pointer to a device path node data structure.
    52 
    53   @return The Type field of the device path node specified by Node.
    54 
    55 **/
    56 UINT8
    57 EFIAPI
    58 DevicePathType (
    59   IN CONST VOID  *Node
    60   )
    61 {
    62   ASSERT (Node != NULL);
    63   return ((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Type;
    64 }
    65 
    66 /**
    67   Returns the SubType field of a device path node.
    68 
    69   Returns the SubType field of the device path node specified by Node.
    70 
    71   If Node is NULL, then ASSERT().
    72 
    73   @param  Node      A pointer to a device path node data structure.
    74 
    75   @return The SubType field of the device path node specified by Node.
    76 
    77 **/
    78 UINT8
    79 EFIAPI
    80 DevicePathSubType (
    81   IN CONST VOID  *Node
    82   )
    83 {
    84   ASSERT (Node != NULL);
    85   return ((EFI_DEVICE_PATH_PROTOCOL *)(Node))->SubType;
    86 }
    87 
    88 /**
    89   Returns the 16-bit Length field of a device path node.
    90 
    91   Returns the 16-bit Length field of the device path node specified by Node. 
    92   Node is not required to be aligned on a 16-bit boundary, so it is recommended
    93   that a function such as ReadUnaligned16() be used to extract the contents of
    94   the Length field.
    95 
    96   If Node is NULL, then ASSERT().
    97 
    98   @param  Node      A pointer to a device path node data structure.
    99 
    100   @return The 16-bit Length field of the device path node specified by Node.
    101 
    102 **/
    103 UINTN
    104 EFIAPI
    105 DevicePathNodeLength (
    106   IN CONST VOID  *Node
    107   )
    108 {
    109   ASSERT (Node != NULL);
    110   return ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]);
    111 }
    112 
    113 /**
    114   Returns a pointer to the next node in a device path.
    115 
    116   Returns a pointer to the device path node that follows the device path node
    117   specified by Node.
    118 
    119   If Node is NULL, then ASSERT().
    120 
    121   @param  Node      A pointer to a device path node data structure.
    122 
    123   @return a pointer to the device path node that follows the device path node
    124   specified by Node.
    125 
    126 **/
    127 EFI_DEVICE_PATH_PROTOCOL *
    128 EFIAPI
    129 NextDevicePathNode (
    130   IN CONST VOID  *Node
    131   )
    132 {
    133   ASSERT (Node != NULL);
    134   return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node));
    135 }
    136 
    137 /**
    138   Determines if a device path node is an end node of a device path.
    139   This includes nodes that are the end of a device path instance and nodes that
    140   are the end of an entire device path.
    141 
    142   Determines if the device path node specified by Node is an end node of a device path. 
    143   This includes nodes that are the end of a device path instance and nodes that are the
    144   end of an entire device path.  If Node represents an end node of a device path,
    145   then TRUE is returned.  Otherwise, FALSE is returned.
    146 
    147   If Node is NULL, then ASSERT().
    148 
    149   @param  Node      A pointer to a device path node data structure.
    150 
    151   @retval TRUE      The device path node specified by Node is an end node of a
    152                     device path.
    153   @retval FALSE     The device path node specified by Node is not an end node of
    154                     a device path.
    155  
    156 **/
    157 BOOLEAN
    158 EFIAPI
    159 IsDevicePathEndType (
    160   IN CONST VOID  *Node
    161   )
    162 {
    163   ASSERT (Node != NULL);
    164   return (BOOLEAN) (DevicePathType (Node) == END_DEVICE_PATH_TYPE);
    165 }
    166 
    167 /**
    168   Determines if a device path node is an end node of an entire device path.
    169 
    170   Determines if a device path node specified by Node is an end node of an entire
    171   device path. If Node represents the end of an entire device path, then TRUE is
    172   returned.  Otherwise, FALSE is returned.
    173 
    174   If Node is NULL, then ASSERT().
    175 
    176   @param  Node      A pointer to a device path node data structure.
    177 
    178   @retval TRUE      The device path node specified by Node is the end of an entire
    179                     device path.
    180   @retval FALSE     The device path node specified by Node is not the end of an
    181                     entire device path.
    182 
    183 **/
    184 BOOLEAN
    185 EFIAPI
    186 IsDevicePathEnd (
    187   IN CONST VOID  *Node
    188   )
    189 {
    190   ASSERT (Node != NULL);
    191   return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE);
    192 }
    193 
    194 /**
    195   Determines if a device path node is an end node of a device path instance.
    196 
    197   Determines if a device path node specified by Node is an end node of a device
    198   path instance. If Node represents the end of a device path instance, then TRUE
    199   is returned.  Otherwise, FALSE is returned.
    200 
    201   If Node is NULL, then ASSERT().
    202 
    203   @param  Node      A pointer to a device path node data structure.
    204 
    205   @retval TRUE      The device path node specified by Node is the end of a device
    206                     path instance.
    207   @retval FALSE     The device path node specified by Node is not the end of a
    208                     device path instance.
    209 
    210 **/
    211 BOOLEAN
    212 EFIAPI
    213 IsDevicePathEndInstance (
    214   IN CONST VOID  *Node
    215   )
    216 {
    217   ASSERT (Node != NULL);
    218   return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);
    219 }
    220 
    221 /**
    222   Sets the length, in bytes, of a device path node.
    223 
    224   Sets the length of the device path node specified by Node to the value specified
    225   by NodeLength.  NodeLength is returned.  Node is not required to be aligned on
    226   a 16-bit boundary, so it is recommended that a function such as WriteUnaligned16()
    227   be used to set the contents of the Length field.
    228 
    229   If Node is NULL, then ASSERT().
    230   If NodeLength >= 0x10000, then ASSERT().
    231 
    232   @param  Node      A pointer to a device path node data structure.
    233   @param  Length    The length, in bytes, of the device path node.
    234 
    235   @return Length
    236 
    237 **/
    238 UINT16
    239 EFIAPI
    240 SetDevicePathNodeLength (
    241   IN OUT VOID  *Node,
    242   IN UINTN     Length
    243   )
    244 {
    245   ASSERT (Node != NULL);
    246   ASSERT (Length < 0x10000);
    247   return WriteUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0], (UINT16)(Length));
    248 }
    249 
    250 /**
    251   Fills in all the fields of a device path node that is the end of an entire device path.
    252 
    253   Fills in all the fields of a device path node specified by Node so Node represents
    254   the end of an entire device path.  The Type field of Node is set to
    255   END_DEVICE_PATH_TYPE, the SubType field of Node is set to
    256   END_ENTIRE_DEVICE_PATH_SUBTYPE, and the Length field of Node is set to
    257   END_DEVICE_PATH_LENGTH.  Node is not required to be aligned on a 16-bit boundary,
    258   so it is recommended that a function such as WriteUnaligned16() be used to set
    259   the contents of the Length field.
    260 
    261   If Node is NULL, then ASSERT().
    262 
    263   @param  Node      A pointer to a device path node data structure.
    264 
    265 **/
    266 VOID
    267 EFIAPI
    268 SetDevicePathEndNode (
    269   OUT VOID  *Node
    270   )
    271 {
    272   ASSERT (Node != NULL);
    273   CopyMem (Node, &mUefiDevicePathLibEndDevicePath, sizeof (mUefiDevicePathLibEndDevicePath));
    274 }
     23#include "UefiDevicePathLib.h"
    27524
    27625/**
     
    27827
    27928  This function returns the size, in bytes, of the device path data structure
    280   specified by DevicePath including the end of device path node.  If DevicePath
    281   is NULL, then 0 is returned.
     29  specified by DevicePath including the end of device path node.
     30  If DevicePath is NULL or invalid, then 0 is returned.
    28231
    28332  @param  DevicePath  A pointer to a device path data structure.
    284  
    285   @retval 0           If DevicePath is NULL.
     33
     34  @retval 0           If DevicePath is NULL or invalid.
    28635  @retval Others      The size of a device path in bytes.
    28736
     
    29342  )
    29443{
    295   CONST EFI_DEVICE_PATH_PROTOCOL  *Start;
    296 
    297   if (DevicePath == NULL) {
    298     return 0;
    299   }
    300 
    301   //
    302   // Search for the end of the device path structure
    303   //
    304   Start = DevicePath;
    305   while (!IsDevicePathEnd (DevicePath)) {
    306     DevicePath = NextDevicePathNode (DevicePath);
    307   }
    308 
    309   //
    310   // Compute the size and add back in the size of the end device path structure
    311   //
    312   return ((UINTN) DevicePath - (UINTN) Start) + DevicePathNodeLength (DevicePath);
     44  return UefiDevicePathLibGetDevicePathSize (DevicePath);
    31345}
    31446
     
    32557  @param  DevicePath    A pointer to a device path data structure.
    32658
    327   @retval NULL          If DevicePath is NULL.
     59  @retval NULL          DevicePath is NULL or invalid.
    32860  @retval Others        A pointer to the duplicated device path.
    32961 
     
    33567  )
    33668{
    337   UINTN                     Size;
    338 
    339   //
    340   // Compute the size
    341   //
    342   Size = GetDevicePathSize (DevicePath);
    343   if (Size == 0) {
    344     return NULL;
    345   }
    346 
    347   //
    348   // Allocate space for duplicate device path
    349   //
    350 
    351   return AllocateCopyPool (Size, DevicePath);
     69  return UefiDevicePathLibDuplicateDevicePath (DevicePath);
    35270}
    35371
     
    37189 
    37290  @retval NULL      If there is not enough memory for the newly allocated buffer.
     91  @retval NULL      If FirstDevicePath or SecondDevicePath is invalid.
    37392  @retval Others    A pointer to the new device path if success.
    37493                    Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL.
     
    382101  )
    383102{
    384   UINTN                     Size;
    385   UINTN                     Size1;
    386   UINTN                     Size2;
    387   EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;
    388   EFI_DEVICE_PATH_PROTOCOL  *DevicePath2;
    389 
    390   //
    391   // If there's only 1 path, just duplicate it.
    392   //
    393   if (FirstDevicePath == NULL) {
    394     return DuplicateDevicePath ((SecondDevicePath != NULL) ? SecondDevicePath : &mUefiDevicePathLibEndDevicePath);
    395   }
    396 
    397   if (SecondDevicePath == NULL) {
    398     return DuplicateDevicePath (FirstDevicePath);
    399   }
    400 
    401   //
    402   // Allocate space for the combined device path. It only has one end node of
    403   // length EFI_DEVICE_PATH_PROTOCOL.
    404   //
    405   Size1         = GetDevicePathSize (FirstDevicePath);
    406   Size2         = GetDevicePathSize (SecondDevicePath);
    407   Size          = Size1 + Size2 - END_DEVICE_PATH_LENGTH;
    408 
    409   NewDevicePath = AllocatePool (Size);
    410 
    411   if (NewDevicePath != NULL) {
    412     NewDevicePath = CopyMem (NewDevicePath, FirstDevicePath, Size1);
    413     //
    414     // Over write FirstDevicePath EndNode and do the copy
    415     //
    416     DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath +
    417                   (Size1 - END_DEVICE_PATH_LENGTH));
    418     CopyMem (DevicePath2, SecondDevicePath, Size2);
    419   }
    420 
    421   return NewDevicePath;
     103  return UefiDevicePathLibAppendDevicePath (FirstDevicePath, SecondDevicePath);
    422104}
    423105
     
    457139  )
    458140{
    459   EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;
    460   EFI_DEVICE_PATH_PROTOCOL  *NextNode;
    461   EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;
    462   UINTN                     NodeLength;
    463 
    464   if (DevicePathNode == NULL) {
    465     return DuplicateDevicePath ((DevicePath != NULL) ? DevicePath : &mUefiDevicePathLibEndDevicePath);
    466   }
    467   //
    468   // Build a Node that has a terminator on it
    469   //
    470   NodeLength = DevicePathNodeLength (DevicePathNode);
    471 
    472   TempDevicePath = AllocatePool (NodeLength + END_DEVICE_PATH_LENGTH);
    473   if (TempDevicePath == NULL) {
    474     return NULL;
    475   }
    476   TempDevicePath = CopyMem (TempDevicePath, DevicePathNode, NodeLength);
    477   //
    478   // Add and end device path node to convert Node to device path
    479   //
    480   NextNode = NextDevicePathNode (TempDevicePath);
    481   SetDevicePathEndNode (NextNode);
    482   //
    483   // Append device paths
    484   //
    485   NewDevicePath = AppendDevicePath (DevicePath, TempDevicePath);
    486 
    487   FreePool (TempDevicePath);
    488 
    489   return NewDevicePath;
     141  return UefiDevicePathLibAppendDevicePathNode (DevicePath, DevicePathNode);
    490142}
    491143
     
    501153  If DevicePath is NULL, then a copy if DevicePathInstance is returned.
    502154  If DevicePathInstance is NULL, then NULL is returned.
     155  If DevicePath or DevicePathInstance is invalid, then NULL is returned.
    503156  If there is not enough memory to allocate space for the new device path, then
    504157  NULL is returned. 
     
    519172  )
    520173{
    521   EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;
    522   EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;
    523   UINTN                     SrcSize;
    524   UINTN                     InstanceSize;
    525 
    526   if (DevicePath == NULL) {
    527     return DuplicateDevicePath (DevicePathInstance);
    528   }
    529 
    530   if (DevicePathInstance == NULL) {
    531     return NULL;
    532   }
    533 
    534   SrcSize       = GetDevicePathSize (DevicePath);
    535   InstanceSize  = GetDevicePathSize (DevicePathInstance);
    536 
    537   NewDevicePath = AllocatePool (SrcSize + InstanceSize);
    538   if (NewDevicePath != NULL) {
    539    
    540     TempDevicePath = CopyMem (NewDevicePath, DevicePath, SrcSize);;
    541  
    542     while (!IsDevicePathEnd (TempDevicePath)) {
    543       TempDevicePath = NextDevicePathNode (TempDevicePath);
    544     }
    545    
    546     TempDevicePath->SubType  = END_INSTANCE_DEVICE_PATH_SUBTYPE;
    547     TempDevicePath           = NextDevicePathNode (TempDevicePath);
    548     CopyMem (TempDevicePath, DevicePathInstance, InstanceSize);
    549   }
    550 
    551   return NewDevicePath;
     174  return UefiDevicePathLibAppendDevicePathInstance (DevicePath, DevicePathInstance);
    552175}
    553176
     
    560183  if no more) and updates Size to hold the size of the device path instance copy.
    561184  If DevicePath is NULL, then NULL is returned.
     185  If DevicePath points to a invalid device path, then NULL is returned.
    562186  If there is not enough memory to allocate space for the new device path, then
    563187  NULL is returned. 
     
    586210  )
    587211{
    588   EFI_DEVICE_PATH_PROTOCOL  *DevPath;
    589   EFI_DEVICE_PATH_PROTOCOL  *ReturnValue;
    590   UINT8                     Temp;
    591 
    592   ASSERT (Size != NULL);
    593 
    594   if (DevicePath == NULL || *DevicePath == NULL) {
    595     *Size = 0;
    596     return NULL;
    597   }
    598 
    599   //
    600   // Find the end of the device path instance
    601   //
    602   DevPath = *DevicePath;
    603   while (!IsDevicePathEndType (DevPath)) {
    604     DevPath = NextDevicePathNode (DevPath);
    605   }
    606 
    607   //
    608   // Compute the size of the device path instance
    609   //
    610   *Size = ((UINTN) DevPath - (UINTN) (*DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
    611  
    612   //
    613   // Make a copy and return the device path instance
    614   //
    615   Temp              = DevPath->SubType;
    616   DevPath->SubType  = END_ENTIRE_DEVICE_PATH_SUBTYPE;
    617   ReturnValue       = DuplicateDevicePath (*DevicePath);
    618   DevPath->SubType  = Temp;
    619 
    620   //
    621   // If DevPath is the end of an entire device path, then another instance
    622   // does not follow, so *DevicePath is set to NULL.
    623   //
    624   if (DevicePathSubType (DevPath) == END_ENTIRE_DEVICE_PATH_SUBTYPE) {
    625     *DevicePath = NULL;
    626   } else {
    627     *DevicePath = NextDevicePathNode (DevPath);
    628   }
    629 
    630   return ReturnValue;
     212  return UefiDevicePathLibGetNextDevicePathInstance (DevicePath, Size);
    631213}
    632214
     
    658240  )
    659241{
    660   EFI_DEVICE_PATH_PROTOCOL      *DevicePath;
    661 
    662   if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
    663     //
    664     // NodeLength is less than the size of the header.
    665     //
    666     return NULL;
    667   }
    668  
    669   DevicePath = AllocateZeroPool (NodeLength);
    670   if (DevicePath != NULL) {
    671      DevicePath->Type    = NodeType;
    672      DevicePath->SubType = NodeSubType;
    673      SetDevicePathNodeLength (DevicePath, NodeLength);
    674   }
    675 
    676   return DevicePath;
     242  return UefiDevicePathLibCreateDeviceNode (NodeType, NodeSubType, NodeLength);
    677243}
    678244
     
    682248  This function returns TRUE if the device path specified by DevicePath is
    683249  multi-instance.
    684   Otherwise, FALSE is returned.  If DevicePath is NULL, then FALSE is returned.
     250  Otherwise, FALSE is returned.
     251  If DevicePath is NULL or invalid, then FALSE is returned.
    685252
    686253  @param  DevicePath                 A pointer to a device path data structure.
    687254
    688255  @retval  TRUE                      DevicePath is multi-instance.
    689   @retval  FALSE                     DevicePath is not multi-instance or DevicePath
    690                                      is NULL.
     256  @retval  FALSE                     DevicePath is not multi-instance, or DevicePath
     257                                     is NULL or invalid.
    691258
    692259**/
     
    697264  )
    698265{
    699   CONST EFI_DEVICE_PATH_PROTOCOL     *Node;
    700 
    701   if (DevicePath == NULL) {
    702     return FALSE;
    703   }
    704 
    705   Node = DevicePath;
    706   while (!IsDevicePathEnd (Node)) {
    707     if (IsDevicePathEndInstance (Node)) {
    708       return TRUE;
    709     }
    710 
    711     Node = NextDevicePathNode (Node);
    712   }
    713 
    714   return FALSE;
    715 }
    716 
    717 
    718 /**
    719   Retrieves the device path protocol from a handle.
    720 
    721   This function returns the device path protocol from the handle specified by Handle. 
    722   If Handle is NULL or Handle does not contain a device path protocol, then NULL
    723   is returned.
    724  
    725   @param  Handle                     The handle from which to retrieve the device
    726                                      path protocol.
    727 
    728   @return The device path protocol from the handle specified by Handle.
    729 
    730 **/
    731 EFI_DEVICE_PATH_PROTOCOL *
    732 EFIAPI
    733 DevicePathFromHandle (
    734   IN EFI_HANDLE                      Handle
    735   )
    736 {
    737   EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
    738   EFI_STATUS                Status;
    739 
    740   Status = gBS->HandleProtocol (
    741                   Handle,
    742                   &gEfiDevicePathProtocolGuid,
    743                   (VOID *) &DevicePath
    744                   );
    745   if (EFI_ERROR (Status)) {
    746     DevicePath = NULL;
    747   }
    748   return DevicePath;
    749 }
    750 
    751 /**
    752   Allocates a device path for a file and appends it to an existing device path.
    753 
    754   If Device is a valid device handle that contains a device path protocol, then a device path for
    755   the file specified by FileName  is allocated and appended to the device path associated with the
    756   handle Device.  The allocated device path is returned.  If Device is NULL or Device is a handle
    757   that does not support the device path protocol, then a device path containing a single device
    758   path node for the file specified by FileName is allocated and returned.
    759   The memory for the new device path is allocated from EFI boot services memory. It is the responsibility
    760   of the caller to free the memory allocated.
    761  
    762   If FileName is NULL, then ASSERT().
    763   If FileName is not aligned on a 16-bit boundary, then ASSERT().
    764 
    765   @param  Device                     A pointer to a device handle.  This parameter
    766                                      is optional and may be NULL.
    767   @param  FileName                   A pointer to a Null-terminated Unicode string.
    768 
    769   @return The allocated device path.
    770 
    771 **/
    772 EFI_DEVICE_PATH_PROTOCOL *
    773 EFIAPI
    774 FileDevicePath (
    775   IN EFI_HANDLE                      Device,     OPTIONAL
    776   IN CONST CHAR16                    *FileName
    777   )
    778 {
    779   UINT16                    Size;
    780   FILEPATH_DEVICE_PATH      *FilePath;
    781   EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
    782   EFI_DEVICE_PATH_PROTOCOL  *FileDevicePath;
    783 
    784   DevicePath = NULL;
    785 
    786   Size = (UINT16) StrSize (FileName);
    787  
    788   FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH);
    789   if (FileDevicePath != NULL) {
    790     FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
    791     FilePath->Header.Type    = MEDIA_DEVICE_PATH;
    792     FilePath->Header.SubType = MEDIA_FILEPATH_DP;
    793     CopyMem (&FilePath->PathName, FileName, Size);
    794     SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);
    795     SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));
    796 
    797     if (Device != NULL) {
    798       DevicePath = DevicePathFromHandle (Device);
    799     }
    800 
    801     DevicePath = AppendDevicePath (DevicePath, FileDevicePath);
    802     FreePool (FileDevicePath);
    803   }
    804 
    805   return DevicePath;
    806 }
    807 
     266  return UefiDevicePathLibIsDevicePathMultiInstance (DevicePath);
     267}
     268
     269/**
     270  Converts a device node to its string representation.
     271
     272  @param DeviceNode        A Pointer to the device node to be converted.
     273  @param DisplayOnly       If DisplayOnly is TRUE, then the shorter text representation
     274                           of the display node is used, where applicable. If DisplayOnly
     275                           is FALSE, then the longer text representation of the display node
     276                           is used.
     277  @param AllowShortcuts    If AllowShortcuts is TRUE, then the shortcut forms of text
     278                           representation for a device node can be used, where applicable.
     279
     280  @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
     281          is NULL or there was insufficient memory.
     282
     283**/
     284CHAR16 *
     285EFIAPI
     286ConvertDeviceNodeToText (
     287  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DeviceNode,
     288  IN BOOLEAN                         DisplayOnly,
     289  IN BOOLEAN                         AllowShortcuts
     290  )
     291{
     292  return UefiDevicePathLibConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts);
     293}
     294
     295/**
     296  Converts a device path to its text representation.
     297
     298  @param DevicePath      A Pointer to the device to be converted.
     299  @param DisplayOnly     If DisplayOnly is TRUE, then the shorter text representation
     300                         of the display node is used, where applicable. If DisplayOnly
     301                         is FALSE, then the longer text representation of the display node
     302                         is used.
     303  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of text
     304                         representation for a device node can be used, where applicable.
     305
     306  @return A pointer to the allocated text representation of the device path or
     307          NULL if DeviceNode is NULL or there was insufficient memory.
     308
     309**/
     310CHAR16 *
     311EFIAPI
     312ConvertDevicePathToText (
     313  IN CONST EFI_DEVICE_PATH_PROTOCOL   *DevicePath,
     314  IN BOOLEAN                          DisplayOnly,
     315  IN BOOLEAN                          AllowShortcuts
     316  )
     317{
     318  return UefiDevicePathLibConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts);
     319}
     320
     321/**
     322  Convert text to the binary representation of a device node.
     323
     324  @param TextDeviceNode  TextDeviceNode points to the text representation of a device
     325                         node. Conversion starts with the first character and continues
     326                         until the first non-device node character.
     327
     328  @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was
     329          insufficient memory or text unsupported.
     330
     331**/
     332EFI_DEVICE_PATH_PROTOCOL *
     333EFIAPI
     334ConvertTextToDeviceNode (
     335  IN CONST CHAR16 *TextDeviceNode
     336  )
     337{
     338  return UefiDevicePathLibConvertTextToDeviceNode (TextDeviceNode);
     339}
     340
     341/**
     342  Convert text to the binary representation of a device path.
     343
     344
     345  @param TextDevicePath  TextDevicePath points to the text representation of a device
     346                         path. Conversion starts with the first character and continues
     347                         until the first non-device node character.
     348
     349  @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or
     350          there was insufficient memory.
     351
     352**/
     353EFI_DEVICE_PATH_PROTOCOL *
     354EFIAPI
     355ConvertTextToDevicePath (
     356  IN CONST CHAR16 *TextDevicePath
     357  )
     358{
     359  return UefiDevicePathLibConvertTextToDevicePath (TextDevicePath);
     360}
  • trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf

    r48674 r58459  
    44# Device Path Library that layers on top of the Memory Allocation Library.
    55#
    6 # Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
     6# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
    77#
    88#  This program and the accompanying materials
     
    1919  INF_VERSION                    = 0x00010005
    2020  BASE_NAME                      = UefiDevicePathLib
     21  MODULE_UNI_FILE                = UefiDevicePathLib.uni
    2122  FILE_GUID                      = 91c1677a-e57f-4191-8b8e-eb7711a716e0
    2223  MODULE_TYPE                    = UEFI_DRIVER
     
    3031
    3132[Sources]
     33  DevicePathUtilities.c
     34  DevicePathToText.c
     35  DevicePathFromText.c
    3236  UefiDevicePathLib.c
    33 
     37  UefiDevicePathLib.h
    3438
    3539[Packages]
     
    3943[LibraryClasses]
    4044  BaseLib
    41   UefiBootServicesTableLib
    4245  MemoryAllocationLib
    4346  DebugLib
    4447  BaseMemoryLib
     48  PcdLib
     49  PrintLib
    4550
     51[Guids]
     52  ## SOMETIMES_CONSUMES  ## GUID
     53  gEfiVTUTF8Guid
     54  ## SOMETIMES_CONSUMES  ## GUID
     55  gEfiVT100Guid
     56  ## SOMETIMES_CONSUMES  ## GUID
     57  gEfiVT100PlusGuid
     58  ## SOMETIMES_CONSUMES  ## GUID
     59  gEfiPcAnsiGuid
     60  ## SOMETIMES_CONSUMES  ## GUID
     61  gEfiUartDevicePathGuid
     62  ## SOMETIMES_CONSUMES  ## GUID
     63  gEfiSasDevicePathGuid
    4664
    4765[Protocols]
    48   gEfiDevicePathProtocolGuid                    ## CONSUMES
     66  gEfiDevicePathProtocolGuid                    ## SOMETIMES_CONSUMES
     67  gEfiDebugPortProtocolGuid                     ## UNDEFINED
    4968
     69[Pcd]
     70  gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount    ## SOMETIMES_CONSUMES
     71
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette