History log of /freebsd-current/sys/dev/firewire/sbp.c
Revision Date Author Comments
# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 8984411b 09-May-2022 John Baldwin <jhb@FreeBSD.org>

firewire: Remove unused devclass arguments to DRIVER_MODULE.


# 3861bafb 18-Dec-2021 Edward Tomasz Napierala <trasz@FreeBSD.org>

firewire(4): Fix "set but not used" warnings

Sponsored By: EPSRC


# cc384c67 03-Jun-2021 Warner Losh <imp@FreeBSD.org>

cam: prefer cam_sim_softc() over accessing cam_sim structure directly.

Use the accessor function to get the softc for this sim. This also drops
an unneeded cast.

Sponsored by: Netflix
Reviewed by: mav@, hselasky@
Differential Revision: https://reviews.freebsd.org/D30360


# cd853791 27-Nov-2020 Konstantin Belousov <kib@FreeBSD.org>

Make MAXPHYS tunable. Bump MAXPHYS to 1M.

Replace MAXPHYS by runtime variable maxphys. It is initialized from
MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.

Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer
cache buffers exactly to atop(maxbcachebuf) (currently it is sized to
atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1.
The +1 for pbufs allow several pbuf consumers, among them vmapbuf(),
to use unaligned buffers still sized to maxphys, esp. when such
buffers come from userspace (*). Overall, we save significant amount
of otherwise wasted memory in b_pages[] for buffer cache buffers,
while bumping MAXPHYS to desired high value.

Eliminate all direct uses of the MAXPHYS constant in kernel and driver
sources, except a place which initialize maxphys. Some random (and
arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted
straight. Some drivers, which use MAXPHYS to size embeded structures,
get private MAXPHYS-like constant; their convertion is out of scope
for this work.

Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs,
dev/siis, where either submitted by, or based on changes by mav.

Suggested by: mav (*)
Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions)
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27225


# 6f45fadf 23-Nov-2020 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make sbp(4) use xpt_alloc_ccb/xpt_free_ccb instead of malloc/free.

Reviewed by: imp, mav
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26843


# 7029da5c 26-Feb-2020 Pawel Biernacki <kaktus@FreeBSD.org>

Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)

r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE. All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by: kib (mentor, blanket)
Commented by: kib, gallatin, melifaro
Differential Revision: https://reviews.freebsd.org/D23718


# 58aa35d4 03-Feb-2020 Warner Losh <imp@FreeBSD.org>

Remove sparc64 kernel support

Remove all sparc64 specific files
Remove all sparc64 ifdefs
Removee indireeect sparc64 ifdefs


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# 857bb3d0 07-Mar-2017 Andriy Gapon <avg@FreeBSD.org>

firewire/sbp: try to improve locking, plus a few style nits

This change tries to fix the most obvious locking problems.

