smp.h revision 27252
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 * 927252Sfsmp * $Id: smp.h,v 1.5 1997/07/06 23:36:49 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 */ 6027002Sfsmpextern volatile u_int stopped_cpus; 6127002Sfsmpextern volatile u_int started_cpus; 6227002Sfsmp 6325164Speter/* global data in mp_machdep.c */ 6425164Speterextern int mp_ncpus; 6525164Speterextern int mp_naps; 6625164Speterextern int mp_nbusses; 6725164Speterextern int mp_napics; 6825164Speterextern int mp_picmode; 6925164Speterextern int boot_cpu_id; 7025164Speterextern vm_offset_t cpu_apic_address; 7125164Speterextern vm_offset_t io_apic_address[]; 7225164Speterextern u_int32_t cpu_apic_versions[]; 7325164Speterextern u_int32_t io_apic_versions[]; 7425164Speterextern int cpu_num_to_apic_id[]; 7525164Speterextern int io_num_to_apic_id[]; 7625164Speterextern int apic_id_to_logical[]; 7727002Sfsmpextern u_int all_cpus; 7826812Speterextern u_int SMP_prvpt[]; 7926812Speterextern u_char SMP_ioapic[]; 8025164Speter 8125164Speter/* functions in mp_machdep.c */ 8225164Speteru_int mp_bootaddress __P((u_int)); 8326252Sfsmpint mp_probe __P((void)); 8425164Spetervoid mp_start __P((void)); 8525164Spetervoid mp_announce __P((void)); 8626948Sfsmpu_int isa_apic_mask __P((u_int)); 8726948Sfsmpint isa_apic_pin __P((int)); 8826948Sfsmpint pci_apic_pin __P((int, int, int)); 8925499Sfsmpint undirect_isa_irq __P((int)); 9025164Speterint undirect_pci_irq __P((int)); 9125164Speterint apic_bus_type __P((int)); 9225164Speterint apic_src_bus_id __P((int, int)); 9325164Speterint apic_src_bus_irq __P((int, int)); 9425164Speterint apic_int_type __P((int, int)); 9525164Speterint apic_trigger __P((int, int)); 9625164Speterint apic_polarity __P((int, int)); 9725164Spetervoid configure_local_apic __P((void)); 9825164Spetervoid init_secondary __P((void)); 9925164Spetervoid smp_invltlb __P((void)); 10027002Sfsmpint stop_cpus __P((u_int)); 10127002Sfsmpint restart_cpus __P((u_int)); 10225164Speter 10325164Speter/* global data in mpapic.c */ 10426812Speterextern volatile lapic_t lapic; 10525164Speter 10625164Speter#if defined(MULTIPLE_IOAPICS) 10725164Speter#error MULTIPLE_IOAPICSXXX 10825164Speter#else 10926812Speterextern volatile ioapic_t *ioapic[]; 11025164Speter#endif /* MULTIPLE_IOAPICS */ 11125164Speter 11225164Speter/* functions in mpapic.c */ 11325164Spetervoid apic_initialize __P((int)); 11425362Sfsmpint apic_ipi __P((int, int, int)); 11525164Speterint selected_apic_ipi __P((u_int, int, int)); 11625164Speterint io_apic_setup __P((int)); 11725164Speterint ext_int_setup __P((int, int)); 11825164Spetervoid write_io_apic_mask24 __P((int, u_int32_t)); 11925164Speter 12025164Speter#if defined(READY) 12125164Spetervoid clr_io_apic_mask24 __P((int, u_int32_t)); 12225164Spetervoid set_io_apic_mask24 __P((int, u_int32_t)); 12325164Speter#endif /* READY */ 12425164Speter 12525164Spetervoid set_apic_timer __P((int)); 12625164Speterint read_apic_timer __P((void)); 12725164Spetervoid u_sleep __P((int)); 12825164Speter 12925164Speter/* global data in init_smp.c */ 13025164Speterextern int smp_active; 13125215Sfsmpextern int invltlb_ok; 13225164Speter 13327002Sfsmp/* 'private' global data in locore.s */ 13426812Speterextern volatile u_int cpuid; 13526812Speterextern volatile u_int cpu_lockid; 13627002Sfsmpextern volatile u_int other_cpus; 13725164Speter 13825164Speter#endif /* SMP || APIC_IO */ 13925164Speter#endif /* KERNEL */ 14025164Speter#endif /* _MACHINE_SMP_H_ */ 141