Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

armadaxp_splfuncs.c



Hi!


That armadaxp_splfuncs.c of semihalf is under in arm/pic feels me dirty.
Moreover, a character string called armadaxp is contained in files.pic now.

file   arch/arm/pic/pic_splfuncs.c             pic & pic_splfuncs & !armadaxp
file   arch/arm/pic/armadaxp_splfuncs.c        pic & pic_splfuncs & armadaxp


Since it comes out, I propose moving this to under arm/marvell.
Furthermore, I enabled it to also use general SPL functions arm/pic.

# tested on SHEEVAPLUG and OPENBLOCKS_AX3.
I will commit at next weekend.


By the way, can you add and test 'options ARMADAXP' further to MARVELL_NAS?


Thanks,
--
kiyohara
? arm/msm72xx
? arm/marvell/armadaxp_splfuncs.c
Index: arm/marvell/armadaxp.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/marvell/armadaxp.c,v
retrieving revision 1.3
diff -u -r1.3 armadaxp.c
--- arm/marvell/armadaxp.c      30 Sep 2013 13:03:25 -0000      1.3
+++ arm/marvell/armadaxp.c      14 Oct 2013 04:21:04 -0000
@@ -92,7 +92,12 @@
 static void armadaxp_pic_block_irqs(struct pic_softc *, size_t, uint32_t);
 static void armadaxp_pic_establish_irq(struct pic_softc *, struct intrsource 
*);
 
-void armadaxp_handle_irq(void *);
+#if !defined(PIC_SPLFUNCS)
+void armadaxp_irq_handler(void *);
+#else
+static int armadaxp_find_pending_irqs(void);
+static void armadaxp_pic_block_irq(struct pic_softc *, size_t);
+#endif
 void armadaxp_io_coherency_init(void);
 int armadaxp_l2_init(bus_addr_t);
 
@@ -188,7 +193,13 @@
        /* Enable IRQ prioritization */
        ctrl |= (1 << 0);
        MPIC_WRITE(ARMADAXP_MLMB_MPIC_CTRL, ctrl);
+#if !defined(PIC_SPLFUNCS)
        MPIC_CPU_WRITE(ARMADAXP_MLMB_MPIC_CTP, curcpl() << MPIC_CTP_SHIFT);
+#else
+       MPIC_CPU_WRITE(ARMADAXP_MLMB_MPIC_CTP, IPL_NONE << MPIC_CTP_SHIFT);
+
+       find_pending_irqs = armadaxp_find_pending_irqs;
+#endif
 }
 
 static void
@@ -236,13 +247,17 @@
            tmp | (is->is_ipl << MPIC_ISCR_SHIFT));
 }
 
+#if !defined(PIC_SPLFUNCS)
 void
-armadaxp_handle_irq(void *frame)
+armadaxp_irq_handler(void *frame)
 {
+       struct cpu_info * const ci = curcpu();
        struct intrsource *is;
        int irq;
        u_int irqstate;
 
+       ci->ci_data.cpu_nintr++;
+
        irq = MPIC_CPU_READ(ARMADAXP_MLMB_MPIC_IIACK) & 0x3ff;
 
        /* Is it a spurious interrupt ?*/
@@ -261,6 +276,39 @@
        cpu_dosoftints();
 #endif
 }
+#else
+static int
+armadaxp_find_pending_irqs(void)
+{
+       struct intrsource *is;
+       int irq;
+
+       irq = MPIC_CPU_READ(ARMADAXP_MLMB_MPIC_IIACK) & 0x3ff;
+
+       /* Is it a spurious interrupt ?*/
+       if (irq == 0x3ff)
+               return 0;
+       is = armadaxp_pic.pic_sources[irq];
+       if (is == NULL) {
+               printf("stray interrupt: %d\n", irq);
+               return 0;
+       }
+
+       armadaxp_pic_block_irq(&armadaxp_pic, irq);
+       pic_mark_pending(&armadaxp_pic, irq);
+
+       return is->is_ipl;
+}
+
+static void
+armadaxp_pic_block_irq(struct pic_softc *pic, size_t irq)
+{
+
+       KASSERT(pic->pic_maxsources >= irq);
+       MPIC_WRITE(ARMADAXP_MLMB_MPIC_ICE, irq);
+       MPIC_CPU_WRITE(ARMADAXP_MLMB_MPIC_ISM, irq);
+}
+#endif
 
 /*
  * Clock functions
Index: arm/marvell/files.marvell
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/marvell/files.marvell,v
retrieving revision 1.10
diff -u -r1.10 files.marvell
--- arm/marvell/files.marvell   30 Sep 2013 13:06:03 -0000      1.10
+++ arm/marvell/files.marvell   14 Oct 2013 04:21:04 -0000
@@ -5,14 +5,12 @@
 
 include "arch/arm/pic/files.pic"
 
-device mvsoc { [unit = -1], [offset = -1], [irq = -1] } : bus_space_generic, 
pic, pic_splfuncs
+device mvsoc { [unit = -1], [offset = -1], [irq = -1] } : bus_space_generic, 
pic
 attach mvsoc at mainbus
 file   arch/arm/marvell/mvsoc.c                mvsoc
 file   arch/arm/marvell/mvsoc_space.c
 file   arch/arm/marvell/mvsoc_dma.c
 
-file   arch/arm/arm32/irq_dispatch.S
-
 defflag opt_mvsoc.h                            ORION KIRKWOOD MV78XX0 ARMADAXP
 file   arch/arm/marvell/mvsoc_intr.c
 file   arch/arm/marvell/orion.c                orion
@@ -20,6 +18,9 @@
 file   arch/arm/marvell/mv78xx0.c              mv78xx0
 file   arch/arm/marvell/armadaxp.c             armadaxp
 
+file   arch/arm/arm32/irq_dispatch.S
+file   arch/arm/marvell/armadaxp_splfuncs.c    pic & !pic_splfuncs & armadaxp
+
 
 # Integrated peripherals
 include "dev/marvell/files.discovery"
Index: arm/marvell/mvsoc_intr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/marvell/mvsoc_intr.c,v
retrieving revision 1.7
diff -u -r1.7 mvsoc_intr.c
--- arm/marvell/mvsoc_intr.c    30 Sep 2013 13:22:22 -0000      1.7
+++ arm/marvell/mvsoc_intr.c    14 Oct 2013 04:21:04 -0000
@@ -42,9 +42,6 @@
 #include <arm/marvell/mvsocreg.h>
 #include <arm/marvell/mvsocvar.h>
 
-#if defined(ARMADAXP)
-extern void armadaxp_handle_irq(void *);
-#endif
 
 int (*find_pending_irqs)(void);
 
@@ -76,14 +73,11 @@
 };
 
 
+#if defined(PIC_SPLFUNCS)
 void
 mvsoc_irq_handler(void *frame)
 {
        struct cpu_info * const ci = curcpu();
-#if defined(ARMADAXP)
-       ci->ci_data.cpu_nintr++;
-       armadaxp_handle_irq(frame);
-#else
        const int oldipl = ci->ci_cpl;
        const uint32_t oldipl_mask = __BIT(oldipl);
        int ipl_mask = 0;
@@ -97,8 +91,8 @@
         */
        if ((ipl_mask & ~oldipl_mask) > oldipl_mask)
                pic_do_pending_ints(I32_bit, oldipl, frame);
