xref: /dragonfly/sys/platform/vkernel64/include/smp.h (revision c89a6c1b)
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 $
10  * $DragonFly: src/sys/platform/vkernel/include/smp.h,v 1.3 2007/07/02 02:37:04 dillon Exp $
11  *
12  */
13 
14 #ifndef _MACHINE_SMP_H_
15 #define _MACHINE_SMP_H_
16 
17 #ifdef _KERNEL
18 
19 #if defined(SMP)
20 
21 #ifndef LOCORE
22 
23 #if 0
24 
25 /*
26  * For sending values to POST displays.
27  * XXX FIXME: where does this really belong, isa.h/isa.c perhaps?
28  */
29 extern int current_postcode;  /** XXX currently in mp_machdep.c */
30 #define POSTCODE(X)	current_postcode = (X), \
31 			outb(0x80, current_postcode)
32 #define POSTCODE_LO(X)	current_postcode &= 0xf0, \
33 			current_postcode |= ((X) & 0x0f), \
34 			outb(0x80, current_postcode)
35 #define POSTCODE_HI(X)	current_postcode &= 0x0f, \
36 			current_postcode |= (((X) << 4) & 0xf0), \
37 			outb(0x80, current_postcode)
38 
39 
40 #include <machine_base/apic/apicreg.h>
41 #include <machine/pcb.h>
42 
43 /* global data in mpboot.s */
44 extern int			bootMP_size;
45 
46 /* functions in mpboot.s */
47 void	bootMP			(void);
48 
49 #endif
50 
51 /* global data in apic_vector.s */
52 extern volatile u_int		stopped_cpus;
53 extern int			optcpus;	/* from main() */
54 
55 #if 0
56 extern volatile u_int		started_cpus;
57 
58 extern volatile u_int		checkstate_probed_cpus;
59 extern void (*cpustop_restartfunc) (void);
60 
61 /* functions in apic_ipl.s */
62 void	apic_eoi		(void);
63 u_int	io_apic_read		(int, int);
64 void	io_apic_write		(int, int, u_int);
65 
66 #endif
67 
68 #if 0
69 /* global data in mp_machdep.c */
70 extern int			bsp_apic_ready;
71 extern int			mp_naps;
72 extern int			mp_nbusses;
73 extern int			mp_napics;
74 extern int			boot_cpu_id;
75 extern vm_offset_t		cpu_apic_address;
76 extern vm_offset_t		io_apic_address[];
77 extern u_int32_t		cpu_apic_versions[];
78 extern u_int32_t		*io_apic_versions;
79 extern int			cpu_num_to_apic_id[];
80 extern int			io_num_to_apic_id[];
81 extern int			apic_id_to_logical[];
82 #endif
83 
84 #if 0
85 #define APIC_INTMAPSIZE 24
86 struct apic_intmapinfo {
87 	int ioapic;
88 	int int_pin;
89 	volatile void *apic_address;
90 	int redirindex;
91 };
92 extern struct apic_intmapinfo	int_to_apicintpin[];
93 extern struct pcb		stoppcbs[];
94 
95 #endif
96 
97 #if 0
98 /* functions in mp_machdep.c */
99 void	*permanent_io_mapping(vm_paddr_t);
100 u_int	mp_bootaddress		(u_int);
101 int	mp_probe		(void);
102 #endif
103 void	mp_start		(void);
104 void	mp_announce		(void);
105 #if 0
106 u_int	isa_apic_mask		(u_int);
107 int	isa_apic_irq		(int);
108 int	pci_apic_irq		(int, int, int);
109 int	apic_irq		(int, int);
110 int	next_apic_irq		(int);
111 int	undirect_isa_irq	(int);
112 int	undirect_pci_irq	(int);
113 int	apic_bus_type		(int);
114 int	apic_src_bus_id		(int, int);
115 int	apic_src_bus_irq	(int, int);
116 int	apic_int_type		(int, int);
117 int	apic_trigger		(int, int);
118 int	apic_polarity		(int, int);
119 void	assign_apic_irq		(int apic, int intpin, int irq);
120 void	revoke_apic_irq		(int irq);
121 void	init_secondary		(void);
122 #endif
123 int	stop_cpus		(u_int);
124 void	ap_init			(void);
125 int	restart_cpus		(u_int);
126 #if 0
127 void	forward_signal		(struct proc *);
128 
129 #endif
130 
131 #if 0
132 /* global data in mpapic.c */
133 extern volatile lapic_t		lapic;
134 extern volatile ioapic_t	**ioapic;
135 #endif
136 
137 /* functions in mpapic.c */
138 #if 0
139 void	apic_dump		(char*);
140 void	apic_initialize		(void);
141 void	imen_dump		(void);
142 int	apic_ipi		(int, int, int);
143 void	selected_apic_ipi	(u_int, int, int);
144 void	single_apic_ipi(int cpu, int vector, int delivery_mode);
145 int	single_apic_ipi_passive(int cpu, int vector, int delivery_mode);
146 int	io_apic_setup		(int);
147 void	io_apic_setup_intpin	(int, int);
148 void	io_apic_set_id		(int, int);
149 int	io_apic_get_id		(int);
150 int	ext_int_setup		(int, int);
151 #endif
152 
153 #if 0
154 void	clr_io_apic_mask24	(int, u_int32_t);
155 void	set_io_apic_mask24	(int, u_int32_t);
156 #endif
157 
158 #if 0
159 void	set_apic_timer		(int);
160 int	read_apic_timer		(void);
161 void	u_sleep			(int);
162 #endif
163 void	cpu_send_ipiq		(int);
164 int	cpu_send_ipiq_passive	(int);
165 
166 /* global data in init_smp.c */
167 extern cpumask_t		smp_active_mask;
168 
169 #endif /* !LOCORE */
170 #else	/* !SMP */
171 
172 #define	smp_active_mask	1	/* smp_active_mask always 1 on UP machines */
173 
174 #endif
175 
176 #endif /* _KERNEL */
177 #endif /* _MACHINE_SMP_H_ */
178