您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AppendDevicePathNode函数代码示例

51自学网 2021-06-01 19:47:17
  C++
这篇教程C++ AppendDevicePathNode函数代码示例写得很实用,希望能帮到您。

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

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

示例1: SetBiosInitBlockIoDevicePath

/**  Build device path for device.  @param  BaseDevicePath         Base device path.  @param  Drive                  Legacy drive.  @param  DevicePath             Device path for output.**/VOIDSetBiosInitBlockIoDevicePath (  IN  EFI_DEVICE_PATH_PROTOCOL  *BaseDevicePath,  IN  BIOS_LEGACY_DRIVE         *Drive,  OUT EFI_DEVICE_PATH_PROTOCOL  **DevicePath  ){  EFI_STATUS                  Status;  BLOCKIO_VENDOR_DEVICE_PATH  VendorNode;    Status = EFI_UNSUPPORTED;    //  // BugBug: Check for memory leaks!  //  if (Drive->EddVersion == EDD_VERSION_30) {    //    // EDD 3.0 case.    //    Status = BuildEdd30DevicePath (BaseDevicePath, Drive, DevicePath);  }    if (EFI_ERROR (Status)) {    //    // EDD 1.1 device case or it is unrecognized EDD 3.0 device    //    ZeroMem (&VendorNode, sizeof (VendorNode));    VendorNode.DevicePath.Header.Type     = HARDWARE_DEVICE_PATH;    VendorNode.DevicePath.Header.SubType  = HW_VENDOR_DP;    SetDevicePathNodeLength (&VendorNode.DevicePath.Header, sizeof (VendorNode));    CopyMem (&VendorNode.DevicePath.Guid, &gBlockIoVendorGuid, sizeof (EFI_GUID));    VendorNode.LegacyDriveLetter  = Drive->Number;    *DevicePath                   = AppendDevicePathNode (BaseDevicePath, &VendorNode.DevicePath.Header);  }}
开发者ID:Clover-EFI-Bootloader,项目名称:clover,代码行数:43,


示例2: CreatePciDevicePath

EFI_DEVICE_PATH_PROTOCOL *CreatePciDevicePath (  IN  EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,  IN  PCI_IO_DEVICE            *PciIoDevice  )/*++Routine Description:Arguments:Returns:  None--*/{  PCI_DEVICE_PATH PciNode;  //  // Create PCI device path  //  PciNode.Header.Type     = HARDWARE_DEVICE_PATH;  PciNode.Header.SubType  = HW_PCI_DP;  SetDevicePathNodeLength (&PciNode.Header, sizeof (PciNode));  PciNode.Device          = PciIoDevice->DeviceNumber;  PciNode.Function        = PciIoDevice->FunctionNumber;  PciIoDevice->DevicePath = AppendDevicePathNode (ParentDevicePath, &PciNode.Header);  return PciIoDevice->DevicePath;}
开发者ID:Clover-EFI-Bootloader,项目名称:clover,代码行数:33,


示例3: SasV1ExtScsiPassThruBuildDevicePath

STATICEFI_STATUSEFIAPISasV1ExtScsiPassThruBuildDevicePath (  IN     EFI_EXT_SCSI_PASS_THRU_PROTOCOL    *This,  IN     UINT8                              *Target,  IN     UINT64                             Lun,  IN OUT EFI_DEVICE_PATH_PROTOCOL           **DevicePath  ){  EFI_DEVICE_PATH_PROTOCOL *NewDevicePathNode;  EFI_DEV_PATH EndNode;  EFI_DEV_PATH Node;  ZeroMem (&Node, sizeof (Node));  Node.DevPath.Type = HARDWARE_DEVICE_PATH;  Node.DevPath.SubType = HW_PCI_DP;  SetDevicePathNodeLength (&Node.DevPath, sizeof (PCI_DEVICE_PATH));  SetDevicePathEndNode (&EndNode.DevPath);  NewDevicePathNode = AppendDevicePathNode (&EndNode.DevPath, &Node.DevPath);  *DevicePath = NewDevicePathNode;  return EFI_SUCCESS;}
开发者ID:joyxu,项目名称:uefi,代码行数:25,


示例4: AppendDeviceNodeProtocolInterface

EFIAPIAppendDeviceNodeProtocolInterface (  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode  ){  return AppendDevicePathNode (DevicePath, DevicePathNode);}
开发者ID:etiago,项目名称:vbox,代码行数:8,


示例5: GetHIDevicePath

EFIAPIGetHIDevicePath (  IN EFI_DEVICE_PATH_PROTOCOL        *DevicePath  ){  UINTN                     NonHIDevicePathNodeCount;  UINTN                     Index;  EFI_DEV_PATH              Node;  EFI_DEVICE_PATH_PROTOCOL  *HIDevicePath;  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;  ASSERT(DevicePath != NULL);  NonHIDevicePathNodeCount  = 0;  HIDevicePath              = AllocateZeroPool (sizeof (EFI_DEVICE_PATH_PROTOCOL));  SetDevicePathEndNode (HIDevicePath);  Node.DevPath.Type       = END_DEVICE_PATH_TYPE;  Node.DevPath.SubType    = END_INSTANCE_DEVICE_PATH_SUBTYPE;  Node.DevPath.Length[0]  = (UINT8)sizeof (EFI_DEVICE_PATH_PROTOCOL);  Node.DevPath.Length[1]  = 0;  while (!IsDevicePathEnd (DevicePath)) {    if (IsHIDevicePathNode (DevicePath)) {      for (Index = 0; Index < NonHIDevicePathNodeCount; Index++) {        TempDevicePath = AppendDevicePathNode (HIDevicePath, &Node.DevPath);        FreePool (HIDevicePath);        HIDevicePath = TempDevicePath;      }      TempDevicePath = AppendDevicePathNode (HIDevicePath, DevicePath);      FreePool (HIDevicePath);      HIDevicePath = TempDevicePath;    } else {      NonHIDevicePathNodeCount++;    }    //    // Next device path node    //    DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) NextDevicePathNode (DevicePath);  }  return HIDevicePath;}
开发者ID:B-Rich,项目名称:edk2,代码行数:45,


示例6: PreparePciSerialDevicePath

EFI_STATUSPreparePciSerialDevicePath (  IN EFI_HANDLE                DeviceHandle  )/*++Routine Description:  Add PCI Serial to ConOut, ConIn, ErrOut.  PCI Serial: 07 00 02Arguments:  DeviceHandle            - Handle of PCIIO protocol.Returns:  EFI_SUCCESS             - PCI Serial is added to ConOut, ConIn, and ErrOut.  EFI_STATUS              - No PCI Serial device is added.--*/{  EFI_STATUS                Status;  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;  DevicePath = NULL;  Status = gBS->HandleProtocol (                  DeviceHandle,                  &gEfiDevicePathProtocolGuid,                  (VOID*)&DevicePath                  );  if (EFI_ERROR (Status)) {    return Status;  }  DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);  DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);  BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);  BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);  BdsLibUpdateConsoleVariable (VarErrorOut, DevicePath, NULL);  return EFI_SUCCESS;}
开发者ID:jeppeter,项目名称:vbox,代码行数:44,


示例7: BdsLoadOptionFileSystemUpdateDevicePath

EFI_STATUSBdsLoadOptionFileSystemUpdateDevicePath (  IN EFI_DEVICE_PATH            *OldDevicePath,  IN CHAR16*                    FileName,  OUT EFI_DEVICE_PATH_PROTOCOL  **NewDevicePath  ){  EFI_STATUS  Status;  CHAR16      BootFilePath[BOOT_DEVICE_FILEPATH_MAX];  UINTN       BootFilePathSize;  FILEPATH_DEVICE_PATH* EndingDevicePath;  FILEPATH_DEVICE_PATH* FilePathDevicePath;  EFI_DEVICE_PATH*  DevicePath;  DevicePath = DuplicateDevicePath (OldDevicePath);  EndingDevicePath = (FILEPATH_DEVICE_PATH*)GetLastDevicePathNode (DevicePath);  Print(L"File path of the %s: ", FileName);  StrnCpy (BootFilePath, EndingDevicePath->PathName, BOOT_DEVICE_FILEPATH_MAX);  Status = EditHIInputStr (BootFilePath, BOOT_DEVICE_FILEPATH_MAX);  if (EFI_ERROR(Status)) {    return Status;  }  BootFilePathSize = StrSize(BootFilePath);  if (BootFilePathSize == 2) {    *NewDevicePath = NULL;    return EFI_NOT_FOUND;  }  // Create the FilePath Device Path node  FilePathDevicePath = (FILEPATH_DEVICE_PATH*)AllocatePool(SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);  if (NULL == FilePathDevicePath)  {    return EFI_INVALID_PARAMETER;  }  FilePathDevicePath->Header.Type = MEDIA_DEVICE_PATH;  FilePathDevicePath->Header.SubType = MEDIA_FILEPATH_DP;  SetDevicePathNodeLength (FilePathDevicePath, SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);  CopyMem (FilePathDevicePath->PathName, BootFilePath, BootFilePathSize);  // Generate the new Device Path by replacing the last node by the updated node  SetDevicePathEndNode (EndingDevicePath);  *NewDevicePath = AppendDevicePathNode (DevicePath, (CONST EFI_DEVICE_PATH_PROTOCOL *)FilePathDevicePath);  FreePool(DevicePath);  return EFI_SUCCESS;}
开发者ID:hzhuang1,项目名称:uefi,代码行数:49,


示例8: FvFileDevicePath

EFI_DEVICE_PATH *FvFileDevicePath (  IN  EFI_HANDLE   FvHandle,  IN  EFI_GUID     *NameGuid  ){  EFI_DEVICE_PATH_PROTOCOL          *DevicePath;  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH NewNode;  DevicePath = DevicePathFromHandle (FvHandle);  EfiInitializeFwVolDevicepathNode (&NewNode, NameGuid);  return AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&NewNode);}
开发者ID:FishYu1222,项目名称:edk2,代码行数:15,


