]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/Library/MpInitLib/MpLib.h
UefiCpuPkg/MpInitLib: Get ApLoopMode and MointorFilter size
[mirror_edk2.git] / UefiCpuPkg / Library / MpInitLib / MpLib.h
CommitLineData
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
9ebcf0f4
JF
38//\r
39// AP loop state when APs are in idle state\r
40// It's value is the same with PcdCpuApLoopMode\r
41//\r
42typedef enum {\r
43 ApInHltLoop = 1,\r
44 ApInMwaitLoop = 2,\r
45 ApInRunLoop = 3\r
46} AP_LOOP_MODE;\r
47\r
f7f85d83
JF
48//\r
49// AP reset code information including code address and size,\r
50// this structure will be shared be C code and assembly code.\r
51// It is natural aligned by design.\r
52//\r
53typedef struct {\r
54 UINT8 *RendezvousFunnelAddress;\r
55 UINTN ModeEntryOffset;\r
56 UINTN RendezvousFunnelSize;\r
57 UINT8 *RelocateApLoopFuncAddress;\r
58 UINTN RelocateApLoopFuncSize;\r
59} MP_ASSEMBLY_ADDRESS_MAP;\r
3e8ad6bd 60\r
d94e5f67
JF
61#pragma pack(1)\r
62\r
63//\r
64// MP CPU exchange information for AP reset code\r
65// This structure is required to be packed because fixed field offsets\r
66// into this structure are used in assembly code in this module\r
67//\r
68typedef struct {\r
69 UINTN Lock;\r
70 UINTN StackStart;\r
71 UINTN StackSize;\r
72 UINTN CFunction;\r
73 IA32_DESCRIPTOR GdtrProfile;\r
74 IA32_DESCRIPTOR IdtrProfile;\r
75 UINTN BufferStart;\r
76 UINTN ModeOffset;\r
77 UINTN NumApsExecuting;\r
78 UINTN CodeSegment;\r
79 UINTN DataSegment;\r
5c66d125 80 UINTN EnableExecuteDisable;\r
d94e5f67 81 UINTN Cr3;\r
d94e5f67
JF
82} MP_CPU_EXCHANGE_INFO;\r
83\r
84#pragma pack()\r
76157021
JF
85/**\r
86 Assembly code to place AP into safe loop mode.\r
87\r
88 Place AP into targeted C-State if MONITOR is supported, otherwise\r
89 place AP into hlt state.\r
90 Place AP in protected mode if the current is long mode. Due to AP maybe\r
91 wakeup by some hardware event. It could avoid accessing page table that\r
92 may not available during booting to OS.\r
93\r
94 @param[in] MwaitSupport TRUE indicates MONITOR is supported.\r
95 FALSE indicates MONITOR is not supported.\r
96 @param[in] ApTargetCState Target C-State value.\r
97 @param[in] PmCodeSegment Protected mode code segment value.\r
98**/\r
99typedef\r
100VOID\r
101(EFIAPI * ASM_RELOCATE_AP_LOOP) (\r
102 IN BOOLEAN MwaitSupport,\r
103 IN UINTN ApTargetCState,\r
104 IN UINTN PmCodeSegment\r
105 );\r
f7f85d83
JF
106\r
107/**\r
108 Assembly code to get starting address and size of the rendezvous entry for APs.\r
109 Information for fixing a jump instruction in the code is also returned.\r
110\r
111 @param[out] AddressMap Output buffer for address map information.\r
112**/\r
113VOID\r
114EFIAPI\r
115AsmGetAddressMap (\r
116 OUT MP_ASSEMBLY_ADDRESS_MAP *AddressMap\r
117 );\r
118\r
3e8ad6bd
JF
119#endif\r
120\r