]>
git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/Include/Library/LocalApicLib.h
2 Public include file for Local APIC library.
4 Local APIC library assumes local APIC is enabled. It does not
5 handles cases where local APIC is disabled.
7 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #ifndef __LOCAL_APIC_LIB_H__
19 #define __LOCAL_APIC_LIB_H__
21 #define LOCAL_APIC_MODE_XAPIC 0x1 ///< xAPIC mode.
22 #define LOCAL_APIC_MODE_X2APIC 0x2 ///< x2APIC mode.
25 Get the current local APIC mode.
27 If local APIC is disabled, then ASSERT.
29 @retval LOCAL_APIC_MODE_XAPIC current APIC mode is xAPIC.
30 @retval LOCAL_APIC_MODE_X2APIC current APIC mode is x2APIC.
39 Set the current local APIC mode.
41 If the specified local APIC mode is not valid, then ASSERT.
42 If the specified local APIC mode can't be set as current, then ASSERT.
44 @param ApicMode APIC mode to be set.
53 Get the initial local APIC ID of the executing processor assigned by hardware upon power on or reset.
55 In xAPIC mode, the initial local APIC ID is 8-bit, and may be different from current APIC ID.
56 In x2APIC mode, the local APIC ID can't be changed and there is no concept of initial APIC ID. In this case,
57 the 32-bit local APIC ID is returned as initial APIC ID.
59 @return 32-bit initial local APIC ID of the executing processor.
68 Get the local APIC ID of the executing processor.
70 @return 32-bit local APIC ID of the executing processor.
79 Get the value of the local APIC version register.
81 @return the value of the local APIC version register.
90 Send a Fixed IPI to a specified target processor.
92 This function returns after the IPI has been accepted by the target processor.
94 @param ApicId The local APIC ID of the target processor.
95 @param Vector The vector number of the interrupt being sent.
105 Send a Fixed IPI to all processors excluding self.
107 This function returns after the IPI has been accepted by the target processors.
109 @param Vector The vector number of the interrupt being sent.
113 SendFixedIpiAllExcludingSelf (
118 Send a SMI IPI to a specified target processor.
120 This function returns after the IPI has been accepted by the target processor.
122 @param ApicId Specify the local APIC ID of the target processor.
131 Send a SMI IPI to all processors excluding self.
133 This function returns after the IPI has been accepted by the target processors.
137 SendSmiIpiAllExcludingSelf (
142 Send an INIT IPI to a specified target processor.
144 This function returns after the IPI has been accepted by the target processor.
146 @param ApicId Specify the local APIC ID of the target processor.
155 Send an INIT IPI to all processors excluding self.
157 This function returns after the IPI has been accepted by the target processors.
161 SendInitIpiAllExcludingSelf (
166 Send an INIT-Start-up-Start-up IPI sequence to a specified target processor.
168 This function returns after the IPI has been accepted by the target processor.
170 if StartupRoutine >= 1M, then ASSERT.
171 if StartupRoutine is not multiple of 4K, then ASSERT.
173 @param ApicId Specify the local APIC ID of the target processor.
174 @param StartupRoutine Points to a start-up routine which is below 1M physical
175 address and 4K aligned.
181 IN UINT32 StartupRoutine
185 Send an INIT-Start-up-Start-up IPI sequence to all processors excluding self.
187 This function returns after the IPI has been accepted by the target processors.
189 if StartupRoutine >= 1M, then ASSERT.
190 if StartupRoutine is not multiple of 4K, then ASSERT.
192 @param StartupRoutine Points to a start-up routine which is below 1M physical
193 address and 4K aligned.
197 SendInitSipiSipiAllExcludingSelf (
198 IN UINT32 StartupRoutine
202 Programming Virtual Wire Mode.
204 This function programs the local APIC for virtual wire mode following
205 the example described in chapter A.3 of the MP 1.4 spec.
207 IOxAPIC is not involved in this type of virtual wire mode.
211 ProgramVirtualWireMode (
216 Disable LINT0 & LINT1 interrupts.
218 This function sets the mask flag in the LVT LINT0 & LINT1 registers.
222 DisableLvtInterrupts (
227 Read the initial count value from the init-count register.
229 @return The initial count value read from the init-count register.
233 GetApicTimerInitCount (
238 Read the current count value from the current-count register.
240 @return The current count value read from the current-count register.
244 GetApicTimerCurrentCount (
249 Initialize the local APIC timer.
251 The local APIC timer is initialized and enabled.
253 @param DivideValue The divide value for the DCR. It is one of 1,2,4,8,16,32,64,128.
254 If it is 0, then use the current divide value in the DCR.
255 @param InitCount The initial count value.
256 @param PeriodicMode If TRUE, timer mode is peridoic. Othewise, timer mode is one-shot.
257 @param Vector The timer interrupt vector number.
261 InitializeApicTimer (
262 IN UINTN DivideValue
,
264 IN BOOLEAN PeriodicMode
,
269 Get the state of the local APIC timer.
271 @param DivideValue Return the divide value for the DCR. It is one of 1,2,4,8,16,32,64,128.
272 @param PeriodicMode Return the timer mode. If TRUE, timer mode is peridoic. Othewise, timer mode is one-shot.
273 @param Vector Return the timer interrupt vector number.
278 OUT UINTN
*DivideValue OPTIONAL
,
279 OUT BOOLEAN
*PeriodicMode OPTIONAL
,
280 OUT UINT8
*Vector OPTIONAL
284 Enable the local APIC timer interrupt.
288 EnableApicTimerInterrupt (
293 Disable the local APIC timer interrupt.
297 DisableApicTimerInterrupt (
302 Get the local APIC timer interrupt state.
304 @retval TRUE The local APIC timer interrupt is enabled.
305 @retval FALSE The local APIC timer interrupt is disabled.
309 GetApicTimerInterruptState (
314 Send EOI to the local APIC.