FreeBSD/Linux Kernel Cross Reference
sys/i386/include/smp.h
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$
10 *
11 */
12
13 #ifndef _MACHINE_SMP_H_
14 #define _MACHINE_SMP_H_
15
16 #ifdef _KERNEL
17
18 #if defined(SMP) && !defined(APIC_IO)
19 # error APIC_IO required for SMP, add "options APIC_IO" to your config file.
20 #endif /* SMP && !APIC_IO */
21
22 #if defined(SMP) || defined(APIC_IO)
23
24 #ifndef LOCORE
25
26 /*
27 * For sending values to POST displays.
28 * XXX FIXME: where does this really belong, isa.h/isa.c perhaps?
29 */
30 extern int current_postcode; /** XXX currently in mp_machdep.c */
31 #define POSTCODE(X) current_postcode = (X), \
32 outb(0x80, current_postcode)
33 #define POSTCODE_LO(X) current_postcode &= 0xf0, \
34 current_postcode |= ((X) & 0x0f), \
35 outb(0x80, current_postcode)
36 #define POSTCODE_HI(X) current_postcode &= 0x0f, \
37 current_postcode |= (((X) << 4) & 0xf0), \
38 outb(0x80, current_postcode)
39
40
41 #include <machine/apic.h>
42
43 /* global data in mpboot.s */
44 extern int bootMP_size;
45
46 /* functions in mpboot.s */
47 void bootMP __P((void));
48
49 /* global data in mplock.s */
50 extern u_int mp_lock;
51 extern u_int isr_lock;
52 #ifdef RECURSIVE_MPINTRLOCK
53 extern u_int mpintr_lock;
54 #endif /* RECURSIVE_MPINTRLOCK */
55
56 /* functions in mplock.s */
57 void get_mplock __P((void));
58 void rel_mplock __P((void));
59 int try_mplock __P((void));
60 #ifdef RECURSIVE_MPINTRLOCK
61 void get_mpintrlock __P((void));
62 void rel_mpintrlock __P((void));
63 int try_mpintrlock __P((void));
64 #endif /* RECURSIVE_MPINTRLOCK */
65
66 /* global data in apic_vector.s */
67 extern volatile u_int stopped_cpus;
68 extern volatile u_int started_cpus;
69
70 extern volatile u_int checkstate_probed_cpus;
71 extern volatile u_int checkstate_need_ast;
72 extern volatile u_int resched_cpus;
73 extern void (*cpustop_restartfunc) __P((void));
74
75 /* functions in apic_ipl.s */
76 void apic_eoi __P((void));
77 u_int io_apic_read __P((int, int));
78 void io_apic_write __P((int, int, u_int));
79
80 /* global data in mp_machdep.c */
81 extern int bsp_apic_ready;
82 extern int mp_ncpus;
83 extern int mp_naps;
84 extern int mp_nbusses;
85 extern int mp_napics;
86 extern int mp_picmode;
87 extern int boot_cpu_id;
88 extern vm_offset_t cpu_apic_address;
89 extern vm_offset_t io_apic_address[];
90 extern u_int32_t cpu_apic_versions[];
91 extern u_int32_t *io_apic_versions;
92 extern int cpu_num_to_apic_id[];
93 extern int io_num_to_apic_id[];
94 extern int apic_id_to_logical[];
95 #define APIC_INTMAPSIZE 24
96 struct apic_intmapinfo {
97 int ioapic;
98 int int_pin;
99 volatile void *apic_address;
100 int redirindex;
101 };
102 extern struct apic_intmapinfo int_to_apicintpin[];
103 extern u_int all_cpus;
104 extern struct pcb stoppcbs[];
105
106 /* functions in mp_machdep.c */
107 u_int mp_bootaddress __P((u_int));
108 int mp_probe __P((void));
109 void mp_start __P((void));
110 void mp_announce __P((void));
111 u_int isa_apic_mask __P((u_int));
112 int isa_apic_irq __P((int));
113 int pci_apic_irq __P((int, int, int, void *));
114 int apic_irq __P((int, int));
115 int next_apic_irq __P((int));
116 int undirect_isa_irq __P((int));
117 int undirect_pci_irq __P((int));
118 int apic_bus_type __P((int));
119 int apic_src_bus_id __P((int, int));
120 int apic_src_bus_irq __P((int, int));
121 int apic_int_type __P((int, int));
122 int apic_trigger __P((int, int));
123 int apic_polarity __P((int, int));
124 int mp_grab_cpu_hlt __P((void));
125 void assign_apic_irq __P((int apic, int intpin, int irq));
126 void revoke_apic_irq __P((int irq));
127 void bsp_apic_configure __P((void));
128 void init_secondary __P((void));
129 void smp_invltlb __P((void));
130 int stop_cpus __P((u_int));
131 int restart_cpus __P((u_int));
132 #ifdef BETTER_CLOCK
133 void forward_statclock __P((int pscnt));
134 void forward_hardclock __P((int pscnt));
135 #endif /* BETTER_CLOCK */
136 void forward_signal __P((struct proc *));
137 void forward_roundrobin __P((void));
138 #ifdef APIC_INTR_REORDER
139 void set_lapic_isrloc __P((int, int));
140 #endif /* APIC_INTR_REORDER */
141 void smp_rendezvous_action __P((void));
142 void smp_rendezvous __P((void (*)(void *),
143 void (*)(void *),
144 void (*)(void *),
145 void *arg));
146
147 /* global data in mpapic.c */
148 extern volatile lapic_t lapic;
149 extern volatile ioapic_t **ioapic;
150
151 /* functions in mpapic.c */
152 void apic_dump __P((char*));
153 void apic_initialize __P((void));
154 void imen_dump __P((void));
155 int apic_ipi __P((int, int, int));
156 int selected_apic_ipi __P((u_int, int, int));
157 int io_apic_setup __P((int));
158 void io_apic_setup_intpin __P((int, int));
159 void io_apic_set_id __P((int, int));
160 int io_apic_get_id __P((int));
161 int ext_int_setup __P((int, int));
162
163 #if defined(READY)
164 void clr_io_apic_mask24 __P((int, u_int32_t));
165 void set_io_apic_mask24 __P((int, u_int32_t));
166 #endif /* READY */
167
168 void set_apic_timer __P((int));
169 int read_apic_timer __P((void));
170 void u_sleep __P((int));
171
172 /* global data in init_smp.c */
173 extern int invltlb_ok;
174 extern int smp_active;
175 extern int smp_started;
176 extern volatile int smp_idle_loops;
177
178 #endif /* !LOCORE */
179 #else /* !SMP && !APIC_IO */
180
181 /*
182 * Create dummy MP lock empties
183 */
184
185 static __inline void
186 get_mplock(void)
187 {
188 }
189
190 static __inline void
191 rel_mplock(void)
192 {
193 }
194
195 #endif
196
197 #endif /* _KERNEL */
198 #endif /* _MACHINE_SMP_H_ */
Cache object: 158313c1f0126d9cf1d15b1540c0f20e
|