Subject: CVS commit: src/sys/dev/pcmcia
To: None <source-changes@NetBSD.org>
From: Charles M. Hannum <mycroft@netbsd.org>
List: source-changes
Date: 08/10/2004 02:50:52
Module Name:	src
Committed By:	mycroft
Date:		Tue Aug 10 02:50:52 UTC 2004

Modified Files:
	src/sys/dev/pcmcia: pcmcia.c pcmciavar.h

Log Message:
Be robust against child devices failing to handle the socket refcnt properly --
force it to 0 when a card is detached, possibly disabling the socket in the
process.

Add several new functions:
* pcmcia_config_alloc(pf, cfe)
  Tries to allocate all the I/O and memory spaces in a config entry.
* pcmcia_config_free(pf)
  Frees all the I/O and memory spaces for the active configuration.
* pcmcia_config_map(pf)
  Maps all the allocated I/O and memory spaces for the active configuration.
* pcmcia_config_unmap(pf)
  Unmaps all the allocated I/O and memory spaces for the active configuration.

And two higher-level functions:
* pcmcia_function_configure(pf, validator)
  Tries to find a CIS config entry that it can allocate the spaces for.  Each
  entry is verified by calling the "validator" function -- which can also do
  card- and driver-specific fixups.  If successful, the regions are all mapped.
* pcmcia_function_unconfigure(pf)
  Equivalent to calling both pcmcia_config_unmap() and pcmcia_config_free().

Most drivers are expected to use the latter two functions, which will greatly
reduce the amount of crufty code.


To generate a diff of this commit:
cvs rdiff -r1.52 -r1.53 src/sys/dev/pcmcia/pcmcia.c
cvs rdiff -r1.22 -r1.23 src/sys/dev/pcmcia/pcmciavar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.