smp.h revision 27351
1132215Snjl/* 2140469Simp * ---------------------------------------------------------------------------- 3131767Simp * "THE BEER-WARE LICENSE" (Revision 42): 4131767Simp * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you 5131767Simp * can do whatever you want with this stuff. If we meet some day, and you think 6131767Simp * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 7131767Simp * ---------------------------------------------------------------------------- 8131767Simp * 9140040Simp * $Id: smp.h,v 1.7 1997/07/13 00:26:07 smp Exp smp $ 10131767Simp * 11140040Simp */ 12140040Simp 13131767Simp#ifndef _MACHINE_SMP_H_ 14131767Simp#define _MACHINE_SMP_H_ 15131767Simp 16131767Simp#ifdef KERNEL 17140040Simp 18140040Simp#if defined(SMP) && !defined(APIC_IO) 19131767Simp# error APIC_IO required for SMP, add "options APIC_IO" to your config file. 20131767Simp#endif /* SMP && !APIC_IO */ 21131767Simp 22131767Simp#if defined(SMP) && !defined(NCPU) 23131767Simp# define NCPU 2 24131767Simp#endif /* SMP && NCPU */ 25131767Simp 26131767Simp#if defined(SMP) || defined(APIC_IO) 27131767Simp 28131767Simp/* 29131767Simp * For sending values to POST displays. 30131767Simp * XXX FIXME: where does this really belong, isa.h/isa.c perhaps? 31134081Sphk */ 32131767Simpextern int current_postcode; /** XXX currently in mp_machdep.c */ 33131767Simp#define POSTCODE(X) current_postcode = (X), \ 34131767Simp outb(0x80, current_postcode) 35131767Simp#define POSTCODE_LO(X) current_postcode &= 0xf0, \ 36131767Simp current_postcode |= ((X) & 0x0f), \ 37131767Simp outb(0x80, current_postcode) 38134081Sphk#define POSTCODE_HI(X) current_postcode &= 0x0f, \ 39131767Simp current_postcode |= (((X) << 4) & 0xf0), \ 40131767Simp outb(0x80, current_postcode) 41131767Simp 42134081Sphk 43131767Simp#include <machine/apic.h> 44131767Simp 45131767Simp/* global data in mpboot.s */ 46140469Simpextern int bootMP_size; 47140469Simp 48135638Sjoerg/* functions in mpboot.s */ 49135638Sjoergvoid bootMP __P((void)); 50134081Sphk 51131767Simp/* global data in mplock.s */ 52272129Sjhbextern u_int mp_lock; 53131767Simp 54272129Sjhb/* functions in mplock.s */ 55131767Simpvoid get_mplock __P((void)); 56131767Simpvoid rel_mplock __P((void)); 57131767Simpvoid try_mplock __P((void)); 58131767Simp 59131767Simp/* global data in apic_vector.s */ 60140469Simpextern volatile u_int stopped_cpus; 61140469Simpextern volatile u_int started_cpus; 62140469Simp 63140469Simp/* global data in mp_machdep.c */ 64140469Simpextern int mp_ncpus; 65140469Simpextern int mp_naps; 66140469Simpextern int mp_nbusses; 67140469Simpextern int mp_napics; 68131767Simpextern int mp_picmode; 69299051Sadrianextern int boot_cpu_id; 70134081Sphkextern vm_offset_t cpu_apic_address; 71134081Sphkextern vm_offset_t io_apic_address[]; 72131767Simpextern u_int32_t cpu_apic_versions[]; 73131767Simpextern u_int32_t io_apic_versions[]; 74131767Simpextern int cpu_num_to_apic_id[]; 75131767Simpextern int io_num_to_apic_id[]; 76132048Snjlextern int apic_id_to_logical[]; 77132048Snjlextern u_int all_cpus; 78132048Snjlextern u_int SMP_prvpt[]; 79132048Snjlextern u_char SMP_ioapic[]; 80132048Snjl 81132048Snjl/* functions in mp_machdep.c */ 82132048Snjlu_int mp_bootaddress __P((u_int)); 83132048Snjlint mp_probe __P((void)); 84131767Simpvoid mp_start __P((void)); 85131767Simpvoid mp_announce __P((void)); 86298426Sjhbu_int isa_apic_mask __P((u_int)); 87132215Snjlint isa_apic_pin __P((int)); 88131767Simpint pci_apic_pin __P((int, int, int)); 89132215Snjlint undirect_isa_irq __P((int)); 90134081Sphkint undirect_pci_irq __P((int)); 91131767Simpint apic_bus_type __P((int)); 92131767Simpint apic_src_bus_id __P((int, int)); 93132048Snjlint apic_src_bus_irq __P((int, int)); 94132215Snjlint apic_int_type __P((int, int)); 95int apic_trigger __P((int, int)); 96int apic_polarity __P((int, int)); 97void bsp_apic_configure __P((void)); 98void init_secondary __P((void)); 99void smp_invltlb __P((void)); 100int stop_cpus __P((u_int)); 101int restart_cpus __P((u_int)); 102 103/* global data in mpapic.c */ 104extern volatile lapic_t lapic; 105 106#if defined(MULTIPLE_IOAPICS) 107#error MULTIPLE_IOAPICSXXX 108#else 109extern volatile ioapic_t *ioapic[]; 110#endif /* MULTIPLE_IOAPICS */ 111 112/* functions in mpapic.c */ 113void apic_dump __P((void)); 114void apic_initialize __P((void)); 115int apic_ipi __P((int, int, int)); 116int selected_apic_ipi __P((u_int, int, int)); 117int io_apic_setup __P((int)); 118int ext_int_setup __P((int, int)); 119void write_io_apic_mask24 __P((int, u_int32_t)); 120 121#if defined(READY) 122void clr_io_apic_mask24 __P((int, u_int32_t)); 123void set_io_apic_mask24 __P((int, u_int32_t)); 124#endif /* READY */ 125 126void set_apic_timer __P((int)); 127int read_apic_timer __P((void)); 128void u_sleep __P((int)); 129 130/* global data in init_smp.c */ 131extern int smp_active; 132extern int invltlb_ok; 133 134/* 'private' global data in locore.s */ 135extern volatile u_int cpuid; 136extern volatile u_int cpu_lockid; 137extern volatile u_int other_cpus; 138 139#endif /* SMP || APIC_IO */ 140#endif /* KERNEL */ 141#endif /* _MACHINE_SMP_H_ */ 142