]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/Include/Protocol/SmmCpuService.h
BaseTools/BinToPcd: Fix Python 2.7.x compatibility issue
[mirror_edk2.git] / UefiCpuPkg / Include / Protocol / SmmCpuService.h
CommitLineData
9f1fc503
MK
1/** @file\r
2SMM CPU Service protocol definition.\r
3\r
4Copyright (c) 2013 - 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 _SMM_CPU_SERVICE_PROTOCOL_H_\r
16#define _SMM_CPU_SERVICE_PROTOCOL_H_\r
17\r
18//\r
19// Share some definitions with MP Services and CPU Arch Protocol\r
20//\r
21#include <Protocol/MpService.h>\r
22#include <Protocol/Cpu.h>\r
23\r
24#define EFI_SMM_CPU_SERVICE_PROTOCOL_GUID \\r
25 { \\r
26 0x1d202cab, 0xc8ab, 0x4d5c, { 0x94, 0xf7, 0x3c, 0xfc, 0xc0, 0xd3, 0xd3, 0x35 } \\r
27 }\r
28\r
29typedef struct _EFI_SMM_CPU_SERVICE_PROTOCOL EFI_SMM_CPU_SERVICE_PROTOCOL;\r
30\r
31//\r
32// Protocol functions\r
33//\r
34\r
35/**\r
36 Gets processor information on the requested processor at the\r
37 instant this call is made. This service may only be called from the BSP.\r
38\r
39 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL\r
40 instance.\r
41 @param[in] ProcessorNumber The handle number of processor.\r
42 @param[out] ProcessorInfoBuffer A pointer to the buffer where information for\r
43 the requested processor is deposited.\r
44\r
45 @retval EFI_SUCCESS Processor information was returned.\r
46 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
47 @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.\r
48 @retval EFI_NOT_FOUND The processor with the handle specified by\r
49 ProcessorNumber does not exist in the platform.\r
50**/\r
51typedef\r
52EFI_STATUS\r
53(EFIAPI * EFI_SMM_GET_PROCESSOR_INFO) (\r
54 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
55 IN UINTN ProcessorNumber,\r
56 OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer\r
57 );\r
58\r
59/**\r
60 This service switches the requested AP to be the BSP from that point onward.\r
61 This service changes the BSP for all purposes. This call can only be performed\r
62 by the current BSP.\r
63\r
64 This service switches the requested AP to be the BSP from that point onward.\r
65 This service changes the BSP for all purposes. The new BSP can take over the\r
66 execution of the old BSP and continue seamlessly from where the old one left\r
67 off.\r
68\r
69 If the BSP cannot be switched prior to the return from this service, then\r
70 EFI_UNSUPPORTED must be returned.\r
71\r
72 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.\r
73 @param[in] ProcessorNumber The handle number of AP that is to become the new\r
74 BSP. The range is from 0 to the total number of\r
75 logical processors minus 1.\r
76\r
77 @retval EFI_SUCCESS BSP successfully switched.\r
78 @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to\r
79 this service returning.\r
80 @retval EFI_UNSUPPORTED Switching the BSP is not supported.\r
81 @retval EFI_SUCCESS The calling processor is an AP.\r
82 @retval EFI_NOT_FOUND The processor with the handle specified by\r
83 ProcessorNumber does not exist.\r
84 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or\r
85 a disabled AP.\r
86 @retval EFI_NOT_READY The specified AP is busy.\r
87\r
88**/\r
89typedef\r
90EFI_STATUS\r
91(EFIAPI * EFI_SMM_SWITCH_BSP) (\r
92 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
93 IN UINTN ProcessorNumber\r
94 );\r
95\r
96/**\r
97 Notify that a new processor has been added to the system.\r
98\r
99 The SMM CPU driver should add the processor to the SMM CPU list.\r
100\r
101 If the processor is disabled it won't participate any SMI handler during subsequent SMIs.\r
102\r
103 @param This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.\r
104 @param ProcessorId The hardware ID of the processor.\r
105 @param ProcessorNumber The handle number of processor.\r
106 @param ProcessorResource A pointer to EFI_SMM_PROCESSOR_RESOURCE which holds the assigned resources.\r
107\r
108 @retval EFI_SUCCESS The function completed successfully.\r
109 @retval EFI_ALREADY_STARTED Processor already present.\r
110 @retval EFI_NOT_READY Space for a new handle could not be allocated.\r
111\r
112**/\r
113typedef\r
114EFI_STATUS\r
115(EFIAPI *EFI_SMM_ADD_PROCESSOR) (\r
116 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
117 IN UINT64 ProcessorId,\r
118 OUT UINTN *ProcessorNumber\r
119 );\r
120\r
121/**\r
122 Notify that a processor is hot-removed.\r
123\r
124 Remove a processor from the CPU list of the SMM CPU driver. After this API is called, the removed processor\r
125 must not respond to SMIs in the coherence domain.\r
126\r
127 @param This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.\r
128 @param ProcessorId The hardware ID of the processor.\r
129\r
130 @retval EFI_SUCCESS The function completed successfully.\r
131 @retval EFI_NOT_FOUND Processor with the hardware ID specified by ProcessorId does not exist.\r
132 @retval EFI_NOT_READY Specified AP is busy.\r
133\r
134**/\r
135typedef\r
136EFI_STATUS\r
137(EFIAPI *EFI_SMM_REMOVE_PROCESSOR) (\r
138 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
139 IN UINTN ProcessorNumber\r
140 );\r
141\r
142/**\r
143 This return the handle number for the calling processor. This service may be\r
144 called from the BSP and APs.\r
145\r
146 This service returns the processor handle number for the calling processor.\r
147 The returned value is in the range from 0 to the total number of logical\r
148 processors minus 1. This service may be called from the BSP and APs.\r
149 If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER\r
150 is returned. Otherwise, the current processors handle number is returned in\r
151 ProcessorNumber, and EFI_SUCCESS is returned.\r
152\r
153 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.\r
154 @param[in] ProcessorNumber The handle number of AP that is to become the new\r
155 BSP. The range is from 0 to the total number of\r
156 logical processors minus 1.\r
157\r
158 @retval EFI_SUCCESS The current processor handle number was returned\r
159 in ProcessorNumber.\r
160 @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.\r
161\r
162**/\r
163typedef\r
164EFI_STATUS\r
165(EFIAPI * EFI_SMM_WHOAMI) (\r
166 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
167 OUT UINTN *ProcessorNumber\r
168 );\r
169\r
170/**\r
171 Register exception handler.\r
172\r
173 @param This A pointer to the SMM_CPU_SERVICE_PROTOCOL instance.\r
174 @param ExceptionType Defines which interrupt or exception to hook. Type EFI_EXCEPTION_TYPE and\r
175 the valid values for this parameter are defined in EFI_DEBUG_SUPPORT_PROTOCOL\r
176 of the UEFI 2.0 specification.\r
177 @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER\r
178 that is called when a processor interrupt occurs.\r
179 If this parameter is NULL, then the handler will be uninstalled.\r
180\r
181 @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.\r
182 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was previously installed.\r
183 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not previously installed.\r
184 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.\r
185\r
186**/\r
187typedef\r
188EFI_STATUS\r
189(EFIAPI *EFI_SMM_REGISTER_EXCEPTION_HANDLER) (\r
190 IN EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
191 IN EFI_EXCEPTION_TYPE ExceptionType,\r
192 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler\r
193 );\r
194\r
195//\r
196// This protocol provides CPU services from SMM.\r
197//\r
198struct _EFI_SMM_CPU_SERVICE_PROTOCOL {\r
199 EFI_SMM_GET_PROCESSOR_INFO GetProcessorInfo;\r
200 EFI_SMM_SWITCH_BSP SwitchBsp;\r
201 EFI_SMM_ADD_PROCESSOR AddProcessor;\r
202 EFI_SMM_REMOVE_PROCESSOR RemoveProcessor;\r
203 EFI_SMM_WHOAMI WhoAmI;\r
204 EFI_SMM_REGISTER_EXCEPTION_HANDLER RegisterExceptionHandler;\r
205};\r
206\r
207extern EFI_GUID gEfiSmmCpuServiceProtocolGuid;\r
208\r
209#endif\r