/** Support routine to get the Image read file function. @param ImageContext - The context of the image being loaded @retval EFI_SUCCESS - If Image function location is found **/ EFI_STATUS GetImageReadFunction ( IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext ) { PEI_CORE_INSTANCE *Private; VOID* MemoryBuffer; Private = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer ()); if (Private->PeiMemoryInstalled && ((Private->HobList.HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME) || PcdGetBool (PcdShadowPeimOnS3Boot)) && (EFI_IMAGE_MACHINE_TYPE_SUPPORTED(EFI_IMAGE_MACHINE_X64) || EFI_IMAGE_MACHINE_TYPE_SUPPORTED(EFI_IMAGE_MACHINE_IA32))) { // // Shadow algorithm makes lots of non ANSI C assumptions and only works for IA32 and X64 // compilers that have been tested // if (Private->ShadowedImageRead == NULL) { MemoryBuffer = AllocatePages (0x400 / EFI_PAGE_SIZE + 1); ASSERT (MemoryBuffer != NULL); CopyMem (MemoryBuffer, (CONST VOID *) (UINTN) PeiImageReadForShadow, 0x400); Private->ShadowedImageRead = (PE_COFF_LOADER_READ_FILE) (UINTN) MemoryBuffer; } ImageContext->ImageRead = Private->ShadowedImageRead; } else { ImageContext->ImageRead = PeiImageRead; } return EFI_SUCCESS; }
/** Internal worker function to read a PCI configuration register. This function wraps EFI_PEI_PCI_CFG2_PPI.Read() service. It reads and returns the PCI configuration register specified by Address, the width of data is specified by Width. @param Address The address that encodes the PCI Bus, Device, Function and Register. @param Width The width of data to read @return The value read from the PCI configuration register. **/ UINT32 PeiPciLibPciCfg2ReadWorker ( IN UINTN Address, IN EFI_PEI_PCI_CFG_PPI_WIDTH Width ) { EFI_STATUS Status; UINT32 Data; CONST EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi; UINT64 PciCfg2Address; Status = PeiServicesLocatePpi (&gEfiPciCfg2PpiGuid, 0, NULL, (VOID **) &PciCfg2Ppi); ASSERT_EFI_ERROR (Status); ASSERT (PciCfg2Ppi != NULL); PciCfg2Address = PCI_TO_PCICFG2_ADDRESS (Address); PciCfg2Ppi->Read ( GetPeiServicesTablePointer (), PciCfg2Ppi, Width, PciCfg2Address, &Data ); return Data; }
EFI_STATUS EFIAPI PeiServicesLocatePpi ( IN EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi ) /*++ Routine Description: The wrapper of Pei Core Service function LocatePpi. Arguments: Guid - Pointer to GUID of the PPI. Instance - Instance Number to discover. PpiDescriptor - Pointer to reference the found descriptor. If not NULL, returns a pointer to the descriptor (includes flags, etc) Ppi - Pointer to reference the found PPI Returns: Status - EFI_SUCCESS if the PPI is in the database EFI_NOT_FOUND if the PPI is not in the database --*/ { EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer(); return (*PeiServices)->LocatePpi (PeiServices, Guid, Instance, PpiDescriptor, Ppi); }
/** Call FspInit API. @param[in] FspHeader FSP header pointer. **/ VOID PeiFspInit ( IN FSP_INFO_HEADER *FspHeader ) { FSP_INIT_PARAMS FspInitParams; FSP_INIT_RT_COMMON_BUFFER FspRtBuffer; UINT8 FspUpdRgn[FixedPcdGet32 (PcdMaxUpdRegionSize)]; UINT32 UpdRegionSize; EFI_BOOT_MODE BootMode; UINT64 StackSize; EFI_PHYSICAL_ADDRESS StackBase; EFI_STATUS Status; DEBUG ((DEBUG_INFO, "PeiFspInit enter\n")); PeiServicesGetBootMode (&BootMode); DEBUG ((DEBUG_INFO, "BootMode - 0x%x\n", BootMode)); GetStackInfo (BootMode, FALSE, &StackBase, &StackSize); DEBUG ((DEBUG_INFO, "StackBase - 0x%x\n", StackBase)); DEBUG ((DEBUG_INFO, "StackSize - 0x%x\n", StackSize)); ZeroMem (&FspRtBuffer, sizeof(FspRtBuffer)); FspRtBuffer.StackTop = (UINT32 *)(UINTN)(StackBase + StackSize); FspRtBuffer.BootMode = BootMode; /* Platform override any UPD configs */ UpdRegionSize = GetUpdRegionSize(); DEBUG ((DEBUG_INFO, "UpdRegionSize - 0x%x\n", UpdRegionSize)); DEBUG ((DEBUG_INFO, "sizeof(FspUpdRgn) - 0x%x\n", sizeof(FspUpdRgn))); ASSERT(sizeof(FspUpdRgn) >= UpdRegionSize); ZeroMem (FspUpdRgn, UpdRegionSize); FspRtBuffer.UpdDataRgnPtr = UpdateFspUpdConfigs (FspUpdRgn); FspRtBuffer.BootLoaderTolumSize = 0; ZeroMem (&FspInitParams, sizeof(FspInitParams)); FspInitParams.NvsBufferPtr = GetNvsBuffer (); DEBUG ((DEBUG_INFO, "NvsBufferPtr - 0x%x\n", FspInitParams.NvsBufferPtr)); FspInitParams.RtBufferPtr = (VOID *)&FspRtBuffer; FspInitParams.ContinuationFunc = (CONTINUATION_PROC)ContinuationFunc; SaveSecContext (GetPeiServicesTablePointer ()); DEBUG ((DEBUG_INFO, "FspInitParams - 0x%x\n", &FspInitParams)); DEBUG ((DEBUG_INFO, " NvsBufferPtr - 0x%x\n", FspInitParams.NvsBufferPtr)); DEBUG ((DEBUG_INFO, " RtBufferPtr - 0x%x\n", FspInitParams.RtBufferPtr)); DEBUG ((DEBUG_INFO, " StackTop - 0x%x\n", FspRtBuffer.StackTop)); DEBUG ((DEBUG_INFO, " BootMode - 0x%x\n", FspRtBuffer.BootMode)); DEBUG ((DEBUG_INFO, " UpdDataRgnPtr - 0x%x\n", FspRtBuffer.UpdDataRgnPtr)); DEBUG ((DEBUG_INFO, " ContinuationFunc - 0x%x\n", FspInitParams.ContinuationFunc)); Status = CallFspInit (FspHeader, &FspInitParams); // // Should never return // DEBUG((DEBUG_ERROR, "FSP Init failed, status: 0x%x\n", Status)); CpuDeadLoop (); }
/** Worker function to switch the requested AP to be the BSP from that point onward. @param[in] ProcessorNumber The handle number of AP that is to become the new BSP. **/ VOID SwitchNewBsp ( IN UINTN ProcessorNumber ) { EFI_STATUS Status; EFI_PEI_MP_SERVICES_PPI *CpuMpPpi; // // Get MP Services Protocol // Status = PeiServicesLocatePpi ( &gEfiPeiMpServicesPpiGuid, 0, NULL, (VOID **)&CpuMpPpi ); ASSERT_EFI_ERROR (Status); // // Wakeup all APs for data collection. // Status = CpuMpPpi->SwitchBSP ( GetPeiServicesTablePointer (), CpuMpPpi, ProcessorNumber, TRUE ); ASSERT_EFI_ERROR (Status); }
/** Worker function to retrieve the number of logical processor in the platform. @param[out] NumberOfCpus Pointer to the total number of logical processors in the system, including the BSP and disabled APs. @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical processors that exist in system, including the BSP. **/ VOID GetNumberOfProcessor ( OUT UINTN *NumberOfCpus, OUT UINTN *NumberOfEnabledProcessors ) { EFI_STATUS Status; EFI_PEI_MP_SERVICES_PPI *CpuMpPpi; // // Get MP Services Protocol // Status = PeiServicesLocatePpi ( &gEfiPeiMpServicesPpiGuid, 0, NULL, (VOID **)&CpuMpPpi ); ASSERT_EFI_ERROR (Status); // // Get the number of CPUs // Status = CpuMpPpi->GetNumberOfProcessors ( GetPeiServicesTablePointer (), CpuMpPpi, NumberOfCpus, NumberOfEnabledProcessors ); ASSERT_EFI_ERROR (Status); }
/** Worker function to execute a caller provided function on all enabled APs. @param[in] Procedure A pointer to the function to be run on enabled APs of the system. **/ VOID StartupAPsWorker ( IN EFI_AP_PROCEDURE Procedure ) { EFI_STATUS Status; EFI_PEI_MP_SERVICES_PPI *CpuMpPpi; // // Get MP Services Protocol // Status = PeiServicesLocatePpi ( &gEfiPeiMpServicesPpiGuid, 0, NULL, (VOID **)&CpuMpPpi ); ASSERT_EFI_ERROR (Status); // // Wakeup all APs for data collection. // Status = CpuMpPpi->StartupAllAPs ( GetPeiServicesTablePointer (), CpuMpPpi, Procedure, FALSE, 0, NULL ); ASSERT_EFI_ERROR (Status); }
EFI_STATUS EFIAPI PeiLibFfsGetVolumeInfo ( IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_FV_INFO *VolumeInfo ) /*++ Routine Description: The wrapper of Pei Core Service function FfsGetVolumeInfo. Arguments: VolumeHandle - The handle to Fv Volume. VolumeInfo - The pointer to volume information. Returns: EFI_STATUS --*/ { EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer(); return (*PeiServices)->FfsGetVolumeInfo (VolumeHandle, VolumeInfo); }
AGESA_STATUS AgesaReadSpd ( IN UINTN FcnData, IN OUT AGESA_READ_SPD_PARAMS *ReadSpd ) { EFI_STATUS Status; EFI_PEI_SERVICES **PeiServices; EFI_PEI_SMBUS2_PPI *Smbus2Ppi; PeiServices = (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (); Status = (*PeiServices)->LocatePpi ( PeiServices, &gEfiPeiSmbus2PpiGuid, 0, NULL, &Smbus2Ppi ); if (EFI_ERROR (Status)) { return AGESA_ERROR; } // Convert ReadSpd->MemChannelId to correct SPD Device Address. // Just return AGESA_FATAL for NULL driver. return AGESA_FATAL; }
EFI_STATUS EFIAPI PeiLibFfsFindSectionData ( IN EFI_SECTION_TYPE SectionType, IN EFI_FFS_FILE_HEADER *FfsFileHeader, IN OUT VOID **SectionData ) /*++ Routine Description: The wrapper of Pei Core Service function FfsFindSectionData. Arguments: SearchType - Filter to find only sections of this type. FileHandle - Pointer to the current file to search. SectionData - Pointer to the Section matching SectionType in FfsFileHeader. - NULL if section not found Returns: EFI_STATUS --*/ { EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer(); return (*PeiServices)->FfsFindSectionData (PeiServices, SectionType, (EFI_PEI_FILE_HANDLE)FfsFileHeader, SectionData); }
/** Worker function to execute a caller provided function on all enabled APs. @param[in] Procedure A pointer to the function to be run on enabled APs of the system. @param[in] MpEvent The Event used to sync the result. **/ VOID StartupAPsWorker ( IN EFI_AP_PROCEDURE Procedure, IN EFI_EVENT MpEvent ) { EFI_STATUS Status; EFI_PEI_MP_SERVICES_PPI *CpuMpPpi; CPU_FEATURES_DATA *CpuFeaturesData; CpuFeaturesData = GetCpuFeaturesData (); CpuMpPpi = CpuFeaturesData->MpService.Ppi; // // Wakeup all APs for data collection. // Status = CpuMpPpi->StartupAllAPs ( GetPeiServicesTablePointer (), CpuMpPpi, Procedure, FALSE, 0, CpuFeaturesData ); ASSERT_EFI_ERROR (Status); }
/** Support routine to get the Image read file function. @param ImageContext - The context of the image being loaded @retval EFI_SUCCESS - If Image function location is found **/ EFI_STATUS GetImageReadFunction ( IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext ) { PEI_CORE_INSTANCE *Private; VOID* MemoryBuffer; Private = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer ()); if (!Private->PeiMemoryInstalled || (Private->HobList.HandoffInformationTable->BootMode == BOOT_ON_S3_RESUME) || EFI_IMAGE_MACHINE_TYPE_SUPPORTED(EFI_IMAGE_MACHINE_IA64)) { ImageContext->ImageRead = PeiImageRead; } else { if (Private->ShadowedImageRead == NULL) { MemoryBuffer = AllocatePages (0x400 / EFI_PAGE_SIZE + 1); ASSERT (MemoryBuffer != NULL); CopyMem (MemoryBuffer, (CONST VOID *) (UINTN) PeiImageReadForShadow, 0x400); Private->ShadowedImageRead = (PE_COFF_LOADER_READ_FILE) (UINTN) MemoryBuffer; } ImageContext->ImageRead = Private->ShadowedImageRead; } return EFI_SUCCESS; }
EFI_STATUS EFIAPI PeiLibFfsFindFileByName ( IN EFI_GUID *FileName, IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle ) /*++ Routine Description: The wrapper of Pei Core Service function FfsFindFileByName. Arguments: FileName - File name to search. VolumeHandle - The current FV to search. FileHandle - Pointer to the file matching name in VolumeHandle. - NULL if file not found Returns: EFI_STATUS --*/ { EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer(); return (*PeiServices)->FfsFindFileByName (FileName, VolumeHandle, FileHandle); }
EFI_STATUS EFIAPI PeiLibFfsFindNextFile ( IN EFI_FV_FILETYPE SearchType, IN EFI_PEI_FV_HANDLE FvHandle, IN OUT EFI_PEI_FILE_HANDLE *FileHandle ) /*++ Routine Description: The wrapper of Pei Core Service function FfsFindNextFile. Arguments: SearchType - Filter to find only file of this type. FvHandle - Pointer to the current FV to search. FileHandle - Pointer to the file matching SearchType in FwVolHeader. - NULL if file not found Returns: EFI_STATUS --*/ { EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer(); return (*PeiServices)->FfsFindNextFile (PeiServices, SearchType, FvHandle, FileHandle); }
EFI_STATUS EFIAPI PeiLibFfsFindNextVolume ( IN UINTN Instance, IN OUT EFI_PEI_FV_HANDLE *VolumeHandle ) /*++ Routine Description: The wrapper of Pei Core Service function FfsFindNextVolume. Arguments: Instance - The Fv Volume Instance. VolumeHandle - Pointer to the current Fv Volume to search. Returns: EFI_STATUS --*/ { EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer(); return (*PeiServices)->FfsFindNextVolume (PeiServices, Instance, VolumeHandle); }
/** This service is a wrapper for the PEI Service RegisterForShadow(), except the pointer to the PEI Services Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface Specification for details. @param FileHandle PEIM's file handle. Must be the currently executing PEIM. @retval EFI_SUCCESS The PEIM was successfully registered for shadowing. @retval EFI_ALREADY_STARTED The PEIM was previously registered for shadowing. @retval EFI_NOT_FOUND The FileHandle does not refer to a valid file handle. **/ EFI_STATUS EFIAPI PeiServicesRegisterForShadow ( IN EFI_PEI_FILE_HANDLE FileHandle ) { return (*GetPeiServicesTablePointer())->RegisterForShadow (FileHandle); }
/** 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_STATUS EFIAPI MeasureFvImage ( 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 whether FV is in the measured FV list. // for (Index = 0; Index < mMeasuredFvIndex; Index ++) { if (mMeasuredFvInfo[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 (mMeasuredFvIndex < FixedPcdGet32 (PcdPeiCoreMaxFvSupported)); if (mMeasuredFvIndex < FixedPcdGet32 (PcdPeiCoreMaxFvSupported)) { mMeasuredFvInfo[mMeasuredFvIndex].BlobBase = FvBase; mMeasuredFvInfo[mMeasuredFvIndex++].BlobLength = FvLength; } return Status; }
/** This service is a wrapper for the PEI Service FfsGetFileInfo2(), except the pointer to the PEI Services Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface Specification for details. @param FileHandle The handle of the file. @param FileInfo Upon exit, points to the file's information. @retval EFI_SUCCESS File information returned. @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file. @retval EFI_INVALID_PARAMETER FileInfo is NULL. **/ EFI_STATUS EFIAPI PeiServicesFfsGetFileInfo2 ( IN CONST EFI_PEI_FILE_HANDLE FileHandle, OUT EFI_FV_FILE_INFO2 *FileInfo ) { return (*GetPeiServicesTablePointer())->FfsGetFileInfo2 (FileHandle, FileInfo); }
/** This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface Specification for details. @param VolumeHandle Handle of the volume. @param VolumeInfo Upon exit, points to the volume's information. @retval EFI_SUCCESS File information returned. @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file. @retval EFI_INVALID_PARAMETER If FileInfo is NULL. **/ EFI_STATUS EFIAPI PeiServicesFfsGetVolumeInfo ( IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_FV_INFO *VolumeInfo ) { return (*GetPeiServicesTablePointer())->FfsGetVolumeInfo (VolumeHandle, VolumeInfo); }
/** This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface Specification for details. @param FileName A pointer to the name of the file to find within the firmware volume. @param VolumeHandle The firmware volume to search FileHandle Upon exit, points to the found file's handle or NULL if it could not be found. @param FileHandle The pointer to found file handle @retval EFI_SUCCESS File was found. @retval EFI_NOT_FOUND File was not found. @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or FileName was NULL. **/ EFI_STATUS EFIAPI PeiServicesFfsFindFileByName ( IN CONST EFI_GUID *FileName, IN CONST EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle ) { return (*GetPeiServicesTablePointer())->FfsFindFileByName (FileName, VolumeHandle, FileHandle); }
/** Resets the entire platform. @retval EFI_SUCCESS The function completed successfully. @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet. **/ EFI_STATUS EFIAPI PeiServicesResetSystem ( VOID ) { CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->ResetSystem (PeiServices); }
/** This service enables a given PEIM to register an interface into the PEI Foundation. @param PpiList A pointer to the list of interfaces that the caller shall install. @retval EFI_SUCCESS The interface was successfully installed. @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL. @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field. @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database. **/ EFI_STATUS EFIAPI PeiServicesInstallPpi ( IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList ) { CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->InstallPpi (PeiServices, PpiList); }
/** This service enables a PEIM to ascertain the address of the list of HOBs in memory. @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize. @retval EFI_SUCCESS The list was successfully returned. @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published. **/ EFI_STATUS EFIAPI PeiServicesGetHobList ( OUT VOID **HobList ) { CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->GetHobList (PeiServices, HobList); }
/** This service enables PEIMs to register a given service to be invoked when another service is installed or reinstalled. @param NotifyList A pointer to the list of notification interfaces that the caller shall install. @retval EFI_SUCCESS The interface was successfully installed. @retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL. @retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do not have the EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field. @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database. **/ EFI_STATUS EFIAPI PeiServicesNotifyPpi ( IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList ) { CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->NotifyPpi (PeiServices, NotifyList); }
/** This service enables PEIMs to update the boot mode variable. @param BootMode The value of the boot mode to set. @retval EFI_SUCCESS The value was successfully updated **/ EFI_STATUS EFIAPI PeiServicesSetBootMode ( IN EFI_BOOT_MODE BootMode ) { CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->SetBootMode (PeiServices, BootMode); }
/** This service enables PEIMs to ascertain the present value of the boot mode. @param BootMode A pointer to contain the value of the boot mode. @retval EFI_SUCCESS The boot mode was returned successfully. @retval EFI_INVALID_PARAMETER BootMode is NULL. **/ EFI_STATUS EFIAPI PeiServicesGetBootMode ( IN OUT EFI_BOOT_MODE *BootMode ) { EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->GetBootMode (PeiServices, BootMode); }
/** This service enables PEIMs to replace an entry in the PPI database with an alternate entry. @param OldPpi The pointer to the old PEI PPI Descriptors. @param NewPpi The pointer to the new PEI PPI Descriptors. @retval EFI_SUCCESS The interface was successfully installed. @retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL. @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field. @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database. @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been installed. **/ EFI_STATUS EFIAPI PeiServicesReInstallPpi ( IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi, IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi ) { CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->ReInstallPpi (PeiServices, OldPpi, NewPpi); }
/** This service enables PEIMs to register the permanent memory configuration that has been initialized with the PEI Foundation. @param MemoryBegin The value of a region of installed memory. @param MemoryLength The corresponding length of a region of installed memory. @retval EFI_SUCCESS The region was successfully installed in a HOB. @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system. @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation. **/ EFI_STATUS EFIAPI PeiServicesInstallPeiMemory ( IN EFI_PHYSICAL_ADDRESS MemoryBegin, IN UINT64 MemoryLength ) { CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->InstallPeiMemory (PeiServices, MemoryBegin, MemoryLength); }
/** This service enables PEIMs to discover additional firmware volumes. @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware Volume (BFV). @param VolumeHandle Handle of the firmware volume header of the volume to return. @retval EFI_SUCCESS The volume was found. @retval EFI_NOT_FOUND The volume was not found. @retval EFI_INVALID_PARAMETER FwVolHeader is NULL. **/ EFI_STATUS EFIAPI PeiServicesFfsFindNextVolume ( IN UINTN Instance, IN OUT EFI_PEI_FV_HANDLE *VolumeHandle ) { CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->FfsFindNextVolume (PeiServices, Instance, VolumeHandle); }
/** This service allocates memory from the Hand-Off Block (HOB) heap. @param Size The number of bytes to allocate from the pool. @param Buffer If the call succeeds, a pointer to a pointer to the allocate buffer; otherwise, undefined. @retval EFI_SUCCESS The allocation was successful @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size. **/ EFI_STATUS EFIAPI PeiServicesAllocatePool ( IN UINTN Size, OUT VOID **Buffer ) { CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->AllocatePool (PeiServices, Size, Buffer); }