Commit Graph

17881 Commits

Author SHA1 Message Date
drochner
b2f07722fc make the "selective probing" work, and minor cleanup
(avoid using the macros which hide cfdata members, this doesn't help
for anything)
2004-08-23 16:41:48 +00:00
lukem
34a603de29 Add ipw(4) 2004-08-23 12:03:25 +00:00
lukem
6d906be913 NetBSD RCSID 2004-08-23 11:57:35 +00:00
lukem
a91684ce5d ipw(4) - Intel PRO/Wireless 2100 driver.
Written by Damien Bergamini, from http://damien.bergamini.free.fr/ipw/
2004-08-23 11:42:02 +00:00
he
764115cc85 Put an #ifdef _KERNEL around inline functions using panic().
Fixes compile problem for the atactl program for the vax target.
2004-08-23 10:08:48 +00:00
thorpej
1efb3da0fb Make use of static. 2004-08-23 06:16:06 +00:00
thorpej
8aa1e65090 De-__P 2004-08-23 06:05:30 +00:00
thorpej
41e5f04cfd - Use ANSI function decls and make use of static. 2004-08-23 06:03:19 +00:00
thorpej
3e1286d67c - Use ANSI function decls.
- Sprinkle some static around.
- Sprinkle some const around.
2004-08-23 05:50:02 +00:00
thorpej
1a4f23700c Sprinkle static in a few places. 2004-08-23 05:39:46 +00:00
thorpej
4152bad13d Remove a comment that doesn't really make sense. 2004-08-23 05:38:15 +00:00
thorpej
a1bb10ef89 Use static in a few more places. 2004-08-23 05:37:42 +00:00
thorpej
878ac57b19 Protect against multiple inclusion. 2004-08-23 04:45:18 +00:00
thorpej
b8d3850087 Use ANSI function decls and more use of static. 2004-08-23 04:38:42 +00:00
thorpej
c5ed5cafd4 Protect against multiple inclusion. 2004-08-23 04:30:28 +00:00
thorpej
d0fcfb4c3a Use ANSI function decls and make use of static. 2004-08-21 23:48:33 +00:00
thorpej
d17a849385 Use ANSI function decls and make use of static. 2004-08-21 22:48:18 +00:00
thorpej
383b485d9a Make the product table static. 2004-08-21 22:23:13 +00:00
thorpej
83a43d11ff Use ANSI function decls and make use of static. 2004-08-21 22:16:07 +00:00
thorpej
4deb00f885 Use ANSI function decls and make use of static. 2004-08-21 22:02:31 +00:00
nisimura
2ded7c9cd6 Redo the previous adjustment work. 2004-08-21 21:46:54 +00:00
nisimura
e86b49fe3c Remove fluctuation of written name in alphabetical representation of
copyright holder.
2004-08-21 21:44:07 +00:00
thorpej
f6b6634f46 Oops, missed one in last. 2004-08-21 21:30:58 +00:00
thorpej
cb3eb355e7 Const poison scsipi_dtype(). 2004-08-21 21:30:29 +00:00
thorpej
be6339d21a Use ANSI function decls and make use of static. 2004-08-21 21:29:39 +00:00
thorpej
3a4c3c0872 - De-__P.
- Use ANSI function decls.
2004-08-21 20:40:36 +00:00
thorpej
7994917f9b De-__P. 2004-08-21 17:41:18 +00:00
thorpej
6cb9b7482f Use ANSI function decls and make use of static. 2004-08-21 17:40:25 +00:00
thorpej
09662eaa73 Register description for SATA port multipliers. 2004-08-21 02:25:26 +00:00
thorpej
5373bdd103 - Move to48() to atareg.h and rename it atacmd_to48().
- Add an atacmd_tosataq() that converts a 32-bit command to a Native
  SATA Queued command.
