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