Operating System Programming Guidelines
Then the operating system should enable its own local APIC, thereby allowing IPI communications with other APIC-based processors. At this time, the APs’ local APICs have interrupts disabled. Interrupts must remain disabled at the APs’ local APICs while the BSP is enabling the I/O APIC and bringing the system to the normal operating state. Otherwise, an I/O interrupt may be delivered to the uninitialized AP, resulting in the loss of the interrupt.
It is the responsibility of the operating system to assign unique IDs to I/O APIC units.
B.4 Application Processor Startup
An AP may be started either by the BSP or by another active AP. The operating system causes application processors to start executing their initial tasks in the operating system code by using the following universal algorithm. The algorithm detailed below consists of a sequence of interprocessor interrupts and short programmatic delays to allow the APs to respond to the wakeup commands. The algorithm shown here in pseudo-code assumes that the BSP is starting an AP for documentation convenience. The BSP must initialize BIOS shutdown code to 0AH and the warm reset vector (DWORD based at 40:67) to point to the AP startup code prior to executing the following sequence:
BSP sends AP an INIT IPI | |
BSP DELAYs (10mSec) | |
If (APIC_VERSION | is not an | 82489DX) { |
BSP sends AP | a STARTUP | IPI |
BSP DELAYs (200µSEC) | |
BSP sends AP | a STARTUP | IPI |
BSP DELAYs (200µSEC) | |
}
BSP verifies synchronization with executing AP
Example B-1. Universal Start-up Algorithm
If the MP configuration table exists, it provides the IDs of the application processor local APICs. These IDs should be used as the destination addresses in targeted IPIs.
If the MP configuration table does not exist on an MP-compliant system, the system must be of default configuration type. The MP specification requires local APIC IDs to be numbered sequentially, starting at zero for all default configurations. As a result, the BSP can determine the AP’s local APIC ID in default, two -processor configurations by reading its own local APIC ID. Since there are only two possible local APIC IDs in this case, zero and one, when the APIC ID of the BSP is one, the APIC ID of the AP is zero, and vice versa. This is important, because a BSP cannot start up an AP unless it already knows the local APIC ID.
Both INIT IPI and STARTUP IPI are open-ended commands. The operating system is responsible for determining whether its local APIC unit successfully dispatches one of these commands. The operating system must do so for an INIT and STARTUP IPI because the APIC either does not automatically retry or guarantee delivery for one of these special messages.
A local APIC unit indicates successful dispatch of an IPI by resetting the Delivery Status bit in the Interrupt Command Register (ICR). The operating system polls the delivery status bit after sending an INIT or STARTUP IPI until the command has been dispatched.