MainUniCore.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /** @file
  2. *
  3. * Copyright (c) 2011-2012, ARM Limited. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause-Patent
  6. *
  7. **/
  8. #include "PrePeiCore.h"
  9. VOID
  10. EFIAPI
  11. SecondaryMain (
  12. IN UINTN MpId
  13. )
  14. {
  15. ASSERT(FALSE);
  16. }
  17. VOID
  18. EFIAPI
  19. PrimaryMain (
  20. IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint
  21. )
  22. {
  23. EFI_SEC_PEI_HAND_OFF SecCoreData;
  24. UINTN PpiListSize;
  25. EFI_PEI_PPI_DESCRIPTOR *PpiList;
  26. UINTN TemporaryRamBase;
  27. UINTN TemporaryRamSize;
  28. CreatePpiList (&PpiListSize, &PpiList);
  29. // Adjust the Temporary Ram as the new Ppi List (Common + Platform Ppi Lists) is created at
  30. // the base of the primary core stack
  31. PpiListSize = ALIGN_VALUE(PpiListSize, CPU_STACK_ALIGNMENT);
  32. TemporaryRamBase = (UINTN)PcdGet64 (PcdCPUCoresStackBase) + PpiListSize;
  33. TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize;
  34. //
  35. // Bind this information into the SEC hand-off state
  36. // Note: this must be in sync with the stuff in the asm file
  37. // Note also: HOBs (pei temp ram) MUST be above stack
  38. //
  39. SecCoreData.DataSize = sizeof(EFI_SEC_PEI_HAND_OFF);
  40. SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet64 (PcdFvBaseAddress);
  41. SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize);
  42. SecCoreData.TemporaryRamBase = (VOID *)TemporaryRamBase; // We run on the primary core (and so we use the first stack)
  43. SecCoreData.TemporaryRamSize = TemporaryRamSize;
  44. SecCoreData.PeiTemporaryRamBase = SecCoreData.TemporaryRamBase;
  45. SecCoreData.PeiTemporaryRamSize = ALIGN_VALUE (SecCoreData.TemporaryRamSize / 2, CPU_STACK_ALIGNMENT);
  46. SecCoreData.StackBase = (VOID *)((UINTN)SecCoreData.TemporaryRamBase + SecCoreData.PeiTemporaryRamSize);
  47. SecCoreData.StackSize = (TemporaryRamBase + TemporaryRamSize) - (UINTN)SecCoreData.StackBase;
  48. // Jump to PEI core entry point
  49. (PeiCoreEntryPoint)(&SecCoreData, PpiList);
  50. }