Home | History | Annotate | Line # | Download | only in cortex
      1  1.12  jmcneill /*	$NetBSD: gic_reg.h,v 1.12 2020/11/22 19:53:47 jmcneill Exp $	*/
      2   1.1      matt /*-
      3   1.1      matt  * Copyright (c) 2012 The NetBSD Foundation, Inc.
      4   1.1      matt  * All rights reserved.
      5   1.1      matt  *
      6   1.1      matt  * This code is derived from software contributed to The NetBSD Foundation
      7   1.1      matt  * by Matt Thomas of 3am Software Foundry.
      8   1.1      matt  *
      9   1.1      matt  * Redistribution and use in source and binary forms, with or without
     10   1.1      matt  * modification, are permitted provided that the following conditions
     11   1.1      matt  * are met:
     12   1.1      matt  * 1. Redistributions of source code must retain the above copyright
     13   1.1      matt  *    notice, this list of conditions and the following disclaimer.
     14   1.1      matt  * 2. Redistributions in binary form must reproduce the above copyright
     15   1.1      matt  *    notice, this list of conditions and the following disclaimer in the
     16   1.1      matt  *    documentation and/or other materials provided with the distribution.
     17   1.1      matt  *
     18   1.1      matt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     19   1.1      matt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     20   1.1      matt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     21   1.1      matt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     22   1.1      matt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     23   1.1      matt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     24   1.1      matt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     25   1.1      matt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     26   1.1      matt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     27   1.1      matt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     28   1.1      matt  * POSSIBILITY OF SUCH DAMAGE.
     29   1.1      matt  */
     30   1.1      matt 
     31   1.1      matt /*
     32   1.1      matt  * ARM Generic Interrupt Controller Register Definitions
     33   1.1      matt  *
     34   1.1      matt  * These registers are accessible through a dedicated internal bus.
     35   1.1      matt  * All accesses must be done in a little-endian manner.
     36   1.1      matt  * The base address of the pages containing these registers is defined
     37   1.1      matt  * by the pins PERIPHBASE[31:13] which can be obtained by doing a
     38   1.1      matt  *	MRC p15,4,<Rd>,c15,c0,0; Read Configuration Base Address Register
     39   1.1      matt  *	(except cortex-A9 uniprocessor)
     40   1.1      matt  *
     41   1.1      matt  * GIC is used by all Cortex-A cores except the A8.
     42   1.1      matt  */
     43   1.1      matt 
     44   1.1      matt #ifndef _ARM_CORTEX_GICREG_H_
     45   1.1      matt #define	_ARM_CORTEX_GICREG_H_
     46   1.1      matt 
     47   1.1      matt #define	GICC_BASE	0x0100	// Offset in PeriphBase
     48   1.1      matt 
     49   1.1      matt #define	GICC_CTRL	0x0000	// CPU Interface Control Register
     50   1.1      matt #define	GICC_PMR	0x0004	// Interrupt Priority Mask Register
     51   1.5     skrll #define	GICC_BPR	0x0008	// Binary Point Register
     52   1.1      matt #define	GICC_IAR	0x000C	// Interrupt Acknowledge Register
     53   1.1      matt #define	GICC_EOIR	0x0010	// End Of Interrupt Register (WO)
     54   1.1      matt #define	GICC_RPR	0x0014	// Running Priority Register
     55   1.1      matt #define	GICC_HPPIR	0x0018	// Highest Priority Pending Interrupt Registers
     56   1.1      matt #define	GICC_ABPR	0x001C	// Aliased Binary Point Register
     57   1.1      matt #define	GICC_AIAR	0x0020	// Aliased Interrupt Acknowledge Register
     58   1.1      matt #define	GICC_AEOIR	0x0024	// Aliased End Of Interrupt Register
     59   1.1      matt #define	GICC_AHPPIR	0x0028	// Aliased Highest Priority Pending Interrupt Registers
     60   1.1      matt #define	GICC_APR0	0x00D0	// Active Priorites Register 0
     61   1.1      matt #define	GICC_APR1	0x00D4	// Active Priorites Register 1
     62   1.1      matt #define	GICC_APR2	0x00D8	// Active Priorites Register 2
     63   1.1      matt #define	GICC_APR3	0x00DC	// Active Priorites Register 3
     64   1.1      matt #define	GICC_NSAPR0	0x00E0	// Non-secure Active Priorities Register 0
     65   1.1      matt #define	GICC_NSAPR1	0x00E4	// Non-secure Active Priorities Register 1
     66   1.1      matt #define	GICC_NSAPR2	0x00E8	// Non-secure Active Priorities Register 2
     67   1.1      matt #define	GICC_NSAPR3	0x00EC	// Non-secure Active Priorities Register 3
     68   1.1      matt #define	GICC_IIDR	0x00FC	// CPU Interface Identification Register
     69   1.1      matt #define	GICC_DIR	0x1000	// Deactivate Interrupt Register
     70   1.1      matt 
     71   1.1      matt 
     72   1.1      matt #define	GICC_CTRL_V1_Enable		__BIT(0) // GICv1
     73   1.1      matt 
     74   1.1      matt #define	GICC_CTRL_V2_EnableGrp0		__BIT(0) // GICv2 !Secure | Secure
     75   1.1      matt #define	GICC_CTRL_V2_EnableGrp1		__BIT(1) // GICv2 !Secure | Secure
     76   1.1      matt 
     77   1.1      matt #define	GICC_CTRL_V2S_EOImodeNS		__BIT(9) // GICv2 Secure
     78   1.1      matt #define	GICC_CTRL_V2S_IRQBypDisGrp1	__BIT(6) // GICv2 Secure
     79   1.1      matt #define	GICC_CTRL_V2S_FIQBypDisGrp1	__BIT(4) // GICv2 Secure
     80   1.1      matt 
     81   1.1      matt #define	GICC_CTRL_V2NS_EOImodeNS	__BIT(10) // GICv2 !Secure
     82   1.1      matt #define	GICC_CTRL_V2NS_EOImodeS		__BIT(9) // GICv2 !Secure
     83   1.1      matt #define	GICC_CTRL_V2NS_IRQBypDisGrp1	__BIT(8) // GICv2 !Secure
     84   1.1      matt #define	GICC_CTRL_V2NS_FIQBypDisGrp1	__BIT(7) // GICv2 !Secure
     85   1.1      matt #define	GICC_CTRL_V2NS_IRQBypDisGrp0	__BIT(6) // GICv2 !Secure
     86   1.1      matt #define	GICC_CTRL_V2NS_FIQBypDisGrp0	__BIT(5) // GICv2 !Secure
     87   1.1      matt #define	GICC_CTRL_V2NS_CPBR		__BIT(4) // GICv2 !Secure
     88   1.1      matt #define	GICC_CTRL_V2NS_FIQEn		__BIT(3) // GICv2 !Secure
     89   1.1      matt #define	GICC_CTRL_V2NS_AckCtl		__BIT(2) // GICv2 !Secure
     90   1.1      matt 
     91   1.1      matt #define	GICC_PMR_PRIORITY		__BITS(7,0)
     92   1.1      matt #define	GICC_PMR_PRIORITIES		256
     93   1.3      matt #define	GICC_PMR_NS_PRIORITIES		128
     94   1.3      matt #define	GICC_PMR_NONSECURE		0x80
     95   1.1      matt #define	GICC_PMR_8_LEVELS		0x1f
     96   1.1      matt #define	GICC_PMR_16_LEVELS		0x0f
     97   1.1      matt #define	GICC_PMR_32_LEVELS		0x07
     98   1.1      matt #define	GICC_PMR_64_LEVELS		0x03
     99   1.1      matt #define	GICC_PMR_128_LEVELS		0x01
    100   1.1      matt 
    101   1.1      matt #define	GICC_IAR_CPUID			__BITS(12,10)
    102   1.1      matt #define	GICC_IAR_IRQ			__BITS(9,0)
    103   1.1      matt #define	GICC_IAR_IRQ_SPURIOUS		1023
    104   1.4     skrll #define	GICC_IAR_IRQ_SSPURIOUS		1022	// Secure
    105   1.1      matt 
    106   1.1      matt #define	GICC_EOIR_CPUID			__BITS(12,10)
    107   1.1      matt #define	GICC_EOIR_InterruptID		__BITS(9,0)
    108   1.1      matt 
    109   1.1      matt #define	GICC_HPPIR_CPUID		__BITS(12,10)
    110   1.1      matt #define	GICC_HPPIR_PendIntID		__BITS(9,0)
    111   1.1      matt 
    112   1.1      matt #define	GICC_IIDR_ProductID		__BITS(31,20)
    113   1.1      matt #define	GICC_IIDR_ArchVersion		__BITS(19,16)
    114   1.1      matt #define	GICC_IIDR_Revision		__BITS(15,12)
    115   1.1      matt #define	GICC_IIDR_Implementer		__BITS(11,0)
    116   1.1      matt 
    117   1.1      matt #define	GICC_DIR_CPUID			__BITS(12,10)
    118   1.1      matt #define	GICC_DIR_InterruptID		__BITS(9,0)
    119   1.1      matt 
    120   1.1      matt #define	GICD_BASE		0x1000 // Offset from PeriphBase
    121   1.1      matt 
    122   1.1      matt #define	GICD_CTRL		0x000 // Distributor Control Register
    123   1.1      matt #define	GICD_TYPER		0x004 // Interrupt Controller Type Register
    124   1.1      matt #define	GICD_IIDR		0x008 // Distributor Implementer Identification Register
    125   1.1      matt #define	GICD_IGROUPRn(n)	(0x080+4*(n)) // Interrupt Group Registers
    126   1.1      matt #define	GICD_ISENABLERn(n)	(0x100+4*(n)) // Interrupt Set-Enable Registers
    127   1.1      matt #define	GICD_ICENABLERn(n)	(0x180+4*(n)) // Interrupt Clear-Enable Registers
    128   1.1      matt #define	GICD_ISPENDRn(n)	(0x200+4*(n)) // Interrupt Set-Pending Registers
    129   1.1      matt #define	GICD_ICPENDRn(n)	(0x280+4*(n)) // Interrupt Clear-Pending Registers
    130   1.1      matt #define	GICD_ISACTIVERn(n)	(0x300+4*(n)) // GICv2 Interrupt Set-Active Registers
    131   1.1      matt #define	GICD_ICACTIVERn(n)	(0x380+4*(n)) // Interrupt Clear-Active Registers
    132   1.1      matt #define	GICD_IPRIORITYRn(n)	(0x400+4*(n)) // Interrupt Priority Registers
    133   1.1      matt 
    134   1.1      matt #define	GICD_ITARGETSRn(n)	(0x800+4*(n)) // Interrupt Processor Targets Registers
    135   1.1      matt #define	GICD_ICFGRn(n)		(0xC00+4*(n)) // Interrupt Configuration Registers
    136   1.7  jmcneill #define	GICD_IGRPMODRn(n)	(0xD00+4*(n)) // Interrupt Group Modifier Registers
    137   1.1      matt #define	GICD_NSACRn(n)		(0xE00+4*(n)) // Non-secure Access Control Registers, optional
    138   1.1      matt #define	GICD_SGIR		0xF00 // Software Generated Interrupt Register
    139   1.1      matt #define	GICD_CPENDSGIR(n)	(0xF10+4*(n)) // SGI Clear-Pending Registers
    140   1.1      matt #define	GICD_SPENDSGIR(n)	(0xF20+4*(n)) // SGI Set-Pending Registers
    141  1.11  jmcneill #define	GICD_IROUTER(n)		(0x6000+8*(n)) // Interrupt Routing Registers
    142   1.1      matt 
    143   1.7  jmcneill #define	GICD_CTRL_RWP			__BIT(31)	// GICv3
    144   1.7  jmcneill #define	GICD_CTRL_E1NWF			__BIT(7)	// GICv3
    145   1.7  jmcneill #define	GICD_CTRL_DS			__BIT(6)	// GICv3
    146   1.9  jmcneill #define	GICD_CTRL_ARE_NS		__BIT(4)	// GICv3
    147  1.12  jmcneill #define	GICD_CTRL_EnableGrp1S		__BIT(2)	// Secure only
    148   1.9  jmcneill #define	GICD_CTRL_EnableGrp1A		__BIT(1)	// GICv3
    149   1.1      matt #define	GICD_CTRL_Enable		__BIT(0)
    150   1.1      matt 
    151   1.8  jmcneill #define	GICD_TYPER_No1N			__BIT(25)	// GICv3
    152   1.8  jmcneill #define	GICD_TYPER_A3V			__BIT(24)	// GICv3
    153   1.8  jmcneill #define	GICD_TYPER_IDbits		__BITS(23,19)	// GICv3
    154   1.8  jmcneill #define	GICD_TYPER_DVIS			__BIT(18)	// GICv3
    155   1.8  jmcneill #define	GICD_TYPER_LPIS			__BIT(17)	// GICv3
    156   1.8  jmcneill #define	GICD_TYPER_MBIS			__BIT(16)	// GICv3
    157   1.1      matt #define	GICD_TYPER_LSPI			__BITS(15,11)
    158   1.1      matt #define	GICD_TYPER_SecurityExtn		__BIT(10)
    159   1.1      matt #define	GICD_TYPER_CPUNumber		__BITS(7,5)
    160   1.1      matt #define	GICD_TYPER_ITLinesNumber	__BITS(4,0)	// 32*(N+1)
    161   1.1      matt #define	GICD_TYPER_LINES(n)		MIN(32*(__SHIFTOUT((n), GICD_TYPER_ITLinesNumber) + 1), 1020)
    162   1.1      matt 
    163   1.6     skrll #define	GICD_IIDR_ProductID		__BITS(31,24)
    164   1.1      matt #define	GICD_IIDR_Variant		__BITS(19,16)
    165   1.1      matt #define	GICD_IIDR_Revision		__BITS(15,12)
    166   1.1      matt #define	GICD_IIDR_Implementer		__BITS(11,0)
    167   1.1      matt 
    168   1.1      matt /*
    169   1.1      matt  * This register is byte-accessible but always little-endian.
    170   1.1      matt  */
    171   1.1      matt #define	GICD_IPRIORITYR_Byte3		__BITS(31,24)
    172   1.1      matt #define	GICD_IPRIORITYR_Byte1		__BITS(23,16)
    173   1.1      matt #define	GICD_IPRIORITYR_Byte2		__BITS(15,8)
    174   1.1      matt #define	GICD_IPRIORITYR_Byte0		__BITS(7,0)
    175   1.1      matt 
    176   1.1      matt /*
    177   1.1      matt  * This register is byte-accessible but always little-endian.
    178   1.1      matt  */
    179   1.1      matt #define	GICD_ITARGETSR_Byte3		__BITS(31,24)
    180   1.1      matt #define	GICD_ITARGETSR_Byte1		__BITS(23,16)
    181   1.1      matt #define	GICD_ITARGETSR_Byte2		__BITS(15,8)
    182   1.1      matt #define	GICD_ITARGETSR_Byte0		__BITS(7,0)
    183   1.1      matt 
    184   1.1      matt #define	GICD_SGIR_TargetListFilter	__BITS(25,24)
    185   1.1      matt #define	GICD_SGIR_TargetListFilter_List	__SHIFTIN(0, GICD_SGIR_TargetListFilter)
    186   1.1      matt #define	GICD_SGIR_TargetListFilter_NotMe __SHIFTIN(1, GICD_SGIR_TargetListFilter)
    187   1.1      matt #define	GICD_SGIR_TargetListFilter_Me	__SHIFTIN(2, GICD_SGIR_TargetListFilter)
    188   1.1      matt #define	GICD_SGIR_TargetList		__BITS(23,16)
    189   1.1      matt #define	GICD_SGIR_NSATT			__BIT(15)
    190   1.1      matt #define	GICD_SGIR_SGIINTID		__BITS(3,0)
    191   1.1      matt 
    192   1.7  jmcneill #define	GICD_IROUTER_Aff3		__BITS(39,32)
    193   1.7  jmcneill #define	GICD_IROUTER_Interrupt_Routing_mode __BIT(31)
    194   1.7  jmcneill #define	GICD_IROUTER_Aff2		__BITS(23,16)
    195   1.7  jmcneill #define	GICD_IROUTER_Aff1		__BITS(15,8)
    196   1.7  jmcneill #define	GICD_IROUTER_Aff0		__BITS(7,0)
    197   1.7  jmcneill 
    198   1.8  jmcneill #define	GICR_CTLR		0x0000	// Redistributor Control Register
    199   1.7  jmcneill #define	GICR_IIDR		0x0004	// Implementor Identification Register
    200   1.7  jmcneill #define	GICR_TYPER		0x0008	// Redistributor Type Register
    201   1.7  jmcneill #define	GICR_STATUSR		0x0010	// Error Reporting Status Register, optional
    202   1.7  jmcneill #define	GICR_WAKER		0x0014	// Redistributor Wake Register
    203   1.7  jmcneill #define	GICR_SETLPIR		0x0040	// Set LPI Pending Register
    204   1.7  jmcneill #define	GICR_CLRLPIR		0x0048	// Clear LPI Pending Register
    205   1.7  jmcneill #define	GICR_PROPBASER		0x0070	// Redistributor Properties Base Address Register
    206   1.7  jmcneill #define	GICR_PENDBASER		0x0078	// Redistributor LPI Pending Table Base Address Register
    207   1.7  jmcneill #define	GICR_INVLPIR		0x00A0	// Redistributor Invalidate LPI Register
    208   1.7  jmcneill #define	GICR_INVALLR		0x00B0	// Redistributor Invalidate All Register
    209   1.7  jmcneill #define	GICR_SYNCR		0x00C0	// Redistributor Synchronize Register
    210   1.7  jmcneill 
    211   1.7  jmcneill #define	GICR_IGROUPR0		0x10080	// Interrupt Group Register 0
    212   1.7  jmcneill #define	GICR_ISENABLER0		0x10100	// Interrupt Set-Enable Register 0
    213   1.7  jmcneill #define	GICR_ICENABLER0		0x10180	// Interrupt Clear-Enable Register 0
    214   1.7  jmcneill #define	GICR_ISPENDR0		0x10200	// Interrupt Set-Pend Register 0
    215   1.7  jmcneill #define	GICR_ICPENDR0		0x10280	// Interrupt Clear-Pend Register 0
    216   1.7  jmcneill #define	GICR_ISACTIVER0		0x10300	// Interrupt Set-Active Register 0
    217   1.7  jmcneill #define	GICR_ICACTIVER0		0x10380	// Interrupt Clear-Active Register 0
    218   1.7  jmcneill #define	GICR_IPRIORITYRn(n)	(0x10400+4*(n)) // Interrupt Priority Registers
    219   1.7  jmcneill #define	GICR_ICFGRn(n)		(0x10C00+4*(n)) // SGI (0) / PPI (1) Configuration Register
    220   1.7  jmcneill #define	GICR_IGRPMODR0		0x10D00	// Interrupt Group Modifier Register 0
    221   1.7  jmcneill #define	GICR_NSACR		0x10E00	// Non-Secure Access Control Register
    222   1.7  jmcneill 
    223   1.8  jmcneill #define	GICR_CTLR_UWP			__BIT(31)
    224   1.8  jmcneill #define	GICR_CTLR_DPG1S			__BIT(26)
    225   1.8  jmcneill #define	GICR_CTLR_DPG1NS		__BIT(25)
    226   1.8  jmcneill #define	GICR_CTLR_DPG0			__BIT(24)
    227   1.8  jmcneill #define	GICR_CTLR_RWP			__BIT(3)
    228   1.8  jmcneill #define	GICR_CTLR_Enable_LPIs		__BIT(0)
    229   1.7  jmcneill 
    230   1.7  jmcneill #define	GICR_TYPER_Affinity_Value	__BITS(63,32)
    231   1.7  jmcneill #define	GICR_TYPER_Affinity_Value_Aff3	__BITS(63,56)
    232   1.7  jmcneill #define	GICR_TYPER_Affinity_Value_Aff2	__BITS(55,48)
    233   1.7  jmcneill #define	GICR_TYPER_Affinity_Value_Aff1	__BITS(47,40)
    234   1.7  jmcneill #define	GICR_TYPER_Affinity_Value_Aff0	__BITS(39,32)
    235   1.7  jmcneill #define	GICR_TYPER_CommonLPIAff		__BITS(25,24)
    236   1.7  jmcneill #define	GICR_TYPER_Processor_Number	__BITS(23,8)
    237   1.7  jmcneill #define	GICR_TYPER_DPGS			__BIT(5)
    238   1.7  jmcneill #define	GICR_TYPER_Last			__BIT(4)
    239   1.7  jmcneill #define	GICR_TYPER_DirectLPI		__BIT(3)
    240   1.7  jmcneill #define	GICR_TYPER_VLPIS		__BIT(1)
    241   1.7  jmcneill #define	GICR_TYPER_PLPIS		__BIT(0)
    242   1.7  jmcneill 
    243   1.7  jmcneill #define	GICR_WAKER_ChildrenAsleep	__BIT(2)
    244   1.7  jmcneill #define	GICR_WAKER_ProcessorSleep	__BIT(1)
    245   1.7  jmcneill 
    246   1.8  jmcneill #define	GICR_PROPBASER_OuterCache	__BITS(58,56)
    247   1.8  jmcneill #define	GICR_PROPBASER_Physical_Address	__BITS(51,12)
    248   1.8  jmcneill #define	GICR_PROPBASER_Shareability	__BITS(11,10)
    249   1.8  jmcneill #define	GICR_PROPBASER_InnerCache	__BITS(9,7)
    250   1.8  jmcneill #define	GICR_PROPBASER_IDbits		__BITS(4,0)
    251   1.8  jmcneill 
    252   1.8  jmcneill #define	GICR_PENDBASER_PTZ		__BIT(62)
    253   1.8  jmcneill #define	GICR_PENDBASER_OuterCache	__BITS(58,56)
    254   1.8  jmcneill #define	GICR_PENDBASER_Physical_Address	__BITS(51,16)
    255   1.8  jmcneill #define	GICR_PENDBASER_Shareability	__BITS(11,10)
    256   1.8  jmcneill #define	GICR_PENDBASER_InnerCache	__BITS(9,7)
    257   1.8  jmcneill 
    258   1.8  jmcneill #define	GICR_Shareability_NS		0	// Non-shareable
    259   1.8  jmcneill #define	GICR_Shareability_IS		1	// Inner Shareable
    260   1.8  jmcneill #define	GICR_Shareability_OS		2	// Outer Shareable
    261   1.8  jmcneill 
    262   1.8  jmcneill #define	GICR_Cache_DEVICE_nGnRnE	0	// Device-nGnRnE
    263   1.8  jmcneill #define	GICR_Cache_NORMAL_NC		1	// Non-cacheable
    264   1.8  jmcneill #define	GICR_Cache_NORMAL_RA_WT		2	// Cacheable Read-allocate, Write-through
    265   1.8  jmcneill #define	GICR_Cache_NORMAL_RA_WB		3	// Cacheable Read-allocate, Write-back
    266   1.8  jmcneill #define	GICR_Cache_NORMAL_WA_WT		4	// Cacheable Write-allocate, Write-through
    267   1.8  jmcneill #define	GICR_Cache_NORMAL_WA_WB		5	// Cacheable Write-allocate, Write-back
    268   1.8  jmcneill #define	GICR_Cache_NORMAL_RA_WA_WT	6	// Cacheable Read-allocate, Write-allocate, Write-through
    269   1.8  jmcneill #define	GICR_Cache_NORMAL_RA_WA_WB	7	// Cacheable Read-allocate, Write-allocate, Write-back
    270   1.8  jmcneill 
    271   1.8  jmcneill /*
    272   1.8  jmcneill  * GICv3 Locality-specific Peripheral Interrupts
    273   1.8  jmcneill  */
    274   1.8  jmcneill 
    275   1.8  jmcneill #define	GIC_LPI_BASE			0x2000	// Base LPI INTID
    276   1.8  jmcneill 
    277   1.8  jmcneill #define	GIC_LPICONF_Priority		__BITS(7,2)
    278   1.8  jmcneill #define	GIC_LPICONF_Res1		__BIT(1)
    279   1.8  jmcneill #define	GIC_LPICONF_Enable		__BIT(0)
    280   1.7  jmcneill 
    281   1.1      matt /*
    282   1.1      matt  * GICv1 names
    283   1.1      matt  */
    284   1.1      matt #define	GICv1_ICDDCR		GICD_CTLR
    285   1.1      matt #define	GICv1_ICDICTR		GICD_TYPER
    286   1.1      matt #define	GICv1_ICDIIDR		GICD_IIDR
    287   1.1      matt #define	GICv1_ICDISRn(n)	GICD_IGROUPRn(n)
    288   1.1      matt #define	GICv1_ICDABRn(n)	GICD_ISACTIVERn(n)
    289   1.1      matt #define	GICv1_ICDISERn(n)	GICD_ISENABLERn(n)
    290   1.1      matt #define	GICv1_ICDICERn(n)	GICD_ICENABLERn(n)
    291   1.1      matt #define	GICv1_ICDISPRn(n)	GICD_ISPENDRn(n)
    292   1.1      matt #define	GICv1_ICDICPRn(n)	GICD_ICPENDRn(n)
    293   1.1      matt #define	GICv1_ICDIPRn(n)	GICD_IPRIORITYRn(n)
    294   1.1      matt #define	GICv1_ICDIPTRn(n)	GICD_ITARGETSRn(n)
    295   1.1      matt #define	GICv1_ICDICRn(n)	GICD_ICFGRn(n)
    296   1.1      matt #define	GICv1_ICDSGIR		GICD_SGIR
    297   1.1      matt 
    298   1.1      matt #define	GICv1_ICCICR		GICC_CTLR
    299   1.1      matt #define	GICv1_ICCPMR		GICC_PMR
    300   1.1      matt #define	GICv1_ICCBPR		GICC_BPR
    301   1.1      matt #define	GICv1_ICCIAR		GICC_IAR
    302   1.1      matt #define	GICv1_ICCEOIR		GICC_EOIR
    303   1.1      matt #define	GICv1_ICCRPR		GICC_RPR
    304   1.1      matt #define	GICv1_ICCABPR		GICC_ABPR
    305   1.1      matt #define	GICv1_ICCHPIR		GICC_HPPIR
    306   1.1      matt #define	GICv1_ICCIIDR		GICC_IIDR
    307   1.1      matt 
    308   1.8  jmcneill /*
    309   1.8  jmcneill  * GICv2m (MSI)
    310   1.8  jmcneill  */
    311   1.2      matt 
    312   1.2      matt #define GIC_MSI_TYPER		0x0008
    313   1.2      matt #define GIC_MSI_SETSPI		0x0040
    314   1.2      matt #define GIC_MSI_PIDR2		0x0fe8
    315   1.2      matt #define GIC_MSI_IIDR		0x0ffc
    316   1.2      matt 
    317   1.2      matt #define GIC_MSI_TYPER_BASE	__BITS(25,16)	// Starting SPI of MSIs
    318   1.2      matt #define GIC_MSI_TYPER_NUMBER	__BITS(9,0)	// Count of MSIs
    319   1.2      matt 
    320   1.8  jmcneill /*
    321   1.8  jmcneill  * GICv3 Interrupt Translation Service (ITS)
    322   1.8  jmcneill  */
    323   1.8  jmcneill 
    324   1.8  jmcneill #define	GITS_CTLR		0x00000		// ITS control register
    325   1.8  jmcneill #define	GITS_IIDR		0x00004		// ITS Identification register
    326   1.8  jmcneill #define	GITS_TYPER		0x00008		// ITS Type register
    327   1.8  jmcneill #define	GITS_CBASER		0x00080		// ITS Command Queue Descriptor
    328   1.8  jmcneill #define	GITS_CWRITER		0x00088		// ITS Write register
    329   1.8  jmcneill #define	GITS_CREADR		0x00090		// ITS Read register
    330   1.8  jmcneill #define	GITS_BASERn(n)		(0x00100+8*(n))	// ITS Translation Table Descriptors
    331   1.8  jmcneill #define	GITS_PIDR2		0x0FFE8		// ITS Peripheral ID2 Register
    332   1.8  jmcneill #define	GITS_TRANSLATER		0x10040		// ITS Translation register
    333   1.8  jmcneill 
    334   1.8  jmcneill #define	GITS_CTLR_Quiescent		__BIT(31)
    335   1.8  jmcneill #define	GITS_CTLR_ITS_Number		__BITS(7,4)
    336   1.8  jmcneill #define	GITS_CTLR_ImDe			__BIT(1)
    337   1.8  jmcneill #define	GITS_CTLR_Enabled		__BIT(0)
    338   1.8  jmcneill 
    339  1.10     skrll #define	GITS_IIDR_ProductID		__BITS(31,24)
    340  1.10     skrll #define	GITS_IIDR_Variant		__BITS(19,16)
    341  1.10     skrll #define	GITS_IIDR_Revision		__BITS(15,12)
    342  1.10     skrll #define	GITS_IIDR_Implementor		__BITS(11,0)
    343  1.10     skrll 
    344   1.8  jmcneill #define	GITS_TYPER_VMOVP		__BIT(37)
    345   1.8  jmcneill #define	GITS_TYPER_CIL			__BIT(36)
    346   1.8  jmcneill #define	GITS_TYPER_CIDbits		__BITS(35,32)
    347   1.8  jmcneill #define	GITS_TYPER_HCC			__BITS(31,24)
    348   1.8  jmcneill #define	GITS_TYPER_PTA			__BIT(19)
    349   1.8  jmcneill #define	GITS_TYPER_SEIS			__BIT(18)
    350   1.8  jmcneill #define	GITS_TYPER_Devbits		__BITS(17,13)
    351   1.8  jmcneill #define	GITS_TYPER_ID_bits		__BITS(12,8)
    352   1.8  jmcneill #define	GITS_TYPER_ITT_entry_size	__BITS(7,4)
    353   1.8  jmcneill #define	GITS_TYPER_CCT			__BIT(2)
    354   1.8  jmcneill #define	GITS_TYPER_Virtual		__BIT(1)
    355   1.8  jmcneill #define	GITS_TYPER_Physical		__BIT(0)
    356   1.8  jmcneill 
    357   1.8  jmcneill #define	GITS_CBASER_Valid		__BIT(63)
    358   1.8  jmcneill #define	GITS_CBASER_InnerCache		__BITS(61,59)
    359   1.8  jmcneill #define	GITS_CBASER_OuterCache		__BITS(55,53)
    360   1.8  jmcneill #define	GITS_CBASER_Physical_Address	__BITS(51,12)
    361   1.8  jmcneill #define	GITS_CBASER_Shareability	__BITS(11,10)
    362   1.8  jmcneill #define	GITS_CBASER_Size		__BITS(7,0)
    363   1.8  jmcneill 
    364   1.8  jmcneill #define	GITS_CWRITER_Offset		__BITS(19,5)
    365   1.8  jmcneill #define	GITS_CWRITER_Retry		__BIT(0)
    366   1.8  jmcneill 
    367   1.8  jmcneill #define	GITS_CREADR_Offset		__BITS(19,5)
    368   1.8  jmcneill #define	GITS_CREADR_Stalled		__BIT(0)
    369   1.8  jmcneill 
    370   1.8  jmcneill #define	GITS_BASER_Valid		__BIT(63)
    371   1.8  jmcneill #define	GITS_BASER_Indirect		__BIT(62)
    372   1.8  jmcneill #define	GITS_BASER_InnerCache		__BITS(61,59)
    373   1.8  jmcneill #define	GITS_BASER_Type			__BITS(58,56)
    374   1.8  jmcneill #define	GITS_BASER_OuterCache		__BITS(55,53)
    375   1.8  jmcneill #define	GITS_BASER_Entry_Size		__BITS(52,48)
    376   1.8  jmcneill #define	GITS_BASER_Physical_Address	__BITS(47,12)
    377   1.8  jmcneill #define	GITS_BASER_Shareability		__BITS(11,10)
    378   1.8  jmcneill #define	GITS_BASER_Page_Size		__BITS(9,8)
    379   1.8  jmcneill #define	GITS_BASER_Size			__BITS(7,0)
    380   1.8  jmcneill 
    381   1.8  jmcneill #define	GITS_Shareability_NS		0	// Non-shareable
    382   1.8  jmcneill #define	GITS_Shareability_IS		1	// Inner Shareable
    383   1.8  jmcneill #define	GITS_Shareability_OS		2	// Outer Shareable
    384   1.8  jmcneill 
    385   1.8  jmcneill #define	GITS_Cache_DEVICE_nGnRnE	0	// Device-nGnRnE
    386   1.8  jmcneill #define	GITS_Cache_NORMAL_NC		1	// Non-cacheable
    387   1.8  jmcneill #define	GITS_Cache_NORMAL_RA_WT		2	// Cacheable Read-allocate, Write-through
    388   1.8  jmcneill #define	GITS_Cache_NORMAL_RA_WB		3	// Cacheable Read-allocate, Write-back
    389   1.8  jmcneill #define	GITS_Cache_NORMAL_WA_WT		4	// Cacheable Write-allocate, Write-through
    390   1.8  jmcneill #define	GITS_Cache_NORMAL_WA_WB		5	// Cacheable Write-allocate, Write-back
    391   1.8  jmcneill #define	GITS_Cache_NORMAL_RA_WA_WT	6	// Cacheable Read-allocate, Write-allocate, Write-through
    392   1.8  jmcneill #define	GITS_Cache_NORMAL_RA_WA_WB	7	// Cacheable Read-allocate, Write-allocate, Write-back
    393   1.8  jmcneill 
    394   1.8  jmcneill #define	GITS_Type_Unimplemented		0	// Unimplemented
    395   1.8  jmcneill #define	GITS_Type_Devices		1	// Devices table
    396   1.8  jmcneill #define	GITS_Type_vPEs			2	// vPEs table
    397   1.8  jmcneill #define	GITS_Type_InterruptCollections	4	// Interrupt collections table
    398   1.8  jmcneill 
    399   1.8  jmcneill #define	GITS_Page_Size_4KB		0
    400   1.8  jmcneill #define	GITS_Page_Size_16KB		1
    401   1.8  jmcneill #define	GITS_Page_Size_64KB		2
    402   1.8  jmcneill 
    403   1.8  jmcneill struct gicv3_its_command {
    404   1.8  jmcneill 	uint64_t	dw[4];
    405   1.8  jmcneill };
    406   1.8  jmcneill 
    407   1.8  jmcneill #define	GITS_CMD_MOVI			0x01
    408   1.8  jmcneill #define	GITS_CMD_INT			0x03
    409   1.8  jmcneill #define	GITS_CMD_CLEAR			0x04
    410   1.8  jmcneill #define	GITS_CMD_SYNC			0x05
    411   1.8  jmcneill #define	GITS_CMD_MAPD			0x08
    412   1.8  jmcneill #define	GITS_CMD_MAPC			0x09
    413   1.8  jmcneill #define	GITS_CMD_MAPTI			0x0A
    414   1.8  jmcneill #define	GITS_CMD_MAPI			0x0B
    415   1.8  jmcneill #define	GITS_CMD_INV			0x0C
    416   1.8  jmcneill #define	GITS_CMD_INVALL			0x0D
    417   1.8  jmcneill #define	GITS_CMD_MOVALL			0x0E
    418   1.8  jmcneill #define	GITS_CMD_DISCARD		0x0F
    419   1.8  jmcneill #define	GITS_CMD_VMOVI			0x21
    420   1.8  jmcneill #define	GITS_CMD_VMOVP			0x22
    421   1.8  jmcneill #define	GITS_CMD_VSYNC			0x25
    422   1.8  jmcneill #define	GITS_CMD_VMAPP			0x29
    423   1.8  jmcneill #define	GITS_CMD_VMAPTI			0x2A
    424   1.8  jmcneill #define	GITS_CMD_VMAPI			0x2B
    425   1.8  jmcneill #define	GITS_CMD_VINVALL		0x2D
    426   1.8  jmcneill 
    427   1.1      matt #endif /* !_ARM_CORTEX_GICREG_H_ */
    428