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