xref: /dragonfly/sys/platform/pc64/apic/ioapic_abi.h (revision 86d692fe)
19e0e3f85SSepherosa Ziehau /*
29e0e3f85SSepherosa Ziehau  * Copyright (c) 1991 The Regents of the University of California.
39e0e3f85SSepherosa Ziehau  * Copyright (c) 1996, by Steve Passe.  All rights reserved.
49e0e3f85SSepherosa Ziehau  * Copyright (c) 2005,2008 The DragonFly Project.  All rights reserved.
59e0e3f85SSepherosa Ziehau  * All rights reserved.
69e0e3f85SSepherosa Ziehau  *
79e0e3f85SSepherosa Ziehau  * This code is derived from software contributed to The DragonFly Project
89e0e3f85SSepherosa Ziehau  * by Matthew Dillon <dillon@backplane.com>
99e0e3f85SSepherosa Ziehau  *
109e0e3f85SSepherosa Ziehau  * This code is derived from software contributed to Berkeley by
119e0e3f85SSepherosa Ziehau  * William Jolitz.
129e0e3f85SSepherosa Ziehau  *
139e0e3f85SSepherosa Ziehau  * Redistribution and use in source and binary forms, with or without
149e0e3f85SSepherosa Ziehau  * modification, are permitted provided that the following conditions
159e0e3f85SSepherosa Ziehau  * are met:
169e0e3f85SSepherosa Ziehau  *
179e0e3f85SSepherosa Ziehau  * 1. Redistributions of source code must retain the above copyright
189e0e3f85SSepherosa Ziehau  *    notice, this list of conditions and the following disclaimer.
199e0e3f85SSepherosa Ziehau  * 2. Redistributions in binary form must reproduce the above copyright
209e0e3f85SSepherosa Ziehau  *    notice, this list of conditions and the following disclaimer in
219e0e3f85SSepherosa Ziehau  *    the documentation and/or other materials provided with the
229e0e3f85SSepherosa Ziehau  *    distribution.
239e0e3f85SSepherosa Ziehau  * 3. Neither the name of The DragonFly Project nor the names of its
249e0e3f85SSepherosa Ziehau  *    contributors may be used to endorse or promote products derived
259e0e3f85SSepherosa Ziehau  *    from this software without specific, prior written permission.
269e0e3f85SSepherosa Ziehau  *
279e0e3f85SSepherosa Ziehau  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
289e0e3f85SSepherosa Ziehau  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
299e0e3f85SSepherosa Ziehau  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
309e0e3f85SSepherosa Ziehau  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
319e0e3f85SSepherosa Ziehau  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
329e0e3f85SSepherosa Ziehau  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
339e0e3f85SSepherosa Ziehau  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
349e0e3f85SSepherosa Ziehau  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
359e0e3f85SSepherosa Ziehau  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
369e0e3f85SSepherosa Ziehau  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
379e0e3f85SSepherosa Ziehau  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
389e0e3f85SSepherosa Ziehau  * SUCH DAMAGE.
399e0e3f85SSepherosa Ziehau  */
409e0e3f85SSepherosa Ziehau 
419e0e3f85SSepherosa Ziehau #ifndef _ARCH_APIC_IOAPIC_ABI_H_
429e0e3f85SSepherosa Ziehau #define _ARCH_APIC_IOAPIC_ABI_H_
439e0e3f85SSepherosa Ziehau 
44929c940fSSepherosa Ziehau #ifndef _SYS_BUS_H_
45929c940fSSepherosa Ziehau #include <sys/bus.h>
46a3dd9120SSepherosa Ziehau #endif
479e0e3f85SSepherosa Ziehau 
48566d27d4SSepherosa Ziehau /*
49566d27d4SSepherosa Ziehau  * NOTE:
505ac5ccd2SSepherosa Ziehau  * - Keep size of ioapic_irqinfo power of 2
515ac5ccd2SSepherosa Ziehau  * - Update IOAPIC_IRQI_SZSHIFT after changing ioapic_irqinfo size
52566d27d4SSepherosa Ziehau  */
535ac5ccd2SSepherosa Ziehau struct ioapic_irqinfo {
545ac5ccd2SSepherosa Ziehau 	uint32_t	io_flags;	/* IOAPIC_IRQI_FLAG_ */
555ac5ccd2SSepherosa Ziehau 	int		io_idx;
565ac5ccd2SSepherosa Ziehau 	volatile void	*io_addr;
57566d27d4SSepherosa Ziehau };
585ac5ccd2SSepherosa Ziehau #define IOAPIC_IRQI_SZSHIFT	4
59566d27d4SSepherosa Ziehau 
605ac5ccd2SSepherosa Ziehau #define IOAPIC_IRQI_FLAG_LEVEL	0x1	/* default to edge trigger */
615ac5ccd2SSepherosa Ziehau #define IOAPIC_IRQI_FLAG_MASKED	0x2
62566d27d4SSepherosa Ziehau 
635ac5ccd2SSepherosa Ziehau extern struct ioapic_irqinfo	ioapic_irqs[];
64566d27d4SSepherosa Ziehau 
65929c940fSSepherosa Ziehau extern struct machintr_abi MachIntrABI_IOAPIC;
66929c940fSSepherosa Ziehau 
67*027bbbfeSSepherosa Ziehau int	ioapic_conf_legacy_extint(int);
68*027bbbfeSSepherosa Ziehau void	ioapic_set_legacy_irqmap(int, int, enum intr_trigger,
69*027bbbfeSSepherosa Ziehau 	    enum intr_polarity);
70*027bbbfeSSepherosa Ziehau void	ioapic_fixup_legacy_irqmaps(void);
71929c940fSSepherosa Ziehau 
729e0e3f85SSepherosa Ziehau #endif	/* !_ARCH_APIC_IOAPIC_ABI_H_ */
73