]>
Commit | Line | Data |
---|---|---|
65e79f93 JF |
1 | /** @file |
2 | Definitions to install Multiple Processor PPI. | |
3 | ||
4 | Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> | |
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 _CPU_MP_PEI_H_ | |
16 | #define _CPU_MP_PEI_H_ | |
17 | ||
18 | #include <PiPei.h> | |
19 | ||
e66d675d | 20 | #include <Ppi/SecPlatformInformation.h> |
65e79f93 JF |
21 | |
22 | #include <Library/BaseLib.h> | |
e66d675d JF |
23 | #include <Library/BaseMemoryLib.h> |
24 | #include <Library/DebugLib.h> | |
05e107f8 | 25 | #include <Library/HobLib.h> |
e66d675d JF |
26 | #include <Library/LocalApicLib.h> |
27 | #include <Library/PcdLib.h> | |
65e79f93 | 28 | #include <Library/PeimEntryPoint.h> |
e66d675d | 29 | #include <Library/PeiServicesLib.h> |
46ba0f63 | 30 | #include <Library/UefiCpuLib.h> |
e66d675d JF |
31 | // |
32 | // AP state | |
33 | // | |
34 | typedef enum { | |
35 | CpuStateIdle, | |
36 | CpuStateBusy, | |
37 | CpuStateDisabled | |
38 | } CPU_STATE; | |
65e79f93 | 39 | |
8018cb15 JF |
40 | // |
41 | // AP reset code information | |
42 | // | |
43 | typedef struct { | |
44 | UINT8 *RendezvousFunnelAddress; | |
45 | UINTN PModeEntryOffset; | |
46 | UINTN LModeEntryOffset; | |
47 | UINTN RendezvousFunnelSize; | |
48 | } MP_ASSEMBLY_ADDRESS_MAP; | |
49 | ||
e66d675d JF |
50 | typedef struct _PEI_CPU_MP_DATA PEI_CPU_MP_DATA; |
51 | ||
52 | #pragma pack() | |
a56f6f45 | 53 | |
f9d30595 JF |
54 | typedef union { |
55 | struct { | |
56 | UINT32 LimitLow : 16; | |
57 | UINT32 BaseLow : 16; | |
58 | UINT32 BaseMid : 8; | |
59 | UINT32 Type : 4; | |
60 | UINT32 System : 1; | |
61 | UINT32 Dpl : 2; | |
62 | UINT32 Present : 1; | |
63 | UINT32 LimitHigh : 4; | |
64 | UINT32 Software : 1; | |
65 | UINT32 Reserved : 1; | |
66 | UINT32 DefaultSize : 1; | |
67 | UINT32 Granularity : 1; | |
68 | UINT32 BaseHigh : 8; | |
69 | } Bits; | |
70 | UINT64 Uint64; | |
71 | } IA32_GDT; | |
a56f6f45 JF |
72 | |
73 | // | |
74 | // MP CPU exchange information for AP reset code | |
75 | // | |
76 | typedef struct { | |
77 | UINTN Lock; | |
78 | UINTN StackStart; | |
79 | UINTN StackSize; | |
80 | UINTN CFunction; | |
81 | IA32_DESCRIPTOR GdtrProfile; | |
82 | IA32_DESCRIPTOR IdtrProfile; | |
83 | UINTN BufferStart; | |
84 | UINTN PmodeOffset; | |
85 | UINTN NumApsExecuting; | |
86 | UINTN LmodeOffset; | |
87 | UINTN Cr3; | |
88 | } MP_CPU_EXCHANGE_INFO; | |
89 | ||
f9d30595 | 90 | #pragma pack() |
8018cb15 | 91 | |
e66d675d JF |
92 | typedef struct { |
93 | UINT32 ApicId; | |
94 | EFI_HEALTH_FLAGS Health; | |
95 | CPU_STATE State; | |
96 | BOOLEAN CpuHealthy; | |
97 | } PEI_CPU_DATA; | |
98 | ||
99 | // | |
100 | // PEI CPU MP Data save in memory | |
101 | // | |
102 | struct _PEI_CPU_MP_DATA { | |
103 | UINT32 CpuCount; | |
104 | UINT32 BspNumber; | |
105 | UINTN Buffer; | |
106 | UINTN CpuApStackSize; | |
107 | MP_ASSEMBLY_ADDRESS_MAP AddressMap; | |
108 | UINTN WakeupBuffer; | |
109 | UINTN BackupBuffer; | |
110 | UINTN BackupBufferSize; | |
111 | PEI_CPU_DATA *CpuData; | |
112 | volatile MP_CPU_EXCHANGE_INFO *MpCpuExchangeInfo; | |
113 | }; | |
114 | ||
8018cb15 JF |
115 | /** |
116 | Assembly code to get starting address and size of the rendezvous entry for APs. | |
117 | Information for fixing a jump instruction in the code is also returned. | |
118 | ||
119 | @param AddressMap Output buffer for address map information. | |
120 | **/ | |
121 | VOID | |
122 | EFIAPI | |
123 | AsmGetAddressMap ( | |
124 | OUT MP_ASSEMBLY_ADDRESS_MAP *AddressMap | |
125 | ); | |
126 | ||
f9d30595 JF |
127 | /** |
128 | Assembly code to load GDT table and update segment accordingly. | |
129 | ||
130 | @param Gdtr Pointer to GDT descriptor | |
131 | **/ | |
132 | VOID | |
133 | EFIAPI | |
134 | AsmInitializeGdt ( | |
135 | IN IA32_DESCRIPTOR *Gdtr | |
136 | ); | |
65e79f93 JF |
137 | |
138 | ||
139 | #endif |