Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Sep 1997 16:46:56 -0600 (MDT)
From:      Nate Williams <nate@mt.sri.com>
To:        Stefan Esser <se@freebsd.org>
Cc:        Nate Williams <nate@mt.sri.com>, mobile@freebsd.org, current@freebsd.org
Subject:   Re: PCCARD in -current broken
Message-ID:  <199709232246.QAA09189@rocky.mt.sri.com>
In-Reply-To: <19970923230018.00034@mi.uni-koeln.de>
References:  <199709231929.NAA08312@rocky.mt.sri.com> <19970923230018.00034@mi.uni-koeln.de>

next in thread | previous in thread | raw e-mail | index | archive | help
> > It has been for some time (May).  If it works on your box, you're
> > lucky!  (PHK is one of the lucky ones, and it may be related to using
> > more PCI-like machines, unlike older 'straight-ISA' laptops).
> 
> Hmmm, I'm surprised to hear that ...
> You are the first to report such a problem.

Most folks don't use current on their laptops. :)

> > The change to the 'generic' shared interrupt code broke some assumptions
> > I had about 'register_intr()' and 'unregister_intr()' in
> > /sys/pccard/pcic.c.  Basically, I had assumed the register_intr() would
> > fail if I wanted access to an interrupt that was already taken, and now
> > it succeeds so I add it to my list of 'available' IRQ's (I'd give it
> > back, but at this point the freemask is really hosed).  This assumption
> > leads to all sorts of problems, of which I haven't completely thought
> > about.
> 
> There should not be a problem. ISA does not 
> (should not, I didn't check the sources
> recently) register the handler as shared,
> and this will prevent another handler (both
> shared or exclusive) to be registered.

register_intr() sets the INTR_EXCL flag just before it calls
intr_create() (so far so good), but in intr_connect(), the code to check
for that flag is ifdef's out:
int
intr_connect(intrec *idesc)
{
...
#ifdef RESOURCE_CHECK
        int resflag;
#endif /* RESOURCE_CHECK */
....
#ifdef RESOURCE_CHECK
        resflag = (idesc->flags & INTR_EXCL) ? RESF_NONE : RESF_SHARED;
        if (resource_claim(idesc->devdata, REST_INT, resflag, irq, irq) == 0)
#endif /* RESOURCE_CHECK */
        {
 
So, we don't even check to see if INTR_EXCL is used.

> I assume this does not work for you ?

See above.

> > In any case, until the code in /sys/kern/kern_intr.c ifdef'd out by
> > 'RESOURCE_CHECK' is finished, or something else is done to make sure
> 
> The code is finished, but I did not commit
> it to -current, since I was waiting for the
> new ISA device probe/attach code to become 
> available.

How does the new code realize that the interrupt is exclusive then?

> > that 'ISA/Exclusive' interrupts are not allowed to be registered as
> > 'shared' resources, I think there are potential problems with the
> 
> Well, ISA interrupts should be registered in 
> a way that guarantees they are not shared.

How?

> Hmmm, I just checked the sources and I can't
> see what's wrong. Please tell me why the 
> following is not sufficient:

Hmm, never mind.  I never walked enough down into the sources to see
what's going on.

So, can I rely on register_intr() return a negative # for failure?

(Here's the code in question.)
static u_int
build_freelist(u_int pcic_mask)
{
        inthand2_t *nullfunc;
        int irq;
        u_int mask, freemask;

        /* No free IRQs (yet). */
        freemask = 0;

        /* Walk through all of the IRQ's and find any that aren't allocated. */
        for (irq = 0; irq < ICU_LEN; irq++) {
                /*
                 * If the PCIC controller can't generate it, don't
                 * bother checking to see if it it's free.
                 */
                mask = 1 << irq;
                if (!(mask & pcic_mask)) continue;

                /* See if the IRQ is free. */
                if (register_intr(irq, 0, 0, nullfunc, NULL, irq) == 0) {
                        /* Give it back, but add it to the mask */
                        INTRMASK(freemask, mask);
                        unregister_intr(irq, nullfunc);
                }
        }
#ifdef PCIC_DEBUG
        printf("Freelist of IRQ's <0x%x>\n", freemask);
#endif
        return freemask;
}

> Please tell me what's wrong with this ...

Maybe nothing, and maybe I'm a geek who likes to blame everyone else for
my problems! :(



Nate



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709232246.QAA09189>