77561a3d05b3dcdafd2e8a27b6cdb87ec057afbf
[mirror_edk2.git] / ArmPlatformPkg / Include / Library / ArmPlatformLib.h
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 position from the value of its MpId register
45
46 This function returns the core position from the position 0 in the processor.
47 This function might be called from assembler before any stack is set.
48
49 @return Return the core position
50
51 **/
52 UINTN
53 ArmPlatformGetCorePosition (
54 IN UINTN MpId
55 );
56
57 /**
58 Return a non-zero value if the callee is the primary core
59
60 This function returns a non-zero value if the callee is the primary core.
61 The primary core is the core responsible to initialize the hardware and run UEFI.
62 This function might be called from assembler before any stack is set.
63
64 @return Return a non-zero value if the callee is the primary core.
65
66 **/
67 UINTN
68 ArmPlatformIsPrimaryCore (
69 IN UINTN MpId
70 );
71
72 /**
73 Return the MpId of the primary core
74
75 This function returns the MpId of the primary core.
76 This function might be called from assembler before any stack is set.
77
78 @return Return the MpId of the primary core
79
80 **/
81 UINTN
82 ArmPlatformGetPrimaryCoreMpId (
83 VOID
84 );
85
86 /**
87 Return the current Boot Mode
88
89 This function returns the boot reason on the platform
90
91 @return Return the current Boot Mode of the platform
92
93 **/
94 EFI_BOOT_MODE
95 ArmPlatformGetBootMode (
96 VOID
97 );
98
99 /**
100 First platform specific function to be called in the PEI phase
101
102 This function is actually the first function called by the PrePi
103 or PrePeiCore modules. It allows to retrieve arguments passed to
104 the UEFI firmware through the CPU registers.
105
106 This function might be written into assembler as no stack are set
107 when the function is invoked.
108
109 **/
110 VOID
111 ArmPlatformPeiBootAction (
112 VOID
113 );
114
115 /**
116 Initialize controllers that must setup in the normal world
117
118 This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei
119 in the PEI phase.
120
121 **/
122 RETURN_STATUS
123 ArmPlatformInitialize (
124 IN UINTN MpId
125 );
126
127 /**
128 Initialize the system (or sometimes called permanent) memory
129
130 This memory is generally represented by the DRAM.
131
132 **/
133 VOID
134 ArmPlatformInitializeSystemMemory (
135 VOID
136 );
137
138 /**
139 Return the Virtual Memory Map of your platform
140
141 This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform.
142
143 @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to-
144 Virtual Memory mapping. This array must be ended by a zero-filled
145 entry
146
147 **/
148 VOID
149 ArmPlatformGetVirtualMemoryMap (
150 OUT ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
151 );
152
153 /**
154 Return the Platform specific PPIs
155
156 This function exposes the Platform Specific PPIs. They can be used by any PrePi modules or passed
157 to the PeiCore by PrePeiCore.
158
159 @param[out] PpiListSize Size in Bytes of the Platform PPI List
160 @param[out] PpiList Platform PPI List
161
162 **/
163 VOID
164 ArmPlatformGetPlatformPpiList (
165 OUT UINTN *PpiListSize,
166 OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
167 );
168
169 #endif