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