smp.h revision 27663
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 * $Id: smp.h,v 1.20 1997/07/23 20:42:16 fsmp Exp $ 10 * 11 */ 12 13#ifndef _MACHINE_SMP_H_ 14#define _MACHINE_SMP_H_ 15 16#ifdef KERNEL 17 18#if defined(SMP) && !defined(APIC_IO) 19# error APIC_IO required for SMP, add "options APIC_IO" to your config file. 20#endif /* SMP && !APIC_IO */ 21 22#if defined(SMP) && !defined(NCPU) 23# define NCPU 2 24#endif /* SMP && NCPU */ 25 26#if defined(SMP) || defined(APIC_IO) 27 28/* 29 * For sending values to POST displays. 30 * XXX FIXME: where does this really belong, isa.h/isa.c perhaps? 31 */ 32extern int current_postcode; /** XXX currently in mp_machdep.c */ 33#define POSTCODE(X) current_postcode = (X), \ 34 outb(0x80, current_postcode) 35#define POSTCODE_LO(X) current_postcode &= 0xf0, \ 36 current_postcode |= ((X) & 0x0f), \ 37 outb(0x80, current_postcode) 38#define POSTCODE_HI(X) current_postcode &= 0x0f, \ 39 current_postcode |= (((X) << 4) & 0xf0), \ 40 outb(0x80, current_postcode) 41 42 43#include <machine/apic.h> 44 45/* global data in mpboot.s */ 46extern int bootMP_size; 47 48/* functions in mpboot.s */ 49void bootMP __P((void)); 50 51/* global data in mplock.s */ 52extern u_int mp_lock; 53 54/* functions in mplock.s */ 55void get_mplock __P((void)); 56void rel_mplock __P((void)); 57void try_mplock __P((void)); 58 59/* global data in apic_vector.s */ 60extern u_int ivectors[]; 61extern volatile u_int stopped_cpus; 62extern volatile u_int started_cpus; 63 64/* global data in apic_ipl.s */ 65extern u_int vec[]; 66extern u_int Xintr8254; 67extern u_int mask8254; 68extern struct simple_lock imen_lock; 69 70/* functions in apic_ipl.s */ 71void vec8254 __P((void)); 72void INTREN __P((u_int)); 73void INTRDIS __P((u_int)); 74void apic_eoi __P((void)); 75u_int io_apic_read __P((int, int)); 76void io_apic_write __P((int, int, u_int)); 77 78/* functions in simplelock.s */ 79#include <machine/param.h> 80void s_lock_init __P((struct simplelock *)); 81void s_lock __P((__volatile struct simplelock *)); 82int s_lock_try __P((__volatile struct simplelock *)); 83void s_unlock __P((__volatile struct simplelock *)); 84 85/* global data in mp_machdep.c */ 86extern int mp_ncpus; 87extern int mp_naps; 88extern int mp_nbusses; 89extern int mp_napics; 90extern int mp_picmode; 91extern int boot_cpu_id; 92extern vm_offset_t cpu_apic_address; 93extern vm_offset_t io_apic_address[]; 94extern u_int32_t cpu_apic_versions[]; 95extern u_int32_t io_apic_versions[]; 96extern int cpu_num_to_apic_id[]; 97extern int io_num_to_apic_id[]; 98extern int apic_id_to_logical[]; 99extern u_int all_cpus; 100extern u_int SMP_prvpt[]; 101extern u_char SMP_ioapic[]; 102 103/* functions in mp_machdep.c */ 104u_int mp_bootaddress __P((u_int)); 105int mp_probe __P((void)); 106void mp_start __P((void)); 107void mp_announce __P((void)); 108u_int isa_apic_mask __P((u_int)); 109int isa_apic_pin __P((int)); 110int pci_apic_pin __P((int, int, int)); 111int undirect_isa_irq __P((int)); 112int undirect_pci_irq __P((int)); 113int apic_bus_type __P((int)); 114int apic_src_bus_id __P((int, int)); 115int apic_src_bus_irq __P((int, int)); 116int apic_int_type __P((int, int)); 117int apic_trigger __P((int, int)); 118int apic_polarity __P((int, int)); 119void bsp_apic_configure __P((void)); 120void init_secondary __P((void)); 121void smp_invltlb __P((void)); 122int stop_cpus __P((u_int)); 123int restart_cpus __P((u_int)); 124 125/* global data in mpapic.c */ 126extern volatile lapic_t lapic; 127 128#if defined(MULTIPLE_IOAPICS) 129#error MULTIPLE_IOAPICSXXX 130#else 131extern volatile ioapic_t *ioapic[]; 132#endif /* MULTIPLE_IOAPICS */ 133 134/* functions in mpapic.c */ 135void apic_dump __P((char*)); 136void apic_initialize __P((void)); 137void imen_dump __P((void)); 138int apic_ipi __P((int, int, int)); 139int selected_apic_ipi __P((u_int, int, int)); 140int io_apic_setup __P((int)); 141int ext_int_setup __P((int, int)); 142 143#if defined(READY) 144void clr_io_apic_mask24 __P((int, u_int32_t)); 145void set_io_apic_mask24 __P((int, u_int32_t)); 146#endif /* READY */ 147 148void set_apic_timer __P((int)); 149int read_apic_timer __P((void)); 150void u_sleep __P((int)); 151 152/* global data in init_smp.c */ 153extern int smp_active; 154extern int invltlb_ok; 155 156/* 'private' global data in locore.s */ 157extern volatile u_int cpuid; 158extern volatile u_int cpu_lockid; 159extern volatile u_int other_cpus; 160 161#endif /* SMP || APIC_IO */ 162#endif /* KERNEL */ 163#endif /* _MACHINE_SMP_H_ */ 164