History log of /freebsd-11-stable/sys/dev/firewire/firewire.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


# 310077 14-Dec-2016 avg

MFC r309093: firewire: initialize tag label to -1 in fw_xfer_alloc()


# 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
# 298955 03-May-2016 pfg

sys/dev: minor spelling fixes.

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


# 277510 21-Jan-2015 will

Fix firewire panic when issuing a reply to an unhandled
asynchronous remote dma request (DMA request that the
hardware cannot automatically handle).

sys/dev/firewire/firewire.c
In fw_rcv(), add missing early return in the error
path for DMA requests to unregistered regions.

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


# 277509 21-Jan-2015 will

Properly lock accesss to the firewire_comm->devices list.

sys/dev/firewire/firewire.c:
Add missing FW_GLOCK/UNLOCK() usage to fw_noderesolve_nodeid().

sys/dev/firewire/firewire.c:
sys/dev/firewire/fwmem.c:
Remove no-op splfw() calls from functions that have been
audited for proper lock usage.

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


# 277508 21-Jan-2015 will

Fix panic in firewire and creation of invalid config ROM.

sys/boot/i386/libfirewire/firewire.c:
sys/dev/firewire/firewire.c:
Fix configuration ROM generation count wrapping logic
so that the generation count is never outside of
allowed limits (0x2 -> 0xF).

sys/dev/firewire/firewire.c:
In fw_xfer_unload(), xfer->fc may be NULL. Protect
against this before taking the fc lock.

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


# 277507 21-Jan-2015 will

Fix a FWXF_INQ race in the firewire driver.

sys/dev/firewire/firewire.c:
In fw_xfer_unload() expand lock coverage so that
the test for FWXF_INQ doesn't race with it being
cleared in another thread.

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


# 277506 21-Jan-2015 will

Fix one cause of firewire panics.

sys/dev/firewire/firewire.c:
In fw_xfer_unload(), clear the FWXF_INQ flag on the
xfer under protection of the FW_GMTX, after the
xfer is removeed from the tx/rx queue. Otherwise
it is possible for the xfer to be removed again
(corrupting the list or immediately panicing) from
another thread that has found this xfer in the
transaction label table.

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


# 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


# 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


# 249291 08-Apr-2013 will

FireWire: Don't allow a tlabel to reference an xfer after free.

sys/dev/firewire/firewire.c:
- fw_xfer_unload(): Since we are about to free this xfer, call fw_tl_free()
to remove the xfer from its tlabel's list, if it has a tlabel.
- In every occasion when a xfer is removed from a tlabel's list, reset
xfer->tl to -1 while holding fc->tlabel_lock, so that the xfer isn't
mis-identified as belonging to a tlabel.

This doesn't fix all the use-after-free problems for M_FWMEM, but is an
incremental towards that goal.

Reviewed by: kan, sbruno
Sponsored by: Spectra Logic


# 227843 22-Nov-2011 marius

- There's no need to overwrite the default device method with the default
one. Interestingly, these are actually the default for quite some time
(bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
since r52045) but even recently added device drivers do this unnecessarily.
Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
Discussed with: jhb
- Also while at it, use __FBSDID.


# 212413 10-Sep-2010 avg

bus_add_child: change type of order parameter to u_int

This reflects actual type used to store and compare child device orders.
Change is mostly done via a Coccinelle (soon to be devel/coccinelle)
semantic patch.
Verified by LINT+modules kernel builds.

Followup to: r212213
MFC after: 10 days


# 194118 13-Jun-2009 jamie

Rename the host-related prison fields to be the same as the host.*
parameters they represent, and the variables they replaced, instead of
abbreviated versions of them.

Approved by: bz (mentor)


# 193066 29-May-2009 jamie

Place hostnames and similar information fully under the prison system.
The system hostname is now stored in prison0, and the global variable
"hostname" has been removed, as has the hostname_mtx mutex. Jails may
have their own host information, or they may inherit it from the
parent/system. The proper way to read the hostname is via
getcredhostname(), which will copy either the hostname associated with
the passed cred, or the system hostname if you pass NULL. The system
hostname can still be accessed directly (and without locking) at
prison0.pr_host, but that should be avoided where possible.

