]>
Commit | Line | Data |
---|---|---|
3e8ad6bd JF |
1 | /** @file\r |
2 | Common header file for MP Initialize Library.\r | |
3 | \r | |
4 | Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _MP_LIB_H_\r | |
16 | #define _MP_LIB_H_\r | |
17 | \r | |
18 | #include <PiPei.h>\r | |
19 | \r | |
20 | #include <Register/Cpuid.h>\r | |
21 | #include <Register/Msr.h>\r | |
22 | #include <Register/LocalApic.h>\r | |
23 | #include <Register/Microcode.h>\r | |
24 | \r | |
25 | #include <Library/MpInitLib.h>\r | |
26 | #include <Library/BaseLib.h>\r | |
27 | #include <Library/BaseMemoryLib.h>\r | |
28 | #include <Library/MemoryAllocationLib.h>\r | |
29 | #include <Library/DebugLib.h>\r | |
30 | #include <Library/LocalApicLib.h>\r | |
31 | #include <Library/CpuLib.h>\r | |
32 | #include <Library/UefiCpuLib.h>\r | |
33 | #include <Library/TimerLib.h>\r | |
34 | #include <Library/SynchronizationLib.h>\r | |
35 | #include <Library/MtrrLib.h>\r | |
36 | #include <Library/HobLib.h>\r | |
37 | \r | |
f7f85d83 JF |
38 | //\r |
39 | // AP reset code information including code address and size,\r | |
40 | // this structure will be shared be C code and assembly code.\r | |
41 | // It is natural aligned by design.\r | |
42 | //\r | |
43 | typedef struct {\r | |
44 | UINT8 *RendezvousFunnelAddress;\r | |
45 | UINTN ModeEntryOffset;\r | |
46 | UINTN RendezvousFunnelSize;\r | |
47 | UINT8 *RelocateApLoopFuncAddress;\r | |
48 | UINTN RelocateApLoopFuncSize;\r | |
49 | } MP_ASSEMBLY_ADDRESS_MAP;\r | |
3e8ad6bd | 50 | \r |
d94e5f67 JF |
51 | #pragma pack(1)\r |
52 | \r | |
53 | //\r | |
54 | // MP CPU exchange information for AP reset code\r | |
55 | // This structure is required to be packed because fixed field offsets\r | |
56 | // into this structure are used in assembly code in this module\r | |
57 | //\r | |
58 | typedef struct {\r | |
59 | UINTN Lock;\r | |
60 | UINTN StackStart;\r | |
61 | UINTN StackSize;\r | |
62 | UINTN CFunction;\r | |
63 | IA32_DESCRIPTOR GdtrProfile;\r | |
64 | IA32_DESCRIPTOR IdtrProfile;\r | |
65 | UINTN BufferStart;\r | |
66 | UINTN ModeOffset;\r | |
67 | UINTN NumApsExecuting;\r | |
68 | UINTN CodeSegment;\r | |
69 | UINTN DataSegment;\r | |
5c66d125 | 70 | UINTN EnableExecuteDisable;\r |
d94e5f67 | 71 | UINTN Cr3;\r |
d94e5f67 JF |
72 | } MP_CPU_EXCHANGE_INFO;\r |
73 | \r | |
74 | #pragma pack()\r | |
76157021 JF |
75 | /**\r |
76 | Assembly code to place AP into safe loop mode.\r | |
77 | \r | |
78 | Place AP into targeted C-State if MONITOR is supported, otherwise\r | |
79 | place AP into hlt state.\r | |
80 | Place AP in protected mode if the current is long mode. Due to AP maybe\r | |
81 | wakeup by some hardware event. It could avoid accessing page table that\r | |
82 | may not available during booting to OS.\r | |
83 | \r | |
84 | @param[in] MwaitSupport TRUE indicates MONITOR is supported.\r | |
85 | FALSE indicates MONITOR is not supported.\r | |
86 | @param[in] ApTargetCState Target C-State value.\r | |
87 | @param[in] PmCodeSegment Protected mode code segment value.\r | |
88 | **/\r | |
89 | typedef\r | |
90 | VOID\r | |
91 | (EFIAPI * ASM_RELOCATE_AP_LOOP) (\r | |
92 | IN BOOLEAN MwaitSupport,\r | |
93 | IN UINTN ApTargetCState,\r | |
94 | IN UINTN PmCodeSegment\r | |
95 | );\r | |
f7f85d83 JF |
96 | \r |
97 | /**\r | |
98 | Assembly code to get starting address and size of the rendezvous entry for APs.\r | |
99 | Information for fixing a jump instruction in the code is also returned.\r | |
100 | \r | |
101 | @param[out] AddressMap Output buffer for address map information.\r | |
102 | **/\r | |
103 | VOID\r | |
104 | EFIAPI\r | |
105 | AsmGetAddressMap (\r | |
106 | OUT MP_ASSEMBLY_ADDRESS_MAP *AddressMap\r | |
107 | );\r | |
108 | \r | |
3e8ad6bd JF |
109 | #endif\r |
110 | \r |