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