xref: /titanic_54/usr/src/uts/sun4/sys/intr.h (revision 100b72f4fc209355ff607a0d787aad892d8a44ed)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*100b72f4Sandrei  * Common Development and Distribution License (the "License").
6*100b72f4Sandrei  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*100b72f4Sandrei  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_INTR_H
277c478bd9Sstevel@tonic-gate #define	_SYS_INTR_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Each cpu allocates an interrupt request pool with the size of
377c478bd9Sstevel@tonic-gate  * INTR_PENDING_MAX entries.
387c478bd9Sstevel@tonic-gate  * XXX this number needs to be tuned
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate #define	INTR_PENDING_MAX	64
417c478bd9Sstevel@tonic-gate #define	INTR_POOL_SIZE		(sizeof (struct intr_req) * INTR_PENDING_MAX)
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * Each cpu allocates two arrays, intr_head[] and intr_tail[], with the size of
457c478bd9Sstevel@tonic-gate  * PIL_LEVELS each.
467c478bd9Sstevel@tonic-gate  *
477c478bd9Sstevel@tonic-gate  * The entry 0 of the arrays are the head and the tail of the interrupt
487c478bd9Sstevel@tonic-gate  * request free list.
497c478bd9Sstevel@tonic-gate  *
507c478bd9Sstevel@tonic-gate  * The entries 1-15 of the arrays are the head and the tail of interrupt
517c478bd9Sstevel@tonic-gate  * level 1-15 request queues.
527c478bd9Sstevel@tonic-gate  */
537c478bd9Sstevel@tonic-gate #define	PIL_LEVELS	16	/* 0    : for the interrupt request free list */
547c478bd9Sstevel@tonic-gate 				/* 1-15 : for the pil level 1-15 */
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate #define	PIL_1	1
577c478bd9Sstevel@tonic-gate #define	PIL_2	2
587c478bd9Sstevel@tonic-gate #define	PIL_3	3
597c478bd9Sstevel@tonic-gate #define	PIL_4	4
607c478bd9Sstevel@tonic-gate #define	PIL_5	5
617c478bd9Sstevel@tonic-gate #define	PIL_6	6
627c478bd9Sstevel@tonic-gate #define	PIL_7	7
637c478bd9Sstevel@tonic-gate #define	PIL_8	8
647c478bd9Sstevel@tonic-gate #define	PIL_9	9
657c478bd9Sstevel@tonic-gate #define	PIL_10	10
667c478bd9Sstevel@tonic-gate #define	PIL_11	11
677c478bd9Sstevel@tonic-gate #define	PIL_12	12
687c478bd9Sstevel@tonic-gate #define	PIL_13	13
697c478bd9Sstevel@tonic-gate #define	PIL_14	14
707c478bd9Sstevel@tonic-gate #define	PIL_15	15
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate #ifndef _ASM
737c478bd9Sstevel@tonic-gate extern uint_t poke_cpu_inum;
747c478bd9Sstevel@tonic-gate extern size_t intr_add_max;
757c478bd9Sstevel@tonic-gate extern uint_t intr_add_div;
767c478bd9Sstevel@tonic-gate extern size_t intr_add_pools;
777c478bd9Sstevel@tonic-gate extern struct intr_req *intr_add_head;
787c478bd9Sstevel@tonic-gate extern struct intr_req *intr_add_tail;
797c478bd9Sstevel@tonic-gate extern void intr_init(struct cpu *);
807c478bd9Sstevel@tonic-gate extern void init_intr_pool(struct cpu *);
817c478bd9Sstevel@tonic-gate extern void cleanup_intr_pool(struct cpu *);
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate /*
847c478bd9Sstevel@tonic-gate  * interrupt request entry
857c478bd9Sstevel@tonic-gate  *
867c478bd9Sstevel@tonic-gate  *    - each cpu has an interrupt request free list formed thru
877c478bd9Sstevel@tonic-gate  *      init_intr_pool(); intr_head[0] and intr_tail[0] are the head
887c478bd9Sstevel@tonic-gate  *      and tail of the free list
897c478bd9Sstevel@tonic-gate  *
907c478bd9Sstevel@tonic-gate  *    - always get a free intr_req from the intr_head[0] and
917c478bd9Sstevel@tonic-gate  *      return a served intr_req to intr_tail[0]
927c478bd9Sstevel@tonic-gate  *
937c478bd9Sstevel@tonic-gate  *    - when vec_interrupt() is called, an interrupt request queue is built
947c478bd9Sstevel@tonic-gate  *      according to the pil level, intr_head[pil] points to the first
957c478bd9Sstevel@tonic-gate  *      interrupt request entry and intr_tail[pil] points to the last one
967c478bd9Sstevel@tonic-gate  *
977c478bd9Sstevel@tonic-gate  */
987c478bd9Sstevel@tonic-gate struct intr_req {
997c478bd9Sstevel@tonic-gate 	uint_t 		intr_number;
1007c478bd9Sstevel@tonic-gate 	struct intr_req *intr_next;
1017c478bd9Sstevel@tonic-gate };
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #endif	/* !_ASM */
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1067c478bd9Sstevel@tonic-gate }
1077c478bd9Sstevel@tonic-gate #endif
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate #endif	/* _SYS_INTR_H */
110