History log of /freebsd-11-stable/sys/dev/firewire/fwohci.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 331722 29-Mar-2018 eadler

Revert r330897:

This was intended to be a non-functional change. It wasn't. The commit
message was thus wrong. In addition it broke arm, and merged crypto
related code.

Revert with prejudice.

This revert skips files touched in r316370 since that commit was since
MFCed. This revert also skips files that require $FreeBSD$ property
changes.

Thank you to those who helped me get out of this mess including but not
limited to gonzo, kevans, rgrimes.

Requested by: gjb (re)


# 330897 14-Mar-2018 eadler

Partial merge of the SPDX changes

These changes are incomplete but are making it difficult
to determine what other changes can/should be merged.

No objections from: pfg


# 310073 14-Dec-2016 avg

MFC r309092: fwohci: report whether PhysicalUpperBound register is implemented


# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 299351 10-May-2016 trasz

Remove NULL checks after M_WAITOK allocations from firewire.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# 298955 03-May-2016 pfg

sys/dev: minor spelling fixes.

Most affect comments, very few have user-visible effects.


# 277511 21-Jan-2015 will

Fix remote DMA based firewire debugging when targeting
systems with more than 4GB of physical memory.

To remotely debug the system 'stealthy' which has a kernel
with this change installed and firewire properly configured:

% fwcontrol -m stealthy (or stealthy's firewire EUI64)
% kgdb kernel /dev/fwmem0.0

sys/dev/firewire/fwohci.c:
Rather than hard code the upper limit for hw based
automatic responses to remote DMA requests at 4GB,
program the hardware using Maxmem, the page number
one higher than the highest physical page detected
in the system.

While here, garbage collect more useless splfw()
calls.

Submitted by: gibbs
MFC after: 1 week
Sponsored by: Spectra Logic
MFSpectraBSD: 1110994 on 2015/01/06


# 272215 27-Sep-2014 kan

Do not pass whole descriptor block size as align to fwdma_malloc_multiseg

Do not pass wrong alignment value to fwdma_malloc_multiseg and ultimately
to contigalloc. In addition to being wrong, this causes insta-panic in
certain cases due to safety assertion - the alignment is required to be
the power of two and the value we calculate here seldom is.

MFC after: 1 month


# 272214 27-Sep-2014 kan

Remove obsolete compatibility glue and improve firewire code readability.

Commit my version of style(9) pass over the firewire code. Now that
other people have started changing the code carrying this is as a
local patch is not longer a viable option.

MFC after: 1 month


# 271795 18-Sep-2014 will

Start the process of cleaning up FreeBSD's firewire driver.

sys/dev/firewire/firewire.c:
sys/dev/firewire/firewire.h:
sys/dev/firewire/firewirereg.h:
sys/dev/firewire/fwcrom.c:
sys/dev/firewire/fwdev.c:
sys/dev/firewire/fwdma.c:
sys/dev/firewire/fwmem.c:
sys/dev/firewire/fwohci.c:
sys/dev/firewire/fwohci_pci.c:
sys/dev/firewire/fwohcivar.h:
sys/dev/firewire/if_fwe.c:
sys/dev/firewire/if_fwip.c:
sys/dev/firewire/sbp.c:
sys/dev/firewire/sbp_targ.c:
Unifdef the code, removing support for DragonflyBSD
and FreeBSD prior to version 5.

Submitted by: gibbs
MFC after: 1 month
Sponsored by: Spectra Logic
MFSpectraBSD: 1081188 on 2014/08/01


# 271793 18-Sep-2014 will

Silence noisy firewire logging.

MFC after: 1 month
Sponsored by: Spectra Logic
MFSpectraBSD: 974594 on 2013/08/02


# 267992 28-Jun-2014 hselasky

Pull in r267961 and r267973 again. Fix for issues reported will follow.


# 267985 27-Jun-2014 gjb

Revert r267961, r267973:

These changes prevent sysctl(8) from returning proper output,
such as:

1) no output from sysctl(8)
2) erroneously returning ENOMEM with tools like truss(1)
or uname(1)
truss: can not get etype: Cannot allocate memory


# 267961 27-Jun-2014 hselasky

Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after: 2 weeks
Sponsored by: Mellanox Technologies


