xref: /titanic_52/usr/src/uts/i86pc/sys/apix.h (revision 41afdfa77f9af46beb3aaab2eccc0d9afe660d31)
17ff178cdSJimmy Vetayases /*
27ff178cdSJimmy Vetayases  * CDDL HEADER START
37ff178cdSJimmy Vetayases  *
47ff178cdSJimmy Vetayases  * The contents of this file are subject to the terms of the
57ff178cdSJimmy Vetayases  * Common Development and Distribution License (the "License").
67ff178cdSJimmy Vetayases  * You may not use this file except in compliance with the License.
77ff178cdSJimmy Vetayases  *
87ff178cdSJimmy Vetayases  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97ff178cdSJimmy Vetayases  * or http://www.opensolaris.org/os/licensing.
107ff178cdSJimmy Vetayases  * See the License for the specific language governing permissions
117ff178cdSJimmy Vetayases  * and limitations under the License.
127ff178cdSJimmy Vetayases  *
137ff178cdSJimmy Vetayases  * When distributing Covered Code, include this CDDL HEADER in each
147ff178cdSJimmy Vetayases  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157ff178cdSJimmy Vetayases  * If applicable, add the following below this CDDL HEADER, with the
167ff178cdSJimmy Vetayases  * fields enclosed by brackets "[]" replaced with your own identifying
177ff178cdSJimmy Vetayases  * information: Portions Copyright [yyyy] [name of copyright owner]
187ff178cdSJimmy Vetayases  *
197ff178cdSJimmy Vetayases  * CDDL HEADER END
207ff178cdSJimmy Vetayases  */
217ff178cdSJimmy Vetayases /*
227ff178cdSJimmy Vetayases  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
237ff178cdSJimmy Vetayases  */
247ff178cdSJimmy Vetayases 
257ff178cdSJimmy Vetayases #ifndef __SYS_APIX_APIX_H
267ff178cdSJimmy Vetayases #define	__SYS_APIX_APIX_H
277ff178cdSJimmy Vetayases 
287ff178cdSJimmy Vetayases #include <sys/note.h>
297ff178cdSJimmy Vetayases #include <sys/avintr.h>
307ff178cdSJimmy Vetayases #include <sys/traptrace.h>
317ff178cdSJimmy Vetayases #include <sys/apic.h>
327ff178cdSJimmy Vetayases #include <sys/apic_common.h>
33*41afdfa7SKrishnendu Sadhukhan - Sun Microsystems #include <sys/apic_timer.h>
347ff178cdSJimmy Vetayases 
357ff178cdSJimmy Vetayases #ifdef	__cplusplus
367ff178cdSJimmy Vetayases extern	"C" {
377ff178cdSJimmy Vetayases #endif
387ff178cdSJimmy Vetayases 
397ff178cdSJimmy Vetayases #ifdef	DEBUG
407ff178cdSJimmy Vetayases #ifndef	TRAPTRACE
417ff178cdSJimmy Vetayases #define	TRAPTRACE
427ff178cdSJimmy Vetayases #endif
437ff178cdSJimmy Vetayases #endif
447ff178cdSJimmy Vetayases 
457ff178cdSJimmy Vetayases #define	APIX_NAME		"apix"
467ff178cdSJimmy Vetayases 
477ff178cdSJimmy Vetayases #define	APIX_NVECTOR		256	/* max number of per-cpu vectors */
487ff178cdSJimmy Vetayases #define	APIX_NIRQ		256	/* maximum number of IRQs */
497ff178cdSJimmy Vetayases #define	APIX_INVALID_VECT	0	/* invalid vector */
507ff178cdSJimmy Vetayases 
517ff178cdSJimmy Vetayases /* vector type */
527ff178cdSJimmy Vetayases #define	APIX_TYPE_FIXED	DDI_INTR_TYPE_FIXED	/* 1 */
537ff178cdSJimmy Vetayases #define	APIX_TYPE_MSI		DDI_INTR_TYPE_MSI	/* 2 */
547ff178cdSJimmy Vetayases #define	APIX_TYPE_MSIX	DDI_INTR_TYPE_MSIX	/* 4 */
557ff178cdSJimmy Vetayases #define	APIX_TYPE_IPI		8
567ff178cdSJimmy Vetayases 
577ff178cdSJimmy Vetayases /* vector states */
587ff178cdSJimmy Vetayases enum {
597ff178cdSJimmy Vetayases 	APIX_STATE_FREED = 0,
607ff178cdSJimmy Vetayases 	APIX_STATE_OBSOLETED,	/* 1 */
617ff178cdSJimmy Vetayases 	APIX_STATE_ALLOCED,	/* 2 */
627ff178cdSJimmy Vetayases 	APIX_STATE_ENABLED,	/* 3 */
637ff178cdSJimmy Vetayases 	APIX_STATE_DISABLED	/* 4 */
647ff178cdSJimmy Vetayases };
657ff178cdSJimmy Vetayases #define	IS_VECT_FREE(p)		\
667ff178cdSJimmy Vetayases 	(((p) == NULL) || ((p)->v_state == APIX_STATE_FREED))
677ff178cdSJimmy Vetayases #define	IS_VECT_OBSOL(p)	\
687ff178cdSJimmy Vetayases 	(((p) != NULL) && ((p)->v_state == APIX_STATE_OBSOLETED))
697ff178cdSJimmy Vetayases #define	IS_VECT_ENABLED(p)	\
707ff178cdSJimmy Vetayases 	(((p) != NULL) && ((p)->v_state == APIX_STATE_ENABLED))
717ff178cdSJimmy Vetayases 
727ff178cdSJimmy Vetayases /* flags */
737ff178cdSJimmy Vetayases #define	APIX_VECT_USER_BOUND	0x1
747ff178cdSJimmy Vetayases #define	APIX_VECT_MASKABLE	0x2
757ff178cdSJimmy Vetayases 
767ff178cdSJimmy Vetayases /*
777ff178cdSJimmy Vetayases  * Number of interrupt vectors reserved by software on each LOCAL APIC:
787ff178cdSJimmy Vetayases  * 	1. Dtrace
797ff178cdSJimmy Vetayases  *	2. int80
807ff178cdSJimmy Vetayases  *	3. system-call
817ff178cdSJimmy Vetayases  *	4. fast-trap
827ff178cdSJimmy Vetayases  * 	5. apix-reserved
837ff178cdSJimmy Vetayases  */
847ff178cdSJimmy Vetayases #define	APIX_SW_RESERVED_VECTORS	5
857ff178cdSJimmy Vetayases 
867ff178cdSJimmy Vetayases /*
877ff178cdSJimmy Vetayases  * Macros to help deal with shared interrupts and to differentiate
887ff178cdSJimmy Vetayases  * between vector and irq number when passing arguments to interfaces
897ff178cdSJimmy Vetayases  * xxx_avintr()
907ff178cdSJimmy Vetayases  */
917ff178cdSJimmy Vetayases #define	APIX_VIRTVEC_VECMASK		0xff
927ff178cdSJimmy Vetayases #define	APIX_VIRTVEC_FLAG		0x80000000
937ff178cdSJimmy Vetayases #define	APIX_VIRTVECTOR(cpuid, v)	\
947ff178cdSJimmy Vetayases 	(APIX_VIRTVEC_FLAG | ((cpuid) << 8) | (v))
957ff178cdSJimmy Vetayases #define	APIX_IS_VIRTVEC(vv)		\
967ff178cdSJimmy Vetayases 	((vv) & APIX_VIRTVEC_FLAG)
977ff178cdSJimmy Vetayases #define	APIX_VIRTVEC_VECTOR(vv)	\
987ff178cdSJimmy Vetayases 	(((uchar_t)(vv)) & APIX_VIRTVEC_VECMASK)
997ff178cdSJimmy Vetayases #define	APIX_VIRTVEC_CPU(vv)		\
1007ff178cdSJimmy Vetayases 	(((uint32_t)(vv) & ~APIX_VIRTVEC_FLAG) >> 8)
1017ff178cdSJimmy Vetayases 
1027ff178cdSJimmy Vetayases struct apix_dev_vector;
1037ff178cdSJimmy Vetayases typedef struct apix_vector {
1047ff178cdSJimmy Vetayases 	ushort_t		v_state;
1057ff178cdSJimmy Vetayases 	ushort_t		v_type;	/* interrupt type */
1067ff178cdSJimmy Vetayases 	processorid_t		v_cpuid;	/* current target cpu */
1077ff178cdSJimmy Vetayases 	uchar_t			v_vector;	/* vector */
1087ff178cdSJimmy Vetayases 	uchar_t			v_share;	/* intrs at this vector */
1097ff178cdSJimmy Vetayases 	int			v_inum;	/* irq for fixed, inum for msi/x */
1107ff178cdSJimmy Vetayases 	uint_t			v_flags;
1117ff178cdSJimmy Vetayases 	processorid_t		v_bound_cpuid;	/* binding cpu */
1127ff178cdSJimmy Vetayases 	uint_t			v_busy;	/* How frequently did clock */
1137ff178cdSJimmy Vetayases 					/* find us in this */
1147ff178cdSJimmy Vetayases 	uint_t			v_pri;	/* maximum priority */
1157ff178cdSJimmy Vetayases 	struct autovec		*v_autovect;	/* ISR linked list */
1167ff178cdSJimmy Vetayases 	void			*v_intrmap_private; /* intr remap data */
1177ff178cdSJimmy Vetayases 	struct apix_dev_vector *v_devp;	/* pointer to device */
1187ff178cdSJimmy Vetayases 	struct apix_vector	*v_next; /* next on per-cpu obosoletes chain */
1197ff178cdSJimmy Vetayases } apix_vector_t;
1207ff178cdSJimmy Vetayases 
1217ff178cdSJimmy Vetayases typedef struct apix_impl {
1227ff178cdSJimmy Vetayases 	processorid_t		x_cpuid;	/* cpu number */
1237ff178cdSJimmy Vetayases 
1247ff178cdSJimmy Vetayases 	uint16_t		x_intr_pending;	/* pending intr by IPL */
1257ff178cdSJimmy Vetayases 	/* pointer to head of interrupt pending list */
1267ff178cdSJimmy Vetayases 	struct autovec		*x_intr_head[PIL_MAX + 1];
1277ff178cdSJimmy Vetayases 	/* pointer to tail of interrupt pending list */
1287ff178cdSJimmy Vetayases 	struct autovec		*x_intr_tail[PIL_MAX + 1];
1297ff178cdSJimmy Vetayases 
1307ff178cdSJimmy Vetayases 	apix_vector_t		*x_obsoletes;	/* obosoleted vectors */
1317ff178cdSJimmy Vetayases 	apix_vector_t		*x_vectbl[APIX_NVECTOR]; /* vector table */
1327ff178cdSJimmy Vetayases 
1337ff178cdSJimmy Vetayases 	lock_t			x_lock;
1347ff178cdSJimmy Vetayases } apix_impl_t;
1357ff178cdSJimmy Vetayases 
1367ff178cdSJimmy Vetayases #define	HILEVEL_PENDING(cpu)	\
1377ff178cdSJimmy Vetayases 	(apixs[(cpu)->cpu_id]->x_intr_pending & CPU_INTR_ACTV_HIGH_LEVEL_MASK)
1387ff178cdSJimmy Vetayases #define	LOWLEVEL_PENDING(cpu)	\
1397ff178cdSJimmy Vetayases 	(apixs[(cpu)->cpu_id]->x_intr_pending & ~CPU_INTR_ACTV_HIGH_LEVEL_MASK)
1407ff178cdSJimmy Vetayases #define	IS_HILEVEL_RUNNING(cpu)	\
1417ff178cdSJimmy Vetayases 	(((ushort_t)((cpu)->intr_actv)) & CPU_INTR_ACTV_HIGH_LEVEL_MASK)
1427ff178cdSJimmy Vetayases #define	IS_LOWLEVEL_RUNNING(cpu)	\
1437ff178cdSJimmy Vetayases 	(((ushort_t)((cpu)->intr_actv)) & ~CPU_INTR_ACTV_HIGH_LEVEL_MASK)
1447ff178cdSJimmy Vetayases 
1457ff178cdSJimmy Vetayases #define	INTR_PENDING(apixp, ipl)			\
1467ff178cdSJimmy Vetayases 	((ipl) <= LOCK_LEVEL ?				\
1477ff178cdSJimmy Vetayases 	((apixp)->x_intr_pending & (1 << (ipl))) :	\
1487ff178cdSJimmy Vetayases 	((apixp)->x_intr_pending >> (LOCK_LEVEL + 1)))
1497ff178cdSJimmy Vetayases 
1507ff178cdSJimmy Vetayases /*
1517ff178cdSJimmy Vetayases  * We need a way to find allocated vector for a device. One option
1527ff178cdSJimmy Vetayases  * is to maintain a mapping table in pcplusmp. Another option would
1537ff178cdSJimmy Vetayases  * be to record vector or irq with interrupt handler hdlp->ih_vector or
1547ff178cdSJimmy Vetayases  * hdlp->ih_irq.
1557ff178cdSJimmy Vetayases  * Second option requires interface changes, such as, a new interface
1567ff178cdSJimmy Vetayases  * for  noticing vector changes caused by interrupt re-targeting.
1577ff178cdSJimmy Vetayases  * Currently we choose the first option cause it doesn't require
1587ff178cdSJimmy Vetayases  * new interfaces.
1597ff178cdSJimmy Vetayases  */
1607ff178cdSJimmy Vetayases typedef struct apix_dev_vector {
1617ff178cdSJimmy Vetayases 	dev_info_t		*dv_dip;
1627ff178cdSJimmy Vetayases 	int			dv_inum;	/* interrupt number */
1637ff178cdSJimmy Vetayases 	int			dv_type;	/* interrupt type */
1647ff178cdSJimmy Vetayases 	apix_vector_t		*dv_vector;	/* vector */
1657ff178cdSJimmy Vetayases 	struct apix_dev_vector *dv_next;	/* per major chain */
1667ff178cdSJimmy Vetayases } apix_dev_vector_t;
1677ff178cdSJimmy Vetayases 
1687ff178cdSJimmy Vetayases extern lock_t apix_lock;
1697ff178cdSJimmy Vetayases extern apix_impl_t *apixs[];
1707ff178cdSJimmy Vetayases extern int apix_nipis;
1717ff178cdSJimmy Vetayases extern int apix_cpu_nvectors;
1727ff178cdSJimmy Vetayases extern apix_dev_vector_t **apix_dev_vector;
1737ff178cdSJimmy Vetayases extern processorid_t *apix_major_to_cpu;
1747ff178cdSJimmy Vetayases extern kmutex_t apix_mutex;
1757ff178cdSJimmy Vetayases 
1767ff178cdSJimmy Vetayases #define	xv_vector(cpu, v)	apixs[(cpu)]->x_vectbl[(v)]
1777ff178cdSJimmy Vetayases #define	xv_intrmap_private(cpu, v)	(xv_vector(cpu, v))->v_intrmap_private
1787ff178cdSJimmy Vetayases 
1797ff178cdSJimmy Vetayases #define	APIX_IPI_MAX		APIC_MAX_VECTOR
1807ff178cdSJimmy Vetayases #define	APIX_IPI_MIN		(APIX_NVECTOR - apix_nipis)
1817ff178cdSJimmy Vetayases #define	APIX_AVINTR_MIN	0x20
1827ff178cdSJimmy Vetayases #define	APIX_NAVINTR		\
1837ff178cdSJimmy Vetayases 	(apix_cpu_nvectors - apix_nipis - APIX_AVINTR_MIN)
1847ff178cdSJimmy Vetayases #define	APIX_AVINTR_MAX	\
1857ff178cdSJimmy Vetayases 	((APIX_NAVINTR <= 0) ? 0 : \
1867ff178cdSJimmy Vetayases 	(((APIX_AVINTR_MIN + APIX_NAVINTR) > APIX_IPI_MIN) ? \
1877ff178cdSJimmy Vetayases 	(APIX_IPI_MIN - 2) : \
1887ff178cdSJimmy Vetayases 	(APIX_AVINTR_MIN + APIX_NAVINTR - 2)))
1897ff178cdSJimmy Vetayases #define	APIX_RESV_VECTOR	(APIX_AVINTR_MAX + 1)
1907ff178cdSJimmy Vetayases 
1917ff178cdSJimmy Vetayases #define	IS_VALID_AVINTR(v)		\
1927ff178cdSJimmy Vetayases 	((v) >= APIX_AVINTR_MIN && (v) <= APIX_AVINTR_MAX)
1937ff178cdSJimmy Vetayases 
1947ff178cdSJimmy Vetayases #define	APIX_ENTER_CPU_LOCK(cpuid)	lock_set(&apixs[(cpuid)]->x_lock)
1957ff178cdSJimmy Vetayases #define	APIX_LEAVE_CPU_LOCK(cpuid)	lock_clear(&apixs[(cpuid)]->x_lock)
1967ff178cdSJimmy Vetayases #define	APIX_CPU_LOCK_HELD(cpuid)	LOCK_HELD(&apixs[(cpuid)]->x_lock)
1977ff178cdSJimmy Vetayases 
1987ff178cdSJimmy Vetayases /* Get dip for msi/x */
1997ff178cdSJimmy Vetayases #define	APIX_GET_DIP(v)		\
2007ff178cdSJimmy Vetayases 	((v)->v_devp->dv_dip)
2017ff178cdSJimmy Vetayases 
2027ff178cdSJimmy Vetayases /*
2037ff178cdSJimmy Vetayases  * For irq
2047ff178cdSJimmy Vetayases  */
2057ff178cdSJimmy Vetayases extern apic_irq_t *apic_irq_table[APIC_MAX_VECTOR+1];
2067ff178cdSJimmy Vetayases #define	IS_IRQ_FREE(p)		\
2077ff178cdSJimmy Vetayases 	((p) == NULL || ((p)->airq_mps_intr_index == FREE_INDEX))
2087ff178cdSJimmy Vetayases 
2097ff178cdSJimmy Vetayases #define	UNREFERENCED_1PARAMETER(_p)		_NOTE(ARGUNUSED(_p))
2107ff178cdSJimmy Vetayases #define	UNREFERENCED_3PARAMETER(_p, _q, _r)	_NOTE(ARGUNUSED(_p, _q, _r))
2117ff178cdSJimmy Vetayases 
2127ff178cdSJimmy Vetayases /*
2137ff178cdSJimmy Vetayases  * From mp_platform_common.c
2147ff178cdSJimmy Vetayases  */
2157ff178cdSJimmy Vetayases extern int apic_intr_policy;
2167ff178cdSJimmy Vetayases extern iflag_t apic_sci_flags;
2177ff178cdSJimmy Vetayases extern int apic_hpet_vect;
2187ff178cdSJimmy Vetayases extern iflag_t apic_hpet_flags;
2197ff178cdSJimmy Vetayases extern int	apic_redist_cpu_skip;
2207ff178cdSJimmy Vetayases extern int	apic_num_imbalance;
2217ff178cdSJimmy Vetayases extern int	apic_num_rebind;
2227ff178cdSJimmy Vetayases extern struct apic_io_intr *apic_io_intrp;
2237ff178cdSJimmy Vetayases extern int	apic_use_acpi_madt_only;
2247ff178cdSJimmy Vetayases extern uint32_t	eisa_level_intr_mask;
2257ff178cdSJimmy Vetayases extern int	apic_pci_bus_total;
2267ff178cdSJimmy Vetayases extern uchar_t	apic_single_pci_busid;
2277ff178cdSJimmy Vetayases 
2287ff178cdSJimmy Vetayases extern ACPI_MADT_INTERRUPT_OVERRIDE *acpi_isop;
2297ff178cdSJimmy Vetayases extern int acpi_iso_cnt;
2307ff178cdSJimmy Vetayases 
2317ff178cdSJimmy Vetayases extern int	apic_defconf;
2327ff178cdSJimmy Vetayases extern int	apic_irq_translate;
2337ff178cdSJimmy Vetayases 
2347ff178cdSJimmy Vetayases extern int apic_max_reps_clear_pending;
2357ff178cdSJimmy Vetayases 
2367ff178cdSJimmy Vetayases extern int apic_probe_common(char *modname);
2377ff178cdSJimmy Vetayases extern uchar_t acpi_find_ioapic(int irq);
2387ff178cdSJimmy Vetayases extern int apic_find_bus_id(int bustype);
2397ff178cdSJimmy Vetayases extern int apic_find_intin(uchar_t ioapic, uchar_t intin);
2407ff178cdSJimmy Vetayases extern struct apic_io_intr *apic_find_io_intr_w_busid(int irqno, int busid);
2417ff178cdSJimmy Vetayases extern int apic_acpi_translate_pci_irq(dev_info_t *dip, int busid, int devid,
2427ff178cdSJimmy Vetayases     int ipin, int *pci_irqp, iflag_t *intr_flagp);
2437ff178cdSJimmy Vetayases extern int apic_handle_pci_pci_bridge(dev_info_t *idip, int child_devno,
2447ff178cdSJimmy Vetayases     int child_ipin, struct apic_io_intr **intrp);
2457ff178cdSJimmy Vetayases extern void apic_record_rdt_entry(apic_irq_t *irqptr, int irq);
2467ff178cdSJimmy Vetayases 
2477ff178cdSJimmy Vetayases /*
2487ff178cdSJimmy Vetayases  * From apic_regops.c
2497ff178cdSJimmy Vetayases  */
2507ff178cdSJimmy Vetayases extern int apic_have_32bit_cr8;
2517ff178cdSJimmy Vetayases 
2527ff178cdSJimmy Vetayases /*
2537ff178cdSJimmy Vetayases  * apix_intr.c
2547ff178cdSJimmy Vetayases  */
2557ff178cdSJimmy Vetayases extern void apix_do_interrupt(struct regs *rp, trap_trace_rec_t *ttp);
2567ff178cdSJimmy Vetayases 
2577ff178cdSJimmy Vetayases /*
2587ff178cdSJimmy Vetayases  * apix_utils.c
2597ff178cdSJimmy Vetayases  */
2607ff178cdSJimmy Vetayases 
2617ff178cdSJimmy Vetayases typedef struct apix_rebind_info {
2627ff178cdSJimmy Vetayases 	int		i_go;	/* if rebinding op is in progress */
2637ff178cdSJimmy Vetayases 	uint_t		i_pri;
2647ff178cdSJimmy Vetayases 	processorid_t	i_old_cpuid;
2657ff178cdSJimmy Vetayases 	struct autovec	*i_old_av;
2667ff178cdSJimmy Vetayases 	processorid_t	i_new_cpuid;
2677ff178cdSJimmy Vetayases 	struct autovec	*i_new_av;
2687ff178cdSJimmy Vetayases } apix_rebind_info_t;
2697ff178cdSJimmy Vetayases 
2707ff178cdSJimmy Vetayases extern struct apix_rebind_info apix_rebindinfo;
2717ff178cdSJimmy Vetayases 
2727ff178cdSJimmy Vetayases #define	APIX_SET_REBIND_INFO(_ovp, _nvp)\
2737ff178cdSJimmy Vetayases 	if (((_ovp)->v_flags & APIX_VECT_MASKABLE) == 0) {\
2747ff178cdSJimmy Vetayases 		apix_rebindinfo.i_pri = (_ovp)->v_pri;\
2757ff178cdSJimmy Vetayases 		apix_rebindinfo.i_old_cpuid = (_ovp)->v_cpuid;\
2767ff178cdSJimmy Vetayases 		apix_rebindinfo.i_old_av = (_ovp)->v_autovect;\
2777ff178cdSJimmy Vetayases 		apix_rebindinfo.i_new_cpuid = (_nvp)->v_cpuid;\
2787ff178cdSJimmy Vetayases 		apix_rebindinfo.i_new_av = (_nvp)->v_autovect;\
2797ff178cdSJimmy Vetayases 		apix_rebindinfo.i_go = 1;\
2807ff178cdSJimmy Vetayases 	}
2817ff178cdSJimmy Vetayases 
2827ff178cdSJimmy Vetayases #define	APIX_CLR_REBIND_INFO() \
2837ff178cdSJimmy Vetayases 	apix_rebindinfo.i_go = 0
2847ff178cdSJimmy Vetayases 
2857ff178cdSJimmy Vetayases #define	APIX_IS_FAKE_INTR(_vector)\
2867ff178cdSJimmy Vetayases 	(apix_rebindinfo.i_go && (_vector) == APIX_RESV_VECTOR)
2877ff178cdSJimmy Vetayases 
2887ff178cdSJimmy Vetayases #define	APIX_DO_FAKE_INTR(_cpu, _vector)\
2897ff178cdSJimmy Vetayases 	if (APIX_IS_FAKE_INTR(_vector)) {\
2907ff178cdSJimmy Vetayases 		struct autovec *tp;\
2917ff178cdSJimmy Vetayases 		if ((_cpu) == apix_rebindinfo.i_old_cpuid)\
2927ff178cdSJimmy Vetayases 			tp = apix_rebindinfo.i_old_av;\
2937ff178cdSJimmy Vetayases 		else if ((_cpu) == apix_rebindinfo.i_new_cpuid)\
2947ff178cdSJimmy Vetayases 			tp = apix_rebindinfo.i_new_av;\
2957ff178cdSJimmy Vetayases 		if (tp->av_vector != NULL &&\
2967ff178cdSJimmy Vetayases 		    (tp->av_flags & AV_PENTRY_PEND) == 0) {\
2977ff178cdSJimmy Vetayases 			tp->av_flags |= AV_PENTRY_PEND;\
2987ff178cdSJimmy Vetayases 			apix_insert_pending_av(apixs[(_cpu)], tp,\
2997ff178cdSJimmy Vetayases 			    tp->av_prilevel);\
3007ff178cdSJimmy Vetayases 			apixs[(_cpu)]->x_intr_pending |=\
3017ff178cdSJimmy Vetayases 			    (1 << tp->av_prilevel);\
3027ff178cdSJimmy Vetayases 		}\
3037ff178cdSJimmy Vetayases 	}
3047ff178cdSJimmy Vetayases 
3057ff178cdSJimmy Vetayases extern int apix_add_avintr(void *intr_id, int ipl, avfunc xxintr, char *name,
3067ff178cdSJimmy Vetayases     int vector, caddr_t arg1, caddr_t arg2, uint64_t *ticksp, dev_info_t *dip);
3077ff178cdSJimmy Vetayases extern void apix_rem_avintr(void *intr_id, int ipl, avfunc xxintr,
3087ff178cdSJimmy Vetayases     int virt_vect);
3097ff178cdSJimmy Vetayases 
3107ff178cdSJimmy Vetayases extern uint32_t apix_bind_cpu_locked(dev_info_t *dip);
3117ff178cdSJimmy Vetayases extern apix_vector_t *apix_rebind(apix_vector_t *vecp, processorid_t tocpu,
3127ff178cdSJimmy Vetayases     int count);
3137ff178cdSJimmy Vetayases 
3147ff178cdSJimmy Vetayases extern uchar_t apix_alloc_ipi(int ipl);
3157ff178cdSJimmy Vetayases extern apix_vector_t *apix_alloc_intx(dev_info_t *dip, int inum, int irqno);
3167ff178cdSJimmy Vetayases extern int apix_alloc_msi(dev_info_t *dip, int inum, int count, int behavior);
3177ff178cdSJimmy Vetayases extern int apix_alloc_msix(dev_info_t *dip, int inum, int count, int behavior);
3187ff178cdSJimmy Vetayases extern void apix_free_vectors(dev_info_t *dip, int inum, int count, int type);
3197ff178cdSJimmy Vetayases extern void apix_enable_vector(apix_vector_t *vecp);
3207ff178cdSJimmy Vetayases extern void apix_disable_vector(apix_vector_t *vecp);
3217ff178cdSJimmy Vetayases extern int apix_obsolete_vector(apix_vector_t *vecp);
3227ff178cdSJimmy Vetayases extern int apix_find_cont_vector_oncpu(uint32_t cpuid, int count);
3237ff178cdSJimmy Vetayases 
3247ff178cdSJimmy Vetayases extern void apix_set_dev_map(apix_vector_t *vecp, dev_info_t *dip, int inum);
3257ff178cdSJimmy Vetayases extern apix_vector_t *apix_get_dev_map(dev_info_t *dip, int inum, int type);
3267ff178cdSJimmy Vetayases extern apix_vector_t *apix_setup_io_intr(apix_vector_t *vecp);
3277ff178cdSJimmy Vetayases extern void ioapix_init_intr(int mask_apic);
3287ff178cdSJimmy Vetayases extern int apix_get_min_dev_inum(dev_info_t *dip, int type);
3297ff178cdSJimmy Vetayases extern int apix_get_max_dev_inum(dev_info_t *dip, int type);
3307ff178cdSJimmy Vetayases 
3317ff178cdSJimmy Vetayases /*
3327ff178cdSJimmy Vetayases  * apix.c
3337ff178cdSJimmy Vetayases  */
3347ff178cdSJimmy Vetayases extern int apix_addspl(int virtvec, int ipl, int min_ipl, int max_ipl);
3357ff178cdSJimmy Vetayases extern int apix_delspl(int virtvec, int ipl, int min_ipl, int max_ipl);
3367ff178cdSJimmy Vetayases extern void apix_intx_set_vector(int irqno, uint32_t cpuid, uchar_t vector);
3377ff178cdSJimmy Vetayases extern apix_vector_t *apix_intx_get_vector(int irqno);
3387ff178cdSJimmy Vetayases extern void apix_intx_enable(int irqno);
3397ff178cdSJimmy Vetayases extern void apix_intx_disable(int irqno);
3407ff178cdSJimmy Vetayases extern void apix_intx_free(int irqno);
3417ff178cdSJimmy Vetayases extern int apix_intx_rebind(int irqno, processorid_t cpuid, uchar_t vector);
3427ff178cdSJimmy Vetayases extern apix_vector_t *apix_set_cpu(apix_vector_t *vecp, int new_cpu,
3437ff178cdSJimmy Vetayases     int *result);
3447ff178cdSJimmy Vetayases extern apix_vector_t *apix_grp_set_cpu(apix_vector_t *vecp, int new_cpu,
3457ff178cdSJimmy Vetayases     int *result);
3467ff178cdSJimmy Vetayases extern void apix_level_intr_pre_eoi(int irq);
3477ff178cdSJimmy Vetayases extern void apix_level_intr_post_dispatch(int irq);
3487ff178cdSJimmy Vetayases 
3497ff178cdSJimmy Vetayases #ifdef	__cplusplus
3507ff178cdSJimmy Vetayases }
3517ff178cdSJimmy Vetayases #endif
3527ff178cdSJimmy Vetayases 
3537ff178cdSJimmy Vetayases #endif	/* __SYS_APIX_APIX_H */
354