1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/// ## Multiprocessor Wakeup Mailbox Structure
/// ## Multiprocessor Wakeup Structure
///
/// The platform firmware publishes a multiprocessor wakeup structure to let the bootstrap processor wake up application processors with a mailbox.
/// The mailbox is memory that the firmware reserves so that each processor can have the OS send a message to them.
///
/// During system boot, the firmware puts the application processors in a state to check the mailbox.
/// The shared mailbox is a 4K-aligned 4K-size memory block allocated by the firmware in the ACPINvs memory.
/// The firmware is not allowed to modify the mailbox location when the firmware transfer the control to an OS loader.
/// The mailbox is broken down into two 2KB sections: an OS section and a firmware section.
///
/// The OS section can only be written by OS and read by the firmware, except the command field.
/// The application processor need clear the command to Noop(0) as the acknowledgement that the command is received.
/// The firmware must cache the content in the mailbox which might be used later before clear the command such as WakeupVector.
/// Only after the command is changed to Noop(0), the OS can send the next command.
/// The firmware section must be considered read-only to the OS and is only to be written to by the firmware.
/// All data communication between the OS and FW must be in little endian format.
///
/// The OS section contains command, flags, APIC ID, and a wakeup address.
/// After the OS detects the processor number from the MADT table, the OS may prepare the wakeup routine,
/// fill the wakeup address field in the mailbox, indicate which processor need to be wakeup in the APID ID field, and send wakeup command.
/// Once an application processor detects the wakeup command and its own APIC ID, the application processor will jump to the OS-provided wakeup address.
/// The application processor will ignore the command if the APIC ID does not match its own.
///
/// For each application processor, the mailbox can be used only once for the wakeup command.
/// After the application process takes the action according to the command, this mailbox will no longer be checked by this application processor.
/// Other processors can continue using the mailbox for the next command.