# 258780 30-Nov-2013 eadler

Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this
shifts into the sign bit. Instead use (1U << 31) which gets the
expected result.

This fix is not ideal as it assumes a 32 bit int, but does fix the issue
for most cases.

A similar change was made in OpenBSD.

Discussed with: -arch, rdivacky
Reviewed by: cperciva


# 243857 04-Dec-2012 glebius

Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags in sys/dev.


# 223353 21-Jun-2011 imp

When we see an interrupt status of 0xffffffff, check to see if the
child is still present. If not, return 'handled' and don't print
anything (this is expected behavior). We expect an interrupt on eject,
power-down and/or shutdown.


# 219543 11-Mar-2011 marius

Allocate the DMA memory shared between the host and the controller as
coherent.

MFC after: 2 weeks


# 214021 18-Oct-2010 brucec

Fix grammar.


# 188584 13-Feb-2009 sbruno

Remove redundant while () from loop.

Submitted by: Ganbold <ganbold@micom.mng.net>
Reviewed by: scottl


# 188509 12-Feb-2009 sbruno

Enhance debug messages and attempt to unify them into one format where possible.

Reviewed by: scottl


# 187993 01-Feb-2009 sbruno

Some updates and bug squashing in the firewire stack.

Move the interupt handler to a driver_intr_t type function as it was trying
to do way to much for a lightweight filter interrupt function.

Introduce much more locking around fc->mtx. Tested this for lock reversals
and other such lockups. Locking seems to be working better, but there
is much more to do with regard to locking. The most significant lock is
in the BUS RESET handler. It was possible, before this checkin, to set
a bus reset via "fwcontrol -r" and have the BUS RESET handler fire before
the code responsible for asserting BUS RESET was complete. This locking
fixes that issue.

Move some of the memory allocations in the fc struct to the attach function
in firewire.c

Rework the businfo.generation indicator to be merely a on/off bit now.
It's purpose according to spec is to notify the bus that the config ROM
has changed. That's it.

Catch and squash a possible panic in SBP where in the SBP_LOCK was held
during a possible error case. The error handling code would definitely
panic as it would try to acquire the SBP_LOCK on entrance.

Catch and squash a camcontrol/device lockup when firewire drives go away.
When a firewire device was powered off or disconnected from the firewire
bus, a "camcontrol rescan all" would hang trying to poll removed devices
as they were not properly detached. Don't do that.

Approved by: scottl
MFC after: 2 weeks


# 178915 10-May-2008 simokawa

- Fix panic on detach.
- Fix a comment.

MFC after: 2 weeks


# 178911 10-May-2008 simokawa

- Disable interrupts on suspend to eliminate excessive
'device physically ejected?' message on resume.
- Fix memory leak on resume reported by kiyohara at netbsd.org.

MFC after: 2 weeks


# 170427 08-Jun-2007 simokawa

Timestamp after sent.


# 170425 08-Jun-2007 simokawa

Fix a race after a bus reset.
- We are in FWBUSINIT state just after SID interrupt.
- Do not pass normal xfers before bus probe is done.


# 170400 07-Jun-2007 simokawa

Add a tunable hw.firewire.phydma_enable.

This is enabled by default. It should be disabled for
those who are uneasy with peeking/poking from FireWire.

Please note sbp(4) and dcons(4) over FireWire need
this feature.


# 170374 06-Jun-2007 simokawa

MFp4: MPSAFE firewire stack.
- lock its own locks and drop Giant.
- create its own taskqueue thread.
- split interrupt routine
- use interrupt filter as a fast interrupt.
- run watchdog timer in taskqueue so that it should be
serialized with the bottom half.
- add extra sanity check for transaction labels.
disable ad-hoc workaround for unknown tlabels.
- add sleep/wakeup synchronization primitives
- don't reset OHCI in fwohci_stop()


# 169132 30-Apr-2007 simokawa

MFp4: Improve asynchronous packet receive process.
- Wake up DMA engine after adding a new receive buffer.
- Skip buffers which have unknown state after error.
- More rigid error detection.

MFC after: 1 week


# 169123 30-Apr-2007 simokawa

MFp4: Add a sysctl knob to disable cycle master mode and add some comments.

MFC after: 1 week


# 169117 30-Apr-2007 simokawa

Initialize configuration ROM before a bus reset.

