这篇教程C++ ASSERT_EFI_ERROR函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ASSERT_EFI_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_EFI_ERROR函数的具体用法?C++ ASSERT_EFI_ERROR怎么用?C++ ASSERT_EFI_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ASSERT_EFI_ERROR函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: FtwNotificationEvent/** Fault Tolerant Write protocol notification event handler. Non-Volatile variable write may needs FTW protocol to reclaim when writting variable. @param[in] Event Event whose notification function is being invoked. @param[in] Context Pointer to the notification function's context. **/VOIDEFIAPIFtwNotificationEvent ( IN EFI_EVENT Event, IN VOID *Context ){ EFI_STATUS Status; EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbProtocol; EFI_FAULT_TOLERANT_WRITE_PROTOCOL *FtwProtocol; EFI_PHYSICAL_ADDRESS NvStorageVariableBase; EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor; EFI_PHYSICAL_ADDRESS BaseAddress; UINT64 Length; EFI_PHYSICAL_ADDRESS VariableStoreBase; UINT64 VariableStoreLength; // // Ensure FTW protocol is installed. // Status = GetFtwProtocol ((VOID**) &FtwProtocol); if (EFI_ERROR (Status)) { return ; } // // Find the proper FVB protocol for variable. // NvStorageVariableBase = (EFI_PHYSICAL_ADDRESS) PcdGet64 (PcdFlashNvStorageVariableBase64); if (NvStorageVariableBase == 0) { NvStorageVariableBase = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageVariableBase); } Status = GetFvbInfoByAddress (NvStorageVariableBase, NULL, &FvbProtocol); if (EFI_ERROR (Status)) { return ; } mVariableModuleGlobal->FvbInstance = FvbProtocol; // // Mark the variable storage region of the FLASH as RUNTIME. // VariableStoreBase = mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase; VariableStoreLength = ((VARIABLE_STORE_HEADER *)(UINTN)VariableStoreBase)->Size; BaseAddress = VariableStoreBase & (~EFI_PAGE_MASK); Length = VariableStoreLength + (VariableStoreBase - BaseAddress); Length = (Length + EFI_PAGE_SIZE - 1) & (~EFI_PAGE_MASK); Status = gDS->GetMemorySpaceDescriptor (BaseAddress, &GcdDescriptor); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_WARN, "Variable driver failed to add EFI_MEMORY_RUNTIME attribute to Flash./n")); } else { Status = gDS->SetMemorySpaceAttributes ( BaseAddress, Length, GcdDescriptor.Attributes | EFI_MEMORY_RUNTIME ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_WARN, "Variable driver failed to add EFI_MEMORY_RUNTIME attribute to Flash./n")); } } Status = VariableWriteServiceInitialize (); ASSERT_EFI_ERROR (Status); // // Install the Variable Write Architectural protocol. // Status = gBS->InstallProtocolInterface ( &mHandle, &gEfiVariableWriteArchProtocolGuid, EFI_NATIVE_INTERFACE, NULL ); ASSERT_EFI_ERROR (Status); // // Close the notify event to avoid install gEfiVariableWriteArchProtocolGuid again. // gBS->CloseEvent (Event);}
开发者ID:Cutty,项目名称:edk2,代码行数:91,
示例2: DxeMain/** Main entry point to DXE Core. @param HobStart Pointer to the beginning of the HOB List from PEI. @return This function should never return.**/VOIDEFIAPIDxeMain ( IN VOID *HobStart ){ EFI_STATUS Status; EFI_PHYSICAL_ADDRESS MemoryBaseAddress; UINT64 MemoryLength; PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; UINTN Index; EFI_HOB_GUID_TYPE *GuidHob; EFI_VECTOR_HANDOFF_INFO *VectorInfoList; EFI_VECTOR_HANDOFF_INFO *VectorInfo; // // Setup the default exception handlers // VectorInfoList = NULL; GuidHob = GetNextGuidHob (&gEfiVectorHandoffInfoPpiGuid, HobStart); if (GuidHob != NULL) { VectorInfoList = (EFI_VECTOR_HANDOFF_INFO *) (GET_GUID_HOB_DATA(GuidHob)); } Status = InitializeCpuExceptionHandlers (VectorInfoList); ASSERT_EFI_ERROR (Status); // // Initialize Debug Agent to support source level debug in DXE phase // InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_CORE, HobStart, NULL); // // Initialize Memory Services // CoreInitializeMemoryServices (&HobStart, &MemoryBaseAddress, &MemoryLength); // // Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData // Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table // gDxeCoreST = AllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate); ASSERT (gDxeCoreST != NULL); gDxeCoreRT = AllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate); ASSERT (gDxeCoreRT != NULL); gDxeCoreST->RuntimeServices = gDxeCoreRT; // // Start the Image Services. // Status = CoreInitializeImageServices (HobStart); ASSERT_EFI_ERROR (Status); // // Call constructor for all libraries // ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST); PERF_END (NULL,"PEI", NULL, 0) ; PERF_START (NULL,"DXE", NULL, 0) ; // // Report DXE Core image information to the PE/COFF Extra Action Library // ZeroMem (&ImageContext, sizeof (ImageContext)); ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)gDxeCoreLoadedImage->ImageBase; ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageContext.ImageAddress); PeCoffLoaderRelocateImageExtraAction (&ImageContext); // // Initialize the Global Coherency Domain Services // Status = CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, MemoryLength); ASSERT_EFI_ERROR (Status); // // Install the DXE Services Table into the EFI System Tables's Configuration Table // Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDxeCoreDS); ASSERT_EFI_ERROR (Status); // // Install the HOB List into the EFI System Tables's Configuration Table // Status = CoreInstallConfigurationTable (&gEfiHobListGuid, HobStart); ASSERT_EFI_ERROR (Status); // // Install Memory Type Information Table into the EFI System Tables's Configuration Table // Status = CoreInstallConfigurationTable (&gEfiMemoryTypeInformationGuid, &gMemoryTypeInformation); ASSERT_EFI_ERROR (Status);//.........这里部分代码省略.........
开发者ID:phshentu,项目名称:UDK2014,代码行数:101,
示例3: PeimEntryMA/** Entry point of this module. @param[in] FileHandle Handle of the file being invoked. @param[in] PeiServices Describes the list of possible PEI Services. @return Status.**/EFI_STATUSEFIAPIPeimEntryMA ( IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices){ EFI_STATUS Status; EFI_BOOT_MODE BootMode; TIS_TPM_HANDLE TpmHandle; if (!CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceTpm12Guid)) { DEBUG ((EFI_D_ERROR, "No TPM12 instance required!/n")); return EFI_UNSUPPORTED; } if (PcdGetBool (PcdHideTpmSupport) && PcdGetBool (PcdHideTpm)) { return EFI_UNSUPPORTED; } // // Initialize TPM device // Status = PeiServicesGetBootMode (&BootMode); ASSERT_EFI_ERROR (Status); // // In S3 path, skip shadow logic. no measurement is required // if (BootMode != BOOT_ON_S3_RESUME) { Status = (**PeiServices).RegisterForShadow(FileHandle); if (Status == EFI_ALREADY_STARTED) { mImageInMemory = TRUE; } else if (Status == EFI_NOT_FOUND) { ASSERT_EFI_ERROR (Status); } } if (!mImageInMemory) { TpmHandle = (TIS_TPM_HANDLE)(UINTN)TPM_BASE_ADDRESS; Status = TisPcRequestUseTpm ((TIS_PC_REGISTERS_PTR)TpmHandle); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "TPM not detected!/n")); return Status; } if (PcdGet8 (PcdTpmInitializationPolicy) == 1) { Status = TpmCommStartup ((EFI_PEI_SERVICES**)PeiServices, TpmHandle, BootMode); if (EFI_ERROR (Status) ) { return Status; } } // // TpmSelfTest is optional on S3 path, skip it to save S3 time // if (BootMode != BOOT_ON_S3_RESUME) { Status = TpmCommContinueSelfTest ((EFI_PEI_SERVICES**)PeiServices, TpmHandle); if (EFI_ERROR (Status)) { return Status; } } Status = PeiServicesInstallPpi (&mTpmInitializedPpiList); ASSERT_EFI_ERROR (Status); } if (mImageInMemory) { Status = PeimEntryMP ((EFI_PEI_SERVICES**)PeiServices); if (EFI_ERROR (Status)) { return Status; } } return Status;}
开发者ID:JohnTroony,项目名称:vector-edk,代码行数:85,
示例4: NotifyDevPath/** This notification function is invoked when an instance of the EFI_DEVICE_PATH_PROTOCOL is produced. @param Event The event that occured @param Context For EFI compatiblity. Not used.**/VOIDEFIAPINotifyDevPath ( IN EFI_EVENT Event, IN VOID *Context ){ EFI_HANDLE Handle; EFI_STATUS Status; UINTN BufferSize; EFI_DEVICE_PATH_PROTOCOL *DevPathNode; ATAPI_DEVICE_PATH *Atapi; // // Examine all new handles // for (;;) { // // Get the next handle // BufferSize = sizeof (Handle); Status = gBS->LocateHandle ( ByRegisterNotify, NULL, mEfiDevPathNotifyReg, &BufferSize, &Handle ); // // If not found, we're done // if (EFI_NOT_FOUND == Status) { break; } if (EFI_ERROR (Status)) { continue; } // // Get the DevicePath protocol on that handle // Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **)&DevPathNode); ASSERT_EFI_ERROR (Status); while (!IsDevicePathEnd (DevPathNode)) { // // Find the handler to dump this device path node // if ( (DevicePathType(DevPathNode) == MESSAGING_DEVICE_PATH) && (DevicePathSubType(DevPathNode) == MSG_ATAPI_DP) ) { Atapi = (ATAPI_DEVICE_PATH*) DevPathNode; PciOr16 ( PCI_LIB_ADDRESS ( 0, 1, 1, (Atapi->PrimarySecondary == 1) ? 0x42: 0x40 ), BIT15 ); } // // Next device path node // DevPathNode = NextDevicePathNode (DevPathNode); } } return;}
开发者ID:jeppeter,项目名称:vbox,代码行数:83,
示例5: Communicate/** Communicates with a registered handler. This function provides a service to send and receive messages from a registered UEFI service. @param[in] This The EFI_PEI_SMM_COMMUNICATION_PPI instance. @param[in, out] CommBuffer A pointer to the buffer to convey into SMRAM. @param[in, out] CommSize The size of the data buffer being passed in.On exit, the size of data being returned. Zero if the handler does not wish to reply with any data. @retval EFI_SUCCESS The message was successfully posted. @retval EFI_INVALID_PARAMETER The CommBuffer was NULL. @retval EFI_NOT_STARTED The service is NOT started.**/EFI_STATUSEFIAPICommunicate ( IN CONST EFI_PEI_SMM_COMMUNICATION_PPI *This, IN OUT VOID *CommBuffer, IN OUT UINTN *CommSize ){ EFI_STATUS Status; PEI_SMM_CONTROL_PPI *SmmControl; PEI_SMM_ACCESS_PPI *SmmAccess; UINT8 SmiCommand; UINTN Size; EFI_SMM_COMMUNICATION_CONTEXT *SmmCommunicationContext; DEBUG ((EFI_D_INFO, "PiSmmCommunicationPei Communicate Enter/n")); if (CommBuffer == NULL) { return EFI_INVALID_PARAMETER; } // // Get needed resource // Status = PeiServicesLocatePpi ( &gPeiSmmControlPpiGuid, 0, NULL, (VOID **)&SmmControl ); if (EFI_ERROR (Status)) { return EFI_NOT_STARTED; } Status = PeiServicesLocatePpi ( &gPeiSmmAccessPpiGuid, 0, NULL, (VOID **)&SmmAccess ); if (EFI_ERROR (Status)) { return EFI_NOT_STARTED; } // // Check SMRAM locked, it should be done after SMRAM lock. // if (!SmmAccess->LockState) { DEBUG ((EFI_D_INFO, "PiSmmCommunicationPei LockState - %x/n", (UINTN)SmmAccess->LockState)); return EFI_NOT_STARTED; } SmmCommunicationContext = GetCommunicationContext (); DEBUG ((EFI_D_INFO, "PiSmmCommunicationPei BufferPtrAddress - 0x%016lx, BufferPtr: 0x%016lx/n", SmmCommunicationContext->BufferPtrAddress, *(EFI_PHYSICAL_ADDRESS *)(UINTN)SmmCommunicationContext->BufferPtrAddress)); // // No need to check if BufferPtr is 0, because it is in PEI phase. // *(EFI_PHYSICAL_ADDRESS *)(UINTN)SmmCommunicationContext->BufferPtrAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)CommBuffer; DEBUG ((EFI_D_INFO, "PiSmmCommunicationPei CommBuffer - %x/n", (UINTN)CommBuffer)); // // Send command // SmiCommand = (UINT8)SmmCommunicationContext->SwSmiNumber; Size = sizeof(SmiCommand); Status = SmmControl->Trigger ( (EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmControl, (INT8 *)&SmiCommand, &Size, FALSE, 0 ); ASSERT_EFI_ERROR (Status); // // Setting BufferPtr to 0 means this transaction is done. // *(EFI_PHYSICAL_ADDRESS *)(UINTN)SmmCommunicationContext->BufferPtrAddress = 0; DEBUG ((EFI_D_INFO, "PiSmmCommunicationPei Communicate Exit/n")); return EFI_SUCCESS;}
开发者ID:shijunjing,项目名称:edk2,代码行数:99,
示例6: WinNtTimerDriverInitializeEFI_STATUSEFIAPIWinNtTimerDriverInitialize ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable )/*++Routine Description: Initialize the Timer Architectural Protocol driverArguments: ImageHandle - ImageHandle of the loaded driver SystemTable - Pointer to the System TableReturns: EFI_SUCCESS - Timer Architectural Protocol created EFI_OUT_OF_RESOURCES - Not enough resources available to initialize driver. EFI_DEVICE_ERROR - A device error occured attempting to initialize the driver.--*/{ EFI_STATUS Status; UINTN Result; EFI_HANDLE Handle; EFI_HANDLE hSourceProcessHandle; EFI_HANDLE hSourceHandle; EFI_HANDLE hTargetProcessHandle; // // Make sure the Timer Architectural Protocol is not already installed in the system // ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiTimerArchProtocolGuid); // // Get the CPU Architectural Protocol instance // Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID**)&mCpu); ASSERT_EFI_ERROR (Status); // // Get our handle so the timer tick thread can suspend // hSourceProcessHandle = gWinNt->GetCurrentProcess (); hSourceHandle = gWinNt->GetCurrentThread (); hTargetProcessHandle = gWinNt->GetCurrentProcess (); Result = gWinNt->DuplicateHandle ( hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, &mNtMainThreadHandle, 0, FALSE, DUPLICATE_SAME_ACCESS ); if (Result == 0) { return EFI_DEVICE_ERROR; } // // Initialize Critical Section used to update variables shared between the main // thread and the timer interrupt thread. // gWinNt->InitializeCriticalSection (&mNtCriticalSection); // // Start the timer thread at the default timer period // Status = mTimer.SetTimerPeriod (&mTimer, DEFAULT_TIMER_TICK_DURATION); if (EFI_ERROR (Status)) { gWinNt->DeleteCriticalSection (&mNtCriticalSection); return Status; } // // Install the Timer Architectural Protocol onto a new handle // Handle = NULL; Status = gBS->InstallProtocolInterface ( &Handle, &gEfiTimerArchProtocolGuid, EFI_NATIVE_INTERFACE, &mTimer ); if (EFI_ERROR (Status)) { // // Cancel the timer // mTimer.SetTimerPeriod (&mTimer, 0); gWinNt->DeleteCriticalSection (&mNtCriticalSection); return Status; } return EFI_SUCCESS;}
开发者ID:AshleyDeSimone,项目名称:edk2,代码行数:100,
示例7: EndOfPeiPpiNotifyCallback/** PEI termination callback. @param[in] PeiServices General purpose services available to every PEIM. @param[in] NotifyDescriptor Not uesed. @param[in] Ppi Not uesed. @retval EFI_SUCCESS If the interface could be successfully installed.**/EFI_STATUSEndOfPeiPpiNotifyCallback ( IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi ){ EFI_STATUS Status; UINT64 MemoryTop; UINT64 LowUncableBase; EFI_PLATFORM_INFO_HOB *PlatformInfo; UINT32 HecBaseHigh; EFI_BOOT_MODE BootMode; Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode); ASSERT_EFI_ERROR (Status); // // Set the some PCI and chipset range as UC // And align to 1M at leaset // PlatformInfo = PcdGetPtr (PcdPlatformInfo); UpdateDefaultSetupValue (PlatformInfo); DEBUG ((EFI_D_ERROR, "Memory TOLM: %X/n", PlatformInfo->MemData.MemTolm)); DEBUG ((EFI_D_ERROR, "PCIE OSBASE: %lX/n", PlatformInfo->PciData.PciExpressBase)); DEBUG ( (EFI_D_ERROR, "PCIE BASE: %lX Size : %X/n", PlatformInfo->PciData.PciExpressBase, PlatformInfo->PciData.PciExpressSize) ); DEBUG ( (EFI_D_ERROR, "PCI32 BASE: %X Limit: %X/n", PlatformInfo->PciData.PciResourceMem32Base, PlatformInfo->PciData.PciResourceMem32Limit) ); DEBUG ( (EFI_D_ERROR, "PCI64 BASE: %lX Limit: %lX/n", PlatformInfo->PciData.PciResourceMem64Base, PlatformInfo->PciData.PciResourceMem64Limit) ); DEBUG ((EFI_D_ERROR, "UC START: %lX End : %lX/n", PlatformInfo->MemData.MemMir0, PlatformInfo->MemData.MemMir1)); LowUncableBase = PlatformInfo->MemData.MemMaxTolm; LowUncableBase &= (0x0FFF00000); MemoryTop = (0x100000000); if (BootMode != BOOT_ON_S3_RESUME) { // // In BIOS, HECBASE will be always below 4GB // HecBaseHigh = (UINT32) RShiftU64 (PlatformInfo->PciData.PciExpressBase, 28); ASSERT (HecBaseHigh < 16); // // Programe HECBASE for DXE phase // } return Status;}
开发者ID:mangguo321,项目名称:Braswell,代码行数:77,
示例8: SpiProtocolInitEFI_STATUSEFIAPISpiProtocolInit ( IN EFI_SPI_PROTOCOL *This, IN SPI_INIT_TABLE *InitTable )/*++Routine Description: Initialize the host controller to execute SPI command.Arguments: This Pointer to the EFI_SPI_PROTOCOL instance. InitTable Initialization data to be programmed into the SPI host controller.Returns: EFI_SUCCESS Initialization completed. EFI_ACCESS_DENIED The SPI static configuration interface has been locked-down. EFI_INVALID_PARAMETER Bad input parameters. EFI_UNSUPPORTED Can't get Descriptor mode VSCC values--*/{ EFI_STATUS Status; UINT8 Index; UINT16 OpcodeType; SPI_INSTANCE *SpiInstance; UINTN PchRootComplexBar; UINT8 UnlockCmdOpcodeIndex; UINT8 FlashPartId[3]; SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This); PchRootComplexBar = SpiInstance->PchRootComplexBar; if (InitTable != NULL) { // // Copy table into SPI driver Private data structure // CopyMem ( &SpiInstance->SpiInitTable, InitTable, sizeof (SPI_INIT_TABLE) ); } else { return EFI_INVALID_PARAMETER; } // // Check if the SPI interface has been locked-down. // if ((MmioRead16 (PchRootComplexBar + R_QNC_RCRB_SPIS) & B_QNC_RCRB_SPIS_SCL) != 0) { ASSERT_EFI_ERROR (EFI_ACCESS_DENIED); return EFI_ACCESS_DENIED; } // // Clear all the status bits for status regs. // MmioOr16 ( (UINTN) (PchRootComplexBar + R_QNC_RCRB_SPIS), (UINT16) ((B_QNC_RCRB_SPIS_CDS | B_QNC_RCRB_SPIS_BAS)) ); MmioRead16 (PchRootComplexBar + R_QNC_RCRB_SPIS); // // Set the Prefix Opcode registers. // MmioWrite16 ( PchRootComplexBar + R_QNC_RCRB_SPIPREOP, (SpiInstance->SpiInitTable.PrefixOpcode[1] << 8) | InitTable->PrefixOpcode[0] ); MmioRead16 (PchRootComplexBar + R_QNC_RCRB_SPIPREOP); // // Set Opcode Type Configuration registers. // for (Index = 0, OpcodeType = 0; Index < SPI_NUM_OPCODE; Index++) { switch (SpiInstance->SpiInitTable.OpcodeMenu[Index].Type) { case EnumSpiOpcodeRead: OpcodeType |= (UINT16) (B_QNC_RCRB_SPIOPTYPE_ADD_READ << (Index * 2)); break; case EnumSpiOpcodeWrite: OpcodeType |= (UINT16) (B_QNC_RCRB_SPIOPTYPE_ADD_WRITE << (Index * 2)); break; case EnumSpiOpcodeWriteNoAddr: OpcodeType |= (UINT16) (B_QNC_RCRB_SPIOPTYPE_NOADD_WRITE << (Index * 2)); break; default: OpcodeType |= (UINT16) (B_QNC_RCRB_SPIOPTYPE_NOADD_READ << (Index * 2)); break; } } MmioWrite16 (PchRootComplexBar + R_QNC_RCRB_SPIOPTYPE, OpcodeType); MmioRead16 (PchRootComplexBar + R_QNC_RCRB_SPIOPTYPE); // // Setup the Opcode Menu registers. // UnlockCmdOpcodeIndex = SPI_NUM_OPCODE; for (Index = 0; Index < SPI_NUM_OPCODE; Index++) {//.........这里部分代码省略.........
开发者ID:EvanLloyd,项目名称:tianocore,代码行数:101,
示例9: InitializationDispatcherWorker/** Dispatch initialization request to sub status code devices based on customized feature flags. **/VOIDInitializationDispatcherWorker ( VOID ){ EFI_PEI_HOB_POINTERS Hob; EFI_STATUS Status; MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader; MEMORY_STATUSCODE_RECORD *Record; UINTN Index; UINTN MaxRecordNumber; // // If enable UseSerial, then initialize serial port. // if enable UseRuntimeMemory, then initialize runtime memory status code worker. // if (FeaturePcdGet (PcdStatusCodeUseSerial)) { // // Call Serial Port Lib API to initialize serial port. // Status = SerialPortInitialize (); ASSERT_EFI_ERROR (Status); } if (FeaturePcdGet (PcdStatusCodeUseMemory)) { Status = RtMemoryStatusCodeInitializeWorker (); ASSERT_EFI_ERROR (Status); } // // Replay Status code which saved in GUID'ed HOB to all supported devices. // if (FeaturePcdGet (PcdStatusCodeReplayIn)) { // // Journal GUID'ed HOBs to find all record entry, if found, // then output record to support replay device. // Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid); if (Hob.Raw != NULL) { PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *) GET_GUID_HOB_DATA (Hob.Guid); Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1); MaxRecordNumber = (UINTN) PacketHeader->RecordIndex; if (PacketHeader->PacketIndex > 0) { // // Record has been wrapped around. So, record number has arrived at max number. // MaxRecordNumber = (UINTN) PacketHeader->MaxRecordsNumber; } for (Index = 0; Index < MaxRecordNumber; Index++) { // // Dispatch records to devices based on feature flag. // if (FeaturePcdGet (PcdStatusCodeUseSerial)) { SerialStatusCodeReportWorker ( Record[Index].CodeType, Record[Index].Value, Record[Index].Instance, NULL, NULL ); } if (FeaturePcdGet (PcdStatusCodeUseMemory)) { RtMemoryStatusCodeReportWorker ( Record[Index].CodeType, Record[Index].Value, Record[Index].Instance, NULL, NULL ); } } } }}
开发者ID:AshleyDeSimone,项目名称:edk2,代码行数:78,
示例10: VBoxVgaGraphicsOutputBlt//.........这里部分代码省略......... } if (BltOperation == EfiBltBufferToVideo || BltOperation == EfiBltVideoToVideo || BltOperation == EfiBltVideoFill) { if (DestinationY + Height > ScreenHeight) { return EFI_INVALID_PARAMETER; } if (DestinationX + Width > ScreenWidth) { return EFI_INVALID_PARAMETER; } } // // We have to raise to TPL Notify, so we make an atomic write the frame buffer. // We would not want a timer based event (Cursor, ...) to come in while we are // doing this operation. // OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY); switch (BltOperation) { case EfiBltVideoToBltBuffer: // // Video to BltBuffer: Source is Video, destination is BltBuffer // for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY) && BltBuffer; SrcY++, DstY++) { /// @todo assumes that color depth is 32 (*4, EfiPciIoWidthUint32) and format matches EFI_GRAPHICS_OUTPUT_BLT_PIXEL Status = Private->PciIo->Mem.Read ( Private->PciIo, EfiPciIoWidthUint32, Private->BarIndexFB, ((SrcY * ScreenWidth) + SourceX) * 4, Width, BltBuffer + (DstY * Delta) + DestinationX ); ASSERT_EFI_ERROR((Status)); } break; case EfiBltBufferToVideo: // // BltBuffer to Video: Source is BltBuffer, destination is Video // for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { /// @todo assumes that color depth is 32 (*4, EfiPciIoWidthUint32) and format matches EFI_GRAPHICS_OUTPUT_BLT_PIXEL Status = Private->PciIo->Mem.Write ( Private->PciIo, EfiPciIoWidthUint32, Private->BarIndexFB, ((DstY * ScreenWidth) + DestinationX) * 4, Width, BltBuffer + (SrcY * Delta) + SourceX ); ASSERT_EFI_ERROR((Status)); } break; case EfiBltVideoToVideo: // // Video to Video: Source is Video, destination is Video // if (DestinationY <= SourceY) { // forward copy for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { /// @todo assumes that color depth is 32 (*4, EfiPciIoWidthUint32) and format matches EFI_GRAPHICS_OUTPUT_BLT_PIXEL Status = Private->PciIo->CopyMem ( Private->PciIo, EfiPciIoWidthUint32,
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:67,
示例11: FirmwarePerformanceDxeEntryPoint/** The module Entry Point of the Firmware Performance Data Table DXE driver. @param[in] ImageHandle The firmware allocated handle for the EFI image. @param[in] SystemTable A pointer to the EFI System Table. @retval EFI_SUCCESS The entry point is executed successfully. @retval Other Some error occurs when executing this entry point.**/EFI_STATUSEFIAPIFirmwarePerformanceDxeEntryPoint ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ){ EFI_STATUS Status; EFI_HOB_GUID_TYPE *GuidHob; FIRMWARE_SEC_PERFORMANCE *Performance; // // Get Report Status Code Handler Protocol. // Status = gBS->LocateProtocol (&gEfiRscHandlerProtocolGuid, NULL, (VOID **) &mRscHandlerProtocol); ASSERT_EFI_ERROR (Status); // // Register report status code listener for OS Loader load and start. // Status = mRscHandlerProtocol->Register (FpdtStatusCodeListenerDxe, TPL_HIGH_LEVEL); ASSERT_EFI_ERROR (Status); // // Register the notify function to update FPDT on ExitBootServices Event. // Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, FpdtExitBootServicesEventNotify, NULL, &gEfiEventExitBootServicesGuid, &mExitBootServicesEvent ); ASSERT_EFI_ERROR (Status); // // Create ready to boot event to install ACPI FPDT table. // Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, FpdtReadyToBootEventNotify, NULL, &gEfiEventReadyToBootGuid, &mReadyToBootEvent ); ASSERT_EFI_ERROR (Status); // // Create legacy boot event to log OsLoaderStartImageStart for legacy boot. // Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, FpdtLegacyBootEventNotify, NULL, &gEfiEventLegacyBootGuid, &mLegacyBootEvent ); ASSERT_EFI_ERROR (Status); // // Retrieve GUID HOB data that contains the ResetEnd. // GuidHob = GetFirstGuidHob (&gEfiFirmwarePerformanceGuid); if (GuidHob != NULL) { Performance = (FIRMWARE_SEC_PERFORMANCE *) GET_GUID_HOB_DATA (GuidHob); mBootPerformanceTableTemplate.BasicBoot.ResetEnd = Performance->ResetEnd; } else { // // SEC Performance Data Hob not found, ResetEnd in ACPI FPDT table will be 0. // DEBUG ((EFI_D_ERROR, "FPDT: WARNING: SEC Performance Data Hob not found, ResetEnd will be set to 0!/n")); } return EFI_SUCCESS;}
开发者ID:Cutty,项目名称:edk2,代码行数:88,
示例12: Table/** Install ACPI Firmware Performance Data Table (FPDT). @return Status code.**/EFI_STATUSInstallFirmwarePerformanceDataTable ( VOID ){ EFI_STATUS Status; EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; EFI_PHYSICAL_ADDRESS Address; UINTN Size; UINT8 SmmBootRecordCommBuffer[SMM_BOOT_RECORD_COMM_SIZE]; EFI_SMM_COMMUNICATE_HEADER *SmmCommBufferHeader; SMM_BOOT_RECORD_COMMUNICATE *SmmCommData; UINTN CommSize; UINTN PerformanceRuntimeDataSize; UINT8 *PerformanceRuntimeData; UINT8 *PerformanceRuntimeDataHead; EFI_SMM_COMMUNICATION_PROTOCOL *Communication; FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable; // // Get AcpiTable Protocol. // Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTableProtocol); if (EFI_ERROR (Status)) { return Status; } // // Collect boot records from SMM drivers. // SmmCommData = NULL; Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &Communication); if (!EFI_ERROR (Status)) { // // Initialize communicate buffer // SmmCommBufferHeader = (EFI_SMM_COMMUNICATE_HEADER*)SmmBootRecordCommBuffer; SmmCommData = (SMM_BOOT_RECORD_COMMUNICATE*)SmmCommBufferHeader->Data; ZeroMem((UINT8*)SmmCommData, sizeof(SMM_BOOT_RECORD_COMMUNICATE)); CopyGuid (&SmmCommBufferHeader->HeaderGuid, &gEfiFirmwarePerformanceGuid); SmmCommBufferHeader->MessageLength = sizeof(SMM_BOOT_RECORD_COMMUNICATE); CommSize = SMM_BOOT_RECORD_COMM_SIZE; // // Get the size of boot records. // SmmCommData->Function = SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE; SmmCommData->BootRecordData = NULL; Status = Communication->Communicate (Communication, SmmBootRecordCommBuffer, &CommSize); ASSERT_EFI_ERROR (Status); if (!EFI_ERROR (SmmCommData->ReturnStatus) && SmmCommData->BootRecordSize != 0) { // // Get all boot records // SmmCommData->Function = SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA; SmmCommData->BootRecordData = AllocateZeroPool(SmmCommData->BootRecordSize); ASSERT (SmmCommData->BootRecordData != NULL); Status = Communication->Communicate (Communication, SmmBootRecordCommBuffer, &CommSize); ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR(SmmCommData->ReturnStatus); } } // // Prepare memory for runtime Performance Record. // Runtime performance records includes two tables S3 performance table and Boot performance table. // S3 Performance table includes S3Resume and S3Suspend records. // Boot Performance table includes BasicBoot record, and one or more appended Boot Records. // PerformanceRuntimeData = NULL; PerformanceRuntimeDataSize = sizeof (S3_PERFORMANCE_TABLE) + sizeof (BOOT_PERFORMANCE_TABLE) + mBootRecordSize + PcdGet32 (PcdExtFpdtBootRecordPadSize); if (SmmCommData != NULL) { PerformanceRuntimeDataSize += SmmCommData->BootRecordSize; } // // Try to allocate the same runtime buffer as last time boot. // ZeroMem (&PerformanceVariable, sizeof (PerformanceVariable)); Size = sizeof (PerformanceVariable); Status = gRT->GetVariable ( EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME, &gEfiFirmwarePerformanceGuid, NULL, &Size, &PerformanceVariable ); if (!EFI_ERROR (Status)) { Address = PerformanceVariable.S3PerformanceTablePointer; Status = gBS->AllocatePages ( AllocateAddress,//.........这里部分代码省略.........
开发者ID:Cutty,项目名称:edk2,代码行数:101,
示例13: VariableServiceInitialize/** Variable Driver main entry point. The Variable driver places the 4 EFI runtime services in the EFI System Table and installs arch protocols for variable read and write services being availible. It also registers a notification function for an EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. @param[in] ImageHandle The firmware allocated handle for the EFI image. @param[in] SystemTable A pointer to the EFI System Table. @retval EFI_SUCCESS Variable service successfully initialized.**/EFI_STATUSEFIAPIVariableServiceInitialize ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ){ EFI_STATUS Status; EFI_EVENT ReadyToBootEvent; Status = VariableCommonInitialize (); ASSERT_EFI_ERROR (Status); SystemTable->RuntimeServices->GetVariable = VariableServiceGetVariable; SystemTable->RuntimeServices->GetNextVariableName = VariableServiceGetNextVariableName; SystemTable->RuntimeServices->SetVariable = VariableServiceSetVariable; SystemTable->RuntimeServices->QueryVariableInfo = VariableServiceQueryVariableInfo; // // Now install the Variable Runtime Architectural protocol on a new handle. // Status = gBS->InstallProtocolInterface ( &mHandle, &gEfiVariableArchProtocolGuid, EFI_NATIVE_INTERFACE, NULL ); ASSERT_EFI_ERROR (Status); // // Register FtwNotificationEvent () notify function. // EfiCreateProtocolNotifyEvent ( &gEfiFaultTolerantWriteProtocolGuid, TPL_CALLBACK, FtwNotificationEvent, (VOID *)SystemTable, &mFtwRegistration ); Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, VariableClassAddressChangeEvent, NULL, &gEfiEventVirtualAddressChangeGuid, &mVirtualAddressChangeEvent ); ASSERT_EFI_ERROR (Status); // // Register the event handling function to reclaim variable for OS usage. // Status = EfiCreateEventReadyToBootEx ( TPL_NOTIFY, OnReadyToBoot, NULL, &ReadyToBootEvent ); return EFI_SUCCESS;}
开发者ID:Cutty,项目名称:edk2,代码行数:74,
示例14: line/** Function to read a single line (up to but not including the /n) from a file. If the position upon start is 0, then the Ascii Boolean will be set. This should be maintained and not changed for all operations with the same file. The function will not return the /r and /n character in buffer. When an empty line is read a CHAR_NULL character will be returned in buffer. @param[in] Handle FileHandle to read from. @param[in, out] Buffer The pointer to buffer to read into. @param[in, out] Size The pointer to number of bytes in Buffer. @param[in] Truncate If the buffer is large enough, this has no effect. If the buffer is is too small and Truncate is TRUE, the line will be truncated. If the buffer is is too small and Truncate is FALSE, then no read will occur. @param[in, out] Ascii Boolean value for indicating whether the file is Ascii (TRUE) or UCS2 (FALSE). @retval EFI_SUCCESS The operation was successful. The line is stored in Buffer. @retval EFI_INVALID_PARAMETER Handle was NULL. @retval EFI_INVALID_PARAMETER Size was NULL. @retval EFI_BUFFER_TOO_SMALL Size was not large enough to store the line. Size was updated to the minimum space required. @sa FileHandleRead**/EFI_STATUSEFIAPIFileHandleReadLine( IN EFI_FILE_HANDLE Handle, IN OUT CHAR16 *Buffer, IN OUT UINTN *Size, IN BOOLEAN Truncate, IN OUT BOOLEAN *Ascii ){ EFI_STATUS Status; CHAR16 CharBuffer; UINT64 FileSize; UINTN CharSize; UINTN CountSoFar; UINTN CrCount; UINT64 OriginalFilePosition; if (Handle == NULL ||Size == NULL ||(Buffer==NULL&&*Size!=0) ){ return (EFI_INVALID_PARAMETER); } if (Buffer != NULL && *Size != 0) { *Buffer = CHAR_NULL; } Status = FileHandleGetSize (Handle, &FileSize); if (EFI_ERROR (Status)) { return Status; } else if (FileSize == 0) { *Ascii = TRUE; return EFI_SUCCESS; } FileHandleGetPosition(Handle, &OriginalFilePosition); if (OriginalFilePosition == 0) { CharSize = sizeof(CHAR16); Status = FileHandleRead(Handle, &CharSize, &CharBuffer); ASSERT_EFI_ERROR(Status); if (CharBuffer == gUnicodeFileTag) { *Ascii = FALSE; } else { *Ascii = TRUE; FileHandleSetPosition(Handle, OriginalFilePosition); } } CrCount = 0; for (CountSoFar = 0;;CountSoFar++){ CharBuffer = 0; if (*Ascii) { CharSize = sizeof(CHAR8); } else { CharSize = sizeof(CHAR16); } Status = FileHandleRead(Handle, &CharSize, &CharBuffer); if ( EFI_ERROR(Status) || CharSize == 0 || (CharBuffer == L'/n' && !(*Ascii)) || (CharBuffer == '/n' && *Ascii) ){ break; } else if ( (CharBuffer == L'/r' && !(*Ascii)) || (CharBuffer == '/r' && *Ascii) ) { CrCount++; continue; }//.........这里部分代码省略.........
开发者ID:baranee,项目名称:edk2,代码行数:101,
示例15: BdsBootDeviceSelect/** This function attempts to boot for the boot order specified by platform policy.**/VOIDBdsBootDeviceSelect ( VOID ){ EFI_STATUS Status; LIST_ENTRY *Link; BDS_COMMON_OPTION *BootOption; UINTN ExitDataSize; CHAR16 *ExitData; UINT16 Timeout; LIST_ENTRY BootLists; CHAR16 Buffer[20]; BOOLEAN BootNextExist; LIST_ENTRY *LinkBootNext; EFI_EVENT ConnectConInEvent; // // Got the latest boot option // BootNextExist = FALSE; LinkBootNext = NULL; ConnectConInEvent = NULL; InitializeListHead (&BootLists); // // First check the boot next option // ZeroMem (Buffer, sizeof (Buffer)); // // Create Event to signal ConIn connection request // if (PcdGetBool (PcdConInConnectOnDemand)) { Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, BdsEmptyCallbackFunction, NULL, &gConnectConInEventGuid, &ConnectConInEvent ); if (EFI_ERROR(Status)) { ConnectConInEvent = NULL; } } if (mBootNext != NULL) { // // Indicate we have the boot next variable, so this time // boot will always have this boot option // BootNextExist = TRUE; // // Clear the this variable so it's only exist in this time boot // Status = gRT->SetVariable ( L"BootNext", &gEfiGlobalVariableGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, 0, NULL ); // // Deleting variable with current variable implementation shouldn't fail. // ASSERT_EFI_ERROR (Status); // // Add the boot next boot option // UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *mBootNext); BootOption = BdsLibVariableToOption (&BootLists, Buffer); // // If fail to get boot option from variable, just return and do nothing. // if (BootOption == NULL) { return; } BootOption->BootCurrent = *mBootNext; } // // Parse the boot order to get boot option // BdsLibBuildOptionFromVar (&BootLists, L"BootOrder"); // // When we didn't have chance to build boot option variables in the first // full configuration boot (e.g.: Reset in the first page or in Device Manager), // we have no boot options in the following mini configuration boot. // Give the last chance to enumerate the boot options.//.........这里部分代码省略.........
开发者ID:Clover-EFI-Bootloader,项目名称:clover,代码行数:101,
示例16: Unmap//.........这里部分代码省略......... if (Operation >= MapOperationMaximum) { return EFI_INVALID_PARAMETER; } // // The debug implementation of UncachedMemoryAllocationLib in ArmPkg returns // a virtual uncached alias, and unmaps the cached ID mapping of the buffer, // in order to catch inadvertent references to the cached mapping. // Since HostToDeviceAddress () expects ID mapped input addresses, convert // the host address to an ID mapped address first. // *DeviceAddress = HostToDeviceAddress (ConvertToPhysicalAddress (HostAddress)); // Remember range so we can flush on the other side Map = AllocatePool (sizeof (MAP_INFO_INSTANCE)); if (Map == NULL) { return EFI_OUT_OF_RESOURCES; } if ((((UINTN)HostAddress & (mCpu->DmaBufferAlignment - 1)) != 0) || ((*NumberOfBytes & (mCpu->DmaBufferAlignment - 1)) != 0)) { // Get the cacheability of the region Status = gDS->GetMemorySpaceDescriptor ((UINTN)HostAddress, &GcdDescriptor); if (EFI_ERROR(Status)) { goto FreeMapInfo; } // If the mapped buffer is not an uncached buffer if ((GcdDescriptor.Attributes & (EFI_MEMORY_WB | EFI_MEMORY_WT)) != 0) { // // Operations of type MapOperationBusMasterCommonBuffer are only allowed // on uncached buffers. // if (Operation == MapOperationBusMasterCommonBuffer) { DEBUG ((EFI_D_ERROR, "%a: Operation type 'MapOperationBusMasterCommonBuffer' is only supported/n" "on memory regions that were allocated using DmaAllocateBuffer ()/n", __FUNCTION__)); Status = EFI_UNSUPPORTED; goto FreeMapInfo; } // // If the buffer does not fill entire cache lines we must double buffer into // uncached memory. Device (PCI) address becomes uncached page. // Map->DoubleBuffer = TRUE; Status = DmaAllocateBuffer (EfiBootServicesData, EFI_SIZE_TO_PAGES (*NumberOfBytes), &Buffer); if (EFI_ERROR (Status)) { goto FreeMapInfo; } if (Operation == MapOperationBusMasterRead) { CopyMem (Buffer, HostAddress, *NumberOfBytes); } *DeviceAddress = HostToDeviceAddress (ConvertToPhysicalAddress (Buffer)); Map->BufferAddress = Buffer; } else { Map->DoubleBuffer = FALSE; } } else { Map->DoubleBuffer = FALSE; DEBUG_CODE_BEGIN (); // // The operation type check above only executes if the buffer happens to be // misaligned with respect to CWG, but even if it is aligned, we should not // allow arbitrary buffers to be used for creating consistent mappings. // So duplicate the check here when running in DEBUG mode, just to assert // that we are not trying to create a consistent mapping for cached memory. // Status = gDS->GetMemorySpaceDescriptor ((UINTN)HostAddress, &GcdDescriptor); ASSERT_EFI_ERROR(Status); ASSERT (Operation != MapOperationBusMasterCommonBuffer || (GcdDescriptor.Attributes & (EFI_MEMORY_WB | EFI_MEMORY_WT)) == 0); DEBUG_CODE_END (); // Flush the Data Cache (should not have any effect if the memory region is uncached) mCpu->FlushDataCache (mCpu, (UINTN)HostAddress, *NumberOfBytes, EfiCpuFlushTypeWriteBackInvalidate); } Map->HostAddress = (UINTN)HostAddress; Map->NumberOfBytes = *NumberOfBytes; Map->Operation = Operation; *Mapping = Map; return EFI_SUCCESS;FreeMapInfo: FreePool (Map); return Status;}
开发者ID:baranee,项目名称:edk2,代码行数:101,
示例17: Flash_Start_OSVOIDFlash_Start_OS ( ){ UINT32 Index = 0; UINTN FDTConfigTable = 0; EFI_STATUS Status; ESL_LINUX LinuxKernel = (ESL_LINUX)(0x80000); if (!PcdGet32(PcdIsMPBoot)) { for (Index = 0; Index < gST->NumberOfTableEntries; Index ++) { if (CompareGuid (&gFdtTableGuid, &(gST->ConfigurationTable[Index].VendorGuid))) { FDTConfigTable = (UINTN)gST->ConfigurationTable[Index].VendorTable; DEBUG ((EFI_D_ERROR, "FDTConfigTable Address: 0x%lx/n",FDTConfigTable)); break; } } gBS->CopyMem((void *)0x6000000,(void *)FDTConfigTable,0x100000); MicroSecondDelay(20000); gBS->CopyMem((void *)LinuxKernel,(void *)0x90100000,0x1F00000); MicroSecondDelay(200000); gBS->CopyMem((void *)0x7000000,(void *)0x92000000,0x4000000); MicroSecondDelay(200000); DEBUG((EFI_D_ERROR,"Update FDT/n")); Status = EFIFdtUpdate(0x06000000); if(EFI_ERROR(Status)) { DEBUG((EFI_D_ERROR,"EFIFdtUpdate ERROR/n")); goto Exit; } } else { Status = LzmaDecompressKernel (LinuxKernel); if(EFI_ERROR(Status)) { goto Exit; } gBS->CopyMem((void *)0x6000000, (void *)0xA47C0000, 0x20000); MicroSecondDelay(20000); gBS->CopyMem((void *)0x7000000, (void *)0xA4000000, 0x7C0000); MicroSecondDelay(200000); } Status = ShutdownUefiBootServices (); if(EFI_ERROR(Status)) { DEBUG((EFI_D_ERROR,"ERROR: Can not shutdown UEFI boot services. Status=0x%X/n", Status)); goto Exit; } // // Switch off interrupts, caches, mmu, etc // Status = PreparePlatformHardware (); ASSERT_EFI_ERROR(Status); LinuxKernel (0x06000000,0,0,0); // Kernel should never exit // After Life services are not provided ASSERT(FALSE);Exit: // Only be here if we fail to start Linux Print (L"ERROR : Can not start the kernel. Status=0x%X/n", Status); // Free Runtimee Memory (kernel and FDT) return ;}
开发者ID:gaozhangfei,项目名称:uefi,代码行数:77,
示例18: Image/** Function for 'drivers' command. @param[in] ImageHandle Handle to the Image (NULL if Internal). @param[in] SystemTable Pointer to the System Table (NULL if Internal).**/SHELL_STATUSEFIAPIShellCommandRunDrivers ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ){ EFI_STATUS Status; LIST_ENTRY *Package; CHAR16 *ProblemParam; SHELL_STATUS ShellStatus; CHAR8 *Language; CONST CHAR16 *Lang; EFI_HANDLE *HandleList; EFI_HANDLE *HandleWalker; UINTN ChildCount; UINTN DeviceCount; CHAR16 *Temp2; CONST CHAR16 *FullDriverName; CHAR16 *TruncatedDriverName; CHAR16 *FormatString; UINT32 DriverVersion; BOOLEAN DriverConfig; BOOLEAN DriverDiag; BOOLEAN SfoFlag; ShellStatus = SHELL_SUCCESS; Status = EFI_SUCCESS; Language = NULL; FormatString = NULL; SfoFlag = FALSE; // // initialize the shell lib (we must be in non-auto-init...) // Status = ShellInitialize(); ASSERT_EFI_ERROR(Status); Status = CommandInit(); ASSERT_EFI_ERROR(Status); // // parse the command line // Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); if (EFI_ERROR(Status)) { if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"drivers", ProblemParam); FreePool(ProblemParam); ShellStatus = SHELL_INVALID_PARAMETER; } else { ASSERT(FALSE); } } else { if (ShellCommandLineGetCount(Package) > 1) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"drivers"); ShellStatus = SHELL_INVALID_PARAMETER; } else { if (ShellCommandLineGetFlag(Package, L"-l")){ Lang = ShellCommandLineGetValue(Package, L"-l"); if (Lang != NULL) { Language = AllocateZeroPool(StrSize(Lang)); AsciiSPrint(Language, StrSize(Lang), "%S", Lang); } else { ASSERT(Language == NULL); ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drivers", L"-l"); ShellCommandLineFreeVarList (Package); return (SHELL_INVALID_PARAMETER); } } if (ShellCommandLineGetFlag (Package, L"-sfo")) { SfoFlag = TRUE; FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE_SFO), Language); // // print the SFO header // ShellPrintHiiEx ( -1, -1, Language, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellDriver1HiiHandle, L"drivers"); } else { FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE), Language); // // print the header row // ShellPrintHiiEx( -1, -1, Language, STRING_TOKEN (STR_DRIVERS_HEADER_LINES),//.........这里部分代码省略.........
开发者ID:EvanLloyd,项目名称:tianocore,代码行数:101,
示例19: ESL_Start_OSVOIDESL_Start_OS ( ){ EFI_STATUS Status; UINTN Reg_Value; ESL_LINUX LinuxKernel = (ESL_LINUX)(0x80000); if(!PcdGet32(PcdIsMPBoot)) { DEBUG((EFI_D_ERROR,"Update FDT/n")); Status = EFIFdtUpdate(0x06000000); if(EFI_ERROR(Status)) { DEBUG((EFI_D_ERROR,"EFIFdtUpdate ERROR/n")); goto Exit; } } DEBUG((EFI_D_ERROR, "[%a]:[%dL] Start to boot Linux/n", __FUNCTION__, __LINE__)); SmmuConfigForLinux(); ITSCONFIG(); if(PcdGet32(PcdIsMPBoot)) { *(volatile UINT32 *)(0x60016220) = 0x7; *(volatile UINT32 *)(0x60016230) = 0x40016260; *(volatile UINT32 *)(0x60016234) = 0X0; *(volatile UINT32 *)(0x60016238) = 0x60016260; *(volatile UINT32 *)(0x6001623C) = 0x400; *(volatile UINT32 *)(0x60016240) = 0x40016260; *(volatile UINT32 *)(0x60016244) = 0x400; *(volatile UINT32 *)(0x40016220) = 0x7; *(volatile UINT32 *)(0x40016230) = 0x60016260; *(volatile UINT32 *)(0x40016234) = 0X0; *(volatile UINT32 *)(0x40016238) = 0x60016260; *(volatile UINT32 *)(0x4001623C) = 0x400; *(volatile UINT32 *)(0x40016240) = 0x40016260; *(volatile UINT32 *)(0x40016244) = 0x400; *(volatile UINT32 *)(0x60016220 + S1_BASE) = 0x7; *(volatile UINT32 *)(0x60016230 + S1_BASE) = 0x40016260; *(volatile UINT32 *)(0x60016234 + S1_BASE) = 0X0; *(volatile UINT32 *)(0x60016238 + S1_BASE) = 0x60016260; *(volatile UINT32 *)(0x6001623C + S1_BASE) = 0x0; *(volatile UINT32 *)(0x60016240 + S1_BASE) = 0x40016260; *(volatile UINT32 *)(0x60016244 + S1_BASE) = 0x400; *(volatile UINT32 *)(0x40016220 + S1_BASE) = 0x7; *(volatile UINT32 *)(0x40016230 + S1_BASE) = 0x60016260; *(volatile UINT32 *)(0x40016234 + S1_BASE) = 0X0; *(volatile UINT32 *)(0x40016238 + S1_BASE) = 0x60016260; *(volatile UINT32 *)(0x4001623C + S1_BASE) = 0x400; *(volatile UINT32 *)(0x40016240 + S1_BASE) = 0x40016260; *(volatile UINT32 *)(0x40016244 + S1_BASE) = 0x0; } Status = ShutdownUefiBootServices (); if(EFI_ERROR(Status)) { DEBUG((EFI_D_ERROR,"ERROR: Can not shutdown UEFI boot services. Status=0x%X/n", Status)); goto Exit; } // // Switch off interrupts, caches, mmu, etc // Status = PreparePlatformHardware (); ASSERT_EFI_ERROR(Status); *(volatile UINT32*)0xFFF8 = 0x0; *(volatile UINT32*)0xFFFC = 0x0; asm("DSB SY"); asm("ISB"); if (!PcdGet64 (PcdTrustedFirmwareEnable)) { StartupAp(); } Reg_Value = asm_read_reg(); DEBUG((EFI_D_ERROR,"CPUECTLR_EL1 = 0x%llx/n",Reg_Value)); MN_CONFIG (); DEBUG((EFI_D_ERROR, "[%a]:[%dL] Start to jump Linux kernel/n", __FUNCTION__, __LINE__)); LinuxKernel (0x06000000,0,0,0); // Kernel should never exit // After Life services are not provided ASSERT(FALSE);Exit: // Only be here if we fail to start Linux Print (L"ERROR : Can not start the kernel. Status=0x%X/n", Status);//.........这里部分代码省略.........
开发者ID:gaozhangfei,项目名称:uefi,代码行数:101,
示例20: Image/** Function for 'tftp' command. @param[in] ImageHandle Handle to the Image (NULL if Internal). @param[in] SystemTable Pointer to the System Table (NULL if Internal). @return SHELL_SUCCESS The 'tftp' command completed successfully. @return SHELL_ABORTED The Shell Library initialization failed. @return SHELL_INVALID_PARAMETER At least one of the command's arguments is not valid. @return SHELL_OUT_OF_RESOURCES A memory allocation failed. @return SHELL_NOT_FOUND Network Interface Card not found or server error or file error.**/SHELL_STATUSEFIAPIShellCommandRunTftp ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ){ SHELL_STATUS ShellStatus; EFI_STATUS Status; LIST_ENTRY *CheckPackage; CHAR16 *ProblemParam; UINTN ParamCount; CONST CHAR16 *UserNicName; BOOLEAN NicFound; CONST CHAR16 *ValueStr; CONST CHAR16 *RemoteFilePath; CHAR8 *AsciiRemoteFilePath; UINTN FilePathSize; CONST CHAR16 *Walker; CONST CHAR16 *LocalFilePath; EFI_MTFTP4_CONFIG_DATA Mtftp4ConfigData; EFI_HANDLE *Handles; UINTN HandleCount; UINTN NicNumber; CHAR16 NicName[IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH]; EFI_HANDLE ControllerHandle; EFI_HANDLE Mtftp4ChildHandle; EFI_MTFTP4_PROTOCOL *Mtftp4; UINTN FileSize; VOID *Data; SHELL_FILE_HANDLE FileHandle; UINT16 BlockSize; ShellStatus = SHELL_INVALID_PARAMETER; ProblemParam = NULL; NicFound = FALSE; AsciiRemoteFilePath = NULL; Handles = NULL; FileSize = 0; BlockSize = MTFTP_DEFAULT_BLKSIZE; // // Initialize the Shell library (we must be in non-auto-init...) // Status = ShellInitialize (); if (EFI_ERROR (Status)) { ASSERT_EFI_ERROR (Status); return SHELL_ABORTED; } // // Parse the command line. // Status = ShellCommandLineParse (ParamList, &CheckPackage, &ProblemParam, TRUE); if (EFI_ERROR (Status)) { if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL) ) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellTftpHiiHandle, L"tftp", ProblemParam ); FreePool (ProblemParam); } else { ASSERT (FALSE); } goto Error; } // // Check the number of parameters // ParamCount = ShellCommandLineGetCount (CheckPackage); if (ParamCount > 4) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellTftpHiiHandle, L"tftp" ); goto Error; } if (ParamCount < 3) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellTftpHiiHandle, L"tftp" ); goto Error;//.........这里部分代码省略.........
开发者ID:lgao4,项目名称:edk2,代码行数:101,
示例21: Image/** Function for 'attrib' command. @param[in] ImageHandle Handle to the Image (NULL if Internal). @param[in] SystemTable Pointer to the System Table (NULL if Internal).**/SHELL_STATUSEFIAPIShellCommandRunAttrib ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ){ UINT64 FileAttributesToAdd; UINT64 FileAttributesToRemove; EFI_STATUS Status; LIST_ENTRY *Package; CHAR16 *ProblemParam; SHELL_STATUS ShellStatus; UINTN ParamNumberCount; CONST CHAR16 *FileName; EFI_SHELL_FILE_INFO *ListOfFiles; EFI_SHELL_FILE_INFO *FileNode; EFI_FILE_INFO *FileInfo; ListOfFiles = NULL; ShellStatus = SHELL_SUCCESS; ProblemParam = NULL; // // initialize the shell lib (we must be in non-auto-init...) // Status = ShellInitialize(); ASSERT_EFI_ERROR(Status); // // parse the command line // Status = ShellCommandLineParse (AttribParamList, &Package, &ProblemParam, TRUE); if (EFI_ERROR(Status)) { if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"attrib", ProblemParam); FreePool(ProblemParam); ShellStatus = SHELL_INVALID_PARAMETER; } else { ASSERT(FALSE); } } else { // // check for "-?" // if (ShellCommandLineGetFlag(Package, L"-?")) { ASSERT(FALSE); } else { FileAttributesToAdd = 0; FileAttributesToRemove = 0; // // apply or remove each flag // if (ShellCommandLineGetFlag(Package, L"+a")) { FileAttributesToAdd |= EFI_FILE_ARCHIVE; } if (ShellCommandLineGetFlag(Package, L"-a")) { FileAttributesToRemove |= EFI_FILE_ARCHIVE; } if (ShellCommandLineGetFlag(Package, L"+s")) { FileAttributesToAdd |= EFI_FILE_SYSTEM; } if (ShellCommandLineGetFlag(Package, L"-s")) { FileAttributesToRemove |= EFI_FILE_SYSTEM; } if (ShellCommandLineGetFlag(Package, L"+h")) { FileAttributesToAdd |= EFI_FILE_HIDDEN; } if (ShellCommandLineGetFlag(Package, L"-h")) { FileAttributesToRemove |= EFI_FILE_HIDDEN; } if (ShellCommandLineGetFlag(Package, L"+r")) { FileAttributesToAdd |= EFI_FILE_READ_ONLY; } if (ShellCommandLineGetFlag(Package, L"-r")) { FileAttributesToRemove |= EFI_FILE_READ_ONLY; } if (FileAttributesToRemove == 0 && FileAttributesToAdd == 0) { // // Do display as we have no attributes to change // for ( ParamNumberCount = 1 ; ; ParamNumberCount++ ){ FileName = ShellCommandLineGetRawValue(Package, ParamNumberCount); // if we dont have anything left, move on... if (FileName == NULL && ParamNumberCount == 1) { FileName = (CHAR16*)AllFiles; } else if (FileName == NULL) { break;//.........这里部分代码省略.........
开发者ID:b-man,项目名称:edk2,代码行数:101,
示例22: BootOptionStartEFI_STATUSBootOptionStart ( IN BDS_LOAD_OPTION *BootOption ){ EFI_STATUS Status; EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol; UINT32 LoaderType; ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData; ARM_BDS_LINUX_ARGUMENTS* LinuxArguments; EFI_DEVICE_PATH_PROTOCOL* FdtDevicePath; EFI_DEVICE_PATH_PROTOCOL* DefaultFdtDevicePath; UINTN FdtDevicePathSize; UINTN CmdLineSize; UINTN InitrdSize; EFI_DEVICE_PATH* Initrd; UINT16 LoadOptionIndexSize; if (IS_ARM_BDS_BOOTENTRY (BootOption)) { Status = EFI_UNSUPPORTED; OptionalData = BootOption->OptionalData; LoaderType = ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType); if (LoaderType == BDS_LOADER_EFI_APPLICATION) { // Need to connect every drivers to ensure no dependencies are missing for the application BdsConnectAllDrivers(); Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList, 0, NULL); } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) { LinuxArguments = &(OptionalData->Arguments.LinuxArguments); CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize); InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize); if (InitrdSize > 0) { Initrd = GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize)); } else { Initrd = NULL; } Status = BdsBootLinuxAtag (BootOption->FilePathList, Initrd, // Initrd (CHAR8*)(LinuxArguments + 1)); // CmdLine } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT) { LinuxArguments = &(OptionalData->Arguments.LinuxArguments); CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize); InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize); if (InitrdSize > 0) { Initrd = GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize)); } else { Initrd = NULL; } // Get the default FDT device path Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol); ASSERT_EFI_ERROR(Status); DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath)); // Get the FDT device path FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath); Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", &gArmGlobalVariableGuid, DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath); ASSERT_EFI_ERROR(Status); Status = BdsBootLinuxFdt (BootOption->FilePathList, Initrd, // Initrd (CHAR8*)(LinuxArguments + 1), FdtDevicePath); FreePool (FdtDevicePath); } } else { // Set BootCurrent variable LoadOptionIndexSize = sizeof(UINT16); gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, LoadOptionIndexSize, &(BootOption->LoadOptionIndex)); Status = BdsStartEfiApplication (mImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData); // Clear BootCurrent variable LoadOptionIndexSize = sizeof(UINT16); gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, 0, NULL); } return Status;}
开发者ID:B-Rich,项目名称:edk2,代码行数:89,
示例23: DetectAndPreparePlatformPciDevicePath/** Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut. @param[in] Handle - Handle of PCI device instance @param[in] PciIo - PCI IO protocol instance @param[in] Pci - PCI Header register block @retval EFI_SUCCESS - PCI Device check and Console variable update successfully. @retval EFI_STATUS - PCI Device check or Console variable update fail.**/EFI_STATUSEFIAPIDetectAndPreparePlatformPciDevicePath ( IN EFI_HANDLE Handle, IN EFI_PCI_IO_PROTOCOL *PciIo, IN PCI_TYPE00 *Pci ){ EFI_STATUS Status; Status = PciIo->Attributes ( PciIo, EfiPciIoAttributeOperationEnable, EFI_PCI_DEVICE_ENABLE, NULL ); ASSERT_EFI_ERROR (Status); if (!mDetectVgaOnly) { // // Here we decide whether it is LPC Bridge // if ((IS_PCI_LPC (Pci)) || ((IS_PCI_ISA_PDECODE (Pci)) && (Pci->Hdr.VendorId == 0x8086) && (Pci->Hdr.DeviceId == 0x7000) ) ) { // // Add IsaKeyboard to ConIn, // add IsaSerial to ConOut, ConIn, ErrOut // DEBUG ((EFI_D_INFO, "Found LPC Bridge device/n")); PrepareLpcBridgeDevicePath (Handle); return EFI_SUCCESS; } // // Here we decide which Serial device to enable in PCI bus // if (IS_PCI_16550SERIAL (Pci)) { // // Add them to ConOut, ConIn, ErrOut. // DEBUG ((EFI_D_INFO, "Found PCI 16550 SERIAL device/n")); PreparePciSerialDevicePath (Handle); return EFI_SUCCESS; } } // // Here we decide which VGA device to enable in PCI bus // if (IS_PCI_VGA (Pci)) { // // Add them to ConOut. // DEBUG ((EFI_D_INFO, "Found PCI VGA device/n")); PreparePciVgaDevicePath (Handle); return EFI_SUCCESS; } return Status;}
开发者ID:jeppeter,项目名称:vbox,代码行数:75,
示例24: InitializeUnicodeCollationEng/** The user Entry Point for English module. This function initializes unicode character mapping and then installs Unicode Collation & Unicode Collation 2 Protocols based on the feature flags. @param ImageHandle The firmware allocated handle for the EFI image. @param SystemTable A pointer to the EFI System Table. @retval EFI_SUCCESS The entry point is executed successfully. @retval other Some error occurs when executing this entry point.**/EFI_STATUSEFIAPIInitializeUnicodeCollationEng ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ){ EFI_STATUS Status; UINTN Index; UINTN Index2; // // Initialize mapping tables for the supported languages // for (Index = 0; Index < MAP_TABLE_SIZE; Index++) { mEngUpperMap[Index] = (CHAR8) Index; mEngLowerMap[Index] = (CHAR8) Index; mEngInfoMap[Index] = 0; if ((Index >= 'a' && Index <= 'z') || (Index >= 0xe0 && Index <= 0xf6) || (Index >= 0xf8 && Index <= 0xfe)) { Index2 = Index - 0x20; mEngUpperMap[Index] = (CHAR8) Index2; mEngLowerMap[Index2] = (CHAR8) Index; mEngInfoMap[Index] |= CHAR_FAT_VALID; mEngInfoMap[Index2] |= CHAR_FAT_VALID; } } for (Index = 0; mOtherChars[Index] != 0; Index++) { Index2 = mOtherChars[Index]; mEngInfoMap[Index2] |= CHAR_FAT_VALID; } if (FeaturePcdGet (PcdUnicodeCollation2Support)) { if (FeaturePcdGet (PcdUnicodeCollationSupport)) { Status = gBS->InstallMultipleProtocolInterfaces ( &mHandle, &gEfiUnicodeCollationProtocolGuid, &UnicodeEng, &gEfiUnicodeCollation2ProtocolGuid, &Unicode2Eng, NULL ); ASSERT_EFI_ERROR (Status); } else { Status = gBS->InstallMultipleProtocolInterfaces ( &mHandle, &gEfiUnicodeCollation2ProtocolGuid, &Unicode2Eng, NULL ); ASSERT_EFI_ERROR (Status); } } else { if (FeaturePcdGet (PcdUnicodeCollationSupport)) { Status = gBS->InstallMultipleProtocolInterfaces ( &mHandle, &gEfiUnicodeCollationProtocolGuid, &UnicodeEng, NULL ); ASSERT_EFI_ERROR (Status); } else { // // This module must support to produce at least one of Unicode Collation Protocol // and Unicode Collation 2 Protocol. // ASSERT (FALSE); Status = EFI_UNSUPPORTED; } } return Status;}
开发者ID:AshleyDeSimone,项目名称:edk2,代码行数:89,
示例25: MeasureFvImage/** Measure FV image. Add it into the measured FV list after the FV is measured successfully. @param[in] FvBase Base address of FV image. @param[in] FvLength Length of FV image. @retval EFI_SUCCESS Fv image is measured successfully or it has been already measured. @retval EFI_OUT_OF_RESOURCES No enough memory to log the new event. @retval EFI_DEVICE_ERROR The command was unsuccessful.**/EFI_STATUSEFIAPIMeasureFvImage ( IN EFI_PHYSICAL_ADDRESS FvBase, IN UINT64 FvLength){ UINT32 Index; EFI_STATUS Status; EFI_PLATFORM_FIRMWARE_BLOB FvBlob; TCG_PCR_EVENT_HDR TcgEventHdr; TIS_TPM_HANDLE TpmHandle; TpmHandle = (TIS_TPM_HANDLE) (UINTN) TPM_BASE_ADDRESS; // // Check if it is in Excluded FV list // if (mMeasurementExcludedFvPpi != NULL) { for (Index = 0; Index < mMeasurementExcludedFvPpi->Count; Index ++) { if (mMeasurementExcludedFvPpi->Fv[Index].FvBase == FvBase) { DEBUG ((DEBUG_INFO, "The FV which is excluded by TcgPei starts at: 0x%x/n", FvBase)); DEBUG ((DEBUG_INFO, "The FV which is excluded by TcgPei has the size: 0x%x/n", FvLength)); return EFI_SUCCESS; } } } // // Check whether FV is in the measured FV list. // for (Index = 0; Index < mMeasuredBaseFvIndex; Index ++) { if (mMeasuredBaseFvInfo[Index].BlobBase == FvBase) { return EFI_SUCCESS; } } // // Measure and record the FV to the TPM // FvBlob.BlobBase = FvBase; FvBlob.BlobLength = FvLength; DEBUG ((DEBUG_INFO, "The FV which is measured by TcgPei starts at: 0x%x/n", FvBlob.BlobBase)); DEBUG ((DEBUG_INFO, "The FV which is measured by TcgPei has the size: 0x%x/n", FvBlob.BlobLength)); TcgEventHdr.PCRIndex = 0; TcgEventHdr.EventType = EV_EFI_PLATFORM_FIRMWARE_BLOB; TcgEventHdr.EventSize = sizeof (FvBlob); Status = HashLogExtendEvent ( (EFI_PEI_SERVICES **) GetPeiServicesTablePointer(), (UINT8*) (UINTN) FvBlob.BlobBase, (UINTN) FvBlob.BlobLength, TpmHandle, &TcgEventHdr, (UINT8*) &FvBlob ); ASSERT_EFI_ERROR (Status); // // Add new FV into the measured FV list. // ASSERT (mMeasuredBaseFvIndex < FixedPcdGet32 (PcdPeiCoreMaxFvSupported)); if (mMeasuredBaseFvIndex < FixedPcdGet32 (PcdPeiCoreMaxFvSupported)) { mMeasuredBaseFvInfo[mMeasuredBaseFvIndex].BlobBase = FvBase; mMeasuredBaseFvInfo[mMeasuredBaseFvIndex].BlobLength = FvLength; mMeasuredBaseFvIndex++; } return Status;}
开发者ID:JohnTroony,项目名称:vector-edk,代码行数:85,
示例26: file/** Function to write a line of text to a file. If the file is a Unicode file (with UNICODE file tag) then write the unicode text. If the file is an ASCII file then write the ASCII text. If the size of file is zero (without file tag at the beginning) then write ASCII text as default. @param[in] Handle FileHandle to write to. @param[in] Buffer Buffer to write, if NULL the function will take no action and return EFI_SUCCESS. @retval EFI_SUCCESS The data was written. Buffer is NULL. @retval EFI_INVALID_PARAMETER Handle is NULL. @retval EFI_OUT_OF_RESOURCES Unable to allocate temporary space for ASCII string due to out of resources. @sa FileHandleWrite**/EFI_STATUSEFIAPIFileHandleWriteLine( IN EFI_FILE_HANDLE Handle, IN CHAR16 *Buffer ){ EFI_STATUS Status; CHAR16 CharBuffer; UINTN Size; UINTN Index; UINTN CharSize; UINT64 FileSize; UINT64 OriginalFilePosition; BOOLEAN Ascii; CHAR8 *AsciiBuffer; if (Buffer == NULL) { return (EFI_SUCCESS); } if (Handle == NULL) { return (EFI_INVALID_PARAMETER); } Ascii = FALSE; AsciiBuffer = NULL; Status = FileHandleGetPosition(Handle, &OriginalFilePosition); if (EFI_ERROR(Status)) { return Status; } Status = FileHandleSetPosition(Handle, 0); if (EFI_ERROR(Status)) { return Status; } Status = FileHandleGetSize(Handle, &FileSize); if (EFI_ERROR(Status)) { return Status; } if (FileSize == 0) { Ascii = TRUE; } else { CharSize = sizeof (CHAR16); Status = FileHandleRead (Handle, &CharSize, &CharBuffer); ASSERT_EFI_ERROR (Status); if (CharBuffer == gUnicodeFileTag) { Ascii = FALSE; } else { Ascii = TRUE; } } Status = FileHandleSetPosition(Handle, OriginalFilePosition); if (EFI_ERROR(Status)) { return Status; } if (Ascii) { Size = ( StrSize(Buffer) / sizeof(CHAR16) ) * sizeof(CHAR8); AsciiBuffer = (CHAR8 *)AllocateZeroPool(Size); if (AsciiBuffer == NULL) { return EFI_OUT_OF_RESOURCES; } UnicodeStrToAsciiStrS (Buffer, AsciiBuffer, Size); for (Index = 0; Index < Size; Index++) { if ((AsciiBuffer[Index] & BIT7) != 0) { FreePool(AsciiBuffer); return EFI_INVALID_PARAMETER; } } Size = AsciiStrSize(AsciiBuffer) - sizeof(CHAR8); Status = FileHandleWrite(Handle, &Size, AsciiBuffer); if (EFI_ERROR(Status)) { FreePool (AsciiBuffer);//.........这里部分代码省略.........
开发者ID:baranee,项目名称:edk2,代码行数:101,
示例27: Unmap//.........这里部分代码省略......... Status = EFI_UNSUPPORTED; goto FreeMapInfo; } // // fall through // case EdkiiIoMmuOperationBusMasterCommonBuffer64: // // The buffer at MapInfo->CryptedAddress comes from AllocateBuffer(). // MapInfo->PlainTextAddress = MapInfo->CryptedAddress; // // Stash the crypted data. // CommonBufferHeader = (COMMON_BUFFER_HEADER *)( (UINTN)MapInfo->CryptedAddress - EFI_PAGE_SIZE ); ASSERT (CommonBufferHeader->Signature == COMMON_BUFFER_SIG); CopyMem ( CommonBufferHeader->StashBuffer, (VOID *)(UINTN)MapInfo->CryptedAddress, MapInfo->NumberOfBytes ); // // Point "DecryptionSource" to the stash buffer so that we decrypt // it to the original location, after the switch statement. // DecryptionSource = CommonBufferHeader->StashBuffer; break; default: // // Operation is invalid // Status = EFI_INVALID_PARAMETER; goto FreeMapInfo; } // // Clear the memory encryption mask on the plaintext buffer. // Status = MemEncryptSevClearPageEncMask ( 0, MapInfo->PlainTextAddress, MapInfo->NumberOfPages, TRUE ); ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) { CpuDeadLoop (); } // // If this is a read operation from the Bus Master's point of view, // then copy the contents of the real buffer into the mapped buffer // so the Bus Master can read the contents of the real buffer. // // For BusMasterCommonBuffer[64] operations, the CopyMem() below will decrypt // the original data (from the stash buffer) back to the original location. // if (Operation == EdkiiIoMmuOperationBusMasterRead || Operation == EdkiiIoMmuOperationBusMasterRead64 || Operation == EdkiiIoMmuOperationBusMasterCommonBuffer || Operation == EdkiiIoMmuOperationBusMasterCommonBuffer64) { CopyMem ( (VOID *) (UINTN) MapInfo->PlainTextAddress, DecryptionSource, MapInfo->NumberOfBytes ); } // // Track all MAP_INFO structures. // InsertHeadList (&mMapInfos, &MapInfo->Link); // // Populate output parameters. // *DeviceAddress = MapInfo->PlainTextAddress; *Mapping = MapInfo; DEBUG (( DEBUG_VERBOSE, "%a: Mapping=0x%p Device(PlainText)=0x%Lx Crypted=0x%Lx Pages=0x%Lx/n", __FUNCTION__, MapInfo, MapInfo->PlainTextAddress, MapInfo->CryptedAddress, (UINT64)MapInfo->NumberOfPages )); return EFI_SUCCESS;FreeMapInfo: FreePool (MapInfo);Failed: *NumberOfBytes = 0; return Status;}
开发者ID:shijunjing,项目名称:edk2,代码行数:101,
示例28: RegisterKeystrokeNotify/** The RegisterKeystrokeNotify() function registers a function which will be called when a specified keystroke will occur. @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance. @param KeyData A pointer to a buffer that is filled in with the keystroke information for the key that was pressed. @param KeyNotificationFunction Points to the function to be called when the key sequence is typed specified by KeyData. @param NotifyHandle Points to the unique handle assigned to the registered notification. @retval EFI_SUCCESS The device state was set appropriately. @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.**/EFI_STATUSEFIAPIEmuGopSimpleTextInExRegisterKeyNotify ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_DATA *KeyData, IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction, OUT EFI_HANDLE *NotifyHandle ){ EFI_STATUS Status; GOP_PRIVATE_DATA *Private; EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify; LIST_ENTRY *Link; EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NewNotify; if (KeyData == NULL || KeyNotificationFunction == NULL || NotifyHandle == NULL) { return EFI_INVALID_PARAMETER; } Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This); // // Return EFI_SUCCESS if the (KeyData, NotificationFunction) is already registered. // for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) { CurrentNotify = CR ( Link, EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY, NotifyEntry, EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE ); if (GopPrivateIsKeyRegistered (&CurrentNotify->KeyData, KeyData)) { if (CurrentNotify->KeyNotificationFn == KeyNotificationFunction) { *NotifyHandle = CurrentNotify->NotifyHandle; return EFI_SUCCESS; } } } // // Allocate resource to save the notification function // NewNotify = (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *) AllocateZeroPool (sizeof (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY)); if (NewNotify == NULL) { return EFI_OUT_OF_RESOURCES; } NewNotify->Signature = EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE; NewNotify->KeyNotificationFn = KeyNotificationFunction; NewNotify->NotifyHandle = (EFI_HANDLE) NewNotify; CopyMem (&NewNotify->KeyData, KeyData, sizeof (KeyData)); InsertTailList (&Private->NotifyList, &NewNotify->NotifyEntry); Status = gBS->CreateEvent ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, EmuGopRegisterKeyCallback, NewNotify, &NewNotify->Event ); ASSERT_EFI_ERROR (Status); *NotifyHandle = NewNotify->NotifyHandle; return EFI_SUCCESS;}
开发者ID:EvanLloyd,项目名称:tianocore,代码行数:93,
注:本文中的ASSERT_EFI_ERROR函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ASSERT_EQUAL函数代码示例 C++ ASSERT_DOUBLE_EQ函数代码示例 |