smp.h revision 27619
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.14 1997/07/23 05:41:55 smp Exp smp $ 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; 68 69/* functions in apic_ipl.s */ 70void vec8254 __P((void)); 71void INTREN __P((u_int)); 72void INTRDIS __P((u_int)); 73void apic_eoi __P((void)); 74u_int io_apic_read __P((int, int)); 75void io_apic_write __P((int, int, u_int)); 76void write_io_apic_mask24 __P((int, u_int)); 77 78#include <machine/param.h> 79void s_lock_init __P((struct simplelock *)); 80void s_lock __P((__volatile struct simplelock *)); 81int s_lock_try __P((__volatile struct simplelock *)); 82void s_unlock __P((__volatile struct simplelock *)); 83 84/* global data in mp_machdep.c */ 85extern int mp_ncpus; 86extern int mp_naps; 87extern int mp_nbusses; 88extern int mp_napics; 89extern int mp_picmode; 90extern int boot_cpu_id; 91extern vm_offset_t cpu_apic_address; 92extern vm_offset_t io_apic_address[]; 93extern u_int32_t cpu_apic_versions[]; 94extern u_int32_t io_apic_versions[]; 95extern int cpu_num_to_apic_id[]; 96extern int io_num_to_apic_id[]; 97extern int apic_id_to_logical[]; 98extern u_int all_cpus; 99extern u_int SMP_prvpt[]; 100extern u_char SMP_ioapic[]; 101 102/* functions in mp_machdep.c */ 103u_int mp_bootaddress __P((u_int)); 104int mp_probe __P((void)); 105void mp_start __P((void)); 106void mp_announce __P((void)); 107u_int isa_apic_mask __P((u_int)); 108int isa_apic_pin __P((int)); 109int pci_apic_pin __P((int, int, int)); 110int undirect_isa_irq __P((int)); 111int undirect_pci_irq __P((int)); 112int apic_bus_type __P((int)); 113int apic_src_bus_id __P((int, int)); 114int apic_src_bus_irq __P((int, int)); 115int apic_int_type __P((int, int)); 116int apic_trigger __P((int, int)); 117int apic_polarity __P((int, int)); 118void bsp_apic_configure __P((void)); 119void init_secondary __P((void)); 120void smp_invltlb __P((void)); 121int stop_cpus __P((u_int)); 122int restart_cpus __P((u_int)); 123 124/* global data in mpapic.c */ 125extern volatile lapic_t lapic; 126 127#if defined(MULTIPLE_IOAPICS) 128#error MULTIPLE_IOAPICSXXX 129#else 130extern volatile ioapic_t *ioapic[]; 131#endif /* MULTIPLE_IOAPICS */ 132 133/* functions in mpapic.c */ 134void apic_dump __P((char*)); 135void apic_initialize __P((void)); 136void imen_dump __P((void)); 137int apic_ipi __P((int, int, int)); 138int selected_apic_ipi __P((u_int, int, int)); 139int io_apic_setup __P((int)); 140int ext_int_setup __P((int, int)); 141 142#if defined(READY) 143void clr_io_apic_mask24 __P((int, u_int32_t)); 144void set_io_apic_mask24 __P((int, u_int32_t)); 145#endif /* READY */ 146 147void set_apic_timer __P((int)); 148int read_apic_timer __P((void)); 149void u_sleep __P((int)); 150 151/* global data in init_smp.c */ 152extern int smp_active; 153extern int invltlb_ok; 154 155/* 'private' global data in locore.s */ 156extern volatile u_int cpuid; 157extern volatile u_int cpu_lockid; 158extern volatile u_int other_cpus; 159 160#endif /* SMP || APIC_IO */ 161#endif /* KERNEL */ 162#endif /* _MACHINE_SMP_H_ */ 163