Deleted Added
full compact
smp.h (112993) smp.h (114349)
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 *
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: head/sys/amd64/include/smp.h 112993 2003-04-02 23:53:30Z peter $
9 * $FreeBSD: head/sys/amd64/include/smp.h 114349 2003-05-01 01:05:25Z peter $
10 *
11 */
12
13#ifndef _MACHINE_SMP_H_
14#define _MACHINE_SMP_H_
15
10 *
11 */
12
13#ifndef _MACHINE_SMP_H_
14#define _MACHINE_SMP_H_
15
16#ifdef _KERNEL
17
18#if defined(SMP) && defined(I386_CPU) && !defined(COMPILING_LINT)
19#error SMP not supported with I386_CPU
20#endif
21#if defined(SMP) && !defined(APIC_IO)
22# error APIC_IO required for SMP, add "options APIC_IO" to your config file.
23#endif /* SMP && !APIC_IO */
24#if defined(SMP) && defined(CPU_DISABLE_CMPXCHG) && !defined(COMPILING_LINT)
25#error SMP not supported with CPU_DISABLE_CMPXCHG
26#endif
27
28#if defined(SMP) || defined(APIC_IO)
29
30#ifndef LOCORE
31
32/*
33 * For sending values to POST displays.
34 * XXX FIXME: where does this really belong, isa.h/isa.c perhaps?
35 */
36extern int current_postcode; /** XXX currently in mp_machdep.c */
37#define POSTCODE(X) current_postcode = (X), \
38 outb(0x80, current_postcode)
39#define POSTCODE_LO(X) current_postcode &= 0xf0, \
40 current_postcode |= ((X) & 0x0f), \
41 outb(0x80, current_postcode)
42#define POSTCODE_HI(X) current_postcode &= 0x0f, \
43 current_postcode |= (((X) << 4) & 0xf0), \
44 outb(0x80, current_postcode)
45
46
47#include <sys/bus.h> /* XXX */
48#include <machine/apic.h>
49#include <machine/frame.h>
50#include <i386/isa/icu.h>
51#include <i386/isa/intr_machdep.h>
52
53/*
54 * Interprocessor interrupts for SMP.
55 */
56#define IPI_INVLTLB XINVLTLB_OFFSET
57#define IPI_INVLPG XINVLPG_OFFSET
58#define IPI_INVLRNG XINVLRNG_OFFSET
59#define IPI_LAZYPMAP XLAZYPMAP_OFFSET
60#define IPI_RENDEZVOUS XRENDEZVOUS_OFFSET
61#define IPI_AST XCPUAST_OFFSET
62#define IPI_STOP XCPUSTOP_OFFSET
63#define IPI_HARDCLOCK XHARDCLOCK_OFFSET
64#define IPI_STATCLOCK XSTATCLOCK_OFFSET
65
66/* global data in mpboot.s */
67extern int bootMP_size;
68
69/* functions in mpboot.s */
70void bootMP(void);
71
72/* global data in mp_machdep.c */
73extern int bsp_apic_ready;
74extern int mp_naps;
75extern int mp_nbusses;
76extern int mp_napics;
77extern int mp_picmode;
78extern int boot_cpu_id;
79extern vm_offset_t cpu_apic_address;
80extern vm_offset_t io_apic_address[];
81extern u_int32_t cpu_apic_versions[];
82extern u_int32_t *io_apic_versions;
83extern int cpu_num_to_apic_id[];
84extern int io_num_to_apic_id[];
85extern int apic_id_to_logical[];
86#define APIC_INTMAPSIZE 32
87struct apic_intmapinfo {
88 int ioapic;
89 int int_pin;
90 volatile void *apic_address;
91 int redirindex;
92};
93extern struct apic_intmapinfo int_to_apicintpin[];
94extern struct pcb stoppcbs[];
95
96/* functions in mp_machdep.c */
97void i386_mp_probe(void);
98u_int mp_bootaddress(u_int);
99u_int isa_apic_mask(u_int);
100int isa_apic_irq(int);
101int pci_apic_irq(int, int, int);
102int apic_irq(int, int);
103int next_apic_irq(int);
104int undirect_isa_irq(int);
105int undirect_pci_irq(int);
106int apic_bus_type(int);
107int apic_src_bus_id(int, int);
108int apic_src_bus_irq(int, int);
109int apic_int_type(int, int);
110int apic_trigger(int, int);
111int apic_polarity(int, int);
112int mp_grab_cpu_hlt(void);
113void assign_apic_irq(int apic, int intpin, int irq);
114void revoke_apic_irq(int irq);
115void bsp_apic_configure(void);
116void init_secondary(void);
117void forward_statclock(void);
118void forwarded_statclock(struct clockframe frame);
119void forward_hardclock(void);
120void forwarded_hardclock(struct clockframe frame);
121void ipi_selected(u_int cpus, u_int ipi);
122void ipi_all(u_int ipi);
123void ipi_all_but_self(u_int ipi);
124void ipi_self(u_int ipi);
125#ifdef APIC_INTR_REORDER
126void set_lapic_isrloc(int, int);
127#endif /* APIC_INTR_REORDER */
128void smp_invlpg(vm_offset_t addr);
129void smp_masked_invlpg(u_int mask, vm_offset_t addr);
130void smp_invlpg_range(vm_offset_t startva, vm_offset_t endva);
131void smp_masked_invlpg_range(u_int mask, vm_offset_t startva,
132 vm_offset_t endva);
133void smp_invltlb(void);
134void smp_masked_invltlb(u_int mask);
135
136/* global data in mpapic.c */
137extern volatile lapic_t lapic;
138extern volatile ioapic_t **ioapic;
139
140/* functions in mpapic.c */
141void apic_dump(char*);
142void apic_initialize(void);
143void imen_dump(void);
144int apic_ipi(int, int, int);
145int selected_apic_ipi(u_int, int, int);
146int io_apic_setup(int);
147void io_apic_setup_intpin(int, int);
148void io_apic_set_id(int, int);
149int io_apic_get_id(int);
150int ext_int_setup(int, int);
151
152void set_apic_timer(int);
153int read_apic_timer(void);
154void u_sleep(int);
155u_int io_apic_read(int, int);
156void io_apic_write(int, int, u_int);
157
158#endif /* !LOCORE */
159#endif /* SMP && !APIC_IO */
160
161#endif /* _KERNEL */
162#endif /* _MACHINE_SMP_H_ */
16#endif /* _MACHINE_SMP_H_ */