minix/kernel/arch/i386/include/arch_smp.h
Tomas Hruby 62c666566e SMP - We boot APs
- kernel detects CPUs by searching ACPI tables for local apic nodes

- each CPU has its own TSS that points to its own stack. All cpus boot
  on the same boot stack (in sequence) but switch to its private stack
  as soon as they can.

- final booting code in main() placed in bsp_finish_booting() which is
  executed only after the BSP switches to its final stack

- apic functions to send startup interrupts

- assembler functions to handle CPU features not needed for single cpu
  mode like memory barries, HT detection etc.

- new files kernel/smp.[ch], kernel/arch/i386/arch_smp.c and
  kernel/arch/i386/include/arch_smp.h

- 16-bit trampoline code for the APs. It is executed by each AP after
  receiving startup IPIs it brings up the CPUs to 32bit mode and let
  them spin in an infinite loop so they don't do any damage.

- implementation of kernel spinlock

- CONFIG_SMP and CONFIG_MAX_CPUS set by the build system
2010-09-15 14:09:52 +00:00

43 lines
983 B
C

#ifndef __SMP_X86_H__
#define __SMP_X86_H__
#include "arch_proto.h" /* K_STACK_SIZE */
#define MAX_NR_INTERRUPT_ENTRIES 128
#define SMP_SCHED_PROC 0xF0
#define SMP_DEQUEUE_PROC 0xF1
#define SMP_CPU_REBOOT 0xF2
#define SMP_CPU_HALT 0xF3
#define SMP_ERROR_INT 0xF4
/* currently only 2 interrupt priority levels are used */
#define SPL0 0x0
#define SPLHI 0xF
#define SMP_IPI_DEST 0
#define SMP_IPI_SELF 1
#define SMP_IPI_TO_ALL 2
#define SMP_IPI_TO_ALL_BUT_SELF 3
#ifndef __ASSEMBLY__
/* returns the current cpu id */
#define cpuid (((u32_t *)(((u32_t)get_stack_frame() + (K_STACK_SIZE - 1)) \
& ~(K_STACK_SIZE - 1)))[-1])
/*
* in case apic or smp is disabled in boot monitor, we need to finish single cpu
* boot using the legacy PIC
*/
#define smp_single_cpu_fallback() do { \
tss_init(0, get_k_stack_top(0)); \
bsp_finish_booting(); \
} while(0)
extern unsigned char cpuid2apicid[CONFIG_MAX_CPUS];
#endif
#endif /* __SMP_X86_H__ */