当前位置: 首页>>代码示例>>C++>>正文


C++ NextDevicePathNode函数代码示例

本文整理汇总了C++中NextDevicePathNode函数的典型用法代码示例。如果您正苦于以下问题:C++ NextDevicePathNode函数的具体用法?C++ NextDevicePathNode怎么用?C++ NextDevicePathNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NextDevicePathNode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DevicePathIsChildDevice

BOOLEAN
DevicePathIsChildDevice (
  IN  EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
  IN  EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath
  )
{
  if (ParentDevicePath == NULL || ParentDevicePath == NULL) {
    return FALSE;
  }

  while (!(IsDevicePathEnd (ParentDevicePath) || IsDevicePathEnd (ChildDevicePath))) {
    if (_DevPathCompareDefault (ParentDevicePath, ChildDevicePath) != 0) {
      return FALSE;
    }

    ParentDevicePath  = (EFI_DEVICE_PATH_PROTOCOL *) NextDevicePathNode (ParentDevicePath);
    ChildDevicePath   = (EFI_DEVICE_PATH_PROTOCOL *) NextDevicePathNode (ChildDevicePath);
  }

  if (IsDevicePathEnd (ParentDevicePath)) {
    return TRUE;
  }

  return FALSE;
}
开发者ID:DYX884877791,项目名称:edk-Shell,代码行数:25,代码来源:ConsistMapping.c

示例2: JudgeHandleIsPCIDevice

EFI_STATUS
JudgeHandleIsPCIDevice(
    EFI_HANDLE            Handle,
    UINT8                 Device,
    UINT8                 Funs
)
{
    EFI_STATUS  Status;
    EFI_DEVICE_PATH   *DPath;
    EFI_DEVICE_PATH   *DevicePath;

    Status = gBS->HandleProtocol (
                 Handle,
                 &gEfiDevicePathProtocolGuid,
                 (VOID **) &DPath
             );
    if(!EFI_ERROR(Status)) {
        DevicePath = DPath;
        while(!IsDevicePathEnd(DPath)) {
            if((DPath->Type == HARDWARE_DEVICE_PATH) && (DPath->SubType == HW_PCI_DP)) {
                PCI_DEVICE_PATH   *PCIPath;

                PCIPath = (PCI_DEVICE_PATH*) DPath;
                DPath = NextDevicePathNode(DPath);
                if(IsDevicePathEnd(DPath) && (PCIPath->Device == Device) && (PCIPath->Function == Funs)) {
                    return EFI_SUCCESS;
                }
            } else {
                DPath = NextDevicePathNode(DPath);
            }
        }
    }
    return EFI_UNSUPPORTED;
}
开发者ID:shivamurthy,项目名称:hikey-edk2,代码行数:34,代码来源:IgdOpRegion.c

示例3: EfiInitpGetDeviceNode

/*++
 * @name EfiInitpGetDeviceNode
 *
 *     The EfiInitpGetDeviceNode routine 
 *
 * @param  DevicePath
 *         UEFI Image Handle for the current loaded application.
 *
 * @return None
 *
 *--*/
EFI_DEVICE_PATH_PROTOCOL*
EfiInitpGetDeviceNode (
    _In_ EFI_DEVICE_PATH_PROTOCOL *DevicePath
    )
{
    EFI_DEVICE_PATH_PROTOCOL* NextPath;

    /* Check if we hit the end terminator */
    if (IsDevicePathEndType(DevicePath))
    {
        return DevicePath;
    }

    /* Loop each device path, until we get to the end or to a file path device node */
    for ((NextPath = NextDevicePathNode(DevicePath));
         !(IsDevicePathEndType(NextPath)) && ((NextPath->Type != MEDIA_DEVICE_PATH) ||
                                              (NextPath->SubType != MEDIA_FILEPATH_DP));
         (NextPath = NextDevicePathNode(NextPath)))
    {
        /* Keep iterating down */
        DevicePath = NextPath;
    }

    /* Return the path found */
    return DevicePath;
}
开发者ID:CSRedRat,项目名称:reactos,代码行数:37,代码来源:efiemu.c

示例4: UnpackDevicePath