2004-08-21 02:17:07 +00:00
thorpej
218dbb60a6 Make some functions referenced only in wdc.c private to that file. 2004-08-21 01:51:46 +00:00
thorpej
8eaae3f96b Eliminate some gratuitous spl frobbing in atabus_thread(). 2004-08-21 00:48:32 +00:00
thorpej
335b799580 atastart() (called only at splbio(), and from interrupts) can change
drive_flags, to make sure all drive_flags manipulations are done at
splbio().
2004-08-21 00:28:34 +00:00
thorpej
2aaf643e25 - atabus_detach(): Manipulate ch_flags at splbio().
- ata_reset_channel(): Assert that we're at splbio() when called.
- Sprinkle some comments about functions that must be called at splbio().
2004-08-20 23:50:13 +00:00
thorpej
4af8216045 WDC_DIAGNOSTIC -> ATA_DEBUG 2004-08-20 23:36:52 +00:00
thorpej
e975b9caee - Add an (*ata_reset_channel)() member to ata_bustype.
- Add an ata_reset_channel() function that performs the common parts
  of resetting an ATA channel, which uses the (*ata_reset_channel)()
  callback to do the heavy lifting.  Adjust callers to use ata_reset_channel()
  instead of wdc_reset_channel().

This removes the last wdc-specific code from ata.c!
2004-08-20 23:26:53 +00:00
thorpej
bd165f8e47 Use ANSI function decls for atabus open/close/ioctl. 2004-08-20 22:26:23 +00:00
thorpej
c5adb42199 wdcreg.h is not needed here any more. 2004-08-20 22:19:00 +00:00
thorpej
56e2a255b5 Move common parts of attaching an ata_channel to a new ata_channel_attach()
function.
2004-08-20 22:17:06 +00:00
thorpej
3234a02f48 Move atabusconfig() to ata.c. 2004-08-20 22:02:40 +00:00
thorpej
51c34ebedf In ata_get_params(), use the (*ata_exec_command)() available from the
ata_bustype rather than using wdc_exec_command() directly.
2004-08-20 20:53:20 +00:00
thorpej
2606542c7b - Add an atac_bustype_ata member to atac_softc to hold a pointer to
the ata_bustype for the controller.  Fill it in and use it instead
  of referencing wdc_ata_bustype directly.
- Add an atac_atapibus_attach member to atac_softc to hold a pointer
  to the function that attaches the ATAPI bus for the controller.  Fill
  it in and use it instead of referencing wdc_atapibus_attach directly.
2004-08-20 20:52:31 +00:00
thorpej
ce56a7e194 Also set the AT_XFDONE bit as appropriate. 2004-08-20 17:37:16 +00:00
thorpej
709a2d87fc Rename the ata_bustype "ata_reset_channel" member to "ata_reset_drive"
to reflect the new reality after Manuel added the bus reset ioctls.
2004-08-20 17:19:44 +00:00
yamt
a92a80cf63 for offloc, use MII_OFFSET_ANY rather than abusing MII_PHY_ANY. 2004-08-20 15:21:24 +00:00
kent
2edd85fb18 Check power states after codec reset. This change fixes a
resume problem on some boards.
Patch provided by Joachim Thiemann in PR kern/26457
2004-08-20 14:36:13 +00:00
thorpej
9cc521a148 Move most of wdc_softc into a new atac_softc structure that contains
info common to all types of ATA controllers.
2004-08-20 06:39:37 +00:00
thorpej
2926431abf Use ANSI function decls and "static". 2004-08-19 23:30:09 +00:00
thorpej
1600c8b8cd - Add and use a CHAN_TO_WDC() macro to get the wdc_softc from an
ata_channel.
- Add and use a CHAN_TO_WDC_REGS() macro to get the wdc_regs from an
  ata_channel.
- Add and use a CHAN_TO_PCIIDE() macro to get the pciide_softc from an
  ata_channel.
- Add and use a CHAN_TO_PCHAN() macro to get the pciide_channel from an
  ata_channel.  (This one just hides a cast, and is really just for
  consistency with the others.)
