kernel: Make SMP support default (and non-optional).
[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 $
984263bc
MD
10 */
11
12#ifndef _MACHINE_SMP_H_
13#define _MACHINE_SMP_H_
14
15#ifdef _KERNEL
16
984263bc
MD
17#ifndef LOCORE
18
19/*
20 * For sending values to POST displays.
21 * XXX FIXME: where does this really belong, isa.h/isa.c perhaps?
22 */
23extern int current_postcode; /** XXX currently in mp_machdep.c */
24#define POSTCODE(X) current_postcode = (X), \
25 outb(0x80, current_postcode)
26#define POSTCODE_LO(X) current_postcode &= 0xf0, \
27 current_postcode |= ((X) & 0x0f), \
28 outb(0x80, current_postcode)
29#define POSTCODE_HI(X) current_postcode &= 0x0f, \
30 current_postcode |= (((X) << 4) & 0xf0), \
31 outb(0x80, current_postcode)
32
33
a9295349 34#include <machine_base/apic/apicreg.h>
7949232e 35#include <machine/pcb.h>
984263bc
MD
36
37/* global data in mpboot.s */
38extern int bootMP_size;
39
40/* functions in mpboot.s */
3ae0cd58 41void bootMP (void);
984263bc 42
984263bc 43/* global data in apic_vector.s */
da23a592
MD
44extern volatile cpumask_t stopped_cpus;
45extern volatile cpumask_t started_cpus;
984263bc
MD
46
47extern volatile u_int checkstate_probed_cpus;
3ae0cd58 48extern void (*cpustop_restartfunc) (void);
984263bc 49
984263bc
MD
50extern struct pcb stoppcbs[];
51
52/* functions in mp_machdep.c */
3ae0cd58 53u_int mp_bootaddress (u_int);
3ae0cd58
RG
54void mp_start (void);
55void mp_announce (void);
3ae0cd58 56void init_secondary (void);
da23a592 57int stop_cpus (cpumask_t);
3ae0cd58 58void ap_init (void);
da23a592 59int restart_cpus (cpumask_t);
3ae0cd58 60void forward_signal (struct proc *);
984263bc 61
984263bc 62#if defined(READY)
3ae0cd58
RG
63void clr_io_apic_mask24 (int, u_int32_t);
64void set_io_apic_mask24 (int, u_int32_t);
984263bc
MD
65#endif /* READY */
66
3ae0cd58 67void cpu_send_ipiq (int);
41a01a4d 68int cpu_send_ipiq_passive (int);
984263bc
MD
69
70/* global data in init_smp.c */
0f7a3396 71extern cpumask_t smp_active_mask;
984263bc 72
f77c018a
MC
73/* Detect CPU topology bits */
74void detect_cpu_topology(void);
75
76/* Interface functions for IDs calculation */
77int get_chip_ID(int cpuid);
78int get_core_number_within_chip(int cpuid);
79int get_logical_CPU_number_within_core(int cpuid);
80
81#include <machine_base/apic/lapic.h>
82static __inline
83int get_apicid_from_cpuid(int cpuid) {
84 return CPUID_TO_APICID(cpuid);
85}
86static __inline
87int get_cpuid_from_apicid(int cpuid) {
88 return APICID_TO_CPUID(cpuid);
89}
90
984263bc 91#endif /* !LOCORE */
984263bc
MD
92
93#endif /* _KERNEL */
94#endif /* _MACHINE_SMP_H_ */