CPU topology support
[dragonfly.git] / sys / platform / vkernel / include / smp.h
CommitLineData
4e497a4d
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 $
c5b0b0ba 10 * $DragonFly: src/sys/platform/vkernel/include/smp.h,v 1.3 2007/07/02 02:37:04 dillon Exp $
4e497a4d
MD
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 */
29extern 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 */
44extern int bootMP_size;
45
46/* functions in mpboot.s */
47void bootMP (void);
48
49#endif
50
4e497a4d 51/* global data in apic_vector.s */
da23a592 52extern volatile cpumask_t stopped_cpus;
c5b0b0ba
MD
53extern int optcpus; /* from main() */
54
6a8aa90e 55#if 0
da23a592 56extern volatile cpumask_t started_cpus;
4e497a4d 57
da23a592 58extern volatile cpumask_t checkstate_probed_cpus;
4e497a4d
MD
59extern void (*cpustop_restartfunc) (void);
60
61/* functions in apic_ipl.s */
4e497a4d
MD
62u_int io_apic_read (int, int);
63void io_apic_write (int, int, u_int);
64
65#endif
66
67#if 0
68/* global data in mp_machdep.c */
69extern int bsp_apic_ready;
70extern int mp_naps;
71extern int mp_nbusses;
72extern int mp_napics;
73extern int boot_cpu_id;
74extern vm_offset_t cpu_apic_address;
75extern vm_offset_t io_apic_address[];
76extern u_int32_t cpu_apic_versions[];
77extern u_int32_t *io_apic_versions;
78extern int cpu_num_to_apic_id[];
79extern int io_num_to_apic_id[];
80extern int apic_id_to_logical[];
81#endif
82
83#if 0
84#define APIC_INTMAPSIZE 24
85struct apic_intmapinfo {
86 int ioapic;
87 int int_pin;
88 volatile void *apic_address;
89 int redirindex;
90};
91extern struct apic_intmapinfo int_to_apicintpin[];
92extern struct pcb stoppcbs[];
93
94#endif
95
96#if 0
97/* functions in mp_machdep.c */
98void *permanent_io_mapping(vm_paddr_t);
99u_int mp_bootaddress (u_int);
100int mp_probe (void);
6a8aa90e 101#endif
4e497a4d
MD
102void mp_start (void);
103void mp_announce (void);
6a8aa90e 104#if 0
4e497a4d
MD
105u_int isa_apic_mask (u_int);
106int isa_apic_irq (int);
107int pci_apic_irq (int, int, int);
108int apic_irq (int, int);
109int next_apic_irq (int);
110int undirect_isa_irq (int);
111int undirect_pci_irq (int);
112int apic_bus_type (int);
113int apic_src_bus_id (int, int);
114int apic_src_bus_irq (int, int);
115int apic_int_type (int, int);
116int apic_trigger (int, int);
117int apic_polarity (int, int);
118void assign_apic_irq (int apic, int intpin, int irq);
119void revoke_apic_irq (int irq);
120void init_secondary (void);
6a8aa90e 121#endif
da23a592 122int stop_cpus (cpumask_t);
4e497a4d 123void ap_init (void);
da23a592 124int restart_cpus (cpumask_t);
6a8aa90e 125#if 0
4e497a4d
MD
126void forward_signal (struct proc *);
127
128#endif
129
130#if 0
131/* global data in mpapic.c */
132extern volatile lapic_t lapic;
133extern volatile ioapic_t **ioapic;
134#endif
135
136/* functions in mpapic.c */
137#if 0
138void apic_dump (char*);
139void apic_initialize (void);
140void imen_dump (void);
141int apic_ipi (int, int, int);
da23a592 142void selected_apic_ipi (cpumask_t, int, int);
4e497a4d
MD
143void single_apic_ipi(int cpu, int vector, int delivery_mode);
144int single_apic_ipi_passive(int cpu, int vector, int delivery_mode);
145int io_apic_setup (int);
146void io_apic_setup_intpin (int, int);
147void io_apic_set_id (int, int);
148int io_apic_get_id (int);
149int ext_int_setup (int, int);
150#endif
151
152#if 0
153void clr_io_apic_mask24 (int, u_int32_t);
154void set_io_apic_mask24 (int, u_int32_t);
155#endif
156
157#if 0
158void set_apic_timer (int);
159int read_apic_timer (void);
160void u_sleep (int);
161#endif
162void cpu_send_ipiq (int);
163int cpu_send_ipiq_passive (int);
164
165/* global data in init_smp.c */
166extern cpumask_t smp_active_mask;
167
168#endif /* !LOCORE */
169#else /* !SMP */
170
171#define smp_active_mask 1 /* smp_active_mask always 1 on UP machines */
172
173#endif
174
175#endif /* _KERNEL */
176#endif /* _MACHINE_SMP_H_ */