2004-08-19 23:25:35 +00:00
thorpej
65193a3b71 Protect against multiple inclusion. 2004-08-19 17:56:57 +00:00
drochner
f2e99ab844 support rescan / manual detach
This code needs cleanup, at least a reasonable linked list
implementation (fixed a bug in detach_card() in the process which
left a dangling pointer around).
Also removed a questionable and undocumented use of the parent's
device unit number as locator value.
(As with the pcmcia code: someone please review wrt powerup/down etc.)
2004-08-19 14:50:52 +00:00
dyoung
c9108ddfc8 Hubert Feyrer points out that hw.ath.countrycode really ought to
be writeable.  Make hw.ath.outdoor writeable while I am here.
2004-08-18 21:59:39 +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
drochner
a758a2aba6 allow to detach child devices and (optional selectively) bus rescans,
using the new autoconf functions
2004-08-18 11:54:47 +00:00
drochner
6ea832578d Use the new autoconf functions to rescan busses and detach devices
on user request.
This duplicates the functionality provided by a private ioctl
interface (accessible through scsictl(8)), but in a more generic way.
2004-08-18 11:50:59 +00:00
drochner
c67a72f6ff make PCI devices attachable/detachable (as far as the particular drivers
allow), and allow to rescan a bus selectively (ie only the device/
function I'm looking at)
2004-08-17 23:20:10 +00:00
enami
31c5dbae84 Dereference ch_wdc after filled. 2004-08-16 22:11:13 +00:00
mrg
2db238d57d fix a wrong variable name in a debug message. 2004-08-16 16:43:29 +00:00
mycroft
5111abd827 Simplify some manipulation of PCIC_INTR.
Further attempt to mitigate "bad Vcc" errors.
2004-08-16 15:46:37 +00:00
mycroft
f0b8d692af Some tweaks, per the PC Card spec:
* Assert RESET before powering off a socket.
* Turn on the output enable bit earlier so the interface actually drives CEn
  and RESET.
* Tighten up the power-on timing a bit.
* Mention the specific timing values named in the spec.

For pccbb, be careful to always power off before zeroing PWRCTL.
2004-08-16 15:40:35 +00:00
mycroft
4ff9d12ea9 Do not attempt to fiddle with the power-control bits in PWRCTL; just read them
back after touching the PCI registers.

This shouldn't be necessary, but somehow the controller detects the need for
VPP2=12V and automatically applies it, and gives us a "bad Vcc" error if we
turn it off accidentally.
2004-08-16 14:48:56 +00:00
mycroft
48de8a7bff wdc_init_shadow_regs() must now be called after ch_wdc is filled in, or we get
a null pointer dereference.
2004-08-16 14:47:31 +00:00
mycroft
a6f02be621 And the reason we had to call pccbb_power() twice in the enable routine is...
we were writing to PCIC_PWRCTL in between and causing the socket to power off.
D'oh.
2004-08-15 20:19:14 +00:00
mycroft
1eb6dd26a9 Allow keypad PgUp/PgDn to scroll as well. 2004-08-14 16:42:36 +00:00
thorpej
08fa2a3486 - Split the register handles out of struct wdc_channel into a separate
wdc_regs structure, and array of which (indexed per channel) is pointed
  to by struct wdc_softc.
- Move the resulting wdc_channel structure to atavar.h and rename it to
  ata_channel.  Rename the corresponding flags.
- Add a "ch_ndrive" member to struct ata_channel, which indicates the
  maximum number of drives that can be present on the channel.  For now,
  this is always 2.  Add an ATA_MAXDRIVES constant that places an upper
  limit on this value, also currently 2.
2004-08-14 15:14:35 +00:00
thorpej
4b51cecfc2 - Split the register handles out of struct wdc_channel into a separate
wdc_regs structure, and array of which (indexed per channel) is pointed
  to by struct wdc_softc.
- Move the resulting wdc_channel structure to atavar.h and rename it to
  ata_channel.  Rename the corresponding flags.
- Add a "ch_ndrive" member to struct ata_channel, which indicates the
  maximum number of drives that can be present on the channel.  For now,
  this is always 2.  Add an ATA_MAXDRIVES constant that places an upper
  limit on this value, also currently 2.
2004-08-14 15:08:04 +00:00
tsutsui
d91b03bd13 Use bus_space(9) on news68k.
Update/sort the comment/ifdefs about bus_space-using ports.

XXX which should we use defined(__${MACHINE_CPU}__) or defined(${MACHINE})?
2004-08-13 12:59:20 +00:00
mycroft
e3dd5f4885 Rearrange slightly so that we don't blow up if the card disappears during the
initial enable.
2004-08-13 12:42:11 +00:00
pooka
b151590832 kill "magic" number 2004-08-13 11:25:58 +00:00
mycroft
1d167b13be amd64 also has bus_space... 2004-08-13 10:52:18 +00:00
mycroft
27b5b1440c Remove a really gratuitous 1s delay. 2004-08-13 04:36:08 +00:00
thorpej
46f4277564 WDCDEBUG -> ATADEBUG. 2004-08-13 04:10:49 +00:00
mycroft
c369e5b81c Fix two annoying display glitches with "fast scrolling" and
WSDISPLAY_SCROLLSUPPORT.
2004-08-13 04:03:38 +00:00
thorpej
ab20886f7b Don't bother with bits that tell of the presence of optional callbacks;
just check the function pointers for NULL.
2004-08-13 03:12:59 +00:00
thorpej
577bf67014 Move wdcstart() to ata.c and rename it to atastart(). 2004-08-13 02:16:40 +00:00
thorpej
996c3ca90e Move wdc_exec_xfer() to ata.c and rename it ata_exec_xfer(). 2004-08-13 02:10:43 +00:00
thorpej
e6d61c5bc9 Move wdc_addref() and wdc_delref() to ata.c and rename them to
ata_*.
2004-08-12 22:39:40 +00:00
thorpej
2eaa5c6142 Move wdc_kill_pending() to ata.c and rename it ata_kill_pending(). 2004-08-12 22:33:45 +00:00
thorpej
2600c55e01 - Move wdc_xfer_pool, wdc_get_xfer(), wdc_free_xfer() to ata.c, and rename
to ata_*.
- Use a static initializer for the ata_xfer_pool.
2004-08-12 21:34:52 +00:00
thorpej
52ed169a28 Move wdc_probe_caps() to ata.c and rename it ata_probe_caps(). 2004-08-12 21:10:18 +00:00
thorpej
ac7276784a Move wdc_downgrade_mode() to ata.c and rename it to ata_downgrade_mode(). 2004-08-12 21:05:09 +00:00
thorpej
9939d3c63d Move wdc_print_modes() into ata.c and rename it ata_print_modes(). 2004-08-12 20:59:27 +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
cba67af302 Remove sc_offset. It's always 0, and if we did want to use it, "that's what
bus_space_subregion() is for".
2004-08-12 19:42:03 +00:00
mycroft
7fdb60e126 delay() -> tsleep() 2004-08-12 19:32:36 +00:00
mycroft
f881dcb9b2 Remove the "known bugs" section. I've fixed both of them.
Use tsleep() rather than delay().  XXX Most of these are probably unnecessary
anyway.  In particular, I believe that what xi_full_reset() does is totally
gratuitous after power-cycling the socket; it should only be necessary if we
want to use power-saving mode.
2004-08-12 18:23:50 +00:00
mycroft
bc9922c5ca Now that we write the IOBASE in generic code, don't do it here. Instead,
implement the hackish/stupid test for the AX88190 by just checking whether
the IOBASE is available in the CCR.

This is unspeakably wrong, but it leaves the code doing ~the same thing it
did before.
2004-08-12 17:33:17 +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
dc63cc8d34 The AX88790 hack never made any sense. It's setting the PWRDWN bit in the CCR!
So, I'm removing it.
2004-08-12 17:13:54 +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
849d423c4e Whoops. Swap the order of the delref() and the config_pending_decr(). 2004-08-12 14:36:46 +00:00
mycroft
306522b970 I can't actually use the FORCE register this way. Just try turning the socket
power off.
2004-08-12 13:42:17 +00:00
mycroft
6269226dde Copyright maintenance. 2004-08-12 13:39:38 +00:00
mycroft
768040dd66 Various cleanup:
* Clean up the socket state earlier in the attach process -- not relying on
  the socket attachment to do it.
* Get rid of PCIC_LASTSTATE_HALF.  It's pointless.
* In pcic_wait_ready(), also check for the card vanishing, like in pccbb.
* Assert #RESET before powering up the card, not after.  (I think it was
  actually okay because the value was left as 0 from a previous disable or
  the initial socket attach, but...
* If the card fails to come ready, don't bother reinstating windows or
  anything -- just power it down.
2004-08-12 13:37:40 +00:00
mycroft
6b8a90b3fe A bunch of random cleanup:
* Like the i82365 code, add a "delay" function that uses tsleep() to wait, and
  use this in the socket enable/disable paths.  This gets rid of the annoying
  system pauses during card insertion and removal.  (There are still some
  issues related to this in various drivers -- notably big delay()s in wi and
  xi.)
* Move the power-change delay out of pccbb_power() and into the PCMCIA backend
  code -- specifically, once in the disable path and once in the enable path.
  We were being pretty schizo about this before.  Make these use tsleep().
  (Note: This should be safe because card insertion/removal is handled by a
  kernel process, not in an interrupt handler.  It works for me with
  DIAGNOSTIC.)
* If we get a "bad Vcc" error, attempt to force the socket to power off, and
  return an error.  If we don't do this, we will get "bad Vcc" errors forever
  and never be able to use another card without rebooting, which is dumb.
  XXX I haven't been able to test this very well, because it doesn't fail for
  me in the first place.  :-)
