kernel - SMP - "Fix AP #%d (PHY# %d) failed" issues
[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
46d4e165 26#if defined(SMP)
b6871f55
YY
27
28#ifndef LOCORE
29
46d4e165
JG
30/*
31 * For sending values to POST displays.
32 * XXX FIXME: where does this really belong, isa.h/isa.c perhaps?
33 */
34extern int current_postcode; /** XXX currently in mp_machdep.c */
35#define POSTCODE(X) current_postcode = (X), \
36 outb(0x80, current_postcode)
37#define POSTCODE_LO(X) current_postcode &= 0xf0, \
38 current_postcode |= ((X) & 0x0f), \
39 outb(0x80, current_postcode)
40#define POSTCODE_HI(X) current_postcode &= 0x0f, \
41 current_postcode |= (((X) << 4) & 0xf0), \
42 outb(0x80, current_postcode)
43
44
45#include <machine_base/apic/apicreg.h>
b6871f55
YY
46#include <machine/pcb.h>
47
48/* global symbols in mpboot.S */
49extern char mptramp_start[];
50extern char mptramp_end[];
51extern u_int32_t mptramp_pagetables;
52
46d4e165
JG
53/* functions in mpboot.s */
54void bootMP (void);
55
56/* global data in apic_vector.s */
57extern volatile u_int stopped_cpus;
58extern volatile u_int started_cpus;
59
60extern volatile u_int checkstate_probed_cpus;
61extern void (*cpustop_restartfunc) (void);
62
63/* functions in apic_ipl.s */
64u_int io_apic_read (int, int);
65void io_apic_write (int, int, u_int);
66
b6871f55 67/* global data in mp_machdep.c */
46d4e165 68extern int bsp_apic_ready;
b6871f55 69extern int mp_naps;
46d4e165
JG
70extern int mp_nbusses;
71extern int mp_napics;
b6871f55 72extern int boot_cpu_id;
46d4e165
JG
73extern vm_offset_t cpu_apic_address;
74extern vm_offset_t io_apic_address[];
75extern u_int32_t cpu_apic_versions[];
76extern u_int32_t *io_apic_versions;
77extern int cpu_num_to_apic_id[];
78extern int io_num_to_apic_id[];
79extern int apic_id_to_logical[];
80#define APIC_INTMAPSIZE 24
81struct apic_intmapinfo {
82 int ioapic;
83 int int_pin;
84 volatile void *apic_address;
85 int redirindex;
86};
87extern struct apic_intmapinfo int_to_apicintpin[];
b6871f55 88extern struct pcb stoppcbs[];
b6871f55
YY
89
90/* functions in mp_machdep.c */
46d4e165
JG
91void *permanent_io_mapping(vm_paddr_t);
92u_int mp_bootaddress (u_int);
93int mp_probe (void);
94void mp_start (void);
95void mp_announce (void);
96u_int isa_apic_mask (u_int);
97int isa_apic_irq (int);
98int pci_apic_irq (int, int, int);
99int apic_irq (int, int);
100int next_apic_irq (int);
101int undirect_isa_irq (int);
102int undirect_pci_irq (int);
103int apic_bus_type (int);
104int apic_src_bus_id (int, int);
105int apic_src_bus_irq (int, int);
106int apic_int_type (int, int);
107int apic_trigger (int, int);
108int apic_polarity (int, int);
109void assign_apic_irq (int apic, int intpin, int irq);
110void revoke_apic_irq (int irq);
111void init_secondary (void);
112int stop_cpus (u_int);
113void ap_init (void);
114int restart_cpus (u_int);
115void forward_signal (struct proc *);
116
117/* global data in mpapic.c */
118extern volatile lapic_t *lapic;
119extern volatile ioapic_t **ioapic;
120
121/* functions in mpapic.c */
122void apic_dump (char*);
123void apic_initialize (boolean_t);
124void imen_dump (void);
125int apic_ipi (int, int, int);
126void selected_apic_ipi (u_int, int, int);
127void single_apic_ipi(int cpu, int vector, int delivery_mode);
128int single_apic_ipi_passive(int cpu, int vector, int delivery_mode);
129int io_apic_setup (int);
130void io_apic_setup_intpin (int, int);
131void io_apic_set_id (int, int);
132int io_apic_get_id (int);
133int ext_int_setup (int, int);
134
135#if defined(READY)
136void clr_io_apic_mask24 (int, u_int32_t);
137void set_io_apic_mask24 (int, u_int32_t);
138#endif /* READY */
139
140void set_apic_timer (int);
bb467734 141int get_apic_timer_frequency(void);
46d4e165
JG
142int read_apic_timer (void);
143void u_sleep (int);
144void cpu_send_ipiq (int);
145int cpu_send_ipiq_passive (int);
146
147/* global data in init_smp.c */
148extern cpumask_t smp_active_mask;
b6871f55
YY
149
150#endif /* !LOCORE */
46d4e165 151#else /* !SMP */
b6871f55 152
46d4e165 153#define smp_active_mask 1 /* smp_active_mask always 1 on UP machines */
b6871f55 154
46d4e165 155#endif
b6871f55
YY
156
157#endif /* _KERNEL */
158#endif /* _MACHINE_SMP_H_ */