当前位置: 首页>>代码示例>>C++>>正文


C++ GetPeiServicesTablePointer函数代码示例

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


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

示例1: GetImageReadFunction

/**

  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;
}
开发者ID:B-Rich,项目名称:edk2,代码行数:39,代码来源:Image.c

示例2: PeiPciLibPciCfg2ReadWorker

/**
  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;
}
开发者ID:hsienchieh,项目名称:uefilab,代码行数:40,代码来源:PciLib.c

示例3: PeiServicesLocatePpi

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);
}
开发者ID:Kohrara,项目名称:edk,代码行数:33,代码来源:PeiLib.c

示例4: PeiFspInit

/**
  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 ();
}
开发者ID:FishYu1222,项目名称:edk2,代码行数:65,代码来源:FspInitPeiV1.c

示例5: SwitchNewBsp

/**
  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);
}
开发者ID:b-man,项目名称:edk2,代码行数:35,代码来源:PeiRegisterCpuFeaturesLib.c

示例6: GetNumberOfProcessor

/**
  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);
}
开发者ID:b-man,项目名称:edk2,代码行数:41,代码来源:PeiRegisterCpuFeaturesLib.c

示例7: StartupAPsWorker

/**
  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);
}
开发者ID:b-man,项目名称:edk2,代码行数:38,代码来源:PeiRegisterCpuFeaturesLib.c

示例8: PeiLibFfsGetVolumeInfo

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);
}
开发者ID:Kohrara,项目名称:edk,代码行数:26,代码来源:PeiLib.c

示例9: AgesaReadSpd

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;

}
开发者ID:fishbaoz,项目名称:CarrizoPI,代码行数:28,代码来源:AgesaCallOutPei.c

示例10: PeiLibFfsFindSectionData

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);
}
开发者ID:Kohrara,项目名称:edk,代码行数:29,代码来源:PeiLib.c

示例11: StartupAPsWorker

/**
  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);
}
开发者ID:shijunjing,项目名称:edk2,代码行数:34,代码来源:PeiRegisterCpuFeaturesLib.c

示例12: PeiLibFfsFindFileByName

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);
}
开发者ID:Kohrara,项目名称:edk,代码行数:30,代码来源:PeiLib.c

示例13: PeiLibFfsFindNextFile

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);
}
开发者ID:Kohrara,项目名称:edk,代码行数:30,代码来源:PeiLib.c

示例14: PeiLibFfsFindNextVolume

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);
}
开发者ID:Kohrara,项目名称:edk,代码行数:28,代码来源:PeiLib.c

示例15: RegisterForShadow

/**
  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);
}
开发者ID:EvanLloyd,项目名称:tianocore,代码行数:25,代码来源:PeiServicesLib.c


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