* Clean up the socket mappings earlier in the enable path.
* Try to be consistent about clearing PWRCTL (which contains OE) before turning
  off power.
2004-08-12 07:15:49 +00:00
thorpej
9167731c79 Rename some constants:
WDC_COMPLETE -> ATACMD_COMPLETE
WDC_QUEUED -> ATACMD_QUEUED
WDC_TRY_AGAIN -> ATACMD_TRY_AGAIN
2004-08-12 05:02:50 +00:00
thorpej
3ddac9b2da Rename "struct wdc_command" to "struct ata_command". 2004-08-12 04:57:19 +00:00
thorpej
2e08b82ed7 Protect against multiple inclusion. 2004-08-12 04:31:33 +00:00
thorpej
f45b99ef1d Add SATA queued read/write commands. 2004-08-12 04:26:06 +00:00
thorpej
77cc762658 Don't assume wdc-specific ATA / ATAPI code should be brought in if atabus
or atapibus are configured; use a separate wdc_common attribute to indicate
that the shared wdc code is also present.
2004-08-12 04:23:02 +00:00
mycroft
d24f7ca79e Close a race condition in the datain loop. If we receive another byte between
reading the FIFO status and reading the interrupt status, we could end up
leaving it in the FIFO.  Force another round through the loop after reading the
interrupt status until the FIFO reads empty again.

