smp.h revision 26269
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.9 1997/05/28 18:44:11 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 && NCPU */ 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#include <machine/apic.h> 29 30/* global data in mpboot.s */ 31extern int bootMP_size; 32 33/* functions in mpboot.s */ 34void bootMP __P((void)); 35 36/* global data in mplock.s */ 37extern u_int mp_lock; 38 39/* functions in mplock.s */ 40void get_mplock __P((void)); 41void rel_mplock __P((void)); 42void try_mplock __P((void)); 43 44/* global data in mp_machdep.c */ 45extern int mp_ncpus; 46extern int mp_naps; 47extern int mp_nbusses; 48extern int mp_napics; 49extern int mp_picmode; 50extern int mpenabled; 51extern int boot_cpu_id; 52extern vm_offset_t cpu_apic_address; 53extern vm_offset_t io_apic_address[]; 54extern u_int32_t cpu_apic_versions[]; 55extern u_int32_t io_apic_versions[]; 56extern int cpu_num_to_apic_id[]; 57extern int io_num_to_apic_id[]; 58extern int apic_id_to_logical[]; 59 60/* functions in mp_machdep.c */ 61u_int mp_bootaddress __P((u_int)); 62int mp_probe __P((void)); 63void mp_start __P((void)); 64void mp_announce __P((void)); 65int get_isa_apic_irq __P((int)); 66u_int get_isa_apic_mask __P((u_int)); 67int undirect_isa_irq __P((int)); 68int get_eisa_apic_irq __P((int)); 69int get_pci_apic_irq __P((int, int, int)); 70int undirect_pci_irq __P((int)); 71int apic_bus_type __P((int)); 72int apic_src_bus_id __P((int, int)); 73int apic_src_bus_irq __P((int, int)); 74int apic_int_type __P((int, int)); 75int apic_trigger __P((int, int)); 76int apic_polarity __P((int, int)); 77void configure_local_apic __P((void)); 78void init_secondary __P((void)); 79void smp_invltlb __P((void)); 80 81/* global data in mpapic.c */ 82extern volatile u_int* apic_base; 83#if 1 /** XXX APIC_STRUCT */ 84extern volatile lapic_t* lapic; 85#endif /** XXX APIC_STRUCT */ 86 87#if defined(MULTIPLE_IOAPICS) 88#error MULTIPLE_IOAPICSXXX 89#else 90extern volatile u_int* io_apic_base; 91#if 1 /** XXX APIC_STRUCT */ 92extern volatile ioapic_t* ioapic; 93#endif /** XXX APIC_STRUCT */ 94#endif /* MULTIPLE_IOAPICS */ 95 96/* functions in mpapic.c */ 97void apic_initialize __P((int)); 98int apic_ipi __P((int, int, int)); 99int selected_apic_ipi __P((u_int, int, int)); 100int io_apic_setup __P((int)); 101int ext_int_setup __P((int, int)); 102void write_io_apic_mask24 __P((int, u_int32_t)); 103 104#if defined(READY) 105void clr_io_apic_mask24 __P((int, u_int32_t)); 106void set_io_apic_mask24 __P((int, u_int32_t)); 107#endif /* READY */ 108 109void set_apic_timer __P((int)); 110int read_apic_timer __P((void)); 111void u_sleep __P((int)); 112 113/* global data in init_smp.c */ 114extern int smp_active; 115extern int invltlb_ok; 116 117/* in pmap.c FIXME: belongs in pmap.h??? */ 118void pmap_bootstrap_apics __P((void)); 119void pmap_bootstrap2 __P((void)); 120 121#if 0 122/* chicken and egg problem... */ 123static __inline unsigned 124cpunumber(void) 125{ 126 return (unsigned)ID_TO_CPU((apic_base[APIC_ID] & APIC_ID_MASK) >> 24); 127} 128#else 129/* 130 * we 'borrow' this info from apic.h 131 * this will go away soon... 132 */ 133static __inline unsigned 134cpunumber(void) 135{ 136#if 0 137 return (unsigned)(apic_id_to_logical[(apic_base[8] & 0x0f000000) >> 24]); 138#else 139 return (unsigned)(apic_id_to_logical[(lapic__id & 0x0f000000) >> 24]); 140#endif 141} 142#endif /* 0 */ 143 144#endif /* SMP || APIC_IO */ 145#endif /* KERNEL */ 146#endif /* _MACHINE_SMP_H_ */ 147