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

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

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

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

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

示例1: efi_main

EFI_STATUSefi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab){	EFI_LOADED_IMAGE *loaded_image = NULL;#if 0	EFI_DEVICE_PATH *dev_path;#endif	EFI_STATUS status;	InitializeLib(image, systab);	status = uefi_call_wrapper(systab->BootServices->HandleProtocol,				3,				image, 				&LoadedImageProtocol, 				(void **) &loaded_image);	if (EFI_ERROR(status)) {		Print(L"handleprotocol: %r/n", status);	}#if 0	BS->HandleProtocol(loaded_image->DeviceHandle, &DevicePathProtocol, (void **) &dev_path);	Print(L"Image device      : %s/n", DevicePathToStr(dev_path));	Print(L"Image file        : %s/n", DevicePathToStr(loaded_image->FilePath));#endif	Print(L"Image base        : %lx/n", loaded_image->ImageBase);	Print(L"Image size        : %lx/n", loaded_image->ImageSize);	Print(L"Load options size : %lx/n", loaded_image->LoadOptionsSize);	Print(L"Load options      : %s/n", loaded_image->LoadOptions);	return EFI_SUCCESS;}
开发者ID:Celelibi,项目名称:gnu-efi,代码行数:32,


示例2: DisplayEntries

VOID DisplayEntries(EFI_DEVICE_PATH *ldr, UINTN slice, UINTN index, VOID *ctx) {    EFI_DEVICE_PATH *pDevice = GetParentDevice(ldr);    CHAR16 *pszDevice = DevicePathToStr(GetLastDevicePath(pDevice));    Print(L"[%d] %s/n", index - slice + 1, pszDevice);    FreePool(pszDevice);    FreePool(pDevice);}
开发者ID:linnaea,项目名称:uefi-ntfs-multiboot,代码行数:7,


示例3: DisconnectBlockingDrivers

/** Some UEFI firmwares (like HPQ EFI from HP notebooks) have DiskIo protocols* opened BY_DRIVER (by Partition driver in HP case) even when no file system* is produced from this DiskIo. This then blocks our FS driver from connecting* and producing file systems.* To fix it we disconnect drivers that connected to DiskIo BY_DRIVER if this* is a partition volume and if those drivers did not produce file system.*/static VOID DisconnectBlockingDrivers(VOID) {    EFI_STATUS Status;    UINTN HandleCount = 0, Index, OpenInfoIndex, OpenInfoCount;    EFI_HANDLE *Handles = NULL;    CHAR16 *DevicePathString;    EFI_FILE_IO_INTERFACE *Volume;    EFI_BLOCK_IO *BlockIo;    EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo;    // Get all DiskIo handles    Status = BS->LocateHandleBuffer(ByProtocol, &DiskIoProtocol, NULL, &HandleCount, &Handles);    if (EFI_ERROR(Status) || (HandleCount == 0))        return;    // Check every DiskIo handle    for (Index = 0; Index < HandleCount; Index++) {        // If this is not partition - skip it.        // This is then whole disk and DiskIo        // should be opened here BY_DRIVER by Partition driver        // to produce partition volumes.        Status = BS->HandleProtocol(Handles[Index], &BlockIoProtocol, (VOID **)&BlockIo);        if (EFI_ERROR(Status))            continue;        if ((BlockIo->Media == NULL) || (!BlockIo->Media->LogicalPartition))            continue;        // If SimpleFileSystem is already produced - skip it, this is ok        Status = BS->HandleProtocol(Handles[Index], &FileSystemProtocol, (VOID **)&Volume);        if (Status == EFI_SUCCESS)            continue;        DevicePathString = DevicePathToStr(DevicePathFromHandle(Handles[Index]));        Print(L"%N/r[ INFO ] Probing %d devices... [%d] %s", HandleCount, Index + 1, DevicePathString);        FreePool(DevicePathString);        // If no SimpleFileSystem on this handle but DiskIo is opened BY_DRIVER        // then disconnect this connection        Status = BS->OpenProtocolInformation(Handles[Index], &DiskIoProtocol, &OpenInfo, &OpenInfoCount);        if (EFI_ERROR(Status)) {            Print(L"%H/n[ WARN ] Could not get DiskIo protocol: %r/n", Status);            FreePool(DevicePathString);            continue;        }        if (OpenInfoCount > 0)            Print(L"%N/n[ INFO ] Disconnecting %d drivers...", OpenInfoCount);        for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {            if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) == EFI_OPEN_PROTOCOL_BY_DRIVER) {                Print(L"%N/r[ INFO ] Disconnecting %d drivers... [%d] %s", OpenInfoCount, OpenInfoIndex+1, GetDriverName(OpenInfo[OpenInfoIndex].AgentHandle));                Status = BS->DisconnectController(Handles[Index], OpenInfo[OpenInfoIndex].AgentHandle, NULL);                if (EFI_ERROR(Status)) {                    Print(L"%H/n[ WARN ] Could not disconnect driver: %r/n", Status);                }            }        }        FreePool(OpenInfo);    }    FreePool(Handles);}
开发者ID:linnaea,项目名称:uefi-ntfs-multiboot,代码行数:68,


示例4: LibGetUiString

CHAR16 *LibGetUiString (    IN  EFI_HANDLE      Handle,    IN  UI_STRING_TYPE  StringType,    IN  ISO_639_2       *LangCode,    IN  BOOLEAN         ReturnDevicePathStrOnMismatch    ){    UI_INTERFACE    *Ui;    UI_STRING_TYPE  Index;    UI_STRING_ENTRY *Array;    EFI_STATUS      Status;        Status = uefi_call_wrapper(BS->HandleProtocol, 3, Handle, &UiProtocol, (VOID *)&Ui);    if (EFI_ERROR(Status)) {        return (ReturnDevicePathStrOnMismatch) ? DevicePathToStr(DevicePathFromHandle(Handle)) : NULL;    }    //    // Skip the first strings    //    for (Index = UiDeviceString, Array = Ui->Entry; Index < StringType; Index++, Array++) {        while (Array->LangCode) {            Array++;        }    }    //    // Search for the match    //    while (Array->LangCode) {        if (strcmpa (Array->LangCode, LangCode) == 0) {            return Array->UiString;         }    }    return (ReturnDevicePathStrOnMismatch) ? DevicePathToStr(DevicePathFromHandle(Handle)) : NULL;}
开发者ID:michas2,项目名称:l4re-snapshot,代码行数:37,


示例5: generate_path

EFI_STATUSgenerate_path(CHAR16* name, EFI_LOADED_IMAGE *li, EFI_DEVICE_PATH **path, CHAR16 **PathName){	unsigned int pathlen;	EFI_STATUS efi_status = EFI_SUCCESS;	CHAR16 *devpathstr = DevicePathToStr(li->FilePath),		*found = NULL;	unsigned int i;	for (i = 0; i < StrLen(devpathstr); i++) {		if (devpathstr[i] == '/')			devpathstr[i] = '//';		if (devpathstr[i] == '//')			found = &devpathstr[i];	}	if (!found) {		pathlen = 0;	} else {		while (*(found - 1) == '//')			--found;		*found = '/0';		pathlen = StrLen(devpathstr);	}	if (name[0] != '//')		pathlen++;	*PathName = AllocatePool((pathlen + 1 + StrLen(name))*sizeof(CHAR16));	if (!*PathName) {		Print(L"Failed to allocate path buffer/n");		efi_status = EFI_OUT_OF_RESOURCES;		goto error;	}	StrCpy(*PathName, devpathstr);	if (name[0] != '//')		StrCat(*PathName, L"//");	StrCat(*PathName, name);		*path = FileDevicePath(li->DeviceHandle, *PathName);error:	FreePool(devpathstr);	return efi_status;}
开发者ID:Acidburn0zzz,项目名称:shim,代码行数:48,


示例6: DevicePathStrFromProtocol

UINT16 *DevicePathStrFromProtocol (  IN VOID        *Protocol,  IN EFI_GUID    *Guid  ){  EFI_STATUS                          Status;  UINTN                                HandleNum;  EFI_HANDLE                          *HandleBuffer;  EFI_DEVICE_PATH_PROTOCOL            *DevicePath;  UINTN                               Index;  UINT16                              *Str;  VOID                                *Interface;  //BOOLEAN                             Found;  //Found = FALSE;  Str = NULL;  HandleNum    = 0;  Status      = LibLocateHandle(                  ByProtocol,                  Guid,                  NULL,                  &HandleNum,                  &HandleBuffer                  );  if (EFI_ERROR(Status) || HandleNum == 0) {    return NULL;  }  for ( Index = 0 ; Index < HandleNum ; Index ++ ) {    Status = tBS->HandleProtocol (HandleBuffer[Index], Guid, &Interface);    if (EFI_ERROR(Status)) {      continue;    }    if (Interface == Protocol) {      Status = tBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, &DevicePath);      if (!EFI_ERROR(Status)) {        //Found = TRUE;        Str = DevicePathToStr(DevicePath);      }      break;    }  }  return Str;}
开发者ID:jljusten,项目名称:efi-sct,代码行数:47,


示例7: ConnectRecursivelyIfPciMassStorage

EFI_STATUSEFIAPIConnectRecursivelyIfPciMassStorage (  IN EFI_HANDLE           Handle,  IN EFI_PCI_IO_PROTOCOL  *Instance,  IN PCI_TYPE00           *PciHeader  ){  EFI_STATUS                Status;  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;  CHAR16                    *DevPathStr;  if (IS_CLASS1 (PciHeader, PCI_CLASS_MASS_STORAGE)) {    DevicePath = NULL;    Status = gBS->HandleProtocol (                    Handle,                    &gEfiDevicePathProtocolGuid,                    (VOID*)&DevicePath                    );    if (EFI_ERROR (Status)) {      return Status;    }    //    // Print Device Path    //    DevPathStr = DevicePathToStr (DevicePath);    if (DevPathStr != NULL) {      DEBUG((        EFI_D_INFO,        "Found Mass Storage device: %s/n",        DevPathStr        ));      FreePool(DevPathStr);    }    Status = gBS->ConnectController (Handle, NULL, NULL, TRUE);    if (EFI_ERROR (Status)) {      return Status;    }  }  return EFI_SUCCESS;}
开发者ID:jeppeter,项目名称:vbox,代码行数:45,


示例8: try_start_first_option

static EFI_STATUStry_start_first_option(EFI_HANDLE parent_image_handle){	EFI_STATUS rc;	EFI_HANDLE image_handle;	if (!first_new_option) {		return EFI_SUCCESS;	}	rc = uefi_call_wrapper(BS->LoadImage, 6, 0, parent_image_handle,			       first_new_option, NULL, 0,			       &image_handle);	if (EFI_ERROR(rc)) {		CHAR16 *dps = DevicePathToStr(first_new_option);		UINTN s = DevicePathSize(first_new_option);		unsigned int i;		UINT8 *dpv = (void *)first_new_option;		Print(L"LoadImage failed: %d/nDevice path: /"%s/"/n", rc, dps);		for (i = 0; i < s; i++) {			if (i > 0 && i % 16 == 0)				Print(L"/n");			Print(L"%02x ", dpv[i]);		}		Print(L"/n");		uefi_call_wrapper(BS->Stall, 1, 500000000);		return rc;	}	EFI_LOADED_IMAGE *image;	rc = uefi_call_wrapper(BS->HandleProtocol, 3, image_handle, &LoadedImageProtocol, (void *)&image);	if (!EFI_ERROR(rc)) {		image->LoadOptions = first_new_option_args;		image->LoadOptionsSize = first_new_option_size;	}	rc = uefi_call_wrapper(BS->StartImage, 3, image_handle, NULL, NULL);	if (EFI_ERROR(rc)) {		Print(L"StartImage failed: %d/n", rc);		uefi_call_wrapper(BS->Stall, 1, 500000000);	}	return rc;}
开发者ID:Acidburn0zzz,项目名称:shim,代码行数:44,


示例9: get_path

static inline BOOLEANget_path(EFI_LOADED_IMAGE *image, CHAR16 *path, UINTN len){	CHAR16 *buf, *p, *q;	int i, dev;	dev = handle_to_dev(image->DeviceHandle);	if (dev == -1) {		error(L"Couldn't find boot device handle/n");		return FALSE;	}	/* Find the path of the efilinux executable*/	p = DevicePathToStr(image->FilePath);	if (!p) {		error(L"Failed to get string from device path/n");		return FALSE;	}	q = p + StrLen(p);	i = StrLen(p);	while (*q != '//' && *q != '/') {		q--;		i--;	}	buf = malloc((i + 1) * sizeof(CHAR16));	if (!buf) {		error(L"Failed to allocate buf/n");		FreePool(p);		return FALSE;	}	memcpy((CHAR8 *)buf, (CHAR8 *)p, i * sizeof(CHAR16));	FreePool(p);	buf[i] = '/0';	SPrint(path, len, L"%d:%s//%s", dev, buf, EFILINUX_CONFIG);	return TRUE;}
开发者ID:TheTypoMaster,项目名称:x86-android-5.0,代码行数:42,


示例10: LocateSerialIo

EFI_STATUSLocateSerialIo (    VOID)/*++Routine Description:  Build a list containing all serial devicesArguments:Returns:--*/{    UINT8                     *Ptr;    UINTN                     Index;    UINTN                     Index2;    UINTN                     NoHandles;    EFI_HANDLE                *Handles;    EFI_STATUS                Status;    ACPI_HID_DEVICE_PATH      *Acpi;    EFI_DEVICE_PATH_PROTOCOL  *DevicePath;    UINT32                    Match;    EFI_SERIAL_IO_PROTOCOL    *SerialIo;    EFI_DEVICE_PATH_PROTOCOL  *OutDevicePath;    EFI_DEVICE_PATH_PROTOCOL  *InpDevicePath;    EFI_DEVICE_PATH_PROTOCOL  *ErrDevicePath;    BM_MENU_ENTRY             *NewMenuEntry;    BM_TERMINAL_CONTEXT       *NewTerminalContext;    EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;    VENDOR_DEVICE_PATH        Vendor;    //    // Get all handles that have SerialIo protocol installed    //    InitializeListHead (&TerminalMenu.Head);    TerminalMenu.MenuNumber = 0;    Status = gBS->LocateHandleBuffer (                 ByProtocol,                 &gEfiSerialIoProtocolGuid,                 NULL,                 &NoHandles,                 &Handles             );    if (EFI_ERROR (Status)) {        //        // No serial ports present        //        return EFI_UNSUPPORTED;    }    //    // Sort Uart handles array with Acpi->UID from low to high    // then Terminal menu can be built from low Acpi->UID to high Acpi->UID    //    SortedUartHandle (Handles, NoHandles);    for (Index = 0; Index < NoHandles; Index++) {        //        // Check to see whether the handle has DevicePath Protocol installed        //        gBS->HandleProtocol (            Handles[Index],            &gEfiDevicePathProtocolGuid,            &DevicePath        );        Ptr = (UINT8 *) DevicePath;        while (*Ptr != END_DEVICE_PATH_TYPE) {            Ptr++;        }        Ptr   = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);        Acpi  = (ACPI_HID_DEVICE_PATH *) Ptr;        Match = EISA_PNP_ID (0x0501);        if (EfiCompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {            NewMenuEntry = BOpt_CreateMenuEntry (BM_TERMINAL_CONTEXT_SELECT);            if (!NewMenuEntry) {                SafeFreePool (Handles);                return EFI_OUT_OF_RESOURCES;            }            NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;            EfiCopyMem (&NewMenuEntry->OptionNumber, &Acpi->UID, sizeof (UINT32));            NewTerminalContext->DevicePath = DevicePathInstanceDup (DevicePath);            //            // BugBug: I have no choice, calling EfiLibStrFromDatahub will hang the system!            // coz' the misc data for each platform is not correct, actually it's the device path stored in            // datahub which is not completed, so a searching for end of device path will enter a            // dead-loop.            //            NewMenuEntry->DisplayString = EfiLibStrFromDatahub (DevicePath);            if (NULL == NewMenuEntry->DisplayString) {                NewMenuEntry->DisplayString = DevicePathToStr (DevicePath);            }            NewMenuEntry->HelpString = NULL;            gBS->HandleProtocol (                Handles[Index],//.........这里部分代码省略.........
开发者ID:Kohrara,项目名称:edk,代码行数:101,


示例11: GetConsoleMenu

EFI_STATUSGetConsoleMenu (    IN UINTN              ConsoleMenuType){    EFI_DEVICE_PATH_PROTOCOL  *DevicePath;    EFI_DEVICE_PATH_PROTOCOL  *AllDevicePath;    EFI_DEVICE_PATH_PROTOCOL  *MultiDevicePath;    EFI_DEVICE_PATH_PROTOCOL  *DevicePathInst;    UINTN                     Size;    UINTN                     AllCount;    UINTN                     Index;    UINTN                     Index2;    BM_MENU_ENTRY             *NewMenuEntry;    BM_CONSOLE_CONTEXT        *NewConsoleContext;    BM_TERMINAL_CONTEXT       *NewTerminalContext;    TYPE_OF_TERMINAL          Terminal;    BM_MENU_ENTRY             *NewTerminalMenuEntry;    UINTN                     Com;    BM_MENU_OPTION            *ConsoleMenu;    DevicePath    = NULL;    AllDevicePath = NULL;    AllCount      = 0;    switch (ConsoleMenuType) {    case BM_CONSOLE_IN_CONTEXT_SELECT:        ConsoleMenu = &ConsoleInpMenu;        DevicePath = EfiLibGetVariable (                         L"ConIn",                         &gEfiGlobalVariableGuid                     );        AllDevicePath = EfiLibGetVariable (                            L"ConInDev",                            &gEfiGlobalVariableGuid                        );        break;    case BM_CONSOLE_OUT_CONTEXT_SELECT:        ConsoleMenu = &ConsoleOutMenu;        DevicePath = EfiLibGetVariable (                         L"ConOut",                         &gEfiGlobalVariableGuid                     );        AllDevicePath = EfiLibGetVariable (                            L"ConOutDev",                            &gEfiGlobalVariableGuid                        );        break;    case BM_CONSOLE_ERR_CONTEXT_SELECT:        ConsoleMenu = &ConsoleErrMenu;        DevicePath = EfiLibGetVariable (                         L"ErrOut",                         &gEfiGlobalVariableGuid                     );        AllDevicePath = EfiLibGetVariable (                            L"ErrOutDev",                            &gEfiGlobalVariableGuid                        );        break;    default:        return EFI_UNSUPPORTED;    }    if (NULL == AllDevicePath) {        return EFI_NOT_FOUND;    }    InitializeListHead (&ConsoleMenu->Head);    AllCount                = EfiDevicePathInstanceCount (AllDevicePath);    ConsoleMenu->MenuNumber = 0;    //    // Following is menu building up for Console Out Devices    //    MultiDevicePath = AllDevicePath;    Index2          = 0;    for (Index = 0; Index < AllCount; Index++) {        DevicePathInst  = EfiDevicePathInstance (&MultiDevicePath, &Size);        NewMenuEntry    = BOpt_CreateMenuEntry (BM_CONSOLE_CONTEXT_SELECT);        if (NULL == NewMenuEntry) {            return EFI_OUT_OF_RESOURCES;        }        NewConsoleContext             = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;        NewMenuEntry->OptionNumber    = Index2;        NewConsoleContext->DevicePath = DevicePathInstanceDup (DevicePathInst);        NewMenuEntry->DisplayString   = EfiLibStrFromDatahub (NewConsoleContext->DevicePath);        if (NULL == NewMenuEntry->DisplayString) {            NewMenuEntry->DisplayString = DevicePathToStr (NewConsoleContext->DevicePath);        }        NewConsoleContext->IsTerminal = IsTerminalDevicePath (                                            NewConsoleContext->DevicePath,//.........这里部分代码省略.........
开发者ID:Kohrara,项目名称:edk,代码行数:101,


示例12: efi_main

EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {        EFI_LOADED_IMAGE *loaded_image;        EFI_FILE *root_dir;        CHAR16 *loaded_image_path;        CHAR8 *b;        UINTN size;        BOOLEAN secure = FALSE;        CHAR8 *sections[] = {                (UINT8 *)".cmdline",                (UINT8 *)".linux",                (UINT8 *)".initrd",                (UINT8 *)".splash",                NULL        };        UINTN addrs[ELEMENTSOF(sections)-1] = {};        UINTN offs[ELEMENTSOF(sections)-1] = {};        UINTN szs[ELEMENTSOF(sections)-1] = {};        CHAR8 *cmdline = NULL;        UINTN cmdline_len;        CHAR16 uuid[37];        EFI_STATUS err;        InitializeLib(image, sys_table);        err = uefi_call_wrapper(BS->OpenProtocol, 6, image, &LoadedImageProtocol, (VOID **)&loaded_image,                                image, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);        if (EFI_ERROR(err)) {                Print(L"Error getting a LoadedImageProtocol handle: %r ", err);                uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000);                return err;        }        root_dir = LibOpenRoot(loaded_image->DeviceHandle);        if (!root_dir) {                Print(L"Unable to open root directory: %r ", err);                uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000);                return EFI_LOAD_ERROR;        }        loaded_image_path = DevicePathToStr(loaded_image->FilePath);        if (efivar_get_raw(&global_guid, L"SecureBoot", &b, &size) == EFI_SUCCESS) {                if (*b > 0)                        secure = TRUE;                FreePool(b);        }        err = pefile_locate_sections(root_dir, loaded_image_path, sections, addrs, offs, szs);        if (EFI_ERROR(err)) {                Print(L"Unable to locate embedded .linux section: %r ", err);                uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000);                return err;        }        if (szs[0] > 0)                cmdline = (CHAR8 *)(loaded_image->ImageBase + addrs[0]);        cmdline_len = szs[0];        /* if we are not in secure boot mode, accept a custom command line and replace the built-in one */        if (!secure && loaded_image->LoadOptionsSize > 0) {                CHAR16 *options;                CHAR8 *line;                UINTN i;                options = (CHAR16 *)loaded_image->LoadOptions;                cmdline_len = (loaded_image->LoadOptionsSize / sizeof(CHAR16)) * sizeof(CHAR8);                line = AllocatePool(cmdline_len);                for (i = 0; i < cmdline_len; i++)                        line[i] = options[i];                cmdline = line;#ifdef SD_BOOT_LOG_TPM                /* Try to log any options to the TPM, escpecially manually edited options */                err = tpm_log_event(SD_TPM_PCR,                                    (EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions,                                    loaded_image->LoadOptionsSize, loaded_image->LoadOptions);                if (EFI_ERROR(err)) {                        Print(L"Unable to add image options measurement: %r", err);                        uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000);                        return err;                }#endif        }        /* export the device path this image is started from */        if (disk_get_part_uuid(loaded_image->DeviceHandle, uuid) == EFI_SUCCESS)                efivar_set(L"LoaderDevicePartUUID", uuid, FALSE);        if (szs[3] > 0)                graphics_splash((UINT8 *)((UINTN)loaded_image->ImageBase + addrs[3]), szs[3], NULL);        err = linux_exec(image, cmdline, cmdline_len,                         (UINTN)loaded_image->ImageBase + addrs[1],                         (UINTN)loaded_image->ImageBase + addrs[2], szs[2]);        graphics_mode(FALSE);        Print(L"Execution of embedded linux image failed: %r/n", err);        uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000);        return err;//.........这里部分代码省略.........
开发者ID:AOSC-Dev,项目名称:systemd,代码行数:101,


示例13: InitTestEnv

//.........这里部分代码省略.........                      (*StandardLib),                      EFI_TEST_ASSERTION_FAILED,                      gTestGenericFailureGuid,                      L"BS.LocateHandle - LocateHandle",                      L"%a:%d:Device Error",                      __FILE__,                      (UINTN)__LINE__                      );    return EFI_DEVICE_ERROR;  }  //  // Find the exact handle that GraphicsOutput bound to  //  for (Index = 0; Index < NoHandles; Index++) {    Status = gtBS->HandleProtocol (                     HandleBuffer[Index],                     &gEfiGraphicsOutputProtocolGuid,                     &OtherGraphicsOutput                     );    if (EFI_ERROR (Status)) {      (*StandardLib)->RecordAssertion (                        (*StandardLib),                        EFI_TEST_ASSERTION_FAILED,                        gTestGenericFailureGuid,                        L"BS.HandleProtocol - HandleProtocol",                        L"%a:%d:Status - %r",                        __FILE__,                        (UINTN)__LINE__,                        Status                        );      gtBS->FreePool (HandleBuffer);      return Status;    }    if (OtherGraphicsOutput == GraphicsOutput) {      break;    }  }  //  // Locate the DevicePath Protocol bound to GraphicsOutput Protocol  //  if (Index >= NoHandles) {    //    // No Handle Found!!    //    gtBS->FreePool (HandleBuffer);    return EFI_DEVICE_ERROR;  }  Status = gtBS->HandleProtocol (                   HandleBuffer[Index],                   &gEfiDevicePathProtocolGuid,                   &DevicePath                   );  gtBS->FreePool (HandleBuffer);  if (Status == EFI_SUCCESS) {    DevicePathStr = DevicePathToStr (DevicePath);    if (DevicePathStr != NULL) {      (*StandardLib)->RecordMessage (                        (*StandardLib),                        EFI_VERBOSE_LEVEL_DEFAULT,                        L"/r/nCurrent Device: %s",                        DevicePathStr                        );      Status = gtBS->FreePool (DevicePathStr);      if (EFI_ERROR (Status)) {        (*StandardLib)->RecordAssertion (                          (*StandardLib),                          EFI_TEST_ASSERTION_FAILED,                          gTestGenericFailureGuid,                          L"BS.FreePool - Free pool",                          L"%a:%d:Status - %r",                          __FILE__,                          (UINTN)__LINE__,                          Status                          );        return Status;      }      DevicePathStr = NULL;    }  } else {    //    // Console Splitter/GraphicsOutput, must add to continue run the rest of the test case    //    (*StandardLib)->RecordMessage (                      (*StandardLib),                      EFI_VERBOSE_LEVEL_DEFAULT,                      L"/r/nCurrent Device: ConsoleSplitter/GraphicsOutput"                      );    return EFI_SUCCESS;  }  return Status;}
开发者ID:JackNine,项目名称:2ndProject,代码行数:101,


示例14: Attributes_Stress

////TDS 4.3.1//EFI_STATUSAttributes_Stress (  IN EFI_BB_TEST_PROTOCOL       *This,  IN VOID                       *ClientInterface,  IN EFI_TEST_LEVEL             TestLevel,  IN EFI_HANDLE                 SupportHandle  ){  EFI_STATUS                            Status;  EFI_STATUS                            Status1;  PCI_IO_PROTOCOL_DEVICE                *PciIoDevice;  EFI_PCI_IO_PROTOCOL                   *PciIo;  EFI_STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;  EFI_TEST_ASSERTION                    AssertionType;  UINT64                                SupportedAttributes;  UINT64                                CurrentAttributes;  UINT64                                OriginalAttributes;  UINT64                                CommonAttributes;  UINTN                                 Index;  UINTN                                 PciIoAttributesNumber;  UINT64                                ThisAttribute;  CHAR16                               *DevicePathStr;  //  //get tested interface.  //  PciIo = (EFI_PCI_IO_PROTOCOL *)ClientInterface;  //  // Get the Standard Library Interface  //  Status = gtBS->HandleProtocol (                   SupportHandle,                   &gEfiStandardTestLibraryGuid,                   &StandardLib                   );  if (EFI_ERROR(Status)) {    return Status;  }  InitializeCaseEnvironment ();  //  //get PciIoDevice struct pointer.  //  PciIoDevice = NULL;  PciIoDevice = GetPciIoDevice (PciIo);  if (PciIoDevice == NULL) {    return EFI_ABORTED;  }  //  //print the device path of pci device.  ////  Status = PrintPciIoDevice (PciIoDevice->DevicePath);//  if (EFI_ERROR(Status)) {//    return Status;//  }  DevicePathStr = DevicePathToStr (PciIoDevice->DevicePath);  if (DevicePathStr == NULL) {    StandardLib->RecordMessage (                   StandardLib,                   EFI_VERBOSE_LEVEL_DEFAULT,                   L"/r/nCannot get DevicePath"                   );  } else {    StandardLib->RecordMessage (                   StandardLib,                   EFI_VERBOSE_LEVEL_DEFAULT,                   L"/r/nCurrent Device: %s",                   DevicePathStr                   );    gtBS->FreePool (DevicePathStr);  }  //  //call Attributes with operation EfiPciIoAttributeOperationGet to  //get current attributes.  //  PciIo->Attributes (           PciIo,           EfiPciIoAttributeOperationGet,           0,           &OriginalAttributes           );  //  //call Attribtes with operation EfiPciIoAttributeOperationSupported to  //get the supported attributes of the pci controller.  //  PciIo->Attributes (           PciIo,           EfiPciIoAttributeOperationSupported,//.........这里部分代码省略.........
开发者ID:jljusten,项目名称:efi-sct,代码行数:101,


示例15: PrepareLpcBridgeDevicePath

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


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


示例17: GatherConfigHandles

//.........这里部分代码省略.........  //  // Initialize the output variables  //  *NoConfigHandles = 0;  Status = gtBS->AllocatePool (                   EfiBootServicesData,                   sizeof(EFI_HANDLE) * NoHandles,                   (VOID **)ConfigHandleBuffer                   );  if (EFI_ERROR (Status)) {    ProfileLib->EfiIniClose (ProfileLib, IniFile);    gtBS->FreePool (HandleBuffer);    return Status;  }  //  // Scan each device configuration data  //  for (Order = 0; Order < OrderNum; Order++) {    //    // Here, need to check the setting in configuration file and find the    // matched device path in the system    //    Status = DeviceConfigGetString (               IniFile,               Order,               L"DriverConfiguration",               Buffer               );    if (EFI_ERROR (Status)) {      continue;    }    if (StriCmp (Buffer, L"Yes") != 0) {      continue;    }    Status = DeviceConfigGetString (               IniFile,               Order,               L"DevicePath",               Buffer               );    if (EFI_ERROR (Status)) {      continue;    }    //    // Search the matched device path in the system    //    for (Index = 0; Index < NoHandles; Index++) {      Status = gtBS->HandleProtocol (                       HandleBuffer[Index],                       &gEfiDevicePathProtocolGuid,                       &DevicePath                       );      if (EFI_ERROR (Status)) {        continue;      }      DevicePathStr = DevicePathToStr (DevicePath);      if (StrCmp (Buffer, DevicePathStr) == 0) {        gtBS->FreePool (DevicePathStr);        break;      }      gtBS->FreePool (DevicePathStr);    }    //    // Found it?    //    if (Index < NoHandles) {      InsertChildHandles (        NoConfigHandles,        *ConfigHandleBuffer,        HandleBuffer[Index],        FALSE                       // Only for the handles on this controller        );    }  }  //  // Free resources  //  gtBS->FreePool (HandleBuffer);  //  // Close the device configuration file  //  ProfileLib->EfiIniClose (ProfileLib, IniFile);  //  // Done  //  return EFI_SUCCESS;}
开发者ID:jljusten,项目名称:efi-sct,代码行数:101,


示例18: CallBootManager

//.........这里部分代码省略.........        //        IsLegacyOption = (BOOLEAN) (                             (DevicePathType (Option->DevicePath) == BBS_DEVICE_PATH) &&                             (DevicePathSubType (Option->DevicePath) == BBS_BBS_DP)                         );        if (!IsLegacyOption && NeedEndOp) {            NeedEndOp = FALSE;            HiiCreateEndOpCode (StartOpCodeHandle);        }        if (IsLegacyOption && DeviceType != ((BBS_BBS_DEVICE_PATH *) Option->DevicePath)->DeviceType) {            if (NeedEndOp) {                HiiCreateEndOpCode (StartOpCodeHandle);            }            DeviceType = ((BBS_BBS_DEVICE_PATH *) Option->DevicePath)->DeviceType;            Token      = HiiSetString (                             HiiHandle,                             0,                             mDeviceTypeStr[                                 MIN (DeviceType & 0xF, ARRAY_SIZE (mDeviceTypeStr) - 1)                             ],                             NULL                         );            HiiCreateSubTitleOpCode (StartOpCodeHandle, Token, 0, 0, 1);            NeedEndOp = TRUE;        }        ASSERT (Option->Description != NULL);        Token = HiiSetString (HiiHandle, 0, Option->Description, NULL);        TempStr = DevicePathToStr (Option->DevicePath);        HelpSize = StrSize (TempStr) + StrSize (L"Device Path : ");        HelpString = AllocateZeroPool (HelpSize);        ASSERT (HelpString != NULL);        StrCatS (HelpString, HelpSize / sizeof (CHAR16), L"Device Path : ");        StrCatS (HelpString, HelpSize / sizeof (CHAR16), TempStr);        HelpToken = HiiSetString (HiiHandle, 0, HelpString, NULL);        HiiCreateActionOpCode (            StartOpCodeHandle,            mKeyInput,            Token,            HelpToken,            EFI_IFR_FLAG_CALLBACK,            0        );    }    if (NeedEndOp) {        HiiCreateEndOpCode (StartOpCodeHandle);    }    HiiUpdateForm (        HiiHandle,        &gBootManagerFormSetGuid,        BOOT_MANAGER_FORM_ID,        StartOpCodeHandle,        EndOpCodeHandle    );    HiiFreeOpCodeHandle (StartOpCodeHandle);    HiiFreeOpCodeHandle (EndOpCodeHandle);
开发者ID:EvanLloyd,项目名称:tianocore,代码行数:67,


示例19: add_to_boot_list

EFI_STATUSadd_to_boot_list(EFI_FILE_HANDLE fh, CHAR16 *dirname, CHAR16 *filename, CHAR16 *label, CHAR16 *arguments){	CHAR16 *fullpath = NULL;	UINT64 pathlen = 0;	EFI_STATUS rc = EFI_SUCCESS;	rc = make_full_path(dirname, filename, &fullpath, &pathlen);	if (EFI_ERROR(rc))		return rc;		EFI_DEVICE_PATH *dph = NULL;	EFI_DEVICE_PATH *file = NULL;	EFI_DEVICE_PATH *full_device_path = NULL;	EFI_DEVICE_PATH *dp = NULL;		dph = DevicePathFromHandle(this_image->DeviceHandle);	if (!dph) {		rc = EFI_OUT_OF_RESOURCES;		goto err;	}	file = FileDevicePath(fh, fullpath);	if (!file) {		rc = EFI_OUT_OF_RESOURCES;		goto err;	}	full_device_path = AppendDevicePath(dph, file);	if (!full_device_path) {		rc = EFI_OUT_OF_RESOURCES;		goto err;	}	rc = FindSubDevicePath(full_device_path,				MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, &dp);	if (EFI_ERROR(rc)) {		if (rc == EFI_NOT_FOUND) {			dp = full_device_path;		} else {			rc = EFI_OUT_OF_RESOURCES;			goto err;		}	}#ifdef DEBUG_FALLBACK	{	UINTN s = DevicePathSize(dp);	UINTN i;	UINT8 *dpv = (void *)dp;	for (i = 0; i < s; i++) {		if (i > 0 && i % 16 == 0)			Print(L"/n");		Print(L"%02x ", dpv[i]);	}	Print(L"/n");	CHAR16 *dps = DevicePathToStr(dp);	Print(L"device path: /"%s/"/n", dps);	}#endif	UINT16 option;	rc = find_boot_option(dp, full_device_path, fullpath, label, arguments, &option);	if (EFI_ERROR(rc)) {		add_boot_option(dp, full_device_path, fullpath, label, arguments);	} else if (option != 0) {		CHAR16 *newbootorder;		newbootorder = AllocateZeroPool(sizeof (CHAR16) * nbootorder);		if (!newbootorder)			return EFI_OUT_OF_RESOURCES;		newbootorder[0] = bootorder[option];		CopyMem(newbootorder + 1, bootorder, sizeof (CHAR16) * option);		CopyMem(newbootorder + option + 1, bootorder + option + 1,			sizeof (CHAR16) * (nbootorder - option - 1));		FreePool(bootorder);		bootorder = newbootorder;	}err:	if (file)		FreePool(file);	if (full_device_path)		FreePool(full_device_path);	if (dp)		FreePool(dp);	if (fullpath)		FreePool(fullpath);	return rc;}
开发者ID:Acidburn0zzz,项目名称:shim,代码行数:91,


示例20: FSBindingStart

static EFI_STATUS EFIAPIFSBindingStart(EFI_DRIVER_BINDING_PROTOCOL *This,		EFI_HANDLE ControllerHandle,		EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath){	EFI_STATUS Status;	EFI_FS *Instance;	EFI_DEVICE_PATH *DevicePath;	PrintDebug(L"FSBindingStart/n");	/* Allocate a new instance of a filesystem */	Instance = AllocateZeroPool(sizeof(EFI_FS));	if (Instance == NULL) {		Status = EFI_OUT_OF_RESOURCES;		PrintStatusError(Status, L"Could not allocate a new file system instance");		return Status;	}	Instance->FileIoInterface.Revision = EFI_FILE_IO_INTERFACE_REVISION;	Instance->FileIoInterface.OpenVolume = FileOpenVolume,	/* Fill the device path for our instance */	DevicePath = DevicePathFromHandle(ControllerHandle);	if (DevicePath == NULL) {		Status = EFI_NO_MAPPING;		PrintStatusError(Status, L"Could not get Device Path");		goto error;	}	Instance->DevicePathString = DevicePathToStr(DevicePath);	if (Instance->DevicePathString == NULL) {		Status = EFI_OUT_OF_RESOURCES;		PrintStatusError(Status, L"Could not allocate Device Path string");		goto error;	}	/* Get access to the Block IO protocol for this controller */	Status = BS->OpenProtocol(ControllerHandle,			&BlockIoProtocol, (VOID **) &Instance->BlockIo,			This->DriverBindingHandle, ControllerHandle,			/* http://wiki.phoenix.com/wiki/index.php/EFI_BOOT_SERVICES#OpenProtocol.28.29			 * EFI_OPEN_PROTOCOL_BY_DRIVER returns Access Denied here, most likely			 * because the disk driver has that protocol already open. So we use			 * EFI_OPEN_PROTOCOL_GET_PROTOCOL (which doesn't require us to close it)			 */			EFI_OPEN_PROTOCOL_GET_PROTOCOL);	if (EFI_ERROR(Status)) {		PrintStatusError(Status, L"Could not access BlockIO protocol");		goto error;	}	/* Get exclusive access to the Disk IO protocol */	Status = BS->OpenProtocol(ControllerHandle,			&DiskIoProtocol, (VOID**) &Instance->DiskIo,			This->DriverBindingHandle, ControllerHandle,			EFI_OPEN_PROTOCOL_BY_DRIVER);	if (EFI_ERROR(Status)) {		PrintStatusError(Status, L"Could not access the DiskIo protocol");		goto error;	}	/* Go through GRUB target init */	Status = GrubDeviceInit(Instance);	if (EFI_ERROR(Status)) {		PrintStatusError(Status, L"Could not init grub device");		goto error;	}	Status = FSInstall(Instance, ControllerHandle);	/* Unless we close the DiskIO protocol in case of error, no other	 * FS driver will be able to access this partition.	 */	if (EFI_ERROR(Status)) {		GrubDeviceExit(Instance);		BS->CloseProtocol(ControllerHandle, &DiskIoProtocol,			This->DriverBindingHandle, ControllerHandle);	}error:	if (EFI_ERROR(Status))		FreeFsInstance(Instance);	return Status;}
开发者ID:tribals,项目名称:efifs,代码行数:83,


示例21: EBounceMain

EFI_STATUSEFIAPIEBounceMain (IN EFI_HANDLE           ImageHandle,             IN EFI_SYSTEM_TABLE     *SystemTable){    EFI_STATUS              Status;    EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;    EFI_CONSOLE_CONTROL_SCREEN_MODE currentMode;    EFI_LOADED_IMAGE        *SelfLoadedImage;    EFI_FILE                *RootDir;    EFI_FILE                *BootFile;    EFI_DEVICE_PATH         *DevicePath;    CHAR16                  *DevicePathAsString;    CHAR16                  DirName[256];    CHAR16                  FileName[256];    UINTN                   i, FileNameIndex;    EFI_HANDLE              LoaderHandle;        InitializeLib(ImageHandle, SystemTable);        // switch to text mode    if (BS->LocateProtocol(&gEfiConsoleControlProtocolGuid, NULL, &ConsoleControl) == EFI_SUCCESS) {        ConsoleControl->GetMode(ConsoleControl, &currentMode, NULL, NULL);        if (currentMode == EfiConsoleControlScreenGraphics)            ConsoleControl->SetMode(ConsoleControl, EfiConsoleControlScreenText);    }        /// load elilo.efi or e.efi from the same directory        // get loaded image protocol for ourselves    if (BS->HandleProtocol(ImageHandle, &LoadedImageProtocol, (VOID*)&SelfLoadedImage) != EFI_SUCCESS) {        Print(L"Can not retrieve a LoadedImageProtocol handle for ImageHandle/n");        return EFI_NOT_FOUND;    }        // open volume    RootDir = LibOpenRoot(SelfLoadedImage->DeviceHandle);    if (RootDir == NULL) {        Print(L"Can't open volume./n");        return EFI_NOT_FOUND;    }        // find the current directory    DevicePathAsString = DevicePathToStr(SelfLoadedImage->FilePath);    if (DevicePathAsString != NULL) {        StrCpy(DirName, DevicePathAsString);        FreePool(DevicePathAsString);        for (i = StrLen(DirName) - 1; i > 0 && DirName[i] != '//'; i--) ;        DirName[i++] = '//';        DirName[i] = 0;    } else {        StrCpy(DirName, L"//");    }        for (FileNameIndex = 0; FileNames[FileNameIndex]; FileNameIndex++) {        // build full absolute path name        StrCpy(FileName, DirName);        StrCat(FileName, FileNames[FileNameIndex]);                // check for presence of the file        if (RootDir->Open(RootDir, &BootFile, FileName, EFI_FILE_MODE_READ, 0) != EFI_SUCCESS)            continue;        BootFile->Close(BootFile);                // make a full device path for the image file        DevicePath = FileDevicePath(SelfLoadedImage->DeviceHandle, FileName);                // load the image into memory        Status = BS->LoadImage(FALSE, ImageHandle, DevicePath, NULL, 0, &LoaderHandle);        FreePool(DevicePath);        if (EFI_ERROR(Status)) {            Print(L"Can not load the file %s/n", FileName);            return Status;        }                // start it!        BS->StartImage(LoaderHandle, NULL, NULL);        // just in case we get control back...        break;    }        return EFI_SUCCESS;}
开发者ID:JackieXie168,项目名称:rEFIt,代码行数:83,


示例22: efi_main

EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {        EFI_LOADED_IMAGE *loaded_image;        _cleanup_freepool_ CHAR8 *b = NULL;        UINTN size;        BOOLEAN secure = FALSE;        CHAR8 *sections[] = {                (UINT8 *)".cmdline",                (UINT8 *)".linux",                (UINT8 *)".initrd",                (UINT8 *)".splash",                NULL        };        UINTN addrs[ELEMENTSOF(sections)-1] = {};        UINTN offs[ELEMENTSOF(sections)-1] = {};        UINTN szs[ELEMENTSOF(sections)-1] = {};        CHAR8 *cmdline = NULL;        UINTN cmdline_len;        CHAR16 uuid[37];        EFI_STATUS err;        InitializeLib(image, sys_table);        err = uefi_call_wrapper(BS->OpenProtocol, 6, image, &LoadedImageProtocol, (VOID **)&loaded_image,                                image, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);        if (EFI_ERROR(err)) {                Print(L"Error getting a LoadedImageProtocol handle: %r ", err);                uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000);                return err;        }        if (efivar_get_raw(&global_guid, L"SecureBoot", &b, &size) == EFI_SUCCESS)                if (*b > 0)                        secure = TRUE;        err = pe_memory_locate_sections(loaded_image->ImageBase, sections, addrs, offs, szs);        if (EFI_ERROR(err)) {                Print(L"Unable to locate embedded .linux section: %r ", err);                uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000);                return err;        }        if (szs[0] > 0)                cmdline = (CHAR8 *)(loaded_image->ImageBase + addrs[0]);        cmdline_len = szs[0];        /* if we are not in secure boot mode, accept a custom command line and replace the built-in one */        if (!secure && loaded_image->LoadOptionsSize > 0 && *(CHAR16 *)loaded_image->LoadOptions != 0) {                CHAR16 *options;                CHAR8 *line;                UINTN i;                options = (CHAR16 *)loaded_image->LoadOptions;                cmdline_len = (loaded_image->LoadOptionsSize / sizeof(CHAR16)) * sizeof(CHAR8);                line = AllocatePool(cmdline_len);                for (i = 0; i < cmdline_len; i++)                        line[i] = options[i];                cmdline = line;#if ENABLE_TPM                /* Try to log any options to the TPM, especially manually edited options */                err = tpm_log_event(SD_TPM_PCR,                                    (EFI_PHYSICAL_ADDRESS) (UINTN) loaded_image->LoadOptions,                                    loaded_image->LoadOptionsSize, loaded_image->LoadOptions);                if (EFI_ERROR(err)) {                        Print(L"Unable to add image options measurement: %r", err);                        uefi_call_wrapper(BS->Stall, 1, 200 * 1000);                }#endif        }        /* export the device path this image is started from */        if (disk_get_part_uuid(loaded_image->DeviceHandle, uuid) == EFI_SUCCESS)                efivar_set(L"LoaderDevicePartUUID", uuid, FALSE);        /* if LoaderImageIdentifier is not set, assume the image with this stub was loaded directly from UEFI */        if (efivar_get_raw(&global_guid, L"LoaderImageIdentifier", &b, &size) != EFI_SUCCESS) {                _cleanup_freepool_ CHAR16 *s;                s = DevicePathToStr(loaded_image->FilePath);                efivar_set(L"LoaderImageIdentifier", s, FALSE);        }        /* if LoaderFirmwareInfo is not set, let's set it */        if (efivar_get_raw(&global_guid, L"LoaderFirmwareInfo", &b, &size) != EFI_SUCCESS) {                _cleanup_freepool_ CHAR16 *s;                s = PoolPrint(L"%s %d.%02d", ST->FirmwareVendor, ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff);                efivar_set(L"LoaderFirmwareInfo", s, FALSE);        }
开发者ID:Hariprasathganesh,项目名称:testsysd,代码行数:90,


示例23: LocateSerialIo

/**  Build a list containing all serial devices.  @retval EFI_SUCCESS The function complete successfully.  @retval EFI_UNSUPPORTED No serial ports present.**/EFI_STATUSLocateSerialIo (  VOID  ){  UINTN                     Index;  UINTN                     Index2;  UINTN                     NoHandles;  EFI_HANDLE                *Handles;  EFI_STATUS                Status;  ACPI_HID_DEVICE_PATH      *Acpi;  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;  EFI_SERIAL_IO_PROTOCOL    *SerialIo;  EFI_DEVICE_PATH_PROTOCOL  *Node;  EFI_DEVICE_PATH_PROTOCOL  *OutDevicePath;  EFI_DEVICE_PATH_PROTOCOL  *InpDevicePath;  EFI_DEVICE_PATH_PROTOCOL  *ErrDevicePath;  BM_MENU_ENTRY             *NewMenuEntry;  BM_TERMINAL_CONTEXT       *NewTerminalContext;  EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;  VENDOR_DEVICE_PATH        Vendor;  UINT32                    FlowControl;  //  // Get all handles that have SerialIo protocol installed  //  InitializeListHead (&TerminalMenu.Head);  TerminalMenu.MenuNumber = 0;  Status = gBS->LocateHandleBuffer (                  ByProtocol,                  &gEfiSerialIoProtocolGuid,                  NULL,                  &NoHandles,                  &Handles                  );  if (EFI_ERROR (Status)) {    //    // No serial ports present    //    return EFI_UNSUPPORTED;  }  //  // Sort Uart handles array with Acpi->UID from low to high  // then Terminal menu can be built from low Acpi->UID to high Acpi->UID  //  SortedUartHandle (Handles, NoHandles);  for (Index = 0; Index < NoHandles; Index++) {    //    // Check to see whether the handle has DevicePath Protocol installed    //    gBS->HandleProtocol (          Handles[Index],          &gEfiDevicePathProtocolGuid,          (VOID **) &DevicePath          );    Acpi = NULL;    for (Node = DevicePath; !IsDevicePathEnd (Node); Node = NextDevicePathNode (Node)) {      if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {        break;      }      //      // Acpi points to the node before Uart node      //      Acpi = (ACPI_HID_DEVICE_PATH *) Node;    }    if ((Acpi != NULL) && IsIsaSerialNode (Acpi)) {      NewMenuEntry = BOpt_CreateMenuEntry (BM_TERMINAL_CONTEXT_SELECT);      if (NewMenuEntry == NULL) {        FreePool (Handles);        return EFI_OUT_OF_RESOURCES;      }      NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;      CopyMem (&NewMenuEntry->OptionNumber, &Acpi->UID, sizeof (UINT32));      NewTerminalContext->DevicePath = DuplicateDevicePath (DevicePath);      //      // BugBug: I have no choice, calling EfiLibStrFromDatahub will hang the system!      // coz' the misc data for each platform is not correct, actually it's the device path stored in      // datahub which is not completed, so a searching for end of device path will enter a      // dead-loop.      //      NewMenuEntry->DisplayString = EfiLibStrFromDatahub (DevicePath);      if (NULL == NewMenuEntry->DisplayString) {        NewMenuEntry->DisplayString = DevicePathToStr (DevicePath);      }      NewMenuEntry->HelpString = NULL;      gBS->HandleProtocol (//.........这里部分代码省略.........
开发者ID:B-Rich,项目名称:edk2,代码行数:101,


示例24: Var_UpdateBootOption

//.........这里部分代码省略.........  *((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);  CopyMem (    NewLoadContext->FilePathList,    (VOID *) Ptr,    GetDevicePathSize (CallbackData->LoadContext->FilePathList)    );  NewMenuEntry->HelpString    = DevicePathToStr (NewLoadContext->FilePathList);  NewMenuEntry->OptionNumber  = Index;  NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (                                      CallbackData,                                      BootOptionStrDepository                                      );  NewMenuEntry->DisplayStringToken = HiiSetString (CallbackData->FeHiiHandle, 0, NewMenuEntry->DisplayString, NULL);  NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (                                    CallbackData,                                    BootOptionHelpStrDepository                                    );  NewMenuEntry->HelpStringToken = HiiSetString (CallbackData->FeHiiHandle, 0, NewMenuEntry->HelpString, NULL);  if (OptionalDataExist) {    Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);    CopyMem (Ptr, NvRamMap->BootOptionalData, StrSize (NvRamMap->BootOptionalData));  }  Status = gRT->SetVariable (                  BootString,                  &gEfiGlobalVariableGuid,                  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,                  BufferSize,                  Buffer                  );  if (!EFI_ERROR (Status)) {    BootOrderList = BdsLibGetVariableAndSize (                      L"BootOrder",                      &gEfiGlobalVariableGuid,                      &BootOrderListSize                      );    ASSERT (BootOrderList != NULL);    NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16));    ASSERT (NewBootOrderList != NULL);    CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);    NewBootOrderList[BootOrderListSize / sizeof (UINT16)] = Index;    if (BootOrderList != NULL) {      FreePool (BootOrderList);    }    Status = gRT->SetVariable (                    L"BootOrder",                    &gEfiGlobalVariableGuid,                    EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,                    BootOrderListSize + sizeof (UINT16),                    NewBootOrderList                    );    if (!EFI_ERROR (Status)) {      FreePool (NewBootOrderList);      NewBootOrderList = NULL;      InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);      BootOptionMenu.MenuNumber++;      NvRamMap->BootDescriptionData[0]  = 0x0000;      NvRamMap->BootOptionalData[0]     = 0x0000;    }  }  return EFI_SUCCESS;}
开发者ID:jeyaramvrp,项目名称:edk2,代码行数:101,


示例25: BBTestReadKeyStrokeManualTest

//// TDS 4.3.1//EFI_STATUSBBTestReadKeyStrokeManualTest (  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_SIMPLE_TEXT_IN_PROTOCOL          *SimpleIn;  EFI_TEST_ASSERTION                   AssertionType;  EFI_INPUT_KEY                        Key;  CHAR16                               KeyBuffer[MAX_KEY_BUFFER_SIZE];  EFI_DEVICE_PATH_PROTOCOL             *DevicePath;  CHAR16                               *DevicePathStr;  UINTN                                Index;  //  // 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;  }  SimpleIn = (EFI_SIMPLE_TEXT_IN_PROTOCOL *)ClientInterface;  //  // Get Device Path of current Simple_Text_In_Protocol  // And out put device path or device name  //  Status = LocateDevicePathFromSimpleTextIn (SimpleIn, &DevicePath, StandardLib);  if (Status == EFI_SUCCESS) {    DevicePathStr = DevicePathToStr(DevicePath);    if (DevicePathStr != NULL) {      StandardLib->RecordMessage (                     StandardLib,                     EFI_VERBOSE_LEVEL_DEFAULT,                     L"/r/nCurrent Device: %s",                     DevicePathStr                     );      Status = gtBS->FreePool (DevicePathStr);      if (EFI_ERROR(Status)) {        StandardLib->RecordAssertion (                       StandardLib,                       EFI_TEST_ASSERTION_FAILED,                       gTestGenericFailureGuid,                       L"BS.FreePool - Free pool",                       L"%a:%d:Status - %r",                       __FILE__,                       __LINE__,                       Status                       );        return Status;      }      DevicePathStr=NULL;    }  } else {    //    // Console Splitter/StdErr    //    StandardLib->RecordMessage (                   StandardLib,                   EFI_VERBOSE_LEVEL_DEFAULT,                   L"/r/nCurrent Device: ConsoleSplitter/TxtIn"                   );  }  //  // wait for times  //  Print (L"/r/nReadKeyStroke Stress Test Start!/r/n");  WaitTimeOrKey (5);  //  // Assertion Point 4.1.3.2.1  // ReadKeyStroke()  //    Status = SimpleIn->Reset (SimpleIn,TRUE);//.........这里部分代码省略.........
开发者ID:jljusten,项目名称:efi-sct,代码行数:101,


示例26: BBTestBltConformanceAutoTest

//// TDS 4.2.2//EFI_STATUSBBTestBltConformanceAutoTest (  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_UGA_DRAW_PROTOCOL                *UgaDraw;  EFI_TEST_ASSERTION                   AssertionType;  EFI_UGA_PIXEL                        BltBuffer[10];  UINTN                                SourceX, SourceY;  UINTN                                DestinationX, DestinationY;  UINTN                                Width, Height;  UINTN                                Delta;  UINTN                                Index;  EFI_UGA_BLT_OPERATION                BltOperation;  EFI_DEVICE_PATH_PROTOCOL             *DevicePath;  CHAR16                               *DevicePathStr;  SourceX      = 0;  SourceY      = 0;  DestinationX = 0;  DestinationY = 0;  Width        = 1;  Height       = 1;  Delta        = 0;  //  // 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;  }  UgaDraw = (EFI_UGA_DRAW_PROTOCOL *)ClientInterface;  //  // Get Device Path of current Uga_Draw_Protocol  // And out put device path or device name  //  Status = LocateDevicePathFromUgaDraw (UgaDraw, &DevicePath, StandardLib);  if (Status == EFI_SUCCESS) {    DevicePathStr = DevicePathToStr (DevicePath);    if (DevicePathStr != NULL) {      StandardLib->RecordMessage (                     StandardLib,                     EFI_VERBOSE_LEVEL_DEFAULT,                     L"/r/nCurrent Device: %s",                     DevicePathStr                     );      Status = gtBS->FreePool (DevicePathStr);      if (EFI_ERROR(Status)) {        StandardLib->RecordAssertion (                       StandardLib,                       EFI_TEST_ASSERTION_FAILED,                       gTestGenericFailureGuid,                       L"BS.FreePool - Free pool",                       L"%a:%d:Status - %r",                       __FILE__,                       __LINE__,                       Status                       );        return Status;      }      DevicePathStr = NULL;    }  } else {    //    // Console Splitter/UgaDraw    //    StandardLib->RecordMessage (                   StandardLib,                   EFI_VERBOSE_LEVEL_DEFAULT,//.........这里部分代码省略.........
开发者ID:jljusten,项目名称:efi-sct,代码行数:101,


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


示例28: BBTestGetModeConformanceAutoTest

//// TDS 4.2.1//EFI_STATUSBBTestGetModeConformanceAutoTest (  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_UGA_DRAW_PROTOCOL                *UgaDraw;  EFI_TEST_ASSERTION                   AssertionType;  UINT32                               HorizontalResolution;  UINT32                               VerticalResolution;  UINT32                               ColorDepth;  UINT32                               RefreshRate;  EFI_DEVICE_PATH_PROTOCOL             *DevicePath;  CHAR16                               *DevicePathStr;  //  // 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;  }  UgaDraw = (EFI_UGA_DRAW_PROTOCOL *)ClientInterface;  //  // Get Device Path of current Uga_Draw_Protocol  // And out put device path or device name  //  Status = LocateDevicePathFromUgaDraw (UgaDraw, &DevicePath, StandardLib);  if (Status == EFI_SUCCESS) {    DevicePathStr = DevicePathToStr (DevicePath);    if (DevicePathStr != NULL) {      StandardLib->RecordMessage (                     StandardLib,                     EFI_VERBOSE_LEVEL_DEFAULT,                     L"/r/nCurrent Device: %s",                     DevicePathStr                     );      Status = gtBS->FreePool (DevicePathStr);      if (EFI_ERROR(Status)) {        StandardLib->RecordAssertion (                       StandardLib,                       EFI_TEST_ASSERTION_FAILED,                       gTestGenericFailureGuid,                       L"BS.FreePool - Free pool",                       L"%a:%d:Status - %r",                       __FILE__,                       __LINE__,                       Status                       );        return Status;      }      DevicePathStr = NULL;    }  } else {    //    // Console Splitter/UgaDraw    //    StandardLib->RecordMessage (                   StandardLib,                   EFI_VERBOSE_LEVEL_DEFAULT,                   L"/r/nCurrent Device: ConsoleSplitter/UgaDraw"                   );#ifdef TEST_CHIPSET_UGA_ONLY    return EFI_SUCCESS;#endif  }  //  // Assertion Point 4.2.1.2.1  // GetMode should not succeed with invalid parameter  //  ////.........这里部分代码省略.........
开发者ID:jljusten,项目名称:efi-sct,代码行数:101,


示例29: configtable_find_image

EFI_IMAGE_EXECUTION_INFO *configtable_find_image(const EFI_DEVICE_PATH *DevicePath){	EFI_IMAGE_EXECUTION_INFO_TABLE *t = configtable_get_image_table();	if (!t)		return NULL;	int entries = t->NumberOfImages;	EFI_IMAGE_EXECUTION_INFO *e = t->InformationInfo;	int i;	for (i = 0; i < entries; i++) {#ifdef DEBUG_CONFIG		console_print(L"InfoSize = %d  Action = %d/n", e->InfoSize, e->Action);		/* print what we have for debugging */		UINT8 *d = (UINT8 *)e; // + sizeof(UINT32)*2;		console_print(L"Data: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x/n",		      d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]); 		d += 16;		console_print(L"Data: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x/n",		      d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]); 		d += 16;		console_print(L"Data: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x/n",		      d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]); 		d += 16;		console_print(L"Data: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x/n",		      d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]); 		d += 16;		console_print(L"Data: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x/n",		      d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]); 		d += 16;		console_print(L"Data: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x/n",		      d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]); #endif		CHAR16 *name = (CHAR16 *)(e->Data);		int skip = 0;		/* There's a bug in a lot of EFI platforms and they forget to		 * put the name here.  The only real way of detecting it is to		 * look for either a UC16 NULL or ASCII as UC16 */		if (name[0] == '/0' || (e->Data[1] == 0 && e->Data[3] == 0)) {			skip = StrSize(name);#ifdef DEBUG_CONFIG			console_print(L"FOUND NAME %s (%d)/n", name, skip);#endif		}		EFI_DEVICE_PATH *dp = (EFI_DEVICE_PATH *)(e->Data + skip), *dpn = dp;		if (dp->Type == 0 || dp->Type > 6 || dp->SubType == 0		    || ((unsigned)((dp->Length[1] << 8) + dp->Length[0]) > e->InfoSize)) {			/* Parse error, table corrupt, bail */			console_print(L"Image Execution Information table corrupt/n");			break;		}		UINTN Size;		DevicePathInstance(&dpn, &Size);#ifdef DEBUG_CONFIG		console_print(L"Path: %s/n", DevicePathToStr(dp));		console_print(L"Device Path Size %d/n", Size);#endif		if (Size > e->InfoSize) {			/* parse error; the platform obviously has a 			 * corrupted image table; bail */			console_print(L"Image Execution Information table corrupt/n");			break;		}				if (CompareMem(dp, (void *)DevicePath, Size) == 0) {#ifdef DEBUG_CONFIG			console_print(L"***FOUND/n");			console_get_keystroke();#endif			return e;		}		e = (EFI_IMAGE_EXECUTION_INFO *)((UINT8 *)e + e->InfoSize);	}#ifdef DEBUG_CONFIG	console_print(L"***NOT FOUND/n");	console_get_keystroke();#endif	return NULL;}
开发者ID:endlessm,项目名称:shim,代码行数:86,


示例30: add_to_boot_list

EFI_STATUSadd_to_boot_list(EFI_FILE_HANDLE fh, CHAR16 *dirname, CHAR16 *filename, CHAR16 *label, CHAR16 *arguments){	CHAR16 *fullpath = NULL;	UINT64 pathlen = 0;	EFI_STATUS rc = EFI_SUCCESS;	rc = make_full_path(dirname, filename, &fullpath, &pathlen);	if (EFI_ERROR(rc))		return rc;		EFI_DEVICE_PATH *dph = NULL, *dpf = NULL, *dp = NULL;		dph = DevicePathFromHandle(this_image->DeviceHandle);	if (!dph) {		rc = EFI_OUT_OF_RESOURCES;		goto err;	}	dpf = FileDevicePath(fh, fullpath);	if (!dpf) {		rc = EFI_OUT_OF_RESOURCES;		goto err;	}	dp = AppendDevicePath(dph, dpf);	if (!dp) {		rc = EFI_OUT_OF_RESOURCES;		goto err;	}#ifdef DEBUG_FALLBACK	UINTN s = DevicePathSize(dp);	int i;	UINT8 *dpv = (void *)dp;	for (i = 0; i < s; i++) {		if (i > 0 && i % 16 == 0)			Print(L"/n");		Print(L"%02x ", dpv[i]);	}	Print(L"/n");	CHAR16 *dps = DevicePathToStr(dp);	Print(L"device path: /"%s/"/n", dps);#endif	if (!first_new_option) {		CHAR16 *dps = DevicePathToStr(dp);		Print(L"device path: /"%s/"/n", dps);		first_new_option = DuplicateDevicePath(dp);		first_new_option_args = arguments;		first_new_option_size = StrLen(arguments) * sizeof (CHAR16);	}	add_boot_option(dp, fullpath, label, arguments);err:	if (dpf)		FreePool(dpf);	if (dp)		FreePool(dp);	if (fullpath)		FreePool(fullpath);	return rc;}
开发者ID:samBeanham,项目名称:shim,代码行数:64,



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


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