Also, there is no point in having the extra loop to wait for the transfer
command to the controller to be acknowledged, because the transfer loop handles
that just fine -- and getting rid of it fixes another race condition.
2004-08-12 03:39:11 +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
b2e0a4015a We don't need to implement DRIVE_NOSTREAM here, 'cause we never set
WDC_CAPABILITY_NOSTREAM.
2004-08-11 20:27:42 +00:00
mycroft
6e3decbf8a "I was mistaken."
The memory window is not actually activate in I/O card configurations.  It was
transparently falling back to 16-bit I/O mode.
Implement "memory card" mode correctly, with polling.
2004-08-11 19:48:57 +00:00
mycroft
6741190fbc Make datain_pio and dataout_pio function pointers in wdc_softc, which can
be overridden by the backend if desired.  Add experimental code to wdc_pcmcia
to use this in memory-mapped mode, disabled by default.
2004-08-11 18:41:46 +00:00
mycroft
c8e7b2a367 The memory mode we were trying to use before is a total loss -- we don't get
any interrupts, and therefore wedge on any access.  However, there is another
memory mode that gives us a memory-mapped data register, which we can use.
Also set the new "DATA1K" flag to tell the wdc backend that we have a large
data area to read from -- this can be used with the region methods.
2004-08-11 18:06:22 +00:00
mycroft
139ff2a55b Change the behavior when a transfer mode setting is rejected. For PIO, fall
back to mode 3.  For DMA, fall back to mode 0.  These are the minimums for
ATAPI.  For UDMA, fail.
2004-08-11 17:51:24 +00:00
mycroft
04a46876e5 Add two helper functions -- wdc_datain_pio() and wdc_dataout_pio() -- which
encapsulate the logic for the various methods of transferring data.  Use these
throughout.
2004-08-11 17:49:27 +00:00
drochner
ad1c914cc3 adapt to esl_pcmcia changes 2004-08-11 16:20:05 +00:00
mycroft
c6c0aabf57 Correct the overrun loop while I'm at it. 2004-08-11 14:28:44 +00:00
mycroft
0ef13a458b Recode the datain_pio loop. This improves performance substantially (almost
2x) with my spc@pcmcia.
2004-08-11 14:22:34 +00:00
mycroft
a1d101ba64 Add a settype function.
Nuke address windows earlier in power up sequence.
2004-08-11 06:56:57 +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
310c1dab88 Do the read of the MAC address before enabling the function the first time,
so we're still in memory mode.
2004-08-11 03:56:03 +00:00
mycroft
8605b5b9c0 Nuke the address windows earlier, before the socket is powered up. Just in
case there are remnants left behind.
2004-08-11 01:51:41 +00:00
mycroft
33ee9cbce7 Oops; fix a compile error. 2004-08-11 01:05:42 +00:00
mycroft
51be90e8ac Be more liberal in torching the old state in the disable and settype routines. 2004-08-11 01:04:40 +00:00
mycroft
38ce741470 Clear IOIE in settype(), too. Not that we currently change modes without
powering down the socket, but...
2004-08-11 00:59:40 +00:00
mycroft
d978001d30 Clear some more ICR0 bits on socket enable/disable. 2004-08-11 00:58:08 +00:00
mycroft
b9798ff4a2 Add a settype() function.
XXX Note that I haven't even compiled this, but any problems are likely to be
more straightforward than crashing with a null pointer dereference.
2004-08-11 00:55:38 +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
a6bd4c05d7 GC some unneeded struct elements. 2004-08-10 23:34:32 +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
32dee96c25 Hold a reference between atabus_attach() and atabusconfig() to avoid an extra
enable/disable cycle.  Now my CF card attaches a bit faster.

