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/07/13 00:26:07 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 */ 32 extern 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 */ 46 extern int bootMP_size; 47 48 /* functions in mpboot.s */ 49 void bootMP __P((void)); 50 51 /* global data in mplock.s */ 52 extern u_int mp_lock; 53 54 /* functions in mplock.s */ 55 void get_mplock __P((void)); 56 void rel_mplock __P((void)); 57 void try_mplock __P((void)); 58 59 /* global data in apic_vector.s */ 60 extern volatile u_int stopped_cpus; 61 extern volatile u_int started_cpus; 62 63 /* global data in mp_machdep.c */ 64 extern int mp_ncpus; 65 extern int mp_naps; 66 extern int mp_nbusses; 67 extern int mp_napics; 68 extern int mp_picmode; 69 extern int boot_cpu_id; 70 extern vm_offset_t cpu_apic_address; 71 extern vm_offset_t io_apic_address[]; 72 extern u_int32_t cpu_apic_versions[]; 73 extern u_int32_t io_apic_versions[]; 74 extern int cpu_num_to_apic_id[]; 75 extern int io_num_to_apic_id[]; 76 extern int apic_id_to_logical[]; 77 extern u_int all_cpus; 78 extern u_int SMP_prvpt[]; 79 extern u_char SMP_ioapic[]; 80 81 /* functions in mp_machdep.c */ 82 u_int mp_bootaddress __P((u_int)); 83 int mp_probe __P((void)); 84 void mp_start __P((void)); 85 void mp_announce __P((void)); 86 u_int isa_apic_mask __P((u_int)); 87 int isa_apic_pin __P((int)); 88 int pci_apic_pin __P((int, int, int)); 89 int undirect_isa_irq __P((int)); 90 int undirect_pci_irq __P((int)); 91 int apic_bus_type __P((int)); 92 int apic_src_bus_id __P((int, int)); 93 int apic_src_bus_irq __P((int, int)); 94 int apic_int_type __P((int, int)); 95 int apic_trigger __P((int, int)); 96 int apic_polarity __P((int, int)); 97 void bsp_apic_configure __P((void)); 98 void init_secondary __P((void)); 99 void smp_invltlb __P((void)); 100 int stop_cpus __P((u_int)); 101 int restart_cpus __P((u_int)); 102 103 /* global data in mpapic.c */ 104 extern volatile lapic_t lapic; 105 106 #if defined(MULTIPLE_IOAPICS) 107 #error MULTIPLE_IOAPICSXXX 108 #else 109 extern volatile ioapic_t *ioapic[]; 110 #endif /* MULTIPLE_IOAPICS */ 111 112 /* functions in mpapic.c */ 113 void apic_dump __P((void)); 114 void apic_initialize __P((void)); 115 int apic_ipi __P((int, int, int)); 116 int selected_apic_ipi __P((u_int, int, int)); 117 int io_apic_setup __P((int)); 118 int ext_int_setup __P((int, int)); 119 void write_io_apic_mask24 __P((int, u_int32_t)); 120 121 #if defined(READY) 122 void clr_io_apic_mask24 __P((int, u_int32_t)); 123 void set_io_apic_mask24 __P((int, u_int32_t)); 124 #endif /* READY */ 125 126 void set_apic_timer __P((int)); 127 int read_apic_timer __P((void)); 128 void u_sleep __P((int)); 129 130 /* global data in init_smp.c */ 131 extern int smp_active; 132 extern int invltlb_ok; 133 134 /* 'private' global data in locore.s */ 135 extern volatile u_int cpuid; 136 extern volatile u_int cpu_lockid; 137 extern volatile u_int other_cpus; 138 139 #endif /* SMP || APIC_IO */ 140 #endif /* KERNEL */ 141 #endif /* _MACHINE_SMP_H_ */ 142