]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.h
UefiCpuPkg/PiSmmCpuDxeSmm: patch "gSmiCr3" with PatchInstructionX86()
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / CpuService.h
CommitLineData
529a5a86
MK
1/** @file\r
2Include file for SMM CPU Services protocol implementation.\r
3\r
4Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _CPU_SERVICE_H_\r
16#define _CPU_SERVICE_H_\r
17\r
18typedef enum {\r
19 SmmCpuNone,\r
20 SmmCpuAdd,\r
21 SmmCpuRemove,\r
22 SmmCpuSwitchBsp\r
23} SMM_CPU_OPERATION;\r
24\r
25//\r
26// SMM CPU Service Protocol function prototypes.\r
27//\r
28\r
29/**\r
30 Gets processor information on the requested processor at the instant this call is made.\r
31\r
32 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.\r
33 @param[in] ProcessorNumber The handle number of processor.\r
34 @param[out] ProcessorInfoBuffer A pointer to the buffer where information for\r
35 the requested processor is deposited.\r
36\r
37 @retval EFI_SUCCESS Processor information was returned.\r
38 @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.\r
39 @retval EFI_INVALID_PARAMETER ProcessorNumber is invalid.\r
40 @retval EFI_NOT_FOUND The processor with the handle specified by\r
41 ProcessorNumber does not exist in the platform.\r
42\r
43**/\r
44EFI_STATUS\r
45EFIAPI\r
46SmmGetProcessorInfo (\r
47 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
48 IN UINTN ProcessorNumber,\r
49 OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer\r
50 );\r
51\r
52/**\r
53 This service switches the requested AP to be the BSP since the next SMI.\r
54\r
55 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.\r
56 @param[in] ProcessorNumber The handle number of AP that is to become the new BSP.\r
57\r
58 @retval EFI_SUCCESS BSP will be switched in next SMI.\r
59 @retval EFI_UNSUPPORTED Switching the BSP or a processor to be hot-removed is not supported.\r
60 @retval EFI_NOT_FOUND The processor with the handle specified by ProcessorNumber does not exist.\r
61 @retval EFI_INVALID_PARAMETER ProcessorNumber is invalid.\r
62**/\r
63EFI_STATUS\r
64EFIAPI\r
65SmmSwitchBsp (\r
66 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
67 IN UINTN ProcessorNumber\r
68 );\r
69\r
70/**\r
71 Notify that a processor was hot-added.\r
72\r
73 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.\r
74 @param[in] ProcessorId Local APIC ID of the hot-added processor.\r
75 @param[out] ProcessorNumber The handle number of the hot-added processor.\r
76\r
77 @retval EFI_SUCCESS The hot-addition of the specified processors was successfully notified.\r
78 @retval EFI_UNSUPPORTED Hot addition of processor is not supported.\r
79 @retval EFI_NOT_FOUND The processor with the handle specified by ProcessorNumber does not exist.\r
80 @retval EFI_INVALID_PARAMETER ProcessorNumber is invalid.\r
81 @retval EFI_ALREADY_STARTED The processor is already online in the system.\r
82**/\r
83EFI_STATUS\r
84EFIAPI\r
85SmmAddProcessor (\r
86 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
87 IN UINT64 ProcessorId,\r
88 OUT UINTN *ProcessorNumber\r
89 );\r
90\r
91/**\r
92 Notify that a processor was hot-removed.\r
93\r
94 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.\r
95 @param[in] ProcessorNumber The handle number of the hot-added processor.\r
96\r
97 @retval EFI_SUCCESS The hot-removal of the specified processors was successfully notified.\r
98 @retval EFI_UNSUPPORTED Hot removal of processor is not supported.\r
99 @retval EFI_UNSUPPORTED Hot removal of BSP is not supported.\r
100 @retval EFI_UNSUPPORTED Hot removal of a processor with pending hot-plug operation is not supported.\r
101 @retval EFI_INVALID_PARAMETER ProcessorNumber is invalid.\r
102**/\r
103EFI_STATUS\r
104EFIAPI\r
105SmmRemoveProcessor (\r
106 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
107 IN UINTN ProcessorNumber\r
108 );\r
109\r
110/**\r
111 This return the handle number for the calling processor.\r
112\r
113 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.\r
114 @param[out] ProcessorNumber The handle number of currently executing processor.\r
115\r
116 @retval EFI_SUCCESS The current processor handle number was returned\r
117 in ProcessorNumber.\r
118 @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.\r
119\r
120**/\r
121EFI_STATUS\r
122EFIAPI\r
123SmmWhoAmI (\r
124 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
125 OUT UINTN *ProcessorNumber\r
126 );\r
127\r
128/**\r
129 Register exception handler.\r
130\r
131 @param This A pointer to the SMM_CPU_SERVICE_PROTOCOL instance.\r
132 @param ExceptionType Defines which interrupt or exception to hook. Type EFI_EXCEPTION_TYPE and\r
133 the valid values for this parameter are defined in EFI_DEBUG_SUPPORT_PROTOCOL\r
134 of the UEFI 2.0 specification.\r
135 @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER\r
136 that is called when a processor interrupt occurs.\r
137 If this parameter is NULL, then the handler will be uninstalled.\r
138\r
139 @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.\r
140 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was previously installed.\r
141 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not previously installed.\r
142 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.\r
143\r
144**/\r
145EFI_STATUS\r
146EFIAPI\r
147SmmRegisterExceptionHandler (\r
148 IN EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
149 IN EFI_EXCEPTION_TYPE ExceptionType,\r
150 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler\r
151 );\r
152\r
153//\r
154// Internal function prototypes\r
155//\r
156\r
157/**\r
158 Update the SMM CPU list per the pending operation.\r
159\r
160 This function is called after return from SMI handlers.\r
161**/\r
162VOID\r
163SmmCpuUpdate (\r
164 VOID\r
165 );\r
166\r
167/**\r
168 Initialize SMM CPU Services.\r
169\r
170 It installs EFI SMM CPU Services Protocol.\r
171\r
172 @param ImageHandle The firmware allocated handle for the EFI image.\r
173\r
174 @retval EFI_SUCCESS EFI SMM CPU Services Protocol was installed successfully.\r
175**/\r
176EFI_STATUS\r
177InitializeSmmCpuServices (\r
178 IN EFI_HANDLE Handle\r
179 );\r
180\r
181#endif\r