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