1 /** @file 2 * 3 * Copyright (c) 2011-2013, ARM Limited. All rights reserved. 4 * 5 * This program and the accompanying materials 6 * are licensed and made available under the terms and conditions of the BSD License 7 * which accompanies this distribution. The full text of the license may be found at 8 * http://opensource.org/licenses/bsd-license.php 9 * 10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 * 13 **/ 14 15 #ifndef _ARMPLATFORMLIB_H_ 16 #define _ARMPLATFORMLIB_H_ 17 18 // 19 // The package level header files this module uses 20 // 21 #include <PiPei.h> 22 // 23 // The protocols, PPI and GUID defintions for this module 24 // 25 #include <Ppi/MasterBootMode.h> 26 #include <Ppi/BootInRecoveryMode.h> 27 28 #include <Library/ArmLib.h> 29 30 /** 31 This structure is used to describe a region of the EFI memory map 32 33 Every EFI regions of the system memory described by their physical start address and their size 34 can have different attributes. Some regions can be tested and other untested. 35 36 **/ 37 typedef struct { 38 EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute; 39 EFI_PHYSICAL_ADDRESS PhysicalStart; 40 UINT64 NumberOfBytes; 41 } ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR; 42 43 /** 44 Return the core per cluster. The method may differ per core type 45 46 This function might be called from assembler before any stack is set. 47 48 @return Return the core count per cluster 49 50 **/ 51 UINTN 52 ArmGetCpuCountPerCluster ( 53 VOID 54 ); 55 56 /** 57 Return the core position from the value of its MpId register 58 59 This function returns the core position from the position 0 in the processor. 60 This function might be called from assembler before any stack is set. 61 62 @return Return the core position 63 64 **/ 65 UINTN 66 ArmPlatformGetCorePosition ( 67 IN UINTN MpId 68 ); 69 70 /** 71 Return a non-zero value if the callee is the primary core 72 73 This function returns a non-zero value if the callee is the primary core. 74 The primary core is the core responsible to initialize the hardware and run UEFI. 75 This function might be called from assembler before any stack is set. 76 77 @return Return a non-zero value if the callee is the primary core. 78 79 **/ 80 UINTN 81 ArmPlatformIsPrimaryCore ( 82 IN UINTN MpId 83 ); 84 85 /** 86 Return the MpId of the primary core 87 88 This function returns the MpId of the primary core. 89 This function might be called from assembler before any stack is set. 90 91 @return Return the MpId of the primary core 92 93 **/ 94 UINTN 95 ArmPlatformGetPrimaryCoreMpId ( 96 VOID 97 ); 98 99 /** 100 Return the current Boot Mode 101 102 This function returns the boot reason on the platform 103 104 @return Return the current Boot Mode of the platform 105 106 **/ 107 EFI_BOOT_MODE 108 ArmPlatformGetBootMode ( 109 VOID 110 ); 111 112 /** 113 First platform specific function to be called in the PEI phase 114 115 This function is actually the first function called by the PrePi 116 or PrePeiCore modules. It allows to retrieve arguments passed to 117 the UEFI firmware through the CPU registers. 118 119 This function might be written into assembler as no stack are set 120 when the function is invoked. 121 122 **/ 123 VOID 124 ArmPlatformPeiBootAction ( 125 VOID 126 ); 127 128 /** 129 Initialize controllers that must setup in the normal world 130 131 This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei 132 in the PEI phase. 133 134 **/ 135 RETURN_STATUS 136 ArmPlatformInitialize ( 137 IN UINTN MpId 138 ); 139 140 /** 141 Initialize the system (or sometimes called permanent) memory 142 143 This memory is generally represented by the DRAM. 144 145 **/ 146 VOID 147 ArmPlatformInitializeSystemMemory ( 148 VOID 149 ); 150 151 /** 152 Return the Virtual Memory Map of your platform 153 154 This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform. 155 156 @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to- 157 Virtual Memory mapping. This array must be ended by a zero-filled 158 entry 159 160 **/ 161 VOID 162 ArmPlatformGetVirtualMemoryMap ( 163 OUT ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap 164 ); 165 166 /** 167 Return the Platform specific PPIs 168 169 This function exposes the Platform Specific PPIs. They can be used by any PrePi modules or passed 170 to the PeiCore by PrePeiCore. 171 172 @param[out] PpiListSize Size in Bytes of the Platform PPI List 173 @param[out] PpiList Platform PPI List 174 175 **/ 176 VOID 177 ArmPlatformGetPlatformPpiList ( 178 OUT UINTN *PpiListSize, 179 OUT EFI_PEI_PPI_DESCRIPTOR **PpiList 180 ); 181 182 #endif 183