x86_64: Move ioapic function declarations from smp.h to apic/ioapic.h
[dragonfly.git] / sys / platform / pc64 / include / smp.h
CommitLineData
46d4e165 1/*
b6871f55
YY
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 *
46d4e165
JG
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/pc32/include/smp.h,v 1.20 2006/11/07 06:43:24 dillon Exp $
b6871f55
YY
11 *
12 */
13
14#ifndef _MACHINE_SMP_H_
15#define _MACHINE_SMP_H_
16
17#ifdef _KERNEL
18
6e738e4e
SS
19#ifndef LOCORE
20
21/* XXX wrong header */
22void initializecpu(void);
23
24#endif /* LOCORE */
25
2b6cd37e
SZ
26/*
27 * Size of APIC ID list.
28 * Also used a MAX size of various other arrays.
29 */
30#define NAPICID 256
31
46d4e165 32#if defined(SMP)
b6871f55
YY
33
34#ifndef LOCORE
35
46d4e165
JG
36/*
37 * For sending values to POST displays.
38 * XXX FIXME: where does this really belong, isa.h/isa.c perhaps?
39 */
40extern int current_postcode; /** XXX currently in mp_machdep.c */
41#define POSTCODE(X) current_postcode = (X), \
42 outb(0x80, current_postcode)
43#define POSTCODE_LO(X) current_postcode &= 0xf0, \
44 current_postcode |= ((X) & 0x0f), \
45 outb(0x80, current_postcode)
46#define POSTCODE_HI(X) current_postcode &= 0x0f, \
47 current_postcode |= (((X) << 4) & 0xf0), \
48 outb(0x80, current_postcode)
49
50
51#include <machine_base/apic/apicreg.h>
b6871f55
YY
52#include <machine/pcb.h>
53
54/* global symbols in mpboot.S */
55extern char mptramp_start[];
56extern char mptramp_end[];
57extern u_int32_t mptramp_pagetables;
58
46d4e165
JG
59/* functions in mpboot.s */
60void bootMP (void);
61
62/* global data in apic_vector.s */
da23a592
MD
63extern volatile cpumask_t stopped_cpus;
64extern volatile cpumask_t started_cpus;
46d4e165
JG
65
66extern volatile u_int checkstate_probed_cpus;
67extern void (*cpustop_restartfunc) (void);
68
b6871f55 69/* global data in mp_machdep.c */
9d758cc4 70extern int imcr_present;
faaf4131 71extern int apic_io_enable;
b6871f55 72extern int mp_naps;
46d4e165 73extern u_int32_t cpu_apic_versions[];
46d4e165 74extern int cpu_num_to_apic_id[];
46d4e165 75extern int apic_id_to_logical[];
ea60dfd6 76
c571da4a 77#define APIC_INTMAPSIZE 192
4ceff811
SZ
78/*
79 * NOTE:
80 * - Keep size of apic_intmapinfo power of 2
81 * - Update IOAPIC_IM_SZSHIFT after changing apic_intmapinfo size
82 */
46d4e165
JG
83struct apic_intmapinfo {
84 int ioapic;
85 int int_pin;
86 volatile void *apic_address;
4ceff811
SZ
87 int redirindex;
88 uint32_t flags; /* IOAPIC_IM_FLAG_ */
89 uint32_t pad[2];
46d4e165 90};
4ceff811 91#define IOAPIC_IM_SZSHIFT 5
54d63b2f 92
dfeaac88
SZ
93#define IOAPIC_IM_FLAG_LEVEL 0x1 /* default to edge trigger */
94#define IOAPIC_IM_FLAG_MASKED 0x2
54d63b2f 95
46d4e165 96extern struct apic_intmapinfo int_to_apicintpin[];
b6871f55 97extern struct pcb stoppcbs[];
b6871f55
YY
98
99/* functions in mp_machdep.c */
01616f8b 100void *ioapic_map(vm_paddr_t);
46d4e165 101u_int mp_bootaddress (u_int);
46d4e165
JG
102void mp_start (void);
103void mp_announce (void);
40d323b6 104void mp_set_cpuids (int, int);
46d4e165 105void init_secondary (void);
da23a592 106int stop_cpus (cpumask_t);
46d4e165 107void ap_init (void);
da23a592 108int restart_cpus (cpumask_t);
46d4e165 109void forward_signal (struct proc *);
e90e7ac4
SZ
110int mptable_pci_int_route(int, int, int, int);
111void mptable_pci_int_dump(void);
46d4e165 112
46d4e165
JG
113#if defined(READY)
114void clr_io_apic_mask24 (int, u_int32_t);
115void set_io_apic_mask24 (int, u_int32_t);
116#endif /* READY */
117
46d4e165
JG
118void cpu_send_ipiq (int);
119int cpu_send_ipiq_passive (int);
120
121/* global data in init_smp.c */
122extern cpumask_t smp_active_mask;
b6871f55
YY
123
124#endif /* !LOCORE */
46d4e165 125#else /* !SMP */
b6871f55 126
46d4e165 127#define smp_active_mask 1 /* smp_active_mask always 1 on UP machines */
b6871f55 128
46d4e165 129#endif
b6871f55
YY
130
131#endif /* _KERNEL */
132#endif /* _MACHINE_SMP_H_ */