XXX This code is split strangely between files.
2004-08-10 23:09:38 +00:00
mycroft
8c50dac2a1 Rather than the silly state machine, set whatever higher-level reference
count there is (for SCSI, adapt_refcnt) to 1 and call the appropriate
"delref" function afterwards to disable the controller.  This is a bit
simpler.

In a couple of cases, just remove the state machine, because it wasn't
really necessary.
2004-08-10 22:49:12 +00:00
mycroft
c2ecd3e635 Update to the new world order. While I'm here, simplify a lot. 2004-08-10 21:14:50 +00:00
mycroft
8355db5e7a Update to the new world order. 2004-08-10 20:47:17 +00:00
mycroft
ab96663a2a Use the right function for disabling after attach. 2004-08-10 20:25:03 +00:00
mycroft
22d0dd0aab Whoops. This goes with the esl_pcmcia.c commit. 2004-08-10 19:55:20 +00:00
mycroft
2f2f7913ed This code was pretty far from even compiling before. It also doesn't implement
detach support.  However, update other parts of it.
2004-08-10 19:54:30 +00:00
mycroft
a2606a74af Update to the new world order.
XXX This driver's backend should really be merged with ess.
2004-08-10 19:47:11 +00:00
mycroft
43a768d1a7 Remove an extra printf(). 2004-08-10 19:23:21 +00:00
mycroft
8534032c92 Constify. 2004-08-10 19:20:20 +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
96221eb572 Constify. 2004-08-10 19:12:25 +00:00
mycroft
1e7c425a39 Replace another home-grown matching function. 2004-08-10 19:08:37 +00:00
mycroft
3a3d934204 Regen. 2004-08-10 18:45:36 +00:00
mycroft
99e8c8ddca Copyright maintenance. 2004-08-10 18:45:25 +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
f185d2861f Remove some CIS strings that we don't actually want to match on -- in some
cases they contain minor revision numbers, and one was even someone's MAC
address!
2004-08-10 18:00:15 +00:00
mycroft
e489df60f6 Take a shot at updating this to the new world order. Hopefully someone will
test it for me...
2004-08-10 16:43:47 +00:00
mycroft
d11fb31edb More careful about cleaning up pointers. 2004-08-10 16:04:16 +00:00
mycroft
f1b2ffd886 Hold a reference to the adapter until scsibus_config() has been called. This
avoids an extra enable/disable cycle on removable controllers (i.e. PCMCIA).
2004-08-10 15:46:44 +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
90f47f6065 Better fix for the previous. 2004-08-10 08:57:50 +00:00
mycroft
8ccc950011 Copyright maintenance. 2004-08-10 08:56:08 +00:00
mycroft
51376df968 Fix a reference count problem I introduced here. 2004-08-10 08:29:27 +00:00
mycroft
03515f2f84 Update to the new world order.
XXX Note: This eliminates some register writes that were done in the "init"
routine during attach.  If these are necessary, they need to do done somewhere
else, quite possibly the enable routine.
2004-08-10 07:04:19 +00:00
mycroft
aebf4d4a6e Update to the new world order. 2004-08-10 07:03:14 +00:00
mycroft
4160a45384 For the c400, set 5380 compatibility mode on every pass through the reset
routine.  The PCMCIA attachment, at least, needs this.
2004-08-10 07:00:30 +00:00
mycroft
26df0f0126 Fix a printf(). 2004-08-10 06:23:50 +00:00
mycroft
6d1b8921aa Copyright maintenance. 2004-08-10 06:10:38 +00:00
mycroft
6c47211011 Update to the new world order. 2004-08-10 06:08:58 +00:00
mycroft
ac82590655 Remove some useless code. 2004-08-10 06:05:40 +00:00
mycroft
d55195e28b Update to the new world order.
"While I'm here..."
All that grotesque code allegedly for the 88190 and 88790 is actually just
mapping the CCR and writing to it.  So, enable the device normally and use
pcmcia_ccr_{read,write}() rather than doing this crap ourselves.
2004-08-10 05:24:56 +00:00
mycroft
1234bb195c Update to the new world order. 2004-08-10 05:23:04 +00:00
mycroft
9e12fe4182 Minor change to a printf(). 2004-08-10 05:22:33 +00:00
mycroft
1641421432 Move the location of a printf() I added. 2004-08-10 05:21:59 +00:00
mycroft
1a0a3e5f59 Update to the new world order. 2004-08-10 03:54:37 +00:00
mycroft
baa0e65038 Make the enable state machine during attach more robust. 2004-08-10 03:54:26 +00:00
mycroft
dae3551db2 Regen. 2004-08-10 03:03:29 +00:00
mycroft
a866720a7e Remove a very silly hack WRT the Digital vendor ID. 2004-08-10 03:03:11 +00:00
mycroft
71e7860bbf GC the "quirk" code. 2004-08-10 03:00:29 +00:00
mycroft
f96037f43b Use pcmcia_function_{configure,unconfigure}().
XXX Memory mapped mode seems to be flaky with my CF cards, so I have
disabled it for now.
2004-08-10 02:56:42 +00:00
mycroft
7f6dd84dc4 Use pcmcia_function_{configure,unconfigure}(). 2004-08-10 02:54:19 +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
dc594b03f9 Be robust against the case of the child devices failing to decrement the
refcnt.
2004-08-10 02:40:51 +00:00
mycroft
646cec1d1d A few things:
* Kill off device nodes *before* we clear out the queue, to help prevent any
  new I/O being queued.
