10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52973Sgovinda * Common Development and Distribution License (the "License"). 62973Sgovinda * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*11172SHaik.Aftandilian@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_INTREG_H 270Sstevel@tonic-gate #define _SYS_INTREG_H 280Sstevel@tonic-gate 29*11172SHaik.Aftandilian@Sun.COM #include <sys/machintreg.h> 300Sstevel@tonic-gate 31*11172SHaik.Aftandilian@Sun.COM #ifndef _ASM 32*11172SHaik.Aftandilian@Sun.COM #include <sys/types.h> 33*11172SHaik.Aftandilian@Sun.COM #endif 340Sstevel@tonic-gate 350Sstevel@tonic-gate #ifdef __cplusplus 360Sstevel@tonic-gate extern "C" { 370Sstevel@tonic-gate #endif 380Sstevel@tonic-gate 390Sstevel@tonic-gate #define INO_SIZE 6 /* Interrupt Number Offset bit size */ 400Sstevel@tonic-gate #define INR_SIZE (IGN_SIZE + INO_SIZE) /* Interrupt Number bit size */ 412973Sgovinda #define MAX_IGN (1 << IGN_SIZE) /* Max Interrupt Group Number size */ 422973Sgovinda #define MAX_INO (1 << INO_SIZE) /* Max Interrupt Number per group */ 435513Slm66018 #define MAXDEVINTRS (MAX_IGN * MAX_INO) /* Max hardware intrs allowed */ 445513Slm66018 455513Slm66018 /* 465513Slm66018 * A platform may require use of the system interrupt table beyond 475513Slm66018 * the maximum hardware interrupts specified above for virtual device 485513Slm66018 * interrupts. If the platform does not specify MAXVINTRS we default to 0. 495513Slm66018 */ 505513Slm66018 #ifndef MAXVINTRS 515513Slm66018 #define MAXVINTRS 0 525513Slm66018 #endif 535513Slm66018 545513Slm66018 /* 555513Slm66018 * maximum system interrupts allowed 565513Slm66018 */ 575513Slm66018 #define MAXIVNUM (MAXDEVINTRS + MAXVINTRS) 580Sstevel@tonic-gate 590Sstevel@tonic-gate /* 600Sstevel@tonic-gate * Interrupt State Machine 610Sstevel@tonic-gate * Each interrupt source has a 2-bit state machine which ensures that 620Sstevel@tonic-gate * software sees exactly one interrupt packet per assertion of the 630Sstevel@tonic-gate * interrupt signal. 640Sstevel@tonic-gate */ 650Sstevel@tonic-gate #define ISM_IDLE 0x0 /* not asserted or pending */ 660Sstevel@tonic-gate #define ISM_TRANSMIT 0x1 /* asserted but is not dispatched */ 670Sstevel@tonic-gate #define ISM_PENDING 0x2 /* dispatched to a processor or is in transit */ 680Sstevel@tonic-gate 690Sstevel@tonic-gate /* 700Sstevel@tonic-gate * Per-Processor Soft Interrupt Register 710Sstevel@tonic-gate * XXX use %asr when the new assembler supports them 720Sstevel@tonic-gate */ 730Sstevel@tonic-gate #define SET_SOFTINT %asr20 /* ASR 0x14 */ 740Sstevel@tonic-gate #define CLEAR_SOFTINT %asr21 /* ASR 0x15 */ 750Sstevel@tonic-gate #define SOFTINT %asr22 /* ASR 0x16 */ 760Sstevel@tonic-gate #define SOFTINT_MASK 0xFFFE /* <15:1> */ 770Sstevel@tonic-gate #define TICK_INT_MASK 0x1 /* <0> */ 780Sstevel@tonic-gate #define STICK_INT_MASK 0x10000 /* <0> */ 790Sstevel@tonic-gate 800Sstevel@tonic-gate /* 810Sstevel@tonic-gate * Per-Processor TICK Register and TICK_Compare registers 820Sstevel@tonic-gate * 830Sstevel@tonic-gate */ 840Sstevel@tonic-gate #define TICK_COMPARE %asr23 /* ASR 0x17 */ 850Sstevel@tonic-gate #define STICK %asr24 /* ASR 0x18 */ 860Sstevel@tonic-gate #define STICK_COMPARE %asr25 /* ASR 0x19 */ 870Sstevel@tonic-gate #define TICKINT_DIS_SHFT 0x3f 880Sstevel@tonic-gate 890Sstevel@tonic-gate #ifndef _ASM 900Sstevel@tonic-gate 910Sstevel@tonic-gate /* 920Sstevel@tonic-gate * Interrupt Packet (mondo) 930Sstevel@tonic-gate */ 940Sstevel@tonic-gate struct intr_packet { 950Sstevel@tonic-gate uint64_t intr_data0; /* can be an interrupt number or a pc */ 960Sstevel@tonic-gate uint64_t intr_data1; 970Sstevel@tonic-gate uint64_t intr_data2; 980Sstevel@tonic-gate }; 990Sstevel@tonic-gate 1000Sstevel@tonic-gate /* 1010Sstevel@tonic-gate * Leftover bogus stuff; removed them later 1020Sstevel@tonic-gate */ 1030Sstevel@tonic-gate struct cpu_intreg { 1040Sstevel@tonic-gate uint_t pend; 1050Sstevel@tonic-gate uint_t clr_pend; 1060Sstevel@tonic-gate uint_t set_pend; 1070Sstevel@tonic-gate uchar_t filler[0x1000 - 0xc]; 1080Sstevel@tonic-gate }; 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate struct sys_intreg { 1110Sstevel@tonic-gate uint_t sys_pend; 1120Sstevel@tonic-gate uint_t sys_m; 1130Sstevel@tonic-gate uint_t sys_mclear; 1140Sstevel@tonic-gate uint_t sys_mset; 1150Sstevel@tonic-gate uint_t itr; 1160Sstevel@tonic-gate }; 1170Sstevel@tonic-gate 1180Sstevel@tonic-gate #endif /* _ASM */ 1190Sstevel@tonic-gate 1200Sstevel@tonic-gate #ifdef __cplusplus 1210Sstevel@tonic-gate } 1220Sstevel@tonic-gate #endif 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate #endif /* _SYS_INTREG_H */ 125