EFI_DEVICE_PATH *
UnpackDevicePath (
    IN EFI_DEVICE_PATH  *DevPath
    )
{
    EFI_DEVICE_PATH     *Src, *Dest, *NewPath;
    UINTN               Size;
    
    //
    // Walk device path and round sizes to valid boundries
    //    

    Src = DevPath;
    Size = 0;
    for (; ;) {
        Size += DevicePathNodeLength(Src);
        Size += ALIGN_SIZE(Size);

        if (IsDevicePathEnd(Src)) {
            break;
        }

        Src = NextDevicePathNode(Src);
    }


    //
    // Allocate space for the unpacked path
    //

    NewPath = AllocateZeroPool (Size);
    if (NewPath) {

        ASSERT (((UINTN)NewPath) % MIN_ALIGNMENT_SIZE == 0);

        //
        // Copy each node
        //

        Src = DevPath;
        Dest = NewPath;
        for (; ;) {
            Size = DevicePathNodeLength(Src);
            CopyMem (Dest, Src, Size);
            Size += ALIGN_SIZE(Size);
            SetDevicePathNodeLength (Dest, Size);
            Dest->Type |= EFI_DP_TYPE_UNPACKED;
            Dest = (EFI_DEVICE_PATH *) (((UINT8 *) Dest) + Size);

            if (IsDevicePathEnd(Src)) {
                break;
            }

            Src = NextDevicePathNode(Src);
        }
    }

    return NewPath;
}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:59,代码来源:dpath.c

示例5: ChangeVariableDevicePath

/**
  Update the device path that describing a terminal device
  based on the new BaudRate, Data Bits, parity and Stop Bits
  set.

  @param DevicePath terminal device's path

**/
VOID
ChangeVariableDevicePath (
  IN OUT EFI_DEVICE_PATH_PROTOCOL  *DevicePath
  )
{
  EFI_DEVICE_PATH_PROTOCOL  *Node;
  ACPI_HID_DEVICE_PATH      *Acpi;
  UART_DEVICE_PATH          *Uart;
  UINTN                     Com;
  BM_TERMINAL_CONTEXT       *NewTerminalContext;
  BM_MENU_ENTRY             *NewMenuEntry;

  Node  = DevicePath;
  Node  = NextDevicePathNode (Node);
  Com   = 0;
  while (!IsDevicePathEnd (Node)) {
    Acpi = (ACPI_HID_DEVICE_PATH *) Node;
    if (IsIsaSerialNode (Acpi)) {
      CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
    }

    if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
      NewMenuEntry = BOpt_GetMenuEntry (
                      &TerminalMenu,
                      Com
                      );
      ASSERT (NewMenuEntry != NULL);
      NewTerminalContext  = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
      Uart                = (UART_DEVICE_PATH *) Node;
      CopyMem (
        &Uart->BaudRate,
        &NewTerminalContext->BaudRate,
        sizeof (UINT64)
        );

      CopyMem (
        &Uart->DataBits,
        &NewTerminalContext->DataBits,
        sizeof (UINT8)
        );

      CopyMem (
        &Uart->Parity,
        &NewTerminalContext->Parity,
        sizeof (UINT8)
        );

      CopyMem (
        &Uart->StopBits,
        &NewTerminalContext->StopBits,
        sizeof (UINT8)
        );
    }

    Node = NextDevicePathNode (Node);
  }
}
开发者ID:B-Rich,项目名称:edk2,代码行数:65,代码来源:ConsoleOption.c

示例6: AppendDevicePathInstance

EFI_DEVICE_PATH_PROTOCOL *
AppendDevicePathInstance (
  IN EFI_DEVICE_PATH_PROTOCOL  *Src,
  IN EFI_DEVICE_PATH_PROTOCOL  *Instance
  )
