History log of /freebsd-9.3-release/sys/dev/pccard/pccard_cis.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 267654 19-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 225736 22-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


# 189682 11-Mar-2009 imp

Allow zero length memroy space descriptor sections. It is apparently
legal in the spec. Add newline to the verbose messages we print when
debugging when this happens. The Hitachi HT-4840-11 is the only card
to hit these in years, and it works well enough if we're liberal about
what we accept.


# 188219 06-Feb-2009 imp

Store the entire funce for disk type functions (eg CF cards and the
like).


# 188212 05-Feb-2009 wkoszek

Bring consistent debugging output for all values that are supposed
to be printed in a hexadecimal format. Otherwise, '270' doesn't say
much.

Reviewed by: imp


# 182229 27-Aug-2008 imp

Some PC Cards don't have the proper IRQ mask in them. The standard
says that in such cases we can pick any interrupt. One of these cards
is the LG11 Wireless LAN card. I don't have one of these, but I do
know that this doesn't hurt any cards I've tried it with.

PR: 92070
Submitted by: Helge Oldach
MFC after: 3 days


# 179483 01-Jun-2008 imp

Slight simplification of the power parsing code, as well as using
autoincrement in some places where it makes sense. This makes this .o
about 180 bytes smaller on x86 and amd64 with no apparent functional
changes.


# 167086 27-Feb-2007 jhb

Use pause() rather than tsleep() on stack variables and function pointers.


# 161108 08-Aug-2006 imp

Thomas Wintergerst reports that when this tsleep went away, certain
cards stopped working. Specifically the AVM B1 PCMCIA Card no longer
detected. Its CIS chain read back as all FF's. Putting the delay
back solves those problems. I've opted to put in a much shorter delay
because as far as I can tell, no delay is really needed here. We'll
see how well this works in practice.


# 150361 20-Sep-2005 imp

Call the passed function on cis scanning for all nodes in the CIS
chains, not just the 'real' ones.


# 150098 13-Sep-2005 imp

Add a few new functions interfaces to allow reading/writing attribute
memory, the CCR and a tweak to cis_scan.


# 148107 17-Jul-2005 imp

I believe that this tsleep was placed here in 1.28 to try to solve the
problems we were having properly mapping the CIS attr space on some
cards. Those problems have been solved other ways, so this kludge is
no longer necessary. Remove it and have pccards come up a whole
second faster.


# 147962 13-Jul-2005 imp

The supposed OLD STYLE network MAC id tuple was really just a buggy
expression in the card in question. Since that driver uses a
different mechanism, retire the workaround for this bug.


# 147729 01-Jul-2005 imp

Upon relection, we shouldn't allow the tuple structs to be modified by
the functor, so make it a const pointer, and chase down the resulting
const-poisoning.

Approved by: re (scottl)


# 147711 01-Jul-2005 imp

Add a much-requested feature: The ability for pccard attachments to
scan the CIS for interesting tuples. 95% of what can be obtained from
the CIS is harvested by the pccard layer and presented to the user in
standard function calls. However, there are special needs at times
where the standard stuff doesn't suffice. This is for those special
cases.

CARD_SCAN_CIS(device_get_parent(dev), function, argp)
scans the CIS of the card, passing each tuple to function with
the tuple and argp as its arguments. Returning 0 continues the scan,
while returning 1 terminates the scan. The value of the last
invocation of function is returned from this function.

int (*pccard_scan_t)(struct pccard_tuple *tuple, void *argp)
function called for each tuple. Elements of the CIS tuple can be
read with pccard_tuple_read_{1,2,3,4,n}(). You are reading
the actual tuple memory each time, in case your card has
registers in the CIS.

# I suppose these things should be documented in pccard(4) or something like
# that.

# I plan on unifying cardbus CIS support in a similar way.

Approved by: re (scottl)


# 144159 26-Mar-2005 sam

deal with malloc failure

Noticed by: Coverity Prevent analysis tool


# 142027 17-Feb-2005 imp

