* Remove a procedural layer in the scheduler clock code by having
[dragonfly.git] / sys / i386 / include / smp.h
... / ...
CommitLineData
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 $
10 * $DragonFly: src/sys/i386/include/Attic/smp.h,v 1.12 2005/06/27 18:37:55 dillon Exp $
11 *
12 */
13
14#ifndef _MACHINE_SMP_H_
15#define _MACHINE_SMP_H_
16
17#ifdef _KERNEL
18
19#if defined(SMP) && !defined(APIC_IO)
20# error APIC_IO required for SMP, add "options APIC_IO" to your config file.
21#endif /* SMP && !APIC_IO */
22
23#if defined(SMP) || defined(APIC_IO)
24
25#ifndef LOCORE
26
27/*
28 * For sending values to POST displays.
29 * XXX FIXME: where does this really belong, isa.h/isa.c perhaps?
30 */
31extern int current_postcode; /** XXX currently in mp_machdep.c */
32#define POSTCODE(X) current_postcode = (X), \
33 outb(0x80, current_postcode)
34#define POSTCODE_LO(X) current_postcode &= 0xf0, \
35 current_postcode |= ((X) & 0x0f), \
36 outb(0x80, current_postcode)
37#define POSTCODE_HI(X) current_postcode &= 0x0f, \
38 current_postcode |= (((X) << 4) & 0xf0), \
39 outb(0x80, current_postcode)
40
41
42#include "apicreg.h"
43
44/* global data in mpboot.s */
45extern int bootMP_size;
46
47/* functions in mpboot.s */
48void bootMP (void);
49
50/* global data in apic_vector.s */
51extern volatile u_int stopped_cpus;
52extern volatile u_int started_cpus;
53
54extern volatile u_int checkstate_probed_cpus;
55extern void (*cpustop_restartfunc) (void);
56
57/* functions in apic_ipl.s */
58void apic_eoi (void);
59u_int io_apic_read (int, int);
60void io_apic_write (int, int, u_int);
61
62/* global data in mp_machdep.c */
63extern int bsp_apic_ready;
64extern int mp_naps;
65extern int mp_nbusses;
66extern int mp_napics;
67extern int mp_picmode;
68extern int boot_cpu_id;
69extern vm_offset_t cpu_apic_address;
70extern vm_offset_t io_apic_address[];
71extern u_int32_t cpu_apic_versions[];
72extern u_int32_t *io_apic_versions;
73extern int cpu_num_to_apic_id[];
74extern int io_num_to_apic_id[];
75extern int apic_id_to_logical[];
76#define APIC_INTMAPSIZE 24
77struct apic_intmapinfo {
78 int ioapic;
79 int int_pin;
80 volatile void *apic_address;
81 int redirindex;
82};
83extern struct apic_intmapinfo int_to_apicintpin[];
84extern struct pcb stoppcbs[];
85
86/* functions in mp_machdep.c */
87u_int mp_bootaddress (u_int);
88int mp_probe (void);
89void mp_start (void);
90void mp_announce (void);
91u_int isa_apic_mask (u_int);
92int isa_apic_irq (int);
93int pci_apic_irq (int, int, int);
94int apic_irq (int, int);
95int next_apic_irq (int);
96int undirect_isa_irq (int);
97int undirect_pci_irq (int);
98int apic_bus_type (int);
99int apic_src_bus_id (int, int);
100int apic_src_bus_irq (int, int);
101int apic_int_type (int, int);
102int apic_trigger (int, int);
103int apic_polarity (int, int);
104void assign_apic_irq (int apic, int intpin, int irq);
105void revoke_apic_irq (int irq);
106void bsp_apic_configure (void);
107void init_secondary (void);
108int stop_cpus (u_int);
109void ap_init (void);
110int restart_cpus (u_int);
111void forward_signal (struct proc *);
112#ifdef APIC_INTR_REORDER
113void set_lapic_isrloc (int, int);
114#endif /* APIC_INTR_REORDER */
115void smp_rendezvous_action (void);
116void smp_rendezvous (void (*)(void *),
117 void (*)(void *),
118 void (*)(void *),
119 void *arg);
120
121/* global data in mpapic.c */
122extern volatile lapic_t lapic;
123extern volatile ioapic_t **ioapic;
124
125/* functions in mpapic.c */
126void apic_dump (char*);
127void apic_initialize (void);
128void imen_dump (void);
129int apic_ipi (int, int, int);
130void selected_apic_ipi (u_int, int, int);
131void single_apic_ipi(int cpu, int vector, int delivery_mode);
132int single_apic_ipi_passive(int cpu, int vector, int delivery_mode);
133int io_apic_setup (int);
134void io_apic_setup_intpin (int, int);
135void io_apic_set_id (int, int);
136int io_apic_get_id (int);
137int ext_int_setup (int, int);
138
139#if defined(READY)
140void clr_io_apic_mask24 (int, u_int32_t);
141void set_io_apic_mask24 (int, u_int32_t);
142#endif /* READY */
143
144void set_apic_timer (int);
145int read_apic_timer (void);
146void u_sleep (int);
147void cpu_send_ipiq (int);
148int cpu_send_ipiq_passive (int);
149
150/* global data in init_smp.c */
151extern cpumask_t smp_active_mask;
152
153#endif /* !LOCORE */
154#else /* !SMP && !APIC_IO */
155
156#define smp_active_mask 1 /* smp_active_mask always 1 on UP machines */
157
158#endif
159
160#endif /* _KERNEL */
161#endif /* _MACHINE_SMP_H_ */