Skip to contentSkip to conversation

irq_resources cleanup (step 1)

PATCH David Gibson 1 participant 1 message Jun 21, 2002 Network drivers

lore
Share & tools
lore
#0 lore raw

The patch below fixes the two worst problems with the current irq_resources setup used by the OCP EMAC driver, to wit:
- The fact that the board specific files need to directly
reference the interrupt handler functions is a big abstraction violation, and can cause compile problems if EMAC support is not included.
- The name "irq_resource" for this global data structure is
confusing, since on a number of architectures "irq_resource" is the name of the top level (struct resource) which handles irq allocation.

So, this patch renames struct irq_resources to struct ocp_irq_desc and the global table of these to "ocp_irq_table". Actually that's still a misleading since the emac driver assumes it is the only user of this table, but we'll save that for another day. It also removes both the irq_name and irq_handler fields and instead the ibm_ocp_enet driver supplies this information directly to request_irq() from it's own internal table.

This works on my 405GP, but needs testing on 440GP, NP405H and NP405L (it should work, but I don't have the hardware to check). It is orthogonal to all my other outstanding ocp patches.

arch/ppc/kernel/ocp.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/kernel/ocp.c +0 -1
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/kernel/ocp.c linux-grinch/arch/ppc/kernel/ocp.c
@@ -75,7 +75,6 @@
 
 LIST_HEAD(ocp_list);
 
-extern struct irq_resources irq_resource[][OCP_MAX_IRQS];
 extern struct ocp_def core_ocp[];
 
 struct type_info ocp_type_info[] = {
arch/ppc/kernel/ocp_proc.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/kernel/ocp_proc.c +3 -3
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/kernel/ocp_proc.c linux-grinch/arch/ppc/kernel/ocp_proc.c
@@ -57,7 +57,7 @@
 #include <asm/byteorder.h>
 #include <asm/ocp.h>
 extern struct type_info ocp_type_info[];
-extern struct irq_resources irq_resource[][OCP_MAX_IRQS];
+extern struct ocp_irq_desc ocp_irq_table[][OCP_MAX_IRQS];
 
 /* iterator */
 static void *
@@ -104,7 +104,7 @@
 		seq_printf(m, " N/A");
 	} else if (i == OCP_IRQ_MUL) {
 		for (i = 0; i < OCP_MAX_IRQS; i++) {
-			seq_printf(m, " %02d", irq_resource[drv->num][i].irq);
+			seq_printf(m, " %02d", ocp_irq_table[drv->num][i].irq);
 		}
 	} else {
 		seq_printf(m, " %02d", drv->irq);
@@ -144,7 +144,7 @@
 	} else if (i == OCP_IRQ_MUL) {
 		for (i = 0; i < OCP_MAX_IRQS; i++) {
 			seq_printf(m, "   irq: %02d\n",
-				   irq_resource[drv->num][i].irq);
+				   ocp_irq_table[drv->num][i].irq);
 		}
 	} else {
 		seq_printf(m, "   irq: %02d\n", drv->irq);
arch/ppc/platforms/ibm405gp.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/ibm405gp.c +8 -8
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/ibm405gp.c linux-grinch/arch/ppc/platforms/ibm405gp.c
@@ -48,14 +48,14 @@
 #include <platforms/ibm405gp.h>
 #include <asm/ocp.h>
 
-const struct irq_resources irq_resource[][OCP_MAX_IRQS] = {
-	{{"405eth Wakeup", 9, ppc405_eth_wakeup, 0},
-	 {"405eth MAL SERR", 10, ppc405_eth_serr, 0},
-	 {"405eth TX DE", 13, ppc405_eth_txde, 0},
-	 {"405eth RX DE", 14, ppc405_eth_rxde, 0},
-	 {"405eth MAC", 15, ppc405_eth_mac, 0},
-	 {"405eth TX EOB", 11, ppc405_eth_txeob, 0},
-	 {"405eth RX EOB", 12, ppc405_eth_rxeob, 0}}
+const struct ocp_irq_desc ocp_irq_table[][OCP_MAX_IRQS] = {
+	{{9, 0}, /* WOL */
+	 {10, 0}, /* MAL SERR */
+	 {13, 0}, /* MAL TX DE */
+	 {14, 0}, /* MAL RX DE */
+	 {15, 0}, /* MAC */
+	 {11, 0}, /* MAL TX EOB */
+	 {12, 0}} /* MAL RX EOB */
 };
 
 struct ocp_def core_ocp[] = {
arch/ppc/platforms/ibm440gp.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/ibm440gp.c +15 -23
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/ibm440gp.c linux-grinch/arch/ppc/platforms/ibm440gp.c
@@ -32,30 +32,22 @@
  * We only have onboard EMAC support for now.  I2C, DMA, timers,
  * etc. have yet to be enabled.
  */
-#ifdef CONFIG_IBM_OCP_ENET
-const struct irq_resources irq_resource[EMAC_NUMS][OCP_MAX_IRQS] = {
-	{
-	 {"EMAC0 WOL", 61, ppc405_eth_wakeup, 0},
-	 {"MAL SERR", 32, ppc405_eth_serr, OCP_INTR_FLAG_SHARED},
-	 {"MAL TXDE", 33, ppc405_eth_txde, OCP_INTR_FLAG_SHARED},
-	 {"MAL RXDE", 34, ppc405_eth_rxde, OCP_INTR_FLAG_SHARED},
-	 {"EMAC0 MAC", 60, ppc405_eth_mac, 0},
-	 {"MAL TXEOB", 10, ppc405_eth_txeob, OCP_INTR_FLAG_SHARED},
-	 {"MAL RXEOB", 11, ppc405_eth_rxeob, OCP_INTR_FLAG_SHARED},
-	 },
-	{
-	 {"EMAC1 WOL", 63, ppc405_eth_wakeup, 0},
-	 {"MAL SERR", 32, ppc405_eth_serr, OCP_INTR_FLAG_SHARED},
-	 {"MAL TXDE", 33, ppc405_eth_txde, OCP_INTR_FLAG_SHARED},
-	 {"MAL RXDE", 34, ppc405_eth_rxde, OCP_INTR_FLAG_SHARED},
-	 {"EMAC1 MAC", 62, ppc405_eth_mac, 0},
-	 {"MAL TXEOB", 10, ppc405_eth_txeob, OCP_INTR_FLAG_SHARED},
-	 {"MAL RXEOB", 11, ppc405_eth_rxeob, OCP_INTR_FLAG_SHARED},
-	 }
+const struct ocp_irq_desc ocp_irq_table[EMAC_NUMS][OCP_MAX_IRQS] = {
+	{{61, 0}, /* WOL */
+	 {32, OCP_INTR_FLAG_SHARED}, /* MAL SERR */
+	 {33, OCP_INTR_FLAG_SHARED}, /* MAL TX DE */
+	 {34, OCP_INTR_FLAG_SHARED}, /* MAL RX DE */
+	 {60, 0}, /* MAC */
+	 {10, OCP_INTR_FLAG_SHARED}, /* MAL TX EOB */
+	 {11, OCP_INTR_FLAG_SHARED}}, /* MAL RX EOB */
+	{{63, 0}, /* WOL */
+	 {32, OCP_INTR_FLAG_SHARED}, /* MAL SERR */
+	 {33, OCP_INTR_FLAG_SHARED}, /* MAL TX DE */
+	 {34, OCP_INTR_FLAG_SHARED}, /* MAL RX DE */
+	 {62, 0}, /* MAC */
+	 {10, OCP_INTR_FLAG_SHARED}, /* MAL TX EOB */
+	 {11, OCP_INTR_FLAG_SHARED}} /* MAL RX EOB */
 };
-#else
-const struct irq_resources irq_resource[EMAC_NUMS][OCP_MAX_IRQS];
-#endif
 
 struct ocp_def core_ocp[] = {
 	{UART, PPC440GP_UART0_ADDR, UART0_INT},
arch/ppc/platforms/ibm_ocp.h renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/ibm_ocp.h +0 -8
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/ibm_ocp.h linux-grinch/arch/ppc/platforms/ibm_ocp.h
@@ -49,14 +49,6 @@
 #include <linux/types.h>
 #include <asm/ptrace.h>
 
-extern void ppc405_eth_wakeup(int, void *, struct pt_regs *);
-extern void ppc405_eth_serr(int, void *, struct pt_regs *);
-extern void ppc405_eth_txeob(int, void *, struct pt_regs *);
-extern void ppc405_eth_rxeob(int, void *, struct pt_regs *);
-extern void ppc405_eth_txde(int, void *, struct pt_regs *);
-extern void ppc405_eth_rxde(int, void *, struct pt_regs *);
-extern void ppc405_eth_mac(int, void *, struct pt_regs *);
-
  /* PCI 32 */
 
 struct pmm_regs {
arch/ppc/platforms/ibmnp405h.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/ibmnp405h.c +29 -29

64 lines not on this page · raw message

arch/ppc/platforms/ibmnp405l.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/ibmnp405l.c +15 -16
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/arch/ppc/platforms/ibmnp405l.c linux-grinch/arch/ppc/platforms/ibmnp405l.c
@@ -51,22 +51,21 @@
 #include <platforms/ibmnp405l.h>
 #include <asm/ocp.h>
 
-const struct irq_resources irq_resource[][OCP_MAX_IRQS] = {
-	{{"405eth Wakeup", 41, ppc405_eth_wakeup, OCP_INTR_FLAG_SHARED},
-	 {"405mal0 SERR", 45, ppc405_eth_serr, OCP_INTR_FLAG_SHARED},
-	 {"405mal0 TX DE", 46, ppc405_eth_txde, OCP_INTR_FLAG_SHARED},
-	 {"405mal0 RX DE", 47, ppc405_eth_rxde, OCP_INTR_FLAG_SHARED},
-	 {"405eth0 MAC", 37, ppc405_eth_mac, 0},
-	 {"405mal0 TX EOB", 17, ppc405_eth_txeob, OCP_INTR_FLAG_SHARED},
-	 {"405mal0 RX EOB", 18, ppc405_eth_rxeob, OCP_INTR_FLAG_SHARED}},
-	{{"405eth Wakeup", 41, ppc405_eth_wakeup, OCP_INTR_FLAG_SHARED},
-	 {"405mal0 SERR", 45, ppc405_eth_serr, OCP_INTR_FLAG_SHARED},
-	 {"405mal0 TX DE", 46, ppc405_eth_txde, OCP_INTR_FLAG_SHARED},
-	 {"405mal0 RX DE", 47, ppc405_eth_rxde, OCP_INTR_FLAG_SHARED},
-	 {"405eth1 MAC", 38, ppc405_eth_mac, 0},
-	 {"405mal0 TX EOB", 17, ppc405_eth_txeob, OCP_INTR_FLAG_SHARED},
-	 {"405mal0 RX EOB", 18, ppc405_eth_rxeob, OCP_INTR_FLAG_SHARED}}
-
+const struct ocp_irq_descs ocp_irq_table[][OCP_MAX_IRQS] = {
+	{{41, OCP_INTR_FLAG_SHARED}, /* WOL */
+	 {45, OCP_INTR_FLAG_SHARED}, /* MAL SERR */
+	 {46, OCP_INTR_FLAG_SHARED}, /* MAL TXDE */
+	 {47, OCP_INTR_FLAG_SHARED}, /* MAL RXDE */
+	 {37, 0}, /* MAC */
+	 {17, OCP_INTR_FLAG_SHARED}, /* MAL TX EOB */
+	 {18, OCP_INTR_FLAG_SHARED}}, /* MAL RX EOB */
+	{{41, OCP_INTR_FLAG_SHARED}, /* WOL */
+	 {45, OCP_INTR_FLAG_SHARED}, /* MAL SERR */
+	 {46, OCP_INTR_FLAG_SHARED}, /* MAL TXDE */
+	 {47, OCP_INTR_FLAG_SHARED}, /* MAL RXDE */
+	 {38, 0}, /* MAC */
+	 {17, OCP_INTR_FLAG_SHARED}, /* MAL TX EOB */
+	 {18, OCP_INTR_FLAG_SHARED}}, /* MAL RX EOB */
 };
 
 struct ocp_def core_ocp[] = {
drivers/net/ibm_ocp/ibm_ocp_enet.c renamed from home/dgibson/kernel/linuxppc_2_4_devel/drivers/net/ibm_ocp/ibm_ocp_enet.c +39 -27

163 lines not on this page · raw message

drivers/net/ibm_ocp/ibm_ocp_enet.h renamed from home/dgibson/kernel/linuxppc_2_4_devel/drivers/net/ibm_ocp/ibm_ocp_enet.h +1 -1
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/drivers/net/ibm_ocp/ibm_ocp_enet.h linux-grinch/drivers/net/ibm_ocp/ibm_ocp_enet.h
@@ -125,7 +125,7 @@
 						((VAL & 0xffff) << 16))
 
 
-extern struct irq_resources irq_resource[][7];
+extern struct ocp_irq_desc ocp_irq_table[][7];
 //extern struct emac_regs *EMAC_ADDR[];
 /* MAL Buffer Descriptor structure */
 typedef struct {
include/asm-ppc/ocp.h renamed from home/dgibson/kernel/linuxppc_2_4_devel/include/asm-ppc/ocp.h +1 -3
diff -urN /home/dgibson/kernel/linuxppc_2_4_devel/include/asm-ppc/ocp.h linux-grinch/include/asm-ppc/ocp.h
@@ -98,10 +98,8 @@
 
 #define OCP_INTR_FLAG_SHARED 0x1
 
-struct irq_resources {
-	char irq_name[16];
+struct ocp_irq_desc {
 	u16 irq;
-	void *irq_handler;
 	int flags;
 };
 

--
David Gibson | For every complex problem there is a
[email protected] | solution which is simple, neat and
| wrong. -- H.L. Mencken
http://www.ozlabs.org/people/dgibson

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/