smp.h revision 27633
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 * 927633Sfsmp * $Id: smp.h,v 1.15 1997/07/23 20:16:11 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; 6827633Sfsmpextern struct simple_lock imen_lock; 6927616Sfsmp 7027616Sfsmp/* functions in apic_ipl.s */ 7127616Sfsmpvoid vec8254 __P((void)); 7227616Sfsmpvoid INTREN __P((u_int)); 7327616Sfsmpvoid INTRDIS __P((u_int)); 7427616Sfsmpvoid apic_eoi __P((void)); 7527616Sfsmpu_int io_apic_read __P((int, int)); 7627616Sfsmpvoid io_apic_write __P((int, int, u_int)); 7727616Sfsmp 7827633Sfsmp/* also in apic_ipl.s, experimental versions of simple_lock(), etc. */ 7927619Sfsmp#include <machine/param.h> 8027619Sfsmpvoid s_lock_init __P((struct simplelock *)); 8127619Sfsmpvoid s_lock __P((__volatile struct simplelock *)); 8227619Sfsmpint s_lock_try __P((__volatile struct simplelock *)); 8327619Sfsmpvoid s_unlock __P((__volatile struct simplelock *)); 8427619Sfsmp 8525164Speter/* global data in mp_machdep.c */ 8625164Speterextern int mp_ncpus; 8725164Speterextern int mp_naps; 8825164Speterextern int mp_nbusses; 8925164Speterextern int mp_napics; 9025164Speterextern int mp_picmode; 9125164Speterextern int boot_cpu_id; 9225164Speterextern vm_offset_t cpu_apic_address; 9325164Speterextern vm_offset_t io_apic_address[]; 9425164Speterextern u_int32_t cpu_apic_versions[]; 9525164Speterextern u_int32_t io_apic_versions[]; 9625164Speterextern int cpu_num_to_apic_id[]; 9725164Speterextern int io_num_to_apic_id[]; 9825164Speterextern int apic_id_to_logical[]; 9927002Sfsmpextern u_int all_cpus; 10026812Speterextern u_int SMP_prvpt[]; 10126812Speterextern u_char SMP_ioapic[]; 10225164Speter 10325164Speter/* functions in mp_machdep.c */ 10425164Speteru_int mp_bootaddress __P((u_int)); 10526252Sfsmpint mp_probe __P((void)); 10625164Spetervoid mp_start __P((void)); 10725164Spetervoid mp_announce __P((void)); 10826948Sfsmpu_int isa_apic_mask __P((u_int)); 10926948Sfsmpint isa_apic_pin __P((int)); 11026948Sfsmpint pci_apic_pin __P((int, int, int)); 11125499Sfsmpint undirect_isa_irq __P((int)); 11225164Speterint undirect_pci_irq __P((int)); 11325164Speterint apic_bus_type __P((int)); 11425164Speterint apic_src_bus_id __P((int, int)); 11525164Speterint apic_src_bus_irq __P((int, int)); 11625164Speterint apic_int_type __P((int, int)); 11725164Speterint apic_trigger __P((int, int)); 11825164Speterint apic_polarity __P((int, int)); 11927285Sfsmpvoid bsp_apic_configure __P((void)); 12025164Spetervoid init_secondary __P((void)); 12125164Spetervoid smp_invltlb __P((void)); 12227002Sfsmpint stop_cpus __P((u_int)); 12327002Sfsmpint restart_cpus __P((u_int)); 12425164Speter 12525164Speter/* global data in mpapic.c */ 12626812Speterextern volatile lapic_t lapic; 12725164Speter 12825164Speter#if defined(MULTIPLE_IOAPICS) 12925164Speter#error MULTIPLE_IOAPICSXXX 13025164Speter#else 13126812Speterextern volatile ioapic_t *ioapic[]; 13225164Speter#endif /* MULTIPLE_IOAPICS */ 13325164Speter 13425164Speter/* functions in mpapic.c */ 13527559Sfsmpvoid apic_dump __P((char*)); 13627285Sfsmpvoid apic_initialize __P((void)); 13727616Sfsmpvoid imen_dump __P((void)); 13825362Sfsmpint apic_ipi __P((int, int, int)); 13925164Speterint selected_apic_ipi __P((u_int, int, int)); 14025164Speterint io_apic_setup __P((int)); 14125164Speterint ext_int_setup __P((int, int)); 14225164Speter 14325164Speter#if defined(READY) 14425164Spetervoid clr_io_apic_mask24 __P((int, u_int32_t)); 14525164Spetervoid set_io_apic_mask24 __P((int, u_int32_t)); 14625164Speter#endif /* READY */ 14725164Speter 14825164Spetervoid set_apic_timer __P((int)); 14925164Speterint read_apic_timer __P((void)); 15025164Spetervoid u_sleep __P((int)); 15125164Speter 15225164Speter/* global data in init_smp.c */ 15325164Speterextern int smp_active; 15425215Sfsmpextern int invltlb_ok; 15525164Speter 15627002Sfsmp/* 'private' global data in locore.s */ 15726812Speterextern volatile u_int cpuid; 15826812Speterextern volatile u_int cpu_lockid; 15927002Sfsmpextern volatile u_int other_cpus; 16025164Speter 16125164Speter#endif /* SMP || APIC_IO */ 16225164Speter#endif /* KERNEL */ 16325164Speter#endif /* _MACHINE_SMP_H_ */ 164