Styx.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /** @file
  2. *
  3. * Copyright (c) 2011-2013, ARM Limited. All rights reserved.<BR>
  4. * Copyright (c) 2014 - 2016, AMD Inc. All rights reserved.<BR>
  5. *
  6. * This program and the accompanying materials
  7. * are licensed and made available under the terms and conditions of the BSD License
  8. * which accompanies this distribution. The full text of the license may be found at
  9. * http://opensource.org/licenses/bsd-license.php
  10. *
  11. * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  13. *
  14. **/
  15. /**
  16. Derived from:
  17. ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSM.c
  18. **/
  19. //
  20. // The package level header files this module uses
  21. //
  22. #include <PiPei.h>
  23. //
  24. // The protocols, PPI and GUID defintions for this module
  25. //
  26. #include <Ppi/ArmMpCoreInfo.h>
  27. #include <Guid/ArmMpCoreInfo.h>
  28. //
  29. // The Library classes this module consumes
  30. //
  31. #include <Library/PeimEntryPoint.h>
  32. #include <Library/PeiServicesLib.h>
  33. #include <Library/DebugLib.h>
  34. #include <Library/PcdLib.h>
  35. #include <Library/HobLib.h>
  36. #include <Library/ArmLib.h>
  37. #include <Library/ArmPlatformLib.h>
  38. #include <Library/BaseMemoryLib.h>
  39. extern EFI_GUID gAmdStyxMpCoreInfoGuid;
  40. UINTN
  41. ArmGetCpuCountPerCluster (
  42. VOID
  43. );
  44. /**
  45. Return the current Boot Mode
  46. This function returns the boot reason on the platform
  47. @return Return the current Boot Mode of the platform
  48. **/
  49. EFI_BOOT_MODE
  50. ArmPlatformGetBootMode (
  51. VOID
  52. )
  53. {
  54. return BOOT_WITH_FULL_CONFIGURATION;
  55. }
  56. /**
  57. Initialize controllers that must setup in the normal world
  58. This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
  59. in the PEI phase.
  60. **/
  61. RETURN_STATUS
  62. ArmPlatformInitialize (
  63. IN UINTN MpId
  64. )
  65. {
  66. if (!ArmPlatformIsPrimaryCore (MpId)) {
  67. return RETURN_SUCCESS;
  68. }
  69. // XXX Place holder XXX ...
  70. return RETURN_SUCCESS;
  71. }
  72. /**
  73. Initialize the system (or sometimes called permanent) memory
  74. This memory is generally represented by the DRAM.
  75. **/
  76. VOID
  77. ArmPlatformInitializeSystemMemory (
  78. VOID
  79. )
  80. {
  81. // Nothing to do here
  82. }
  83. //
  84. // Return list of cores in the system
  85. //
  86. EFI_STATUS
  87. PrePeiCoreGetMpCoreInfo (
  88. OUT UINTN *ArmCoreCount,
  89. OUT ARM_CORE_INFO **ArmCoreInfoTable
  90. )
  91. {
  92. EFI_PEI_HOB_POINTERS Hob;
  93. if (ArmIsMpCore()) {
  94. // Iterate through the HOBs and find if there is ARM PROCESSOR ENTRY HOB
  95. for (Hob.Raw = GetHobList (); !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
  96. // Check for Correct HOB type
  97. if ((GET_HOB_TYPE (Hob)) == EFI_HOB_TYPE_GUID_EXTENSION) {
  98. // Check for correct GUID type
  99. if (CompareGuid(&(Hob.Guid->Name), &gAmdStyxMpCoreInfoGuid)) {
  100. *ArmCoreInfoTable = (ARM_CORE_INFO *) GET_GUID_HOB_DATA(Hob);
  101. *ArmCoreCount = GET_GUID_HOB_DATA_SIZE(Hob)/sizeof(ARM_CORE_INFO);
  102. return EFI_SUCCESS;
  103. }
  104. }
  105. }
  106. }
  107. return EFI_UNSUPPORTED;
  108. }
  109. ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };
  110. EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
  111. {
  112. EFI_PEI_PPI_DESCRIPTOR_PPI,
  113. &gArmMpCoreInfoPpiGuid,
  114. &mMpCoreInfoPpi
  115. }
  116. };
  117. VOID
  118. ArmPlatformGetPlatformPpiList (
  119. OUT UINTN *PpiListSize,
  120. OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
  121. )
  122. {
  123. if (ArmIsMpCore()) {
  124. *PpiListSize = sizeof(gPlatformPpiTable);
  125. *PpiList = gPlatformPpiTable;
  126. } else {
  127. *PpiListSize = 0;
  128. *PpiList = NULL;
  129. }
  130. }