/*++

Routine Description:
  Function is used to add a device path instance to a device path.

Arguments:
  Src          - A pointer to a device path data structure

  Instance     - A pointer to a device path instance.

Returns:

  This function returns a pointer to the new device path.
  If there is not enough temporary pool memory available to complete this function,
  then NULL is returned. It is up to the caller to free the memory used by Src and
  Instance if they are no longer needed.

--*/
{
  UINT8                     *Ptr;
  EFI_DEVICE_PATH_PROTOCOL  *DevPath;
  UINTN                     SrcSize;
  UINTN                     InstanceSize;

  if (Src == NULL) {
    return DuplicateDevicePath (Instance);
  }
  SrcSize = DevicePathSize(Src);
  InstanceSize = DevicePathSize(Instance);
  Ptr = AllocatePool (SrcSize + InstanceSize);
  DevPath = (EFI_DEVICE_PATH_PROTOCOL *)Ptr;
  ASSERT(DevPath);

  CopyMem (Ptr, Src, SrcSize);
//    FreePool (Src);

  while (!IsDevicePathEnd(DevPath)) {
    DevPath = NextDevicePathNode(DevPath);
  }
  //
  // Convert the End to an End Instance, since we are
  //  appending another instacne after this one its a good
  //  idea.
  //
  DevPath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;

  DevPath = NextDevicePathNode(DevPath);
  CopyMem (DevPath, Instance, InstanceSize);
  return (EFI_DEVICE_PATH_PROTOCOL *)Ptr;
}
开发者ID:jljusten,项目名称:efi-sct,代码行数:55,代码来源:dpath.c

示例7: GetNextDevicePathInstance

