ThunkPpiToProtocolPei.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*++ @file
  2. UEFI/PI PEIM to abstract construction of firmware volume in a Unix environment.
  3. Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
  4. Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #include <PiPei.h>
  8. #include <Library/DebugLib.h>
  9. #include <Library/PeimEntryPoint.h>
  10. #include <Library/HobLib.h>
  11. #include <Library/PeiServicesLib.h>
  12. #include <Library/PeiServicesTablePointerLib.h>
  13. #include <Ppi/EmuThunk.h>
  14. #include <Protocol/EmuThunk.h>
  15. EFI_STATUS
  16. EFIAPI
  17. PeiInitialzeThunkPpiToProtocolPei (
  18. IN EFI_PEI_FILE_HANDLE FileHandle,
  19. IN CONST EFI_PEI_SERVICES **PeiServices
  20. )
  21. /*++
  22. Routine Description:
  23. Perform a call-back into the SEC simulator to get Unix Stuff
  24. Arguments:
  25. PeiServices - General purpose services available to every PEIM.
  26. Returns:
  27. None
  28. **/
  29. {
  30. EFI_STATUS Status;
  31. EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
  32. EMU_THUNK_PPI *Thunk;
  33. VOID *Ptr;
  34. DEBUG ((DEBUG_ERROR, "Emu Thunk PEIM Loaded\n"));
  35. Status = PeiServicesLocatePpi (
  36. &gEmuThunkPpiGuid, // GUID
  37. 0, // INSTANCE
  38. &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
  39. (VOID **)&Thunk // PPI
  40. );
  41. ASSERT_EFI_ERROR (Status);
  42. Ptr = Thunk->Thunk ();
  43. BuildGuidDataHob (
  44. &gEmuThunkProtocolGuid, // Guid
  45. &Ptr, // Buffer
  46. sizeof (VOID *) // Sizeof Buffer
  47. );
  48. return Status;
  49. }