Frank Wille | 10 Jan 2012 14:15
Picon

New trigger types for OpenPIC

Hi!

We have many OpenPIC-based PICs in powerpc/pic, which also support
different polarities of level- and edge-triggers. So I suggest to extened
our trigger types like this (powerpc/include/intr.h):

/* Interrupt sharing types. */
#define IST_NONE		0       /* none */  
#define IST_PULSE		1       /* pulsed */
#define IST_EDGE		2       /* edge-triggered */ 
#define IST_LEVEL		3       /* level-triggered */
/* new: */
#define IST_EDGE_FALLING	IST_EDGE
#define IST_EDGE_RAISING	4
#define IST_LEVEL_LOW		IST_LEVEL
#define IST_LEVEL_HIGH		5

Additionally I would change the PICs which support polarities as in the
following example for the mpcsoc PIC:

--- pic_mpcsoc.c        20 Jun 2011 06:21:45 -0000      1.2
+++ pic_mpcsoc.c        10 Jan 2012 13:04:01 -0000
 <at>  <at>  -161,9 +161,11  <at>  <at> 

        x = irq;
        x |= OPENPIC_IMASK;
-       x |= (i8259iswired && irq == 0) ?
+       x |= ((i8259iswired && irq == 0) ||
+           type == IST_EDGE_RAISING || type == IST_LEVEL_HIGH) ?
            OPENPIC_POLARITY_POSITIVE : OPENPIC_POLARITY_NEGATIVE;
(Continue reading)

Toru Nishimura | 10 Jan 2012 15:03

Re: New trigger types for OpenPIC

Frank Wille asked;

> I suggest to extend our trigger types like this (powerpc/include/intr.h):
> ...
> ... support polarities as in the following example for the mpcsoc PIC:

How about using plain if-clauses there like;

    if (i8259iswired && irq == 0)
        x |= OPENPIC_POLARITY_POSITIVE; /* ISA style southbridge compat */
    else if (type == IST_LEVEL_RISING || type == IST_LEVEL_HIGH)
        x |= OPENPIC_POLARITY_POSITIVE;
    else
        x |= OPENPIC_POLARITY_NEGATIVE;
    if (type == IST_EDGE_FALLING || type == IST_EDGE_RASING)
        x |= OPENPIC_SENSE_EDGE;
    else
        x |= OPENPIC_SENSE_LEVEL;

Toru Nishimura / ALKYL Technology

Frank Wille | 10 Jan 2012 15:39
Picon

Re: New trigger types for OpenPIC

On Tue, 10 Jan 2012 23:03:32 +0900
"Toru Nishimura" <locore64 <at> alkyltechnology.com> wrote:

> How about using plain if-clauses there like;
> 
>     if (i8259iswired && irq == 0)
>         x |= OPENPIC_POLARITY_POSITIVE; /* ISA style southbridge
> compat */ else if (type == IST_LEVEL_RISING || type == IST_LEVEL_HIGH)
>         x |= OPENPIC_POLARITY_POSITIVE;
>     else
>         x |= OPENPIC_POLARITY_NEGATIVE;
>     if (type == IST_EDGE_FALLING || type == IST_EDGE_RASING)
>         x |= OPENPIC_SENSE_EDGE;
>     else
>         x |= OPENPIC_SENSE_LEVEL;

Ok for me. This might increase readability.

I just realized that I will also have to add the new types to intr.c.

--- intr.c      27 Sep 2011 01:02:36 -0000      1.18
+++ intr.c      10 Jan 2012 14:37:03 -0000
 <at>  <at>  -168,8 +168,10  <at>  <at> 
        case IST_NONE:
                is->is_type = type;
                break;
-       case IST_EDGE:
-       case IST_LEVEL:
+       case IST_EDGE_FALLING:
+       case IST_EDGE_RAISING:
(Continue reading)

Frank Wille | 27 Jan 2012 22:51
Picon

pthread mutex failures

Is there any chance to fix the critical PR44387 before 6.0 is released?

I can reproduce it on several macppc, ofppc and sandpoint platforms, but
unfortunately I have no idea how to fix it. The bug timing-critical, which
means using gdb or generating more debugging output will make it disappear
in most cases.

For easier analysis of the problem I made a simple standalone program,
without the ATF framework:

#include <sys/cdefs.h>
#include <pthread.h>
#include <stdio.h>

static pthread_mutex_t mutex;
static int global_x;

static void *
threadfunc(void *arg)
{
        long count = *(int *)arg;

        printf("Second thread (%p). Count is %ld\n", pthread_self(), count);

        while (count--) {
                pthread_mutex_lock(&mutex);
                global_x++;
                pthread_mutex_unlock(&mutex);
        }
        return (void *)count;
(Continue reading)


Gmane