* More useful error reporting in wd_setcache() and wd_flushcache().
* Add a wd_standby() (tested but not used yet).

And the most important:
* In wddetach(), if the device was open, call adapt_delref() so that we
  propagate the disable up to our PCMCIA socket.
2004-08-10 02:33:58 +00:00
dyoung
2bcbb9cb72 IBSS fixes: get IBSS beacon generation right. Merge with a same-SSID,
same-channel IBSS.
2004-08-10 01:03:52 +00:00
dyoung
8abb07d1ac Make the node table into an LRU cache: least-recently used nodes
are at the end of the node queue.  Change the reference-counting
discipline: ni->ni_refcnt indicates how many times net80211 has
granted ni to the driver.  Every node in the table with ni_refcnt=0
is eligible to be garbage-collected.  The mere presence of a node
in the table does not any longer indicate its auth/assoc state;
nodes have a ni_state variable, now.  A sysctl,
net.link.ieee80211.maxnodecache, controls the maximum LRU cache
size.

While I am here, patch ieee80211_find_node_for_beacon to do a "best
match" by bssid/ssid/channel, not a "perfect match."  This keeps
net80211 from caching duplicate nodes in the table.
2004-08-10 00:57:20 +00:00
mycroft
16e317876a Minor change. 2004-08-09 22:24:37 +00:00
mycroft
125ba6ee0c Adapt to the new world order. 2004-08-09 22:02:11 +00:00
mycroft
975673d3f6 Adapt to the new world order. 2004-08-09 21:30:18 +00:00
mycroft
285bec8287 Minor code reduction. 2004-08-09 20:30:19 +00:00
mycroft
b37b3de94e Adapt to the new world order. Now all my sm cards work. 2004-08-09 20:30:08 +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
7848004c46 Do the I/O mapping in the main attach routine.
Also, we don't need to bother cleaning up on a failed attach -- we keep enough
state for the detach routine to do it.
2004-08-09 19:34:00 +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
f65dd54152 Correct the intr_establish order here. 2004-08-09 18:51:32 +00:00
mycroft
7b96c587dc Fix the intr_establish/disestablish order here too. 2004-08-09 18:41:36 +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
2ae40d3e4f Do our io_map()s and intr_establish()es earlier. 2004-08-09 18:11:01 +00:00
mycroft
af19b73069 Do io_map() and intr_establish() before enabling the function, always. This
prevents "stray interrupts" during attach.
2004-08-09 17:00:53 +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
9a46d5ed7d Do an extra read of the IIR during initialization, just to ack any pending
interrupt.
2004-08-09 16:57:14 +00:00
mycroft
c74553663e Add some code to deal with the interrupt mask register on early CEM cards.
Doesn't seem to work yet, but it's marginal progress.
2004-08-09 16:05:00 +00:00
mycroft
c8180f49fd Use PCMCIA_WIDTH_AUTO, not PCMCIA_WIDTH_IO16, since we (sometimes) do 8-bit
access.
2004-08-09 15:40:56 +00:00
mycroft
b03f5b32c7 Pass a valid alignment to pcmcia_io_alloc(). 2004-08-09 14:24:10 +00:00
mycroft
4e92489373 Add detach support for spc@pcmcia, modeled after aic@pcmcia. 2004-08-09 14:07:57 +00:00
mycroft
f5eacc00f9 Don't loop forever if a card went away. 2004-08-09 13:52:21 +00:00
mycroft
10121549dd Add a hack that makes the address register programming more reliable on my
CE2 cards.
2004-08-09 13:30:16 +00:00
mycroft
eaae9fcf2b The "savedpage" stuff is nonsense. Every place we touch the device is
protected by splnet(), so there's no reason to even try.
2004-08-09 05:11:33 +00:00