示例9: WinNtBusCreateDevicePath

EFI_DEVICE_PATH_PROTOCOL *WinNtBusCreateDevicePath (  IN  EFI_DEVICE_PATH_PROTOCOL  *RootDevicePath,  IN  EFI_GUID                  *Guid,  IN  UINT16                    InstanceNumber  )/*++Routine Description:  Create a device path node using Guid and InstanceNumber and append it to  the passed in RootDevicePathArguments:  RootDevicePath - Root of the device path to return.  Guid           - GUID to use in vendor device path node.  InstanceNumber - Instance number to use in the vendor device path. This                    argument is needed to make sure each device path is unique.Returns:  EFI_DEVICE_PATH_PROTOCOL--*/{  WIN_NT_VENDOR_DEVICE_PATH_NODE  DevicePath;  DevicePath.VendorDevicePath.Header.Type     = HARDWARE_DEVICE_PATH;  DevicePath.VendorDevicePath.Header.SubType  = HW_VENDOR_DP;  SetDevicePathNodeLength (&DevicePath.VendorDevicePath.Header, sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE));  //  // The GUID defines the Class  //  CopyMem (&DevicePath.VendorDevicePath.Guid, Guid, sizeof (EFI_GUID));  //  // Add an instance number so we can make sure there are no Device Path  // duplication.  //  DevicePath.Instance = InstanceNumber;  return AppendDevicePathNode (          RootDevicePath,          (EFI_DEVICE_PATH_PROTOCOL *) &DevicePath          );}
开发者ID:shijunjing,项目名称:edk2,代码行数:48,


示例10: PlatformRegisterFvBootOption

VOIDPlatformRegisterFvBootOption (  EFI_GUID                         *FileGuid,  CHAR16                           *Description,  UINT32                           Attributes  ){  EFI_STATUS                        Status;  UINTN                             OptionIndex;  EFI_BOOT_MANAGER_LOAD_OPTION      NewOption;  EFI_BOOT_MANAGER_LOAD_OPTION      *BootOptions;  UINTN                             BootOptionCount;  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;  EFI_LOADED_IMAGE_PROTOCOL         *LoadedImage;  EFI_DEVICE_PATH_PROTOCOL          *DevicePath;  Status = gBS->HandleProtocol (gImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);  ASSERT_EFI_ERROR (Status);  EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid);  DevicePath = AppendDevicePathNode (                 DevicePathFromHandle (LoadedImage->DeviceHandle),                 (EFI_DEVICE_PATH_PROTOCOL *) &FileNode                 );  Status = EfiBootManagerInitializeLoadOption (             &NewOption,             LoadOptionNumberUnassigned,             LoadOptionTypeBoot,             Attributes,             Description,             DevicePath,             NULL,             0             );  if (!EFI_ERROR (Status)) {    BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);    OptionIndex = PlatformFindLoadOption (&NewOption, BootOptions, BootOptionCount);    if (OptionIndex == -1) {      Status = EfiBootManagerAddLoadOptionVariable (&NewOption, (UINTN) -1);      ASSERT_EFI_ERROR (Status);    }    EfiBootManagerFreeLoadOption (&NewOption);    EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);  }}
开发者ID:ozbenh,项目名称:edk2,代码行数:48,


示例11: CreatePlatformBootOptionFromGuid

STATICEFI_STATUSCreatePlatformBootOptionFromGuid (  IN     EFI_GUID                        *FileGuid,  IN     CHAR16                          *Description,  IN OUT EFI_BOOT_MANAGER_LOAD_OPTION    *BootOption  ){  EFI_STATUS                             Status;  EFI_DEVICE_PATH                        *DevicePath;  EFI_DEVICE_PATH                        *TempDevicePath;  EFI_LOADED_IMAGE_PROTOCOL              *LoadedImage;  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH      FileNode;  Status = gBS->HandleProtocol (                  gImageHandle,                  &gEfiLoadedImageProtocolGuid,                  (VOID **) &LoadedImage                  );  ASSERT_EFI_ERROR (Status);  EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid);  TempDevicePath = DevicePathFromHandle (LoadedImage->DeviceHandle);  ASSERT (TempDevicePath != NULL);  DevicePath = AppendDevicePathNode (                 TempDevicePath,                 (EFI_DEVICE_PATH_PROTOCOL *) &FileNode                 );  ASSERT (DevicePath != NULL);  Status = EfiBootManagerInitializeLoadOption (             BootOption,             LoadOptionNumberUnassigned,             LoadOptionTypeBoot,             LOAD_OPTION_ACTIVE,             Description,             DevicePath,             NULL,             0             );  FreePool (DevicePath);  return Status;}
开发者ID:mangguo321,项目名称:edk2-platforms,代码行数:41,


示例12: FvFilePath

/**  Generate device path include the input file guid info.  @param  FileGuid     Input file guid for the BootManagerMenuApp.  @retval DevicePath for BootManagerMenuApp.**/EFI_DEVICE_PATH *FvFilePath (  EFI_GUID                     *FileGuid  ){  EFI_STATUS                         Status;  EFI_LOADED_IMAGE_PROTOCOL          *LoadedImage;  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH  FileNode;  EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid);  Status = gBS->HandleProtocol (                  gImageHandle,                  &gEfiLoadedImageProtocolGuid,                  (VOID **) &LoadedImage                  );  ASSERT_EFI_ERROR (Status);  return AppendDevicePathNode (           DevicePathFromHandle (LoadedImage->DeviceHandle),           (EFI_DEVICE_PATH_PROTOCOL *) &FileNode           );}
开发者ID:EvanLloyd,项目名称:tianocore,代码行数:31,


示例13: BdsLoadOptionTftpUpdateDevicePath