sbp_cam_scan_lun() is never called with the sbp lock held, so the lock
needs to be acquired internally (if it's needed at all).
Without this change a kernel with INVARIANTS panics when a firewire disk
is connected:
panic: mutex sbp not owned at /usr/src/sys/dev/firewire/sbp.c:967
KDB: stack backtrace:
db_trace_self_wrapper() at 0xffffffff80420bbb = db_trace_self_wrapper+0x2b/frame 0xfffffe0504df0930
kdb_backtrace() at 0xffffffff80670359 = kdb_backtrace+0x39/frame 0xfffffe0504df09e0
vpanic() at 0xffffffff8063986c = vpanic+0x14c/frame 0xfffffe0504df0a20
panic() at 0xffffffff806395b3 = panic+0x43/frame 0xfffffe0504df0a80
__mtx_assert() at 0xffffffff8061c40d = __mtx_assert+0xed/frame 0xfffffe0504df0ac0
sbp_cam_scan_lun() at 0xffffffff80474667 = sbp_cam_scan_lun+0x37/frame 0xfffffe0504df0af0
xpt_done_process() at 0xffffffff802aacfa = xpt_done_process+0x2da/frame 0xfffffe0504df0b30
xpt_done_td() at 0xffffffff802ac2e5 = xpt_done_td+0xd5/frame 0xfffffe0504df0b80
fork_exit() at 0xffffffff805ff72f = fork_exit+0xdf/frame 0xfffffe0504df0bf0
fork_trampoline() at 0xffffffff8082483e = fork_trampoline+0xe/frame
0xfffffe0504df0bf0
--- trap 0, rip = 0, rsp = 0, rbp = 0 ---

Also, I tried to reduce the scope of the sbp lock to avoid holding it
while doing bus_dma allocations.

The code badly needs some re-engineering. SBP really should implement
a CAM transport, so that it avoids control flow inversion when re-scanning
the bus. Also, the sbp lock seems to be too coarse.

Additionally, the commit includes some changes not related to locking.

- sbp_cam_scan_lun: restore CAM_DEV_QFREEZE before re-queueing the ccb
because xpt_setup_ccb resets ccb_h.flags
- sbp_post_busreset: call xpt_release_simq only if it's actually frozen
- don't place private SIMQ_FREEZED flag (sic, "freezed") into sim->flags,
use sbp->flags for that
- some style fixes and control flow enhancements

Reviewed by: sbruno
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D9898


# 0e672f79 27-Feb-2017 Alexander Motin <mav@FreeBSD.org>

Add safety check against too long CDB.

SBP-2 specification defined maximum CDB length as 12 bytes. Newer SBP-3
specification allows CDB of any size, but this driver is too old. Proper
solution would be to look on maximal ORB size supported by the target.

MFC after: 1 week


# d3c06026 04-Jan-2017 Ravi Pokala <rpokala@FreeBSD.org>

In the same vein as r311350, fix whitespace in handling of XPT_PATH_INQ in
several more drivers.

Sponsored by: Panasas


# 4195c7de 04-Jan-2017 Alan Somers <asomers@FreeBSD.org>

Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name)

The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq are
fixed-length strings. AFAICT the only place they're read is in
sbin/camcontrol/camcontrol.c, which assumes they'll be null-terminated.
However, the kernel doesn't null-terminate them. A bunch of copy-pasted code
uses strncpy to write them, and doesn't guarantee null-termination. For at
least 4 drivers (mpr, mps, ciss, and hyperv), the hba_vid field actually
overflows. You can see the result by doing "camcontrol negotiate da0 -v".

This change null-terminates those fields everywhere they're set in the
kernel. It also shortens a few strings to ensure they'll fit within the
16-character field.

PR: 215474
Reported by: Coverity
CID: 1009997 1010000 1010001 1010002 1010003 1010004 1010005
CID: 1331519 1010006 1215097 1010007 1288967 1010008 1306000
CID: 1211924 1010009 1010010 1010011 1010012 1010013 1010014
CID: 1147190 1010017 1010016 1010018 1216435 1010020 1010021
CID: 1010022 1009666 1018185 1010023 1010025 1010026 1010027
CID: 1010028 1010029 1010030 1010031 1010033 1018186 1018187
CID: 1010035 1010036 1010042 1010041 1010040 1010039
Reviewed by: imp, sephe, slm
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9037
Differential Revision: https://reviews.freebsd.org/D9038


# 85c9dd9d 21-Nov-2014 Steven Hartland <smh@FreeBSD.org>

Prevent overflow issues in timeout processing

Previously, any timeout value for which (timeout * hz) will overflow the
signed integer, will give weird results, since callout(9) routines will
convert negative values of ticks to '1'. For unsigned integer overflow we
will get sufficiently smaller timeout values than expected.

Switch from callout_reset, which requires conversion to int based ticks
to callout_reset_sbt to avoid this.

Also correct isci to correctly resolve ccb timeout.

This was based on the original work done by Eygene Ryabinkin
<rea@freebsd.org> back in 5 Aug 2011 which used a macro to help avoid
the overlow.

Differential Revision: https://reviews.freebsd.org/D1157
Reviewed by: mav, davide
MFC after: 1 month
Sponsored by: Multiplay


# 23667f08 27-Sep-2014 Alexander Kabaev <kan@FreeBSD.org>

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


# 138ebd1b 18-Sep-2014 Will Andrews <will@FreeBSD.org>

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


# af3b2549 27-Jun-2014 Hans Petter Selasky <hselasky@FreeBSD.org>

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