-#endif
 }
+#endif
 
 /*
  * Mbus-L to Mbus bridge
Index: arm/marvell/mvsoc_intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/marvell/mvsoc_intr.h,v
retrieving revision 1.2
diff -u -r1.2 mvsoc_intr.h
--- arm/marvell/mvsoc_intr.h    29 Jul 2012 00:07:10 -0000      1.2
+++ arm/marvell/mvsoc_intr.h    14 Oct 2013 04:21:04 -0000
@@ -28,12 +28,26 @@
 #ifndef _MVSOC_INTR_H_
 #define _MVSOC_INTR_H_
 
+#include "opt_mvsoc.h"
+
+#ifdef PIC_SPLFUNCS
 #define ARM_IRQ_HANDLER        _C_LABEL(mvsoc_irq_handler)
+#else
+#  ifdef ARMADAXP
+#define ARM_IRQ_HANDLER        _C_LABEL(armadaxp_irq_handler)
+#  endif
+#endif
 
 #ifndef _LOCORE
 extern int (*find_pending_irqs)(void);
 
+#ifdef PIC_SPLFUNCS
 void mvsoc_irq_handler(void *);
+#else
+#  ifdef ARMADAXP
+void armadaxp_irq_handler(void *);
+#  endif
+#endif
 
 #include <arm/pic/picvar.h>
 
Index: arm/pic/files.pic
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/pic/files.pic,v
retrieving revision 1.5
diff -u -r1.5 files.pic
--- arm/pic/files.pic   29 May 2013 22:35:34 -0000      1.5
+++ arm/pic/files.pic   14 Oct 2013 04:21:05 -0000
@@ -8,5 +8,4 @@
 defflag opt_arm_intr_impl.h            __HAVE_PIC_SOFTINT
 
 file   arch/arm/pic/pic.c                      pic
-file   arch/arm/pic/pic_splfuncs.c             pic & pic_splfuncs & !armadaxp
-file   arch/arm/pic/armadaxp_splfuncs.c        pic & pic_splfuncs & armadaxp
+file   arch/arm/pic/pic_splfuncs.c             pic & pic_splfuncs
Index: evbarm/conf/OPENBLOCKS_AX3
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/conf/OPENBLOCKS_AX3,v
retrieving revision 1.4
diff -u -r1.4 OPENBLOCKS_AX3
--- evbarm/conf/OPENBLOCKS_AX3  5 Oct 2013 06:15:51 -0000       1.4
+++ evbarm/conf/OPENBLOCKS_AX3  14 Oct 2013 04:21:05 -0000
@@ -27,6 +27,8 @@
 options        ARMADAXP
 
 options        PIC_MAXSOURCES=128
+#no options    PIC_SPLFUNCS    # use ARMADA XP's SPL functions instead of
+                               # ARM generic SPL functions.
 
 # Standard system options
 
Index: evbarm/conf/std.marvell
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/conf/std.marvell,v
retrieving revision 1.3
diff -u -r1.3 std.marvell
--- evbarm/conf/std.marvell     16 Dec 2012 23:47:56 -0000      1.3
+++ evbarm/conf/std.marvell     14 Oct 2013 04:21:06 -0000
@@ -11,6 +11,7 @@
 options        __HAVE_CPU_UAREA_ALLOC_IDLELWP
 
 options        COM_REGMAP
+options        PIC_SPLFUNCS                    # use ARM generic SPL functions.
 
 options        KERNEL_BASE_EXT=0xc0000000
 makeoptions    LOADADDRESS="0xc0008000"


Home | Main Index | Thread Index | Old Index