state, so do not update ic->ic_state in wi_newstate() before calling
ieee80211_newstate(). Instead, update ic->ic_state when we do not
let ieee80211_newstate() run.
writes a hardware register when the data rate selection actually
changes. Add wi_cfg_txrate, which writes the data rate selection
regardless.
Name some fields in the wi Tx buffer which we will use for rate
adaptation.
Name the Prism "Alternate Retry Count" RID, WI_RID_ALT_RETRY_COUNT.
the number of descriptors, because of a disparity between the
bus_dmamap_load_mbuf implementation in FreeBSD and NetBSD. Now I
cover up the difference using ath_dmamap_load_mbuf.
Thanks Enami Tsugutomo for diagnosing this.
device; some ATAPI devices as master will report 0x7f in all registers
for slave before reset
- For the same reason, remove the er1 check.
Makes slave device with a "strange" ATAPI master probe again.
Problem reported and fix tested by Gary Duzan on current-users.
codes when I right-shift the country-code register! Fixes a bug
reported by Dan Carosone: regulatory domain "ETSI" registered as
domain "Spain/Other", so he could only tune channels 10 and 11.
status from 10 seconds to 250 milli seconds for the second and subsequent
attempts to determine the link status. This prevents unnecessary long
stalls after the device attach routines have completed.
Tested on a dual port QLogic 3212. Approved by mjacob@feral.com.
http://mail-index.netbsd.org/tech-kern/2003/09/25/0006.html
This adds a device (atabus) between IDE controllers and wd or atapibus, to
have each ATA channel show up in the device tree. Later there will be atabus
devices in /dev, so that we can do IOCTL on them.
Each atabus has its own kernel thread, to handle operations that needs polling,
e.g. reset and others.
Device probing on each bus it defered to the atabus thread creation.
This allows to do the reset and basic device probes in parallel, which reduce
boot time on systems with several pciide controllers.
When probing a nonexistent slave, we may timeout waiting for an interrupt.
In __wdccommand_start(), for polled data in commands, abort quickly if
status still read 0 after 400ns (for a nonexistant slave, the
command will either be aborted, or the status register will report 0; for
a real device we should have BSY, DRQ or ERR).
Thanks to Alexander Yurchenko for reporting the problem and testing the
fix.
removing assumptions that there are only two B channels and by
adding support for a varying number of channels.
Due to this, rename previously used isdn identified "bri" to "isdnif",
which better describes the current situation.
fit in the number of bits used for the port still does something.
This fixes PR pkg/18741 for ac97-based hardware. Other audio drivers
might need a similar fix.
it should be there, but in practice, on some systems an ugly race condition
rears its head: SCSI commands are issued before the FC thread ever runs, and
fail from then on forever. Yuck.
The driver backend is capable of supporting also ISA cards (no DMA)
and primary rate (PRI) cards in addition to the basic rate ones,
but I don't any to test on right now, so we don't support those
currently.
This code was originally written by Juha-Matti Liukkonen <jml@cubical.fi>
of Cubical Solutions Ltd. for FreeBSD, and was ported to NetBSD by
myself for the same company.
1) Don't wait for DRQ on an IDENTIFY command -- if it's not set when we see
BSY clear, abort the command and ignore the drive. (Do this by testing
for DRQ in the read/write cases in __wdccommand_intr().)
2) Don't wait for DRQ to deassert when we finish an IDENTIFY (or any other
non-block command that reads data) -- we don't do this for block I/O, and
empirically it doesn't clear on my CF cards at all, causing a pointless 1s
delay.
3) Add comments to some of the delay()s, and add missing ones in wdcreset()
and the WDCC_RECAL in the so-called "pre-ATA" probe.
4) Slightly simplify the reset sequence -- we were doing an extra I/O.
5) Modify the register writability test to make sure that registers are not
overlapped -- this can happen in some weird cases with a missing device 1.
6) Check the error register value after the reset -- if it's not 01h or 81h,
as appropriate (see ATA spec), punt.
Tested with a number of ATA-only, ATAPI-only, mixed ATA-ATAPI, CF, and IDE
disk configurations.
Also remove the SINGLE_DRIVE nonsense again.
of both devices are written, and device 0 will respond for device 1 if
device 1 isn't present. Pointed out by Quentin Garnier.
So the only way to know if device 1 is there or not is to send a command, which
is done later.
Detecting the second device here isn't important and won't speed up the probe.
We just need to know if there is at last one device on the bus.
Fix PR kern/22869 from Julio M. Merino Vidal.
call ata_raid_check_component() immediately, and panics since DMA setup
isn't done yet. So, defer the call until attach stage is almost done.
Tested with Promise TX2000.
most polling.
2) Clean up some goofiness in pciide -- get rid of the whole "candisable" path
(it's gratuitous) and simplify the code by calling pciide_map_compat_intr(),
*_set_modes() and wdc_print_modes() from central locations.
3) Add a register writability and register ghost test to eliminate phantom
drives more quickly.
voltage sense wired. So, disable it and force the card to 5V by default.
Also, recode the hack to use the "direct Vcc" feature of the chip, letting
it manage the voltage directly, as this is supported on both the 296 and
396.
controls. As it was before, the master volume control in all mixer programs
did nothing. It seems that this codec is not correctly wired in (almost?)
all motherboards.
Patch by Quentin Garnier. Fixes first part of PR kern/22548.
PCIC_VENDOR_NONE: New.
PCIC_VENDOR_CIRRUS_*: Collapse the 2 chips into one vendor ID.
pcic_ident_ok(): Check the ID revision field -- if it's 0, punt.
pcic_vendor(): Check the ID revision field -- if it's 0, or the ID register
is all-1s, assume there is no chip present. (Previously this would return
"Unknown controller" -- which, AFAICT, *never* resulted in a working device.)
Do the Cirrus check only after verifying that we got the Intel ID.
pcic_attach(): Use a priori knowledge of the Cirrus chips to determine the
number of sockets rather than trying (unsuccessfully) to probe. Also, just
blast all of PCIC_INTR -- we do this in pcic_deactivate_card() anyway.
* Remove some redundant code.
* ahd: Don't initiate negotiation for a discovery xs when the negotiation goal
is set. Just looking at the auto_negotiate mask is enough, and it can
cause an endless loop if the request gets requeued (happens with a
of a PPR negotiation, which ends with a busfree).
FreeBSD ahd driver:
Fix a race condition in the flushing of commands that
have completed across the bus but not to the host before
processing of an exception condition (busfree, bus reset,
etc.). When flushing the controller of completed commands,
we also look for packetized commands that have completed
with good status and are stored in the "good status fifo".
The hardware will post to the good status fifo even if
data for that command is still active in a FIFO. In
one particular failure case, a command outstanding on the
bus reconnected, transferred data into a FIFO, and provided
good status while the host driver was processing an expected
busfree event (PPR message negotiation). This resulted in
an entry in the good status fifo that we completed, but
since the sequencer was paused, the data in the data FIFO
for this command had never been transferred to the host.
Once the busfree processing was complete, the sequencer
was unpaused, and the data completed its transfer to the
host. In some instances, the client for the data was notified
of the completion and attempted to view the data before
it arrived. This case only occurred during FreeBSD's
multi-target probe of the SCSI bus while some devices are
negotiating to go packetized and some devices are already
running in packetized.
The fix is to run and FIFOs active with a context in the
good status fifo to completion before completing the command
to the SCSI layer. This requies duplicating the FIFO rundown
operations in the host driver that would usually be handled
by the firmware, but there is no other alternative.
Don't blindly shutdown the SCB dma engine when restarting
the sequencer. We may be killing an operation that is
not supposed to be cancelled. The cases where we need to
shutdown these dma engines are already handled elsewhere in
the driver.
Fix a few more ahd_in?() -> ahd_in?_scbram() instances.
FreeBSD ahd driver:
aic79xx.h:
Add softc flag to indicate that we have seen at
least one selection since the last bus reset or
SE/LVD bus change.
aic79xx.c:
Fix a few style nits.
In ahd_update_pending_scbs(), only touch card registers
once we have found an SCB that needs to be updated.
This removes lots of clutter from PCI traces taken of
error recovery performed by the driver.
Short circuit the first selection iocell workaround handler
if we've run once since the last bus reset or iocell change.
This also removes clutter from PCI traces.
Note if completions are pending in the qoutfifo when we dump
card state.
FreeBSD ahd driver:
Correct a typo in a comment.
Add a comment in ahd_clear_critical_sections() about
our need to leave ENBUSFREE set in SIMODE1 while single
stepping.
Re-arrange some delay loops so that we always perform
a read after any register write and before the delay.
This should make the delay loop more accurate.
When completing message processing for a packetized
commention, return the controller to a state where
invalid non-packetized phases will still cause protocol
violations. These are the same operations as those
performed in the clear_target_state routine in the
firmware.
Now that we have a chip with working ABORTPENDING
support (the 7901B), comment out the automatic use
of this feature until we can adequately test it.
The previous checkin updated the bug mask for the
7901B so this code was exercised.
When resetting the bus, perform an ahd_flush_device_writes()
call so that our reset assertion delay is acurately
timed from when the reset bit is written to the controller.
FreeBSD ahd driver:
aic79xx.h:
Add a 7901A specific feature definition.
aic79xx_pci.c:
Split out the general aic790X setup into it's own
setup handler that works on single and dual controllers.
Adjust all other PCI setup handlers to initialize the
chips basic features and type before calling the generic
handler.
Turn off a few Rev B workarounds that are not required
on the 7901B.
FreeBSD ahd driver:
Add parenthesis so that we get all of the bits all
of the contents of the CCSCBCTL register into our
local varaible. The other bits are used in later tests.
This avoids a potential deadlock in ahd_run_qoutfifo()
if we happen to catch the DMA engine in just the right
state.
FreeBSD ahd driver:
When single stepping, only leave ENBUSFREE enabled
if it was already enabled. We don't want to set it
when it shouldn't be set, we just don't want to
inadvertantly turn it off. This should fix a recent
report of the aic7xxx driver repeatedly complaining of
"unexpected busfree while idle" in one configuration.
FreeBSD ahd driver:
Work around SCSI spec violation by the Quantum Atlas 10K.
This drive delays going async after receiving a WDTR
message. We now send an SDTR message after a WDTR even
if our goal is to go async. This should work even for
confused devices.
If we get an unexpected busfree when attempting a WDTR
or SDTR, only set the goal negotiation parameters we were
trying to negotiate to off. This means that should a WDTR
message fail, we will still try an SDTR if our goal is
non-async.
Fix a few more places where we were looking at goal.period
instead of goal.offset for determining if we should be
negotiating sync. This should not have any impact on
our behavior, but the offset is more definitive and should
be used.
FreeBSD ahd driver:
Fix a reported case of severe data corruption:
aic79xx.h:
aic79xx.reg:
Return the SCB_TAG field to 16byte alignment.
It seems that on some PCI systems, SCBs are not
transferred correctly to the controller with
the previous placement of the SCB_TAG field.
Approved by: re (rwatson)
FreeBSD ahd driver:
aic7770.c:
aic79xx.c:
aic79xx.h:
aic79xx_pci.c:
aic7xxx.c:
aic7xxx.h:
aic7xxx_pci.c:
Switch ah?_reset() to take an additional "reinit" argument.
Use this instead of init_level to determin if the chip
should be fully reinitialized after a chip reset. This
is required so that ah?_shutdown() can reset the chip
without side-effects.
FreeBSD ahd driver:
aic79xx.c:
Use the special LUNLEN_SINGLE_LEVEL constant for
post Rev A4 hardware for single byte luns. Without
this change, Rev B hardware would place the single
byte of lun data in byte 0 of the lun structure when
it should be in byte 1. Since there are few if any
devices on the market that support multiple luns in
target mode, the corrupted lun field (which was only
corrupted for non-zero luns) wasn't hurting us.
Approved by: re (rwatson)
FreeBSD ahd driver:
Correct/Simplify ignore wide residue message handling
aic79xx.c:
In ahd_handle_ign_wide_residue():
o Use SCB_XFERLEN_ODD SCB field to determine transfer
"oddness" rather than the DATA_COUNT_ODD logic.
SCB_XFERLEN_ODD is toggled on every ignore wide
residue message so that multiple ignore wide residue
messages for the same transaction are properly supported.
o If the sg list has been exausted, the sequencer
doesn't bother to update the residual data count
since it is known to be zero. Perform the zeroing
manually before calculating the remaining data count.
o Use multibyte in/out macros instead of shifting/masking
by hand.
aic79xx_inline.h:
In ahd_setup_scb_common(), setup the SCB_XFERLEN_ODD field.
aic79xx.reg:
Use the SCB_TASK_ATTRIBUTE field as a bit field in the
non-packetized case. We currently only define one bit,
SCB_XFERLEN_ODD.
Remove the ODD_SEG bit field that was used to carry the odd
transfer length information through the SG cache. This
is obviated by SCB_XFERLEN_ODD field.
Remove the DATA_COUNT_ODD scratch ram byte that was used
dynamicaly compute data transfer oddness. This is obviated
by SCB_XFERLEN_ODD field.
aic79xx.seq:
Remove all updates to the DATA_COUNT_ODD scratch ram field.
Remove all uses of ODD_SEG. These two save quite a few
sequencer instructions.
Use SCB_XFERLEN_ODD to validate the end of transfer
ignore wide residue message case.
FreeBSD ahd driver:
Change hadling of the Rev. A packetized lun output bug
to be more efficient by having the sequencer copy the
single byte of valid lun data into the long lun field.
aic79xx.c:
Memset our hardware SCB to 0 so that untouched
fields don't confuse diagnostic output. With the
old method for handling the Rev A bug, if the long
lun field was not 0, this could result in bogus
lun information being sent to drives.
Use the same SCB transfer size for all chip types
now that the long lun is not DMA'ed to the chip.
aic79xx.seq:
Add code to copy lun information for Rev.A hardware.
aic79xx_inline.h:
Remove host update of the long_lun field on every
packetized command.
to the FreeBSD ahd driver:
Correct spelling errors.
Switch to handling bad SCSI status as a sequencer interrupt
instead of having the kernel proccess these failures via
the completion queue. This is done because:
o The old scheme required us to pause the sequencer and clear
critical sections for each SCB. It seems that these pause
actions, if coincident with a sequencer FIFO interrupt, would
result in a FIFO interrupt getting lost or directing to the
wrong FIFO. This caused hangs when the driver was stressed
under high "queue full" loads.
o The completion code assumed that it was always called with
the sequencer running. This may not be the case in timeout
processing where completions occur manually via
ahd_pause_and_flushwork().
o With this scheme, the extra expense of clearing critical
sections is avoided since the sequencer will only self pause
once all pending selections have cleared and it is not in
a critical section.
aic79xx.c
Add code to handle the new BAD_SCB_STATUS sequencer
interrupt code. This just redirects the SCB through
the already existing ahd_complete_scb() code path.
Remove code in ahd_handle_scsi_status() that paused
the sequencer, made sure that no selections where
pending, and cleared critical sections. Bad
status SCBs are now only processed when all of these
conditions are true.
aic79xx.reg:
Add the BAD_SCB_STATUS sequencer interrupt code.
aic79xx.seq:
When completing an SCB upload to the host, if
we are doing this because the SCB contains non-zero
SCSI status, defer completing the SCB until there
are no pending selection events. When completing
these SCBs, use the new BAD_SCB_STATUS sequencer
interrupt. For all other uploaded SCBs (currently
only for underruns), the SCB is completed via the
normal done queue. Additionally, keep the SCB that
is currently being uploaded on the COMPLETE_DMA_SCB
list until the dma is completed, not just until the
DMA is started. This ensures that the DMA is restarted
properly should the host disable the DMA transfer for
some reason.
In our RevA workaround for Maxtor drives, guard against
the host pausing us while trying to pause I/O until the
first data-valid REQ by clearing the current snapshot
so that we can tell if the transfer has completed prior
to us noticing the REQINIT status.
In cfg4data_intr, shave off an instruction before getting
the data path running by adding an entrypoint to the
overrun handler to also increment the FIFO use count.
In the overrun handler, be sure to clear our LONGJMP
address in both exit paths.
Perform a few sequencer optimizations.
aic79xx.c:
Print the full path from the SCB when a packetized
status overrun occurs.
Remove references to LONGJMP_SCB which is being
removed from firmware usage.
Print the new SCB_FIFO_USE_COUNT field in the
per-SCB section of ahd_dump_card_state(). The
SCB_TAG field is now re-used by the sequencer,
so it no longer makes sense to reference this
field in the kernel driver.
aic79xx.h:
Re-arrange fields in the hardware SCB from largest
size type to smallest. This makes it easier to
move fields without changing field alignment.
The hardware scb tag field is now down near the
"spare" portion of the SCB to facilitate reuse
by the sequencer.
aic79xx.reg:
Remove LONGJMP_ADDR.
Rearrange SCB fields to match aic79xx.h.
Add SCB_FIFO_USE_COUNT as the first byte
of the SCB_TAG field.
aic79xx.seq:
Add a per-SCB "Fifos in use count" field and use
it to determine when it is safe (all data posted)
to deliver status back to the host. The old method
involved polling one or both FIFOs to verify that
the current task did not have pending data. This
makes running down the GSFIFO very cheap, so we
will empty the GSFIFO in one idle loop pass in
all cases.
Use this simplification of the completion process
to prune down the data FIFO teardown sequencer for
packetized transfers. Much more code is now shared
between the data residual and transfer complete cases.
Correct some issues in the packetized status handler.
It used to be possible to CLRCHN our FIFO before status
had fully transferred to the host. We also failed to
handle NONPACKREQ phases that could occur should a CRC
error occur during transmission of the status data packet.
Correct a few big endian issues:
aic79xx.c:
aic79xx_inline.h:
aic79xx_pci.c:
aic79xx_osm.c:
o Always get the SCB's tag via the SCB_GET_TAG acccessor
o Add missing use of byte swapping macros when touching
hscb fields.
o Don't double swap SEEPROM data when it is printed.
Correct a big-endian bug. We cannot assign a
o When assigning a 32bit LE variable to a 64bit LE
variable, we must be explict about how the words
of the 64bit LE variable are initialized. Cast to
(uint32_t*) to do this.
aic79xx.c:
In ahd_clear_critical_section(), hit CRLSCSIINT
after restoring the interrupt masks to avoid what
appears to be a glitch on SCSIINT. Any real SCSIINT
status will be persistent and will immidiately
reset SCSIINT. This clear should only get rid of
spurious SCSIINTs.
This glitch was the cause of the "Unexpected PKT busfree"
status that occurred under high queue full loads
Call ahd_fini_scbdata() after shutdown so that
any ahd_chip_init() routine that might access
SCB data will not access free'd memory.
Reset the bus on an IOERR since the chip doesn't
seem to reset to the new voltage level without
this.
Change offset calculation for scatter gather maps
so that the calculation is correct if an integral
multiple of sg lists does not fit in the allocation
size.
Adjust bus dma tag for data buffers based on 39BIT
addressing flag in our softc.
Use the QFREEZE count to simplify ahd_pause_and_flushworkd().
We can thus rely on the sequencer eventually clearing ENSELO.
In ahd_abort_scbs(), fix a bug that could potentially
corrupt sequencer state. The saved SCB was being
restored in the SCSI mode instead of the saved mode.
It turns out that the SCB did not need to be saved at all
as the scbptr is already restored by all subroutines
called during this function that modify that register.
aic79xx.c:
aic79xx.h:
aic79xx_pci.c:
Add support for parsing the seeprom vital product
data. The VPD data are currently unused.
aic79xx.h:
aic79xx.seq:
aic79xx_pci.c:
Add a firmware workaround to make the LED blink
brighter during packetized operations on the H2A.
aic79xx_inline.h:
The host does not use timer interrupts, so don't
gate our decision on whether or not to unpause
the sequencer on whether or not a timer interrupt
is pending.
Fix the bug where the thread worker constantly looped. It was a race as
to whether or not the thread fired up or a polled/probed command happened
first, or maybe it's due to other scsipi changes, but we never set the
value that caused the fc thread worker to actually go to sleep until an
initial loop up.
This was rather ugly as it consumed nearly all CPU time available from thence
on. Bad.
In particular, when doing the "swap hscbs" trick, the scb must
reference the correct hscb_map when it gets a new hscb, otherwise
when you go to sync an hscb later, you could end up using the wrong
dmamap.
In order to make this work, we have to convert the shared_data stuff
to use a map_node, because of the "sentinel" trick played with the
initial "next_hscb".
This driver now works on XScale-based platforms.
- Don't use SCMD_XFR command in message-in phase and status phase.
It causes unexpected hangs on heavy load. Instead transfer data
manually via TEMP register by SCMD_SET_ACK and SCMD_RST_ACK.
- Don't set SCMD_ICPT_XFR in spc_dataout_pio() and spc_msgout().
- Rewrite spc_datain_pio() to handle FIFO more properly.
- disable debug code by default
- use MI minphys()
- add proper delay in spc_find()
- initialize TMOD register in spc_reset()
- wrap a sanity check with #ifdef DIAGNOSTIC (sync with aic6360.c)
- no need to set LUN bits in SCSI command which should be done in mid-layer
- set proper resid even in error case
- fix/remove some bogus comments
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
the ioctl issued by the ICP RAID management libraries (used by the
storcon and iirconfig tools). This requires some infrastructure changes:
* Add a "service callback" mechanism that the ld driver (cache service)
and the iopsp driver (raw service) can register with the icp parent.
Right now this callback allows the children to adjust their notion of
how many command openings are available.
* Add a mutex around the icp ioctl handler, allowing only one thread
to execute an ioctl at a time.
* Add a way to freeze the controller command queue. We stop all I/O
while processing rescans (due to the semantics of icp_cmd()).
* Make icp_cmd() work when !cold.
* Add detach support to ld@icp.
com ports found on Intel PXA2x0 processors.
Re-arrange the code which detects the FIFO configuration to defer
printing until _after_ com_fifo is cleared. Some supposedly compatible
chips clear the Tx/Rx FIFOs when this happens, resulting in previous
output being lost.
No longer require a hi-low-hi transition of a status bit before
we believe it. It's a performance killer, and without it there
does not seem to be a race.
Sam Leffler reports that wi_intr needs to be bracketed by
disable/enable interrupts through WI_INT_EN, or else performance
is bad on Lucent. So now we do that.
will match in the case of a break before the console was opened for the
first time. Makes BREAKing into DDB work (again) as soon as interrupts
are enabled.
1 Add channel mask, transmit rate-mask arguments to wi_scan_ap.
2 Adopt the macros WI_LOCK/WI_UNLOCK for synchronization. FreeBSD
uses a different synchronization mechanism.
3 In wi_cmd, adopt constants WI_DELAY/WI_TIMEOUT for timing.
4 Pull debug messages from into wi_read_nicid from FreeBSD.
5 Bug fix: if IFF_ALLMULTI, don't filter any multicasts.
6 Count and report TX exceptions, but don't generate any additional
interrupts.
FreeBSD.)
Fix a bug in wi_stop where ejecting from the Powerbook crashes the
system. Essentially, the patch makes sure we write *no* registers
when we are no longer attached.
Also, for consistency w/ FreeBSD, use sc_portnum throughout wi,
instead of hard-coding WI_PORT0 .
Fail cursor related ioctls with EBUSY while in text mode.
Don't do uvm_useracc checks before copyout, instead check copyout()
return value directly.
Minor cleanups.
registers. This is so that I can read an SMC 93cx6 through the
32-bit registers of the ADMtek ADM8211 802.11 wireless MAC.
Adapt aic to choose 8-bit registers.
first step towards per-device MAXPHYS, and has the beneficial side effect
of allowing clustering to MAXPHYS even on systems that need to run with
a reduced MAXBSIZE to get more metadata buffers.
identical to the patch in kern/6502 (which is hereby fixed), but
modelled after the corresponding fix to the 8530 driver in
z8530tty.c revision 1.60 to maintain consistency with that driver.
for FreeBSD, ported to NetBSD by Pascal Renauld, Network Storage Solutions,
Inc, plus a bunch of changes by me.
This driver is as yet untested in this final form, it will be added
to config files when it has been tested.