Commit | Line | Data |
---|---|---|
984263bc MD |
1 | /* |
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 | * ---------------------------------------------------------------------------- | |
8 | * | |
9 | * $FreeBSD: src/sys/i386/include/smp.h,v 1.50.2.5 2001/02/13 22:32:45 tegge Exp $ | |
984263bc MD |
10 | */ |
11 | ||
12 | #ifndef _MACHINE_SMP_H_ | |
13 | #define _MACHINE_SMP_H_ | |
14 | ||
15 | #ifdef _KERNEL | |
16 | ||
984263bc MD |
17 | #ifndef LOCORE |
18 | ||
19 | /* | |
20 | * For sending values to POST displays. | |
21 | * XXX FIXME: where does this really belong, isa.h/isa.c perhaps? | |
22 | */ | |
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) | |
32 | ||
33 | ||
a9295349 | 34 | #include <machine_base/apic/apicreg.h> |
7949232e | 35 | #include <machine/pcb.h> |
984263bc MD |
36 | |
37 | /* global data in mpboot.s */ | |
38 | extern int bootMP_size; | |
39 | ||
40 | /* functions in mpboot.s */ | |
3ae0cd58 | 41 | void bootMP (void); |
984263bc | 42 | |
984263bc | 43 | /* global data in apic_vector.s */ |
da23a592 MD |
44 | extern volatile cpumask_t stopped_cpus; |
45 | extern volatile cpumask_t started_cpus; | |
984263bc | 46 | |
3ae0cd58 | 47 | extern void (*cpustop_restartfunc) (void); |
984263bc | 48 | |
984263bc MD |
49 | extern struct pcb stoppcbs[]; |
50 | ||
51 | /* functions in mp_machdep.c */ | |
3ae0cd58 | 52 | u_int mp_bootaddress (u_int); |
3ae0cd58 RG |
53 | void mp_start (void); |
54 | void mp_announce (void); | |
3ae0cd58 | 55 | void init_secondary (void); |
da23a592 | 56 | int stop_cpus (cpumask_t); |
3ae0cd58 | 57 | void ap_init (void); |
da23a592 | 58 | int restart_cpus (cpumask_t); |
3ae0cd58 | 59 | void forward_signal (struct proc *); |
984263bc | 60 | |
984263bc | 61 | #if defined(READY) |
3ae0cd58 RG |
62 | void clr_io_apic_mask24 (int, u_int32_t); |
63 | void set_io_apic_mask24 (int, u_int32_t); | |
984263bc MD |
64 | #endif /* READY */ |
65 | ||
3ae0cd58 | 66 | void cpu_send_ipiq (int); |
41a01a4d | 67 | int cpu_send_ipiq_passive (int); |
984263bc MD |
68 | |
69 | /* global data in init_smp.c */ | |
0f7a3396 | 70 | extern cpumask_t smp_active_mask; |
984263bc | 71 | |
f77c018a MC |
72 | /* Detect CPU topology bits */ |
73 | void detect_cpu_topology(void); | |
74 | ||
75 | /* Interface functions for IDs calculation */ | |
76 | int get_chip_ID(int cpuid); | |
77 | int get_core_number_within_chip(int cpuid); | |
78 | int get_logical_CPU_number_within_core(int cpuid); | |
79 | ||
80 | #include <machine_base/apic/lapic.h> | |
81 | static __inline | |
82 | int get_apicid_from_cpuid(int cpuid) { | |
83 | return CPUID_TO_APICID(cpuid); | |
84 | } | |
85 | static __inline | |
86 | int get_cpuid_from_apicid(int cpuid) { | |
87 | return APICID_TO_CPUID(cpuid); | |
88 | } | |
89 | ||
984263bc | 90 | #endif /* !LOCORE */ |
984263bc MD |
91 | |
92 | #endif /* _KERNEL */ | |
93 | #endif /* _MACHINE_SMP_H_ */ |