EFIAPI
GetNextDevicePathInstance (
  IN OUT EFI_DEVICE_PATH_PROTOCOL    **DevicePath,
  OUT UINTN                          *Size
  )
{
  EFI_DEVICE_PATH_PROTOCOL  *DevPath;
  EFI_DEVICE_PATH_PROTOCOL  *ReturnValue;
  UINT8                     Temp;

  ASSERT (Size != NULL);

  if (DevicePath == NULL || *DevicePath == NULL) {
    *Size = 0;
    return NULL;
  }

  if (!IsDevicePathValid (*DevicePath, 0)) {
    return NULL;
  }

  //
  // Find the end of the device path instance
  //
  DevPath = *DevicePath;
  while (!IsDevicePathEndType (DevPath)) {
    DevPath = NextDevicePathNode (DevPath);
  }

  //
  // Compute the size of the device path instance
  //
  *Size = ((UINTN) DevPath - (UINTN) (*DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
 
  //
  // Make a copy and return the device path instance
  //
  Temp              = DevPath->SubType;
  DevPath->SubType  = END_ENTIRE_DEVICE_PATH_SUBTYPE;
  ReturnValue       = DuplicateDevicePath (*DevicePath);
  DevPath->SubType  = Temp;

  //
  // If DevPath is the end of an entire device path, then another instance
  // does not follow, so *DevicePath is set to NULL.
  //
  if (DevicePathSubType (DevPath) == END_ENTIRE_DEVICE_PATH_SUBTYPE) {
    *DevicePath = NULL;
  } else {
    *DevicePath = NextDevicePathNode (DevPath);
  }

  return ReturnValue;
}
开发者ID:Zokormazo,项目名称:refind,代码行数:54,代码来源:gnuefi-helper.c

示例8: GetLastDevicePath

// Return the device path node right before the end node
static EFI_DEVICE_PATH* GetLastDevicePath(CONST EFI_DEVICE_PATH* dp)
{
    EFI_DEVICE_PATH *next, *p;

    if (IsDevicePathEnd(dp))
        return NULL;

    for (p = (EFI_DEVICE_PATH *) dp, next = NextDevicePathNode(p);
        !IsDevicePathEnd(next);
        p = next, next = NextDevicePathNode(next));

    return p;
}
开发者ID:linnaea,项目名称:uefi-ntfs-multiboot,代码行数:14,代码来源:boot.c

示例9: disk_get_part_uuid

EFI_STATUS disk_get_part_uuid(EFI_HANDLE *handle, CHAR16 uuid[37]) {
        EFI_DEVICE_PATH *device_path;
        EFI_STATUS r = EFI_NOT_FOUND;

        /* export the device path this image is started from */
        device_path = DevicePathFromHandle(handle);
        if (device_path) {
                EFI_DEVICE_PATH *path, *paths;

                paths = UnpackDevicePath(device_path);
                for (path = paths; !IsDevicePathEnd(path); path = NextDevicePathNode(path)) {
                        HARDDRIVE_DEVICE_PATH *drive;

                        if (DevicePathType(path) != MEDIA_DEVICE_PATH)
                                continue;
                        if (DevicePathSubType(path) != MEDIA_HARDDRIVE_DP)
                                continue;
                        drive = (HARDDRIVE_DEVICE_PATH *)path;
                        if (drive->SignatureType != SIGNATURE_TYPE_GUID)
                                continue;

                        GuidToString(uuid, (EFI_GUID *)&drive->Signature);
                        r = EFI_SUCCESS;
                        break;
                }
                FreePool(paths);
        }

        return r;
}
开发者ID:ajeddeloh,项目名称:systemd,代码行数:30,代码来源:disk.c

示例10: DevPathAppendFilePath

//
// append file path
//
EFI_DEVICE_PATH_PROTOCOL* DevPathAppendFilePath(EFI_DEVICE_PATH_PROTOCOL* devicePath, CHAR16 CONST* fileName)
{
	if(!devicePath || !fileName || !fileName[0])
		return nullptr;

	UINTN devicePathSize													= DevPathGetSize(devicePath);
	if(!devicePathSize)
		return nullptr;

	UINTN size																= (wcslen(fileName) + 1) * sizeof(CHAR16);
	EFI_DEVICE_PATH_PROTOCOL* filePath										= static_cast<EFI_DEVICE_PATH_PROTOCOL*>(MmAllocatePool(size + devicePathSize + SIZE_OF_FILEPATH_DEVICE_PATH));
	if(!filePath)
		return nullptr;

	devicePathSize															-= END_DEVICE_PATH_LENGTH;
	memcpy(filePath, devicePath, devicePathSize);
	FILEPATH_DEVICE_PATH* filePathNode										= Add2Ptr(filePath, devicePathSize, FILEPATH_DEVICE_PATH*);
	filePathNode->Header.Type												= MEDIA_DEVICE_PATH;
	filePathNode->Header.SubType											= MEDIA_FILEPATH_DP;
	SetDevicePathNodeLength(&filePathNode->Header, size + SIZE_OF_FILEPATH_DEVICE_PATH);
	memcpy(filePathNode->PathName, fileName, size);
	EFI_DEVICE_PATH_PROTOCOL* endOfPath										= NextDevicePathNode(&filePathNode->Header);
	SetDevicePathEndNode(endOfPath);
	return filePath;
}
开发者ID:Jeremy-D-Miller,项目名称:macosxbootloader,代码行数:28,代码来源:DevicePath.cpp

示例11: DevicePathSize

UINTN
DevicePathSize (
    IN EFI_DEVICE_PATH_PROTOCOL  *DevPath
    )
/*++

Routine Description:
  Function returns the size of a device path in bytes.

Arguments:
  DevPath        - A pointer to a device path data structure

Returns:

  Size is returned.

--*/
{
  EFI_DEVICE_PATH_PROTOCOL     *Start;

  //
  // Search for the end of the device path structure
  //

  Start = DevPath;
  while (!IsDevicePathEnd(DevPath)) {
    DevPath = NextDevicePathNode(DevPath);
  }

  //
  // Compute the size
  //
  return ((UINTN) DevPath - (UINTN) Start) + sizeof(EFI_DEVICE_PATH_PROTOCOL);
}
开发者ID:jljusten,项目名称:efi-sct,代码行数:34,代码来源:dpath.c

示例12: FileDevicePath

EFI_DEVICE_PATH_PROTOCOL *
FileDevicePath (
  IN EFI_HANDLE       Device  OPTIONAL,
  IN CHAR16           *FileName
  )
/*++

Routine Description:
  Function allocates a device path for a file and appends it to an existing device path.

Arguments:
  Device         - A pointer to a device handle.

  FileName       - A pointer to a Null-terminated Unicode string.

Returns:

  If Device is not a valid device handle, then a device path for the file specified
  by FileName is allocated and returned.

  Results are allocated from pool.  The caller must FreePool the resulting device path
  structure

--*/
{
  UINTN                       Size;
  FILEPATH_DEVICE_PATH        *FilePath;
  EFI_DEVICE_PATH_PROTOCOL    *Eop, *DevicePath;

  Size = StrSize(FileName);
  FilePath = AllocateZeroPool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + sizeof(EFI_DEVICE_PATH_PROTOCOL));
  DevicePath = NULL;

  if (FilePath) {

    //
    // Build a file path
    //
    FilePath->Header.Type = MEDIA_DEVICE_PATH;
    FilePath->Header.SubType = MEDIA_FILEPATH_DP;
    SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);
    CopyMem (FilePath->PathName, FileName, Size);
    Eop = NextDevicePathNode(&FilePath->Header);
    SetDevicePathEndNode(Eop);

    //
    // Append file path to device's device path
    //
    DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) FilePath;
    if (Device) {
      DevicePath = AppendDevicePath (
                        DevicePathFromHandle(Device),
                        DevicePath
                        );
      FreePool(FilePath);
    }
  }

  return DevicePath;
}
开发者ID:jljusten,项目名称:efi-sct,代码行数:60,代码来源:dpath.c

