History log of /freebsd-9.3-release/sys/dev/pccard/pccardvar.h
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)


# 215034 09-Nov-2010 brucec

Fix typos.

PR: bin/148894
Submitted by: olgeni


# 189318 03-Mar-2009 imp

Add in parsing of the disk FUNCE tuples.


# 186795 05-Jan-2009 imp

Define bits for memory mapping house keeping by bridges.


# 181342 06-Aug-2008 imp

Unify the initial card probe/attach procedure with the kldload
procedure. There were some subtle differences before that could lead
to a variety of bugs, including resources being lost (in one case
forever). pccard_probe_and_attach_card does this now, and includes
comments about what's going on and why, since it isn't obvious from
the code. Please let me know if I've missed anything...

Provide a new function called pccard_select_cfe that allows drivers to
select which configuration entry to use. This is needed for some
older pre-MFC standard cards with many functions that want to activate
all their functions by selecting alternative entries, or to work
around broken ones. pccard_select_cfe will migrate into the
pccard_if.m interface as its interface stabilizes to keep all the
pccard drivers from referencing any symbols in the pccard.ko module
directly.

Fix a printf to refer to the right function name.


# 150532 24-Sep-2005 imp

Fix comment


# 150468 22-Sep-2005 imp

Remove compat layer for OLDCARD compatibility. All instances of it
are now gone from the tree.


# 150371 20-Sep-2005 glebius

Fix build.


# 150362 20-Sep-2005 imp

Implement /dev/pccardN.cis. This mirrors the CIS for the card to userland.

pccardc dumpcis /dev/pccardN.cis will work now, but I may rewrite pccardc.

Also, move more of the private data to a new file called pccardvarp.h.


# 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.


# 150097 13-Sep-2005 imp

Define and use PCCARD_MEM_PAGE_SIZE.


# 150095 13-Sep-2005 imp

MFp4: Remove stale functions.


# 147963 13-Jul-2005 imp

o Check to make sure the card has a function (panic if not) in read_ivar.
o Use pf more consistantly for pccard_function.
o Make sure we quote the strings properly (maybe this function belongs in
subr_bus.c)
o Tweak a comment to be more accurate after code changed.


# 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)


# 147580 24-Jun-2005 imp

Eliminate unused argument in PCMCIA_CARD macro.

Provide a backwards compatible way to have the extra macro by defining
PCCARD_API_LEVEL 5 before including pccarddevs for driver writers that
want/need to have the same driver on 5 and 6 with pccard attachments.

Approved by: re (dwhite)


# 144955 12-Apr-2005 imp

Big cleanup of resource code for pccard. Once coventry noticed
problems here, it became clear we were being too complex.

o Don't keep track of resources in two places
o Use resource_list_purge instead of rolling our own
o Just reassign the ownership of the resource, rather than freeing it
and reallocating it.
o Fix compile problems when sizeof(u_long) != sizeof(int)


# 144930 12-Apr-2005 imp

Cleanup of resource allocation code after having my attention focused on
this code:
o rid is stored in the resource, so don't bother keeping track of it here.
o Implement memory space
o Don't try to activate 'memory card' CFEs. This is type memory, as opposed
to the memory resource.


# 139749 05-Jan-2005 imp

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


# 129799 28-May-2004 imp

Don't nest includes here. There's no need and the subset included is lame.

Submitted by: bde


# 121905 02-Nov-2003 imp

MFp4:
o Fix MFC cards. We were bogusly setting CCR_IOBASE[01] and CCR_IOLIMIT.
now when we activate the resource, we adjust these for MFC cards, per the
spec.
o Change type of pf_mfc_* to be bus_addr_t, which is more correct than
long.

This makes my 3C362D/3C363D and 3CXEM556 cards work! Woo Hoo!


# 121521 25-Oct-2003 imp

Const poison string accessor functions.


# 120849 06-Oct-2003 imp

refactor how we do the quirk matching. this puts an ugly if into a
routine of its own, and allows us to move the indentation back two
layers making the code more readable.

delete a prototype that should have been killed years ago in pccardvar.h.

# adding quirks here is way harder than it needs to be. :-(


# 120289 20-Sep-2003 imp

Remove unused #defines.


# 119545 28-Aug-2003 imp

Remove unneeded field after CIS changes.


# 113945 23-Apr-2003 imp

Add accessor for cis4 string. Neither OLDCARD nor NEWCARD support
this yet, but that will change soon.

Pr: 51333
Submited by: Scott Mitchell


# 113323 10-Apr-2003 imp

