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 $
13 #ifndef _MACHINE_SMP_H_
14 #define _MACHINE_SMP_H_
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 */
22 #if defined(SMP) || defined(APIC_IO)
27 * For sending values to POST displays.
28 * XXX FIXME: where does this really belong, isa.h/isa.c perhaps?
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)
41 #include <machine/apic.h>
43 /* global data in mpboot.s */
44 extern int bootMP_size;
46 /* functions in mpboot.s */
47 void bootMP __P((void));
49 /* global data in mplock.s */
51 extern u_int isr_lock;
52 #ifdef RECURSIVE_MPINTRLOCK
53 extern u_int mpintr_lock;
54 #endif /* RECURSIVE_MPINTRLOCK */
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 */
66 /* global data in apic_vector.s */
67 extern volatile u_int stopped_cpus;
68 extern volatile u_int started_cpus;
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));
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));
80 /* global data in mp_machdep.c */
81 extern int bsp_apic_ready;
84 extern int mp_nbusses;
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 {
99 volatile void *apic_address;
102 extern struct apic_intmapinfo int_to_apicintpin[];
103 extern u_int all_cpus;
104 extern struct pcb stoppcbs[];
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));
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 void assign_apic_irq __P((int apic, int intpin, int irq));
125 void revoke_apic_irq __P((int irq));
126 void bsp_apic_configure __P((void));
127 void init_secondary __P((void));
128 void smp_invltlb __P((void));
129 int stop_cpus __P((u_int));
130 int restart_cpus __P((u_int));
132 void forward_statclock __P((int pscnt));
133 void forward_hardclock __P((int pscnt));
134 #endif /* BETTER_CLOCK */
135 void forward_signal __P((struct proc *));
136 void forward_roundrobin __P((void));
137 #ifdef APIC_INTR_REORDER
138 void set_lapic_isrloc __P((int, int));
139 #endif /* APIC_INTR_REORDER */
140 void smp_rendezvous_action __P((void));
141 void smp_rendezvous __P((void (*)(void *),
146 /* global data in mpapic.c */
147 extern volatile lapic_t lapic;
148 extern volatile ioapic_t **ioapic;
150 /* functions in mpapic.c */
151 void apic_dump __P((char*));
152 void apic_initialize __P((void));
153 void imen_dump __P((void));
154 int apic_ipi __P((int, int, int));
155 int selected_apic_ipi __P((u_int, int, int));
156 int io_apic_setup __P((int));
157 void io_apic_setup_intpin __P((int, int));
158 void io_apic_set_id __P((int, int));
159 int io_apic_get_id __P((int));
160 int ext_int_setup __P((int, int));
163 void clr_io_apic_mask24 __P((int, u_int32_t));
164 void set_io_apic_mask24 __P((int, u_int32_t));
167 void set_apic_timer __P((int));
168 int read_apic_timer __P((void));
169 void u_sleep __P((int));
171 /* global data in init_smp.c */
172 extern int invltlb_ok;
173 extern int smp_active;
174 extern int smp_started;
175 extern volatile int smp_idle_loops;
178 #else /* !SMP && !APIC_IO */
181 * Create dummy MP lock empties
197 #endif /* _MACHINE_SMP_H_ */