# 37a107a4 27-Jun-2014 Glen Barber <gjb@FreeBSD.org>

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


# 3da1cf1e 27-Jun-2014 Hans Petter Selasky <hselasky@FreeBSD.org>

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


# 2d5d61a4 19-Jun-2014 Alexander Kabaev <kan@FreeBSD.org>

Set target->sbp field to valid value when sbp device is created.

The sbp_cam_detach_target can be called from sbp_post_explore function
on the first target that is not really attached and it was written with
the corresponding safety check in place to tolerate that. Unfortunately
the recent locking cleanup did add a locking assertion that tries to
dereference the target->sbp pointer unconditionally, which causes less
than desirable outcome. Since the assertion is useful, just initialize
the target sbp pointer once when sbp device is being initialized instead
of when the target is being attached. This makes assertion work in all
cases and fixes the crash on boot.


# 2cc18341 27-May-2014 John Baldwin <jhb@FreeBSD.org>

Various cleanups and fixes:
- Switch from timeout() to callout_*() for per-request timers.
- Use device_find_child() in the identify routine.
- Use device_printf() instead of passing device_get_nameunit() to
printf().
- Expand the SBP_LOCK coverage simplifying the locking.
- Uninline STAILQ_FOREACH_SAFE().

Tested by: sbruno


# 73aa8b9a 16-May-2014 Christian Brueffer <brueffer@FreeBSD.org>

Remove some unused variables.

Found with: Clang Static Analyzer
MFC after: 2 weeks


# 7a22215c 30-Nov-2013 Eitan Adler <eadler@FreeBSD.org>

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


# 123055f0 30-Oct-2013 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Adjust various SCSI drivers to handle either a 32-bit or 64-bit lun_id_t,
mostly by adjustments to debugging printf() format specifiers. For high
numbered LUNs, also switch to printing them in hex as per SAM-5.

MFC after: 2 weeks


# eb8a7632 25-Sep-2013 Scott Long <scottl@FreeBSD.org>

Re-do r255853. Along with adding back the API/ABI changes from the
original, this hides the contents of cam_compat.h from ktrace/kdump/truss,
avoiding problems there. There are no user-servicable parts in there, so
no need for those tools to be groping around in there.

Approved by: re


# 0082e54e 24-Sep-2013 Glen Barber <gjb@FreeBSD.org>

Revert r255853 pending fixes to build errors in usr.bin/kdump

Approved by: re (implicit)


# 18588425 24-Sep-2013 Scott Long <scottl@FreeBSD.org>

Update the CAM API for FreeBSD 10:

- Remove the timeout_ch field. It's been deprecated since FreeBSD 7.0;
MPSAFE drivers should be managing their own timeout storage. The
remaining non-MPSAFE drivers have been modified to also manage their own
storage, and should be considered for updating to MPSAFE (or removal)
during the FreeBSD 10.x lifecycle.

- Add fields related to soft timeouts and quality of service, to be used
in upcoming work.

- Add room for more flags in the CCB header and path_inq structures.

- Begin support for extended 64-bit LUNs.

- Bump the CAM version number to 0x18, but add compat shims. Tested with
camcontrol and smartctl.

Reviewed by: nathanw, ken, kib
Approved by: re
Obtained from: Netflix


# e5dfa058 14-Apr-2013 Alexander Motin <mav@FreeBSD.org>

MFprojects/camlock r248982:
Stop abusing xpt_periph in random plases that really have no periph related
to CCB, for example, bus scanning. NULL value is fine in such cases and it
is correctly logged in debug messages as "noperiph". If at some point we
need some real XPT periphs (alike to pmpX now), quite likely they will be
per-bus, and not a single global instance as xpt_periph now.


# e7599006 21-Feb-2013 Warner Losh <imp@FreeBSD.org>

bus_dmamap_load_ccb doesn't exist on earlier versions of FreeBSD or
DragonFlyBSD, so it certainly doesn't need splsoftvm(). Remove it.

# I doubt this driver will now compile on older FreeBSD versions or DFBSD
# We should consider unifdefing it since that code seems unmaintained.


# dd0b4fb6 12-Feb-2013 Konstantin Belousov <kib@FreeBSD.org>

