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