The "similar information" referred to is domainname, hostid, and
hostuuid, which have also become prison parameters and had their
associated global variables removed.

Approved by: bz (mentor)


# 190792 07-Apr-2009 sbruno

Minor updates as a precursor to fixing sbp_targ

firewire.c -- expand a comment and repair a typo
sbp.h -- define Logical Unit Reset so it can be used in sbp_targ

Reviewed by: scottl@freebsd.org


# 189928 17-Mar-2009 sbruno

Reviewed by: scott (scottl@freebsd.org)
Obtained from: Hideotshi Shimokawa

This update is based on comments from Hidetoshi.

Changeset 183550 removed the call to crom_load() in fw_busreset(). Restore
that call such that the Configuration ROM is valid.

Stash and update fwdev settings in fw_explore_node() so that negotiation
works again.


# 188726 17-Feb-2009 sbruno

Introduce 1394a-2000 extended PHY Self ID packets.

Deprecate unused phy_delay Self ID field as it was removed
by 1394a-2000.

Attempt to parse extended Self ID PHY packets if they are detected

Reviewed by: scottl (mentor)
MFC after: 2 weeks


# 188722 17-Feb-2009 sbruno

Simplify some debugging messages and try to consolodate some of the more
interesting conditional printf's into single device_printf's

Change a couple of variable names so that I don't have to trace what they
acutally do anymore.

Enable the display of the Self ID PHY packet if firewire_debug > 0
Reviewed by: scottl(mentor)
MFC after: 2 weeks


# 188704 17-Feb-2009 sbruno

Synopsis:
If speed of link between two devices is slower than the reported max
speed of both endpoints, the current driver will fail and be unable to
negotiate.

Summary:
Test negotiated speed by reading the CSRROM into a dummy variable.
If that read fails, decrement our speed and retry. If all else fails,
go to lowest speed possible(0).

Report speed to the user.
Add display of the Bus Info Block when debug.firewire_debug > 1
Support the Bus Info Block(1394a-2000) method of speed detection.

I also should note that I am moving "hold_count" to 0 for future
releases.

This variable determines how many bus resets to "hold" a removed
firewire device before deletion. I don't feel this is useful and will
probably drop support for this sysctl in the future.

Reviewed by: scottl(mentor)
MFC after: 2 weeks


# 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


# 183550 02-Oct-2008 zec

Step 1.5 of importing the network stack virtualization infrastructure
from the vimage project, as per plan established at devsummit 08/08:
http://wiki.freebsd.org/Image/Notes200808DevSummit

Introduce INIT_VNET_*() initializer macros, VNET_FOREACH() iterator
macros, and CURVNET_SET() context setting macros, all currently
resolving to NOPs.

Prepare for virtualization of selected SYSCTL objects by introducing a
family of SYSCTL_V_*() macros, currently resolving to their global
counterparts, i.e. SYSCTL_V_INT() == SYSCTL_INT().

Move selected #defines from sys/sys/vimage.h to newly introduced header
files specific to virtualized subsystems (sys/net/vnet.h,
sys/netinet/vinet.h etc.).

All the changes are verified to have zero functional impact at this
point in time by doing MD5 comparision between pre- and post-change
object files(*).

(*) netipsec/keysock.c did not validate depending on compile time options.

Implemented by: julian, bz, brooks, zec
Reviewed by: julian, bz, brooks, kris, rwatson, ...
Approved by: julian (mentor)
Obtained from: //depot/projects/vimage-commit2/...
X-MFC after: never
Sponsored by: NLnet Foundation, The FreeBSD Foundation


# 181803 17-Aug-2008 bz

Commit step 1 of the vimage project, (network stack)
virtualization work done by Marko Zec (zec@).

This is the first in a series of commits over the course
of the next few weeks.

Mark all uses of global variables to be virtualized
with a V_ prefix.
Use macros to map them back to their global names for
now, so this is a NOP change only.