示例13: GetFilePathList

/* Currently this function is useless */
void GetFilePathList(BDS_LOAD_OPTION* BdsLoadOption, char* buffer, int descSize)
{
    if (BdsLoadOption->FilePathListLength <= 0)
        return;

    EFI_DEVICE_PATH_PROTOCOL* DevicePathNode = BdsLoadOption->FilePathList;

    // File path fields
    DevicePathNode = BdsLoadOption->FilePathList;
    if (DevicePathType(DevicePathNode) != MEDIA_DEVICE_PATH_TYPE)
        return;

    while (!IsDevicePathEndType(DevicePathNode))
    {
        switch (DevicePathSubType(DevicePathNode))
        {
        case HARDDRIVE_SUBTYPE:
            printf("HDD");
            break;

        case FILE_PATH_SUBTYPE:
            printf("FILE");
            break;
        }


        DevicePathNode = NextDevicePathNode(DevicePathNode);
    }
}
开发者ID:ExtremeGTX,项目名称:Win32-UEFILibrary,代码行数:30,代码来源:efiparser.cpp

示例14: BmGetDevicePathSizeEx

/**
  Returns the size of a device path in bytes.

  This function returns the size, in bytes, of the device path data structure 
  specified by DevicePath including the end of device path node. If DevicePath 
  is NULL, then 0 is returned. If the length of the device path is bigger than
  MaxSize, also return 0 to indicate this is an invalidate device path.

  @param  DevicePath         A pointer to a device path data structure.
  @param  MaxSize            Max valid device path size. If big than this size, 
                             return error.
  
  @retval 0                  An invalid device path.
  @retval Others             The size of a device path in bytes.

**/
UINTN
BmGetDevicePathSizeEx (
  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath,
  IN UINTN                           MaxSize
  )
{
  UINTN  Size;
  UINTN  NodeSize;

  if (DevicePath == NULL) {
    return 0;
  }

  //
  // Search for the end of the device path structure
  //
  Size = 0;
  while (!IsDevicePathEnd (DevicePath)) {
    NodeSize = DevicePathNodeLength (DevicePath);
    if (NodeSize == 0) {
      return 0;
    }
    Size += NodeSize;
    if (Size > MaxSize) {
      return 0;
    }
    DevicePath = NextDevicePathNode (DevicePath);
  }
  Size += DevicePathNodeLength (DevicePath);
  if (Size > MaxSize) {
    return 0;
  }

  return Size;
}
开发者ID:Acidburn0zzz,项目名称:edk2-MdeModulePkg,代码行数:51,代码来源:BmLoadOption.c

示例15: AppendDevicePathNode

EFI_DEVICE_PATH *
AppendDevicePathNode (
    IN EFI_DEVICE_PATH  *Src1,
    IN EFI_DEVICE_PATH  *Src2
    )
// Src1 may have multiple "instances" and each instance is appended
// Src2 is a signal device path node (without a terminator) that is
// appended to each instance is Src1.
{
    EFI_DEVICE_PATH     *Temp, *Eop;
    UINTN               Length;

    //
    // Build a Src2 that has a terminator on it
    //

    Length = DevicePathNodeLength(Src2);
    Temp = AllocatePool (Length + sizeof(EFI_DEVICE_PATH));
    if (!Temp) {
        return NULL;
    }

    CopyMem (Temp, Src2, Length);
    Eop = NextDevicePathNode(Temp); 
    SetDevicePathEndNode(Eop);

    //
    // Append device paths
    //

    Src1 = AppendDevicePath (Src1, Temp);
    FreePool (Temp);
    return Src1;
}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:34,代码来源:dpath.c


注:本文中的NextDevicePathNode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。