summaryrefslogtreecommitdiff
path: root/target/linux/brcm63xx/patches-3.14/023-MIPS-BCM63XX-add-cpu-argument-to-dispatch-internal.patch
blob: 395dc13d8d3d4bee691601ec98b24c0dbf45c6c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From 43ebef8162adfa7789cb915e60e46103965d7efd Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jogo@openwrt.org>
Date: Fri, 26 Apr 2013 11:21:16 +0200
Subject: [PATCH 06/10] MIPS: BCM63XX: add cpu argument to dispatch internal

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
 arch/mips/bcm63xx/irq.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

--- a/arch/mips/bcm63xx/irq.c
+++ b/arch/mips/bcm63xx/irq.c
@@ -19,9 +19,10 @@
 #include <bcm63xx_io.h>
 #include <bcm63xx_irq.h>
 
+
 static u32 irq_stat_addr[2];
 static u32 irq_mask_addr[2];
-static void (*dispatch_internal)(void);
+static void (*dispatch_internal)(int cpu);
 static int is_ext_irq_cascaded;
 static unsigned int ext_irq_count;
 static unsigned int ext_irq_start, ext_irq_end;
@@ -54,19 +55,20 @@ static inline void handle_internal(int i
  */
 
 #define BUILD_IPIC_INTERNAL(width)					\
-void __dispatch_internal_##width(void)					\
+void __dispatch_internal_##width(int cpu)				\
 {									\
 	u32 pending[width / 32];					\
 	unsigned int src, tgt;						\
 	bool irqs_pending = false;					\
-	static unsigned int i;						\
+	static unsigned int i[2];					\
+	unsigned int *next = &i[cpu];					\
 									\
 	/* read registers in reverse order */				\
 	for (src = 0, tgt = (width / 32); src < (width / 32); src++) {	\
 		u32 val;						\
 									\
-		val = bcm_readl(irq_stat_addr[0] + src * sizeof(u32));	\
-		val &= bcm_readl(irq_mask_addr[0] + src * sizeof(u32));	\
+		val = bcm_readl(irq_stat_addr[cpu] + src * sizeof(u32)); \
+		val &= bcm_readl(irq_mask_addr[cpu] + src * sizeof(u32)); \
 		pending[--tgt] = val;					\
 									\
 		if (val)						\
@@ -77,9 +79,9 @@ void __dispatch_internal_##width(void)
 		return;							\
 									\
 	while (1) {							\
-		unsigned int to_call = i;				\
+		unsigned int to_call = *next;				\
 									\
-		i = (i + 1) & (width - 1);				\
+		*next = (*next + 1) & (width - 1);			\
 		if (pending[to_call / 32] & (1 << (to_call & 0x1f))) {	\
 			handle_internal(to_call);			\
 			break;						\
@@ -129,7 +131,7 @@ asmlinkage void plat_irq_dispatch(void)
 		if (cause & CAUSEF_IP1)
 			do_IRQ(1);
 		if (cause & CAUSEF_IP2)
-			dispatch_internal();
+			dispatch_internal(0);
 		if (!is_ext_irq_cascaded) {
 			if (cause & CAUSEF_IP3)
 				do_IRQ(IRQ_EXT_0);