We hope to have caught at least 85-90% of what is needed
so we do not invalidate a lot of outstanding patches again.

Obtained from: //depot/projects/vimage-commit2/...
Reviewed by: brooks, des, ed, mav, julian,
jamie, kris, rwatson, zec, ...
(various people I forgot, different versions)
md5 (with a bit of help)
Sponsored by: NLnet Foundation, The FreeBSD Foundation
X-MFC after: never
V_Commit_Message_Reviewed_By: more people than the patch


# 178915 10-May-2008 simokawa

- Fix panic on detach.
- Fix a comment.

MFC after: 2 weeks


# 172836 20-Oct-2007 julian

Rename the kthread_xxx (e.g. kthread_create()) calls
to kproc_xxx as they actually make whole processes.
Thos makes way for us to add REAL kthread_create() and friends
that actually make theads. it turns out that most of these
calls actually end up being moved back to the thread version
when it's added. but we need to make this cosmetic change first.

I'd LOVE to do this rename in 7.0 so that we can eventually MFC the
new kthread_xxx() calls.


# 171513 20-Jul-2007 simokawa

Protect transaction labels by its own lock to reduce lock contention.

Approved by: re (rwatson)


# 171457 15-Jul-2007 simokawa

Improve acquisition of transaction labels.
- Keep last transaction label for each destination.
- If the next label is not free, just give up.
- This should reduce CPU load for TX on if_fwip under heavy load.

Approved by: re (hrs)


# 171302 08-Jul-2007 simokawa

Fix a bug of retrieving configuration ROM.
- Handle directories and leaves other than unit directories and text leaves
correctly.
- Now we can retrieve CROM of iSight correctly.

Approved by: re (hrs)
Tested by: flz
MFC after: 3 days


# 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.


# 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()


# 169829 21-May-2007 simokawa

Make sure fwsid is not NULL.

MFC after: 3 days


# 169806 21-May-2007 simokawa

MFp4: Simplify the bus probe routin using a kthread.

MFC after: 1 week


# 169131 30-Apr-2007 simokawa

MFp4:
- Update state in fw_xferq_dorain() after removed from the send queue.
- Remove unnecessary 'goto err;".

MFC after: 1 week


# 169130 30-Apr-2007 simokawa

MFp4: Fix broken userland API for async packets.

- Introduce fw_xferlist_add/remove().
- Introduce fw_read/write_async().
- Remove unused FWACT_CH.

MFC after: 1 week


# 169127 30-Apr-2007 simokawa

MFp4: Fix typo in recv spd.

MFC after: 1 week


# 169122 30-Apr-2007 simokawa

MFp4: remove unused fw_asybusy().

MFC after: 1 week


# 169119 30-Apr-2007 simokawa

MFp4: Simplify tlabel handling

- Remove struct tl_label and runtime malloc() for it.
- Include tl_lable list in struct fw_xfer.
- Don't free unallocated tlabel.

MFC after: 1 week


# 169117 30-Apr-2007 simokawa

Initialize configuration ROM before a bus reset.

MFC: after 3 days


# 168051 30-Mar-2007 simokawa

Free tlabel in fw_xfer_done().


# 168050 30-Mar-2007 simokawa

- Don't call fw_busreset() in firewire_attach().
This should fix the problem that the first bus reset is
sometimes ignored because of FWBUSRESET status.

MFC after: 3 days


# 167632 16-Mar-2007 simokawa

Replace xfer->act.hand with xfer->hand.


# 167631 16-Mar-2007 simokawa

Remove retry_count.


# 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.


# 152792 25-Nov-2005 simokawa

Fix panic when we cannot find self-id of probing nodes.
This shouldn't happen as far as the self-id buffer is vaild but
some people have this problem.

PR: kern/83999
Submitted by: Markus Wild <fbsd-lists@dudes.ch>
MFC after: 3 days


# 139749 05-Jan-2005 imp

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


# 139680 04-Jan-2005 jmg

return after freeing data element, instead of falling through, and using
the free'd element, and ultimate NULL deref of the failed allocation.

MFC after: 1 week


