xref: /xnu-8020.101.4/pexpert/pexpert/arm/AIC.h (revision e7776783b89a353188416a9a346c6cdb4928faad)
1 /*
2  * Copyright (c) 2009 Apple Inc. All rights reserved.
3  */
4 
5 #ifndef _PEXPERT_ARM_AIC_H
6 #define _PEXPERT_ARM_AIC_H
7 
8 #ifndef ASSEMBLER
9 
10 static inline unsigned long
_aic_read32(unsigned long addr)11 _aic_read32(unsigned long addr)
12 {
13 	unsigned long data;
14 	data = *(volatile unsigned *)addr;
15 	return data;
16 }
17 
18 static inline void
_aic_write32(unsigned long addr,unsigned long data)19 _aic_write32(unsigned long addr, unsigned long data)
20 {
21 	*(volatile unsigned *)(addr) = data;
22 }
23 
24 #define aic_read32(offset, data) (_aic_read32(pic_base + (offset)))
25 #define aic_write32(offset, data) (_aic_write32(pic_base + (offset), (data)))
26 
27 #endif
28 
29 // AIC
30 #define kAICAicRev                      (0x0000)
31 #define kAICAicCap0                     (0x0004)
32 #define kAICAicCap0Int(n)               ((n) & 0x3FF)
33 #define kAICAicCap0Proc(n)              ((((n) >> 16) & 0x1F) + 1)
34 #define kAICAicCap1                     (0x0008)
35 #define kAICAicRst                      (0x000C)
36 #define kAICGlbCfg                      (0x0010)
37 #define kAICMainTimLo                   (0x0020)
38 #define kAICMainTimHi                   (0x0028)
39 #define kAICIPINormalDbg                (0x0030)
40 #define kAICIPISelfDbg                  (0x0034)
41 
42 #define kAICWhoAmI                      (0x2000)
43 #define kAICIack                        (0x2004)
44 #define kAICIackVecType(n)              (((n) >> 16) & 0x7)
45 #define kAICIackVecTypeSpurious         (0)
46 #define kAICIackVecTypeExtInt           (1)
47 #define kAICIackVecTypeIPI              (4)
48 #define kAICIackVecTypeTimer            (7)
49 #define kAICIackVecExtInt(n)            ((n) & 0x3FF)
50 #define kAICIackVecIPIType(n)           ((n) & 0x003)
51 #define kAICIackVecIPITypeNormal        (1)
52 #define kAICIackVecIPITypeSelf          (2)
53 #define kAICIPISet                      (0x2008)
54 #define kAICIPIClr                      (0x200C)
55 #define kAICIPIClrSelf                  (0x80000000)
56 #define kAICTmrCfg                      (0x2010)
57 #define kAICTmrCfgEn                    (1)
58 #define kAICTmrCfgFslPTI                (0 << 4)
59 #define kAICTmrCfgFslSGTI               (1 << 4)
60 #define kAICTmrCfgFslETI                (2 << 4)
61 #define kAICTmrCnt                      (0x2014)
62 #define kAICTmrIntStat                  (0x2018)
63 #define kAICTmrIntStatPct               (1)
64 #define kAICTmrStateSet                 (0x201C)
65 #define kAICTmrStateClr                 (0x2020)
66 #define kAICBankedCoreRegs              (0x2000)
67 #define kAICBankedCoreTmrCnt            (0x14)
68 #define kAICBankedCoreTmrIntStat        (0x18)
69 
70 #define kAICTgtDst(n)                   (0x3000 + (n) * 4)
71 #define kAICSwGenSet(n)                 (0x4000 + (n) * 4)
72 #define kAICSwGenClr(n)                 (0x4080 + (n) * 4)
73 #define kAICIntMaskSet(n)               (0x4100 + (n) * 4)
74 #define kAICIntMaskClr(n)               (0x4180 + (n) * 4)
75 #define kAICHwIntMon(n)                 (0x4200 + (n) * 4)
76 
77 #define kAICAliasWhoAmI(n)              (0x5000 + (n) * 0x80 + 0x00)
78 #define kAICAliasIack(n)                (0x5000 + (n) * 0x80 + 0x04)
79 #define kAICAliasIPISet(n)              (0x5000 + (n) * 0x80 + 0x08)
80 #define kAICAliasIPIClr(n)              (0x5000 + (n) * 0x80 + 0x0C)
81 #define kAICAliasTmrCfg(n)              (0x5000 + (n) * 0x80 + 0x10)
82 #define kAICAliasTmrCnt(n)              (0x5000 + (n) * 0x80 + 0x14)
83 #define kAICAliasTmrIntStat(n)          (0x5000 + (n) * 0x80 + 0x18)
84 #define kAICAliasTmrStateSet(n)         (0x5000 + (n) * 0x80 + 0x1C)
85 #define kAICAliasTmrStateClr(n)         (0x5000 + (n) * 0x80 + 0x20)
86 
87 #define kAICExtIntShift                 (5)
88 #define kAICExtIntMask                  (0x1F)
89 
90 #endif /* ! _PEXPERT_ARM_AIC_H */
91