/**  Update the parameters of a TFTP boot option  The function asks sequentially to update the IPv4 parameters as well as the boot file path,  providing the previously set value if any.  @param[in]   OldDevicePath  Current complete device path of the Tftp boot option.                              This has to be a valid complete Tftp boot option path.                              By complete, we mean that it is not only the Tftp                              specific end part built by the                              "BdsLoadOptionTftpCreateDevicePath()" function.                              This path is handled as read only.  @param[in]   FileName       Description of the file the path is asked for  @param[out]  NewDevicePath  Pointer to the new complete device path.  @retval  EFI_SUCCESS            Update completed  @retval  EFI_ABORTED            Update aborted by the user  @retval  EFI_OUT_OF_RESOURCES   Fail to perform the update due to lack of resource**/EFI_STATUSBdsLoadOptionTftpUpdateDevicePath (  IN   EFI_DEVICE_PATH            *OldDevicePath,  IN   CHAR16                     *FileName,  OUT  EFI_DEVICE_PATH_PROTOCOL  **NewDevicePath  ){  EFI_STATUS             Status;  EFI_DEVICE_PATH       *DevicePath;  EFI_DEVICE_PATH       *DevicePathNode;  UINT8                 *Ipv4NodePtr;  IPv4_DEVICE_PATH       Ipv4Node;  BOOLEAN                IsDHCP;  EFI_IP_ADDRESS         OldIp;  EFI_IP_ADDRESS         OldSubnetMask;  EFI_IP_ADDRESS         OldGatewayIp;  EFI_IP_ADDRESS         LocalIp;  EFI_IP_ADDRESS         SubnetMask;  EFI_IP_ADDRESS         GatewayIp;  EFI_IP_ADDRESS         RemoteIp;  UINT8                 *FileNodePtr;  CHAR16                 BootFilePath[BOOT_DEVICE_FILEPATH_MAX];  UINTN                  PathSize;  UINTN                  BootFilePathSize;  FILEPATH_DEVICE_PATH  *NewFilePathNode;  Ipv4NodePtr = NULL;  //  // Make a copy of the complete device path that is made of :  // the device path of the device that support the Simple Network protocol  // followed by an IPv4 node (type IPv4_DEVICE_PATH),  // followed by a file path node (type FILEPATH_DEVICE_PATH) and ended up  // by an end node. The IPv6 case is not handled yet.  //  DevicePath = DuplicateDevicePath (OldDevicePath);  if (DevicePath == NULL) {    Status = EFI_OUT_OF_RESOURCES;    goto ErrorExit;  }  //  // Because of the check done by "BdsLoadOptionTftpIsSupported()" prior to the  // call to this function, we know that the device path ends with an IPv4 node  // followed by a file path node and finally an end node. To get the address of  // the last IPv4 node, we loop over the whole device path, noting down the  // address of each encountered IPv4 node.  //  for (DevicePathNode = DevicePath;       !IsDevicePathEnd (DevicePathNode);       DevicePathNode = NextDevicePathNode (DevicePathNode))  {    if (IS_DEVICE_PATH_NODE (DevicePathNode, MESSAGING_DEVICE_PATH, MSG_IPv4_DP)) {      Ipv4NodePtr = (UINT8*)DevicePathNode;    }  }  // Copy for alignment of the IPv4 node data  CopyMem (&Ipv4Node, Ipv4NodePtr, sizeof (IPv4_DEVICE_PATH));  Print (L"Get the IP address from DHCP: ");  Status = GetHIInputBoolean (&IsDHCP);  if (EFI_ERROR (Status)) {    goto ErrorExit;  }  if (!IsDHCP) {    Print (L"Local static IP address: ");    if (Ipv4Node.StaticIpAddress) {      CopyMem (&OldIp.v4, &Ipv4Node.LocalIpAddress, sizeof (EFI_IPv4_ADDRESS));      Status = EditHIInputIP (&OldIp, &LocalIp);    } else {      Status = GetHIInputIP (&LocalIp);    }    if (EFI_ERROR (Status)) {      goto ErrorExit;    }    Print (L"Get the network mask: ");//.........这里部分代码省略.........
开发者ID:hzhuang1,项目名称:uefi,代码行数:101,


示例14: PartitionInstallChildHandle

//.........这里部分代码省略.........    Private->BlockIo2.FlushBlocksEx  = PartitionFlushBlocksEx;   }  Private->Media.IoAlign   = 0;  Private->Media.LogicalPartition = TRUE;  Private->Media.LastBlock = DivU64x32 (                               MultU64x32 (                                 End - Start + 1,                                 ParentBlockIo->Media->BlockSize                                 ),                                BlockSize                               ) - 1;  Private->Media.BlockSize = (UINT32) BlockSize;  Private->Media2.IoAlign   = 0;  Private->Media2.LogicalPartition = TRUE;  Private->Media2.LastBlock = Private->Media.LastBlock;  Private->Media2.BlockSize = (UINT32) BlockSize;  //  // Per UEFI Spec, LowestAlignedLba, LogicalBlocksPerPhysicalBlock and OptimalTransferLengthGranularity must be 0  //  for logical partitions.  //  if (Private->BlockIo.Revision >= EFI_BLOCK_IO_PROTOCOL_REVISION2) {    Private->Media.LowestAlignedLba               = 0;    Private->Media.LogicalBlocksPerPhysicalBlock  = 0;    Private->Media2.LowestAlignedLba              = 0;    Private->Media2.LogicalBlocksPerPhysicalBlock = 0;    if (Private->BlockIo.Revision >= EFI_BLOCK_IO_PROTOCOL_REVISION3) {      Private->Media.OptimalTransferLengthGranularity  = 0;      Private->Media2.OptimalTransferLengthGranularity = 0;    }  }  Private->DevicePath     = AppendDevicePathNode (ParentDevicePath, DevicePathNode);  if (Private->DevicePath == NULL) {    FreePool (Private);    return EFI_OUT_OF_RESOURCES;  }  if (InstallEspGuid) {    Private->EspGuid = &gEfiPartTypeSystemPartGuid;  } else {    //    // If NULL InstallMultipleProtocolInterfaces will ignore it.    //    Private->EspGuid = NULL;  }  //  // Create the new handle.   //  Private->Handle = NULL;  if (Private->DiskIo2 != NULL) {    Status = gBS->InstallMultipleProtocolInterfaces (                    &Private->Handle,                    &gEfiDevicePathProtocolGuid,                    Private->DevicePath,                    &gEfiBlockIoProtocolGuid,                    &Private->BlockIo,                    &gEfiBlockIo2ProtocolGuid,                    &Private->BlockIo2,                    Private->EspGuid,                    NULL,                    NULL                    );  } else {        Status = gBS->InstallMultipleProtocolInterfaces (                    &Private->Handle,                    &gEfiDevicePathProtocolGuid,                    Private->DevicePath,                    &gEfiBlockIoProtocolGuid,                    &Private->BlockIo,                    Private->EspGuid,                    NULL,                    NULL                    );  }  if (!EFI_ERROR (Status)) {    //    // Open the Parent Handle for the child    //    Status = gBS->OpenProtocol (                    ParentHandle,                    &gEfiDiskIoProtocolGuid,                    (VOID **) &ParentDiskIo,                    This->DriverBindingHandle,                    Private->Handle,                    EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER                    );  } else {    FreePool (Private->DevicePath);    FreePool (Private);  }  return Status;}
开发者ID:FishYu1222,项目名称:edk2,代码行数:101,


示例15: VirtioNetDriverBindingStart

STATICEFI_STATUSEFIAPIVirtioNetDriverBindingStart (  IN EFI_DRIVER_BINDING_PROTOCOL *This,  IN EFI_HANDLE                  DeviceHandle,  IN EFI_DEVICE_PATH_PROTOCOL    *RemainingDevicePath  ){  EFI_STATUS               Status;  VNET_DEV                 *Dev;  EFI_DEVICE_PATH_PROTOCOL *DevicePath;  MAC_ADDR_DEVICE_PATH     MacNode;  VOID                     *ChildVirtIo;  //  // allocate space for the driver instance  //  Dev = (VNET_DEV *) AllocateZeroPool (sizeof *Dev);  if (Dev == NULL) {    return EFI_OUT_OF_RESOURCES;  }  Dev->Signature = VNET_SIG;  Status = gBS->OpenProtocol (DeviceHandle, &gVirtioDeviceProtocolGuid,                  (VOID **)&Dev->VirtIo, This->DriverBindingHandle,                  DeviceHandle, EFI_OPEN_PROTOCOL_BY_DRIVER);  if (EFI_ERROR (Status)) {    goto FreeVirtioNet;  }  //  // now we can run a basic one-shot virtio-net initialization required to  // retrieve the MAC address  //  Status = VirtioNetSnpPopulate (Dev);  if (EFI_ERROR (Status)) {    goto CloseVirtIo;  }  //  // get the device path of the virtio-net device -- one-shot open  //  Status = gBS->OpenProtocol (DeviceHandle, &gEfiDevicePathProtocolGuid,                  (VOID **)&DevicePath, This->DriverBindingHandle,                  DeviceHandle, EFI_OPEN_PROTOCOL_GET_PROTOCOL);  if (EFI_ERROR (Status)) {    goto Evacuate;  }  //  // create another device path that has the MAC address appended  //  MacNode.Header.Type    = MESSAGING_DEVICE_PATH;  MacNode.Header.SubType = MSG_MAC_ADDR_DP;  SetDevicePathNodeLength (&MacNode, sizeof MacNode);  CopyMem (&MacNode.MacAddress, &Dev->Snm.CurrentAddress,    sizeof (EFI_MAC_ADDRESS));  MacNode.IfType         = Dev->Snm.IfType;  Dev->MacDevicePath = AppendDevicePathNode (DevicePath, &MacNode.Header);  if (Dev->MacDevicePath == NULL) {    Status = EFI_OUT_OF_RESOURCES;    goto Evacuate;  }  //  // create a child handle with the Simple Network Protocol and the new  // device path installed on it  //  Status = gBS->InstallMultipleProtocolInterfaces (&Dev->MacHandle,                  &gEfiSimpleNetworkProtocolGuid, &Dev->Snp,                  &gEfiDevicePathProtocolGuid,    Dev->MacDevicePath,                  NULL);  if (EFI_ERROR (Status)) {    goto FreeMacDevicePath;  }  //  // make a note that we keep this device open with VirtIo for the sake of this  // child  //  Status = gBS->OpenProtocol (DeviceHandle, &gVirtioDeviceProtocolGuid,                  &ChildVirtIo, This->DriverBindingHandle,                  Dev->MacHandle, EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER);  if (EFI_ERROR (Status)) {    goto UninstallMultiple;  }  return EFI_SUCCESS;UninstallMultiple:  gBS->UninstallMultipleProtocolInterfaces (Dev->MacHandle,         &gEfiDevicePathProtocolGuid,    Dev->MacDevicePath,         &gEfiSimpleNetworkProtocolGuid, &Dev->Snp,         NULL);FreeMacDevicePath:  FreePool (Dev->MacDevicePath);//.........这里部分代码省略.........
开发者ID:hsienchieh,项目名称:uefilab,代码行数:101,


示例16: Console

/**  This function delete and build multi-instance device path for  specified type of console device.  This function clear the EFI variable defined by ConsoleName and  gEfiGlobalVariableGuid. It then build the multi-instance device  path by appending the device path of the Console (In/Out/Err) instance   in ConsoleMenu. Then it scan all corresponding console device by  scanning Terminal (built from device supporting Serial I/O instances)  devices in TerminalMenu. At last, it save a EFI variable specifed  by ConsoleName and gEfiGlobalVariableGuid.  @param ConsoleName     The name for the console device type. They are                         usually "ConIn", "ConOut" and "ErrOut".  @param ConsoleMenu     The console memu which is a list of console devices.  @param UpdatePageId    The flag specifying which type of console device                         to be processed.  @retval EFI_SUCCESS    The function complete successfully.  @return The EFI variable can not be saved. See gRT->SetVariable for detail return information.**/EFI_STATUSVar_UpdateConsoleOption (  IN UINT16                     *ConsoleName,  IN BM_MENU_OPTION             *ConsoleMenu,  IN UINT16                     UpdatePageId  ){  EFI_DEVICE_PATH_PROTOCOL  *ConDevicePath;  BM_MENU_ENTRY             *NewMenuEntry;  BM_CONSOLE_CONTEXT        *NewConsoleContext;  BM_TERMINAL_CONTEXT       *NewTerminalContext;  EFI_STATUS                Status;  VENDOR_DEVICE_PATH        Vendor;  EFI_DEVICE_PATH_PROTOCOL  *TerminalDevicePath;  UINTN                     Index;  GetEfiGlobalVariable2 (ConsoleName, (VOID**)&ConDevicePath, NULL);  if (ConDevicePath != NULL) {    EfiLibDeleteVariable (ConsoleName, &gEfiGlobalVariableGuid);    FreePool (ConDevicePath);    ConDevicePath = NULL;  };  //  // First add all console input device from console input menu  //  for (Index = 0; Index < ConsoleMenu->MenuNumber; Index++) {    NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);    NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;    if (NewConsoleContext->IsActive) {      ConDevicePath = AppendDevicePathInstance (                        ConDevicePath,                        NewConsoleContext->DevicePath                        );    }  }  for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {    NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);    NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;    if (((NewTerminalContext->IsConIn != 0) && (UpdatePageId == FORM_CON_IN_ID)) ||        ((NewTerminalContext->IsConOut != 0)  && (UpdatePageId == FORM_CON_OUT_ID)) ||        ((NewTerminalContext->IsStdErr  != 0) && (UpdatePageId == FORM_CON_ERR_ID))        ) {      Vendor.Header.Type    = MESSAGING_DEVICE_PATH;      Vendor.Header.SubType = MSG_VENDOR_DP;            ASSERT (NewTerminalContext->TerminalType < (sizeof (TerminalTypeGuid) / sizeof (TerminalTypeGuid[0])));      CopyMem (        &Vendor.Guid,        &TerminalTypeGuid[NewTerminalContext->TerminalType],        sizeof (EFI_GUID)        );      SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));      TerminalDevicePath = AppendDevicePathNode (                            NewTerminalContext->DevicePath,                            (EFI_DEVICE_PATH_PROTOCOL *) &Vendor                            );      ASSERT (TerminalDevicePath != NULL);      ChangeTerminalDevicePath (TerminalDevicePath, TRUE);      ConDevicePath = AppendDevicePathInstance (                        ConDevicePath,                        TerminalDevicePath                        );    }  }  if (ConDevicePath != NULL) {    Status = gRT->SetVariable (                    ConsoleName,                    &gEfiGlobalVariableGuid,                    VAR_FLAG,                    GetDevicePathSize (ConDevicePath),                    ConDevicePath                    );    if (EFI_ERROR (Status)) {//.........这里部分代码省略.........
开发者ID:RafaelRMachado,项目名称:edk2,代码行数:101,


示例17: DiscoverEmmcDevice

/**  Scan EMMC Bus to discover the device.  @param[in]  Private             The EMMC driver private data structure.  @param[in]  Slot                The slot number to check device present.  @param[in]  RemainingDevicePath The pointer to the remaining device path.  @retval EFI_SUCCESS             Successfully to discover the device and attach                                  SdMmcIoProtocol to it.  @retval EFI_OUT_OF_RESOURCES    The request could not be completed due to a lack                                  of resources.  @retval EFI_ALREADY_STARTED     The device was discovered before.  @retval Others                  Fail to discover the device.**/EFI_STATUSEFIAPIDiscoverEmmcDevice (  IN  EMMC_DRIVER_PRIVATE_DATA    *Private,  IN  UINT8                       Slot,  IN  EFI_DEVICE_PATH_PROTOCOL    *RemainingDevicePath  ){  EFI_STATUS                      Status;  EMMC_DEVICE                     *Device;  EFI_DEVICE_PATH_PROTOCOL        *DevicePath;  EFI_DEVICE_PATH_PROTOCOL        *NewDevicePath;  EFI_DEVICE_PATH_PROTOCOL        *RemainingEmmcDevPath;  EFI_DEV_PATH                    *Node;  EFI_HANDLE                      DeviceHandle;  EFI_SD_MMC_PASS_THRU_PROTOCOL   *PassThru;  UINT8                           Index;  Device              = NULL;  DevicePath          = NULL;  NewDevicePath       = NULL;  RemainingDevicePath = NULL;  PassThru = Private->PassThru;  Device   = &Private->Device[Slot];  //  // Build Device Path to check if the EMMC device present at the slot.  //  Status = PassThru->BuildDevicePath (                       PassThru,                       Slot,                       &DevicePath                       );  if (EFI_ERROR(Status)) {    return Status;  }  if (DevicePath->SubType != MSG_EMMC_DP) {    Status = EFI_UNSUPPORTED;    goto Error;  }  NewDevicePath = AppendDevicePathNode (                    Private->ParentDevicePath,                    DevicePath                    );  if (NewDevicePath == NULL) {    Status = EFI_OUT_OF_RESOURCES;    goto Error;  }  DeviceHandle         = NULL;  RemainingEmmcDevPath = NewDevicePath;  Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingEmmcDevPath, &DeviceHandle);  //  // The device path to the EMMC device doesn't exist. It means the corresponding device private data hasn't been initialized.  //  if (EFI_ERROR (Status) || (DeviceHandle == NULL) || !IsDevicePathEnd (RemainingEmmcDevPath)) {    Device->DevicePath = NewDevicePath;    Device->Slot       = Slot;    Device->Private    = Private;    //    // Expose user area in the Sd memory card to upper layer.    //    Status = DiscoverAllPartitions (Device);    if (EFI_ERROR(Status)) {      FreePool (NewDevicePath);      goto Error;    }    Status = gBS->InstallProtocolInterface (                    &Device->Handle,                    &gEfiDevicePathProtocolGuid,                    EFI_NATIVE_INTERFACE,                    Device->DevicePath                    );    if (EFI_ERROR(Status)) {      FreePool (NewDevicePath);      goto Error;    }    Device->ControllerNameTable = NULL;    GetEmmcModelName (Device, &Device->Cid);    AddUnicodeString2 (      "eng",//.........这里部分代码省略.........
开发者ID:agileinsider,项目名称:edk2,代码行数:101,


示例18: PxeBcCreateIp4Children

//.........这里部分代码省略.........                  );  if (EFI_ERROR (Status)) {    goto ON_ERROR;  }  //  // Get max packet size from Ip4 to calculate block size for Tftp later.  //  Status = Private->Ip4->GetModeData (Private->Ip4, &Ip4ModeData, NULL, NULL);  if (EFI_ERROR (Status)) {    goto ON_ERROR;  }  Private->Ip4MaxPacketSize = Ip4ModeData.MaxPacketSize;  Private->Ip4Nic = AllocateZeroPool (sizeof (PXEBC_VIRTUAL_NIC));  if (Private->Ip4Nic == NULL) {    return EFI_OUT_OF_RESOURCES;  }  Private->Ip4Nic->Private   = Private;  Private->Ip4Nic->Signature = PXEBC_VIRTUAL_NIC_SIGNATURE;  //  // Create a device path node for Ipv4 virtual nic, and append it.  //  ZeroMem (&Ip4Node, sizeof (IPv4_DEVICE_PATH));  Ip4Node.Header.Type     = MESSAGING_DEVICE_PATH;  Ip4Node.Header.SubType  = MSG_IPv4_DP;  Ip4Node.StaticIpAddress = FALSE;  SetDevicePathNodeLength (&Ip4Node.Header, sizeof (Ip4Node));  Private->Ip4Nic->DevicePath = AppendDevicePathNode (Private->DevicePath, &Ip4Node.Header);  if (Private->Ip4Nic->DevicePath == NULL) {    Status = EFI_OUT_OF_RESOURCES;    goto ON_ERROR;  }  CopyMem (    &Private->Ip4Nic->LoadFile,    &gLoadFileProtocolTemplate,    sizeof (EFI_LOAD_FILE_PROTOCOL)    );  //  // Create a new handle for IPv4 virtual nic,  // and install PxeBaseCode, LoadFile and DevicePath protocols.  //  Status = gBS->InstallMultipleProtocolInterfaces (                  &Private->Ip4Nic->Controller,                  &gEfiDevicePathProtocolGuid,                  Private->Ip4Nic->DevicePath,                  &gEfiLoadFileProtocolGuid,                  &Private->Ip4Nic->LoadFile,                  &gEfiPxeBaseCodeProtocolGuid,                  &Private->PxeBc,                  NULL                  );  if (EFI_ERROR (Status)) {    goto ON_ERROR;  }  if (Private->Snp != NULL) {    //
开发者ID:Cutty,项目名称:edk2,代码行数:67,


示例19: PrepareLpcBridgeDevicePath

EFI_STATUSPrepareLpcBridgeDevicePath (  IN EFI_HANDLE                DeviceHandle  )/*++Routine Description:  Add IsaKeyboard to ConIn,  add IsaSerial to ConOut, ConIn, ErrOut.  LPC Bridge: 06 01 00Arguments:  DeviceHandle            - Handle of PCIIO protocol.Returns:  EFI_SUCCESS             - LPC bridge is added to ConOut, ConIn, and ErrOut.  EFI_STATUS              - No LPC bridge is added.--*/{  EFI_STATUS                Status;  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;  CHAR16                    *DevPathStr;  DevicePath = NULL;  Status = gBS->HandleProtocol (                  DeviceHandle,                  &gEfiDevicePathProtocolGuid,                  (VOID*)&DevicePath                  );  if (EFI_ERROR (Status)) {    return Status;  }  TempDevicePath = DevicePath;  //  // Register Keyboard  //  DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gPnpPs2KeyboardDeviceNode);  BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);  //  // Register COM1  //  DevicePath = TempDevicePath;  gPnp16550ComPortDeviceNode.UID = 0;  DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gPnp16550ComPortDeviceNode);  DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);  DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);  //  // Print Device Path  //  DevPathStr = DevicePathToStr(DevicePath);  if (DevPathStr != NULL) {    DEBUG((      EFI_D_INFO,      "BdsPlatform.c+%d: COM%d DevPath: %s/n",      __LINE__,      gPnp16550ComPortDeviceNode.UID + 1,      DevPathStr      ));    FreePool(DevPathStr);  }  BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);  BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);  BdsLibUpdateConsoleVariable (VarErrorOut, DevicePath, NULL);  //  // Register COM2  //  DevicePath = TempDevicePath;  gPnp16550ComPortDeviceNode.UID = 1;  DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gPnp16550ComPortDeviceNode);  DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);  DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);  //  // Print Device Path  //  DevPathStr = DevicePathToStr(DevicePath);  if (DevPathStr != NULL) {    DEBUG((      EFI_D_INFO,      "BdsPlatform.c+%d: COM%d DevPath: %s/n",      __LINE__,      gPnp16550ComPortDeviceNode.UID + 1,      DevPathStr      ));    FreePool(DevPathStr);  }//.........这里部分代码省略.........
开发者ID:jeppeter,项目名称:vbox,代码行数:101,


示例20: UsbCreateInterface

/**  Create an interface for the descriptor IfDesc. Each  device's configuration can have several interfaces.  @param  Device                The device has the interface descriptor.  @param  IfDesc                The interface descriptor.  @return The created USB interface for the descriptor, or NULL.**/USB_INTERFACE *UsbCreateInterface (  IN USB_DEVICE           *Device,  IN USB_INTERFACE_DESC   *IfDesc  ){  USB_DEVICE_PATH         UsbNode;  USB_INTERFACE           *UsbIf;  USB_INTERFACE           *HubIf;  EFI_STATUS              Status;  UsbIf = AllocateZeroPool (sizeof (USB_INTERFACE));  if (UsbIf == NULL) {    return NULL;  }  UsbIf->Signature  = USB_INTERFACE_SIGNATURE;  UsbIf->Device     = Device;  UsbIf->IfDesc     = IfDesc;//  ASSERT (IfDesc->ActiveIndex < USB_MAX_INTERFACE_SETTING);  if (IfDesc->ActiveIndex >= USB_MAX_INTERFACE_SETTING) {    FreePool(UsbIf);    return NULL;  }  UsbIf->IfSetting  = IfDesc->Settings[IfDesc->ActiveIndex];  CopyMem (    &(UsbIf->UsbIo),    &mUsbIoProtocol,    sizeof (EFI_USB_IO_PROTOCOL)    );  //  // Install protocols for USBIO and device path  //  UsbNode.Header.Type       = MESSAGING_DEVICE_PATH;  UsbNode.Header.SubType    = MSG_USB_DP;  UsbNode.ParentPortNumber  = Device->ParentPort;  UsbNode.InterfaceNumber   = UsbIf->IfSetting->Desc.InterfaceNumber;  SetDevicePathNodeLength (&UsbNode.Header, sizeof (UsbNode));  HubIf = Device->ParentIf;//  ASSERT (HubIf != NULL);  if (!HubIf) {    return NULL;  }  UsbIf->DevicePath = AppendDevicePathNode (HubIf->DevicePath, &UsbNode.Header);  if (UsbIf->DevicePath == NULL) { //   DEBUG ((EFI_D_ERROR, "UsbCreateInterface: failed to create device path/n"));    DBG("UsbCreateInterface: failed to create device path/n");    Status = EFI_OUT_OF_RESOURCES;    goto ON_ERROR;  }  Status = gBS->InstallMultipleProtocolInterfaces (                  &UsbIf->Handle,                  &gEfiDevicePathProtocolGuid,                  UsbIf->DevicePath,                  &gEfiUsbIoProtocolGuid,                  &UsbIf->UsbIo,                  NULL                  );  if (EFI_ERROR (Status)) { //   DEBUG ((EFI_D_ERROR, "UsbCreateInterface: failed to install UsbIo - %r/n", Status));    goto ON_ERROR;  }  //  // Open USB Host Controller Protocol by Child  //  Status = UsbOpenHostProtoByChild (Device->Bus, UsbIf->Handle);  if (EFI_ERROR (Status)) {    gBS->UninstallMultipleProtocolInterfaces (           &UsbIf->Handle,           &gEfiDevicePathProtocolGuid,           UsbIf->DevicePath,           &gEfiUsbIoProtocolGuid,           &UsbIf->UsbIo,           NULL           ); //   DEBUG ((EFI_D_ERROR, "UsbCreateInterface: failed to open host for child - %r/n", Status));    DBG("UsbCreateInterface: failed to open host for child - %r/n", Status);    goto ON_ERROR;//.........这里部分代码省略.........
开发者ID:Clover-EFI-Bootloader,项目名称:clover,代码行数:101,


示例21: DebugPortStart

/**  Binds exclusively to serial io on the controller handle, Produces DebugPort  protocol and DevicePath on new handle.  @param  This                 Protocol instance pointer.  @param  ControllerHandle     Handle of device to bind driver to.  @param  RemainingDevicePath  Optional parameter use to pick a specific child                               device to start.  @retval EFI_SUCCESS          This driver is added to ControllerHandle.  @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device.  @retval others               Some error occurs.**/EFI_STATUSEFIAPIDebugPortStart (  IN EFI_DRIVER_BINDING_PROTOCOL    *This,  IN EFI_HANDLE                     ControllerHandle,  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath  ){  EFI_STATUS                Status;  DEBUGPORT_DEVICE_PATH     DebugPortDP;  EFI_DEVICE_PATH_PROTOCOL  EndDP;  EFI_DEVICE_PATH_PROTOCOL  *Dp1;  Status = gBS->OpenProtocol (                  ControllerHandle,                  &gEfiSerialIoProtocolGuid,                  (VOID **) &mDebugPortDevice.SerialIoBinding,                  This->DriverBindingHandle,                  ControllerHandle,                  EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE                  );  if (EFI_ERROR (Status)) {    return Status;  }  mDebugPortDevice.SerialIoDeviceHandle = ControllerHandle;  //  // Initialize the Serial Io interface...  //  Status = mDebugPortDevice.SerialIoBinding->SetAttributes (                                                mDebugPortDevice.SerialIoBinding,                                                mDebugPortDevice.BaudRate,                                                mDebugPortDevice.ReceiveFifoDepth,                                                mDebugPortDevice.Timeout,                                                mDebugPortDevice.Parity,                                                mDebugPortDevice.DataBits,                                                mDebugPortDevice.StopBits                                                );  if (EFI_ERROR (Status)) {    mDebugPortDevice.BaudRate          = 0;    mDebugPortDevice.Parity            = DefaultParity;    mDebugPortDevice.DataBits          = 0;    mDebugPortDevice.StopBits          = DefaultStopBits;    mDebugPortDevice.ReceiveFifoDepth  = 0;    Status = mDebugPortDevice.SerialIoBinding->SetAttributes (                                                  mDebugPortDevice.SerialIoBinding,                                                  mDebugPortDevice.BaudRate,                                                  mDebugPortDevice.ReceiveFifoDepth,                                                  mDebugPortDevice.Timeout,                                                  mDebugPortDevice.Parity,                                                  mDebugPortDevice.DataBits,                                                  mDebugPortDevice.StopBits                                                  );    if (EFI_ERROR (Status)) {      gBS->CloseProtocol (            ControllerHandle,            &gEfiSerialIoProtocolGuid,            This->DriverBindingHandle,            ControllerHandle            );      return Status;    }  }  mDebugPortDevice.SerialIoBinding->Reset (mDebugPortDevice.SerialIoBinding);  //  // Create device path instance for DebugPort  //  DebugPortDP.Header.Type     = MESSAGING_DEVICE_PATH;  DebugPortDP.Header.SubType  = MSG_VENDOR_DP;  SetDevicePathNodeLength (&(DebugPortDP.Header), sizeof (DebugPortDP));  CopyGuid (&DebugPortDP.Guid, &gEfiDebugPortDevicePathGuid);  Dp1 = DevicePathFromHandle (ControllerHandle);  if (Dp1 == NULL) {    Dp1 = &EndDP;    SetDevicePathEndNode (Dp1);  }  mDebugPortDevice.DebugPortDevicePath = AppendDevicePathNode (Dp1, (EFI_DEVICE_PATH_PROTOCOL *) &DebugPortDP);  if (mDebugPortDevice.DebugPortDevicePath == NULL) {    return EFI_OUT_OF_RESOURCES;  }  ////.........这里部分代码省略.........
开发者ID:bhanug,项目名称:virtualbox,代码行数:101,


示例22: BuildEdd30DevicePath

/**  Build device path for EDD 3.0.  @param  BaseDevicePath         Base device path.  @param  Drive                  Legacy drive.  @param  DevicePath             Device path for output.  @retval EFI_SUCCESS            The device path is built successfully.  @retval EFI_UNSUPPORTED        It is failed to built device path.**/EFI_STATUSBuildEdd30DevicePath (  IN  EFI_DEVICE_PATH_PROTOCOL  *BaseDevicePath,  IN  BIOS_LEGACY_DRIVE         *Drive,  IN  EFI_DEVICE_PATH_PROTOCOL  **DevicePath  ){  //  // AVL    UINT64                  Address;  // AVL    EFI_HANDLE              Handle;  //  EFI_DEV_PATH  Node;  UINT32        Controller;  Controller = (UINT32) Drive->Parameters.InterfacePath.Pci.Controller;  ZeroMem (&Node, sizeof (Node));  if ((AsciiStrnCmp ("ATAPI", Drive->Parameters.InterfaceType, 5) == 0) ||      (AsciiStrnCmp ("ATA", Drive->Parameters.InterfaceType, 3) == 0)      ) {    //    // ATA or ATAPI drive found    //    Node.Atapi.Header.Type    = MESSAGING_DEVICE_PATH;    Node.Atapi.Header.SubType = MSG_ATAPI_DP;    SetDevicePathNodeLength (&Node.Atapi.Header, sizeof (ATAPI_DEVICE_PATH));    Node.Atapi.SlaveMaster      = Drive->Parameters.DevicePath.Atapi.Master;    Node.Atapi.Lun              = Drive->Parameters.DevicePath.Atapi.Lun;    Node.Atapi.PrimarySecondary = (UINT8) Controller;  } else {    //    // Not an ATA/ATAPI drive    //#if 0    if (Controller != 0) {      ZeroMem (&Node, sizeof (Node));      Node.Controller.Header.Type      = HARDWARE_DEVICE_PATH;      Node.Controller.Header.SubType   = HW_CONTROLLER_DP;      SetDevicePathNodeLength (&Node.Controller.Header, sizeof (CONTROLLER_DEVICE_PATH));      Node.Controller.ControllerNumber = Controller;      *DevicePath                      = AppendDevicePathNode (*DevicePath, &Node.DevPath);    }    ZeroMem (&Node, sizeof (Node));#endif    if (AsciiStrnCmp ("SCSI", Drive->Parameters.InterfaceType, 4) == 0) {      //      // SCSI drive      //      Node.Scsi.Header.Type     = MESSAGING_DEVICE_PATH;      Node.Scsi.Header.SubType  = MSG_SCSI_DP;      SetDevicePathNodeLength (&Node.Scsi.Header, sizeof (SCSI_DEVICE_PATH));      //      // Lun is miss aligned in both EDD and Device Path data structures.      //  thus we do a byte copy, to prevent alignment traps on IA-64.      //      CopyMem (&Node.Scsi.Lun, &Drive->Parameters.DevicePath.Scsi.Lun, sizeof (UINT16));      Node.Scsi.Pun = Drive->Parameters.DevicePath.Scsi.Pun;    } else if (AsciiStrnCmp ("USB", Drive->Parameters.InterfaceType, 3) == 0) {      //      // USB drive      //      Node.Usb.Header.Type    = MESSAGING_DEVICE_PATH;      Node.Usb.Header.SubType = MSG_USB_DP;      SetDevicePathNodeLength (&Node.Usb.Header, sizeof (USB_DEVICE_PATH));      Node.Usb.ParentPortNumber = Drive->Number; //(UINT8) Drive->Parameters.DevicePath.Usb.Reserved;      Node.Usb.InterfaceNumber = (UINT8) Drive->Parameters.DevicePath.Usb.SerialNumber;    } else if (AsciiStrnCmp ("1394", Drive->Parameters.InterfaceType, 4) == 0) {      //      // 1394 drive      //      Node.F1394.Header.Type    = MESSAGING_DEVICE_PATH;      Node.F1394.Header.SubType = MSG_1394_DP;      SetDevicePathNodeLength (&Node.F1394.Header, sizeof (F1394_DEVICE_PATH));      Node.F1394.Guid = Drive->Parameters.DevicePath.FireWire.Guid;    } else if (AsciiStrnCmp ("FIBRE", Drive->Parameters.InterfaceType, 5) == 0) {      //      // Fibre drive      //      Node.FibreChannel.Header.Type     = MESSAGING_DEVICE_PATH;      Node.FibreChannel.Header.SubType  = MSG_FIBRECHANNEL_DP;      SetDevicePathNodeLength (&Node.FibreChannel.Header, sizeof (FIBRECHANNEL_DEVICE_PATH));      Node.FibreChannel.WWN = Drive->Parameters.DevicePath.FibreChannel.Wwn;      Node.FibreChannel.Lun = Drive->Parameters.DevicePath.FibreChannel.Lun;//.........这里部分代码省略.........
开发者ID:Clover-EFI-Bootloader,项目名称:clover,代码行数:101,


示例23: Ip4Config2FormInit

/**  Install HII Config Access protocol for network device and allocate resource.  @param[in, out]  Instance        The IP4 config2 Instance.  @retval EFI_SUCCESS              The HII Config Access protocol is installed.  @retval EFI_OUT_OF_RESOURCES     Failed to allocate memory.  @retval Others                   Other errors as indicated.**/EFI_STATUSIp4Config2FormInit (  IN OUT IP4_CONFIG2_INSTANCE     *Instance  ){  EFI_STATUS                     Status;  IP4_SERVICE                    *IpSb;  IP4_FORM_CALLBACK_INFO         *CallbackInfo;  EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;  VENDOR_DEVICE_PATH             VendorDeviceNode;  EFI_SERVICE_BINDING_PROTOCOL   *MnpSb;  CHAR16                         *MacString;  CHAR16                         MenuString[128];  CHAR16                         PortString[128];  CHAR16                         *OldMenuString;  EFI_DEVICE_PATH_PROTOCOL       *ParentDevicePath;  IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);  ASSERT (IpSb != NULL);  CallbackInfo = &Instance->CallbackInfo;  CallbackInfo->Signature = IP4_FORM_CALLBACK_INFO_SIGNATURE;  Status = gBS->HandleProtocol (                  IpSb->Controller,                  &gEfiDevicePathProtocolGuid,                  (VOID **) &ParentDevicePath                  );  if (EFI_ERROR (Status)) {    return Status;  }  //  // Construct device path node for EFI HII Config Access protocol,  // which consists of controller physical device path and one hardware  // vendor guid node.  //  ZeroMem (&VendorDeviceNode, sizeof (VENDOR_DEVICE_PATH));  VendorDeviceNode.Header.Type    = HARDWARE_DEVICE_PATH;  VendorDeviceNode.Header.SubType = HW_VENDOR_DP;  CopyGuid (&VendorDeviceNode.Guid, &gEfiCallerIdGuid);  SetDevicePathNodeLength (&VendorDeviceNode.Header, sizeof (VENDOR_DEVICE_PATH));  CallbackInfo->HiiVendorDevicePath = AppendDevicePathNode (                                        ParentDevicePath,                                        (EFI_DEVICE_PATH_PROTOCOL *) &VendorDeviceNode                                        );  if (CallbackInfo->HiiVendorDevicePath == NULL) {    Status = EFI_OUT_OF_RESOURCES;    goto Error;  }  ConfigAccess                = &CallbackInfo->HiiConfigAccessProtocol;  ConfigAccess->ExtractConfig = Ip4FormExtractConfig;  ConfigAccess->RouteConfig   = Ip4FormRouteConfig;  ConfigAccess->Callback      = Ip4FormCallback;  //  // Install Device Path Protocol and Config Access protocol on new handle  //  Status = gBS->InstallMultipleProtocolInterfaces (                  &CallbackInfo->ChildHandle,                  &gEfiDevicePathProtocolGuid,                  CallbackInfo->HiiVendorDevicePath,                  &gEfiHiiConfigAccessProtocolGuid,                  ConfigAccess,                  NULL                  );  if (!EFI_ERROR (Status)) {    //    // Open the Parent Handle for the child    //    Status = gBS->OpenProtocol (                    IpSb->Controller,                    &gEfiManagedNetworkServiceBindingProtocolGuid,                    (VOID **) &MnpSb,                    IpSb->Image,                    CallbackInfo->ChildHandle,                    EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER                    );  }  if (EFI_ERROR (Status)) {    goto Error;  }  ////.........这里部分代码省略.........
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:101,


示例24: InstallVlanConfigForm

/**  This function publish the VLAN configuration Form for a network device. The  HII Config Access protocol will be installed on a child handle of the network  device.  @param[in, out]  PrivateData   Points to VLAN configuration private data.  @retval EFI_SUCCESS            HII Form is installed for this network device.  @retval EFI_OUT_OF_RESOURCES   Not enough resource for HII Form installation.  @retval Others                 Other errors as indicated.**/EFI_STATUSInstallVlanConfigForm (  IN OUT VLAN_CONFIG_PRIVATE_DATA    *PrivateData  ){  EFI_STATUS                      Status;  EFI_HII_HANDLE                  HiiHandle;  EFI_HANDLE                      DriverHandle;  CHAR16                          Str[26 + sizeof (EFI_MAC_ADDRESS) * 2 + 1];  CHAR16                          *MacString;  EFI_DEVICE_PATH_PROTOCOL        *ChildDevicePath;  EFI_HII_CONFIG_ACCESS_PROTOCOL  *ConfigAccess;  EFI_VLAN_CONFIG_PROTOCOL        *VlanConfig;  //  // Create child handle and install HII Config Access Protocol  //  ChildDevicePath = AppendDevicePathNode (                      PrivateData->ParentDevicePath,                      (CONST EFI_DEVICE_PATH_PROTOCOL *) &mHiiVendorDevicePathNode                      );  if (ChildDevicePath == NULL) {    return EFI_OUT_OF_RESOURCES;  }  PrivateData->ChildDevicePath = ChildDevicePath;  DriverHandle = NULL;  ConfigAccess = &PrivateData->ConfigAccess;  Status = gBS->InstallMultipleProtocolInterfaces (                  &DriverHandle,                  &gEfiDevicePathProtocolGuid,                  ChildDevicePath,                  &gEfiHiiConfigAccessProtocolGuid,                  ConfigAccess,                  NULL                  );  if (EFI_ERROR (Status)) {    return Status;  }  PrivateData->DriverHandle = DriverHandle;  //  // Establish the parent-child relationship between the new created  // child handle and the ControllerHandle.  //  Status = gBS->OpenProtocol (                  PrivateData->ControllerHandle,                  &gEfiVlanConfigProtocolGuid,                  (VOID **)&VlanConfig,                  PrivateData->ImageHandle,                  PrivateData->DriverHandle,                  EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER                  );  if (EFI_ERROR (Status)) {    return Status;  }  //  // Publish the HII package list  //  HiiHandle = HiiAddPackages (                &gVlanConfigFormSetGuid,                DriverHandle,                VlanConfigDxeStrings,                VlanConfigBin,                NULL                );  if (HiiHandle == NULL) {    return EFI_OUT_OF_RESOURCES;  }  PrivateData->HiiHandle = HiiHandle;  //  // Update formset title help string.  //  MacString = NULL;  Status = NetLibGetMacString (PrivateData->ControllerHandle, PrivateData->ImageHandle, &MacString);  if (EFI_ERROR (Status)) {    return Status;  }  PrivateData->MacString = MacString;  StrCpy (Str, L"VLAN Configuration (MAC:");  StrnCat (Str, MacString, sizeof (EFI_MAC_ADDRESS) * 2);  StrCat (Str, L")");  HiiSetString (    HiiHandle,    STRING_TOKEN (STR_VLAN_FORM_SET_TITLE_HELP),//.........这里部分代码省略.........
开发者ID:ChenFanFnst,项目名称:edk2,代码行数:101,


示例25: ScsiScanCreateDevice

/**  Scan SCSI Bus to discover the device, and attach ScsiIoProtocol to it.  @param  This           Protocol instance pointer  @param  Controller     Controller handle  @param  TargetId       Tartget to be scanned  @param  Lun            The Lun of the SCSI device on the SCSI channel.  @param  ScsiBusDev     The pointer of SCSI_BUS_DEVICE  @retval EFI_SUCCESS           Successfully to discover the device and attach                                ScsiIoProtocol to it.  @retval EFI_OUT_OF_RESOURCES  Fail to discover the device.**/EFI_STATUSEFIAPIScsiScanCreateDevice (  IN     EFI_DRIVER_BINDING_PROTOCOL   *This,  IN     EFI_HANDLE                    Controller,  IN     SCSI_TARGET_ID                *TargetId,  IN     UINT64                        Lun,  IN OUT SCSI_BUS_DEVICE               *ScsiBusDev  ){  EFI_STATUS                Status;  SCSI_IO_DEV               *ScsiIoDevice;  EFI_DEVICE_PATH_PROTOCOL  *ScsiDevicePath;  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;  EFI_DEVICE_PATH_PROTOCOL  *RemainingDevicePath;  EFI_HANDLE                 DeviceHandle;  DevicePath          = NULL;  RemainingDevicePath = NULL;  ScsiDevicePath      = NULL;  ScsiIoDevice        = NULL;  //  // Build Device Path  //  if (ScsiBusDev->ExtScsiSupport){    Status = ScsiBusDev->ExtScsiInterface->BuildDevicePath (                                             ScsiBusDev->ExtScsiInterface,                                             &TargetId->ScsiId.ExtScsi[0],                                             Lun,                                             &ScsiDevicePath                                             );  } else {    Status = ScsiBusDev->ScsiInterface->BuildDevicePath (                                          ScsiBusDev->ScsiInterface,                                          TargetId->ScsiId.Scsi,                                          Lun,                                          &ScsiDevicePath                                          );  }  if (EFI_ERROR(Status)) {    return Status;  }  DevicePath = AppendDevicePathNode (                 ScsiBusDev->DevicePath,                 ScsiDevicePath                 );  if (DevicePath == NULL) {    Status = EFI_OUT_OF_RESOURCES;    goto ErrorExit;  }  DeviceHandle = NULL;  RemainingDevicePath = DevicePath;  Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &DeviceHandle);  if (!EFI_ERROR (Status) && (DeviceHandle != NULL) && IsDevicePathEnd(RemainingDevicePath)) {    //    // The device has been started, directly return to fast boot.    //    Status = EFI_ALREADY_STARTED;    goto ErrorExit;  }  ScsiIoDevice = AllocateZeroPool (sizeof (SCSI_IO_DEV));  if (ScsiIoDevice == NULL) {    Status = EFI_OUT_OF_RESOURCES;    goto ErrorExit;  }  ScsiIoDevice->Signature                 = SCSI_IO_DEV_SIGNATURE;  CopyMem(&ScsiIoDevice->Pun, TargetId, TARGET_MAX_BYTES);  ScsiIoDevice->Lun                       = Lun;  if (ScsiBusDev->ExtScsiSupport) {    ScsiIoDevice->ExtScsiPassThru         = ScsiBusDev->ExtScsiInterface;    ScsiIoDevice->ExtScsiSupport          = TRUE;    ScsiIoDevice->ScsiIo.IoAlign          = ScsiIoDevice->ExtScsiPassThru->Mode->IoAlign;  } else {    ScsiIoDevice->ScsiPassThru            = ScsiBusDev->ScsiInterface;    ScsiIoDevice->ExtScsiSupport          = FALSE;    ScsiIoDevice->ScsiIo.IoAlign          = ScsiIoDevice->ScsiPassThru->Mode->IoAlign;  }//.........这里部分代码省略.........
开发者ID:AshleyDeSimone,项目名称:edk2,代码行数:101,


示例26: PxeBcCreateIp6Children

//.........这里部分代码省略.........  //  // Get max packet size from Ip6 to calculate block size for Tftp later.  //  Status = Private->Ip6->GetModeData (Private->Ip6, &Ip6ModeData, NULL, NULL);  if (EFI_ERROR (Status)) {    goto ON_ERROR;  }  Private->Ip6MaxPacketSize = Ip6ModeData.MaxPacketSize;  //  // Locate Ip6->Ip6Config and store it for set IPv6 address.  //  Status = gBS->HandleProtocol (                  ControllerHandle,                  &gEfiIp6ConfigProtocolGuid,                  (VOID **) &Private->Ip6Cfg                  );  if (EFI_ERROR (Status)) {    goto ON_ERROR;  }  //  // Create a device path node for Ipv6 virtual nic, and append it.  //  ZeroMem (&Ip6Node, sizeof (IPv6_DEVICE_PATH));  Ip6Node.Header.Type     = MESSAGING_DEVICE_PATH;  Ip6Node.Header.SubType  = MSG_IPv6_DP;  Ip6Node.PrefixLength    = IP6_PREFIX_LENGTH;  SetDevicePathNodeLength (&Ip6Node.Header, sizeof (Ip6Node));  Private->Ip6Nic->DevicePath = AppendDevicePathNode (Private->DevicePath, &Ip6Node.Header);  if (Private->Ip6Nic->DevicePath == NULL) {    Status = EFI_OUT_OF_RESOURCES;    goto ON_ERROR;  }  CopyMem (    &Private->Ip6Nic->LoadFile,    &gLoadFileProtocolTemplate,    sizeof (EFI_LOAD_FILE_PROTOCOL)    );  //  // Create a new handle for IPv6 virtual nic,  // and install PxeBaseCode, LoadFile and DevicePath protocols.  //  Status = gBS->InstallMultipleProtocolInterfaces (                  &Private->Ip6Nic->Controller,                  &gEfiDevicePathProtocolGuid,                  Private->Ip6Nic->DevicePath,                  &gEfiLoadFileProtocolGuid,                  &Private->Ip6Nic->LoadFile,                  &gEfiPxeBaseCodeProtocolGuid,                  &Private->PxeBc,                  NULL                  );  if (EFI_ERROR (Status)) {    goto ON_ERROR;  }    if (Private->Snp != NULL) {    //
开发者ID:Cutty,项目名称:edk2,代码行数:67,


示例27: UsbMassInitMultiLun

/**  Initialize data for device that supports multiple LUNSs.  @param  This                 The Driver Binding Protocol instance.  @param  Controller           The device to initialize.  @param  Transport            Pointer to USB_MASS_TRANSPORT.  @param  Context              Parameter for USB_MASS_DEVICE.Context.  @param  DevicePath           The remaining device path.  @param  MaxLun               The max LUN number.  @retval EFI_SUCCESS          At least one LUN is initialized successfully.  @retval EFI_NOT_FOUND        Fail to initialize any of multiple LUNs.**/EFI_STATUSUsbMassInitMultiLun (  IN EFI_DRIVER_BINDING_PROTOCOL   *This,  IN EFI_HANDLE                    Controller,  IN USB_MASS_TRANSPORT            *Transport,  IN VOID                          *Context,  IN EFI_DEVICE_PATH_PROTOCOL      *DevicePath,  IN UINT8                         MaxLun  ){  USB_MASS_DEVICE                  *UsbMass;  EFI_USB_IO_PROTOCOL              *UsbIo;  DEVICE_LOGICAL_UNIT_DEVICE_PATH  LunNode;  UINT8                            Index;  EFI_STATUS                       Status;  EFI_STATUS                       ReturnStatus;  ASSERT (MaxLun > 0);  ReturnStatus = EFI_NOT_FOUND;  for (Index = 0; Index <= MaxLun; Index++) {    DEBUG ((EFI_D_INFO, "UsbMassInitMultiLun: Start to initialize No.%d logic unit/n", Index));    UsbIo   = NULL;    UsbMass = AllocateZeroPool (sizeof (USB_MASS_DEVICE));    ASSERT (UsbMass != NULL);    UsbMass->Signature            = USB_MASS_SIGNATURE;    UsbMass->UsbIo                = UsbIo;    UsbMass->BlockIo.Media        = &UsbMass->BlockIoMedia;    UsbMass->BlockIo.Reset        = UsbMassReset;    UsbMass->BlockIo.ReadBlocks   = UsbMassReadBlocks;    UsbMass->BlockIo.WriteBlocks  = UsbMassWriteBlocks;    UsbMass->BlockIo.FlushBlocks  = UsbMassFlushBlocks;    UsbMass->OpticalStorage       = FALSE;    UsbMass->Transport            = Transport;    UsbMass->Context              = Context;    UsbMass->Lun                  = Index;    //    // Initialize the media parameter data for EFI_BLOCK_IO_MEDIA of Block I/O Protocol.    //    Status = UsbMassInitMedia (UsbMass);    if ((EFI_ERROR (Status)) && (Status != EFI_NO_MEDIA)) {      DEBUG ((EFI_D_ERROR, "UsbMassInitMultiLun: UsbMassInitMedia (%r)/n", Status));      FreePool (UsbMass);      continue;    }    //    // Create a device path node for device logic unit, and append it.    //    LunNode.Header.Type    = MESSAGING_DEVICE_PATH;    LunNode.Header.SubType = MSG_DEVICE_LOGICAL_UNIT_DP;    LunNode.Lun            = UsbMass->Lun;    SetDevicePathNodeLength (&LunNode.Header, sizeof (LunNode));    UsbMass->DevicePath = AppendDevicePathNode (DevicePath, &LunNode.Header);    if (UsbMass->DevicePath == NULL) {      DEBUG ((EFI_D_ERROR, "UsbMassInitMultiLun: failed to create device logic unit device path/n"));      Status = EFI_OUT_OF_RESOURCES;      FreePool (UsbMass);      continue;    }    InitializeDiskInfo (UsbMass);    //    // Create a new handle for each LUN, and install Block I/O Protocol and Device Path Protocol.    //    Status = gBS->InstallMultipleProtocolInterfaces (                    &UsbMass->Controller,                    &gEfiDevicePathProtocolGuid,                    UsbMass->DevicePath,                    &gEfiBlockIoProtocolGuid,                    &UsbMass->BlockIo,                    &gEfiDiskInfoProtocolGuid,                    &UsbMass->DiskInfo,                    NULL                    );    if (EFI_ERROR (Status)) {      DEBUG ((EFI_D_ERROR, "UsbMassInitMultiLun: InstallMultipleProtocolInterfaces (%r)/n", Status));//.........这里部分代码省略.........
开发者ID:b-man,项目名称:edk2,代码行数:101,


示例28: FvFilePath

EFI_DEVICE_PATH *FvFilePath (  UINTN                         FvBaseAddress,  UINTN                         FvSize,  EFI_GUID                     *FileGuid  ){    EFI_STATUS                         Status;  EFI_LOADED_IMAGE_PROTOCOL          *LoadedImage;  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH  FileNode;  EFI_HANDLE                         FvProtocolHandle;   EFI_HANDLE                         *FvHandleBuffer;  UINTN                              FvHandleCount;  EFI_FV_FILETYPE                    Type;  UINTN                              Size;  EFI_FV_FILE_ATTRIBUTES             Attributes;  UINT32                             AuthenticationStatus;  EFI_FIRMWARE_VOLUME2_PROTOCOL      *Fv;  UINTN                              Index;  EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid);  if (FvBaseAddress == 0) {    Status = gBS->HandleProtocol (                  gImageHandle,                  &gEfiLoadedImageProtocolGuid,                  (VOID **) &LoadedImage                  );    ASSERT_EFI_ERROR (Status);    return AppendDevicePathNode (           DevicePathFromHandle (LoadedImage->DeviceHandle),           (EFI_DEVICE_PATH_PROTOCOL *) &FileNode           );  }  else {    //    // Expose Payload file in FV    //      gDS->ProcessFirmwareVolume (           (VOID *)FvBaseAddress,           (UINT32)FvSize,           &FvProtocolHandle           );    //    // Find out the handle of FV containing the playload file    //    FvHandleBuffer = NULL;    gBS->LocateHandleBuffer (          ByProtocol,          &gEfiFirmwareVolume2ProtocolGuid,          NULL,          &FvHandleCount,          &FvHandleBuffer          );    for (Index = 0; Index < FvHandleCount; Index++) {      gBS->HandleProtocol (            FvHandleBuffer[Index],            &gEfiFirmwareVolume2ProtocolGuid,            (VOID **) &Fv            );      Status = Fv->ReadFile (                  Fv,                  FileGuid,                  NULL,                  &Size,                  &Type,                  &Attributes,                  &AuthenticationStatus                  );      if (!EFI_ERROR (Status)) {        break;      }    }    if (Index < FvHandleCount) {      return AppendDevicePathNode (            DevicePathFromHandle (FvHandleBuffer[Index]),            (  EFI_DEVICE_PATH_PROTOCOL *) &FileNode            );    }  }  return NULL;}
开发者ID:RafaelRMachado,项目名称:Galileo,代码行数:84,


示例29: InstallProtocolOnPartition

/**  Install BlkIo, BlkIo2 and Ssp protocols for the specified partition in the EMMC device.  @param[in] Device          The pointer to the EMMC_DEVICE data structure.  @param[in] Index           The index of the partition.  @retval EFI_SUCCESS        The protocols are installed successfully.  @retval Others             Some error occurs when installing the protocols.**/EFI_STATUSInstallProtocolOnPartition (  IN EMMC_DEVICE             *Device,  IN UINT8                   Index  ){  EFI_STATUS                        Status;  EMMC_PARTITION                    *Partition;  CONTROLLER_DEVICE_PATH            ControlNode;  EFI_DEVICE_PATH_PROTOCOL          *ParentDevicePath;  EFI_DEVICE_PATH_PROTOCOL          *DevicePath;  EFI_DEVICE_PATH_PROTOCOL          *RemainingDevicePath;  EFI_HANDLE                        DeviceHandle;  //  // Build device path  //  ParentDevicePath = Device->DevicePath;  ControlNode.Header.Type    = HARDWARE_DEVICE_PATH;  ControlNode.Header.SubType = HW_CONTROLLER_DP;  SetDevicePathNodeLength (&ControlNode.Header, sizeof (CONTROLLER_DEVICE_PATH));  ControlNode.ControllerNumber = Index;  DevicePath = AppendDevicePathNode (ParentDevicePath, (EFI_DEVICE_PATH_PROTOCOL*)&ControlNode);  if (DevicePath == NULL) {    Status = EFI_OUT_OF_RESOURCES;    goto Error;  }  DeviceHandle = NULL;  RemainingDevicePath = DevicePath;  Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &DeviceHandle);  if (!EFI_ERROR (Status) && (DeviceHandle != NULL) && IsDevicePathEnd(RemainingDevicePath)) {    Status = EFI_ALREADY_STARTED;    goto Error;  }  Partition = &Device->Partition[Index];  Partition->DevicePath = DevicePath;  if (Partition->Enable) {    //    // Install BlkIo/BlkIo2/Ssp for the specified partition    //    Status = gBS->InstallMultipleProtocolInterfaces (                    &Partition->Handle,                    &gEfiDevicePathProtocolGuid,                    Partition->DevicePath,                    &gEfiBlockIoProtocolGuid,                    &Partition->BlockIo,                    &gEfiBlockIo2ProtocolGuid,                    &Partition->BlockIo2,                    NULL                    );    if (EFI_ERROR (Status)) {      goto Error;    }    if (Partition->PartitionType != EmmcPartitionRPMB) {      Status = gBS->InstallProtocolInterface (                      &Partition->Handle,                      &gEfiEraseBlockProtocolGuid,                      EFI_NATIVE_INTERFACE,                      &Partition->EraseBlock                      );      if (EFI_ERROR (Status)) {        gBS->UninstallMultipleProtocolInterfaces (               &Partition->Handle,               &gEfiDevicePathProtocolGuid,               Partition->DevicePath,               &gEfiBlockIoProtocolGuid,               &Partition->BlockIo,               &gEfiBlockIo2ProtocolGuid,               &Partition->BlockIo2,               NULL               );        goto Error;      }    }    if (((Partition->PartitionType == EmmcPartitionUserData) ||        (Partition->PartitionType == EmmcPartitionBoot1) ||        (Partition->PartitionType == EmmcPartitionBoot2)) &&        ((Device->Csd.Ccc & BIT10) != 0)) {      Status = gBS->InstallProtocolInterface (                      &Partition->Handle,                      &gEfiStorageSecurityCommandProtocolGuid,                      EFI_NATIVE_INTERFACE,                      &Partition->StorageSecurity                      );//.........这里部分代码省略.........
开发者ID:agileinsider,项目名称:edk2,代码行数:101,



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


C++ AppendFileName函数代码示例
C++ AppendDebugLog函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。