Remove strings by default from PCMCIA_CARD expansion. Add _DESC version
for adding them back. This saves about 2.5k of code space.


# 113322 10-Apr-2003 imp

Remove bogus line and entry, restore cnet ne2000 add smc 8041


# 113308 09-Apr-2003 imp

1.37 was committed prematurely: back out until I can commit all parts at the
same time.


# 113307 09-Apr-2003 imp

1.77 was bogus: there is no logic bug. Back it out and compare the
correct fields instead.


# 113257 08-Apr-2003 imp

Create new _ND versions to allow one to not specify the description be
stored in the table.


# 113241 08-Apr-2003 imp

u_int*_t -> uint*_t
-1 -> 0xffffffff


# 106898 14-Nov-2002 imp

MFp4:
o Use 32-bit unsigned types for things that really are 32-bit quantities,
not bus_addr_t. These are not the same as a bus_addr_t, so don't use
that here. Harmless on i386, introduced problems on sparc64.

Submitted by: jhb


# 100218 17-Jul-2002 imp

Eliminate the need for pccard_common.c by moving the function inline
in the .h file. Make it static __inline to make sure that it doesn't
wind up defined in any files.

Also, fix a typo that said null_do_attach instead of null_do_probe.


# 97613 30-May-2002 takawata

Make oldcard and newcard kernel module work.


# 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


# 89959 29-Jan-2002 imp

Move cardaddr to memory structure.

Forgotten by: imp
Reminded by: Dave Cornejo


# 86385 15-Nov-2001 imp

Hoist the Card/Card2 macros that I invented for the wi driver into
pccard layer and rename them PCMCIA_CARD and PCMCIA_CARD2 respectively
(note, this is being done with an eye towards NetBSD integreation so
it is easier to keep lists of cards between us and them in sync).

Use this in the an and wi drivers.


# 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


# 82378 26-Aug-2001 jon

Part two of this NEWCARD update:

Briefly, the significant changes include:
* Way better resource management in pccbb, pccard and cardbus.
* pccard hot-removal now appears to work.
* support pre-fetchable memory in cardbus.
* update cardbus to support new pci bus interface functions.
* Fix CIS reading to no longer use rman_get_virtual().

What's not there, but in the works:
* pccard needs to do interrupt properly and not read the ISR on single
function cards.
* real resource management for pccard
* a complete implementation of CIS parsing
* need to look into how to correctly use mutex in pccbb


# 76387 08-May-2001 dmlb

Add additional enumeration types for CARD_SET_RES_FLAGS.

Approved by: imp
MFC: after 1 week


# 75761 21-Apr-2001 imp

Add accessor/ivar for the "function". This is so we can generically
match disks and serial ports and maybe others.


# 74636 22-Mar-2001 imp

First step towards making loadable modules independent of having
pccard in the kernel for those drivers with pccard attachments. This
makes the compat layer a little larger by introducing some inlines,
but should almost make it possible to have independent attachments.
The pccard_match function are the only one left, which I will take
care of shortly.


# 71322 21-Jan-2001 imp

Convert the vendor/product cis strings to an array of CIS entries. This
allows us to use the PCCARD_CIS #defines generated to distinguish cards
that don't have a Manufacturer and OEM.


# 70715 06-Jan-2001 jon

* Better kld support in pccbb/cardbus
- pccbb no longer needs to remember whether a card is inserted.
- pccbb reissues insertion on load of cardbus/pccard modules.
- got rid of unnecessary delays in power functions.
- Cardbus children are no longer deleted if probe/attach fails.
- non-attached child devices are reprobed at driver_added.

* CARD interface to read CIS
- added card_cis_read/card_cis_free interface to read arbitrary CIS
data. This currently is only implemented in cardbus.

* pccard begins to work
- pccard can now use higher memory space (and uses it by default).
- set_memory_offset interface changed.
- fixed ccr access, which was broken at multiple locations.
- implement an interrupt handler - pccard can now share interrupts.
- resource alloc/release/activate/deactivate functions gutted: some
resources are allocated by the bridge before the child device is
probed or attached. Thus the resource "belongs" to the bridge, and
the pccard_*_resource functions need to fudge the owner/rid.
- changed some error conditions to panics to speed debugging.

* Mutex fix - Giant is entered at the beginning of thread


# 67187 16-Oct-2000 imp

First cut at allocating the resources from the CIS after the probe, but
before the attach. Things aren't completely working, but this is a good
checkpoint.

Also, initialize the dev member of the function as soon as we add it
to the parent.


# 67167 15-Oct-2000 imp