memspace is set to some value by masking off bits. When these bits
are equal to PCCARD_TPCE_FS_MEMSPACE_NONE, memspace will be zero, so
testing for this case inside of the if statement results in dead code.
We'd fail to set a value to zero that's already zero (since it is
initialized to 0 indirectly) with this code being there. Well, except
in the very rare case that we have a card that has a defualt entry
that includes a memory space followed by one that has no memory space
(these are extremely rare, I don't recall ever having seen one :-).

Fix this by setting num_memspace to 0 in a more appropriate place.

Submitted by: Coverity Prevent analysis tool


# 140542 21-Jan-2005 imp

Some older PC Cards have a weird format for FUNCE tuples. They appear
as type 0, rather than the usualy type 4. Assume that this format is
from an old standard and go with it. The Fujitsu FMV-186A and Silicom
Ethernet cards I have both have tuples with this format, and they are
both pretty old cards.

# if somebody knows for sure, please let me know.


# 139749 05-Jan-2005 imp

Start each of the license/copyright comments with /*-, minor shuffle of lines


# 128169 12-Apr-2004 imp

Improve reading of CIS cards:

(1) Align to 64k for the CIS. Some cards don't like it when we aren't
aligned to a 64k boundary. I can't find anything in the standard
that requires this, but I have 1/2 dozen cards that won't work at
all unless I enable this.
(2) Sleep 1s before scanning the CIS. This may be a nop, but has little
harm.
(3) The CIS can be up to 4k in some weird, odd-ball edge cases. Since we
have limiters for when that's not the case, it does no harm to increase
it to 4k.

#1 was submitted, in a different form, by Carlos Velasco.


# 120868 07-Oct-2003 imp

o move the cis tuple definitions into a common file.
o minor optimization of cardbus_cis processing. Remove a bunch of generic
entries that are handled by generic.
o no longer need the card_get_type stuff.


# 119161 20-Aug-2003 imp

When debugging CIS, only print 10 CISTPL_NULLs. Chances are good they
are all bogus, and the cards that don't decode things quite right
often have hundreds of them. This will fix starvation of small dmesg
buffers and allow better debugging to happen. I thought about adding
an override, but there is such a thing as too many knobs. :-)


# 119060 18-Aug-2003 imp

Put a band-aide(tm) on the CIS panic problem. This is a similar fix
to what is in NetBSD. I have a few cards that tickles this bug, and
this just keeps us from panicing. It doesn't actually fix the problem
(that will happen once I figure out why some cards hate the address
their CIS is mapped to high memory).


# 112358 18-Mar-2003 imp

Tag longling_addr as maybe using a bad type, I'm not sure.


# 106914 14-Nov-2002 mux

Fix printf() format errors.

Reviewed by: imp


# 104640 07-Oct-2002 imp

Merge changes from NetBSD through version 1.17 of this file. These
give us slightly better error checking than before and interpret what
default bits mean better. See the NetBSD CVS tree for the authors of
these changes (revs 1.10 .. 1.17).


# 104604 07-Oct-2002 imp

Better comment for the product ID thing.


# 93370 29-Mar-2002 imp

Improve support of MFC cards (Multi-function cards). This commit
allows us to properly parse cards with attribute memory based CIS that
before wouldn't parse correctly, sometimes with a panic. This allows
me to get my 3C562 modem/ethernet card to fail to attach due to
problems in the ep and sio drivers rather than due to problems in the
CIS parsing code :-).

We weren't setting the address to jump to for the function entries.
This caused us to only work when the addional entries were after the
first ones. On the 3C562/3C563 card this was not the case.

We were also mapping Attribute memory when common memory was asked for
in the target of the LONGLINK_{A,C} or LONGLINK_MFC.

My IBM Home And Away Modem/LAN card still fails for reasons unknown.


# 91786 07-Mar-2002 imp

Make hw.pccard.debug and hw.pccard.cis_debug tunable/sysctl. Setting to 1
will enable more verbose debugging output from the pccard system.


# 90964 20-Feb-2002 shiba

Add u_int16 prodext value in CISTPL_MANF_ID. This gets a fifth byte
when manufacturer id tuple length is 5. This change is for xe driver.
This is a dirty hack. But there is no better idea.

Reviewd by: imp


# 90896 19-Feb-2002 imp

Do the cast away of unsignedness in a way that is more commprehensible.


# 90187 04-Feb-2002 imp

Default debugging to OFF now.


# 87352 04-Dec-2001 imp

implement MFC links properly (and I think long links too). This make
the sprint wireless card try to attach. Sadly, the pci code at the
bridge keeps this from happening.

Bug w/o PR: jhb :-)


# 86272 11-Nov-2001 imp

Sync to 1.16 pccarddevs to get new PCMCIA_ symbols


# 82781 02-Sep-2001 shiba

Update cis tuple parser, add a pccarddevs entry,
and improve PCCARD_IVAR_ETHADDR in pccard_read_ivar().

Change points:

(1) Read Function Ext tuple.
(2) Add Ratoc REX-R280 entry(fe driver).
(3) Take ether address from function ext tuple.

Reviewed by: imp
Obtained from: NetBSD


# 67897 29-Oct-2000 dwmalone

Make a few more mallocs use M_ZERO.

Submitted by: josh@zipperup.org
Submitted by: Robert Drehmel <robd@gmx.net>
Approved by: imp


# 64850 19-Aug-2000 imp

o Move to using PCCARD_SOFTC(dev)
o fill in the size of the actual softc, rather than 1 in data structure
o minor debugging improvements.


# 61788 18-Jun-2000 imp

Matching commits to pccard for last pcic changes. We now at least to
probe/attach. This is a checkpoint.


# 59389 19-Apr-2000 imp

OK. Next step: we read in CIS.

I've done this by having requests to allocate memory propigate up the
tree. We'll see how well this works and reevaluate if it isn't
working well. Also initialize ptr in the tuple. As well as minor
reorg of memory allocation. Likely need to do similar things for I/O
when the time comes.

I've move all defines from pccardchip.h into pccardvar.h and
eliminated pccardchip.h.


# 59193 13-Apr-2000 imp

checkpoint latest pccard/pcic hacking:

o Eliminate cross calls between the devices. Instead move to using the
newbus messaging system. Added three new card calls: attach_card,
detach_card, get_type.
o Eliminate interrupt routine in pccard we never use.
o Move from deactivate to detach for removing cards.
o Start mapping CIS memory, but it is broken and causes panics. At least
it is closer to working than before.
o Eliminate struct device everywhere. It was bogus.
o Initialize softc for pccard device so we have valid pointers to
ourselves.
o Implement routine to find the pcic ivar for a child device of the pccard so
we can use it to talk to the pcic hardware.
o Lots of minor tiding up.

This version now panics when we try to read the CIS. The next batch
of work to make this work is what was outlined in my posting to mobile
about resource allocation and such.


# 58997 04-Apr-2000 imp

Fix pcic_detach_socket to get right pcic_handle.
Pass sc->dev rather than a bogusly cast pccard_softc *sc.

This allows us to insert and remove cards w/o panicing the kernel.
However, the cis isn't mapped in, so the pccard_scan_cis function
fails.


# 58581 26-Mar-2000 imp

Minor changes to some of the interfaces.
Remove RF_PCCARD_ATTR in anticipation of removing it from sys/rman.h
Add interface for setting "attributes" of pccard/cardbus devices.
Minor formatting nits.


# 55720 10-Jan-2000 imp

Eliminate pccard_chip_* tonight.
o ifdef out pccardchip.h (almost all of it, there are dangling bits
o Add rid/res members to pccard_function
o remove pct/pch from pccard_softc
o map memory properly in scan_cis (almost, see XXX for more work)
o manage ccr.
o remove bogus comment I added about touching the ccr being a layering
violation for pccard. It is properly done at that level.
o More function prototyping


# 54250 07-Dec-1999 imp

Tonight's cleanups.
o Implement memory and I/O activation/deactivation. irq not handled.
o switch pcic_chip functions around to use more convenient types.
o kill __P and most of the old K&R prototypes just to be mean.
o minor other nits


# 53873 29-Nov-1999 imp

Flesh out the pccard bus_ methods with either the generic one (where
it would work), or a specialized one. Most of these have been
creatively stolen from pccard_nkb, which in turn stole from isa
showing that generic bus_ versions of bus_{set,get,delete}_resource
might be profitable.

Fix a couple of minor bugs introduced in the last round of updates
from NetBSD.

Start on the pccard_ivar structure which will hold the resources and
slot number.

Add tcic as a possible attachment for pccard and rename the attachment
for pcicx to pcic since the name has changed since I originally wrote
this stuff.

Next up:
stringing together the various memory and I/O
allocation/mapping primitives in i82365.c, final touches on the isa
attach routine and other fun stuff in that line of attach.


# 53813 28-Nov-1999 imp

Update pccard code to latest NetBSD code. This is the last merge
before newbusification hits full steam ahead.

All:
Adjust NetBSD labels to reflect new base versions.
dev/pcic/i82365.c:
1.24 Interface change for kernel threads
1.25 Massive unification for cardbus
dev/pcic/i82365var.h
1.8 Massive unification for cardbus
dev/pcic/i82365_isasubr.c
1.3 Massive unification for cardbus
dev/pccard/pccard_cis.c
1.11 Massive unification for cardbus
(better device printing, better memspace calcs)
dev/pccard/pccard_cis_quirks.c
1.4,1.5 Lotsa 3com devices
dev/pccard/pccardchip.h
1.4 Massive unification for cardbus
dev/pccard/pccarddevs
1.33..1.59 Lots of devices


# 52506 26-Oct-1999 imp

Moderately hacked pccard code from newconfig. It is somewhat in
incomplete and likely has problem. The code was originally pcmcia,
but I renamed it to pccard and made it compile on FreeBSD -current. I
converted SIMPLEQ to STAILQ as well as a few sc->dev.xname ->
device_printf changes. This is a green port of fairly mature code.

I derived this work from the FreeBSD newconfig project
(http://www.jp.freebsd.org/newconfig). Any problems with it are
likely introduced by me.

Obtained from: newconfig project