Reform the busdma API so that new types may be added without modifying
every architecture's busdma_machdep.c. It is done by unifying the
bus_dmamap_load_buffer() routines so that they may be called from MI
code. The MD busdma is then given a chance to do any final processing
in the complete() callback.

The cam changes unify the bus_dmamap_load* handling in cam drivers.

The arm and mips implementations are updated to track virtual
addresses for sync(). Previously this was done in a type specific
way. Now it is done in a generic way by recording the list of
virtuals in the map.

Submitted by: jeff (sponsored by EMC/Isilon)
Reviewed by: kan (previous version), scottl,
mjacob (isp(4), no objections for target mode changes)
Discussed with: ian (arm changes)
Tested by: marius (sparc64), mips (jmallet), isci(4) on x86 (jharris),
amd64 (Fabian Keil <freebsd-listen@fabiankeil.de>)


# 6472ac3d 07-Nov-2011 Ed Schouten <ed@FreeBSD.org>

Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.

The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.


# d745c852 06-Nov-2011 Ed Schouten <ed@FreeBSD.org>

Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.

This means that their use is restricted to a single C file.


# 1cc052e8 03-Oct-2011 Kenneth D. Merry <ken@FreeBSD.org>

Add descriptor sense support to CAM, and honor sense residuals properly in
CAM.

Desriptor sense is a new sense data format that originated in SPC-3. Among
other things, it allows for an 8-byte info field, which is necessary to
pass back block numbers larger than 4 bytes.

This change adds a number of new functions to scsi_all.c (and therefore
libcam) that abstract out most access to sense data.

This includes a bump of CAM_VERSION, because the CCB ABI has changed.
Userland programs that use the CAM pass(4) driver will need to be
recompiled.

camcontrol.c: Change uses of scsi_extract_sense() to use
scsi_extract_sense_len().

Use scsi_get_sks() instead of accessing sense key specific
data directly.

scsi_modes: Update the control mode page to the latest version (SPC-4).

scsi_cmds.c,
scsi_target.c: Change references to struct scsi_sense_data to struct
scsi_sense_data_fixed. This should be changed to allow the
user to specify fixed or descriptor sense, and then use
scsi_set_sense_data() to build the sense data.

ps3cdrom.c: Use scsi_set_sense_data() instead of setting sense data
manually.

cam_periph.c: Use scsi_extract_sense_len() instead of using
scsi_extract_sense() or accessing sense data directly.

cam_ccb.h: Bump the CAM_VERSION from 0x15 to 0x16. The change of
struct scsi_sense_data from 32 to 252 bytes changes the
size of struct ccb_scsiio, but not the size of union ccb.
So the version must be bumped to prevent structure
mis-matches.

scsi_all.h: Lots of updated SCSI sense data and other structures.

Add function prototypes for the new sense data functions.

Take out the inline implementation of scsi_extract_sense().
It is now too large to put in a header file.

Add macros to calculate whether fields are present and
filled in fixed and descriptor sense data

scsi_all.c: In scsi_op_desc(), allow the user to pass in NULL inquiry
data, and we'll assume a direct access device in that case.

Changed the SCSI RESERVED sense key name and description
to COMPLETED, as it is now defined in the spec.

Change the error recovery action for a number of read errors
to prevent lots of retries when the drive has said that the
block isn't accessible. This speeds up reconstruction of
the block by any RAID software running on top of the drive
(e.g. ZFS).

In scsi_sense_desc(), allow for invalid sense key numbers.
This allows calling this routine without checking the input
values first.

Change scsi_error_action() to use scsi_extract_sense_len(),
and handle things when invalid asc/ascq values are
encountered.

Add a new routine, scsi_desc_iterate(), that will call the
supplied function for every descriptor in descriptor format
sense data.

Add scsi_set_sense_data(), and scsi_set_sense_data_va(),
which build descriptor and fixed format sense data. They
currently default to fixed format sense data.

Add a number of scsi_get_*() functions, which get different
types of sense data fields from either fixed or descriptor
format sense data, if the data is present.

Add a number of scsi_*_sbuf() functions, which print
formatted versions of various sense data fields. These
functions work for either fixed or descriptor sense.

