2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
9 * $FreeBSD: src/sys/i386/include/smp.h,v 1.50.2.5 2001/02/13 22:32:45 tegge Exp $
12 #ifndef _MACHINE_SMP_H_
13 #define _MACHINE_SMP_H_
20 * For sending values to POST displays.
21 * XXX FIXME: where does this really belong, isa.h/isa.c perhaps?
23 extern int current_postcode; /** XXX currently in mp_machdep.c */
24 #define POSTCODE(X) current_postcode = (X), \
25 outb(0x80, current_postcode)
26 #define POSTCODE_LO(X) current_postcode &= 0xf0, \
27 current_postcode |= ((X) & 0x0f), \
28 outb(0x80, current_postcode)
29 #define POSTCODE_HI(X) current_postcode &= 0x0f, \
30 current_postcode |= (((X) << 4) & 0xf0), \
31 outb(0x80, current_postcode)
34 #include <machine_base/apic/apicreg.h>
35 #include <machine/pcb.h>
37 /* global data in mpboot.s */
38 extern int bootMP_size;
40 /* functions in mpboot.s */
43 /* global data in apic_vector.s */
44 extern volatile cpumask_t stopped_cpus;
45 extern volatile cpumask_t started_cpus;
47 extern volatile u_int checkstate_probed_cpus;
48 extern void (*cpustop_restartfunc) (void);
50 extern struct pcb stoppcbs[];
52 /* functions in mp_machdep.c */
53 u_int mp_bootaddress (u_int);
55 void mp_announce (void);
56 void init_secondary (void);
57 int stop_cpus (cpumask_t);
59 int restart_cpus (cpumask_t);
60 void forward_signal (struct proc *);
63 void clr_io_apic_mask24 (int, u_int32_t);
64 void set_io_apic_mask24 (int, u_int32_t);
67 void cpu_send_ipiq (int);
68 int cpu_send_ipiq_passive (int);
70 /* global data in init_smp.c */
71 extern cpumask_t smp_active_mask;
73 /* Detect CPU topology bits */
74 void detect_cpu_topology(void);
76 /* Interface functions for IDs calculation */
77 int get_chip_ID(int cpuid);
78 int get_core_number_within_chip(int cpuid);
79 int get_logical_CPU_number_within_core(int cpuid);
81 #include <machine_base/apic/lapic.h>
83 int get_apicid_from_cpuid(int cpuid) {
84 return CPUID_TO_APICID(cpuid);
87 int get_cpuid_from_apicid(int cpuid) {
88 return APICID_TO_CPUID(cpuid);
94 #endif /* _MACHINE_SMP_H_ */