smp.h revision 27559
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 * 934206Sdyson * $Id: smp.h,v 1.8 1997/07/20 17:48:00 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 2227728Sfsmp#if defined(SMP) && !defined(NCPU) 2325164Speter# define NCPU 2 2425164Speter#endif /* SMP && NCPU */ 2525164Speter 2625164Speter#if defined(SMP) || defined(APIC_IO) 2727728Sfsmp 2827728Sfsmp/* 2927728Sfsmp * For sending values to POST displays. 3027728Sfsmp * XXX FIXME: where does this really belong, isa.h/isa.c perhaps? 3127728Sfsmp */ 3227728Sfsmpextern int current_postcode; /** XXX currently in mp_machdep.c */ 3325164Speter#define POSTCODE(X) current_postcode = (X), \ 3425164Speter outb(0x80, current_postcode) 3527728Sfsmp#define POSTCODE_LO(X) current_postcode &= 0xf0, \ 3627728Sfsmp current_postcode |= ((X) & 0x0f), \ 3727002Sfsmp outb(0x80, current_postcode) 3827002Sfsmp#define POSTCODE_HI(X) current_postcode &= 0x0f, \ 3927252Sfsmp current_postcode |= (((X) << 4) & 0xf0), \ 4027002Sfsmp outb(0x80, current_postcode) 4127252Sfsmp 4227252Sfsmp 4327252Sfsmp#include <machine/apic.h> 4427252Sfsmp 4527252Sfsmp/* global data in mpboot.s */ 4627252Sfsmpextern int bootMP_size; 4727252Sfsmp 4827252Sfsmp/* functions in mpboot.s */ 4927252Sfsmpvoid bootMP __P((void)); 5027002Sfsmp 5127252Sfsmp/* global data in mplock.s */ 5226269Sfsmpextern u_int mp_lock; 5326269Sfsmp 5425164Speter/* functions in mplock.s */ 5525164Spetervoid get_mplock __P((void)); 5625164Spetervoid rel_mplock __P((void)); 5725164Spetervoid try_mplock __P((void)); 5825164Speter 5925164Speter/* global data in apic_vector.s */ 6025164Speterextern volatile u_int stopped_cpus; 6125164Speterextern volatile u_int started_cpus; 6228441Sfsmp 6328921Sfsmp/* global data in mp_machdep.c */ 6428921Sfsmpextern int mp_ncpus; 6528921Sfsmpextern int mp_naps; 6625164Speterextern int mp_nbusses; 6725164Speterextern int mp_napics; 6825164Speterextern int mp_picmode; 6925164Speterextern int boot_cpu_id; 7034206Sdysonextern vm_offset_t cpu_apic_address; 7128921Sfsmpextern vm_offset_t io_apic_address[]; 7228921Sfsmpextern u_int32_t cpu_apic_versions[]; 7328921Sfsmpextern u_int32_t io_apic_versions[]; 7434206Sdysonextern int cpu_num_to_apic_id[]; 7528921Sfsmpextern int io_num_to_apic_id[]; 7625164Speterextern int apic_id_to_logical[]; 7727002Sfsmpextern u_int all_cpus; 7827002Sfsmpextern u_int SMP_prvpt[]; 7927002Sfsmpextern u_char SMP_ioapic[]; 8027002Sfsmp 8131639Sfsmp/* functions in mp_machdep.c */ 8231639Sfsmpu_int mp_bootaddress __P((u_int)); 8331639Sfsmpint mp_probe __P((void)); 8427616Sfsmpvoid mp_start __P((void)); 8527616Sfsmpvoid mp_announce __P((void)); 8627616Sfsmpu_int isa_apic_mask __P((u_int)); 8727616Sfsmpint isa_apic_pin __P((int)); 8827616Sfsmpint pci_apic_pin __P((int, int, int)); 8925164Speterint undirect_isa_irq __P((int)); 9028669Sfsmpint 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 bsp_apic_configure __P((void)); 9825164Spetervoid init_secondary __P((void)); 9925164Spetervoid smp_invltlb __P((void)); 10025164Speterint stop_cpus __P((u_int)); 10125164Speterint restart_cpus __P((u_int)); 10225164Speter 10325164Speter/* global data in mpapic.c */ 10427002Sfsmpextern volatile lapic_t lapic; 10526812Speter 10625164Speter#if defined(MULTIPLE_IOAPICS) 10725164Speter#error MULTIPLE_IOAPICSXXX 10825164Speter#else 10926252Sfsmpextern volatile ioapic_t *ioapic[]; 11025164Speter#endif /* MULTIPLE_IOAPICS */ 11125164Speter 11226948Sfsmp/* functions in mpapic.c */ 11326948Sfsmpvoid apic_dump __P((char*)); 11426948Sfsmpvoid apic_initialize __P((void)); 11525499Sfsmpint apic_ipi __P((int, int, int)); 11625164Speterint selected_apic_ipi __P((u_int, int, int)); 11725164Speterint io_apic_setup __P((int)); 11825164Speterint ext_int_setup __P((int, int)); 11925164Spetervoid write_io_apic_mask24 __P((int, u_int32_t)); 12025164Speter 12125164Speter#if defined(READY) 12225164Spetervoid clr_io_apic_mask24 __P((int, u_int32_t)); 12327285Sfsmpvoid set_io_apic_mask24 __P((int, u_int32_t)); 12425164Speter#endif /* READY */ 12525164Speter 12627002Sfsmpvoid set_apic_timer __P((int)); 12727002Sfsmpint read_apic_timer __P((void)); 12834017Steggevoid u_sleep __P((int)); 12934017Stegge 13034017Stegge/* global data in init_smp.c */ 13134017Steggeextern int smp_active; 13234020Steggeextern int invltlb_ok; 13334021Stegge 13434021Stegge/* 'private' global data in locore.s */ 13534021Steggeextern volatile u_int cpuid; 13625164Speterextern volatile u_int cpu_lockid; 13725164Speterextern volatile u_int other_cpus; 13826812Speter 13925164Speter#endif /* SMP || APIC_IO */ 14025164Speter#endif /* KERNEL */ 14125164Speter#endif /* _MACHINE_SMP_H_ */ 14225164Speter