Add a number of scsi_sense_*_sbuf() functions, which have a
standard calling interface and print the indicated field.
These functions take descriptors only.

Add scsi_sense_desc_sbuf(), which will print a formatted
version of the given sense descriptor.

Pull out a majority of the scsi_sense_sbuf() function and
put it into scsi_sense_only_sbuf(). This allows callers
that don't use struct ccb_scsiio to easily utilize the
printing routines. Revamp that function to handle
descriptor sense and use the new sense fetching and
printing routines.

Move scsi_extract_sense() into scsi_all.c, and implement it
in terms of the new function, scsi_extract_sense_len().
The _len() version takes a length (which should be the
sense length - residual) and can indicate which fields are
present and valid in the sense data.

Add a couple of new scsi_get_*() routines to get the sense
key, asc, and ascq only.

mly.c: Rename struct scsi_sense_data to struct
scsi_sense_data_fixed.

sbp_targ.c: Use the new sense fetching routines to get sense data
instead of accessing it directly.

sbp.c: Change the firewire/SCSI sense data transformation code to
use struct scsi_sense_data_fixed instead of struct
scsi_sense_data. This should be changed later to use
scsi_set_sense_data().

ciss.c: Calculate the sense residual properly. Use
scsi_get_sense_key() to fetch the sense key.

mps_sas.c,
mpt_cam.c: Set the sense residual properly.

iir.c: Use scsi_set_sense_data() instead of building sense data by
hand.

iscsi_subr.c: Use scsi_extract_sense_len() instead of grabbing sense data
directly.

umass.c: Use scsi_set_sense_data() to build sense data.

Grab the sense key using scsi_get_sense_key().

Calculate the sense residual properly.

isp_freebsd.h: Use scsi_get_*() routines to grab asc, ascq, and sense key
values.

Calculate and set the sense residual.

MFC after: 3 days
Sponsored by: Spectra Logic Corporation


# 0752b99d 11-Mar-2011 Marius Strobl <marius@FreeBSD.org>

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

MFC after: 2 weeks


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 784ae794 29-Mar-2010 Warner Losh <imp@FreeBSD.org>

Cast a bus_size_t to a (size_t) to use %zd specifier. Not quite the
right thing to do, but it is in compat code I don't want to sort out
at the moment.


# 7733cf8f 11-Feb-2010 Matt Jacob <mjacob@FreeBSD.org>

MFC a number of changes from head for ISP (203478,203463,203444,202418,201758,
201408,201325,200089,198822,197373,197372,197214,196162). Since one of those
changes was a semicolon cleanup from somebody else, this touches a lot more.


# c2ede4b3 07-Jan-2010 Martin Blapp <mbr@FreeBSD.org>

Remove extraneous semicolons, no functional changes.

Submitted by: Marc Balmer <marc@msys.ch>
MFC after: 1 week


# f5411317 18-Feb-2009 Sean Bruno <sbruno@FreeBSD.org>

Enhance debugging mode by storing the string "BB:TT:LL" once and use
it instead of overloading sbp_show_sdev_info().

replace calls to printf with calls to device_printf and cleanup debug
messages

Remove a bit of dead, commented out code.

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


# 166366b5 09-Feb-2009 Max Khon <fjoe@FreeBSD.org>

Remove unused variable.

Found with: Coverity Prevent(tm)
CID: 3693


# 3042cc43 01-Feb-2009 Sean Bruno <sbruno@FreeBSD.org>

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


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# b50569b7 16-Jun-2007 Scott Long <scottl@FreeBSD.org>

Prepare for future integration between CAM and newbus. xpt_bus_register
now takes a device_t to be the parent of the bus that is being created.
Most SIMs have been updated with a reasonable argument, but a few exceptions
just pass NULL for now. This argument isn't used yet and the newbus
integration likely won't be ready until after 7.0-RELEASE.


# 99b242f3 15-Jun-2007 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Lock sbp_write_cmd() and ORB_POINTER_ACTIVE flag.
- Remove unnecessary timestamps.
- Return CAM_RESRC_UNAVAIL for ORB shortage.
- Fix a lock problem when doorbell is used.
- Fix a potential bug for unordered execution.


