smp.h revision 69578
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 * 950477Speter * $FreeBSD: head/sys/i386/include/smp.h 69578 2000-12-04 21:15:14Z peter $ 1025164Speter * 1125164Speter */ 1225164Speter 1325164Speter#ifndef _MACHINE_SMP_H_ 1425164Speter#define _MACHINE_SMP_H_ 1525164Speter 1655205Speter#ifdef _KERNEL 1725164Speter 1865932Sphk#if defined(SMP) && defined(I386_CPU) && !defined(COMPILING_LINT) 1965557Sjasone#error SMP not supported with I386_CPU 2065557Sjasone#endif 2125517Sfsmp#if defined(SMP) && !defined(APIC_IO) 2225517Sfsmp# error APIC_IO required for SMP, add "options APIC_IO" to your config file. 2327002Sfsmp#endif /* SMP && !APIC_IO */ 2425517Sfsmp 2525164Speter#if defined(SMP) || defined(APIC_IO) 2625164Speter 2727728Sfsmp#ifndef LOCORE 2827728Sfsmp 2927002Sfsmp/* 3027002Sfsmp * For sending values to POST displays. 3127252Sfsmp * XXX FIXME: where does this really belong, isa.h/isa.c perhaps? 3227002Sfsmp */ 3327252Sfsmpextern int current_postcode; /** XXX currently in mp_machdep.c */ 3427252Sfsmp#define POSTCODE(X) current_postcode = (X), \ 3527252Sfsmp outb(0x80, current_postcode) 3627252Sfsmp#define POSTCODE_LO(X) current_postcode &= 0xf0, \ 3727252Sfsmp current_postcode |= ((X) & 0x0f), \ 3827252Sfsmp outb(0x80, current_postcode) 3927252Sfsmp#define POSTCODE_HI(X) current_postcode &= 0x0f, \ 4027252Sfsmp current_postcode |= (((X) << 4) & 0xf0), \ 4127252Sfsmp outb(0x80, current_postcode) 4227002Sfsmp 4327252Sfsmp 4426269Sfsmp#include <machine/apic.h> 4526269Sfsmp 4625164Speter/* global data in mpboot.s */ 4725164Speterextern int bootMP_size; 4825164Speter 4925164Speter/* functions in mpboot.s */ 5025164Spetervoid bootMP __P((void)); 5125164Speter 5227002Sfsmp/* global data in apic_vector.s */ 5327002Sfsmpextern volatile u_int stopped_cpus; 5427002Sfsmpextern volatile u_int started_cpus; 5527002Sfsmp 5634989Steggeextern volatile u_int checkstate_probed_cpus; 5734989Steggeextern volatile u_int checkstate_need_ast; 5836135Steggeextern volatile u_int resched_cpus; 5936135Steggeextern void (*cpustop_restartfunc) __P((void)); 6031639Sfsmp 6127616Sfsmp/* functions in apic_ipl.s */ 6227616Sfsmpvoid apic_eoi __P((void)); 6327616Sfsmpu_int io_apic_read __P((int, int)); 6427616Sfsmpvoid io_apic_write __P((int, int, u_int)); 6527616Sfsmp 6625164Speter/* global data in mp_machdep.c */ 6728669Sfsmpextern int bsp_apic_ready; 6825164Speterextern int mp_ncpus; 6925164Speterextern int mp_naps; 7025164Speterextern int mp_nbusses; 7125164Speterextern int mp_napics; 7225164Speterextern int mp_picmode; 7325164Speterextern int boot_cpu_id; 7425164Speterextern vm_offset_t cpu_apic_address; 7525164Speterextern vm_offset_t io_apic_address[]; 7625164Speterextern u_int32_t cpu_apic_versions[]; 7766277Spsextern u_int32_t *io_apic_versions; 7825164Speterextern int cpu_num_to_apic_id[]; 7925164Speterextern int io_num_to_apic_id[]; 8025164Speterextern int apic_id_to_logical[]; 8169578Speter#define APIC_INTMAPSIZE 32 8238888Steggestruct apic_intmapinfo { 8338888Stegge int ioapic; 8438888Stegge int int_pin; 8538888Stegge volatile void *apic_address; 8638888Stegge int redirindex; 8738888Stegge}; 8838888Steggeextern struct apic_intmapinfo int_to_apicintpin[]; 8927002Sfsmpextern u_int all_cpus; 9036135Steggeextern struct pcb stoppcbs[]; 9125164Speter 9225164Speter/* functions in mp_machdep.c */ 9325164Speteru_int mp_bootaddress __P((u_int)); 9426252Sfsmpint mp_probe __P((void)); 9525164Spetervoid mp_start __P((void)); 9625164Spetervoid mp_announce __P((void)); 9726948Sfsmpu_int isa_apic_mask __P((u_int)); 9838888Steggeint isa_apic_irq __P((int)); 9938888Steggeint pci_apic_irq __P((int, int, int)); 10038888Steggeint apic_irq __P((int, int)); 10138888Steggeint next_apic_irq __P((int)); 10225499Sfsmpint undirect_isa_irq __P((int)); 10325164Speterint undirect_pci_irq __P((int)); 10425164Speterint apic_bus_type __P((int)); 10525164Speterint apic_src_bus_id __P((int, int)); 10625164Speterint apic_src_bus_irq __P((int, int)); 10725164Speterint apic_int_type __P((int, int)); 10825164Speterint apic_trigger __P((int, int)); 10925164Speterint apic_polarity __P((int, int)); 11055420Steggevoid assign_apic_irq __P((int apic, int intpin, int irq)); 11155420Steggevoid revoke_apic_irq __P((int irq)); 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)); 11734017Stegge#ifdef BETTER_CLOCK 11834017Steggevoid forward_statclock __P((int pscnt)); 11934017Steggevoid forward_hardclock __P((int pscnt)); 12034017Stegge#endif /* BETTER_CLOCK */ 12134020Steggevoid forward_signal __P((struct proc *)); 12236135Steggevoid forward_roundrobin __P((void)); 12334021Stegge#ifdef APIC_INTR_REORDER 12434021Steggevoid set_lapic_isrloc __P((int, int)); 12534021Stegge#endif /* APIC_INTR_REORDER */ 12648924Smsmithvoid smp_rendezvous_action __P((void)); 12748924Smsmithvoid smp_rendezvous __P((void (*)(void *), 12848924Smsmith void (*)(void *), 12948924Smsmith void (*)(void *), 13048924Smsmith void *arg)); 13125164Speter 13225164Speter/* global data in mpapic.c */ 13326812Speterextern volatile lapic_t lapic; 13466277Spsextern volatile ioapic_t **ioapic; 13525164Speter 13625164Speter/* functions in mpapic.c */ 13727559Sfsmpvoid apic_dump __P((char*)); 13827285Sfsmpvoid apic_initialize __P((void)); 13927616Sfsmpvoid imen_dump __P((void)); 14025362Sfsmpint apic_ipi __P((int, int, int)); 14125164Speterint selected_apic_ipi __P((u_int, int, int)); 14225164Speterint io_apic_setup __P((int)); 14361136Smsmithvoid io_apic_set_id __P((int, int)); 14464290Steggeint io_apic_get_id __P((int)); 14525164Speterint ext_int_setup __P((int, int)); 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 */ 15228231Sfsmpextern int invltlb_ok; 15325164Speterextern int smp_active; 15451661Smjacobextern int smp_started; 15528231Sfsmpextern volatile int smp_idle_loops; 15625164Speter 15727728Sfsmp#endif /* !LOCORE */ 15865557Sjasone#endif /* SMP && !APIC_IO */ 15958755Sdillon 16055205Speter#endif /* _KERNEL */ 16125164Speter#endif /* _MACHINE_SMP_H_ */ 162