xref: /titanic_44/usr/src/uts/sun4/sys/intreg.h (revision 023e71de9e5670cebc23dd51162833661d3d2d3b)
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
5b0fc0e77Sgovinda  * Common Development and Distribution License (the "License").
6b0fc0e77Sgovinda  * 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*023e71deSHaik Aftandilian  * Copyright 2009 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_INTREG_H
277c478bd9Sstevel@tonic-gate #define	_SYS_INTREG_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <sys/machintreg.h>
307c478bd9Sstevel@tonic-gate 
31*023e71deSHaik Aftandilian #ifndef	_ASM
32*023e71deSHaik Aftandilian #include <sys/types.h>
33*023e71deSHaik Aftandilian #endif
34*023e71deSHaik Aftandilian 
357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #define	INO_SIZE	6		/* Interrupt Number Offset bit size */
407c478bd9Sstevel@tonic-gate #define	INR_SIZE	(IGN_SIZE + INO_SIZE)	/* Interrupt Number bit size */
41b0fc0e77Sgovinda #define	MAX_IGN		(1 << IGN_SIZE) /* Max Interrupt Group Number size */
42b0fc0e77Sgovinda #define	MAX_INO		(1 << INO_SIZE) /* Max Interrupt Number per group */
43a10abbb4Slm66018 #define	MAXDEVINTRS	(MAX_IGN * MAX_INO) /* Max hardware intrs allowed */
44a10abbb4Slm66018 
45a10abbb4Slm66018 /*
46a10abbb4Slm66018  * A platform may require use of the system interrupt table beyond
47a10abbb4Slm66018  * the maximum hardware interrupts specified above for virtual device
48a10abbb4Slm66018  * interrupts. If the platform does not specify MAXVINTRS we default to 0.
49a10abbb4Slm66018  */
50a10abbb4Slm66018 #ifndef MAXVINTRS
51a10abbb4Slm66018 #define	MAXVINTRS	0
52a10abbb4Slm66018 #endif
53a10abbb4Slm66018 
54a10abbb4Slm66018 /*
55a10abbb4Slm66018  * maximum system interrupts allowed
56a10abbb4Slm66018  */
57a10abbb4Slm66018 #define	MAXIVNUM	(MAXDEVINTRS + MAXVINTRS)
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /*
607c478bd9Sstevel@tonic-gate  * Interrupt State Machine
617c478bd9Sstevel@tonic-gate  *	Each interrupt source has a 2-bit state machine which ensures that
627c478bd9Sstevel@tonic-gate  *	software sees exactly one interrupt packet per assertion of the
637c478bd9Sstevel@tonic-gate  *	interrupt signal.
647c478bd9Sstevel@tonic-gate  */
657c478bd9Sstevel@tonic-gate #define	ISM_IDLE	0x0	/* not asserted or pending */
667c478bd9Sstevel@tonic-gate #define	ISM_TRANSMIT	0x1	/* asserted but is not dispatched */
677c478bd9Sstevel@tonic-gate #define	ISM_PENDING	0x2	/* dispatched to a processor or is in transit */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /*
707c478bd9Sstevel@tonic-gate  * Per-Processor Soft Interrupt Register
717c478bd9Sstevel@tonic-gate  * XXX use %asr when the new assembler supports them
727c478bd9Sstevel@tonic-gate  */
737c478bd9Sstevel@tonic-gate #define	SET_SOFTINT	%asr20		/* ASR 0x14 */
747c478bd9Sstevel@tonic-gate #define	CLEAR_SOFTINT	%asr21		/* ASR 0x15 */
757c478bd9Sstevel@tonic-gate #define	SOFTINT		%asr22		/* ASR 0x16 */
767c478bd9Sstevel@tonic-gate #define	SOFTINT_MASK	0xFFFE		/* <15:1> */
777c478bd9Sstevel@tonic-gate #define	TICK_INT_MASK	0x1		/* <0> */
787c478bd9Sstevel@tonic-gate #define	STICK_INT_MASK	0x10000		/* <0> */
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate /*
817c478bd9Sstevel@tonic-gate  * Per-Processor TICK Register and TICK_Compare registers
827c478bd9Sstevel@tonic-gate  *
837c478bd9Sstevel@tonic-gate  */
847c478bd9Sstevel@tonic-gate #define	TICK_COMPARE	%asr23		/* ASR 0x17 */
857c478bd9Sstevel@tonic-gate #define	STICK		%asr24		/* ASR 0x18 */
867c478bd9Sstevel@tonic-gate #define	STICK_COMPARE	%asr25		/* ASR 0x19 */
877c478bd9Sstevel@tonic-gate #define	TICKINT_DIS_SHFT	0x3f
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate #ifndef _ASM
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate /*
927c478bd9Sstevel@tonic-gate  * Interrupt Packet (mondo)
937c478bd9Sstevel@tonic-gate  */
947c478bd9Sstevel@tonic-gate struct intr_packet {
957c478bd9Sstevel@tonic-gate 	uint64_t intr_data0; /* can be an interrupt number or a pc */
967c478bd9Sstevel@tonic-gate 	uint64_t intr_data1;
977c478bd9Sstevel@tonic-gate 	uint64_t intr_data2;
987c478bd9Sstevel@tonic-gate };
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * Leftover bogus stuff; removed them later
1027c478bd9Sstevel@tonic-gate  */
1037c478bd9Sstevel@tonic-gate struct cpu_intreg {
1047c478bd9Sstevel@tonic-gate 	uint_t	pend;
1057c478bd9Sstevel@tonic-gate 	uint_t	clr_pend;
1067c478bd9Sstevel@tonic-gate 	uint_t	set_pend;
1077c478bd9Sstevel@tonic-gate 	uchar_t	filler[0x1000 - 0xc];
1087c478bd9Sstevel@tonic-gate };
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate struct sys_intreg {
1117c478bd9Sstevel@tonic-gate 	uint_t	sys_pend;
1127c478bd9Sstevel@tonic-gate 	uint_t	sys_m;
1137c478bd9Sstevel@tonic-gate 	uint_t	sys_mclear;
1147c478bd9Sstevel@tonic-gate 	uint_t	sys_mset;
1157c478bd9Sstevel@tonic-gate 	uint_t	itr;
1167c478bd9Sstevel@tonic-gate };
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate #endif  /* _ASM */
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1217c478bd9Sstevel@tonic-gate }
1227c478bd9Sstevel@tonic-gate #endif
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate #endif	/* _SYS_INTREG_H */
125