RTEMS 6.1-rc7
Loading...
Searching...
No Matches
irq.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 2010, 2015 embedded brains GmbH & Co. KG
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef LIBBSP_POWERPC_QORIQ_IRQ_H
37#define LIBBSP_POWERPC_QORIQ_IRQ_H
38
39#include <bsp.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif /* __cplusplus */
44
45#ifdef QORIQ_IS_HYPERVISOR_GUEST
46
47#define BSP_INTERRUPT_VECTOR_COUNT 1024
48
49#else /* !QORIQ_IS_HYPERVISOR_GUEST */
50
51#define QORIQ_IRQ_ERROR 0
52
53#if QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT)
54
55#define QORIQ_IRQ_PCI_EXPRESS_1 4
56#define QORIQ_IRQ_PCI_EXPRESS_2 5
57#define QORIQ_IRQ_PCI_EXPRESS_3 6
58#define QORIQ_IRQ_PCI_EXPRESS_4 7
59#define QORIQ_IRQ_PAMU 8
60#define QORIQ_IRQ_IFC 9
61#define QORIQ_IRQ_DMA_CHANNEL_1_1 12
62#define QORIQ_IRQ_DMA_CHANNEL_1_2 13
63#define QORIQ_IRQ_DMA_CHANNEL_1_3 14
64#define QORIQ_IRQ_DMA_CHANNEL_1_4 15
65#define QORIQ_IRQ_DMA_CHANNEL_2_1 16
66#define QORIQ_IRQ_DMA_CHANNEL_2_2 17
67#define QORIQ_IRQ_DMA_CHANNEL_2_3 18
68#define QORIQ_IRQ_DMA_CHANNEL_2_4 19
69#define QORIQ_IRQ_DUART_1 20
70#define QORIQ_IRQ_DUART_2 21
71#define QORIQ_IRQ_DUARL_I2C_1 22
72#define QORIQ_IRQ_DUARL_I2C_2 23
73#define QORIQ_IRQ_PCI_EXPRESS_1_INTA 24
74#define QORIQ_IRQ_PCI_EXPRESS_2_INTA 25
75#define QORIQ_IRQ_PCI_EXPRESS_3_INTA 26
76#define QORIQ_IRQ_PCI_EXPRESS_4_INTA 27
77#define QORIQ_IRQ_USB_1 28
78#define QORIQ_IRQ_USB_2 29
79#define QORIQ_IRQ_ESDHC 32
80#define QORIQ_IRQ_PERF_MON 36
81#define QORIQ_IRQ_ESPI 37
82#define QORIQ_IRQ_GPIO_2 38
83#define QORIQ_IRQ_GPIO_1 39
84#define QORIQ_IRQ_SATA_1 52
85#define QORIQ_IRQ_SATA_2 53
86#define QORIQ_IRQ_DMA_CHANNEL_1_5 60
87#define QORIQ_IRQ_DMA_CHANNEL_1_6 61
88#define QORIQ_IRQ_DMA_CHANNEL_1_7 62
89#define QORIQ_IRQ_DMA_CHANNEL_1_8 63
90#define QORIQ_IRQ_DMA_CHANNEL_2_5 64
91#define QORIQ_IRQ_DMA_CHANNEL_2_6 65
92#define QORIQ_IRQ_DMA_CHANNEL_2_7 66
93#define QORIQ_IRQ_DMA_CHANNEL_2_8 67
94#define QORIQ_IRQ_EVENT_PROC_UNIT_1 68
95#define QORIQ_IRQ_EVENT_PROC_UNIT_2 69
96#define QORIQ_IRQ_GPIO_3 70
97#define QORIQ_IRQ_GPIO_4 71
98#define QORIQ_IRQ_SEC_5_2_JOB_QUEUE_1 72
99#define QORIQ_IRQ_SEC_5_2_JOB_QUEUE_2 73
100#define QORIQ_IRQ_SEC_5_2_JOB_QUEUE_3 74
101#define QORIQ_IRQ_SEC_5_2_JOB_QUEUE_4 75
102#define QORIQ_IRQ_SEC_5_2_GLOBAL_ERROR 76
103#define QORIQ_IRQ_SEC_MON 77
104#define QORIQ_IRQ_EVENT_PROC_UNIT_3 78
105#define QORIQ_IRQ_EVENT_PROC_UNIT_4 79
106#define QORIQ_IRQ_FRAME_MGR 80
107#define QORIQ_IRQ_MDIO_1 84
108#define QORIQ_IRQ_MDIO_2 85
109#define QORIQ_IRQ_QUEUE_MGR_PORTAL_0 88
110#define QORIQ_IRQ_BUFFER_MGR_PORTAL_0 89
111#define QORIQ_IRQ_QUEUE_MGR_PORTAL_1 90
112#define QORIQ_IRQ_BUFFER_MGR_PORTAL_1 91
113#define QORIQ_IRQ_QUEUE_MGR_PORTAL_2 92
114#define QORIQ_IRQ_BUFFER_MGR_PORTAL_2 93
115#define QORIQ_IRQ_QUEUE_MGR_PORTAL_3 94
116#define QORIQ_IRQ_BUFFER_MGR_PORTAL_3 95
117#define QORIQ_IRQ_QUEUE_MGR_PORTAL_4 96
118#define QORIQ_IRQ_BUFFER_MGR_PORTAL_4 97
119#define QORIQ_IRQ_QUEUE_MGR_PORTAL_5 98
120#define QORIQ_IRQ_BUFFER_MGR_PORTAL_5 99
121#define QORIQ_IRQ_QUEUE_MGR_PORTAL_6 100
122#define QORIQ_IRQ_BUFFER_MGR_PORTAL_6 101
123#define QORIQ_IRQ_QUEUE_MGR_PORTAL_7 102
124#define QORIQ_IRQ_BUFFER_MGR_PORTAL_7 103
125#define QORIQ_IRQ_QUEUE_MGR_PORTAL_8 104
126#define QORIQ_IRQ_BUFFER_MGR_PORTAL_8 105
127#define QORIQ_IRQ_QUEUE_MGR_PORTAL_9 106
128#define QORIQ_IRQ_BUFFER_MGR_PORTAL_9 107
129#define QORIQ_IRQ_QUEUE_MGR_PORTAL_10 109
130#define QORIQ_IRQ_BUFFER_MGR_PORTAL_10 109
131#define QORIQ_IRQ_QUEUE_MGR_PORTAL_11 110
132#define QORIQ_IRQ_BUFFER_MGR_PORTAL_11 111
133#define QORIQ_IRQ_QUEUE_MGR_PORTAL_12 112
134#define QORIQ_IRQ_BUFFER_MGR_PORTAL_12 113
135#define QORIQ_IRQ_QUEUE_MGR_PORTAL_13 114
136#define QORIQ_IRQ_BUFFER_MGR_PORTAL_13 115
137#define QORIQ_IRQ_QUEUE_MGR_PORTAL_14 116
138#define QORIQ_IRQ_BUFFER_MGR_PORTAL_14 117
139#define QORIQ_IRQ_QUEUE_MGR_PORTAL_15 118
140#define QORIQ_IRQ_BUFFER_MGR_PORTAL_15 119
141#define QORIQ_IRQ_QUEUE_MGR_PORTAL_16 120
142#define QORIQ_IRQ_BUFFER_MGR_PORTAL_16 121
143#define QORIQ_IRQ_QUEUE_MGR_PORTAL_17 122
144#define QORIQ_IRQ_BUFFER_MGR_PORTAL_17 123
145#define QORIQ_IRQ_DMA_CHANNEL_3_1 240
146#define QORIQ_IRQ_DMA_CHANNEL_3_2 241
147#define QORIQ_IRQ_DMA_CHANNEL_3_3 242
148#define QORIQ_IRQ_DMA_CHANNEL_3_4 243
149#define QORIQ_IRQ_DMA_CHANNEL_3_5 244
150#define QORIQ_IRQ_DMA_CHANNEL_3_6 245
151#define QORIQ_IRQ_DMA_CHANNEL_3_7 246
152#define QORIQ_IRQ_DMA_CHANNEL_3_8 247
153
154#define QORIQ_IRQ_EXT_BASE 256
155
156#else /* QORIQ_CHIP_VARIANT */
157
168#define QORIQ_IRQ_ETSEC_TX_1_GROUP_1 1
169#define QORIQ_IRQ_ETSEC_RX_1_GROUP_1 2
170#define QORIQ_IRQ_ETSEC_ER_1_GROUP_1 8
171#define QORIQ_IRQ_ETSEC_TX_3_GROUP_1 9
172#define QORIQ_IRQ_ETSEC_RX_3_GROUP_1 10
173#define QORIQ_IRQ_ETSEC_ER_3_GROUP_1 11
174#define QORIQ_IRQ_ETSEC_TX_2_GROUP_1 35
175#define QORIQ_IRQ_ETSEC_RX_2_GROUP_1 36
176#define QORIQ_IRQ_TDM 46
177#define QORIQ_IRQ_TDM_ERROR 47
178#define QORIQ_IRQ_ETSEC_ER_2_GROUP_1 51
179
192#define QORIQ_IRQ_L2_CACHE 0
193#define QORIQ_IRQ_ECM 1
194#define QORIQ_IRQ_DDR_CONTROLLER 2
195#define QORIQ_IRQ_PCI_EXPRESS_3 8
196#define QORIQ_IRQ_PCI_EXPRESS_2 9
197#define QORIQ_IRQ_PCI_EXPRESS_1 10
198#define QORIQ_IRQ_SRIO_ERR_WRT_1_2 32
199#define QORIQ_IRQ_SRIO_OUT_DOORBELL_1 33
200#define QORIQ_IRQ_SRIO_IN_DOORBELL_1 34
201#define QORIQ_IRQ_SRIO_OUT_MSG_1 37
202#define QORIQ_IRQ_SRIO_IN_MSG_1 38
203#define QORIQ_IRQ_SRIO_OUT_MSG_2 39
204#define QORIQ_IRQ_SRIO_IN_MSG_2 40
205
218#define QORIQ_IRQ_ELBC 3
219#define QORIQ_IRQ_DMA_CHANNEL_1_1 4
220#define QORIQ_IRQ_DMA_CHANNEL_2_1 5
221#define QORIQ_IRQ_DMA_CHANNEL_3_1 6
222#define QORIQ_IRQ_DMA_CHANNEL_4_1 7
223#define QORIQ_IRQ_USB_1 12
224#define QORIQ_IRQ_ETSEC_TX_1 13
225#define QORIQ_IRQ_ETSEC_RX_1 14
226#define QORIQ_IRQ_ETSEC_TX_3 15
227#define QORIQ_IRQ_ETSEC_RX_3 16
228#define QORIQ_IRQ_ETSEC_ER_3 17
229#define QORIQ_IRQ_ETSEC_ER_1 18
230#define QORIQ_IRQ_ETSEC_TX_2 19
231#define QORIQ_IRQ_ETSEC_RX_2 20
232#define QORIQ_IRQ_ETSEC_ER_2 24
233#define QORIQ_IRQ_DUART_1 26
234#define QORIQ_IRQ_I2C 27
235#define QORIQ_IRQ_PERFORMANCE_MONITOR 28
236#define QORIQ_IRQ_SECURITY_1 29
237#define QORIQ_IRQ_USB_2 30
238#define QORIQ_IRQ_GPIO 31
239#define QORIQ_IRQ_SECURITY_2 42
240#define QORIQ_IRQ_ESPI 43
241#define QORIQ_IRQ_ETSEC_IEEE_1588_1 52
242#define QORIQ_IRQ_ETSEC_IEEE_1588_2 53
243#define QORIQ_IRQ_ETSEC_IEEE_1588_3 54
244#define QORIQ_IRQ_ESDHC 56
245#define QORIQ_IRQ_DMA_CHANNEL_1_2 60
246#define QORIQ_IRQ_DMA_CHANNEL_2_2 61
247#define QORIQ_IRQ_DMA_CHANNEL_3_2 62
248#define QORIQ_IRQ_DMA_CHANNEL_4_2 63
249
252#define QORIQ_IRQ_EXT_BASE 64
253
254#endif /* QORIQ_CHIP_VARIANT */
255
266#define QORIQ_IRQ_EXT_0 (QORIQ_IRQ_EXT_BASE + 0)
267#define QORIQ_IRQ_EXT_1 (QORIQ_IRQ_EXT_BASE + 1)
268#define QORIQ_IRQ_EXT_2 (QORIQ_IRQ_EXT_BASE + 2)
269#define QORIQ_IRQ_EXT_3 (QORIQ_IRQ_EXT_BASE + 3)
270#define QORIQ_IRQ_EXT_4 (QORIQ_IRQ_EXT_BASE + 4)
271#define QORIQ_IRQ_EXT_5 (QORIQ_IRQ_EXT_BASE + 5)
272#define QORIQ_IRQ_EXT_6 (QORIQ_IRQ_EXT_BASE + 6)
273#define QORIQ_IRQ_EXT_7 (QORIQ_IRQ_EXT_BASE + 7)
274#define QORIQ_IRQ_EXT_8 (QORIQ_IRQ_EXT_BASE + 8)
275#define QORIQ_IRQ_EXT_9 (QORIQ_IRQ_EXT_BASE + 9)
276#define QORIQ_IRQ_EXT_10 (QORIQ_IRQ_EXT_BASE + 10)
277#define QORIQ_IRQ_EXT_11 (QORIQ_IRQ_EXT_BASE + 11)
278
279#define QORIQ_IRQ_IS_EXT(vector) \
280 ((vector) >= QORIQ_IRQ_EXT_0 && (vector) <= QORIQ_IRQ_EXT_11)
293#define QORIQ_IRQ_IPI_BASE (QORIQ_IRQ_EXT_11 + 1)
294#define QORIQ_IRQ_IPI_0 (QORIQ_IRQ_IPI_BASE + 0)
295#define QORIQ_IRQ_IPI_1 (QORIQ_IRQ_IPI_BASE + 1)
296#define QORIQ_IRQ_IPI_2 (QORIQ_IRQ_IPI_BASE + 2)
297#define QORIQ_IRQ_IPI_3 (QORIQ_IRQ_IPI_BASE + 3)
298
311#define QORIQ_IRQ_MI_BASE (QORIQ_IRQ_IPI_3 + 1)
312#define QORIQ_IRQ_MI_0 (QORIQ_IRQ_MI_BASE + 0)
313#define QORIQ_IRQ_MI_1 (QORIQ_IRQ_MI_BASE + 1)
314#define QORIQ_IRQ_MI_2 (QORIQ_IRQ_MI_BASE + 2)
315#define QORIQ_IRQ_MI_3 (QORIQ_IRQ_MI_BASE + 3)
316#define QORIQ_IRQ_MI_4 (QORIQ_IRQ_MI_BASE + 4)
317#define QORIQ_IRQ_MI_5 (QORIQ_IRQ_MI_BASE + 5)
318#define QORIQ_IRQ_MI_6 (QORIQ_IRQ_MI_BASE + 6)
319#define QORIQ_IRQ_MI_7 (QORIQ_IRQ_MI_BASE + 7)
320
333#define QORIQ_IRQ_MSI_BASE (QORIQ_IRQ_MI_7 + 1)
334#define QORIQ_IRQ_MSI_0 (QORIQ_IRQ_MSI_BASE + 0)
335#define QORIQ_IRQ_MSI_1 (QORIQ_IRQ_MSI_BASE + 1)
336#define QORIQ_IRQ_MSI_2 (QORIQ_IRQ_MSI_BASE + 2)
337#define QORIQ_IRQ_MSI_3 (QORIQ_IRQ_MSI_BASE + 3)
338#define QORIQ_IRQ_MSI_4 (QORIQ_IRQ_MSI_BASE + 4)
339#define QORIQ_IRQ_MSI_5 (QORIQ_IRQ_MSI_BASE + 5)
340#define QORIQ_IRQ_MSI_6 (QORIQ_IRQ_MSI_BASE + 6)
341#define QORIQ_IRQ_MSI_7 (QORIQ_IRQ_MSI_BASE + 7)
342
355#define QORIQ_IRQ_GT_BASE (QORIQ_IRQ_MSI_7 + 1)
356#define QORIQ_IRQ_GT_A_0 (QORIQ_IRQ_GT_BASE + 0)
357#define QORIQ_IRQ_GT_A_1 (QORIQ_IRQ_GT_BASE + 1)
358#define QORIQ_IRQ_GT_A_2 (QORIQ_IRQ_GT_BASE + 2)
359#define QORIQ_IRQ_GT_A_3 (QORIQ_IRQ_GT_BASE + 3)
360#define QORIQ_IRQ_GT_B_0 (QORIQ_IRQ_GT_BASE + 4)
361#define QORIQ_IRQ_GT_B_1 (QORIQ_IRQ_GT_BASE + 5)
362#define QORIQ_IRQ_GT_B_2 (QORIQ_IRQ_GT_BASE + 6)
363#define QORIQ_IRQ_GT_B_3 (QORIQ_IRQ_GT_BASE + 7)
364
365#define QORIQ_INTERRUPT_SOURCE_COUNT (QORIQ_IRQ_GT_B_3 + 1)
366
367#define QORIQ_IS_INTERRUPT_SOURCE(vector) \
368 (((rtems_vector_number) (vector)) < QORIQ_INTERRUPT_SOURCE_COUNT)
369
370#define QORIQ_IRQ_MSI_MULTIPLEX_BASE QORIQ_INTERRUPT_SOURCE_COUNT
371
372#define QORIQ_IRQ_MSI_COUNT 256
373
374#define QORIQ_IRQ_MSI_INDEX(vector) ((vector) - QORIQ_IRQ_MSI_MULTIPLEX_BASE)
375
376#define QORIQ_IRQ_MSI_VECTOR(index) (QORIQ_IRQ_MSI_MULTIPLEX_BASE + (index))
377
378#define QORIQ_IRQ_IS_MSI(vector) \
379 (QORIQ_IRQ_MSI_INDEX(vector) < QORIQ_IRQ_MSI_COUNT)
380
381#define BSP_INTERRUPT_VECTOR_COUNT QORIQ_IRQ_MSI_VECTOR(QORIQ_IRQ_MSI_COUNT)
382
385#endif /* QORIQ_IS_HYPERVISOR_GUEST */
386
397/*
398 * These are RTEMS API priority values, not PIC priority values. We have:
399 * 15 - API-priority == PIC-priority
400 *
401 * The API-priority value 15 (which is PIC-priority 0) effectively disables the
402 * interrupt.
403 */
404#define QORIQ_PIC_PRIORITY_LOWEST 14
405#define QORIQ_PIC_PRIORITY_HIGHEST 0
406#define QORIQ_PIC_PRIORITY_DISABLED 15
407#define QORIQ_PIC_PRIORITY_INVALID 16
408#define QORIQ_PIC_PRIORITY_DEFAULT 13
409#define QORIQ_PIC_PRIORITY_IS_VALID(p) \
410 (((uint32_t) (p)) <= QORIQ_PIC_PRIORITY_DISABLED)
411
412rtems_status_code qoriq_pic_msi_allocate(rtems_vector_number *vector);
413
414rtems_status_code qoriq_pic_msi_free(rtems_vector_number vector);
415
416rtems_status_code qoriq_pic_msi_map(
417 rtems_vector_number vector,
418 uint64_t *addr,
419 uint32_t *data
420);
421
422typedef enum {
423 QORIQ_EIRQ_TRIGGER_EDGE_FALLING,
424 QORIQ_EIRQ_TRIGGER_EDGE_RISING,
425 QORIQ_EIRQ_TRIGGER_LEVEL_LOW,
426 QORIQ_EIRQ_TRIGGER_LEVEL_HIGH,
427} qoriq_eirq_sense_and_polarity;
428
442 rtems_vector_number vector,
443 qoriq_eirq_sense_and_polarity new_sense_and_polarity,
444 qoriq_eirq_sense_and_polarity *old_sense_and_polarity
445);
446
449#ifdef __cplusplus
450}
451#endif /* __cplusplus */
452
453#endif /* LIBBSP_POWERPC_QORIQ_IRQ_H */
ISR_Vector_number rtems_vector_number
This integer type represents interrupt vector numbers.
Definition: intr.h:102
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
rtems_status_code qoriq_pic_set_sense_and_polarity(rtems_vector_number vector, qoriq_eirq_sense_and_polarity new_sense_and_polarity, qoriq_eirq_sense_and_polarity *old_sense_and_polarity)
Change polarity and sense settings of external interrupts.
Definition: irq.c:350