vkernel{,64} - CPU topology support
[dragonfly.git] / sys / platform / vkernel64 / include / smp.h
CommitLineData
da673940
JG
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 */
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
51/* global data in apic_vector.s */
da23a592 52extern volatile cpumask_t stopped_cpus;
da673940 53extern int optcpus; /* from main() */
9bea6114
MC
54extern int vkernel_b_arg; /* arg from main() */
55extern int vkernel_B_arg; /* arg from main() */
da673940
JG
56
57#if 0
da23a592 58extern volatile cpumask_t started_cpus;
da673940 59
da23a592 60extern volatile cpumask_t checkstate_probed_cpus;
da673940
JG
61extern void (*cpustop_restartfunc) (void);
62
63/* functions in apic_ipl.s */
da673940
JG
64u_int io_apic_read (int, int);
65void io_apic_write (int, int, u_int);
66
67#endif
68
69#if 0
70/* global data in mp_machdep.c */
71extern int bsp_apic_ready;
72extern int mp_naps;
73extern int mp_nbusses;
74extern int mp_napics;
75extern int boot_cpu_id;
76extern vm_offset_t cpu_apic_address;
77extern vm_offset_t io_apic_address[];
78extern u_int32_t cpu_apic_versions[];
79extern u_int32_t *io_apic_versions;
80extern int cpu_num_to_apic_id[];
81extern int io_num_to_apic_id[];
82extern int apic_id_to_logical[];
83#endif
84
85#if 0
86#define APIC_INTMAPSIZE 24
87struct apic_intmapinfo {
88 int ioapic;
89 int int_pin;
90 volatile void *apic_address;
91 int redirindex;
92};
93extern struct apic_intmapinfo int_to_apicintpin[];
94extern struct pcb stoppcbs[];
95
96#endif
97
98#if 0
99/* functions in mp_machdep.c */
100void *permanent_io_mapping(vm_paddr_t);
101u_int mp_bootaddress (u_int);
102int mp_probe (void);
103#endif
104void mp_start (void);
105void mp_announce (void);
106#if 0
107u_int isa_apic_mask (u_int);
108int isa_apic_irq (int);
109int pci_apic_irq (int, int, int);
110int apic_irq (int, int);
111int next_apic_irq (int);
112int undirect_isa_irq (int);
113int undirect_pci_irq (int);
114int apic_bus_type (int);
115int apic_src_bus_id (int, int);
116int apic_src_bus_irq (int, int);
117int apic_int_type (int, int);
118int apic_trigger (int, int);
119int apic_polarity (int, int);
120void assign_apic_irq (int apic, int intpin, int irq);
121void revoke_apic_irq (int irq);
122void init_secondary (void);
123#endif
da23a592 124int stop_cpus (cpumask_t);
da673940 125void ap_init (void);
da23a592 126int restart_cpus (cpumask_t);
da673940
JG
127#if 0
128void forward_signal (struct proc *);
129
130#endif
131
132#if 0
133/* global data in mpapic.c */
134extern volatile lapic_t lapic;
135extern volatile ioapic_t **ioapic;
136#endif
137
138/* functions in mpapic.c */
139#if 0
140void apic_dump (char*);
141void apic_initialize (void);
142void imen_dump (void);
143int apic_ipi (int, int, int);
da23a592 144void selected_apic_ipi (cpumask_t, int, int);
da673940
JG
145void single_apic_ipi(int cpu, int vector, int delivery_mode);
146int single_apic_ipi_passive(int cpu, int vector, int delivery_mode);
147int io_apic_setup (int);
148void io_apic_setup_intpin (int, int);
149void io_apic_set_id (int, int);
150int io_apic_get_id (int);
151int ext_int_setup (int, int);
152#endif
153
154#if 0
155void clr_io_apic_mask24 (int, u_int32_t);
156void set_io_apic_mask24 (int, u_int32_t);
157#endif
158
159#if 0
160void set_apic_timer (int);
161int read_apic_timer (void);
162void u_sleep (int);
163#endif
164void cpu_send_ipiq (int);
165int cpu_send_ipiq_passive (int);
166
167/* global data in init_smp.c */
168extern cpumask_t smp_active_mask;
169
9bea6114
MC
170/* Detect CPU topology bits */
171void detect_cpu_topology(void);
172
173/* Interface functions for IDs calculation */
174int get_chip_ID(int cpuid);
175int get_core_number_within_chip(int cpuid);
176int get_logical_CPU_number_within_core(int cpuid);
177
178/* Assume that APICID = CPUID for virtual processors */
179#define get_cpuid_from_apicid(cpuid) cpuid
180#define get_apicid_from_cpuid(cpuid) cpuid
181
da673940
JG
182#endif /* !LOCORE */
183#else /* !SMP */
184
185#define smp_active_mask 1 /* smp_active_mask always 1 on UP machines */
186
187#endif
188
189#endif /* _KERNEL */
190#endif /* _MACHINE_SMP_H_ */