# 132771 28-Jul-2004 kan

Avoid casts as lvalues.


# 132199 15-Jul-2004 phk

Do a pass over all modules in the kernel and make them return EOPNOTSUPP
for unknown events.

A number of modules return EINVAL in this instance, and I have left
those alone for now and instead taught MOD_QUIESCE to accept this
as "didn't do anything".


# 130460 14-Jun-2004 dfr

If we run out of transmission labels, just re-queue the packet for later
instead of printing endless error messages on the console and discarding
the packet.


# 129879 30-May-2004 phk

Add missing <sys/module.h> includes


# 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.


# 129274 16-May-2004 dfr

Don't use the node id as an index into the topology map. This breaks
if a node on the bus has more than three ports (like my cheapo six
port hub).


# 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.


# 126102 21-Feb-2004 cperciva

Check that xfer != NULL before dereferencing it, not after.

Reported by: "Ted Unangst" <tedu@coverity.com>
Approved by: rwatson (mentor)


# 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.


# 124251 08-Jan-2004 simokawa

* firewire
Add tcode_str[] and improve debug message.
* sbp
If max_speed is negative, use the maximum speed which the
ohci chip supports. The default max_speed is -1.
* if_fwe
If tx_speed is negative, use the maximum speed which the
ohci chip supports. The default tx_speed is 2.


# 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.


# 122352 09-Nov-2003 tanimura

- Implement selwakeuppri() which allows raising the priority of a
thread being waken up. The thread waken up can run at a priority as
high as after tsleep().

- Replace selwakeup()s with selwakeuppri()s and pass appropriate
priorities.

- Add cv_broadcastpri() which raises the priority of the broadcast
threads. Used by selwakeuppri() if collision occurs.

Not objected in: -arch, -current


# 121505 25-Oct-2003 simokawa

Move validity check of 'xfer->fc != NULL' to right place.


# 121463 24-Oct-2003 simokawa

Don't check timeout just after booted.
Some transactions could be considered wrongly to be timeout
bacause interrupts are disabled during boot process.


# 120850 06-Oct-2003 simokawa

- Introduce hw.firewire.hold_count sysctl MIB by popular demand.

This MIB specifies how many bus resets should be observed before the
lost device entry is removed. The default value is 3.
You can set this value to 0 if you want a SBP device to be detached from CAM
layer as soon as the device is physically detached like USB.


# 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.


# 118455 05-Aug-2003 simokawa

Change device name notation.
- /dev/fw{,mem}X.Y represents the Y'th unit on the X'th bus.
- /dev/fw{,mem}X is an alias of fw{,mem}X.0 for compatibility.
- Clone devices.


# 117732 18-Jul-2003 simokawa

Clean up include files.


# 117716 18-Jul-2003 simokawa

Add some debug messages.


# 117350 09-Jul-2003 simokawa

Configuraiton ROM fix:
- Don't bump the generation if ROM has not changed and keep it
between 0x2 and 0xf.
- Refetch the ROM if CRC of the businfo block has changed.


# 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.


# 116376 15-Jun-2003 simokawa

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


# 115787 03-Jun-2003 simokawa

Allocate zeroed space for fwdev.


# 114909 11-May-2003 simokawa

- Use moderate gap counts listed in IEEE1394a.
- Simplify and correct the bus manager election process.
- Check link_active when choosing cycle master.
- Fix location of the cmr bit.

Approved by: re (scottl)


# 114729 05-May-2003 simokawa

Don't panic for FWXF_START state in fw_xfer_unload().


# 114284 30-Apr-2003 simokawa

Set status to FWDEVINVAL if probe failed.


# 114069 26-Apr-2003 simokawa

- Improve configuration ROM parser for multiple unit directory.
- Remove getcsrdata().
- Don't print device type, this can be obtained by fwcontrol.

Tested with: Maxtor 5000XT
Tested by: Daniel O'Connor <doconnor@gsoft.com.au>


# 113962 24-Apr-2003 simokawa

Fix printf warning for RELENG_4.


# 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


# 112524 24-Mar-2003 simokawa

