Commit Graph

78 Commits

Author SHA1 Message Date
thorpej 78ffd948be Replace device_locators() with device_locator(), and use it. 2006-03-29 06:00:46 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
drochner 49126e9efe use XXXCF_NLOCS constants instead of magic numbers 2005-08-26 11:01:42 +00:00
drochner e6a178f21f kill a number of autoconf submatch functions which follow the
standard scheme:
if (<configured> != <wildcard> && <configured> != <real>)
	then fail
else
	ask device match function

This is handled by config_stdsubmatch() now.
2005-08-25 22:33:18 +00:00
drochner fa3cb84d62 replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
2005-08-25 18:35:38 +00:00
christos aef258e0aa PR/30995: Wada Keiji: pcmcia interface can't use ne2000 compatible card
Call pcmcia_socket_settype sooner. I removed the later call, so the submitter
should test the final code before I close the PR.
2005-08-15 18:58:24 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
perry 18db93c7f6 de-__P 2005-02-04 02:10:35 +00:00
drochner 890158d024 Allow to rescan and detach by user request, using the new autoconf
functions.
For later rescans (eg after a driver LKM was loaded) to make sense,
don't consider it an error if no driver was attached on the initial
bus scan.
Someone who understands the enable/disable/powerup/down stuff please
review this.
2004-08-18 12:01:13 +00:00
mycroft 7aa8e97898 Simplify a little. Pass down the card type from pcmcia_function_enable(),
which just gets it from the config entry for the function it's enabling.
Multifunction cards are defined to be of type I/O on every function, so there
is no possibility of accidentally switching.
2004-08-12 19:59:07 +00:00
mycroft 3c4f1ecaa3 If the card is being detached, do not try to write the CCR to disable the
function.
2004-08-12 17:31:06 +00:00
mycroft 438f4e5647 Always write the IOBASE/IOLIMIT registers if they're set in the CCR mask. We
can't really rely on multifunction devices having a CIS that reflects this --
e.g. some cards use a combined Ethernet+modem chip, but only actually serve
one of the functions.  (We have to assume the configuration index reflects the
bits needed to enable the function.)
2004-08-12 17:26:51 +00:00
mycroft 03a381d5d5 Write the configuration option register -- possibly switching the device into
its I/O mode -- as the *last* write to the CCR.
2004-08-12 17:07:52 +00:00
mycroft 8e026e9d56 Don't call socket_settype() to enable I/O interrupts until after we've written
the CCR.
2004-08-12 17:06:49 +00:00
mycroft 1714f4f98a My previous understanding of the I/O base/limit registers was incorrect.
However, so was the old code.  Now it works correctly.  :-)
2004-08-12 16:04:20 +00:00
mycroft 0ed22a5ae1 Output a message if we fail to find anything useful in the CIS, rather than
appearing to do nothing.
2004-08-11 20:57:40 +00:00
mycroft d54277f76c Do not ever set IOIS8. We are not running on an 8088. 2004-08-11 04:35:35 +00:00
mycroft 8f96fc7c75 Always use PCMCIA_WIDTH_AUTO rather than PCMCIA_WIDTH_IO16. This spec is
pretty clear on how this works.
2004-08-11 04:25:28 +00:00
mycroft faaea66252 Fix uninitialized variable warnings (which did not appear on x86). 2004-08-11 00:32:44 +00:00
mycroft a23e15bcbe Rather than having a call up from the low-level driver to get the card type,
instead have a call down from the PCMCIA mid-layer to set it.  Use this from
pcmcia_function_enable().  (Currently the policy is the same, but this would
allow for more flexibility in deciding which mode to use.)

Now it is safe to hold the socket enabled during attach, so do that.  Only
one enable/disable cycle to attach a card now!
2004-08-11 00:18:18 +00:00
mycroft 76ad292990 Move the socket reference counting into pcmcia_socket_{enable,disable}(), and
use that where needed.
2004-08-10 23:34:06 +00:00
mycroft bf4a3f1523 Whoops, look at both the ID numbers and the CIS strings in each pcmcia_product.
It's dumb that drivers depend on this, but...
2004-08-10 19:15:08 +00:00
mycroft 0515828a46 Now that all the silly string printing is gone, move the location where we
print a newline so it doesn't have to be done in every driver.
2004-08-10 18:43:49 +00:00
mycroft adbea3511a Enhance pcmcia_product_lookup():
* Remove the "expected function" value.  This was just causing problems with
  multifunction cards.  Differentiating the functions is better done by
  checking the function type (which we now do in ep and sm).
* Add support for matching CIS strings.  This necessitated changing the calling
  pattern a little too.

Use this enhanced version rather than driver-specific versions that do the
same thing.

