Subject: pcmcia CIS parsing
To: None <tech-kern@netbsd.org>
From: Christian E. Hopps <chopps@merit.edu>
List: tech-kern
Date: 01/15/2000 14:47:54
First, I don't have the pccard standard, I'm trying to get along with
the description of things in the book ``Inside PC Card'' by Faisal
Haque.

I'm running into a problem with the pcmcia_cis code specifically the
config entry stuff.  Amoung other things it looks to me like its not
handling the `default' bit correctly.

The book I have describes the default bit as saying, the follwing
features now serve as the default.  It doesn't imply that the following
config entry serves as the default.

The code currently assumes that if the default bit is set the config
entry that it is talking about now serves as the default for all feature 
values.

Ok, so can someone out there with the standard give some more detail
here, is the code correct or the book?

Another problem I'm having I'm more sure is a bug. There is an initial
cfe structure in pcmcia_parse_cis_tuple, that serves as the initial
default config entry.  It has a bunch of flags set in it, but is
otherwise in a null state.

When setting the flags based on features present
pcmcia_parse_cis_tuple() doesn't clear the values previously in the cfe
that it might be setting.  Thus as you parse through table entries you
aren't setting your flags to the indicated features but rather the OR of 
the indicated features and the current defaults indicated features.

Also since a new default is initialized with the old default values,
this problem of ORing gets worse.  Each new default entry gets the old
default entry's flag values plus its new flag values.  Thus this new set
of flag values gets imporoperly (?) propogated to all future non-default
entries also.

Would it be correct to change the code sections that set cfe->flags to
first mask the set of bits they operate on?

Thanks,
Chris.