smp.h revision 27616
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 * 927616Sfsmp * $Id: smp.h,v 1.13 1997/07/22 18:31:51 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 7825164Speter/* global data in mp_machdep.c */ 7925164Speterextern int mp_ncpus; 8025164Speterextern int mp_naps; 8125164Speterextern int mp_nbusses; 8225164Speterextern int mp_napics; 8325164Speterextern int mp_picmode; 8425164Speterextern int boot_cpu_id; 8525164Speterextern vm_offset_t cpu_apic_address; 8625164Speterextern vm_offset_t io_apic_address[]; 8725164Speterextern u_int32_t cpu_apic_versions[]; 8825164Speterextern u_int32_t io_apic_versions[]; 8925164Speterextern int cpu_num_to_apic_id[]; 9025164Speterextern int io_num_to_apic_id[]; 9125164Speterextern int apic_id_to_logical[]; 9227002Sfsmpextern u_int all_cpus; 9326812Speterextern u_int SMP_prvpt[]; 9426812Speterextern u_char SMP_ioapic[]; 9525164Speter 9625164Speter/* functions in mp_machdep.c */ 9725164Speteru_int mp_bootaddress __P((u_int)); 9826252Sfsmpint mp_probe __P((void)); 9925164Spetervoid mp_start __P((void)); 10025164Spetervoid mp_announce __P((void)); 10126948Sfsmpu_int isa_apic_mask __P((u_int)); 10226948Sfsmpint isa_apic_pin __P((int)); 10326948Sfsmpint pci_apic_pin __P((int, int, int)); 10425499Sfsmpint undirect_isa_irq __P((int)); 10525164Speterint undirect_pci_irq __P((int)); 10625164Speterint apic_bus_type __P((int)); 10725164Speterint apic_src_bus_id __P((int, int)); 10825164Speterint apic_src_bus_irq __P((int, int)); 10925164Speterint apic_int_type __P((int, int)); 11025164Speterint apic_trigger __P((int, int)); 11125164Speterint apic_polarity __P((int, int)); 11227285Sfsmpvoid bsp_apic_configure __P((void)); 11325164Spetervoid init_secondary __P((void)); 11425164Spetervoid smp_invltlb __P((void)); 11527002Sfsmpint stop_cpus __P((u_int)); 11627002Sfsmpint restart_cpus __P((u_int)); 11725164Speter 11825164Speter/* global data in mpapic.c */ 11926812Speterextern volatile lapic_t lapic; 12025164Speter 12125164Speter#if defined(MULTIPLE_IOAPICS) 12225164Speter#error MULTIPLE_IOAPICSXXX 12325164Speter#else 12426812Speterextern volatile ioapic_t *ioapic[]; 12525164Speter#endif /* MULTIPLE_IOAPICS */ 12625164Speter 12725164Speter/* functions in mpapic.c */ 12827559Sfsmpvoid apic_dump __P((char*)); 12927285Sfsmpvoid apic_initialize __P((void)); 13027616Sfsmpvoid imen_dump __P((void)); 13125362Sfsmpint apic_ipi __P((int, int, int)); 13225164Speterint selected_apic_ipi __P((u_int, int, int)); 13325164Speterint io_apic_setup __P((int)); 13425164Speterint ext_int_setup __P((int, int)); 13525164Speter 13625164Speter#if defined(READY) 13725164Spetervoid clr_io_apic_mask24 __P((int, u_int32_t)); 13825164Spetervoid set_io_apic_mask24 __P((int, u_int32_t)); 13925164Speter#endif /* READY */ 14025164Speter 14125164Spetervoid set_apic_timer __P((int)); 14225164Speterint read_apic_timer __P((void)); 14325164Spetervoid u_sleep __P((int)); 14425164Speter 14525164Speter/* global data in init_smp.c */ 14625164Speterextern int smp_active; 14725215Sfsmpextern int invltlb_ok; 14825164Speter 14927002Sfsmp/* 'private' global data in locore.s */ 15026812Speterextern volatile u_int cpuid; 15126812Speterextern volatile u_int cpu_lockid; 15227002Sfsmpextern volatile u_int other_cpus; 15325164Speter 15425164Speter#endif /* SMP || APIC_IO */ 15525164Speter#endif /* KERNEL */ 15625164Speter#endif /* _MACHINE_SMP_H_ */ 157