- The payload of Write Request Quad must be network byte order.


# 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.


# 111615 27-Feb-2003 simokawa

MFp4(simokawa_sbp branch)

Improve SBP device probeing:
- Wait 2 sec before issuing LOGIN ORB expecting the reconnection
hold timer expires.
- Serialize management ORB and scanning LUN by CAM on each target.
This should fix the problem for devices which have multiple LUNs.
Test device is donated by: Jaye Mathisen <mrcpu@internetcds.com>
- Freeze SIM queue for 2 sec after BUS RESET.
- Retry with LOGIN rather than RECONNECT after LOGIN is not completed for
BUS RESET.
- Use appropriate CAM status for BUS RESET and DEVICE RESET.
- Let CAM to scan targets after BUS REST.
- Implement CAM scan target function.
- Keep our own devq freeze count.
- Let CAM to know that SBP does tagged queuing.

These should be merged to RELENG_4 before 4.8-RELEASE.


# 111078 18-Feb-2003 simokawa

Fix fwdev memory leak on detaching.


# 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.


# 111040 17-Feb-2003 simokawa

* firewire.c
- Don't initiate bus reset even if probe failed for some nodes to prevent
infinite bus reset loop.

Problem Reported by: Pierre Beyssac <pb@fasterix.frmug.org>

- Protect timeout routine with splfw() for 4-stable.

* sbp.c

- Make sure to release devq when start request.


# 110891 14-Feb-2003 simokawa

- Increase split transaction timeout from 2 sec to 6 sec.
Problem reported by: Michael Reifenberger <root@nihil.reifenberger.com>

- Improve debug message.


# 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.


# 110582 09-Feb-2003 simokawa

Add new ioctl to specify target EUI64 for fwmem.


# 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.


# 110270 03-Feb-2003 simokawa

Add missing 'static'.


# 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.


# 110179 01-Feb-2003 simokawa

Sort device list by eui64 in acendent order correctly.


# 110072 30-Jan-2003 simokawa

Restart cycle master after bus manager election.
This should fix the IR(and maybe IT) problem when
the host becames the bus manager.
- rename fw_noderesolve() to fw_noderesolve_eui64() and add
fw_noderesolve_nodeid().


# 110016 29-Jan-2003 simokawa

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


# 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.


# 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.


# 109424 17-Jan-2003 simokawa

Replace M_DONTWAIT with M_NOWAIT for malloc().

Pointed out by: nate@root.org


# 109422 17-Jan-2003 simokawa

Fix bus manager election process.
- Lock response 0x3f means that the host becomes the bus manager.
- Add missing htonl().


# 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.


# 109282 15-Jan-2003 simokawa

Add DV_PAL for PAL users.


# 109280 15-Jan-2003 simokawa

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


# 109227 14-Jan-2003 simokawa

Fix for FreeBSD-4.
- Protect whole fw_tbuf_update() with splfw().


# 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.


# 108853 07-Jan-2003 simokawa

Don't call fw_bus_probe() twice when successive self-id packets received.
This change should stabilize SBP-II device probing.


# 108773 06-Jan-2003 simokawa

Fix fc->dev to fc->bdev.


# 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.


# 108281 26-Dec-2002 simokawa

Cosmetic change. s/Firewire/FireWire/.


# 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


# 106815 12-Nov-2002 simokawa

- Remove unused code.
- Fix style.


# 106813 12-Nov-2002 simokawa

Split userland services to fwdev.c.


# 106810 12-Nov-2002 simokawa

Use struct fw_device in fwmem.c
- specify fwmem target by EUI64.
- fw_noderesolve returns struct fw_device rather than dst.
- include struct firewire_comm in struct fw_device.


# 106790 12-Nov-2002 simokawa

- Remove unused code.
- Style fixes.


# 106543 07-Nov-2002 simokawa

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


# 105620 21-Oct-2002 simokawa

fix prototype of asyreqq().


# 103485 17-Sep-2002 ikob

Firewire device support for Apple eMac with PPC kernel.
Contributed by Peter Grehan <grehan@freebsd.org>


# 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.