[BUG pcmcia] multi-function card can't get the correct ConfigBase

Komuro komurojun-mbn at nifty.com
Sun Nov 30 03:54:02 EST 2008


Dear Dominik

Multi-function card can't get the correct ConfigBase.

unfortunately, pccard_read_tuple always get the ConfigBase for 1st device.

The reason of this problem is pccard_read_tuple set
tuple.Attributes = TUPLE_RETURN_COMMON.

Any idea to fix this?

//// ds.c
        /* set up some more device information */
        ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG,
                                &cis_config);
        if (!ret) {
                p_dev->conf.ConfigBase = cis_config.base;
                p_dev->conf.Present = cis_config.rmask[0];
        } else {
                dev_printk(KERN_INFO, dev,
                           "pcmcia: could not parse base and rmask0 of CIS\n");
                p_dev->conf.ConfigBase = 0;
                p_dev->conf.Present = 0;
        }
//// ds.c

//// cistple.c: pccard_read_tuple
int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t code, void *parse)
{
    tuple_t tuple;
    cisdata_t *buf;
    int ret;

    buf = kmalloc(256, GFP_KERNEL);
    if (buf == NULL) {
            dev_printk(KERN_WARNING, &s->dev, "no memory to read tuple\n");
            return -ENOMEM;
    }
    tuple.DesiredTuple = code;
    tuple.Attributes = TUPLE_RETURN_COMMON;                    <<< Here!
    ret = pccard_get_first_tuple(s, function, &tuple);
//// cistple.c

//// cistple.c: get_first_tuple
    if (!(s->state & SOCKET_CARDBUS) && (s->functions > 1) &&
        !(tuple->Attributes & TUPLE_RETURN_COMMON)) {           <<< Here!
        cisdata_t req = tuple->DesiredTuple;
        tuple->DesiredTuple = CISTPL_LONGLINK_MFC;
        if (pccard_get_next_tuple(s, function, tuple) == 0) {
            tuple->DesiredTuple = CISTPL_LINKTARGET;
            if (pccard_get_next_tuple(s, function, tuple) != 0)
                return -ENOSPC;
        } else
            tuple->CISOffset = tuple->TupleLink = 0;

        tuple->DesiredTuple = req;
    }
//// cistple.c

Best Regards
Komuro



More information about the linux-pcmcia mailing list