- 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!
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.
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.)
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.)
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.
* 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.
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.
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.
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.
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.
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.
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.
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.)
* 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.
* 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.
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.
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.
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.
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!
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.
* 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_*.
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.
"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.
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.
* 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.
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.
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.)
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.