aboutsummaryrefslogtreecommitdiffstats
path: root/cvmx-interrupt.h
diff options
context:
space:
mode:
Diffstat (limited to 'cvmx-interrupt.h')
-rw-r--r--cvmx-interrupt.h293
1 files changed, 100 insertions, 193 deletions
diff --git a/cvmx-interrupt.h b/cvmx-interrupt.h
index c3275c3ccd26..c2619d70173e 100644
--- a/cvmx-interrupt.h
+++ b/cvmx-interrupt.h
@@ -1,5 +1,5 @@
/***********************license start***************
- * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
+ * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights
* reserved.
*
*
@@ -15,7 +15,7 @@
* disclaimer in the documentation and/or other materials provided
* with the distribution.
- * * Neither the name of Cavium Networks nor the names of
+ * * Neither the name of Cavium Inc. nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
@@ -26,7 +26,7 @@
* countries.
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
- * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
+ * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
* WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
* THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
* DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
@@ -48,12 +48,12 @@
*
* Interface to the Mips interrupts.
*
- * <hr>$Revision: 49448 $<hr>
+ * <hr>$Revision: 70030 $<hr>
*/
#ifndef __CVMX_INTERRUPT_H__
#define __CVMX_INTERRUPT_H__
-#ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
#endif
@@ -64,140 +64,100 @@ typedef enum
{
/* 0 - 7 represent the 8 MIPS standard interrupt sources */
CVMX_IRQ_SW0 = 0,
- CVMX_IRQ_SW1 = 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
- CVMX_IRQ_PCI_INT3 = 47,
- CVMX_IRQ_PCI_MSI0 = 48,
- CVMX_IRQ_PCI_MSI1 = 49,
- CVMX_IRQ_PCI_MSI2 = 50,
- CVMX_IRQ_PCI_MSI3 = 51,
- CVMX_IRQ_RESERVED44 = 52,
- CVMX_IRQ_TWSI = 53,
- CVMX_IRQ_RML = 54,
- CVMX_IRQ_TRACE = 55,
- CVMX_IRQ_GMX_DRP0 = 56,
- CVMX_IRQ_GMX_DRP1 = 57, /* Doesn't apply on CN52XX or CN63XX */
- CVMX_IRQ_IPD_DRP = 58,
- CVMX_IRQ_KEY_ZERO = 59, /* Doesn't apply on CN52XX or CN63XX */
- CVMX_IRQ_TIMER0 = 60,
- CVMX_IRQ_TIMER1 = 61,
- CVMX_IRQ_TIMER2 = 62,
- CVMX_IRQ_TIMER3 = 63,
- CVMX_IRQ_USB0 = 64, /* Doesn't apply on CN38XX or CN58XX */
- CVMX_IRQ_PCM = 65, /* Doesn't apply on CN52XX or CN63XX */
- CVMX_IRQ_MPI = 66, /* Doesn't apply on CN52XX or CN63XX */
- CVMX_IRQ_TWSI2 = 67, /* Added in CN56XX */
- CVMX_IRQ_POWIQ = 68, /* Added in CN56XX */
- CVMX_IRQ_IPDPPTHR = 69, /* Added in CN56XX */
- CVMX_IRQ_MII = 70, /* Added in CN56XX */
- CVMX_IRQ_BOOTDMA = 71, /* Added in CN56XX */
-
- /* 72 - 135 represent the sources in CIU_INTX_EN1 */
- CVMX_IRQ_WDOG0 = 72,
- CVMX_IRQ_WDOG1 = 73,
- CVMX_IRQ_WDOG2 = 74,
- CVMX_IRQ_WDOG3 = 75,
- CVMX_IRQ_WDOG4 = 76,
- CVMX_IRQ_WDOG5 = 77,
- CVMX_IRQ_WDOG6 = 78,
- CVMX_IRQ_WDOG7 = 79,
- CVMX_IRQ_WDOG8 = 80,
- CVMX_IRQ_WDOG9 = 81,
- CVMX_IRQ_WDOG10= 82,
- CVMX_IRQ_WDOG11= 83,
- CVMX_IRQ_WDOG12= 84,
- CVMX_IRQ_WDOG13= 85,
- CVMX_IRQ_WDOG14= 86,
- CVMX_IRQ_WDOG15= 87,
- CVMX_IRQ_UART2 = 88, /* Added in CN52XX */
- CVMX_IRQ_USB1 = 89, /* Added in CN52XX */
- CVMX_IRQ_MII1 = 90, /* Added in CN52XX */
- CVMX_IRQ_NAND = 91, /* Added in CN52XX */
- CVMX_IRQ_MIO = 92, /* Added in CN63XX */
- CVMX_IRQ_IOB = 93, /* Added in CN63XX */
- CVMX_IRQ_FPA = 94, /* Added in CN63XX */
- CVMX_IRQ_POW = 95, /* Added in CN63XX */
- CVMX_IRQ_L2C = 96, /* Added in CN63XX */
- CVMX_IRQ_IPD = 97, /* Added in CN63XX */
- CVMX_IRQ_PIP = 98, /* Added in CN63XX */
- CVMX_IRQ_PKO = 99, /* Added in CN63XX */
- CVMX_IRQ_ZIP = 100, /* Added in CN63XX */
- CVMX_IRQ_TIM = 101, /* Added in CN63XX */
- CVMX_IRQ_RAD = 102, /* Added in CN63XX */
- CVMX_IRQ_KEY = 103, /* Added in CN63XX */
- CVMX_IRQ_DFA = 104, /* Added in CN63XX */
- CVMX_IRQ_USB = 105, /* Added in CN63XX */
- CVMX_IRQ_SLI = 106, /* Added in CN63XX */
- CVMX_IRQ_DPI = 107, /* Added in CN63XX */
- CVMX_IRQ_AGX0 = 108, /* Added in CN63XX */
- /* 109 - 117 are reserved */
- CVMX_IRQ_AGL = 118, /* Added in CN63XX */
- CVMX_IRQ_PTP = 119, /* Added in CN63XX */
- CVMX_IRQ_PEM0 = 120, /* Added in CN63XX */
- CVMX_IRQ_PEM1 = 121, /* Added in CN63XX */
- CVMX_IRQ_SRIO0 = 122, /* Added in CN63XX */
- CVMX_IRQ_SRIO1 = 123, /* Added in CN63XX */
- CVMX_IRQ_LMC0 = 124, /* Added in CN63XX */
- /* Interrupts 125 - 127 are reserved */
- CVMX_IRQ_DFM = 128, /* Added in CN63XX */
- /* Interrupts 129 - 135 are reserved */
+ CVMX_IRQ_SW1,
+ CVMX_IRQ_MIPS2,
+ CVMX_IRQ_MIPS3,
+ CVMX_IRQ_MIPS4,
+ CVMX_IRQ_MIPS5,
+ CVMX_IRQ_MIPS6,
+ CVMX_IRQ_MIPS7,
+ /* 64 WORKQ interrupts. */
+ CVMX_IRQ_WORKQ0,
+ /* 16 GPIO interrupts. */
+ CVMX_IRQ_GPIO0 = CVMX_IRQ_WORKQ0 + 64,
+ /* 4 MBOX interrupts. */
+ CVMX_IRQ_MBOX0 = CVMX_IRQ_GPIO0 + 16,
+ /* 3 UART interrupts. */
+ CVMX_IRQ_UART0 = CVMX_IRQ_MBOX0 + 4,
+ CVMX_IRQ_PCI_INT0 = CVMX_IRQ_UART0 + 3,
+ CVMX_IRQ_PCI_INT1,
+ CVMX_IRQ_PCI_INT2,
+ CVMX_IRQ_PCI_INT3,
+ CVMX_IRQ_PCI_MSI0,
+ CVMX_IRQ_PCI_MSI1,
+ CVMX_IRQ_PCI_MSI2,
+ CVMX_IRQ_PCI_MSI3,
+ /* 2 TWSI interrupts */
+ CVMX_IRQ_TWSI0,
+ CVMX_IRQ_RML = CVMX_IRQ_TWSI0 + 2,
+ /* 4 TRACE interrupts added in CN68XX */
+ CVMX_IRQ_TRACE0,
+ /* 5 GMX_DRP interrupts added in CN68XX */
+ CVMX_IRQ_GMX_DRP0 = CVMX_IRQ_TRACE0 + 4,
+ CVMX_IRQ_GMX_DRP1, /* Doesn't apply on CN52XX or CN63XX */
+ CVMX_IRQ_IPD_DRP = CVMX_IRQ_GMX_DRP0 + 5,
+ CVMX_IRQ_KEY_ZERO, /* Doesn't apply on CN52XX or CN63XX */
+ /* 4 TIMER interrupts. */
+ CVMX_IRQ_TIMER0,
+ /* 2 USB interrupts. */
+ CVMX_IRQ_USB0 = CVMX_IRQ_TIMER0 + 4, /* Doesn't apply on CN38XX or CN58XX */
+ CVMX_IRQ_PCM = CVMX_IRQ_USB0 + 2, /* Doesn't apply on CN52XX or CN63XX */
+ CVMX_IRQ_MPI, /* Doesn't apply on CN52XX or CN63XX */
+ CVMX_IRQ_POWIQ, /* Added in CN56XX */
+ CVMX_IRQ_IPDPPTHR, /* Added in CN56XX */
+ /* 2 MII interrupts. */
+ CVMX_IRQ_MII0, /* Added in CN56XX */
+ CVMX_IRQ_BOOTDMA = CVMX_IRQ_MII0 + 2, /* Added in CN56XX */
+
+ /* 32 WDOG interrupts. */
+ CVMX_IRQ_WDOG0,
+ CVMX_IRQ_NAND = CVMX_IRQ_WDOG0 + 32, /* Added in CN52XX */
+ CVMX_IRQ_MIO, /* Added in CN63XX */
+ CVMX_IRQ_IOB, /* Added in CN63XX */
+ CVMX_IRQ_FPA, /* Added in CN63XX */
+ CVMX_IRQ_POW, /* Added in CN63XX */
+ CVMX_IRQ_L2C, /* Added in CN63XX */
+ CVMX_IRQ_IPD, /* Added in CN63XX */
+ CVMX_IRQ_PIP, /* Added in CN63XX */
+ CVMX_IRQ_PKO, /* Added in CN63XX */
+ CVMX_IRQ_ZIP, /* Added in CN63XX */
+ CVMX_IRQ_TIM, /* Added in CN63XX */
+ CVMX_IRQ_RAD, /* Added in CN63XX */
+ CVMX_IRQ_KEY, /* Added in CN63XX */
+ CVMX_IRQ_DFA, /* Added in CN63XX */
+ CVMX_IRQ_USBCTL, /* Added in CN63XX */
+ CVMX_IRQ_SLI, /* Added in CN63XX */
+ CVMX_IRQ_DPI, /* Added in CN63XX */
+ /* 5 AGX interrupts added in CN68XX. */
+ CVMX_IRQ_AGX0, /* Added in CN63XX */
+
+ CVMX_IRQ_AGL = CVMX_IRQ_AGX0 + 5, /* Added in CN63XX */
+ CVMX_IRQ_PTP, /* Added in CN63XX */
+ CVMX_IRQ_PEM0, /* Added in CN63XX */
+ CVMX_IRQ_PEM1, /* Added in CN63XX */
+ CVMX_IRQ_SRIO0, /* Added in CN63XX */
+ CVMX_IRQ_SRIO1, /* Added in CN63XX */
+ CVMX_IRQ_LMC0, /* Added in CN63XX */
+ /* 4 LMC interrupts added in CN68XX. */
+ CVMX_IRQ_DFM = CVMX_IRQ_LMC0 + 4, /* Added in CN63XX */
+ CVMX_IRQ_RST, /* Added in CN63XX */
+ CVMX_IRQ_ILK, /* Added for CN68XX */
+ CVMX_IRQ_SRIO2, /* Added in CN66XX */
+ CVMX_IRQ_DPI_DMA, /* Added in CN61XX */
+ /* 6 addition timers added in CN61XX */
+ CVMX_IRQ_TIMER4, /* Added in CN61XX */
+ CVMX_IRQ_MAX = CVMX_IRQ_TIMER4 + 6 /* One greater than the last valid number.*/
} cvmx_irq_t;
/**
* Function prototype for the exception handler
*/
-typedef void (*cvmx_interrupt_exception_t)(uint64_t registers[32]);
+typedef void (*cvmx_interrupt_exception_t)(uint64_t *registers);
/**
* Function prototype for interrupt handlers
*/
-typedef void (*cvmx_interrupt_func_t)(int irq_number, uint64_t registers[32], void *user_arg);
+typedef void (*cvmx_interrupt_func_t)(int irq_number, uint64_t *registers, void *user_arg);
/**
* Register an interrupt handler for the specified interrupt number.
@@ -206,7 +166,7 @@ typedef void (*cvmx_interrupt_func_t)(int irq_number, uint64_t registers[32], vo
* @param func Function to call on interrupt.
* @param user_arg User data to pass to the interrupt handler
*/
-void cvmx_interrupt_register(cvmx_irq_t irq_number, cvmx_interrupt_func_t func, void *user_arg);
+void cvmx_interrupt_register(int irq_number, cvmx_interrupt_func_t func, void *user_arg);
/**
* Set the exception handler for all non interrupt sources.
@@ -216,74 +176,21 @@ void cvmx_interrupt_register(cvmx_irq_t irq_number, cvmx_interrupt_func_t func,
*/
cvmx_interrupt_exception_t cvmx_interrupt_set_exception(cvmx_interrupt_exception_t handler);
+
/**
* Masks a given interrupt number.
- * EN0 sources are masked on IP2
- * EN1 sources are masked on IP3
*
- * @param irq_number interrupt number to mask (0-135)
+ * @param irq_number interrupt number to mask
*/
-static inline void cvmx_interrupt_mask_irq(int irq_number)
-{
- if (irq_number<8)
- {
- uint32_t mask;
- asm volatile ("mfc0 %0,$12,0" : "=r" (mask));
- mask &= ~(1<< (8 + irq_number));
- asm volatile ("mtc0 %0,$12,0" : : "r" (mask));
- }
- else if (irq_number < 8 + 64)
- {
- int ciu_bit = (irq_number - 8) & 63;
- int ciu_offset = cvmx_get_core_num() * 2;
- uint64_t mask = cvmx_read_csr(CVMX_CIU_INTX_EN0(ciu_offset));
- mask &= ~(1ull << ciu_bit);
- cvmx_write_csr(CVMX_CIU_INTX_EN0(ciu_offset), mask);
- }
- else
- {
- int ciu_bit = (irq_number - 8) & 63;
- int ciu_offset = cvmx_get_core_num() * 2 + 1;
- uint64_t mask = cvmx_read_csr(CVMX_CIU_INTX_EN1(ciu_offset));
- mask &= ~(1ull << ciu_bit);
- cvmx_write_csr(CVMX_CIU_INTX_EN1(ciu_offset), mask);
- }
-}
+extern void (*cvmx_interrupt_mask_irq)(int irq_number);
/**
* Unmasks a given interrupt number
- * EN0 sources are unmasked on IP2
- * EN1 sources are unmasked on IP3
*
- * @param irq_number interrupt number to unmask (0-135)
+ * @param irq_number interrupt number to unmask
*/
-static inline void cvmx_interrupt_unmask_irq(int irq_number)
-{
- if (irq_number<8)
- {
- uint32_t mask;
- asm volatile ("mfc0 %0,$12,0" : "=r" (mask));
- mask |= (1<< (8 + irq_number));
- asm volatile ("mtc0 %0,$12,0" : : "r" (mask));
- }
- else if (irq_number < 8 + 64)
- {
- int ciu_bit = (irq_number - 8) & 63;
- int ciu_offset = cvmx_get_core_num() * 2;
- uint64_t mask = cvmx_read_csr(CVMX_CIU_INTX_EN0(ciu_offset));
- mask |= (1ull << ciu_bit);
- cvmx_write_csr(CVMX_CIU_INTX_EN0(ciu_offset), mask);
- }
- else
- {
- int ciu_bit = (irq_number - 8) & 63;
- int ciu_offset = cvmx_get_core_num() * 2 + 1;
- uint64_t mask = cvmx_read_csr(CVMX_CIU_INTX_EN1(ciu_offset));
- mask |= (1ull << ciu_bit);
- cvmx_write_csr(CVMX_CIU_INTX_EN1(ciu_offset), mask);
- }
-}
+extern void (*cvmx_interrupt_unmask_irq)(int irq_number);
/* Disable interrupts by clearing bit 0 of the COP0 status register,
@@ -318,16 +225,16 @@ static inline void cvmx_interrupt_restore(uint32_t flags)
* Utility function to do interrupt safe printf
*/
#ifdef CVMX_BUILD_FOR_LINUX_KERNEL
- #define cvmx_safe_printf printk
+ #define cvmx_safe_printf printk
#elif defined(CVMX_BUILD_FOR_LINUX_USER)
- #define cvmx_safe_printf printf
+ #define cvmx_safe_printf printf
#else
- extern void cvmx_safe_printf(const char* format, ... ) __attribute__ ((format(printf, 1, 2)));
+ extern void cvmx_safe_printf(const char* format, ... ) __attribute__ ((format(printf, 1, 2)));
#endif
#define PRINT_ERROR(format, ...) cvmx_safe_printf("ERROR " format, ##__VA_ARGS__)
-#ifdef __cplusplus
+#ifdef __cplusplus
}
#endif