Lots of little fixes. We no longer panic on card insert:
o initialize ivars with bzero.
o remove interrupt function pointer. netbsd needs it, but we don't.
o add lots of comments about bogus things that I've been kludging to try
to make the simple cases work.
o add new ivar accessor for cis4 to match cis3. likely neither will be
needed, but it doesn't hurt to have it.


# 66847 09-Oct-2000 imp

o Record the pccard_function in the ivar.
o Use a macro function to get the ivar for the child rather than the casting
directly. This should be a little safer and easier to read.


# 66200 21-Sep-2000 imp

o Merge in changes to the NetBSD sources:
pcmciavar.h 1.9->1.12
1.12, enami, minor coding nits
1.11, augustss, (pcmcia_devinfo NRFB)
1.10, cgd, add generic lookup routines
pcmcia.c 1.14->1.23
1.23, drochner, (probe code printing, NRFB)
1.22, augustss, KNF
1.21, uch, (hpcmips tweaks NRFB)
1.20, chopps, remove bogus debug
1.19, enami, minor coding nits
1.18, augustss, (pcmcia_devinfo NRFB)
1.17, nathanw, LP64 printf fixes
1.16, cgd, add generic lookup routines
1.15, aymeric, printf fixes
NRFB == not relevant to freebsd
o Expand the pccard matching routines to include the ability to match
against the CIS strings since our current driver database is based on
that.
o Add lots more ivars to get the information necessary to snag these values.


# 66058 19-Sep-2000 imp

Implement indirection in the pccard probe/attach. This should make it
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.

Compatibility methods for OLDCARD drivers. We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects. For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines. For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.

compat devices should use the following:

/* Device interface */
DEVMETHOD(device_probe), pccard_compat_probe),
DEVMETHOD(device_attach), pccard_compat_attach),
/* Card interface */
DEVMETHOD(card_compat_match, foo_match), /* newly written */
DEVMETHOD(card_compat_probe, foo_probe), /* old probe */
DEVMETHOD(card_compat_attach, foo_attach), /* old attach */

This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.

Drivers wishing to not retain OLDCARD compatibility needn't do this.

ep driver minorly updated.

sn driver updated more than minorly. Add module dependencies to allow
module to load. Also change name to if_sn. Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.


# 65917 16-Sep-2000 imp

Change the interface to pccard_function_init. The interface is such
that it looks for an acceptible one. Once it finds it, it should set
the resources for the device. I say "should" because I've not written
that. Also set an ivar for the child of pccard. Minor fix to the
attach message printed, we lose the slot number, which I'll have to
restore later. Adjust the pccard ivar so that we can save the
function that corresponds to this driver so we can enable and disable
it more easily. Save a pointer to the function so we know what we're
dealing with.

There should be some way for the driver to specify which cfg it wants
to activate. For now the pccard_function_init function just picks
one, but we'll have to revisit this going forward. I'm not doing it
now because I'd need some way to activate the card many times and I'm
not sure that is desirable or even safe with some cards.


# 64927 22-Aug-2000 imp

Save a pointer to the dev, if any, that each function attach.
Remove some bogus printfs.


# 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.


# 60938 26-May-2000 jake

Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by: msmith and others


# 60833 23-May-2000 jake

Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by: phk
Reviewed by: phk
Approved by: mdodd


# 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.


# 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.


# 56361 21-Jan-2000 hosokawa

Propagate MAC address in CIS tupple to dev/ed/ driver.
Many ed-based Ethernet PC-cards can't get correct MAC address without
this patch.

Submitted by: Takanori Watanabe <takawata@shidahara1.planet.sci.kobe-u.ac.jp>
Reviewed by: Warner Losh <imp@village.org>


# 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


# 55500 06-Jan-2000 imp

Checkpoint of today's changes. We now get to the point where the pccard
layer is trying to access the now unexistant chip functions.
o Added DEVPRINTF which is like DPRINTF only calls device_printf.
o Made it possible to define PCICDEBUG
o Remove ph_parent and use the softc pointer sc instead in pcic_handle.
o Remove all references to dv_xname
o Add some debug messages.
o enable MI attach/detach calling for pccard.
o convert pcic_chip_socket_{en,dis}able to pcic_{dis,en}able_socket
and connect them to the power_{enable,disbale}_socket.
o Remove pccard pointer from pcic_softc.
o GC some unused pccard functions.
o Convert pccard_chip_socket* to POWER_ENABLE_SOCKET
o kill pccard_attach_args.
o power_if.m updates. More to come.


# 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.


# 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