# 9b33b1ab 13-Jun-2007 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Suppress compiler optimization so that orb[1] must be written first.
We may need an explicit memory barrier for other architectures other than i386/amd64.

MFC after: 3 days


# ac2d2894 07-Jun-2007 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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.


# 4930d13c 06-Jun-2007 Andrew Gallatin <gallatin@FreeBSD.org>

Fix a typo to make this file compile


# 9950b741 06-Jun-2007 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# 0892f4c5 30-Apr-2007 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# 2b83592f 15-Apr-2007 Scott Long <scottl@FreeBSD.org>

Remove Giant from CAM. Drivers (SIMs) now register a mutex that CAM will
use to synchornize and protect all data objects that are used for that
SIM. Drivers that are not yet MPSAFE register Giant and operate as
usual. RIght now, no drivers are MPSAFE, though a few will be changed
in the coming week as this work settles down.

The driver API has changed, so all CAM drivers will need to be recompiled.
The userland API has not changed, so tools like camcontrol do not need to
be recompiled.


# 801167a8 15-Mar-2007 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# 976c8ead 15-Mar-2007 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# c6c27382 15-Mar-2007 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Print warning for large DFLTPHYS.


# 31922227 15-Mar-2007 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Support MAXPHYS up to 512KB

- We need at least two OCBs with indirect pointers allocated in a 4KB page.
- SBP_MAXPHYS can increase to 1MB once we separate management OCB/ORB
which usually does not need indirect pointers.
- We have to increase SBP_DMA_SIZE for MAXPHYS larger than 1MB.

MFC after: 3 days


# 4d70511a 27-Feb-2007 John Baldwin <jhb@FreeBSD.org>

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


# bd3fd815 01-Nov-2006 Matt Jacob <mjacob@FreeBSD.org>

2nd and final commit that moves us to CAM_NEW_TRAN_CODE
as the default.

Reviewed by multitudes.


# fa9ed865 30-Oct-2006 Matt Jacob <mjacob@FreeBSD.org>

The first of 3 major steps to move the CAM layer forward to using
the CAM_NEW_TRAN_CODE that has been in the tree for some years now.

This first step consists solely of adding to or correcting
CAM_NEW_TRAN_CODE pieces in the kernel source tree such
that a both a GENERIC (at least on i386) and a LINT build
with CAM_NEW_TRAN_CODE as an option will compile correctly
and run (at least with some the h/w I have).

After a short settle time, the other pieces (making
CAM_NEW_TRAN_CODE the default and updating libcam
and camcontrol) will be brought in.

This will be an incompatible change in that the size of structures
related to XPT_PATH_INQ and XPT_{GET,SET}_TRAN_SETTINGS change
in both size and content. However, basic system operation and
basic system utilities work well enough with this change.

Reviewed by: freebsd-scsi and specific stakeholders


# 09c00166 24-Dec-2005 Tom Rhodes <trhodes@FreeBSD.org>

Make tv_sec a time_t on all platforms but alpha. Brings us more in line with
POSIX. This also makes the struct correct we ever implement an i386-time64
architecture. Not that we need too.

Reviewed by: imp, brooks
Approved by: njl (acpica), des (no objects, touches procfs)
Tested with: make universe


# 098ca2bd 05-Jan-2005 Warner Losh <imp@FreeBSD.org>

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


# e794746d 06-Sep-2004 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Add a missing splx().


# f9d9941f 19-Jul-2004 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# e1ebf690 18-Jun-2004 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Fix the description of hw.firewire.sbp.exclusive_login.

Submitted by: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>


# c2216c0a 15-Jun-2004 Doug Rabson <dfr@FreeBSD.org>

Fix spelling.


# 03161bbc 22-May-2004 Doug Rabson <dfr@FreeBSD.org>

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


# 10d3ed64 26-Mar-2004 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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.


# 11fe2492 08-Jan-2004 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# d09a5d6f 06-Jan-2004 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Remove __P().


# 5b50d9ad 05-Jan-2004 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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.


# 39b2899f 11-Nov-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Improve debug message.


# 4a4bfb08 11-Nov-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Reserve a ocb for management ORB.
- Requeue XPT_SCSI_IO if ocb is short.


# 5414e3cf 11-Nov-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Oops, fix typo in my name.


