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

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

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

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

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

示例1: BmGetDevicePathSizeEx

/**  Returns the size of a device path in bytes.  This function returns the size, in bytes, of the device path data structure   specified by DevicePath including the end of device path node. If DevicePath   is NULL, then 0 is returned. If the length of the device path is bigger than  MaxSize, also return 0 to indicate this is an invalidate device path.  @param  DevicePath         A pointer to a device path data structure.  @param  MaxSize            Max valid device path size. If big than this size,                              return error.    @retval 0                  An invalid device path.  @retval Others             The size of a device path in bytes.**/UINTNBmGetDevicePathSizeEx (  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath,  IN UINTN                           MaxSize  ){  UINTN  Size;  UINTN  NodeSize;  if (DevicePath == NULL) {    return 0;  }  //  // Search for the end of the device path structure  //  Size = 0;  while (!IsDevicePathEnd (DevicePath)) {    NodeSize = DevicePathNodeLength (DevicePath);    if (NodeSize == 0) {      return 0;    }    Size += NodeSize;    if (Size > MaxSize) {      return 0;    }    DevicePath = NextDevicePathNode (DevicePath);  }  Size += DevicePathNodeLength (DevicePath);  if (Size > MaxSize) {    return 0;  }  return Size;}
开发者ID:Acidburn0zzz,项目名称:edk2-MdeModulePkg,代码行数:51,


示例2: UnpackDevicePath

EFI_DEVICE_PATH *UnpackDevicePath (    IN EFI_DEVICE_PATH  *DevPath    ){    EFI_DEVICE_PATH     *Src, *Dest, *NewPath;    UINTN               Size;        //    // Walk device path and round sizes to valid boundries    //        Src = DevPath;    Size = 0;    for (; ;) {        Size += DevicePathNodeLength(Src);        Size += ALIGN_SIZE(Size);        if (IsDevicePathEnd(Src)) {            break;        }        Src = NextDevicePathNode(Src);    }    //    // Allocate space for the unpacked path    //    NewPath = AllocateZeroPool (Size);    if (NewPath) {        ASSERT (((UINTN)NewPath) % MIN_ALIGNMENT_SIZE == 0);        //        // Copy each node        //        Src = DevPath;        Dest = NewPath;        for (; ;) {            Size = DevicePathNodeLength(Src);            CopyMem (Dest, Src, Size);            Size += ALIGN_SIZE(Size);            SetDevicePathNodeLength (Dest, Size);            Dest->Type |= EFI_DP_TYPE_UNPACKED;            Dest = (EFI_DEVICE_PATH *) (((UINT8 *) Dest) + Size);            if (IsDevicePathEnd(Src)) {                break;            }            Src = NextDevicePathNode(Src);        }    }    return NewPath;}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:59,


示例3: ASSERT

/**  Determine whether a given device path is valid.  If DevicePath is NULL, then ASSERT().  @param  DevicePath  A pointer to a device path data structure.  @param  MaxSize     The maximum size of the device path data structure.  @retval TRUE        DevicePath is valid.  @retval FALSE       The length of any node node in the DevicePath is less                      than sizeof (EFI_DEVICE_PATH_PROTOCOL).  @retval FALSE       If MaxSize is not zero, the size of the DevicePath                      exceeds MaxSize.  @retval FALSE       If PcdMaximumDevicePathNodeCount is not zero, the node                      count of the DevicePath exceeds PcdMaximumDevicePathNodeCount.**/BOOLEANEFIAPIIsDevicePathValid (  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,  IN       UINTN                    MaxSize  ){  UINTN Count;  UINTN Size;  UINTN NodeLength;  ASSERT (DevicePath != NULL);  if (MaxSize == 0) {    MaxSize = MAX_UINTN;  }  //  // Validate the input size big enough to touch the first node.  //  if (MaxSize < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {    return FALSE;  }  for (Count = 0, Size = 0; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) {    NodeLength = DevicePathNodeLength (DevicePath);    if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {      return FALSE;    }    if (NodeLength > MAX_UINTN - Size) {      return FALSE;    }    Size += NodeLength;    //    // Validate next node before touch it.    //    if (Size > MaxSize - END_DEVICE_PATH_LENGTH ) {      return FALSE;    }    if (PcdGet32 (PcdMaximumDevicePathNodeCount) > 0) {      Count++;      if (Count >= PcdGet32 (PcdMaximumDevicePathNodeCount)) {        return FALSE;      }    }  }  //  // Only return TRUE when the End Device Path node is valid.  //  return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);}
开发者ID:bale-john,项目名称:edk2,代码行数:70,


示例4: HttpBootParseFilePath

/**  Get the URI address string from the input device path.  Caller need to free the buffer in the UriAddress pointer.    @param[in]   FilePath         Pointer to the device path which contains a URI device path node.  @param[out]  UriAddress       The URI address string extract from the device path.    @retval EFI_SUCCESS            The URI string is returned.  @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.**/EFI_STATUSHttpBootParseFilePath (  IN     EFI_DEVICE_PATH_PROTOCOL     *FilePath,     OUT CHAR8                        **UriAddress  ){  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;  URI_DEVICE_PATH           *UriDevicePath;  CHAR8                     *Uri;  UINTN                     UriStrLength;  if (FilePath == NULL) {    return EFI_INVALID_PARAMETER;  }  *UriAddress = NULL;  //  // Extract the URI address from the FilePath  //  TempDevicePath = FilePath;  while (!IsDevicePathEnd (TempDevicePath)) {    if ((DevicePathType (TempDevicePath) == MESSAGING_DEVICE_PATH) &&        (DevicePathSubType (TempDevicePath) == MSG_URI_DP)) {      UriDevicePath = (URI_DEVICE_PATH*) TempDevicePath;      //      // UEFI Spec doesn't require the URI to be a NULL-terminated string      // So we allocate a new buffer and always append a '/0' to it.      //      UriStrLength = DevicePathNodeLength (UriDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);      if (UriStrLength == 0) {        //        // return a NULL UriAddress if it's a empty URI device path node.        //        break;      }      Uri = AllocatePool (UriStrLength + 1);      if (Uri == NULL) {        return EFI_OUT_OF_RESOURCES;      }      CopyMem (Uri, UriDevicePath->Uri, DevicePathNodeLength (UriDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL));      Uri[DevicePathNodeLength (UriDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL)] = '/0';      *UriAddress = Uri;    }    TempDevicePath = NextDevicePathNode (TempDevicePath);  }  return EFI_SUCCESS;}
开发者ID:kraxel,项目名称:edk2,代码行数:62,


示例5: GetSlotNumber

/**  This function retrieves an SD card slot number based on the input device path.  The GetSlotNumber() function retrieves slot number for the SD card specified by  the DevicePath node. If DevicePath is NULL, EFI_INVALID_PARAMETER is returned.  If DevicePath is not a device path node type that the SD Pass Thru driver supports,  EFI_UNSUPPORTED is returned.  @param[in]  This              A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance.  @param[in]  DevicePath        A pointer to the device path node that describes a SD                                card on the SD controller.  @param[out] Slot              On return, points to the slot number of an SD card on                                the SD controller.  @retval EFI_SUCCESS           SD card slot number is returned in Slot.  @retval EFI_INVALID_PARAMETER Slot or DevicePath is NULL.  @retval EFI_UNSUPPORTED       DevicePath is not a device path node type that the SD                                Pass Thru driver supports.**/EFI_STATUSEFIAPISdMmcPassThruGetSlotNumber (  IN  EFI_SD_MMC_PASS_THRU_PROTOCOL          *This,  IN  EFI_DEVICE_PATH_PROTOCOL               *DevicePath,  OUT UINT8                                  *Slot  ){  SD_MMC_HC_PRIVATE_DATA          *Private;  SD_DEVICE_PATH                  *SdNode;  EMMC_DEVICE_PATH                *EmmcNode;  UINT8                           SlotNumber;  if ((This == NULL) || (DevicePath == NULL) || (Slot == NULL)) {    return EFI_INVALID_PARAMETER;  }  Private = SD_MMC_HC_PRIVATE_FROM_THIS (This);  //  // Check whether the DevicePath belongs to SD_DEVICE_PATH or EMMC_DEVICE_PATH  //  if ((DevicePath->Type != MESSAGING_DEVICE_PATH) ||      ((DevicePath->SubType != MSG_SD_DP) &&       (DevicePath->SubType != MSG_EMMC_DP)) ||      (DevicePathNodeLength(DevicePath) != sizeof(SD_DEVICE_PATH)) ||      (DevicePathNodeLength(DevicePath) != sizeof(EMMC_DEVICE_PATH))) {    return EFI_UNSUPPORTED;  }  if (DevicePath->SubType == MSG_SD_DP) {    SdNode = (SD_DEVICE_PATH *) DevicePath;    SlotNumber = SdNode->SlotNumber;  } else {    EmmcNode = (EMMC_DEVICE_PATH *) DevicePath;    SlotNumber = EmmcNode->SlotNumber;  }  if (SlotNumber >= SD_MMC_HC_MAX_SLOT) {    return EFI_NOT_FOUND;  }  if (Private->Slot[SlotNumber].Enable) {    *Slot = SlotNumber;    return EFI_SUCCESS;  } else {    return EFI_NOT_FOUND;  }}
开发者ID:baranee,项目名称:edk2,代码行数:70,


示例6: ASSERT

/**  Determine whether a given device path is valid.  If DevicePath is NULL, then ASSERT().  @param  DevicePath  A pointer to a device path data structure.  @param  MaxSize     The maximum size of the device path data structure.  @retval TRUE        DevicePath is valid.  @retval FALSE       The length of any node node in the DevicePath is less                      than sizeof (EFI_DEVICE_PATH_PROTOCOL).  @retval FALSE       If MaxSize is not zero, the size of the DevicePath                      exceeds MaxSize.  @retval FALSE       If PcdMaximumDevicePathNodeCount is not zero, the node                      count of the DevicePath exceeds PcdMaximumDevicePathNodeCount.**/BOOLEANEFIAPIIsDevicePathValid (  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,  IN       UINTN                    MaxSize  ){  UINTN Count;  UINTN Size;  UINTN NodeLength;  ASSERT (DevicePath != NULL);  if (MaxSize == 0){    MaxSize = MAX_UINTN;  }  Size = 0;  Count = 0;  while (MaxSize >= sizeof (EFI_DEVICE_PATH_PROTOCOL) &&        (MaxSize - sizeof (EFI_DEVICE_PATH_PROTOCOL) >= Size) &&        !IsDevicePathEnd (DevicePath)) {    NodeLength = DevicePathNodeLength (DevicePath);    if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {      return FALSE;    }    if (NodeLength > MAX_UINTN - Size) {      return FALSE;    }    Size += NodeLength;    if (PcdGet32 (PcdMaximumDevicePathNodeCount) > 0) {      Count++;      if (Count >= PcdGet32 (PcdMaximumDevicePathNodeCount)) {        return FALSE;      }    }    DevicePath = NextDevicePathNode (DevicePath);  }  //  // Only return TRUE when the End Device Path node is valid.  //  return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);}
开发者ID:EvanLloyd,项目名称:tianocore,代码行数:64,


示例7: _DevPathIPv6

static VOID_DevPathIPv6 (    IN OUT POOL_PRINT       *Str,    IN VOID                 *DevPath    ){    IPv6_DEVICE_PATH     *IP;    IP = DevPath;    CatPrint( Str , L"IPv6(") ;    CatPrintIPv6( Str , & IP-> RemoteIpAddress ) ;    CatPrint( Str , L",") ;    CatPrintNetworkProtocol( Str, IP-> Protocol ) ;    CatPrint( Str , L",%s," , IP-> IPAddressOrigin ?        ( IP-> IPAddressOrigin == 1 ? L"StatelessAutoConfigure" :        L"StatefulAutoConfigure" ) : L"Static" ) ;    CatPrintIPv6( Str , & IP-> LocalIpAddress ) ;    if ( DevicePathNodeLength( & IP-> Header ) == sizeof( IPv6_DEVICE_PATH ) ) {        CatPrint( Str , L",") ;        CatPrintIPv6( Str , & IP-> GatewayIpAddress ) ;        CatPrint( Str , L",") ;        CatPrint( Str , L"%d" , & IP-> PrefixLength ) ;    }    CatPrint( Str , L")") ;}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:25,


示例8: _DevPathMacAddr

static VOID_DevPathMacAddr (    IN OUT POOL_PRINT       *Str,    IN VOID                 *DevPath    ){    MAC_ADDR_DEVICE_PATH    *MAC;    UINTN                   HwAddressSize;    UINTN                   Index;    MAC = DevPath;    /* HwAddressSize = sizeof(EFI_MAC_ADDRESS); */    HwAddressSize = DevicePathNodeLength( & MAC-> Header ) ;    HwAddressSize -= sizeof( MAC-> Header ) ;    HwAddressSize -= sizeof( MAC-> IfType ) ;    if (MAC->IfType == 0x01 || MAC->IfType == 0x00) {        HwAddressSize = 6;    }        CatPrint(Str, L"Mac(");    for(Index = 0; Index < HwAddressSize; Index++) {        CatPrint(Str, L"%02x",MAC->MacAddress.Addr[Index]);    }    if ( MAC-> IfType != 0 ) {        CatPrint(Str, L",%d" , MAC-> IfType ) ;    }    CatPrint(Str, L")");}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:30,


示例9: UefiDevicePathLibGetDevicePathSize

/**  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 or invalid, then 0 is returned.  @param  DevicePath  A pointer to a device path data structure.  @retval 0           If DevicePath is NULL or invalid.  @retval Others      The size of a device path in bytes.**/UINTNEFIAPIUefiDevicePathLibGetDevicePathSize (  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath  ){  CONST EFI_DEVICE_PATH_PROTOCOL  *Start;  if (DevicePath == NULL) {    return 0;  }  if (!IsDevicePathValid (DevicePath, 0)) {    return 0;  }  //  // Search for the end of the device path structure  //  Start = DevicePath;  while (!IsDevicePathEnd (DevicePath)) {    DevicePath = NextDevicePathNode (DevicePath);  }  //  // Compute the size and add back in the size of the end device path structure  //  return ((UINTN) DevicePath - (UINTN) Start) + DevicePathNodeLength (DevicePath);}
开发者ID:shijunjing,项目名称:edk2,代码行数:42,


示例10: AppendDevicePathNode

EFI_DEVICE_PATH *AppendDevicePathNode (    IN EFI_DEVICE_PATH  *Src1,    IN EFI_DEVICE_PATH  *Src2    )// Src1 may have multiple "instances" and each instance is appended// Src2 is a signal device path node (without a terminator) that is// appended to each instance is Src1.{    EFI_DEVICE_PATH     *Temp, *Eop;    UINTN               Length;    //    // Build a Src2 that has a terminator on it    //    Length = DevicePathNodeLength(Src2);    Temp = AllocatePool (Length + sizeof(EFI_DEVICE_PATH));    if (!Temp) {        return NULL;    }    CopyMem (Temp, Src2, Length);    Eop = NextDevicePathNode(Temp);     SetDevicePathEndNode(Eop);    //    // Append device paths    //    Src1 = AppendDevicePath (Src1, Temp);    FreePool (Temp);    return Src1;}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:34,


示例11: BusDriver1BindingSupported

EFI_STATUSBusDriver1BindingSupported (  IN EFI_DRIVER_BINDING_PROTOCOL    *This,  IN EFI_HANDLE                     Controller,  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath  ){  EFI_STATUS        Status;  EFI_DEV_PATH      *Node;  if (RemainingDevicePath != NULL) {    Node = (EFI_DEV_PATH *)RemainingDevicePath;    if (Node->DevPath.Type != HARDWARE_DEVICE_PATH ||        Node->DevPath.SubType != HW_VENDOR_DP ||        DevicePathNodeLength(&Node->DevPath) != sizeof(VENDOR_DEVICE_PATH)) {      return EFI_UNSUPPORTED;    }  }  Status = gtBS->OpenProtocol (                      Controller,                      &mInterfaceFunctionTestProtocol1Guid,                      NULL,                      This->DriverBindingHandle,                      Controller,                      EFI_OPEN_PROTOCOL_TEST_PROTOCOL                      );  if (EFI_ERROR(Status)) {    return EFI_UNSUPPORTED;  }  return EFI_SUCCESS;}
开发者ID:JackNine,项目名称:2ndProject,代码行数:33,


示例12: NextDevicePathNode

EFIAPINextDevicePathNode (  IN CONST VOID  *Node  ){  ASSERT (Node != NULL);  return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node));}
开发者ID:FishYu1222,项目名称:edk2,代码行数:8,


示例13: CompareDevicePaths

// Compare device pathsstatic INTN CompareDevicePaths(CONST EFI_DEVICE_PATH *dp1, CONST EFI_DEVICE_PATH *dp2){    if (dp1 == NULL || dp2 == NULL)        return -1;    while (1) {        UINT8 type1, type2;        UINT8 subtype1, subtype2;        UINT16 len1, len2;        INTN ret;        type1 = DevicePathType(dp1);        type2 = DevicePathType(dp2);        if (type1 != type2)                return (int) type2 - (int) type1;        subtype1 = DevicePathSubType(dp1);        subtype2 = DevicePathSubType(dp2);        if (subtype1 != subtype2)                return (int) subtype1 - (int) subtype2;        len1 = DevicePathNodeLength(dp1);        len2 = DevicePathNodeLength(dp2);        if (len1 != len2)                return (int) len1 - (int) len2;        ret = CompareMem(dp1, dp2, len1);        if (ret != 0)                return ret;        if (IsDevicePathEnd(dp1))                break;        dp1 = (EFI_DEVICE_PATH*) ((char *)dp1 + len1);        dp2 = (EFI_DEVICE_PATH*) ((char *)dp2 + len2);    }    return 0;}
开发者ID:linnaea,项目名称:uefi-ntfs-multiboot,代码行数:42,


示例14: _DevPathIPv4

static VOID_DevPathIPv4 (    IN OUT POOL_PRINT       *Str,    IN VOID                 *DevPath    ){    IPv4_DEVICE_PATH     *IP;    BOOLEAN show ;    IP = DevPath;    CatPrint( Str , L"IPv4(") ;    CatPrintIPv4( Str , & IP-> RemoteIpAddress ) ;    CatPrint( Str , L",") ;    CatPrintNetworkProtocol( Str , IP-> Protocol ) ;    CatPrint( Str , L",%s" , IP-> StaticIpAddress ? L"Static" : L"DHCP" ) ;    show = IsNotNullIPv4( & IP-> LocalIpAddress ) ;    if ( ! show && DevicePathNodeLength( & IP-> Header ) == sizeof( IPv4_DEVICE_PATH ) ) {        /* only version 2 includes gateway and netmask */        show |= IsNotNullIPv4( & IP-> GatewayIpAddress ) ;        show |= IsNotNullIPv4( & IP-> SubnetMask  ) ;    }    if ( show ) {        CatPrint( Str , L"," ) ;        CatPrintIPv4( Str , & IP-> LocalIpAddress ) ;        if ( DevicePathNodeLength( & IP-> Header ) == sizeof( IPv4_DEVICE_PATH ) ) {            /* only version 2 includes gateway and netmask */            show = IsNotNullIPv4( & IP-> GatewayIpAddress ) ;            show |= IsNotNullIPv4( & IP-> SubnetMask ) ;            if ( show ) {                CatPrint( Str , L",") ;                CatPrintIPv4( Str , & IP-> GatewayIpAddress ) ;                if ( IsNotNullIPv4( & IP-> SubnetMask ) ) {                    CatPrint( Str , L",") ;                    CatPrintIPv4( Str , & IP-> SubnetMask ) ;                }            }        }    }    CatPrint( Str , L")") ;}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:40,


示例15: SerialControllerDriverSupported

/**  Check to see if this driver supports the given controller  @param  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.  @param  Controller           The handle of the controller to test.  @param  RemainingDevicePath  A pointer to the remaining portion of a device path.  @return EFI_SUCCESS          This driver can support the given controller**/EFI_STATUSEFIAPISerialControllerDriverSupported (  IN EFI_DRIVER_BINDING_PROTOCOL    *This,  IN EFI_HANDLE                     Controller,  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath  ){  EFI_STATUS                                Status;  UART_DEVICE_PATH                          *Uart;  UART_FLOW_CONTROL_DEVICE_PATH             *FlowControl;  //  // Test RemainingDevicePath  //  if ((RemainingDevicePath != NULL) && !IsDevicePathEnd (RemainingDevicePath)) {    Status = EFI_UNSUPPORTED;    Uart = SkipControllerDevicePathNode (RemainingDevicePath, NULL, NULL);    if (DevicePathType (Uart) != MESSAGING_DEVICE_PATH ||        DevicePathSubType (Uart) != MSG_UART_DP ||        DevicePathNodeLength (Uart) != sizeof (UART_DEVICE_PATH)        ) {      return EFI_UNSUPPORTED;    }    //    // Do a rough check because Clock Rate is unknown until DriverBindingStart()    //    if (!VerifyUartParameters (0, Uart->BaudRate, Uart->DataBits, Uart->Parity, Uart->StopBits, NULL, NULL)) {      return EFI_UNSUPPORTED;    }    FlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) NextDevicePathNode (Uart);    if (IsUartFlowControlDevicePathNode (FlowControl)) {      //      // If the second node is Flow Control Node,      //   return error when it request other than hardware flow control.      //      if ((ReadUnaligned32 (&FlowControl->FlowControlMap) & ~UART_FLOW_CONTROL_HARDWARE) != 0) {        return EFI_UNSUPPORTED;      }    }  }  Status = IsSioSerialController (Controller);  if (EFI_ERROR (Status)) {    Status = IsPciSerialController (Controller);  }  return Status;}
开发者ID:MattDevo,项目名称:edk2,代码行数:62,


示例16: ASSERT

/**  Determine whether a given device path is valid.  If DevicePath is NULL, then ASSERT().  @param  DevicePath  A pointer to a device path data structure.  @param  MaxSize     The maximum size of the device path data structure.  @retval TRUE        DevicePath is valid.  @retval FALSE       The length of any node node in the DevicePath is less                      than sizeof (EFI_DEVICE_PATH_PROTOCOL).  @retval FALSE       If MaxSize is not zero, the size of the DevicePath                      exceeds MaxSize.  @retval FALSE       If PcdMaximumDevicePathNodeCount is not zero, the node                      count of the DevicePath exceeds PcdMaximumDevicePathNodeCount.**/BOOLEANEFIAPIIsDevicePathValid (  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,  IN       UINTN                    MaxSize  ){  UINTN Count;  UINTN Size;  UINTN NodeLength;  ASSERT (DevicePath != NULL);  for (Count = 0, Size = 0; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) {    NodeLength = DevicePathNodeLength (DevicePath);    if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {      return FALSE;    }    if (MaxSize > 0) {      Size += NodeLength;      if (Size + END_DEVICE_PATH_LENGTH > MaxSize) {        return FALSE;      }    }    if (PcdGet32 (PcdMaximumDevicePathNodeCount) > 0) {      Count++;      if (Count >= PcdGet32 (PcdMaximumDevicePathNodeCount)) {        return FALSE;      }    }  }  //  // Only return TRUE when the End Device Path node is valid.  //  return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);}
开发者ID:FishYu1222,项目名称:edk2,代码行数:54,


示例17: _DevPathCompareDefault

INTN_DevPathCompareDefault (  IN EFI_DEVICE_PATH_PROTOCOL       *DevicePath1,  IN EFI_DEVICE_PATH_PROTOCOL       *DevicePath2  ){  UINTN DevPathSize1;  UINTN DevPathSize2;  ASSERT(DevicePath1 != NULL);  ASSERT(DevicePath2 != NULL);  DevPathSize1  = DevicePathNodeLength (DevicePath1);  DevPathSize2  = DevicePathNodeLength (DevicePath2);  if (DevPathSize1 > DevPathSize2) {    return 1;  } else if (DevPathSize1 < DevPathSize2) {    return -1;  } else {    return CompareMem (DevicePath1, DevicePath2, DevPathSize1);  }}
开发者ID:DYX884877791,项目名称:edk-Shell,代码行数:22,


示例18: AppendDevicePathNode

EFI_DEVICE_PATH_PROTOCOL *AppendDevicePathNode (  IN EFI_DEVICE_PATH_PROTOCOL  *Src1,  IN EFI_DEVICE_PATH_PROTOCOL  *Src2  )/*++Routine Description:  Function is used to append a device path node to all the instances in another device path.Arguments:  Src1           - A pointer to a device path data structure.  Src2           - A pointer to a device path data structure.Returns:  This function returns a pointer to the new device path.  If there is not enough temporary pool memory available to complete this function,  then NULL is returned.  Src1 may have multiple "instances" and each instance is appended  Src2 is a signal device path node (without a terminator) that is  appended to each instance is Src1.--*/{  EFI_DEVICE_PATH_PROTOCOL    *Temp, *Eop;  UINTN                       Length;  //  // Build a Src2 that has a terminator on it  //  Length = DevicePathNodeLength(Src2);  Temp = AllocatePool (Length + sizeof(EFI_DEVICE_PATH_PROTOCOL));  if (!Temp) {    return NULL;  }  CopyMem (Temp, Src2, Length);  Eop = NextDevicePathNode(Temp);  SetDevicePathEndNode(Eop);  //  // Append device paths  //  Src1 = AppendDevicePath (Src1, Temp);  FreePool (Temp);  return Src1;}
开发者ID:jljusten,项目名称:efi-sct,代码行数:51,


示例19: IsValidDevicePath

/**  Validate the device path instance.   Only base on the length filed in the device path node to validate the device path.   @param  DevicePath         A pointer to a device path data structure.  @param  MaxSize            Max valid device path size. If big than this size,                              return error.    @retval TRUE               An valid device path.  @retval FALSE              An invalid device path.**/BOOLEANIsValidDevicePath (  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePath,  IN UINTN                     MaxSize  ){  UINTN  Size;  UINTN  NodeSize;  if (DevicePath == NULL) {    return TRUE;  }  Size = 0;  while (!IsDevicePathEnd (DevicePath)) {    NodeSize = DevicePathNodeLength (DevicePath);    if (NodeSize < END_DEVICE_PATH_LENGTH) {      return FALSE;    }    Size += NodeSize;    if (Size > MaxSize) {      return FALSE;    }    DevicePath = NextDevicePathNode (DevicePath);  }  Size += DevicePathNodeLength (DevicePath);  if (Size > MaxSize) {    return FALSE;  }  return TRUE;}
开发者ID:masamitsu-murase,项目名称:edk2_for_mruby,代码行数:49,


示例20: FileDevicePathToText

EFIAPIFileDevicePathToText(EFI_DEVICE_PATH_PROTOCOL *FilePathProto){	EFI_STATUS			Status;	FILEPATH_DEVICE_PATH 		*FilePath;	CHAR16				FilePathText[256]; // possible problem: if filepath is bigger	CHAR16				*OutFilePathText;	INTN				Size;	INTN				SizeAll;	INTN				i;		FilePathText[0] = L'/0';	i = 4;	SizeAll = 0;	//PRINT("FilePathProto->Type: %d, SubType: %d, Length: %d/n", FilePathProto->Type, FilePathProto->SubType, DevicePathNodeLength(FilePathProto));	while (FilePathProto != NULL && FilePathProto->Type != END_DEVICE_PATH_TYPE && i > 0) {		if (FilePathProto->Type == MEDIA_DEVICE_PATH && FilePathProto->SubType == MEDIA_FILEPATH_DP) {			FilePath = (FILEPATH_DEVICE_PATH *) FilePathProto;			Size = (DevicePathNodeLength(FilePathProto) - 4) / 2;			if (SizeAll + Size < 256) {				if (SizeAll > 0 && FilePathText[SizeAll / 2 - 2] != L'//') {					StrCatS(FilePathText, 256, L"//");				}				StrCatS(FilePathText, 256, FilePath->PathName);				SizeAll = StrSize(FilePathText);			}		}		FilePathProto = NextDevicePathNode(FilePathProto);		//PRINT("FilePathProto->Type: %d, SubType: %d, Length: %d/n", FilePathProto->Type, FilePathProto->SubType, DevicePathNodeLength(FilePathProto));		i--;		//PRINT("FilePathText: %s/n", FilePathText);	}		OutFilePathText = NULL;	Size = StrSize(FilePathText);	if (Size > 2) {		// we are allocating mem here - should be released by caller		Status = gBS->AllocatePool(EfiBootServicesData, Size, (VOID*)&OutFilePathText);		if (Status == EFI_SUCCESS) {			StrCpyS(OutFilePathText, Size/sizeof(CHAR16), FilePathText);		} else {			OutFilePathText = NULL;		}	}		return OutFilePathText;}
开发者ID:jief666,项目名称:clover,代码行数:47,


示例21: _DevPathNodeUnknown

static VOID_DevPathNodeUnknown (    IN OUT POOL_PRINT       *Str,    IN VOID                 *DevPath    ){    EFI_DEVICE_PATH * Path ;    UINT8 * value ;    int length , index ;    Path = DevPath ;    value = DevPath ;    value += 4 ;    switch ( Path-> Type ) {        case HARDWARE_DEVICE_PATH : { /* Unknown Hardware Device Path */            CatPrint( Str , L"HardwarePath(%d" , Path-> SubType ) ;            break ;        }        case ACPI_DEVICE_PATH : { /* Unknown ACPI Device Path */            CatPrint( Str , L"AcpiPath(%d" , Path-> SubType ) ;            break ;        }        case MESSAGING_DEVICE_PATH : { /* Unknown Messaging Device Path */            CatPrint( Str , L"Msg(%d" , Path-> SubType ) ;            break ;        }        case MEDIA_DEVICE_PATH : { /* Unknown Media Device Path */            CatPrint( Str , L"MediaPath(%d" , Path-> SubType ) ;            break ;        }        case BBS_DEVICE_PATH : { /* Unknown BIOS Boot Specification Device Path */            CatPrint( Str , L"BbsPath(%d" , Path-> SubType ) ;            break ;        }        default : { /* Unknown Device Path */            CatPrint( Str , L"Path(%d,%d" , Path-> Type , Path-> SubType ) ;            break ;        }    }    length = DevicePathNodeLength( Path ) ;    for ( index = 0 ; index < length ; index ++ ) {        if ( index == 0 ) CatPrint( Str , L",0x" ) ;        CatPrint( Str , L"%02x" , * value ) ;	value ++ ;    }    CatPrint( Str , L")" ) ;}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:46,


示例22: dp_size

static INTNdp_size(EFI_DEVICE_PATH *dp, INTN limit){	INTN ret = 0;	while (1) {		if (limit < 4)			break;		INTN nodelen = DevicePathNodeLength(dp);		if (nodelen > limit)			break;		limit -= nodelen;		ret += nodelen;		if (IsDevicePathEnd(dp))			return ret;		dp = NextDevicePathNode(dp);	}	return -1;}
开发者ID:vathpela,项目名称:fwupdate,代码行数:19,


示例23: NvmExpressGetNamespace

/**  Used to translate a device path node to a namespace ID.  The EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL.GetNamespace() function determines the namespace ID associated with the  namespace described by DevicePath.  If DevicePath is a device path node type that the NVM Express Pass Thru driver supports, then the NVM Express  Pass Thru driver will attempt to translate the contents DevicePath into a namespace ID.  If this translation is successful, then that namespace ID is returned in NamespaceId, and EFI_SUCCESS is returned  @param[in]  This                A pointer to the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL instance.  @param[in]  DevicePath          A pointer to the device path node that describes an NVM Express namespace on                                  the NVM Express controller.  @param[out] NamespaceId         The NVM Express namespace ID contained in the device path node.  @retval EFI_SUCCESS             DevicePath was successfully translated to NamespaceId.  @retval EFI_INVALID_PARAMETER   If DevicePath or NamespaceId are NULL, then EFI_INVALID_PARAMETER is returned.  @retval EFI_UNSUPPORTED         If DevicePath is not a device path node type that the NVM Express Pass Thru driver                                  supports, then EFI_UNSUPPORTED is returned.  @retval EFI_NOT_FOUND           If DevicePath is a device path node type that the NVM Express Pass Thru driver                                  supports, but there is not a valid translation from DevicePath to a namespace ID,                                  then EFI_NOT_FOUND is returned.**/EFI_STATUSEFIAPINvmExpressGetNamespace (  IN     EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL          *This,  IN     EFI_DEVICE_PATH_PROTOCOL                    *DevicePath,     OUT UINT32                                      *NamespaceId  ){  NVME_NAMESPACE_DEVICE_PATH       *Node;  NVME_CONTROLLER_PRIVATE_DATA     *Private;  if ((This == NULL) || (DevicePath == NULL) || (NamespaceId == NULL)) {    return EFI_INVALID_PARAMETER;  }  if (DevicePath->Type != MESSAGING_DEVICE_PATH) {    return EFI_UNSUPPORTED;  }  Node    = (NVME_NAMESPACE_DEVICE_PATH *)DevicePath;  Private = NVME_CONTROLLER_PRIVATE_DATA_FROM_PASS_THRU (This);  if (DevicePath->SubType == MSG_NVME_NAMESPACE_DP) {    if (DevicePathNodeLength(DevicePath) != sizeof(NVME_NAMESPACE_DEVICE_PATH)) {      return EFI_NOT_FOUND;    }    //    // Check NamespaceId in the device path node is valid or not.    //    if ((Node->NamespaceId == 0) ||      (Node->NamespaceId > Private->ControllerData->Nn)) {      return EFI_NOT_FOUND;    }    *NamespaceId = Node->NamespaceId;    return EFI_SUCCESS;  } else {    return EFI_UNSUPPORTED;  }}
开发者ID:vathpela,项目名称:edk2,代码行数:66,


示例24: IScsiExtScsiPassThruGetTargetLun

/**  Used to translate a device path node to a Target ID and LUN.  @param[in]  This       A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.  @param[in]  DevicePath A pointer to a single device path node that describes the SCSI device                         on the SCSI channel.  @param[out] Target     A pointer to the Target Array which represents the ID of a SCSI device                         on the SCSI channel.  @param[out]  Lun       A pointer to the LUN of a SCSI device on the SCSI channel.  @retval EFI_SUCCESS           DevicePath was successfully translated to a Target ID and                                LUN, and they were returned in Target and Lun.  @retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL.  @retval EFI_NOT_FOUND         A valid translation from DevicePath to a Target ID and LUN                                does not exist.Currently not implemented.  @retval EFI_UNSUPPORTED       This driver does not support the device path node type in                                DevicePath.**/EFI_STATUSEFIAPIIScsiExtScsiPassThruGetTargetLun (  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL  *This,  IN EFI_DEVICE_PATH_PROTOCOL         *DevicePath,  OUT UINT8                           **Target,  OUT UINT64                          *Lun  ){  ISCSI_DRIVER_DATA           *Private;  ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;  if ((DevicePath == NULL) || (Target == NULL) || (Lun == NULL)) {    return EFI_INVALID_PARAMETER;  }  if ((DevicePath->Type != MESSAGING_DEVICE_PATH) ||      (DevicePath->SubType != MSG_ISCSI_DP) ||      (DevicePathNodeLength (DevicePath) <= sizeof (ISCSI_DEVICE_PATH))      ) {    return EFI_UNSUPPORTED;  }  Private       = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (This);  ConfigNvData  = &Private->Session.ConfigData.NvData;  SetMem (*Target, TARGET_MAX_BYTES, 0xFF);  (*Target)[0] = 0;  if (AsciiStrCmp (ConfigNvData->TargetName, (CHAR8 *) DevicePath + sizeof (ISCSI_DEVICE_PATH)) != 0) {    return EFI_UNSUPPORTED;  }  CopyMem (Lun, ConfigNvData->BootLun, sizeof (UINT64));  return EFI_SUCCESS;}
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:55,


示例25: GetFileName

/**  Get file name from device path.  The file name may contain one or more device path node. Save the file name in a  buffer if file name is found. The caller is responsible to free the buffer.  @param[in]  DevicePath     A pointer to a device path.  @param[out] FileName       The callee allocated buffer to save the file name if file name is found.  @param[out] FileNameOffset The offset of file name in device path if file name is found.  @retval     UINTN          The file name length. 0 means file name is not found.**/UINTNGetFileName (  IN  CONST EFI_DEVICE_PATH_PROTOCOL          *DevicePath,  OUT UINT8                                   **FileName,  OUT UINTN                                   *FileNameOffset  ){  UINTN                                       Length;  EFI_DEVICE_PATH_PROTOCOL                    *TmpDevicePath;  EFI_DEVICE_PATH_PROTOCOL                    *RootDevicePath;  CHAR8                                       *NodeStr;  UINTN                                       NodeStrLength;  CHAR16                                      LastNodeChar;  CHAR16                                      FirstNodeChar;  //  // Get the length of DevicePath before file name.  //  Length = 0;  RootDevicePath = (EFI_DEVICE_PATH_PROTOCOL *)DevicePath;  while (!IsDevicePathEnd (RootDevicePath)) {    if ((DevicePathType(RootDevicePath) == MEDIA_DEVICE_PATH) && (DevicePathSubType(RootDevicePath) == MEDIA_FILEPATH_DP)) {      break;    }    Length += DevicePathNodeLength (RootDevicePath);    RootDevicePath = NextDevicePathNode (RootDevicePath);  }  *FileNameOffset = Length;  if (Length == 0) {    return 0;  }  //  // Get the file name length.  //  Length = 0;  TmpDevicePath = RootDevicePath;  while (!IsDevicePathEnd (TmpDevicePath)) {    if ((DevicePathType(TmpDevicePath) != MEDIA_DEVICE_PATH) || (DevicePathSubType(TmpDevicePath) != MEDIA_FILEPATH_DP)) {      break;    }    Length += DevicePathNodeLength (TmpDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL);    TmpDevicePath = NextDevicePathNode (TmpDevicePath);  }  if (Length == 0) {    return 0;  }  *FileName = AllocateZeroPool (Length);  ASSERT (*FileName != NULL);  //  // Copy the file name to the buffer.  //  Length = 0;  LastNodeChar = '//';  TmpDevicePath = RootDevicePath;  while (!IsDevicePathEnd (TmpDevicePath)) {    if ((DevicePathType(TmpDevicePath) != MEDIA_DEVICE_PATH) || (DevicePathSubType(TmpDevicePath) != MEDIA_FILEPATH_DP)) {      break;    }    FirstNodeChar = (CHAR16) ReadUnaligned16 ((UINT16 *)((UINT8 *)TmpDevicePath + sizeof (EFI_DEVICE_PATH_PROTOCOL)));    NodeStr = (CHAR8 *)TmpDevicePath + sizeof (EFI_DEVICE_PATH_PROTOCOL);    NodeStrLength = DevicePathNodeLength (TmpDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL) - sizeof(CHAR16);    if ((FirstNodeChar == '//') && (LastNodeChar == '//')) {      //      // Skip separator "/" when there are two separators.      //      NodeStr += sizeof (CHAR16);      NodeStrLength -= sizeof (CHAR16);    } else if ((FirstNodeChar != '//') && (LastNodeChar != '//')) {      //      // Add separator "/" when there is no separator.      //      WriteUnaligned16 ((UINT16 *)(*FileName + Length), '//');      Length += sizeof (CHAR16);    }    CopyMem (*FileName + Length, NodeStr, NodeStrLength);    Length += NodeStrLength;    LastNodeChar  = (CHAR16) ReadUnaligned16 ((UINT16 *) (NodeStr + NodeStrLength - sizeof(CHAR16)));    TmpDevicePath = NextDevicePathNode (TmpDevicePath);  }//.........这里部分代码省略.........
开发者ID:jeppeter,项目名称:vbox,代码行数:101,


示例26: efi_main

voidefi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table){	static EFI_GUID image_protocol = LOADED_IMAGE_PROTOCOL;	EFI_LOADED_IMAGE *img;	CHAR16 *argp, *args, **argv;	EFI_STATUS status;	int argc, addprog;	IH = image_handle;	ST = system_table;	BS = ST->BootServices;	RS = ST->RuntimeServices;	heapsize = 512*1024;	status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData,	    EFI_SIZE_TO_PAGES(heapsize), &heap);	if (status != EFI_SUCCESS)		BS->Exit(IH, status, 0, NULL);	setheap((void *)heap, (void *)(heap + heapsize));	/* Use exit() from here on... */	status = BS->HandleProtocol(IH, &image_protocol, (VOID**)&img);	if (status != EFI_SUCCESS)		exit(status);	/*	 * Pre-process the (optional) load options. If the option string	 * is given as an ASCII string, we use a poor man's ASCII to	 * Unicode-16 translation. The size of the option string as given	 * to us includes the terminating null character. We assume the	 * string is an ASCII string if strlen() plus the terminating	 * '/0' is less than LoadOptionsSize. Even if all Unicode-16	 * characters have the upper 8 bits non-zero, the terminating	 * null character will cause a one-off.	 * If the string is already in Unicode-16, we make a copy so that	 * we know we can always modify the string.	 */	if (img->LoadOptionsSize > 0 && img->LoadOptions != NULL) {		if (img->LoadOptionsSize == strlen(img->LoadOptions) + 1) {			args = malloc(img->LoadOptionsSize << 1);			for (argc = 0; argc < img->LoadOptionsSize; argc++)				args[argc] = ((char*)img->LoadOptions)[argc];		} else {			args = malloc(img->LoadOptionsSize);			memcpy(args, img->LoadOptions, img->LoadOptionsSize);		}	} else		args = NULL;	/*	 * Use a quick and dirty algorithm to build the argv vector. We	 * first count the number of words. Then, after allocating the	 * vector, we split the string up. We don't deal with quotes or	 * other more advanced shell features.	 * The EFI shell will pas the name of the image as the first	 * word in the argument list. This does not happen if we're	 * loaded by the boot manager. This is not so easy to figure	 * out though. The ParentHandle is not always NULL, because	 * there can be a function (=image) that will perform the task	 * for the boot manager.	 */	/* Part 1: Figure out if we need to add our program name. */	addprog = (args == NULL || img->ParentHandle == NULL ||	    img->FilePath == NULL) ? 1 : 0;	if (!addprog) {		addprog =		    (DevicePathType(img->FilePath) != MEDIA_DEVICE_PATH ||		     DevicePathSubType(img->FilePath) != MEDIA_FILEPATH_DP ||		     DevicePathNodeLength(img->FilePath) <=			sizeof(FILEPATH_DEVICE_PATH)) ? 1 : 0;		if (!addprog) {			/* XXX todo. */		}	}	/* Part 2: count words. */	argc = (addprog) ? 1 : 0;	argp = args;	while (argp != NULL && *argp != 0) {		argp = arg_skipsep(argp);		if (*argp == 0)			break;		argc++;		argp = arg_skipword(argp);	}	/* Part 3: build vector. */	argv = malloc((argc + 1) * sizeof(CHAR16*));	argc = 0;	if (addprog)		argv[argc++] = L"loader.efi";	argp = args;	while (argp != NULL && *argp != 0) {		argp = arg_skipsep(argp);		if (*argp == 0)			break;		argv[argc++] = argp;		argp = arg_skipword(argp);		/* Terminate the words. *///.........这里部分代码省略.........
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:101,


示例27: BdsLoadOptionTftpUpdateDevicePath

//.........这里部分代码省略.........    if (Ipv4Node.StaticIpAddress) {      CopyMem (&OldSubnetMask.v4, &Ipv4Node.SubnetMask, sizeof (EFI_IPv4_ADDRESS));      Status = EditHIInputIP (&OldSubnetMask, &SubnetMask);    } else {      Status = GetHIInputIP (&SubnetMask);    }    if (EFI_ERROR (Status)) {      goto ErrorExit;    }    Print (L"Get the gateway IP address: ");    if (Ipv4Node.StaticIpAddress) {      CopyMem (&OldGatewayIp.v4, &Ipv4Node.GatewayIpAddress, sizeof (EFI_IPv4_ADDRESS));      Status = EditHIInputIP (&OldGatewayIp, &GatewayIp);    } else {      Status = GetHIInputIP (&GatewayIp);    }    if (EFI_ERROR (Status)) {      goto ErrorExit;    }  }  Print (L"TFTP server IP address: ");  // Copy remote IPv4 address into IPv4 or IPv6 union  CopyMem (&OldIp.v4, &Ipv4Node.RemoteIpAddress, sizeof (EFI_IPv4_ADDRESS));  Status = EditHIInputIP (&OldIp, &RemoteIp);  if (EFI_ERROR (Status)) {    goto ErrorExit;  }  // Get the path of the boot file and its size in number of bytes  FileNodePtr = Ipv4NodePtr + sizeof (IPv4_DEVICE_PATH);  BootFilePathSize = DevicePathNodeLength (FileNodePtr) - SIZE_OF_FILEPATH_DEVICE_PATH;  //  // Ask for update of the boot file path  //  do {    // Copy for 2-byte alignment of the Unicode string    CopyMem (      BootFilePath, FileNodePtr + SIZE_OF_FILEPATH_DEVICE_PATH,      MIN (BootFilePathSize, BOOT_DEVICE_FILEPATH_MAX)      );    BootFilePath[BOOT_DEVICE_FILEPATH_MAX - 1] = L'/0';    Print (L"File path of the %s: ", FileName);    Status = EditHIInputStr (BootFilePath, BOOT_DEVICE_FILEPATH_MAX);    if (EFI_ERROR (Status)) {      goto ErrorExit;    }    PathSize = StrSize (BootFilePath);    if (PathSize > 2) {      break;    }    // Empty string, give the user another try    Print (L"Empty string - Invalid path/n");  } while (PathSize <= 2) ;  //  // Update the IPv4 node. IPv6 case not handled yet.  //  if (IsDHCP) {    Ipv4Node.StaticIpAddress = FALSE;    ZeroMem (&Ipv4Node.LocalIpAddress, sizeof (EFI_IPv4_ADDRESS));    ZeroMem (&Ipv4Node.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
开发者ID:hzhuang1,项目名称:uefi,代码行数:67,


示例28: PartitionDriverBindingSupported

/**  Test to see if this driver supports ControllerHandle. Any ControllerHandle  than contains a BlockIo and DiskIo protocol or a BlockIo2 protocol can be  supported.  @param[in]  This                Protocol instance pointer.  @param[in]  ControllerHandle    Handle of device to test.  @param[in]  RemainingDevicePath Optional parameter use to pick a specific child                                  device to start.  @retval EFI_SUCCESS         This driver supports this device  @retval EFI_ALREADY_STARTED This driver is already running on this device  @retval other               This driver does not support this device**/EFI_STATUSEFIAPIPartitionDriverBindingSupported (  IN EFI_DRIVER_BINDING_PROTOCOL  *This,  IN EFI_HANDLE                   ControllerHandle,  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath  ){  EFI_STATUS                Status;  EFI_DEVICE_PATH_PROTOCOL  *ParentDevicePath;  EFI_DISK_IO_PROTOCOL      *DiskIo;  EFI_DEV_PATH              *Node;  //  // Check RemainingDevicePath validation  //  if (RemainingDevicePath != NULL) {    //    // Check if RemainingDevicePath is the End of Device Path Node,     // if yes, go on checking other conditions    //    if (!IsDevicePathEnd (RemainingDevicePath)) {      //      // If RemainingDevicePath isn't the End of Device Path Node,      // check its validation      //      Node = (EFI_DEV_PATH *) RemainingDevicePath;      if (Node->DevPath.Type != MEDIA_DEVICE_PATH ||        Node->DevPath.SubType != MEDIA_HARDDRIVE_DP ||        DevicePathNodeLength (&Node->DevPath) != sizeof (HARDDRIVE_DEVICE_PATH)) {        return EFI_UNSUPPORTED;      }    }  }  //  // Open the IO Abstraction(s) needed to perform the supported test  //  Status = gBS->OpenProtocol (                  ControllerHandle,                  &gEfiDiskIoProtocolGuid,                  (VOID **) &DiskIo,                  This->DriverBindingHandle,                  ControllerHandle,                  EFI_OPEN_PROTOCOL_BY_DRIVER                  );  if (Status == EFI_ALREADY_STARTED) {    return EFI_SUCCESS;  }  if (EFI_ERROR (Status)) {    return Status;  }  //  // Close the I/O Abstraction(s) used to perform the supported test  //  gBS->CloseProtocol (         ControllerHandle,         &gEfiDiskIoProtocolGuid,         This->DriverBindingHandle,         ControllerHandle         );  //  // Open the EFI Device Path protocol needed to perform the supported test  //  Status = gBS->OpenProtocol (                  ControllerHandle,                  &gEfiDevicePathProtocolGuid,                  (VOID **) &ParentDevicePath,                  This->DriverBindingHandle,                  ControllerHandle,                  EFI_OPEN_PROTOCOL_BY_DRIVER                  );  if (Status == EFI_ALREADY_STARTED) {    return EFI_SUCCESS;  }  if (EFI_ERROR (Status)) {    return Status;  }  //  // Close protocol, don't use device path protocol in the Support() function  //  gBS->CloseProtocol (//.........这里部分代码省略.........
开发者ID:FishYu1222,项目名称:edk2,代码行数:101,


示例29: BBTestWholeDevicePathConformanceAutoTest

//// TDS 3.2//EFI_STATUSBBTestWholeDevicePathConformanceAutoTest (    IN EFI_BB_TEST_PROTOCOL       *This,    IN VOID                       *ClientInterface,    IN EFI_TEST_LEVEL             TestLevel,    IN EFI_HANDLE                 SupportHandle){    EFI_STANDARD_TEST_LIBRARY_PROTOCOL   *StandardLib;    EFI_STATUS                           Status;    EFI_DEVICE_PATH_PROTOCOL             *DevicePath;    EFI_TEST_ASSERTION                   AssertionType;    UINT16                               Type;    UINT16                               SubType;    UINT16                               Length;    UINT16                               Count;    UINT16                               PCIRootFirst;    UINT16                               SCSICount;    UINT16                               ATAPICount;    ACPI_HID_DEVICE_PATH                 *Acpi;    CHAR16                               *DevStr;    //    // Verify whether it is one of IHV interfaces    //    if (! IsIhvInterface (ClientInterface, SupportHandle)) {        return EFI_UNSUPPORTED;    }    //    // Get the Standard Library Interface    //    Status = gtBS->HandleProtocol (                 SupportHandle,                 &gEfiStandardTestLibraryGuid,                 &StandardLib             );    if (EFI_ERROR(Status)) {        StandardLib->RecordAssertion (            StandardLib,            EFI_TEST_ASSERTION_FAILED,            gTestGenericFailureGuid,            L"BS.HandleProtocol - Handle standard test library",            L"%a:%d:Status - %r",            __FILE__,            __LINE__,            Status        );        return Status;    }    DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)ClientInterface;    DevStr = DevicePathToStr (DevicePath);    StandardLib->RecordMessage (        StandardLib,        EFI_VERBOSE_LEVEL_QUIET,        L"/nVerifying device path: %s/n",        DevStr    );    gtBS->FreePool (DevStr);    Count = 0;    PCIRootFirst = 0;    SCSICount = 0;    ATAPICount = 0;    while (!IsDevicePathEnd (DevicePath)) {        Type    = (UINT16)DevicePathType (DevicePath);        SubType = (UINT16)DevicePathSubType (DevicePath);        Length  = (UINT16)DevicePathNodeLength (DevicePath);        Count++;        //        // Assertion Point 3.2.2.1        // BIOS Root Specification Device Path        //        if ((Type == 5) && (SubType == 1)) {            if (Count != 1) {                AssertionType = EFI_TEST_ASSERTION_FAILED;            } else {                DevicePath = NextDevicePathNode (DevicePath);                if(IsDevicePathEnd (DevicePath)) {                    AssertionType = EFI_TEST_ASSERTION_PASSED;                } else {                    AssertionType = EFI_TEST_ASSERTION_FAILED;                }            }            StandardLib->RecordAssertion (                StandardLib,                AssertionType,                gDevicePathBBTestFunctionAssertionGuid030,                L"EFI_DEVICE_PATH_PROTOCOL - BIOS Root Specification Device Path",                L"%a:%d:Type - %d, Subtype - %d, Length - %d",                __FILE__,//.........这里部分代码省略.........
开发者ID:jljusten,项目名称:efi-sct,代码行数:101,


示例30: BBTestDevicePathNodeConformanceAutoTest

//// TDS 3.1//EFI_STATUSBBTestDevicePathNodeConformanceAutoTest (    IN EFI_BB_TEST_PROTOCOL       *This,    IN VOID                       *ClientInterface,    IN EFI_TEST_LEVEL             TestLevel,    IN EFI_HANDLE                 SupportHandle){    EFI_STANDARD_TEST_LIBRARY_PROTOCOL   *StandardLib;    EFI_STATUS                           Status;    EFI_DEVICE_PATH_PROTOCOL             *DevicePath;    EFI_TEST_ASSERTION                   AssertionType;    UINT16                               Type;    UINT16                               SubType;    UINT16                               Length;    MEMMAP_DEVICE_PATH                   *MemMap;    IPv4_DEVICE_PATH                     *IPv4;    IPv6_DEVICE_PATH                     *IPv6;    ATAPI_DEVICE_PATH                    *Atapi;    UART_DEVICE_PATH                     *Uart;    VENDOR_DEVICE_PATH                   *Vendor;    HARDDRIVE_DEVICE_PATH                *Hd;    CHAR16                               *DevStr;    //    // Verify whether it is one of IHV interfaces    //    if (! IsIhvInterface (ClientInterface, SupportHandle)) {        return EFI_UNSUPPORTED;    }    //    // Get the Standard Library Interface    //    Status = gtBS->HandleProtocol (                 SupportHandle,                 &gEfiStandardTestLibraryGuid,                 &StandardLib             );    if (EFI_ERROR(Status)) {        StandardLib->RecordAssertion (            StandardLib,            EFI_TEST_ASSERTION_FAILED,            gTestGenericFailureGuid,            L"BS.HandleProtocol - Handle standard test library",            L"%a:%d:Status - %r",            __FILE__,            __LINE__,            Status        );        return Status;    }    DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)ClientInterface;    DevStr = DevicePathToStr (DevicePath);    StandardLib->RecordMessage (        StandardLib,        EFI_VERBOSE_LEVEL_QUIET,        L"/nVerifying device path: %s/n",        DevStr    );    gtBS->FreePool (DevStr);    while (!IsDevicePathEnd (DevicePath)) {        Type    = (UINT16)DevicePathType (DevicePath);        SubType = (UINT16)DevicePathSubType (DevicePath);        Length  = (UINT16)DevicePathNodeLength (DevicePath);        //        // Assertion Point 3.1.2.2        // Check End of Hardware Device Path: End This Device Path        //        if ((Type == 0x7F || Type == 0xFF) && (SubType == 0x01)) {            if (Length == 4) {                AssertionType = EFI_TEST_ASSERTION_PASSED;            } else {                AssertionType = EFI_TEST_ASSERTION_FAILED;            }            StandardLib->RecordAssertion (                StandardLib,                AssertionType,                gDevicePathBBTestFunctionAssertionGuid001,                L"EFI_DEVICE_PATH_PROTOCOL - End of Hardware Device Path - End This Device Path",                L"%a:%d:Type - %d, Subtype - %d, Length - %d",                __FILE__,                __LINE__,                Type,                SubType,                Length            );        }        //        // Assertion Point 3.1.2.3        // Check Hardware Device Path: PCI Device Path//.........这里部分代码省略.........
开发者ID:jljusten,项目名称:efi-sct,代码行数:101,



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


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