MFC: after 3 days


# 167685 19-Mar-2007 simokawa

Wait SCLK to be stable after LPS enabled.
This should fix NMI problem in fwphy_rddata().

PR: kern/94146 kern/100356
MFC: after 3 days


# 167630 16-Mar-2007 simokawa

* Remove xfer->retry_req.
It is unnecessary because retry is done by OHCI.
Further retry should be done by applications.


# 167629 16-Mar-2007 simokawa

Less verbose debug messages.


# 167628 16-Mar-2007 simokawa

Detect cycle lost.


# 167086 27-Feb-2007 jhb

Use pause() rather than tsleep() on stack variables and function pointers.


# 144263 28-Mar-2005 sam

fix potential null ptr deref

Submitted by: Coverity Prevent analysis tool


# 139749 05-Jan-2005 imp

Start each of the license/copyright comments with /*-, minor shuffle of lines


# 132432 20-Jul-2004 simokawa

Don't output too many debug messages for bootverbose.
This driver seems to be fairly stable now.


# 130585 16-Jun-2004 phk

Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.


# 129611 23-May-2004 dfr

Initialise OHCI_CROMHDR and OHCI_BUS_OPT in fwohci_ibr to make sure that
they have the right values at the first bus reset.


# 129585 22-May-2004 dfr

Change u_intXX_t to uintXX_t. Change a couple of 'unsigned long's to
uint32_t where appropriate.


# 129541 21-May-2004 dfr

Fix spelling.


# 127468 26-Mar-2004 simokawa

MFp4: FireWire
* all
- s/__FUNCTION__/__func__/.
Submitted by: Stefan Farfeleder <stefan@fafoe.narf.at>
- Compatibility for RELENG_4 and DragonFly.

* firewire
- Timestamp just before queuing.
- Retry bus probe if it fails.
- Use device_printf() for debug message.
- Invalidiate CROM while update.
- Don't process minimum/invalid CROM.

* sbp
- Add ORB_SHORTAGE flag.
- Add sbp.tags tunable.
- Revive doorbell support. It's not enabled by default.


# 125238 30-Jan-2004 simokawa

Use device_identify and bus_add_child methods to add a firewire
bus on fwohci. This should fix attach failure caused by a race
between firewire and fwochi initialization for the kernel module.


# 124836 22-Jan-2004 simokawa

Add missing free() in exception handlers.

Reported by: Stanford Metacompilation research group


# 124378 11-Jan-2004 simokawa

Sync type of linkspeed with firewire.c.


# 124169 06-Jan-2004 simokawa

Remove __P().


# 124145 05-Jan-2004 simokawa

MFp4:
* firewire
- Remove pending list.
- Ignore timeout for the FWXF_START state.
- Define M_FWMEM for debugging.
- Comment out DELAY() in fw_asybusy().
- Improve debugging messages
* sbp
- Freeze simq while bus reset.


# 123740 23-Dec-2003 peter

Catch a few places where NULL (pointer) was used where 0 (integer) was
expected.


# 121781 31-Oct-2003 simokawa

Reject too large OHCI version number.

Invalid OHCI version indicates OHCI registers are not mapped
correctly in PCI or CardBus layer.


# 120660 02-Oct-2003 simokawa

MFp4: Change struct fw_xfer to reduce memory copy in fwmem_*() functions.
And many changes.

* all
- Major change of struct fw_xfer.
o {send,recv}.buf is splitted into hdr and payload.
o Remove unnecessary fields.
o spd is moved under send and recv.
- Remove unnecessary 'volatile' keyword.
- Add definition of rtcode and extcode.

* firewire.c
- Ignore FWDEVINVAL devices in fw_noderesolve_nodeid().
- Check the existance of the bind before call STAILQ_REMOVE().
- Fix bug in the fw_bindadd().
- Change element of struct fw_bind for simplicity.
- Check rtcode of response packet.
- Reduce split transaction timeout to 200 msec.
(100msec is the default value in the spec.)
- Set watchdog timer cycle to 10 Hz.
- Set xfer->tv just before calling fw_get_tlabel().

* fwohci.c
- Simplifies fwohci_get_plen().

* sbp.c
- Fix byte order of multibyte scsi_status informations.
- Split sbp.c and sbp.h.
- Unit number is not necessary for FIFO¤ address.
- Reduce LOGIN_DELAY and SCAN_DELAY to 1 sec.
- Add some constants defineded in SBP-2 spec.

* fwmem.c
- Introduce fwmem_strategy() and reduce memory copy.


# 119289 22-Aug-2003 simokawa

Comment out verbose debug messages.


# 119155 20-Aug-2003 simokawa

Fill reserved fields of transmitting packets header with zero.
This fixes the if_fwe problem with 1394b chip.

PR and Tested by: nork


# 119120 19-Aug-2003 simokawa

Remove unused code.


# 119118 19-Aug-2003 simokawa

Allow to access phy registers via ioctl().


# 118820 12-Aug-2003 simokawa

Validate number of iso. DMA channels.


# 118416 04-Aug-2003 simokawa

- Don't mess with TX queue in fwohci_stop() if we failed to attach the device.

Tested by: wilko

- Detect memory mapping failure of registers by checking OHCI version.

Tested by: KONDOU, Kazuhiro <kazuhiro@alib.jp>


# 118293 01-Aug-2003 simokawa

Clean up fwdev.

Allocate iso DMA channel dynamically. This allows us to have more
/dev/fw* than number of DMA channels for asyn. transactions and etc.


# 117732 18-Jul-2003 simokawa

Clean up include files.


# 117228 04-Jul-2003 simokawa

Add compatibility for FreeBSD-4.


# 117126 01-Jul-2003 scottl

Mega busdma API commit.

Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma. At the moment, this is used for the
asynchronous busdma_swi and callback mechanism. Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg. dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create(). The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms. The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by: tmm, gibbs


# 117067 30-Jun-2003 simokawa

Include file clean up.


# 116978 28-Jun-2003 simokawa

Fix several problems related to resume:
- Initialize fc->status to process bus reset correctly after resume.
- Initialize AT ring buffer pointer.
- Requeue stdma to stfree for active IR buffer.
- Stop DMA before suspend for safe.
- Set powerstate after resume.


# 116897 26-Jun-2003 simokawa

- Use fwohci_poll() instead of fwohci_intr() to process the first bus reest.
- Wait 2 cycles before starting the process for fast machines.


# 116376 15-Jun-2003 simokawa

- Enable support for building Configuration ROM.
- Improve probe message for S800 chips.


# 114224 29-Apr-2003 simokawa

Set recv.len to zero if we get no response.


# 114218 29-Apr-2003 simokawa

Fix indentation.


# 114142 28-Apr-2003 simokawa

Make compiled on RELEGN_4


# 113972 24-Apr-2003 simokawa

Fix printf warnings for i386 with PAE.

Submitted by: harti


# 113584 17-Apr-2003 simokawa

MFp4(simokawa_firewire):
Many internal structure changes for the FireWire driver.

- Compute CRC in CROM parsing.
- Add support for configuration ROM build.
- Simplify dummy buffer handling.
- busdma conversion
- Use swi_taskqueue_giant for -current. Mark the interrupt routine as MPSAFE.
- AR buffer handling.
Don't reallocate AR buffer but just recycle it.
Don't malloc and copy per packet in fwohci_arcv().
Pass packet to fw_rcv() using iovec.
Application must prepare receiving buffer in advance.
- Change fw_bind API so that application should pre-allocate xfer structure.
- Add fw_xfer_unload() for recycling struct fw_xfer.
- Add post_busreset hook
- Remove unused 'sub' and 'act_type' in struct fw_xfer.
- Remove npacket from struct fw_bulkxfer.
- Don't call back handlers in fwochi_arcv() if the packet has
not drained in AT queue
- Make firewire works on big endian platform.
- Use native endian for packet header and remove unnecessary ntohX/htonX.
- Remove FWXFERQ_PACKET mode. We don't use it anymore.
- Remove unnecessary restriction of FWSTMAXCHUNK.
- Don't set root node for phy config packet if the root node is
not cycle master capable but set myself for root node.
We should be the root node after next bus reset.

Spotted by: Yoshihiro Tabira <tabira@scd.mei.co.jp>
- Improve self id handling

Tested on: i386, sparc64 and i386 with forced bounce buffer


# 112523 24-Mar-2003 simokawa

- The payload of Write Request Quad and Read Response Quad must be
network byte order.
- Set ATRetries register after each bus reset because the value is 'undef'
in OHCI spec.


# 111956 07-Mar-2003 simokawa

- improve timeout handling in fwmem.c
- stop processing of TX db if we reaches the end of active db.


# 111942 06-Mar-2003 simokawa

MFp4(simokawa_sbp)

Improve if_fwe performance.
- Simplify mbuf handling by using bulkxfer.
Now, it uses mbuf clusters for RX buffer as usual ethernet drivers.
- Recycle struct xfer buffer and don't call malloc at runtime.
- Count input and output errors.
- Handle a mbuf chain longer than 6 correctly.
- Increase queue length.


# 111892 04-Mar-2003 simokawa

Set ldesc after dbch->ndesc has initialized.


# 111787 03-Mar-2003 simokawa

Defer allowing async. requests after self ID's have received.
This should fix some problem of SBP2 device probing.

Prior to rev 1.41, we keep writing the register while bus reset phase.
But in rev 1.41, we ignore successive bus reset events and some chips seem to
clear the register after we write to it.

Tested by: Michael Reifenberger <root@nihil.reifenberger.com>


# 111074 18-Feb-2003 simokawa

* firewire.c
- Fix memory leak in detaching.
- Initialize fc->status to other than FWBUSREST.

* fwohci.c
- Ignore BUS reset events while BUS reset phase. We can't clear that flag
during bus reset phase.


# 110798 13-Feb-2003 simokawa

firewire/fwohci
- Drain fwohci TX queue first then drain xfer queue which has not started.
- Check validity of the received packet length.
- Don't allocate too large buffer for xfer receive buf.

sbp
- Fix panic for some CROM which doesn't have a text leaf.
This could fix the PR kern/48129 but no feedback has been gotten from
the originator yet.
- Put back some M_NOWAIT flags into malloc which could be called
in interrupt context for 4-stable.


# 110593 09-Feb-2003 simokawa

Increase atrq.ndesc for if_fwe.


# 110577 09-Feb-2003 simokawa

- Detect split transcation timeout.
* implement watchdog timer.
* check all standing transactions in firewire_xfer_timeout().
- Add firewire_xferq_drain() for fw_busreset().
- Add/improve some debug messages.
- Call fw_xfer_done() if retry handler is NULL.


# 110488 07-Feb-2003 simokawa

Remove debug message.


# 110273 03-Feb-2003 simokawa

Remove unnecessary M_NOWAIT.


# 110269 03-Feb-2003 simokawa

- Take malloc type as an argument in fw_xfer_alloc().
- Fix overwrite problem of freed buffers. It was rare but could happen
when fwohci_arcv() is called before fwohci_txd() is called for
the transcation.
- Drain AT queues and pend AR queues on SID receive rather than BUS reset to
make sure DMA actually stops.
- Do agent reset in sbp_timeout().


# 110195 01-Feb-2003 simokawa

Define new malloc type M_FW and use it.


# 110193 01-Feb-2003 simokawa

- replace timeout with callout_*.
- replace TAILQ with STAILQ for device list.
- some clean up.


# 110145 31-Jan-2003 simokawa

SBP related changes.
- Issue LOGOUT command on detach and shutdown.
- Rename some functions.


# 110045 29-Jan-2003 simokawa

- Probe number of IT/IR DMA contexts as specified in OHCI spec.


# 110016 29-Jan-2003 simokawa

- Fix build on alpha.
- Add a missing newline in printf.


# 109892 26-Jan-2003 simokawa

- Split db.desc.cmd into desc.control and desc.reqcount.
- remove unncessary descriptor updates.


# 109890 26-Jan-2003 simokawa

- Improve IT/IR DMA queue management.
- Improve debug message for mbuf handling.
- Wait 1 sec for DMA stop in fwohci_i{t,r}x_disable() before freeing buffers.


# 109814 25-Jan-2003 simokawa

Change API of FW_GDEVLST ioctl.
- include information about itself.
- define struct fw_devinfo and use it in struct fw_devlstreq.
- unify EUI64 representation using struct fw_eui64.


# 109802 24-Jan-2003 simokawa

Remove FW_SSTDV ioctl. It is not used anymore.


# 109736 23-Jan-2003 simokawa

- Add sysctl knob for bus manager. (hw.firewire.try_bmr)
- Check invalid SID length.
- Add some debug messages.


# 109644 21-Jan-2003 simokawa

Ignore events of unused IR DMA.


# 109424 17-Jan-2003 simokawa

Replace M_DONTWAIT with M_NOWAIT for malloc().

Pointed out by: nate@root.org


# 109423 17-Jan-2003 simokawa

Improve some debug massages.


# 109403 17-Jan-2003 simokawa

Detect underrun of IT queue for debugging.
Add some comments.


# 109379 16-Jan-2003 simokawa

Improve memory allocation.
- Don't use contigmalloc() and allocate page by page to avoid
allocation failure.
- allocate buffer by PAGE_SIZE.


# 109356 16-Jan-2003 simokawa

Use cycleMatch for precise IT DMA start timing.


# 109280 15-Jan-2003 simokawa

Fix IT DMA underun while bus reset.
- Reduce number of DELAY's


# 109179 13-Jan-2003 simokawa

Minimal fix for DV part.
- Don't panic on contigmalloc failure.
- Calculate timestamp by feedforward rather than feedback which depends on
unreliable interrupt timing.
- Overwrite timestamp in CIP header correctly.
- Add debug code for timestamp synchronization.
- Add comments.


# 108995 09-Jan-2003 simokawa

- Add error messages for bulkxfer.
- Reduce register access.


# 108712 05-Jan-2003 simokawa

Reduce diff to RELENG_4.


# 108701 05-Jan-2003 simokawa

- Change definition of fc->maxrec same as fwdev->maxrec.
- 'spec' and 'ver' are attributes of a unit rather than a node.
- Report Phy and Link info separatelly.
- Reorder intialization step in fwohci_reset().


# 108655 04-Jan-2003 simokawa

- Replace printf() with device_printf().
- Separate fc->dev (i.e. fwohci0) and fc->bdev (i.e. firewire0).
- Remove unused firewirebusreg.h.
- Reduce size of descriptor block for asynchronous transmit and
check the number of descriptor when copying from mbuf.
- Skip mbuf whose length is zero. NFS seems passing such mbuf and
some chips generates unrecoverable error.


# 108642 04-Jan-2003 simokawa

- Propagate suspend/resume to child devices.
- Restore pci config registers after resume.
- Reinitialize and start rx buffers after resume.
- Don't reallocate memory in fwohci_db_init() if the dbch is
already initialized.
- Fix typo.
- Some clean up.


# 108530 01-Jan-2003 simokawa

Experimental support for suspend/resume, not finished yet.


# 108527 01-Jan-2003 simokawa

- Retry phy access when the wait-loop count is exhausted.
- Free allocated memory when detaching.
- Detect contigmalloc failure.


# 108500 31-Dec-2002 simokawa

Improve error checking of phy access and retry when error occurs.


# 108276 26-Dec-2002 simokawa

firewire.c
- Fix permission of device node.

fwochi.c, fwohcireg.h
- Detect phy access failure correct way.
- Set root hold-off bit before initiating bus reset.
This should fix the problem with VIA6306.

fwohcivar.h
- Fix over-allocation of array. (fwohcivar.h)

sbp.c
- Return CAM_DEV_NOT_THERE rather than CAM_TID_INVALID to prevent retry.


# 107653 06-Dec-2002 simokawa

Reduce and improve debug messages.

Approved by: re


# 106802 12-Nov-2002 simokawa

- clean up


# 106790 12-Nov-2002 simokawa

- Remove unused code.
- Style fixes.


# 106789 12-Nov-2002 simokawa

Restrict process count in fwohci_arcv() and fwohci_ircv().


# 106543 07-Nov-2002 simokawa

- Fix printf warnings on 64bit plathome.
- Disable fw_vmaccess() because it's not used and unuseful 64bit plathome.


# 106439 05-Nov-2002 simokawa

Sony CXD3222 OHCI i.LINK chips needs more DELAY before starting SCLK
when no devices are connected.


# 103285 13-Sep-2002 ikob

Initial import for IEEE1394 OHCI chipdet device driver and SBP-2 (Serial
Bus Protocol 2:SCSI over IEEE1394) support for CAM.