# 9b86b36d 10-Nov-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Reduce debug message.


# 4a431baa 09-Nov-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

* Improve sbp device probe in boot process.
- Notify BUS RESET to CAM in sbp_attach().
- Use last bus reset time to determine login delay.

Tested by: imura

* Add some sysctl MIB and tunables.


# 97b70925 30-Oct-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Add a new sysctl MIB to control exclusive login.


# 5217c8c2 17-Oct-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Call sbp_reset_start() for mgm timeout.
- Change type of target->luns to allocate an array of LUNs dynamically.
This allows targets to change their number of LUNs after each bus reset.
- Serialize ORB POINTER command for each LUN.
- Improve debug messages.


# cb987496 05-Oct-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Implement sbp_poll() to enable kernel dump on SBP-2 device.


# baaf74b2 05-Oct-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Fix timeout for unodered excution.

In unodered excution case, we cannot detect link-chain end only
by prev == NULL if lastest ORB is executed earlyer than the former
ORBs. Use ORB_LINK_DEAD flag for this case.

- Don't reset agent for management ORB.
- Improve debug messages.

Spotted by: sbp target mode


# c4778b5d 01-Oct-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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.


# 16acf1a3 29-Aug-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Fix byte order of multi-byte scsi_status information.


# 7e711d0d 21-Aug-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Include order bit in sdev->type.


# 3722fcec 31-Jul-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Disable faking T_DIRECT as T_RBC because we have PIM_NO_6_BYTE now.


# 1deac581 28-Jul-2003 Nate Lawson <njl@FreeBSD.org>

Add a PATH_INQ flag, PIM_NO_6_BYTE, which indicates the SIM never wishes to
receive 6 byte commands. Add a check for this flag to da(4) and cd(4) so
that they honor it. This is a quick workaround for many devices (especially
USB) that require da(4) quirks to operate. The more complete approach is
to finish the new transport code which will be aware of the SCSI version a
transport implements.

MFC after: 1 day


# 9547314f 18-Jul-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Clean up include files.


# 4f933468 04-Jul-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Add compatibility for FreeBSD-4.


# f6b1c44d 01-Jul-2003 Scott Long <scottl@FreeBSD.org>

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


# 0d3432ec 15-Jun-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Revert previos change for prior release/branch.


# 2813692c 14-Jun-2003 Nate Lawson <njl@FreeBSD.org>

Merge common XPT_CALC_GEOMETRY functions into a single convenience function.
Devices below may experience a change in geometry.

* Due to a bug, aic(4) never used extended geometry. Changes all drives
>1G to now use extended translation.
* sbp(4) drives exactly 1 GB in size now no longer use extended geometry.
* umass(4) drives exactly 1 GB in size now no longer use extended geometry.

For all other controllers in this commit, this should be a no-op.

Looked over by: scottl


# de7f8045 03-Jun-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Don't call sbp_do_attach() recursively after agent reset
while device probing.


# 96c7c6dd 11-May-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Make it compiled on 4-stable.

Approved by: re (scottl)


# d7398f23 05-May-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Write to RESET_START register if TARGET_RESET ORB doesn't work for timeout.


# eadb8f35 02-May-2003 Jake Burkholder <jake@FreeBSD.org>

Fix printf format errors.


# e47276e5 30-Apr-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Fix printf warning caused by recent CAM change.


# 98465499 30-Apr-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Release devq before detach.


# 45800373 29-Apr-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Add missing crom_next() in the previous revision.


# fd596327 29-Apr-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Get correct firmware/model information for multiple unit directories.


# 5e286c32 26-Apr-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# a2da26fc 24-Apr-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Fix printf warnings for i386 with PAE.

Submitted by: harti


# 77ee030b 16-Apr-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# 050871cc 14-Apr-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Panic if bus_dmamap_load() doesn't respect maxsegsz.


# d067ce20 12-Mar-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Put back including sys/devicestat.h for 4-stable.


# 60794e04 08-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Centralize the devstat handling for all GEOM disk device drivers
in geom_disk.c.

As a side effect this makes a lot of #include <sys/devicestat.h>
lines not needed and some biofinish() calls can be reduced to
biodone() again.


