smp.h revision 27619
125164Speter/* 225164Speter * ---------------------------------------------------------------------------- 325164Speter * "THE BEER-WARE LICENSE" (Revision 42): 425164Speter * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you 525164Speter * can do whatever you want with this stuff. If we meet some day, and you think 625164Speter * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 725164Speter * ---------------------------------------------------------------------------- 825164Speter * 927619Sfsmp * $Id: smp.h,v 1.14 1997/07/23 05:41:55 smp Exp smp $ 1025164Speter * 1125164Speter */ 1225164Speter 1325164Speter#ifndef _MACHINE_SMP_H_ 1425164Speter#define _MACHINE_SMP_H_ 1525164Speter 1625164Speter#ifdef KERNEL 1725164Speter 1825517Sfsmp#if defined(SMP) && !defined(APIC_IO) 1925517Sfsmp# error APIC_IO required for SMP, add "options APIC_IO" to your config file. 2027002Sfsmp#endif /* SMP && !APIC_IO */ 2125517Sfsmp 2225164Speter#if defined(SMP) && !defined(NCPU) 2325164Speter# define NCPU 2 2425164Speter#endif /* SMP && NCPU */ 2525164Speter 2625164Speter#if defined(SMP) || defined(APIC_IO) 2725164Speter 2827002Sfsmp/* 2927002Sfsmp * For sending values to POST displays. 3027252Sfsmp * XXX FIXME: where does this really belong, isa.h/isa.c perhaps? 3127002Sfsmp */ 3227252Sfsmpextern int current_postcode; /** XXX currently in mp_machdep.c */ 3327252Sfsmp#define POSTCODE(X) current_postcode = (X), \ 3427252Sfsmp outb(0x80, current_postcode) 3527252Sfsmp#define POSTCODE_LO(X) current_postcode &= 0xf0, \ 3627252Sfsmp current_postcode |= ((X) & 0x0f), \ 3727252Sfsmp outb(0x80, current_postcode) 3827252Sfsmp#define POSTCODE_HI(X) current_postcode &= 0x0f, \ 3927252Sfsmp current_postcode |= (((X) << 4) & 0xf0), \ 4027252Sfsmp outb(0x80, current_postcode) 4127002Sfsmp 4227252Sfsmp 4326269Sfsmp#include <machine/apic.h> 4426269Sfsmp 4525164Speter/* global data in mpboot.s */ 4625164Speterextern int bootMP_size; 4725164Speter 4825164Speter/* functions in mpboot.s */ 4925164Spetervoid bootMP __P((void)); 5025164Speter 5125164Speter/* global data in mplock.s */ 5225164Speterextern u_int mp_lock; 5325164Speter 5425164Speter/* functions in mplock.s */ 5525164Spetervoid get_mplock __P((void)); 5625164Spetervoid rel_mplock __P((void)); 5725320Sfsmpvoid try_mplock __P((void)); 5825164Speter 5927002Sfsmp/* global data in apic_vector.s */ 6027616Sfsmpextern u_int ivectors[]; 6127002Sfsmpextern volatile u_int stopped_cpus; 6227002Sfsmpextern volatile u_int started_cpus; 6327002Sfsmp 6427616Sfsmp/* global data in apic_ipl.s */ 6527616Sfsmpextern u_int vec[]; 6627616Sfsmpextern u_int Xintr8254; 6727616Sfsmpextern u_int mask8254; 6827616Sfsmp 6927616Sfsmp/* functions in apic_ipl.s */ 7027616Sfsmpvoid vec8254 __P((void)); 7127616Sfsmpvoid INTREN __P((u_int)); 7227616Sfsmpvoid INTRDIS __P((u_int)); 7327616Sfsmpvoid apic_eoi __P((void)); 7427616Sfsmpu_int io_apic_read __P((int, int)); 7527616Sfsmpvoid io_apic_write __P((int, int, u_int)); 7627616Sfsmpvoid write_io_apic_mask24 __P((int, u_int)); 7727616Sfsmp 7827619Sfsmp#include <machine/param.h> 7927619Sfsmpvoid s_lock_init __P((struct simplelock *)); 8027619Sfsmpvoid s_lock __P((__volatile struct simplelock *)); 8127619Sfsmpint s_lock_try __P((__volatile struct simplelock *)); 8227619Sfsmpvoid s_unlock __P((__volatile struct simplelock *)); 8327619Sfsmp 8425164Speter/* global data in mp_machdep.c */ 8525164Speterextern int mp_ncpus; 8625164Speterextern int mp_naps; 8725164Speterextern int mp_nbusses; 8825164Speterextern int mp_napics; 8925164Speterextern int mp_picmode; 9025164Speterextern int boot_cpu_id; 9125164Speterextern vm_offset_t cpu_apic_address; 9225164Speterextern vm_offset_t io_apic_address[]; 9325164Speterextern u_int32_t cpu_apic_versions[]; 9425164Speterextern u_int32_t io_apic_versions[]; 9525164Speterextern int cpu_num_to_apic_id[]; 9625164Speterextern int io_num_to_apic_id[]; 9725164Speterextern int apic_id_to_logical[]; 9827002Sfsmpextern u_int all_cpus; 9926812Speterextern u_int SMP_prvpt[]; 10026812Speterextern u_char SMP_ioapic[]; 10125164Speter 10225164Speter/* functions in mp_machdep.c */ 10325164Speteru_int mp_bootaddress __P((u_int)); 10426252Sfsmpint mp_probe __P((void)); 10525164Spetervoid mp_start __P((void)); 10625164Spetervoid mp_announce __P((void)); 10726948Sfsmpu_int isa_apic_mask __P((u_int)); 10826948Sfsmpint isa_apic_pin __P((int)); 10926948Sfsmpint pci_apic_pin __P((int, int, int)); 11025499Sfsmpint undirect_isa_irq __P((int)); 11125164Speterint undirect_pci_irq __P((int)); 11225164Speterint apic_bus_type __P((int)); 11325164Speterint apic_src_bus_id __P((int, int)); 11425164Speterint apic_src_bus_irq __P((int, int)); 11525164Speterint apic_int_type __P((int, int)); 11625164Speterint apic_trigger __P((int, int)); 11725164Speterint apic_polarity __P((int, int)); 11827285Sfsmpvoid bsp_apic_configure __P((void)); 11925164Spetervoid init_secondary __P((void)); 12025164Spetervoid smp_invltlb __P((void)); 12127002Sfsmpint stop_cpus __P((u_int)); 12227002Sfsmpint restart_cpus __P((u_int)); 12325164Speter 12425164Speter/* global data in mpapic.c */ 12526812Speterextern volatile lapic_t lapic; 12625164Speter 12725164Speter#if defined(MULTIPLE_IOAPICS) 12825164Speter#error MULTIPLE_IOAPICSXXX 12925164Speter#else 13026812Speterextern volatile ioapic_t *ioapic[]; 13125164Speter#endif /* MULTIPLE_IOAPICS */ 13225164Speter 13325164Speter/* functions in mpapic.c */ 13427559Sfsmpvoid apic_dump __P((char*)); 13527285Sfsmpvoid apic_initialize __P((void)); 13627616Sfsmpvoid imen_dump __P((void)); 13725362Sfsmpint apic_ipi __P((int, int, int)); 13825164Speterint selected_apic_ipi __P((u_int, int, int)); 13925164Speterint io_apic_setup __P((int)); 14025164Speterint ext_int_setup __P((int, int)); 14125164Speter 14225164Speter#if defined(READY) 14325164Spetervoid clr_io_apic_mask24 __P((int, u_int32_t)); 14425164Spetervoid set_io_apic_mask24 __P((int, u_int32_t)); 14525164Speter#endif /* READY */ 14625164Speter 14725164Spetervoid set_apic_timer __P((int)); 14825164Speterint read_apic_timer __P((void)); 14925164Spetervoid u_sleep __P((int)); 15025164Speter 15125164Speter/* global data in init_smp.c */ 15225164Speterextern int smp_active; 15325215Sfsmpextern int invltlb_ok; 15425164Speter 15527002Sfsmp/* 'private' global data in locore.s */ 15626812Speterextern volatile u_int cpuid; 15726812Speterextern volatile u_int cpu_lockid; 15827002Sfsmpextern volatile u_int other_cpus; 15925164Speter 16025164Speter#endif /* SMP || APIC_IO */ 16125164Speter#endif /* KERNEL */ 16225164Speter#endif /* _MACHINE_SMP_H_ */ 163