smp.h revision 27002
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 * $Id: smp.h,v 1.12 1997/06/25 20:59:15 fsmp Exp $
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(NCPU)
23# define NCPU			2
24#endif /* SMP && NCPU */
25
26#if defined(SMP) || defined(APIC_IO)
27
28/*
29 * For sending values to POST displays.
30 */
31#define POSTCODE(X)		outb(0x80, (X))
32
33#include <machine/apic.h>
34
35/* global data in mpboot.s */
36extern int			bootMP_size;
37
38/* functions in mpboot.s */
39void	bootMP			__P((void));
40
41/* global data in mplock.s */
42extern u_int			mp_lock;
43
44/* functions in mplock.s */
45void	get_mplock		__P((void));
46void	rel_mplock		__P((void));
47void	try_mplock		__P((void));
48
49/* global data in apic_vector.s */
50extern volatile u_int		stopped_cpus;
51extern volatile u_int		started_cpus;
52
53/* global data in mp_machdep.c */
54extern int			mp_ncpus;
55extern int			mp_naps;
56extern int			mp_nbusses;
57extern int			mp_napics;
58extern int			mp_picmode;
59extern int			boot_cpu_id;
60extern vm_offset_t		cpu_apic_address;
61extern vm_offset_t		io_apic_address[];
62extern u_int32_t		cpu_apic_versions[];
63extern u_int32_t		io_apic_versions[];
64extern int			cpu_num_to_apic_id[];
65extern int			io_num_to_apic_id[];
66extern int			apic_id_to_logical[];
67extern u_int			all_cpus;
68extern u_int			SMP_prvpt[];
69extern u_char			SMP_ioapic[];
70
71/* functions in mp_machdep.c */
72u_int	mp_bootaddress		__P((u_int));
73int	mp_probe		__P((void));
74void	mp_start		__P((void));
75void	mp_announce		__P((void));
76u_int	isa_apic_mask		__P((u_int));
77int	isa_apic_pin		__P((int));
78int	pci_apic_pin		__P((int, int, int));
79int	undirect_isa_irq	__P((int));
80int	undirect_pci_irq	__P((int));
81int	apic_bus_type		__P((int));
82int	apic_src_bus_id		__P((int, int));
83int	apic_src_bus_irq	__P((int, int));
84int	apic_int_type		__P((int, int));
85int	apic_trigger		__P((int, int));
86int	apic_polarity		__P((int, int));
87void	configure_local_apic	__P((void));
88void	init_secondary		__P((void));
89void	smp_invltlb		__P((void));
90int	stop_cpus		__P((u_int));
91int	restart_cpus		__P((u_int));
92
93/* global data in mpapic.c */
94extern volatile lapic_t		lapic;
95
96#if defined(MULTIPLE_IOAPICS)
97#error MULTIPLE_IOAPICSXXX
98#else
99extern volatile ioapic_t	*ioapic[];
100#endif /* MULTIPLE_IOAPICS */
101
102/* functions in mpapic.c */
103void	apic_initialize		__P((int));
104int	apic_ipi		__P((int, int, int));
105int	selected_apic_ipi	__P((u_int, int, int));
106int	io_apic_setup		__P((int));
107int	ext_int_setup		__P((int, int));
108void	write_io_apic_mask24	__P((int, u_int32_t));
109
110#if defined(READY)
111void	clr_io_apic_mask24	__P((int, u_int32_t));
112void	set_io_apic_mask24	__P((int, u_int32_t));
113#endif /* READY */
114
115void	set_apic_timer		__P((int));
116int	read_apic_timer		__P((void));
117void	u_sleep			__P((int));
118
119/* global data in init_smp.c */
120extern int			smp_active;
121extern int			invltlb_ok;
122
123/* 'private' global data in locore.s */
124extern volatile u_int		cpuid;
125extern volatile u_int		cpu_lockid;
126extern volatile u_int		other_cpus;
127
128#endif /* SMP || APIC_IO */
129#endif /* KERNEL */
130#endif /* _MACHINE_SMP_H_ */
131