MainUniCore.c 2.0 KB

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