Also, remove the last vestiges of PCMCIA_STR_*.
2004-08-10 18:39:08 +00:00
mycroft 70ca4b2fa7 Print diagnostics in only one place if intr_establish() or function_enable()
fails.

Also, be a little more careful about passing up error values, and consistently
clear our interrupt handler pointer.
2004-08-10 15:29:56 +00:00
mycroft 1641421432 Move the location of a printf() I added. 2004-08-10 05:21:59 +00:00
mycroft 2137977a97 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.
2004-08-10 02:50:52 +00:00
mycroft 36c30a2f1a Dispense with all the interrupt multiplexing code here, and assume that the
underlying implementation DTRT.  This has the side effect of causing us to
ignore the INTR and INTRACK bits in the CCR -- but this seems for the best
anyway, since they are not reliably implemented.  (I note that Linux doesn't
bother either.)
2004-08-09 20:02:36 +00:00
mycroft bc7b11e4ff Add newlines to the messages... 2004-08-09 19:33:07 +00:00
mycroft b7a991ceb6 Whoops, nuke an unused variable. 2004-08-09 19:09:06 +00:00
mycroft 65d47754b3 Assume that io_map/unmap and intr_establish/disestablish will not be called
with the function enabled.  If this happens, issue a warning.  (This is only
really important for multifunction cards.)

This allows me to get rid of a bunch of extra code.
2004-08-09 19:08:19 +00:00
mycroft 9092e2c97e Make pcmcia_function_disable() primarily responsible for disabling the CCR
bits.  pcmcia_intr_disestablish() continues to do this as a stopgap.
2004-08-09 18:30:51 +00:00
mycroft deca9207b3 If the function is not enabled, do not attempt to immediately update the CCR.
XXX This is a stopgap until all drivers are converted to do their io_maps and
intr_establishes before function_enable.
2004-08-09 16:59:10 +00:00
mycroft 0e261f0935 Fix a debugging printf(). 2004-08-09 02:10:25 +00:00
mycroft 105470da05 Do not set INTRACK ourselves. 2004-08-09 02:01:16 +00:00
mycroft cafa5cc2d1 Implement the correct (I think) interrupt acknowledgement sequence. 2004-08-09 01:49:26 +00:00
mycroft 00a9c911e6 Multifunction fixes:
* Don't call handlers for functions that are not enabled.
* Always call the handler if the function doesn't support the STATUS register.
While I'm here, divide the CCR numbers by 2.
2004-08-09 01:32:04 +00:00
mycroft 8231a1a314 Copyright maintenance. 2004-08-08 23:19:59 +00:00
mycroft ebed70c6e6 Remove the "offset" and "size" arguments to pcmcia_io_map(). In the singular
case (ne@pcmcia) where we were using these to create a subregion, it is better
handled by calling bus_space_subregion().

Now there is a 1:1 mapping between I/O spaces in the config table and windows
mapped in the function.  Rework the multifunction mapping code to take
advantage of this by using both I/O base addresses if necessary.
2004-08-08 23:17:12 +00:00
mycroft 961619ae0e pcmcia_socket_{enable,disable}() weren't used. Reimplement them as public
functions taking a pcmcia* device structure.

XXX This is a method of last resort for dealing with stupid/insane cards that
we need to probe harder before we can choose a config entry.  It should not be
used by most drivers.
2004-08-08 05:33:04 +00:00
mycroft 632742c13d Put a comma before the last CIS string too. 2004-08-06 20:30:05 +00:00
mycroft 74da882744 More cleanup:
* Print "devinfo" in a canonial place (like we do in the SCSI code).
* Use aprint_{error,normal}() during attach.
* More PCMCIA_STR_* removal.
2004-07-07 06:43:22 +00:00
mycroft 16802a90de Modify the format of pcmcia_devinfo() slightly. 2004-07-07 06:08:25 +00:00
briggs 40823fb6bb Maintain reference count properly for nested enables/disables. 2003-10-22 07:46:48 +00:00
thorpej 72a7af27b0 Use aprint_normal() in cfprint routines. 2003-01-01 00:10:15 +00:00
thorpej b75a007d9f Add trailing ; to CFATTACH_DECL. 2002-10-02 16:51:16 +00:00
thorpej 71adb76f75 Use CFATTACH_DECL(). 2002-09-30 21:57:46 +00:00
thorpej f818766afe Declare all cfattach structures const. 2002-09-27 20:31:45 +00:00
thorpej 6c88de3b53 Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller.  Use it
rather than invoking cfattach->ca_match directly.
2002-09-27 03:17:40 +00:00
thorpej d1ad2ac4f2 Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver.  The cfdriver is then looked
up in a list which is built at run-time.
2002-09-27 02:24:06 +00:00