#ifndef _POWERPC_BOOKE_OPENPICREG_H_
#define _POWERPC_BOOKE_OPENPICREG_H_
#define VPR_MSK 0x80000000
#define VPR_A 0x40000000
#define VPR_P 0x00800000
#define VPR_P_HIGH 0x00800000
#define VPR_S 0x00400000
#define VPR_S_LEVEL 0x00400000
#define VPR_PRIORITY 0x000f0000
#define VPR_PRIORITY_GET(n) (((n) >> 16) & 0x000f)
#define VPR_PRIORITY_MAKE(n) (((n) & 0x000f) << 16)
#define VPR_VECTOR 0x0000ffff
#define VPR_VECTOR_GET(n) (((n) >> 0) & 0xffff)
#define VPR_VECTOR_MAKE(n) (((n) & 0xffff) << 0)
#define VPR_LEVEL_LOW (VPR_S_LEVEL)
#define VPR_LEVEL_HIGH (VPR_S_LEVEL | VPR_P_HIGH)
#define DR_EP 0x80000000
#define DR_CI(n) (1 << (30 - (n)))
#define DR_P(n) (1 << (n))
#define OPENPIC_BRR1 0x0000
#define BRR1_IPID(n) (((n) >> 16) & 0xffff)
#define BRR1_IPMJ(n) (((n) >> 8) & 0x00ff)
#define BRR1_IPMN(n) (((n) >> 0) & 0x00ff)
#define OPENPIC_BRR2 0x0010
#define BRR2_IPINT0(n) (((n) >> 16) & 0xff)
#define BRR2_IPCFG0(n) (((n) >> 0) & 0xff)
#define OPENPIC_IPIDR(n) (0x0040 + 0x10 * (n))
#define OPENPIC_CTPR 0x0080
#define OPENPIC_WHOAMI 0x0090
#define OPENPIC_IACK 0x00a0
#define OPENPIC_EOI 0x00b0
#define OPENPIC_FRR 0x1000
#define FRR_NIRQ_GET(n) (((n) >> 16) & 0x7ff)
#define FRR_NCPU_GET(n) (((n) >> 8) & 0x01f)
#define FRR_VID_GET(n) (((n) >> 0) & 0x0ff)
#define OPENPIC_GCR 0x1020
#define GCR_RST 0x80000000
#define GCR_M 0x20000000
#define OPENPIC_VIR 0x1080
#define OPENPIC_PIR 0x1090
#define OPENPIC_IPIVPR(n) (0x10a0 + 0x10 * (n))
#define OPENPIC_SVR 0x10e0
#define SVR_VECTOR 0x0000ffff
#define SVR_VECTOR_GET(n) (((n) >> 0) & 0xffff)
#define SVR_VECTOR_MAKE(n) (((n) & 0xffff) << 0)
#define OPENPIC_TFRR 0x10f0
#define OPENPIC_GTCCR(cpu, n) (0x1100 + 0x40 * (n) + 0x1000 * (cpu))
#define GTCCR_TOG 0x80000000
#define GTCCR_COUNT 0x7fffffff
#define OPENPIC_GTBCR(cpu, n) (0x1110 + 0x40 * (n) + 0x1000 * (cpu))
#define GTBCR_CI 0x80000000
#define GTBCR_BASECNT 0x7fffffff
#define OPENPIC_GTVPR(cpu, n) (0x1120 + 0x40 * (n) + 0x1000 * (cpu))
#define OPENPIC_GTDR(cpu, n) (0x1130 + 0x40 * (n) + 0x1000 * (cpu))
#define OPENPIC_TCR 0x1300
#define TCR_ROVR(n) (1 << (24 + (n)))
#define TCR_RTM 0x00010000
#define TCR_CLKR 0x00000300
#define TCR_CLKR_64 0x00000300
#define TCR_CLKR_32 0x00000200
#define TCR_CLKR_16 0x00000100
#define TCR_CLKR_8 0x00000000
#define TCR_CASC 0x00000007
#define TCR_CASC_0123 0x00000007
#define TCR_CASC_123 0x00000006
#define TCR_CASC_01_23 0x00000005
#define TCR_CASC_23 0x00000004
#define TCR_CASC_012 0x00000003
#define TCR_CASC_12 0x00000002
#define TCR_CASC_01 0x00000001
#define TCR_CASC_OFF 0x00000000
#define OPENPIC_ERQSR 0x1308
#define ERQSR_A(n) (1 << (31 - (n)))
#define OPENPIC_IRQSR0 0x1310
#define IRSR0_MSI_A(n) (1 << (31 - (n)))
#define IRSR0_MSG_A(n) (1 << (20 - ((n) ^ 4)))
#define IRSR0_EXT_A(n) (1 << (11 - (n)))
#define OPENPIC_IRQSR1 0x1320
#define IRQSR1_A(n) (1 << (31 - ((n) - 0)))
#define OPENPIC_IRQSR2 0x1324
#define IRQSR2_A(n) (1 << (31 - ((n) - 32)))
#define OPENPIC_CISR0 0x1330
#define OPENPIC_CISR1 0x1340
#define CISR1_A(n) (1 << (31 - ((n) - 0)))
#define OPENPIC_CISR2 0x1344
#define CISR2_A(n) (1 << (31 - ((n) - 32)))
#define OPENPIC_PMMR0(n) (0x1350 + 0x20 * (n))
#define PMMR0_MShl(n) (1 << (31 - (n)))
#define PMMR0_IPI(n) (1 << (24 - (n)))
#define PMMR0_TIMER(n) (1 << (20 - (n)))
#define PMMR0_MSG(n) (1 << (16 - ((n) & 7)))
#define PMMR0_EXT(n) (1 << (12 - (n)))
#define OPENPIC_PMMR1(n) (0x1360 + 0x20 * (n))
#define PMMR1_INT(n) (1 << (31 - ((n) - 0)))
#define OPENPIC_PMMR2(n) (0x1364 + 0x20 * (n))
#define PMMR2_INT(n) (1 << (31 - ((n) - 32)))
#define OPENPIC_MSGR(cpu, n) (0x1400 + 0x1000 * (cpu) + 0x10 * (n))
#define OPENPIC_MER(cpu) (0x1500 + 0x1000 * (cpu))
#define MER_MSG(n) (1 << (n))
#define OPENPIC_MSR(cpu) (0x1510 + 0x1000 * (cpu))
#define MSR_MSG(n) (1 << (n))
#define OPENPIC_MSIR(n) (0x1600 + 0x10 * (n))
#define OPENPIC_MSISR 0x1720
#define MSIR_SR(n) (1 << (n))
#define OPENPIC_MSIIR 0x1740
#define MSIIR_BIT(srs, ibs) (((srs) << 29) | ((ibs) << 24))
#define OPENPIC_EIVPR(n) (0x10000 + 0x20 * (n))
#define OPENPIC_EIDR(n) (0x10010 + 0x20 * (n))
#define OPENPIC_IIVPR(n) (0x10200 + 0x20 * (n))
#define OPENPIC_IIDR(n) (0x10210 + 0x20 * (n))
#define OPENPIC_MIVPR(n) (0x11600 + 0x20 * (n))
#define OPENPIC_MIDR(n) (0x11610 + 0x20 * (n))
#define OPENPIC_MSIVPR(n) (0x11c00 + 0x20 * (n))
#define OPENPIC_MSIDR(n) (0x11c10 + 0x20 * (n))
#define MPC8536_EXTERNALSOURCES 12
#define MPC8536_ONCHIPSOURCES 64
#define MPC8536_ONCHIPBITMAP { 0xfe07ffff, 0x05501c00 }
#define MPC8536_IPISOURCES 8
#define MPC8536_TIMERSOURCES 8
#define MPC8536_MISOURCES 4
#define MPC8536_MSIGROUPSOURCES 8
#define MPC8536_NCPUS 1
#define MPC8536_SOURCES \
(MPC8536_EXTERNALSOURCES \
+ MPC8536_ONCHIPSOURCES \
+ MPC8536_MSIGROUPSOURCES \
+ MPC8536_NCPUS*(MPC8536_IPISOURCES \
+ MPC8536_TIMERSOURCES \
+ MPC8536_MISOURCES))
#define MPC8544_EXTERNALSOURCES 12
#define MPC8544_ONCHIPSOURCES 48
#define MPC8544_ONCHIPBITMAP { 0x3c07efff, 0x00000000 }
#define MPC8544_IPISOURCES 4
#define MPC8544_TIMERSOURCES 4
#define MPC8544_MISOURCES 4
#define MPC8544_MSIGROUPSOURCES 8
#define MPC8544_NCPUS 1
#define MPC8544_SOURCES \
(MPC8544_EXTERNALSOURCES \
+ MPC8544_ONCHIPSOURCES \
+ MPC8544_MSIGROUPSOURCES \
+ MPC8544_NCPUS*(MPC8544_IPISOURCES \
+ MPC8544_TIMERSOURCES \
+ MPC8544_MISOURCES))
#define MPC8548_EXTERNALSOURCES 12
#define MPC8548_ONCHIPSOURCES 48
#define MPC8548_ONCHIPBITMAP { 0x3dffffff, 0x000000f3 }
#define MPC8548_IPISOURCES 4
#define MPC8548_TIMERSOURCES 4
#define MPC8548_MISOURCES 4
#define MPC8548_MSIGROUPSOURCES 8
#define MPC8548_NCPUS 1
#define MPC8548_SOURCES \
(MPC8548_EXTERNALSOURCES \
+ MPC8548_ONCHIPSOURCES \
+ MPC8548_MSIGROUPSOURCES \
+ MPC8548_NCPUS*(MPC8548_IPISOURCES \
+ MPC8548_TIMERSOURCES \
+ MPC8548_MISOURCES))
#define MPC8555_EXTERNALSOURCES 12
#define MPC8555_ONCHIPSOURCES 32
#define MPC8555_ONCHIPBITMAP { 0x7d1c63ff, 0 }
#define MPC8555_IPISOURCES 4
#define MPC8555_TIMERSOURCES 4
#define MPC8555_MISOURCES 4
#define MPC8555_MSIGROUPSOURCES 0
#define MPC8555_NCPUS 1
#define MPC8555_SOURCES \
(MPC8555_EXTERNALSOURCES \
+ MPC8555_ONCHIPSOURCES \
+ MPC8555_MSIGROUPSOURCES \
+ MPC8555_NCPUS*(MPC8555_IPISOURCES \
+ MPC8555_TIMERSOURCES \
+ MPC8555_MISOURCES))
#define MPC8568_EXTERNALSOURCES 12
#define MPC8568_ONCHIPSOURCES 48
#define MPC8568_ONCHIPBITMAP { 0xfd1c65ff, 0x000b9e7 }
#define MPC8568_IPISOURCES 4
#define MPC8568_TIMERSOURCES 4
#define MPC8568_MISOURCES 4
#define MPC8568_MSIGROUPSOURCES 8
#define MPC8568_NCPUS 1
#define MPC8568_SOURCES \
(MPC8568_EXTERNALSOURCES \
+ MPC8568_ONCHIPSOURCES \
+ MPC8568_MSIGROUPSOURCES \
+ MPC8568_NCPUS*(MPC8568_IPISOURCES \
+ MPC8568_TIMERSOURCES \
+ MPC8568_MISOURCES))
#define MPC8572_EXTERNALSOURCES 12
#define MPC8572_ONCHIPSOURCES 64
#define MPC8572_ONCHIPBITMAP { 0xdeffffff, 0xf8ff93f3 }
#define MPC8572_IPISOURCES 4
#define MPC8572_TIMERSOURCES 4
#define MPC8572_MISOURCES 4
#define MPC8572_MSIGROUPSOURCES 8
#define MPC8572_NCPUS 2
#define MPC8572_SOURCES \
(MPC8572_EXTERNALSOURCES \
+ MPC8572_ONCHIPSOURCES \
+ MPC8572_MSIGROUPSOURCES \
+ MPC8572_NCPUS*(MPC8572_IPISOURCES \
+ MPC8572_TIMERSOURCES \
+ MPC8572_MISOURCES))
#define P1023_EXTERNALSOURCES 12
#define P1023_ONCHIPSOURCES 64
#define P1023_ONCHIPBITMAP { 0xbc07f5f9, 0xf0000e00 }
#define P1023_IPISOURCES 4
#define P1023_TIMERSOURCES 4
#define P1023_MISOURCES 4
#define P1023_MSIGROUPSOURCES 8
#define P1023_NCPUS 2
#define P1023_SOURCES \
(P1023_EXTERNALSOURCES \
+ P1023_ONCHIPSOURCES \
+ P1023_MSIGROUPSOURCES \
+ P1023_NCPUS*(P1023_IPISOURCES \
+ P1023_TIMERSOURCES \
+ P1023_MISOURCES))
#define P1017_NCPUS 1
#define P1017_SOURCES \
(P1023_EXTERNALSOURCES \
+ P1023_ONCHIPSOURCES \
+ P1023_MSIGROUPSOURCES \
+ P1017_NCPUS*(P1023_IPISOURCES \
+ P1023_TIMERSOURCES \
+ P1023_MISOURCES))
#define P1025_EXTERNALSOURCES 6
#define P1025_ONCHIPSOURCES 64
#define P1025_ONCHIPBITMAP { 0xbd1fffff, 0x01789c18 }
#define P1025_IPISOURCES 4
#define P1025_TIMERSOURCES 4
#define P1025_MISOURCES 4
#define P1025_MSIGROUPSOURCES 8
#define P1025_NCPUS 2
#define P1025_SOURCES \
(P1025_EXTERNALSOURCES \
+ P1025_ONCHIPSOURCES \
+ P1025_MSIGROUPSOURCES \
+ P1025_NCPUS*(P1025_IPISOURCES \
+ P1025_TIMERSOURCES \
+ P1025_MISOURCES))
#define P1016_NCPUS 1
#define P1016_SOURCES \
(P1025_EXTERNALSOURCES \
+ P1025_ONCHIPSOURCES \
+ P1025_MSIGROUPSOURCES \
+ P1016_NCPUS*(P1025_IPISOURCES \
+ P1025_TIMERSOURCES \
+ P1025_MISOURCES))
#define P20x0_EXTERNALSOURCES 12
#define P20x0_ONCHIPSOURCES 64
#define P20x0_ONCHIPBITMAP { 0xbd1ff7ff, 0xf17005e7 }
#define P20x0_IPISOURCES 4
#define P20x0_TIMERSOURCES 4
#define P20x0_MISOURCES 4
#define P20x0_MSIGROUPSOURCES 8
#define P2020_NCPUS 2
#define P2020_SOURCES \
(P20x0_EXTERNALSOURCES \
+ P20x0_ONCHIPSOURCES \
+ P20x0_MSIGROUPSOURCES \
+ P2020_NCPUS*(P20x0_IPISOURCES \
+ P20x0_TIMERSOURCES \
+ P20x0_MISOURCES))
#define P2010_NCPUS 1
#define P2010_SOURCES \
(P20x0_EXTERNALSOURCES \
+ P20x0_ONCHIPSOURCES \
+ P20x0_MSIGROUPSOURCES \
+ P2010_NCPUS*(P20x0_IPISOURCES \
+ P20x0_TIMERSOURCES \
+ P20x0_MISOURCES))
#define OPENPIC_IPIDRn(cpu, n) (0x20040 + 0x1000 * (cpu) + 0x10 * (n))
#define OPENPIC_CTPRn(cpu) (0x20080 + 0x1000 * (cpu))
#define OPENPIC_WHOAMIn(cpu) (0x20090 + 0x1000 * (cpu))
#define OPENPIC_IACKn(cpu) (0x200a0 + 0x1000 * (cpu))
#define OPENPIC_EOIn(cpu) (0x200b0 + 0x1000 * (cpu))
#define IRQ_SPURIOUS 0xffff
#define ISOURCE_L2 0
#define ISOURCE_ERROR 0
#define ISOURCE_ECM 1
#define ISOURCE_ETSEC1_G1_TX 1
#define ISOURCE_DDR 2
#define ISOURCE_ETSEC1_G1_RX 2
#define ISOURCE_LBC 3
#define ISOURCE_DMA_CHAN1 4
#define ISOURCE_DMA_CHAN2 5
#define ISOURCE_DMA_CHAN3 6
#define ISOURCE_DMA_CHAN4 7
#define ISOURCE_PCIEX3_MPC8572 8
#define ISOURCE_PCI1 8
#define ISOURCE_ETSEC1_G1_ERR 8
#define ISOURCE_FMAN 8
#define ISOURCE_PCI2 9
#define ISOURCE_PCIEX2 9
#define ISOURCE_ETSEC3_G1_TX 9
#define ISOURCE_PCIEX 10
#define ISOURCE_ETSEC3_G1_RX 10
#define ISOURCE_MDIO 10
#define ISOURCE_PCIEX3 11
#define ISOURCE_ETSEC3_G1_ERR 11
#define ISOURCE_USB1 12
#define ISOURCE_ETSEC1_TX 13
#define ISOURCE_QMAN0 13
#define ISOURCE_ETSEC1_RX 14
#define ISOURCE_BMAN0 14
#define ISOURCE_ETSEC3_TX 15
#define ISOURCE_QMAN1 15
#define ISOURCE_ETSEC3_RX 16
#define ISOURCE_BMAN1 16
#define ISOURCE_ETSEC3_ERR 17
#define ISOURCE_QMAN2 17
#define ISOURCE_ETSEC1_ERR 18
#define ISOURCE_BMAN2 18
#define ISOURCE_ETSEC2_TX 19
#define ISOURCE_ETSEC2_RX 20
#define ISOURCE_ETSEC4_TX 21
#define ISOURCE_ETSEC4_RX 22
#define ISOURCE_ETSEC4_ERR 23
#define ISOURCE_ETSEC2_ERR 24
#define ISOURCE_FEC 25
#define ISOURCE_SATA2 25
#define ISOURCE_DUART 26
#define ISOURCE_I2C 27
#define ISOURCE_PERFMON 28
#define ISOURCE_SECURITY1 29
#define ISOURCE_CPM 30
#define ISOURCE_QEB_LOW 30
#define ISOURCE_USB2 30
#define ISOURCE_GPIO 31
#define ISOURCE_QEB_PORT 31
#define ISOURCE_SRIO_EWPU 32
#define ISOURCE_SRIO_ODBELL 33
#define ISOURCE_SRIO_IDBELL 34
#define ISOURCE_ETSEC2_G1_TX 35
#define ISOURCE_ETSEC2_G1_RX 36
#define ISOURCE_SRIO_OMU1 37
#define ISOURCE_SRIO_IMU1 38
#define ISOURCE_SRIO_OMU2 39
#define ISOURCE_SRIO_IMU2 40
#define ISOURCE_PME_GENERAL 41
#define ISOURCE_SECURITY2_P1023 41
#define ISOURCE_SECURITY2 42
#define ISOURCE_SEC_GENERAL 42
#define ISOURCE_SPI 43
#define ISOURCE_QEB_IECC 43
#define ISOURCE_USB3 44
#define ISOURCE_QEB_MUECC 44
#define ISOURCE_TLU1 45
#define ISOURCE_46 46
#define ISOURCE_QEB_HIGH 47
#define ISOURCE_PME_CHAN1 48
#define ISOURCE_PME_CHAN2 49
#define ISOURCE_PME_CHAN3 50
#define ISOURCE_PME_CHAN4 51
#define ISOURCE_ETSEC2_G1_ERR 51
#define ISOURCE_ETSEC1_PTP 52
#define ISOURCE_ETSEC2_PTP 53
#define ISOURCE_ETSEC3_PTP 54
#define ISOURCE_ETSEC4_PTP 55
#define ISOURCE_ESDHC 56
#define ISOURCE_57 57
#define ISOURCE_SATA1 58
#define ISOURCE_TLU2 59
#define ISOURCE_DMA2_CHAN1 60
#define ISOURCE_DMA2_CHAN2 61
#define ISOURCE_DMA2_CHAN3 62
#define ISOURCE_DMA2_CHAN4 63
#endif