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

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

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

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

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

示例1: IsLoadForbidden

/**  Check whether the DevicePath is in the device path forbid list   (mAccessInfo.LoadForbid).  @param[in]  DevicePath           Points to device path.    @retval TRUE     The DevicePath is in the device path forbid list.  @retval FALSE    The DevicePath is not in the device path forbid list.**/BOOLEANIsLoadForbidden (  IN  EFI_DEVICE_PATH_PROTOCOL                  *DevicePath  ){  UINTN                     OffSet;  UINTN                     DPSize;  UINTN                     Size;  EFI_DEVICE_PATH_PROTOCOL  *Dp;  OffSet = 0;  Size   = GetDevicePathSize (DevicePath);  //  // Check each device path.  //  while (OffSet < mAccessInfo.LoadForbidLen) {    Dp      = (EFI_DEVICE_PATH_PROTOCOL *) (mAccessInfo.LoadForbid + OffSet);    DPSize  = GetDevicePathSize (Dp);    //    // Compare device path.    //    if ((DPSize == Size) && (CompareMem (DevicePath, Dp, Size) == 0)) {      return TRUE;    }    OffSet += DPSize;  }  return FALSE;}
开发者ID:etiago,项目名称:vbox,代码行数:38,


示例2: Var_UpdateAllConsoleOption

/**  Update the device path of "ConOut", "ConIn" and "ErrOut"   based on the new BaudRate, Data Bits, parity and Stop Bits  set.**/VOIDVar_UpdateAllConsoleOption (  VOID  ){  EFI_DEVICE_PATH_PROTOCOL  *OutDevicePath;  EFI_DEVICE_PATH_PROTOCOL  *InpDevicePath;  EFI_DEVICE_PATH_PROTOCOL  *ErrDevicePath;  EFI_STATUS                Status;  OutDevicePath = EfiLibGetVariable (L"ConOut", &gEfiGlobalVariableGuid);  InpDevicePath = EfiLibGetVariable (L"ConIn", &gEfiGlobalVariableGuid);  ErrDevicePath = EfiLibGetVariable (L"ErrOut", &gEfiGlobalVariableGuid);  if (OutDevicePath != NULL) {    ChangeVariableDevicePath (OutDevicePath);    Status = gRT->SetVariable (                    L"ConOut",                    &gEfiGlobalVariableGuid,                    EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,                    GetDevicePathSize (OutDevicePath),                    OutDevicePath                    );    //    // Changing variable without increasing its size with current variable implementation shouldn't fail.    //    ASSERT_EFI_ERROR (Status);  }  if (InpDevicePath != NULL) {    ChangeVariableDevicePath (InpDevicePath);    Status = gRT->SetVariable (                    L"ConIn",                    &gEfiGlobalVariableGuid,                    EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,                    GetDevicePathSize (InpDevicePath),                    InpDevicePath                    );    //    // Changing variable without increasing its size with current variable implementation shouldn't fail.    //    ASSERT_EFI_ERROR (Status);  }  if (ErrDevicePath != NULL) {    ChangeVariableDevicePath (ErrDevicePath);    Status = gRT->SetVariable (                    L"ErrOut",                    &gEfiGlobalVariableGuid,                    EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,                    GetDevicePathSize (ErrDevicePath),                    ErrDevicePath                    );    //    // Changing variable without increasing its size with current variable implementation shouldn't fail.    //    ASSERT_EFI_ERROR (Status);  }}
开发者ID:jeyaramvrp,项目名称:edk2,代码行数:64,


示例3: Var_UpdateAllConsoleOption

/**  Update the device path of "ConOut", "ConIn" and "ErrOut"   based on the new BaudRate, Data Bits, parity and Stop Bits  set.**/VOIDVar_UpdateAllConsoleOption (  VOID  ){  EFI_DEVICE_PATH_PROTOCOL  *OutDevicePath;  EFI_DEVICE_PATH_PROTOCOL  *InpDevicePath;  EFI_DEVICE_PATH_PROTOCOL  *ErrDevicePath;  EFI_STATUS                Status;  GetEfiGlobalVariable2 (L"ConOut", (VOID**)&OutDevicePath, NULL);  GetEfiGlobalVariable2 (L"ConIn", (VOID**)&InpDevicePath, NULL);  GetEfiGlobalVariable2 (L"ErrOut", (VOID**)&ErrDevicePath, NULL);  if (OutDevicePath != NULL) {    ChangeVariableDevicePath (OutDevicePath);    Status = gRT->SetVariable (                    L"ConOut",                    &gEfiGlobalVariableGuid,                    VAR_FLAG,                    GetDevicePathSize (OutDevicePath),                    OutDevicePath                    );    ASSERT (!EFI_ERROR (Status));  }  if (InpDevicePath != NULL) {    ChangeVariableDevicePath (InpDevicePath);    Status = gRT->SetVariable (                    L"ConIn",                    &gEfiGlobalVariableGuid,                    VAR_FLAG,                    GetDevicePathSize (InpDevicePath),                    InpDevicePath                    );    ASSERT (!EFI_ERROR (Status));  }  if (ErrDevicePath != NULL) {    ChangeVariableDevicePath (ErrDevicePath);    Status = gRT->SetVariable (                    L"ErrOut",                    &gEfiGlobalVariableGuid,                    VAR_FLAG,                    GetDevicePathSize (ErrDevicePath),                    ErrDevicePath                    );    ASSERT (!EFI_ERROR (Status));  }}
开发者ID:RafaelRMachado,项目名称:edk2,代码行数:55,


示例4: Var_UpdateAllConsoleOption

/**  Update the device path of "ConOut", "ConIn" and "ErrOut"   based on the new BaudRate, Data Bits, parity and Stop Bits  set.**/VOIDVar_UpdateAllConsoleOption (  VOID  ){  EFI_DEVICE_PATH_PROTOCOL  *OutDevicePath;  EFI_DEVICE_PATH_PROTOCOL  *InpDevicePath;  EFI_DEVICE_PATH_PROTOCOL  *ErrDevicePath;  EFI_STATUS                Status;  OutDevicePath = EfiLibGetVariable (L"ConOut", &gEfiGlobalVariableGuid);  InpDevicePath = EfiLibGetVariable (L"ConIn", &gEfiGlobalVariableGuid);  ErrDevicePath = EfiLibGetVariable (L"ErrOut", &gEfiGlobalVariableGuid);  if (OutDevicePath != NULL) {    ChangeVariableDevicePath (OutDevicePath);    Status = gRT->SetVariable (                    L"ConOut",                    &gEfiGlobalVariableGuid,                    EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,                    GetDevicePathSize (OutDevicePath),                    OutDevicePath                    );    ASSERT (!EFI_ERROR (Status));  }  if (InpDevicePath != NULL) {    ChangeVariableDevicePath (InpDevicePath);    Status = gRT->SetVariable (                    L"ConIn",                    &gEfiGlobalVariableGuid,                    EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,                    GetDevicePathSize (InpDevicePath),                    InpDevicePath                    );    ASSERT (!EFI_ERROR (Status));  }  if (ErrDevicePath != NULL) {    ChangeVariableDevicePath (ErrDevicePath);    Status = gRT->SetVariable (                    L"ErrOut",                    &gEfiGlobalVariableGuid,                    EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,                    GetDevicePathSize (ErrDevicePath),                    ErrDevicePath                    );    ASSERT (!EFI_ERROR (Status));  }}
开发者ID:B-Rich,项目名称:edk2,代码行数:55,


示例5: IsDevicePathInList

/**  Check whether the image pointed to by DevicePath is in the device path list  specified by AccessType.  @param[in] DevicePath  Points to device path.  @param[in] AccessType  The type of user access control.  @retval    TURE        The DevicePath is in the specified List.  @retval    FALSE       The DevicePath is not in the specified List.**/BOOLEANIsDevicePathInList (  IN  CONST EFI_DEVICE_PATH_PROTOCOL   *DevicePath,  IN        UINT32                     AccessType  ){  EFI_STATUS                            Status;  EFI_USER_INFO_ACCESS_CONTROL          *Access;  EFI_DEVICE_PATH_PROTOCOL              *Path;  UINTN                                 OffSet;  Status = GetAccessControl (&Access, AccessType);  if (EFI_ERROR (Status)) {    return FALSE;  }  OffSet = 0;  while (OffSet < Access->Size - sizeof (EFI_USER_INFO_ACCESS_CONTROL)) {    Path = (EFI_DEVICE_PATH_PROTOCOL*)((UINT8*)(Access + 1) + OffSet);    if (CheckDevicePath (Path, DevicePath)) {      //      // The device path is found in list.      //      FreePool (Access);      return TRUE;    }    OffSet += GetDevicePathSize (Path);  }  FreePool (Access);  return FALSE;}
开发者ID:jeppeter,项目名称:vbox,代码行数:43,


示例6: GetUnalignedDevicePathSize

UINTNGetUnalignedDevicePathSize (  IN EFI_DEVICE_PATH* DevicePath  ){  UINTN Size;  EFI_DEVICE_PATH* AlignedDevicePath;  if ((UINTN)DevicePath & 0x1) {    AlignedDevicePath = DuplicateDevicePath (DevicePath);    Size = GetDevicePathSize (AlignedDevicePath);    FreePool (AlignedDevicePath);  } else {    Size = GetDevicePathSize (DevicePath);  }  return Size;}
开发者ID:hzhuang1,项目名称:uefi,代码行数:17,


示例7: GetDevicePathSizeProtocolInterface

/**  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.  @param  DevicePath                 A pointer to a device path data structure.  @return The size of a device path in bytes.**/UINTNEFIAPIGetDevicePathSizeProtocolInterface (  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath  ){  return GetDevicePathSize (DevicePath);}
开发者ID:etiago,项目名称:vbox,代码行数:19,


示例8: UpdateFdtPath

EFI_STATUSUpdateFdtPath (  IN LIST_ENTRY *BootOptionsList  ){  EFI_STATUS                Status;  UINTN                     FdtDevicePathSize;  BDS_SUPPORTED_DEVICE      *SupportedBootDevice;  EFI_DEVICE_PATH_PROTOCOL  *FdtDevicePathNodes;  EFI_DEVICE_PATH_PROTOCOL  *FdtDevicePath;  Status = SelectBootDevice (&SupportedBootDevice);  if (EFI_ERROR(Status)) {    Status = EFI_ABORTED;    goto EXIT;  }  // Create the specific device path node  Status = SupportedBootDevice->Support->CreateDevicePathNode (L"FDT blob", &FdtDevicePathNodes);  if (EFI_ERROR(Status)) {    Status = EFI_ABORTED;    goto EXIT;  }  if (FdtDevicePathNodes != NULL) {    // Append the Device Path node to the select device path    FdtDevicePath = AppendDevicePath (SupportedBootDevice->DevicePathProtocol, FdtDevicePathNodes);    FdtDevicePathSize = GetDevicePathSize (FdtDevicePath);    Status = gRT->SetVariable (                    (CHAR16*)L"Fdt",                    &gArmGlobalVariableGuid,                    EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,                    FdtDevicePathSize,                    FdtDevicePath                    );    ASSERT_EFI_ERROR(Status);  } else {    gRT->SetVariable (           (CHAR16*)L"Fdt",           &gArmGlobalVariableGuid,           EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,           0,           NULL           );    ASSERT_EFI_ERROR(Status);  }EXIT:  if (Status == EFI_ABORTED) {    Print(L"/n");  }  FreePool(SupportedBootDevice);  return Status;}
开发者ID:jian-tian,项目名称:UEFI,代码行数:54,


示例9: EfiCompareDevicePath

/**  Compare two device pathes to check if they are exactly same.  @param DevicePath1    A pointer to the first device path data structure.  @param DevicePath2    A pointer to the second device path data structure.  @retval TRUE    They are same.  @retval FALSE   They are not same.**/BOOLEANEfiCompareDevicePath (  IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,  IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2  ){  UINTN Size1;  UINTN Size2;  Size1 = GetDevicePathSize (DevicePath1);  Size2 = GetDevicePathSize (DevicePath2);  if (Size1 != Size2) {    return FALSE;  }  if (CompareMem (DevicePath1, DevicePath2, Size1) != 0) {    return FALSE;  }  return TRUE;}
开发者ID:AshleyDeSimone,项目名称:edk2,代码行数:32,


示例10: list

/**  Delete the specified device path by DriverIndex from the forbid device path   list (mAccessInfo.LoadForbid).  @param[in]  DriverIndex   The index of driver in forbidden device path list.  **/VOIDDeleteFromForbidLoad (  IN  UINT16                                    DriverIndex  ){  UINTN                     OffSet;  UINTN                     DPSize;  UINTN                     OffLen;  EFI_DEVICE_PATH_PROTOCOL  *Dp;  OffSet = 0;  //  // Find the specified device path.  //  while ((OffSet < mAccessInfo.LoadForbidLen) && (DriverIndex > 0)) {    Dp      = (EFI_DEVICE_PATH_PROTOCOL *) (mAccessInfo.LoadForbid + OffSet);    DPSize  = GetDevicePathSize (Dp);    OffSet += DPSize;    DriverIndex--;  }    //  // Specified device path found.  //  if (DriverIndex == 0) {    Dp      = (EFI_DEVICE_PATH_PROTOCOL *) (mAccessInfo.LoadForbid + OffSet);    DPSize  = GetDevicePathSize (Dp);    OffLen  = mAccessInfo.LoadForbidLen - OffSet - DPSize;    if (OffLen > 0) {      CopyMem (        mAccessInfo.LoadForbid + OffSet,         mAccessInfo.LoadForbid + OffSet + DPSize,         OffLen        );    }    mAccessInfo.LoadForbidLen -= DPSize;  }}
开发者ID:etiago,项目名称:vbox,代码行数:45,


示例11: ConnectAllAndCreateNetworkDeviceList

/**  Connect all the system drivers to controllers and create the network device list in NV storage.  @retval EFI_SUCCESS      Network devices are connected.  @retval EFI_DEVICE_ERROR No network device is connected.**/EFI_STATUSConnectAllAndCreateNetworkDeviceList (  VOID  ){  EFI_STATUS                      Status;  EFI_HANDLE                      *Handles;  UINTN                           HandleCount;  EFI_DEVICE_PATH_PROTOCOL        *SingleDevice;  EFI_DEVICE_PATH_PROTOCOL        *Devices;  EFI_DEVICE_PATH_PROTOCOL        *TempDevicePath;  EfiBootManagerConnectAll ();  Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiManagedNetworkServiceBindingProtocolGuid, NULL, &HandleCount, &Handles);  if (EFI_ERROR (Status)) {    Handles = NULL;    HandleCount = 0;  }  Devices = NULL;  while (HandleCount-- != 0) {    Status = gBS->HandleProtocol (Handles[HandleCount], &gEfiDevicePathProtocolGuid, (VOID **) &SingleDevice);    if (EFI_ERROR (Status) || (SingleDevice == NULL)) {      continue;    }    TempDevicePath = Devices;    Devices = AppendDevicePathInstance (Devices, SingleDevice);    if (TempDevicePath != NULL) {      FreePool (TempDevicePath);    }  }  if (Devices != NULL) {    Status = gRT->SetVariable (                    mNetworkDeviceList,                    &gEfiCallerIdGuid,                    EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,                    GetDevicePathSize (Devices),                    Devices                    );    //    // Fails to save the network device list to NV storage is not a fatal error.    // Only impact is performance.    //    FreePool (Devices);  }  return (Devices == NULL) ? EFI_DEVICE_ERROR : EFI_SUCCESS;}
开发者ID:lersek,项目名称:edk2,代码行数:57,


示例12: IsParentDevicePath

STATICBOOLEANIsParentDevicePath (  IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,  IN EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath  ){  UINTN ParentSize;  UINTN ChildSize;  ParentSize = GetDevicePathSize (ParentDevicePath);  ChildSize = GetDevicePathSize (ChildDevicePath);  if (ParentSize > ChildSize) {    return FALSE;  }  if (CompareMem (ParentDevicePath, ChildDevicePath, ParentSize - END_DEVICE_PATH_LENGTH) != 0) {    return FALSE;  }  return TRUE;}
开发者ID:hzhuang1,项目名称:uefi,代码行数:23,


示例13: Process

/**  Process (load and execute) the load option.  @param LoadOption  Pointer to the load option.  @retval EFI_INVALID_PARAMETER  The load option type is invalid,                                  or the load option file path doesn't point to a valid file.  @retval EFI_UNSUPPORTED        The load option type is of LoadOptionTypeBoot.  @retval EFI_SUCCESS            The load option is inactive, or successfully loaded and executed.**/EFI_STATUSEFIAPIEfiBootManagerProcessLoadOption (  IN EFI_BOOT_MANAGER_LOAD_OPTION       *LoadOption  ){  EFI_STATUS                        Status;  EFI_DEVICE_PATH_PROTOCOL          *FilePath;  EFI_HANDLE                        ImageHandle;  EFI_LOADED_IMAGE_PROTOCOL         *ImageInfo;  VOID                              *FileBuffer;  UINTN                             FileSize;  if ((UINT32) LoadOption->OptionType >= LoadOptionTypeMax) {    return EFI_INVALID_PARAMETER;  }  if (LoadOption->OptionType == LoadOptionTypeBoot) {    return EFI_UNSUPPORTED;  }  //  // If a load option is not marked as LOAD_OPTION_ACTIVE,  // the boot manager will not automatically load the option.  //  if ((LoadOption->Attributes & LOAD_OPTION_ACTIVE) == 0) {    return EFI_SUCCESS;  }  Status = EFI_INVALID_PARAMETER;  //  // Load and start the load option.  //  DEBUG ((    DEBUG_INFO | DEBUG_LOAD, "Process Load Option (%s%04x) .../n",    mBmLoadOptionName[LoadOption->OptionType], LoadOption->OptionNumber    ));  ImageHandle = NULL;  FileBuffer = BmGetLoadOptionBuffer (LoadOption->FilePath, &FilePath, &FileSize);  DEBUG_CODE (    if (FileBuffer != NULL && CompareMem (LoadOption->FilePath, FilePath, GetDevicePathSize (FilePath)) != 0) {      DEBUG ((EFI_D_INFO, "[Bds] DevicePath expand: "));      BmPrintDp (LoadOption->FilePath);      DEBUG ((EFI_D_INFO, " -> "));      BmPrintDp (FilePath);      DEBUG ((EFI_D_INFO, "/n"));    }  );
开发者ID:Acidburn0zzz,项目名称:edk2-MdeModulePkg,代码行数:59,


示例14: BdsLibDelPartMatchInstance

EFIAPIBdsLibDelPartMatchInstance (  IN     EFI_DEVICE_PATH_PROTOCOL  *Multi,  IN     EFI_DEVICE_PATH_PROTOCOL  *Single  ){  EFI_DEVICE_PATH_PROTOCOL  *Instance;  EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;  EFI_DEVICE_PATH_PROTOCOL  *TempNewDevicePath;  UINTN                     InstanceSize;  UINTN                     SingleDpSize;  UINTN                     Size;  NewDevicePath     = NULL;  TempNewDevicePath = NULL;  if (Multi == NULL || Single == NULL) {    return Multi;  }  Instance        =  GetNextDevicePathInstance (&Multi, &InstanceSize);  SingleDpSize    =  GetDevicePathSize (Single) - END_DEVICE_PATH_LENGTH;  InstanceSize    -= END_DEVICE_PATH_LENGTH;  while (Instance != NULL) {    Size = (SingleDpSize < InstanceSize) ? SingleDpSize : InstanceSize;    if ((CompareMem (Instance, Single, Size) != 0)) {      //      // Append the device path instance which does not match with Single      //      TempNewDevicePath = NewDevicePath;      NewDevicePath = AppendDevicePathInstance (NewDevicePath, Instance);      if (TempNewDevicePath != NULL) {        FreePool(TempNewDevicePath);      }    }    FreePool(Instance);    Instance = GetNextDevicePathInstance (&Multi, &InstanceSize);    InstanceSize  -= END_DEVICE_PATH_LENGTH;  }  return NewDevicePath;}
开发者ID:jief666,项目名称:clover,代码行数:45,


示例15: PutDefferedImageInfo

/**  Add the image info to a deferred image list.  @param[in]  ImageDevicePath  A pointer to the device path of a image.  @param[in]  Image            Points to the first byte of the image, or NULL if the                               image is not available.  @param[in]  ImageSize        The size of the image, or 0 if the image is not available.**/VOIDPutDefferedImageInfo (  IN  CONST EFI_DEVICE_PATH_PROTOCOL    *ImageDevicePath,  IN        VOID                        *Image,  IN        UINTN                       ImageSize  ){  DEFERRED_IMAGE_INFO    *CurImageInfo;  UINTN                  PathSize;  //  // Expand memory for the new deferred image.  //  if (mDeferredImage.Count == 0) {    mDeferredImage.ImageInfo = AllocatePool (sizeof (DEFERRED_IMAGE_INFO));    ASSERT (mDeferredImage.ImageInfo != NULL);  } else {    CurImageInfo = AllocatePool ((mDeferredImage.Count + 1) * sizeof (DEFERRED_IMAGE_INFO));    ASSERT (CurImageInfo != NULL);    CopyMem (      CurImageInfo,      mDeferredImage.ImageInfo,      mDeferredImage.Count * sizeof (DEFERRED_IMAGE_INFO)      );    FreePool (mDeferredImage.ImageInfo);    mDeferredImage.ImageInfo = CurImageInfo;  }  mDeferredImage.Count++;  //  // Save the deferred image information.  //  CurImageInfo = &mDeferredImage.ImageInfo[mDeferredImage.Count - 1];  PathSize     = GetDevicePathSize (ImageDevicePath);  CurImageInfo->ImageDevicePath = AllocateZeroPool (PathSize);  ASSERT (CurImageInfo->ImageDevicePath != NULL);  CopyMem (CurImageInfo->ImageDevicePath, ImageDevicePath, PathSize);  CurImageInfo->Image      = Image;  CurImageInfo->ImageSize  = ImageSize;  CurImageInfo->BootOption = IsBootOption (ImageDevicePath);}
开发者ID:jeppeter,项目名称:vbox,代码行数:52,


示例16: UefiDevicePathLibDuplicateDevicePath

EFIAPIUefiDevicePathLibDuplicateDevicePath (  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath  ){  UINTN                     Size;  //  // Compute the size  //  Size = GetDevicePathSize (DevicePath);  if (Size == 0) {    return NULL;  }  //  // Allocate space for duplicate device path  //  return AllocateCopyPool (Size, DevicePath);}
开发者ID:shijunjing,项目名称:edk2,代码行数:21,


示例17: PlatformFindLoadOption

/**  Return the index of the load option in the load option array.  The function consider two load options are equal when the   OptionType, Attributes, Description, FilePath and OptionalData are equal.  @param Key    Pointer to the load option to be found.  @param Array  Pointer to the array of load options to be found.  @param Count  Number of entries in the Array.  @retval -1          Key wasn't found in the Array.  @retval 0 ~ Count-1 The index of the Key in the Array.**/INTNPlatformFindLoadOption (  IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key,  IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array,  IN UINTN                              Count  ){  UINTN                             Index;  for (Index = 0; Index < Count; Index++) {    if ((Key->OptionType == Array[Index].OptionType) &&        (Key->Attributes == Array[Index].Attributes) &&        (StrCmp (Key->Description, Array[Index].Description) == 0) &&        (CompareMem (Key->FilePath, Array[Index].FilePath, GetDevicePathSize (Key->FilePath)) == 0) &&        (Key->OptionalDataSize == Array[Index].OptionalDataSize) &&        (CompareMem (Key->OptionalData, Array[Index].OptionalData, Key->OptionalDataSize) == 0)) {      return (INTN) Index;    }  }  return -1;}
开发者ID:ozbenh,项目名称:edk2,代码行数:35,


示例18: GlueDuplicateDevicePath

EFIAPIGlueDuplicateDevicePath (  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath  ){  EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;  UINTN                     Size;  //  // Compute the size  //  Size = GetDevicePathSize (DevicePath);  if (Size == 0) {    return NULL;  }  //  // Allocate space for duplicate device path  //  NewDevicePath = AllocateCopyPool (Size, DevicePath);  return NewDevicePath;}
开发者ID:hsienchieh,项目名称:uefilab,代码行数:23,


示例19: BdsPlatformAddBootableImage

VOIDBdsPlatformAddBootableImage (  IN  CHAR16                    *NameString,  IN  EFI_DEVICE_PATH_PROTOCOL  *FileDevicePath  ){  UINTN  Size;  UINTN  Index;  if (mDefaultBootOptionsCount >= mDefaultBootOptionsMaxCount) {    if (mDefaultBootOptionsMaxCount == 0) {      // Very first time set a default size      mDefaultBootOptionsMaxCount = 4;    }    Size = mDefaultBootOptionsMaxCount * sizeof (EFI_BOOT_MANAGER_BOOT_OPTION);    mDefaultBootOptions = ReallocateCopyPool (Size * 2, Size, mDefaultBootOptions);    mDefaultBootOptionsMaxCount *= 2;  }    for (Index = 0; Index < mDefaultBootOptionsCount; Index++ ) {    //    // If the boot option has already in buffer, don't add it.    //    if (!CompareMem (&mDefaultBootOptions[Index].FilePath, FileDevicePath, GetDevicePathSize (FileDevicePath))){      return;    }  }  EfiBootManagerInitializeBootOption (    &mDefaultBootOptions[mDefaultBootOptionsCount++],    NameString,    FileDevicePath,    LOAD_OPTION_ACTIVE,    NULL,    0    );}
开发者ID:RafaelRMachado,项目名称:MinnowBoard,代码行数:37,


示例20: EfiBootManagerLoadOptionToVariable

/**  Create the Boot####, Driver####, SysPrep####, variable from the load option.    @param  LoadOption      Pointer to the load option.  @retval EFI_SUCCESS     The variable was created.  @retval Others          Error status returned by RT->SetVariable.**/EFI_STATUSEFIAPIEfiBootManagerLoadOptionToVariable (  IN CONST EFI_BOOT_MANAGER_LOAD_OPTION     *Option  ){  UINTN                            VariableSize;  UINT8                            *Variable;  UINT8                            *Ptr;  CHAR16                           OptionName[BM_OPTION_NAME_LEN];  CHAR16                           *Description;  CHAR16                           NullChar;  UINT32                           VariableAttributes;  if ((Option->OptionNumber == LoadOptionNumberUnassigned) ||      (Option->FilePath == NULL) ||      ((UINT32) Option->OptionType >= LoadOptionTypeMax)     ) {    return EFI_INVALID_PARAMETER;  }  //  // Convert NULL description to empty description  //  NullChar    = L'/0';  Description = Option->Description;  if (Description == NULL) {    Description = &NullChar;  }  /*  UINT32                      Attributes;  UINT16                      FilePathListLength;  CHAR16                      Description[];  EFI_DEVICE_PATH_PROTOCOL    FilePathList[];  UINT8                       OptionalData[];TODO: FilePathList[] IS:A packed array of UEFI device paths.  The first element of the array is a device path that describes the device and location of the Image for this load option.  The FilePathList[0] is specific to the device type.  Other device paths may optionally exist in the FilePathList, but their usage is OSV specific. Each element in the array is variable length, and ends at the device path end structure.  */  VariableSize = sizeof (Option->Attributes)               + sizeof (UINT16)               + StrSize (Description)               + GetDevicePathSize (Option->FilePath)               + Option->OptionalDataSize;  Variable     = AllocatePool (VariableSize);  ASSERT (Variable != NULL);  Ptr             = Variable;  WriteUnaligned32 ((UINT32 *) Ptr, Option->Attributes);  Ptr            += sizeof (Option->Attributes);  WriteUnaligned16 ((UINT16 *) Ptr, (UINT16) GetDevicePathSize (Option->FilePath));  Ptr            += sizeof (UINT16);  CopyMem (Ptr, Description, StrSize (Description));  Ptr            += StrSize (Description);  CopyMem (Ptr, Option->FilePath, GetDevicePathSize (Option->FilePath));  Ptr            += GetDevicePathSize (Option->FilePath);  CopyMem (Ptr, Option->OptionalData, Option->OptionalDataSize);  UnicodeSPrint (OptionName, sizeof (OptionName), L"%s%04x", mBmLoadOptionName[Option->OptionType], Option->OptionNumber);  VariableAttributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;  return gRT->SetVariable (                OptionName,                &gEfiGlobalVariableGuid,                VariableAttributes,                VariableSize,                Variable                );}
开发者ID:Acidburn0zzz,项目名称:edk2-MdeModulePkg,代码行数:89,


示例21: LinuxLoaderConfig

//.........这里部分代码省略.........  }  if (Choice == LINUX_LOADER_NEW) {    Description[0] = '/0';    CmdLine[0]     = '/0';    Initrd[0]      = '/0';    BdsLoadOption = (BDS_LOAD_OPTION*)AllocateZeroPool (sizeof(BDS_LOAD_OPTION));    DEBUG_CODE_BEGIN();      CHAR16*                           DevicePathTxt;      EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;      Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);      ASSERT_EFI_ERROR(Status);      DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (LoadedImage->FilePath, TRUE, TRUE);      Print(L"EFI OS Loader: %s/n",DevicePathTxt);      FreePool(DevicePathTxt);    DEBUG_CODE_END();    //    // Fill the known fields of BdsLoadOption    //    BdsLoadOption->Attributes = LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT;    // Get the full Device Path for this file    Status = gBS->HandleProtocol (LoadedImage->DeviceHandle, &gEfiDevicePathProtocolGuid, (VOID **)&DevicePathRoot);    ASSERT_EFI_ERROR(Status);    BdsLoadOption->FilePathList = AppendDevicePath (DevicePathRoot, LoadedImage->FilePath);    BdsLoadOption->FilePathListLength = GetDevicePathSize (BdsLoadOption->FilePathList);  } else {    if (SupportedBdsLoadOptionCount > 1) {      for (Index = 0; Index < SupportedBdsLoadOptionCount; Index++) {        Print (L"[%d] %s/n",Index + 1,SupportedBdsLoadOptions[Index]->Description);      }      do {        Print (L"Update Boot Entry: ");        Status = GetHIInputInteger ((UINTN*)&Choice);        if (Status == EFI_INVALID_PARAMETER) {          Print (L"/n");          return Status;        } else if ((Choice < 1) && (Choice > SupportedBdsLoadOptionCount)) {          Print (L"Choose entry from 1 to %d/n",SupportedBdsLoadOptionCount);          Status = EFI_INVALID_PARAMETER;        }      } while (EFI_ERROR(Status));      BdsLoadOption = SupportedBdsLoadOptions[Choice-1];    }    StrnCpy (Description, BdsLoadOption->Description, MAX_STR_INPUT);    LinuxOptionalData = (LINUX_LOADER_OPTIONAL_DATA*)BdsLoadOption->OptionalData;    if (LinuxOptionalData->CmdLineLength > 0) {      CopyMem (CmdLine, (CHAR8*)LinuxOptionalData + sizeof(LINUX_LOADER_OPTIONAL_DATA), LinuxOptionalData->CmdLineLength);    } else {      CmdLine[0] = '/0';    }    if (LinuxOptionalData->InitrdPathListLength > 0) {      CopyMem (Initrd, (CHAR8*)LinuxOptionalData + sizeof(LINUX_LOADER_OPTIONAL_DATA) + LinuxOptionalData->CmdLineLength, LinuxOptionalData->InitrdPathListLength);    } else {      Initrd[0] = L'/0';
开发者ID:B-Rich,项目名称:edk2,代码行数:67,


示例22: ASSERT

/**  Check whether the DevicePath2 is identical with DevicePath1, or identical with  DevicePath1's child device path.  If DevicePath2 is identical with DevicePath1, or with DevicePath1's child device  path, then TRUE returned. Otherwise, FALSE is returned.  If DevicePath1 is NULL, then ASSERT().  If DevicePath2 is NULL, then ASSERT().  @param[in]  DevicePath1   A pointer to a device path.  @param[in]  DevicePath2   A pointer to a device path.  @retval     TRUE          Two device paths are identical , or DevicePath2 is                            DevicePath1's child device path.  @retval     FALSE         Two device paths are not identical, and DevicePath2                            is not DevicePath1's child device path.**/BOOLEANCheckDevicePath (  IN  CONST EFI_DEVICE_PATH_PROTOCOL          *DevicePath1,  IN  CONST EFI_DEVICE_PATH_PROTOCOL          *DevicePath2  ){  UINTN                                       DevicePathSize;  UINTN                                       FileNameSize1;  UINTN                                       FileNameSize2;  UINT8                                       *FileName1;  UINT8                                       *FileName2;  UINTN                                       FileNameOffset1;  UINTN                                       FileNameOffset2;  BOOLEAN                                     DevicePathEqual;  FileName1       = NULL;  FileName2       = NULL;  DevicePathEqual = TRUE;  ASSERT (DevicePath1 != NULL);  ASSERT (DevicePath2 != NULL);  if (IsDevicePathEnd (DevicePath1)) {    return FALSE;  }  //  // The file name may contain one or more device path node.  // To compare the file name, copy file name to a buffer and compare the buffer.  //  FileNameSize1 = GetFileName (DevicePath1, &FileName1, &FileNameOffset1);  if (FileNameSize1 != 0) {    FileNameSize2 = GetFileName (DevicePath2, &FileName2, &FileNameOffset2);    if (FileNameOffset1 != FileNameOffset2) {      DevicePathEqual = FALSE;      goto Done;    }    if (CompareMem (DevicePath1, DevicePath2, FileNameOffset1) != 0) {      DevicePathEqual = FALSE;      goto Done;    }    if (FileNameSize1 > FileNameSize2) {      DevicePathEqual = FALSE;      goto Done;    }    if (CompareMem (FileName1, FileName2, FileNameSize1) != 0) {      DevicePathEqual = FALSE;      goto Done;    }    DevicePathEqual = TRUE;    goto Done;  }  DevicePathSize = GetDevicePathSize (DevicePath1);  if (DevicePathSize > GetDevicePathSize (DevicePath2)) {    return FALSE;  }  //  // Exclude the end of device path node.  //  DevicePathSize -= sizeof (EFI_DEVICE_PATH_PROTOCOL);  if (CompareMem (DevicePath1, DevicePath2, DevicePathSize) != 0) {    DevicePathEqual = FALSE;  }Done:  if (FileName1 != NULL) {    FreePool (FileName1);  }  if (FileName2 != NULL) {    FreePool (FileName2);  }  return DevicePathEqual;}
开发者ID:jeppeter,项目名称:vbox,代码行数:93,


示例23: GetGopDevicePath

EFI_STATUSGetGopDevicePath (   IN  EFI_DEVICE_PATH_PROTOCOL *PciDevicePath,   OUT EFI_DEVICE_PATH_PROTOCOL **GopDevicePath   ){  UINTN                           Index;  EFI_STATUS                      Status;  EFI_HANDLE                      PciDeviceHandle;  EFI_DEVICE_PATH_PROTOCOL        *TempDevicePath;  EFI_DEVICE_PATH_PROTOCOL        *TempPciDevicePath;  UINTN                           GopHandleCount;  EFI_HANDLE                      *GopHandleBuffer;  if (PciDevicePath == NULL || GopDevicePath == NULL) {    return EFI_INVALID_PARAMETER;  }  //  // Initialize the GopDevicePath to be PciDevicePath  //  *GopDevicePath    = PciDevicePath;  TempPciDevicePath = PciDevicePath;  Status = gBS->LocateDevicePath (                  &gEfiDevicePathProtocolGuid,                  &TempPciDevicePath,                  &PciDeviceHandle                  );  if (EFI_ERROR (Status)) {    return Status;  }  //  // Try to connect this handle, so that GOP dirver could start on this  // device and create child handles with GraphicsOutput Protocol installed  // on them, then we get device paths of these child handles and select  // them as possible console device.  //  gBS->ConnectController (PciDeviceHandle, NULL, NULL, FALSE);  Status = gBS->LocateHandleBuffer (                  ByProtocol,                  &gEfiGraphicsOutputProtocolGuid,                  NULL,                  &GopHandleCount,                  &GopHandleBuffer                  );  if (!EFI_ERROR (Status)) {    //    // Add all the child handles as possible Console Device    //    for (Index = 0; Index < GopHandleCount; Index++) {      Status = gBS->HandleProtocol (GopHandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID*)&TempDevicePath);      if (EFI_ERROR (Status)) {        continue;      }      if (CompareMem (            PciDevicePath,            TempDevicePath,            GetDevicePathSize (PciDevicePath) - END_DEVICE_PATH_LENGTH            ) == 0) {        //        // In current implementation, we only enable one of the child handles        // as console device, i.e. sotre one of the child handle's device        // path to variable "ConOut"        // In futhure, we could select all child handles to be console device        //        *GopDevicePath = TempDevicePath;        //        // Delete the PCI device's path that added by GetPlugInPciVgaDevicePath()        // Add the integrity GOP device path.        //        BdsLibUpdateConsoleVariable (VarConsoleOutDev, NULL, PciDevicePath);        BdsLibUpdateConsoleVariable (VarConsoleOutDev, TempDevicePath, NULL);      }    }    gBS->FreePool (GopHandleBuffer);  }  return EFI_SUCCESS;}
开发者ID:jeppeter,项目名称:vbox,代码行数:84,


示例24: BdsLibRegisterNewOption

//.........这里部分代码省略.........    if (*VariableName == 'B') {      UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", TempOptionPtr[Index]);    } else {      UnicodeSPrint (OptionName, sizeof (OptionName), L"Driver%04x", TempOptionPtr[Index]);    }    OptionPtr = BdsLibGetVariableAndSize (                  OptionName,                  &gEfiGlobalVariableGuid,                  &OptionSize                  );    if (OptionPtr == NULL) {      continue;    }    //    // Validate the variable.    //    if (!ValidateOption(OptionPtr, OptionSize)) {      FreePool(OptionPtr);      continue;    }    TempPtr         =   OptionPtr;    TempPtr         +=  sizeof (UINT32) + sizeof (UINT16);    Description     =   (CHAR16 *) TempPtr;    TempPtr         +=  StrSize ((CHAR16 *) TempPtr);    OptionDevicePath =  (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;    //    // Notes: the description may will change base on the GetStringToken    //    if (CompareMem (OptionDevicePath, DevicePath, GetDevicePathSize (OptionDevicePath)) == 0) {      if (CompareMem (Description, String, StrSize (Description)) == 0) {         //        // Got the option, so just return        //        FreePool (OptionPtr);        FreePool (TempOptionPtr);        return EFI_SUCCESS;      } else {        //        // Option description changed, need update.        //        UpdateDescription = TRUE;        FreePool (OptionPtr);        break;      }    }    FreePool (OptionPtr);  }  OptionSize          = sizeof (UINT32) + sizeof (UINT16) + StrSize (String);  OptionSize          += GetDevicePathSize (DevicePath);  OptionPtr           = AllocateZeroPool (OptionSize);//  ASSERT (OptionPtr != NULL);  if (!OptionPtr) {    return EFI_OUT_OF_RESOURCES;  }    TempPtr             = OptionPtr;  *(UINT32 *) TempPtr = LOAD_OPTION_ACTIVE;  TempPtr             += sizeof (UINT32);  *(UINT16 *) TempPtr = (UINT16) GetDevicePathSize (DevicePath);
开发者ID:jief666,项目名称:clover,代码行数:67,


示例25: BdsLibVariableToOption

EFIAPIBdsLibVariableToOption (  IN OUT LIST_ENTRY                   *BdsCommonOptionList,  IN  CHAR16                          *VariableName  ){  UINT32                    Attribute;  UINT16                    FilePathSize;  UINT8                     *Variable;  UINT8                     *TempPtr;  UINTN                     VariableSize;  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;  BDS_COMMON_OPTION         *Option;  VOID                      *LoadOptions;  UINT32                    LoadOptionsSize;  CHAR16                    *Description;  UINT8                     NumOff;  //  // Read the variable. We will never free this data.  //  Variable = BdsLibGetVariableAndSize (              VariableName,              &gEfiGlobalVariableGuid,              &VariableSize              );  if (Variable == NULL) {    return NULL;  }  //  // Validate Boot#### variable data.  //  if (!ValidateOption(Variable, VariableSize)) {    FreePool (Variable);    return NULL;  }  //  // Notes: careful defined the variable of Boot#### or  // Driver####, consider use some macro to abstract the code  //  //  // Get the option attribute  //  TempPtr   =  Variable;  Attribute =  *(UINT32 *) Variable;  TempPtr   += sizeof (UINT32);  //  // Get the option's device path size  //  FilePathSize =  *(UINT16 *) TempPtr;  TempPtr      += sizeof (UINT16);  //  // Get the option's description string  //  Description = (CHAR16 *) TempPtr;  //  // Get the option's description string size  //  TempPtr += StrSize((CHAR16 *) TempPtr);  //  // Get the option's device path  //  DevicePath =  (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;  TempPtr    += FilePathSize;  //  // Get load opion data.  //  LoadOptions     = TempPtr;  LoadOptionsSize = (UINT32) (VariableSize - (UINTN) (TempPtr - Variable));  //  // The Console variables may have multiple device paths, so make  // an Entry for each one.  //  Option = AllocateZeroPool (sizeof (BDS_COMMON_OPTION));  if (Option == NULL) {    FreePool (Variable);    return NULL;  }  Option->Signature   = BDS_LOAD_OPTION_SIGNATURE;  Option->DevicePath  = AllocateCopyPool (GetDevicePathSize (DevicePath), DevicePath);//  ASSERT(Option->DevicePath != NULL);  if (!Option->DevicePath) {    FreePool (Option);    return NULL;  }//  CopyMem (Option->DevicePath, DevicePath, GetDevicePathSize (DevicePath));  Option->Attribute   = Attribute;  Option->Description = AllocateCopyPool (StrSize (Description), Description);//  ASSERT(Option->Description != NULL);  if (!Option->Description) {//.........这里部分代码省略.........
开发者ID:jief666,项目名称:clover,代码行数:101,


示例26: GetConsoleDevicePathFromVariable

STATICEFI_STATUSGetConsoleDevicePathFromVariable (  IN  CHAR16*             ConsoleVarName,  IN  CHAR16*             DefaultConsolePaths,  OUT EFI_DEVICE_PATH**   DevicePaths  ){  EFI_STATUS                Status;  UINTN                     Size;  EFI_DEVICE_PATH_PROTOCOL* DevicePathInstances;  EFI_DEVICE_PATH_PROTOCOL* DevicePathInstance;  CHAR16*                   DevicePathStr;  CHAR16*                   NextDevicePathStr;  EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL  *EfiDevicePathFromTextProtocol;  Status = GetGlobalEnvironmentVariable (ConsoleVarName, NULL, NULL, (VOID**)&DevicePathInstances);  if (EFI_ERROR(Status)) {    // In case no default console device path has been defined we assume a driver handles the console (eg: SimpleTextInOutSerial)    if ((DefaultConsolePaths == NULL) || (DefaultConsolePaths[0] == L'/0')) {      *DevicePaths = NULL;      return EFI_SUCCESS;    }    Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);    ASSERT_EFI_ERROR(Status);    DevicePathInstances = NULL;    // Extract the Device Path instances from the multi-device path string    while ((DefaultConsolePaths != NULL) && (DefaultConsolePaths[0] != L'/0')) {      NextDevicePathStr = StrStr (DefaultConsolePaths, L";");      if (NextDevicePathStr == NULL) {        DevicePathStr = DefaultConsolePaths;        DefaultConsolePaths = NULL;      } else {        DevicePathStr = (CHAR16*)AllocateCopyPool ((NextDevicePathStr - DefaultConsolePaths + 1) * sizeof(CHAR16), DefaultConsolePaths);        *(DevicePathStr + (NextDevicePathStr - DefaultConsolePaths)) = L'/0';        DefaultConsolePaths = NextDevicePathStr;        if (DefaultConsolePaths[0] == L';') {          DefaultConsolePaths++;        }      }      DevicePathInstance = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (DevicePathStr);      ASSERT(DevicePathInstance != NULL);      DevicePathInstances = AppendDevicePathInstance (DevicePathInstances, DevicePathInstance);      if (NextDevicePathStr != NULL) {        FreePool (DevicePathStr);      }      FreePool (DevicePathInstance);    }    // Set the environment variable with this device path multi-instances    Size = GetDevicePathSize (DevicePathInstances);    if (Size > 0) {      gRT->SetVariable (          ConsoleVarName,          &gEfiGlobalVariableGuid,          EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,          Size,          DevicePathInstances          );    } else {      Status = EFI_INVALID_PARAMETER;    }  }  if (!EFI_ERROR(Status)) {    *DevicePaths = DevicePathInstances;  }  return Status;}
开发者ID:binsys,项目名称:VisualUefi,代码行数:74,


示例27: Var_UpdateBootOption

/**  This function create a currently loaded Boot Option from   the BMM. It then appends this Boot Option to the end of   the "BootOrder" list. It also append this Boot Opotion to the end  of BootOptionMenu.  @param CallbackData    The BMM context data.  @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.  @retval EFI_SUCCESS          If function completes successfully.**/EFI_STATUSVar_UpdateBootOption (  IN  BMM_CALLBACK_DATA              *CallbackData  ){  UINT16          *BootOrderList;  UINT16          *NewBootOrderList;  UINTN           BootOrderListSize;  UINT16          BootString[10];  VOID            *Buffer;  UINTN           BufferSize;  UINT8           *Ptr;  UINT16          Index;  BM_MENU_ENTRY   *NewMenuEntry;  BM_LOAD_CONTEXT *NewLoadContext;  BOOLEAN         OptionalDataExist;  EFI_STATUS      Status;  BMM_FAKE_NV_DATA  *NvRamMap;  OptionalDataExist = FALSE;  NvRamMap = &CallbackData->BmmFakeNvData;  Index = BOpt_GetBootOptionNumber () ;  UnicodeSPrint (BootString, sizeof (BootString), L"Boot%04x", Index);  if (NvRamMap->BootDescriptionData[0] == 0x0000) {    StrCpyS (NvRamMap->BootDescriptionData, sizeof (NvRamMap->BootDescriptionData) / sizeof (NvRamMap->BootDescriptionData[0]), BootString);  }  BufferSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (NvRamMap->BootDescriptionData);  BufferSize += GetDevicePathSize (CallbackData->LoadContext->FilePathList);  if (NvRamMap->BootOptionalData[0] != 0x0000) {    OptionalDataExist = TRUE;    BufferSize += StrSize (NvRamMap->BootOptionalData);  }  Buffer = AllocateZeroPool (BufferSize);  if (NULL == Buffer) {    return EFI_OUT_OF_RESOURCES;  }  NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);  if (NULL == NewMenuEntry) {    return EFI_OUT_OF_RESOURCES;  }  NewLoadContext                  = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;  NewLoadContext->Deleted         = FALSE;  NewLoadContext->LoadOptionSize  = BufferSize;  Ptr = (UINT8 *) Buffer;  NewLoadContext->LoadOption = Ptr;  *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE;  NewLoadContext->Attributes = *((UINT32 *) Ptr);  NewLoadContext->IsActive = TRUE;  NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);  Ptr += sizeof (UINT32);  *((UINT16 *) Ptr) = (UINT16) GetDevicePathSize (CallbackData->LoadContext->FilePathList);  NewLoadContext->FilePathListLength = *((UINT16 *) Ptr);  Ptr += sizeof (UINT16);  CopyMem (    Ptr,    NvRamMap->BootDescriptionData,    StrSize (NvRamMap->BootDescriptionData)    );  NewLoadContext->Description = AllocateZeroPool (StrSize (NvRamMap->BootDescriptionData));  ASSERT (NewLoadContext->Description != NULL);  NewMenuEntry->DisplayString = NewLoadContext->Description;  CopyMem (    NewLoadContext->Description,    (VOID *) Ptr,    StrSize (NvRamMap->BootDescriptionData)    );  Ptr += StrSize (NvRamMap->BootDescriptionData);  CopyMem (    Ptr,    CallbackData->LoadContext->FilePathList,    GetDevicePathSize (CallbackData->LoadContext->FilePathList)    );  NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));  ASSERT (NewLoadContext->FilePathList != NULL);//.........这里部分代码省略.........
开发者ID:RafaelRMachado,项目名称:edk2,代码行数:101,


示例28: Var_UpdateDriverOption

/**  This function create a currently loaded Drive Option from   the BMM. It then appends this Driver Option to the end of   the "DriverOrder" list. It append this Driver Opotion to the end  of DriverOptionMenu.  @param CallbackData    The BMM context data.  @param HiiHandle       The HII handle associated with the BMM formset.  @param DescriptionData The description of this driver option.  @param OptionalData    The optional load option.  @param ForceReconnect  If to force reconnect.  @retval EFI_OUT_OF_RESOURCES If not enought memory to complete the operation.  @retval EFI_SUCCESS          If function completes successfully.**/EFI_STATUSVar_UpdateDriverOption (  IN  BMM_CALLBACK_DATA         *CallbackData,  IN  EFI_HII_HANDLE            HiiHandle,  IN  UINT16                    *DescriptionData,  IN  UINT16                    *OptionalData,  IN  UINT8                     ForceReconnect  ){  UINT16          Index;  UINT16          *DriverOrderList;  UINT16          *NewDriverOrderList;  UINT16          DriverString[12];  UINTN           DriverOrderListSize;  VOID            *Buffer;  UINTN           BufferSize;  UINT8           *Ptr;  BM_MENU_ENTRY   *NewMenuEntry;  BM_LOAD_CONTEXT *NewLoadContext;  BOOLEAN         OptionalDataExist;  EFI_STATUS      Status;  OptionalDataExist = FALSE;  Index             = BOpt_GetDriverOptionNumber ();  UnicodeSPrint (    DriverString,    sizeof (DriverString),    L"Driver%04x",    Index    );  if (*DescriptionData == 0x0000) {    StrCpyS (DescriptionData, MAX_MENU_NUMBER, DriverString);  }  BufferSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (DescriptionData);  BufferSize += GetDevicePathSize (CallbackData->LoadContext->FilePathList);  if (*OptionalData != 0x0000) {    OptionalDataExist = TRUE;    BufferSize += StrSize (OptionalData);  }  Buffer = AllocateZeroPool (BufferSize);  if (NULL == Buffer) {    return EFI_OUT_OF_RESOURCES;  }  NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);  if (NULL == NewMenuEntry) {    FreePool (Buffer);    return EFI_OUT_OF_RESOURCES;  }  NewLoadContext                  = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;  NewLoadContext->Deleted         = FALSE;  NewLoadContext->LoadOptionSize  = BufferSize;  Ptr = (UINT8 *) Buffer;  NewLoadContext->LoadOption = Ptr;  *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE | (ForceReconnect << 1);  NewLoadContext->Attributes = *((UINT32 *) Ptr);  NewLoadContext->IsActive = TRUE;  NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);  Ptr += sizeof (UINT32);  *((UINT16 *) Ptr) = (UINT16) GetDevicePathSize (CallbackData->LoadContext->FilePathList);  NewLoadContext->FilePathListLength = *((UINT16 *) Ptr);  Ptr += sizeof (UINT16);  CopyMem (    Ptr,    DescriptionData,    StrSize (DescriptionData)    );  NewLoadContext->Description = AllocateZeroPool (StrSize (DescriptionData));  ASSERT (NewLoadContext->Description != NULL);  NewMenuEntry->DisplayString = NewLoadContext->Description;  CopyMem (    NewLoadContext->Description,    (VOID *) Ptr,    StrSize (DescriptionData)    );//.........这里部分代码省略.........
开发者ID:RafaelRMachado,项目名称:edk2,代码行数:101,


示例29: 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,



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


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