# 0fc9ced0 03-Mar-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Fix printf warning on RELENG_4.


# 46ce9fef 03-Mar-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Simplify ORB queue management.
Don't send doorbell and send ORB pointer only if it's necessary.
This reduces bus traffic and interrupts much.


# 37413f0a 01-Mar-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Don't reset agent before processing OCB has done.


# 45545499 26-Feb-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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.


# 41dc7a98 20-Feb-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Oops, forgot to put back debug level.


# d17c7743 20-Feb-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Don't scan lun by myself while boot process leave it CAM to scan the bus.
Some drives seem to be confused by simultaneous probes.

Tested by: marcel

As a side effect, logical units whose lun is greater than 0 might not be
probed correctly if the lun of 0 doesn't exist in the target because
CAM doesn't scan such luns.
I have a SCSI-FireWire bridge which maps SCSI-ID to LUN and it is an
example of such targets.


# f918ec7b 17-Feb-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# f3d2847d 13-Feb-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Though I got a feedback from the originator of kern/48129 that the
previous revision fixed the panic, I found the problem exits in
another part of the function by investigating the crom dump sent by him.
The search was started in the middle of bus info block and the
routine misunderstood the EUI64 as a crom entry. This problem is fixed.

PR: kern/48129

Fix incorrect type mask included in a logical unit number and check
the validity of the lun.


# 627d85fb 13-Feb-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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.


# 5a8d8970 09-Feb-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Remove unnecessary check for OCB_ACT_CMD.


# a487c0f2 04-Feb-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Improve recovery after timeout.
* reset agent first then reset target.
* untimeout all ccbs.
- Try reconnect first if the device has been seen.
- Fix for ORB_FUN_ATA.


# 48249fe0 03-Feb-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# 5166f1df 01-Feb-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Define new malloc type M_FW and use it.


# 0981f5f0 01-Feb-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# 3c62126d 31-Jan-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Check status FIFO more closely to report error.


# 0db3d163 01-Feb-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Add basic support for device wiring down to specific (CAM)
target id. It still needs to be hard-coded now but will
be changed to be configured by tunables or device hints.


# 64cf5240 31-Jan-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# 9bb3ca03 30-Jan-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

SBP related changes.
- Set dual phase retry BUSY_TIMEOUT.
- Let users to know serial bus error.


# 449e559c 29-Jan-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Handle SCSI_STATUS_BUSY case.


# e715bfae 23-Jan-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Merge little and big endian case.


# 44956c98 21-Jan-2003 Alfred Perlstein <alfred@FreeBSD.org>

Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


# ae8c82bb 17-Jan-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Replace M_DONTWAIT with M_NOWAIT for malloc().

Pointed out by: nate@root.org


# 9a7d0adf 06-Jan-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Fix print format for FreeBSD-4
- Reduce debug message.


# a4239576 05-Jan-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Reduce diff to RELENG_4.


# 9339321d 03-Jan-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# 6faac3ac 01-Jan-2003 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Reduce debug message.


# b018dcd1 31-Dec-2002 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Implement primal Configuration ROM parser.
- Support multiple LUNs for SBP-II.


# ee126d67 25-Dec-2002 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Cosmetic change. s/Firewire/FireWire/.


# f3abec22 25-Dec-2002 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Replace ntohl() with ntohs() because orb_hi is u_int16_t.


# ac9f6692 25-Dec-2002 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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.


# 17c3d42c 05-Dec-2002 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Reduce and improve debug messages.

Approved by: re


# 70ce30b5 06-Nov-2002 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

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


# 1d3e59b1 06-Nov-2002 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

Minor clean up on cdb handling.


# 06a93bac 23-Oct-2002 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Dequeue OCBs more safely in sbp_abort_all_ocbs().


# 8e484a62 21-Oct-2002 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

- Abort all OCBs for timeout.
- Improve warning message.


# ba68cdd3 21-Sep-2002 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

don't include bus_dma.h which doesn't need.


# b24db4dd 21-Sep-2002 Hidetoshi Shimokawa <simokawa@FreeBSD.org>

remove unused code.


# 3c60ba66 12-Sep-2002 Katsushi Kobayashi <ikob@FreeBSD.org>

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