2 * Copyright (c) 2003 John Baldwin <jhb@FreeBSD.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the author nor the names of any co-contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * $FreeBSD: src/sys/i386/include/apicvar.h,v 1.5 2003/11/14 22:21:30 peter Exp $
30 * $DragonFly: src/sys/platform/pc32/apic/apicvar.h,v 1.4 2007/04/30 16:45:55 dillon Exp $
33 #ifndef _MACHINE_APICVAR_H_
34 #define _MACHINE_APICVAR_H_
37 * Local && I/O APIC variable definitions.
46 #define LVT_MAX LVT_THERMAL
50 #define APIC_IPI_DEST_SELF -1
51 #define APIC_IPI_DEST_ALL -2
52 #define APIC_IPI_DEST_OTHERS -3
55 * An APIC enumerator is a psuedo bus driver that enumerates APIC's including
56 * CPU's and I/O APIC's.
58 struct apic_enumerator {
59 const char *apic_name;
60 int (*apic_probe)(void);
61 int (*apic_probe_cpus)(void);
62 int (*apic_setup_local)(void);
63 int (*apic_setup_io)(void);
64 SLIST_ENTRY(apic_enumerator) apic_next;
67 u_int apic_irq_to_idt(u_int irq);
68 u_int apic_idt_to_irq(u_int vector);
69 void apic_register_enumerator(struct apic_enumerator *enumerator);
70 void *ioapic_create(uintptr_t addr, int32_t id, int intbase);
71 int ioapic_disable_pin(void *cookie, u_int pin);
72 void ioapic_enable_mixed_mode(void);
73 int ioapic_get_vector(void *cookie, u_int pin);
74 int ioapic_next_logical_cluster(void);
75 void ioapic_register(void *cookie);
76 int ioapic_remap_vector(void *cookie, u_int pin, int vector);
77 int ioapic_set_extint(void *cookie, u_int pin);
78 int ioapic_set_nmi(void *cookie, u_int pin);
79 int ioapic_set_polarity(void *cookie, u_int pin, char activehi);
80 int ioapic_set_triggermode(void *cookie, u_int pin, char edgetrigger);
81 int ioapic_set_smi(void *cookie, u_int pin);
82 void lapic_create(u_int apic_id, int boot_cpu);
83 void lapic_disable(void);
84 void lapic_dump(const char *str);
85 void lapic_enable_intr(u_int vector);
88 void lapic_init(uintptr_t addr);
89 int lapic_intr_pending(u_int vector);
90 void lapic_ipi_raw(register_t icrlo, u_int dest);
91 void lapic_ipi_vectored(u_int vector, int dest);
92 int lapic_ipi_wait(int delay);
93 void lapic_handle_intr(struct intrframe *frame);
94 void lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id);
95 int lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked);
96 int lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode);
97 int lapic_set_lvt_polarity(u_int apic_id, u_int lvt, u_char activehi);
98 int lapic_set_lvt_triggermode(u_int apic_id, u_int lvt, u_char edgetrigger);
99 void lapic_setup(void);
102 #endif /* _MACHINE_APICVAR_H_ */