Home | History | Annotate | only in /src/sys/dev/ieee1394
History log of /src/sys/dev/ieee1394
RevisionDateAuthorComments
 1.8 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.7 27-Feb-2005  perry branches: 1.7.4;
nuke trailing whitespace
 1.6 03-Feb-2002  jmc branches: 1.6.16; 1.6.24; 1.6.26;
Change some wording on fw's to make it more logical sounding.
 1.5 24-Aug-2001  wiz heirarchy -> hierarchy
 1.4 13-May-2001  jmc branches: 1.4.2;
Add locators support
 1.3 09-May-2001  augustss Point out where the documentation is wrong.
 1.2 30-Apr-2001  jmc Rework implementation notes/ideas with a more fleshed out example.
 1.1 31-May-2000  matt branches: 1.1.4; 1.1.6; 1.1.8;
random thoughts on how i'm implementing this.
 1.1.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.1.8.2 21-Sep-2001  nathanw Catch up to -current.
 1.1.8.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 31-May-2000  bouyer file IMPLEMENTATION was added on branch thorpej_scsipi on 2000-11-20 11:41:09 +0000
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 31-May-2000  minoura file IMPLEMENTATION was added on branch minoura-xpg4dl on 2000-06-22 17:07:06 +0000
 1.4.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.4.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.6.26.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.24.1 29-Apr-2005  kent sync with -current
 1.6.16.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.16.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.4.1 21-Jun-2006  yamt sync with head.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.3 04-Dec-2002  haya branches: 1.3.6; 1.3.22;
New Feature: add pseudo device for IEEE 1394 isochronous stream and
isochronous reception routine for IEEE 1394 OHCI (fwohci). The
transmission part is under construction.

The minimum configuration options for this feature are:

# IEEE 1394 (i.LINK)
fwohci* at pci? dev ? function ?
pseudo-device fwiso 1
 1.2 11-Apr-2001  jdolecek Only install headers which are actually used by our userland. This
saves about 2.2MB under /usr/include/dev/. Discussed on tech-kern@
recently.

I HOPE to get the list right. The headers I left in are ones
used for MI tools and those whose usage I discovered by grep over tree sources.
Feel free to put needed includes back in if you encounter anything which
should not be removed from lists.
 1.1 30-May-2000  matt branches: 1.1.4; 1.1.6; 1.1.8;
Install ieee1394reg.h since user application (someday) will need it.
 1.1.8.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.8.1 28-Feb-2002  nathanw Catch up to -current.
 1.1.6.3 21-Apr-2001  bouyer Sync with HEAD
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 30-May-2000  bouyer file Makefile was added on branch thorpej_scsipi on 2000-11-20 11:41:09 +0000
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 30-May-2000  minoura file Makefile was added on branch minoura-xpg4dl on 2000-06-22 17:07:06 +0000
 1.3.22.1 21-Jun-2006  yamt sync with head.
 1.3.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.2 27-Feb-2005  perry branches: 1.2.4;
nuke trailing whitespace
 1.1 22-Nov-2002  jmc branches: 1.1.2; 1.1.8; 1.1.16; 1.1.18;
First pass (checkpoint checkin) for firewire scsi code.

There are a number of issues here for anyone trying to use this today:

1. On my test drive the command engine on the drive seems to stall after the
inquire is done. So the mode sense times out for a long time before
aborting. This obviously needs to be tracked down and fixed.

However it does do a proper inquire:

scsibus0 at sbpscsi0: 1 target, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Maxtor, 1394 storage, 60> disk fixed

2. This code is quite ugly in places as debug code was added to test things.
Definitly needs cleanup/documention in places where it's using command
structures. The structure for alloc'ing orbs, running them through the
command engine and getting state back is mostly set but implementation needs
an overhaul in places.

3. For testing I use the following config options:

fwohci* at cardbus? dev ? function ? # IEEE1394 Controller
fw* at fwbus?
options FW_DEBUG
options FWNODE_DEBUG
options P1212_DEBUG
options SBP2_DEBUG
options SBPSCSI_DEBUG
fwnode* at fwbus?
sbpscsi* at fwnode?
scsibus* at sbpscsi?
 1.1.18.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.16.1 29-Apr-2005  kent sync with -current
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 22-Nov-2002  thorpej file NOTES was added on branch nathanw_sa on 2002-12-11 06:38:04 +0000
 1.2.4.1 21-Jun-2006  yamt sync with head.
 1.12 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.11 27-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 19-Dec-2002  jmc branches: 1.10.2; 1.10.10; 1.10.12;
Updates
 1.9 22-Nov-2002  jmc First pass (checkpoint checkin) for firewire scsi code.

There are a number of issues here for anyone trying to use this today:

1. On my test drive the command engine on the drive seems to stall after the
inquire is done. So the mode sense times out for a long time before
aborting. This obviously needs to be tracked down and fixed.

However it does do a proper inquire:

scsibus0 at sbpscsi0: 1 target, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Maxtor, 1394 storage, 60> disk fixed

2. This code is quite ugly in places as debug code was added to test things.
Definitly needs cleanup/documention in places where it's using command
structures. The structure for alloc'ing orbs, running them through the
command engine and getting state back is mostly set but implementation needs
an overhaul in places.

3. For testing I use the following config options:

fwohci* at cardbus? dev ? function ? # IEEE1394 Controller
fw* at fwbus?
options FW_DEBUG
options FWNODE_DEBUG
options P1212_DEBUG
options SBP2_DEBUG
options SBPSCSI_DEBUG
fwnode* at fwbus?
sbpscsi* at fwnode?
scsibus* at sbpscsi?
 1.8 27-Feb-2002  jmc Note done sections related to fwnode/ieee1212 stuff
 1.7 29-Dec-2001  ichiro done - Make fwohci detach correctly (for cardbus/etc type interfaces)
 1.6 17-May-2001  jmc branches: 1.6.2; 1.6.4;
Add a few nits. Hubs seem problematic on resets sometimes.
Also, make sure fwohci can detach cleanly (for cardbus).
 1.5 15-May-2001  jmc Clean up comment about unregistering callbacks
 1.4 13-May-2001  jmc Add locators support
 1.3 11-May-2001  jmc Add some notes
 1.2 01-May-2001  jmc Add a few more items
 1.1 30-Apr-2001  jmc First pass at the overall TODO list. Some of these may come off before I get the full code checked in even
 1.6.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.6.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.6 29-Dec-2002  thorpej Sync with HEAD.
 1.6.2.5 11-Dec-2002  thorpej Sync with HEAD.
 1.6.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.6.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.6.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.6.2.1 17-May-2001  nathanw file TODO was added on branch nathanw_sa on 2001-06-21 20:03:36 +0000
 1.10.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.10.1 29-Apr-2005  kent sync with -current
 1.10.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.4.1 21-Jun-2006  yamt sync with head.
 1.11 24-Apr-2021  thorpej Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.10 30-Apr-2006  kiyohara branches: 1.10.168;
Indented.
 1.9 11-Dec-2005  christos branches: 1.9.4; 1.9.6; 1.9.8; 1.9.10; 1.9.12;
merge ktrace-lwp.
 1.8 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.7 22-Nov-2002  jmc branches: 1.7.6; 1.7.22;
First pass (checkpoint checkin) for firewire scsi code.

There are a number of issues here for anyone trying to use this today:

1. On my test drive the command engine on the drive seems to stall after the
inquire is done. So the mode sense times out for a long time before
aborting. This obviously needs to be tracked down and fixed.

However it does do a proper inquire:

scsibus0 at sbpscsi0: 1 target, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Maxtor, 1394 storage, 60> disk fixed

2. This code is quite ugly in places as debug code was added to test things.
Definitly needs cleanup/documention in places where it's using command
structures. The structure for alloc'ing orbs, running them through the
command engine and getting state back is mostly set but implementation needs
an overhaul in places.

3. For testing I use the following config options:

fwohci* at cardbus? dev ? function ? # IEEE1394 Controller
fw* at fwbus?
options FW_DEBUG
options FWNODE_DEBUG
options P1212_DEBUG
options SBP2_DEBUG
options SBPSCSI_DEBUG
fwnode* at fwbus?
sbpscsi* at fwnode?
scsibus* at sbpscsi?
 1.6 27-Feb-2002  jmc Rototill fwnode.c to rely on the p1212 routines to parse and validate the ROM
 1.5 13-May-2001  jmc branches: 1.5.2;
Add locators support
 1.4 01-May-2001  jmc Put in the structure for fwnode/fwscsi
 1.3 24-Feb-2001  lukem branches: 1.3.2;
whitespace police
 1.2 14-Nov-2000  matt branches: 1.2.2;
Add a fwlynx device. Move the file for fwohci to files.ieee1394
 1.1 05-Nov-2000  onoe First Prototype implementation of network interface part for IEEE1394 (if_fw).

Current status:
Only OHCI chip is supported (fwohci).
ping (IPv4) works with Sony's implementation (SmartConnect) on Win98.
sometimes works but not stable.
Not implemented yet:
IRM (Isochronous Resource Manager) functionality.
Link layer fragmentation.
Topology map.
More to do:
clean ups
MCAP
charactor device part
dhcp

There is no entry in GENERIC config file yet.
Follow sys/dev/ieee1394/IMPLEMENTATION to enable if_fw.
 1.2.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.2.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.2.2.1 14-Nov-2000  bouyer file files.ieee1394 was added on branch thorpej_scsipi on 2000-11-22 16:03:40 +0000
 1.3.2.3 11-Dec-2002  thorpej Sync with HEAD.
 1.3.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.3.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.7.22.1 21-Jun-2006  yamt sync with head.
 1.7.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.9.10.1 11-May-2006  elad sync with head
 1.9.8.1 24-May-2006  yamt sync with head.
 1.9.6.1 01-Jun-2006  kardel Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.10.168.1 22-Mar-2021  thorpej sbp does not need its own (unused) interface attribute; it already
carries the "scsi" interface attribute.
 1.55 22-May-2022  andvar fix various small typos, mainly in comments.
 1.54 20-Dec-2021  riastradh ieee1394: Need kernel lock around config_found.
 1.53 04-Oct-2021  andvar follow fcambus steps by fixing typos for "unknown" in few more error messages.
 1.52 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.51 24-Apr-2021  thorpej branches: 1.51.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.50 10-Nov-2019  chs branches: 1.50.10;
in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.49 15-Oct-2019  msaitoh Use unsigned to avoid undefined behavior. Found by kUBSan.
 1.48 03-Sep-2018  riastradh branches: 1.48.4;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.47 20-Nov-2016  riastradh branches: 1.47.14; 1.47.16;
Kill some more tsleep.

And no, surrounding tsleep by mutex_exit/mutex_enter does not fix
problems even if the LOCKDEBUG panic symptom goes away...
 1.46 20-Nov-2016  riastradh Defer initialization of isodma channels until we know how many.

Should fix a bug I introduced four years ago in:
https://mail-index.netbsd.org/source-changes/2012/08/04/msg036211.html
 1.45 18-Oct-2014  snj branches: 1.45.2; 1.45.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.44 25-Feb-2014  pooka Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.43 12-Oct-2013  christos Pass the device name in, so we can debug what deferred drivers did not work.
 1.42 05-Aug-2012  riastradh branches: 1.42.2; 1.42.4;
...and be sure to config_pending_decr if kthread_create fails.

This error branch looks suspect, though. Shouldn't we bail at this
point rather than blithely try to proceed?
 1.41 05-Aug-2012  riastradh Restore config pending stuff, adjusted to avoid the race.

Leave a note about what this code probably should look like for
anyone who comes rummaging around with the intent to really fix it.
I would do that myself if I had time and resources to test this at
the moment, and more comfort with our firewire stack, but I don't.
 1.40 04-Aug-2012  riastradh Fix error branches and config pending races in firewire init.

This way, if anything fails, it just fails; you don't panic. This can
happen if suspending and resuming of firewire is broken (e.g., as I
encountered in PR kern/44581).
 1.39 29-Apr-2012  dsl Change to consistently use M_FW for all malloc/free.
It probably doesn't matter any more, but the code doesn't appear to
have matched its mallocs and frees - so the stats would have been awol.
 1.38 07-Sep-2010  cegger branches: 1.38.8; 1.38.12;
do not assume all fw devices speak sbp.
teach the fw attach code to deal with different fw device classes.
this allows other fw drivers than sbp to attach
 1.37 26-Aug-2010  cegger fix crash when detaching/re-attaching a cable where three firewire devices are on the bus.
 1.36 14-Aug-2010  jym Fix some code paths where pointers are dereferenced after checking that
they are NULL (oops?)

XXX pull-ups for NetBSD-4 and NetBSD-5.
 1.35 23-May-2010  christos Revert all previous kmem_ commits. This needs to be done in a different way
because we cannot call kmem_ from an interrupt context. I opened PR/43341 for
it.
 1.34 23-May-2010  christos don't allocate rom scratch memory from an interrupt context:

fwohci0: BUS reset
panic: kernel diagnostic assertion "!cpu_intr_p()" failed: file "../../../../ker
n/subr_kmem.c", line 195
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip ffffffff8022db1d cs 8 rflags 246 cr2 0 cpl 6 rsp fffffff
f80fafb08
breakpoint() at netbsd:breakpoint+0x5
panic() at netbsd:panic+0x2ba
kern_assert() at netbsd:kern_assert+0x2d
kmem_alloc() at netbsd:kmem_alloc+0x18a
kmem_zalloc() at netbsd:kmem_zalloc+0xf
fw_busreset() at netbsd:fw_busreset+0x23b
fwohci_intr() at netbsd:fwohci_intr+0xa56
...
 1.33 15-May-2010  kiyohara Add mutex.h.
 1.32 14-May-2010  kiyohara May be easy to understand 'pay_len > 0' more than 'paylaod != NULL'.
 1.31 10-May-2010  kiyohara Use kmem(9) instead of malloc(9).
 1.30 06-Apr-2010  reinoud KASSERT(FALSE) to enter the debugger on this check. When DDB is not defined
but KGDB is, this would result in cpu_Debugger() dont being defined! Please be
kind to developers that use KGDB instead of DDB! :)
 1.29 29-Mar-2010  kiyohara Remove more my debugging code.
 1.28 29-Mar-2010  kiyohara Remove debugging process.
 1.27 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.26 11-Mar-2010  mrg branches: 1.26.2;
various aprint_* fixes.
 1.25 12-May-2009  cegger branches: 1.25.2;
struct cfdata * -> cfdata_t, no functional changes intended.
 1.24 18-Mar-2009  cegger bzero -> memset
 1.23 18-Mar-2009  cegger bcmp -> memcmp
 1.22 12-Nov-2008  ad branches: 1.22.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.21 10-May-2008  jmcneill branches: 1.21.4; 1.21.6;
Use aprint
 1.20 29-Mar-2008  kiyohara branches: 1.20.2; 1.20.4; 1.20.6;
Split device_t/softc.
And cosmetic change.
 1.19 15-Dec-2007  perry branches: 1.19.6;
__FUNCTION__ -> __func__
 1.18 11-Dec-2007  lukem use __KERNEL_RCSID()
 1.17 09-Dec-2007  jmcneill branches: 1.17.2;
Merge jmcneill-pm branch.
 1.16 05-Nov-2007  kiyohara branches: 1.16.4; 1.16.6;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.15 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.14 09-Jul-2007  ad branches: 1.14.6; 1.14.8; 1.14.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.13 21-Apr-2007  kiyohara firewire.c sync to Rev.1.86 for FreeBSD.
firewirereg.h sync to Rev.1.41 for FreeBSD.
fwcrom.c sync to Rev.1.14 for FreeBSD.
fwdev.c sync to Rev.1.49 for FreeBSD.
fwmem.c sync to Rev.1.32 for FreeBSD.
fwohci.c sync to Rev.1.86 for FreeBSD.
fwohcivar.h sync to Rev.1.15 for FreeBSD.
if_fwip.c sync to Rev.1.14 for FreeBSD.
if_fwipvar.h sync to Rev.1.4 for FreeBSD.
sbp.c sync to Rev.1.89 for FreeBSD.
 1.12 04-Mar-2007  christos branches: 1.12.2; 1.12.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 16-Nov-2006  christos branches: 1.11.4;
__unused removal on arguments; approved by core.
 1.10 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.9 26-Sep-2006  kiyohara Fix device name in {fwohci,firewire}_print(). valiable aux is not string
pointer.
 1.8 13-Jun-2006  christos branches: 1.8.4; 1.8.8; 1.8.10;
Don't allocate > 1K on the stack
 1.7 14-Apr-2006  christos branches: 1.7.2;
Coverity CID 1118: Protect NULL deref.
 1.6 21-Mar-2006  yamt fw_bus_probe_thread: change wmesg from "-" to "fwprobe".
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.6; 1.5.8; 1.5.10; 1.5.12;
merge ktrace-lwp.
 1.4 26-Aug-2005  drochner branches: 1.4.6;
kill some more simple submatch() functions, use config_stdsubmatch()
 1.3 25-Aug-2005  drochner replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
 1.2 20-Jul-2005  drochner minor cleanup: some "const", global namespace sanity and fix a maclo name
 1.1 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.4.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.6.1 26-Aug-2005  skrll file firewire.c was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.5.12.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.12.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.5.10.1 19-Apr-2006  elad sync with head.
 1.5.8.3 26-Jun-2006  yamt sync with head.
 1.5.8.2 24-May-2006  yamt sync with head.
 1.5.8.1 01-Apr-2006  yamt sync with head.
 1.5.6.1 22-Apr-2006  simonb Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.7.2.1 19-Jun-2006  chap Sync with head.
 1.8.10.2 10-Dec-2006  yamt sync with head.
 1.8.10.1 22-Oct-2006  yamt sync with head
 1.8.8.1 18-Nov-2006  ad Sync with head.
 1.8.4.7 21-Jan-2008  yamt sync with head
 1.8.4.6 15-Nov-2007  yamt sync with head.
 1.8.4.5 27-Oct-2007  yamt sync with head.
 1.8.4.4 03-Sep-2007  yamt sync with head.
 1.8.4.3 30-Dec-2006  yamt sync with head.
 1.8.4.2 21-Jun-2006  yamt sync with head.
 1.8.4.1 13-Jun-2006  yamt file firewire.c was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.11.4.2 07-May-2007  yamt sync with head.
 1.11.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.4.1 11-Jul-2007  mjf Sync with head.
 1.12.2.3 23-Oct-2007  ad Sync with head.
 1.12.2.2 27-May-2007  ad Sync with head.
 1.12.2.1 09-Apr-2007  ad - Add two new arguments to kthread_create1: pri_t pri, bool mpsafe.
- Fork kthreads off proc0 as new LWPs, not new processes.
 1.14.12.2 13-Nov-2007  bouyer Sync with HEAD
 1.14.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.14.8.2 09-Jan-2008  matt sync with HEAD
 1.14.8.1 06-Nov-2007  matt sync with HEAD
 1.14.6.4 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.14.6.3 14-Nov-2007  joerg Convert to suspend/resume framework. Not fully functional, but a start.
 1.14.6.2 06-Nov-2007  joerg Sync with HEAD.
 1.14.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.16.6.1 11-Dec-2007  yamt sync with head.
 1.16.4.1 26-Dec-2007  ad Sync with head.
 1.17.2.2 02-Jan-2008  bouyer Sync with HEAD
 1.17.2.1 13-Dec-2007  bouyer Sync with HEAD
 1.19.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.19.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.19.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.20.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.20.4.5 09-Oct-2010  yamt sync with head
 1.20.4.4 11-Aug-2010  yamt sync with head.
 1.20.4.3 16-May-2009  yamt sync with head
 1.20.4.2 04-May-2009  yamt sync with head.
 1.20.4.1 16-May-2008  yamt sync with head.
 1.20.2.1 18-May-2008  yamt sync with head.
 1.21.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.21.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.22.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.25.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.25.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.26.2.2 05-Mar-2011  rmind sync with head
 1.26.2.1 30-May-2010  rmind sync with head
 1.38.12.1 29-Apr-2012  mrg sync to latest -current.
 1.38.8.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.38.8.2 30-Oct-2012  yamt sync with head
 1.38.8.1 23-May-2012  yamt sync with head.
 1.42.4.1 18-May-2014  rmind sync with head
 1.42.2.2 03-Dec-2017  jdolecek update from HEAD
 1.42.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.45.4.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.45.2.1 05-Dec-2016  skrll Sync with HEAD
 1.47.16.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.47.16.1 10-Jun-2019  christos Sync with HEAD
 1.47.14.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.48.4.1 31-Jan-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #671):

sys/dev/pci/if_bce.c: revision 1.53
sys/dev/pci/pccbbreg.h: revision 1.16
sys/dev/ic/rt2860.c: revision 1.34
sys/dev/pci/if_alc.c: revision 1.45
sys/dev/pci/if_mcx.c: revision 1.5
sys/dev/pci/if_pcn.c: revision 1.72
sys/dev/pci/if_ale.c: revision 1.37
sys/dev/pci/if_age.c: revision 1.65
sys/dev/ieee1394/fwohcireg.h: revision 1.20
sys/dev/ieee1394/fwohci.c: revision 1.143
sys/dev/ieee1394/firewire.c: revision 1.49
sys/dev/ic/am79900reg.h: revision 1.10

Use unsigned to avoid undefined behavior. Found by kUBSan.
 1.50.10.3 22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.50.10.2 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.50.10.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.51.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.7 12-Apr-2021  mrg convert union member from [0] array to [3] array, so that attempts
to access these members later will work.

does not affect size of the structure or layout in any other way.
 1.6 14-Nov-2010  uebayasi branches: 1.6.76;
Include dependencies directly.
 1.5 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.4 05-Nov-2007  kiyohara branches: 1.4.20; 1.4.40; 1.4.42;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.3 16-Nov-2006  jdolecek branches: 1.3.22; 1.3.24; 1.3.28;
make the struct fw_crom_buf's len uint32_t, so that it can never be negative
the real fix to
http://archives.neohapsis.com/archives/fulldisclosure/2006-11/0261.html
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.22; 1.2.24;
merge ktrace-lwp.
 1.1 11-Jul-2005  kiyohara branches: 1.1.6;
ieee1394 import from FreeBSD.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file firewire.h was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.2.24.1 10-Dec-2006  yamt sync with head.
 1.2.22.1 18-Nov-2006  ad Sync with head.
 1.2.18.4 15-Nov-2007  yamt sync with head.
 1.2.18.3 30-Dec-2006  yamt sync with head.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file firewire.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.3.28.1 13-Nov-2007  bouyer Sync with HEAD
 1.3.24.1 06-Nov-2007  matt sync with HEAD
 1.3.22.1 06-Nov-2007  joerg Sync with HEAD.
 1.4.42.2 05-Mar-2011  rmind sync with head
 1.4.42.1 30-May-2010  rmind sync with head
 1.4.40.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.4.20.1 11-Aug-2010  yamt sync with head.
 1.6.76.1 17-Apr-2021  thorpej Sync with HEAD.
 1.3 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.76; 1.2.98; 1.2.100;
merge ktrace-lwp.
 1.1 11-Jul-2005  kiyohara branches: 1.1.6;
ieee1394 import from FreeBSD.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file firewire_phy.h was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.2.100.1 30-May-2010  rmind sync with head
 1.2.98.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.2.76.1 11-Aug-2010  yamt sync with head.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file firewire_phy.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.20 20-Nov-2016  riastradh Kill some more tsleep.

And no, surrounding tsleep by mutex_exit/mutex_enter does not fix
problems even if the LOCKDEBUG panic symptom goes away...
 1.19 20-Nov-2016  riastradh Defer initialization of isodma channels until we know how many.

Should fix a bug I introduced four years ago in:
https://mail-index.netbsd.org/source-changes/2012/08/04/msg036211.html
 1.18 04-Aug-2012  riastradh branches: 1.18.2; 1.18.16; 1.18.20;
Fix error branches and config pending races in firewire init.

This way, if anything fails, it just fails; you don't panic. This can
happen if suspending and resuming of firewire is broken (e.g., as I
encountered in PR kern/44581).
 1.17 29-Apr-2012  dsl Change to consistently use M_FW for all malloc/free.
It probably doesn't matter any more, but the code doesn't appear to
have matched its mallocs and frees - so the stats would have been awol.
 1.16 24-Apr-2011  rmind branches: 1.16.4; 1.16.8;
Inclusion for malloc decls (missed in previous commit).
 1.15 14-Nov-2010  uebayasi branches: 1.15.2;
Include dependencies directly.
 1.14 07-Sep-2010  cegger do not assume all fw devices speak sbp.
teach the fw attach code to deal with different fw device classes.
this allows other fw drivers than sbp to attach
 1.13 23-May-2010  christos Revert all previous kmem_ commits. This needs to be done in a different way
because we cannot call kmem_ from an interrupt context. I opened PR/43341 for
it.
 1.12 23-May-2010  christos don't allocate rom scratch memory from an interrupt context:

fwohci0: BUS reset
panic: kernel diagnostic assertion "!cpu_intr_p()" failed: file "../../../../ker
n/subr_kmem.c", line 195
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip ffffffff8022db1d cs 8 rflags 246 cr2 0 cpl 6 rsp fffffff
f80fafb08
breakpoint() at netbsd:breakpoint+0x5
panic() at netbsd:panic+0x2ba
kern_assert() at netbsd:kern_assert+0x2d
kmem_alloc() at netbsd:kmem_alloc+0x18a
kmem_zalloc() at netbsd:kmem_zalloc+0xf
fw_busreset() at netbsd:fw_busreset+0x23b
fwohci_intr() at netbsd:fwohci_intr+0xa56
...
 1.11 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.10 20-Jun-2009  dyoung branches: 1.10.2; 1.10.4;
unifdef -U__DragonFlyBSD__ -U__FreeBSD__ -D__NetBSD__.

XXX Compiles, but untested.
 1.9 20-Jun-2009  cegger buildfix: don't redefine MIN and MAX. They are defined in <sys/param.h>.
 1.8 29-Mar-2008  kiyohara branches: 1.8.4; 1.8.18;
Split device_t/softc.
And cosmetic change.
 1.7 05-Nov-2007  kiyohara branches: 1.7.16;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.6 29-Jul-2007  ad branches: 1.6.4; 1.6.6; 1.6.10; 1.6.12;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.5 21-Apr-2007  kiyohara branches: 1.5.2;
firewire.c sync to Rev.1.86 for FreeBSD.
firewirereg.h sync to Rev.1.41 for FreeBSD.
fwcrom.c sync to Rev.1.14 for FreeBSD.
fwdev.c sync to Rev.1.49 for FreeBSD.
fwmem.c sync to Rev.1.32 for FreeBSD.
fwohci.c sync to Rev.1.86 for FreeBSD.
fwohcivar.h sync to Rev.1.15 for FreeBSD.
if_fwip.c sync to Rev.1.14 for FreeBSD.
if_fwipvar.h sync to Rev.1.4 for FreeBSD.
sbp.c sync to Rev.1.89 for FreeBSD.
 1.4 04-Mar-2007  christos branches: 1.4.2; 1.4.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.3 11-Dec-2005  christos branches: 1.3.18; 1.3.28;
merge ktrace-lwp.
 1.2 20-Jul-2005  drochner branches: 1.2.6;
minor cleanup: some "const", global namespace sanity and fix a maclo name
 1.1 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 20-Jul-2005  skrll file firewirereg.h was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.3.28.2 07-May-2007  yamt sync with head.
 1.3.28.1 12-Mar-2007  rmind Sync with HEAD.
 1.3.18.4 15-Nov-2007  yamt sync with head.
 1.3.18.3 03-Sep-2007  yamt sync with head.
 1.3.18.2 21-Jun-2006  yamt sync with head.
 1.3.18.1 11-Dec-2005  yamt file firewirereg.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.4.4.1 11-Jul-2007  mjf Sync with head.
 1.4.2.2 20-Aug-2007  ad Sync with HEAD.
 1.4.2.1 27-May-2007  ad Sync with head.
 1.5.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.6.12.2 29-Jul-2007  ad It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.6.12.1 29-Jul-2007  ad file firewirereg.h was added on branch matt-mips64 on 2007-07-29 13:31:09 +0000
 1.6.10.1 13-Nov-2007  bouyer Sync with HEAD
 1.6.6.1 06-Nov-2007  matt sync with HEAD
 1.6.4.1 06-Nov-2007  joerg Sync with HEAD.
 1.7.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.8.18.1 23-Jul-2009  jym Sync with HEAD.
 1.8.4.3 09-Oct-2010  yamt sync with head
 1.8.4.2 11-Aug-2010  yamt sync with head.
 1.8.4.1 18-Jul-2009  yamt sync with head.
 1.10.4.3 31-May-2011  rmind sync with head
 1.10.4.2 05-Mar-2011  rmind sync with head
 1.10.4.1 30-May-2010  rmind sync with head
 1.10.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.10.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.15.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.16.8.1 29-Apr-2012  mrg sync to latest -current.
 1.16.4.2 30-Oct-2012  yamt sync with head
 1.16.4.1 23-May-2012  yamt sync with head.
 1.18.20.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.18.16.1 05-Dec-2016  skrll Sync with HEAD
 1.18.2.1 03-Dec-2017  jdolecek update from HEAD
 1.34 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.33 07-Aug-2009  dyoung branches: 1.33.2; 1.33.4;
unifdef -U__FreeBSD__ -D__NetBSD__, et cetera.
 1.32 20-Apr-2009  mschuett Add queue macros SLIST_FOREACH_SAFE, STAILQ_FOREACH_SAFE, STAILQ_LAST,
SIMPLEQ_CONCAT, and SIMPLEQ_LAST.

Remove seperate definitions outside of queue.h.
 1.31 18-Mar-2009  cegger bzero -> memset
 1.30 24-Jun-2008  gmcgarry branches: 1.30.4; 1.30.10;
Digraphs as lvalues must return the same type.
 1.29 08-Apr-2008  cegger branches: 1.29.4; 1.29.6; 1.29.8;
use aprint_*_dev and device_xname
 1.28 29-Mar-2008  kiyohara Split device_t/softc.
And cosmetic change.
 1.27 25-Dec-2007  perry branches: 1.27.6;
Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.26 05-Nov-2007  kiyohara branches: 1.26.2; 1.26.4; 1.26.8;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.25 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.24 05-Aug-2007  rmind branches: 1.24.2; 1.24.6; 1.24.8;
Improve per-CPU support for the workqueue(9):
- Make structures CPU-cache friendly, as suggested and explained
by Andrew Doran. CACHE_LINE_SIZE definition is invented.
- Use current CPU if NULL is passed to the workqueue_enqueue().
- Implemented MI CPU index, which could be used as an index of array.
Removed linked-lists usage for work queues.

The roundup2() function avoids division, but works only with power of 2.

Reviewed by: <ad>, <yamt>, <tech-kern>
 1.23 09-Jul-2007  ad branches: 1.23.2; 1.23.6;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.22 21-Apr-2007  kiyohara firewire.c sync to Rev.1.86 for FreeBSD.
firewirereg.h sync to Rev.1.41 for FreeBSD.
fwcrom.c sync to Rev.1.14 for FreeBSD.
fwdev.c sync to Rev.1.49 for FreeBSD.
fwmem.c sync to Rev.1.32 for FreeBSD.
fwohci.c sync to Rev.1.86 for FreeBSD.
fwohcivar.h sync to Rev.1.15 for FreeBSD.
if_fwip.c sync to Rev.1.14 for FreeBSD.
if_fwipvar.h sync to Rev.1.4 for FreeBSD.
sbp.c sync to Rev.1.89 for FreeBSD.
 1.21 04-Mar-2007  christos branches: 1.21.2; 1.21.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20 16-Nov-2006  christos branches: 1.20.4;
__unused removal on arguments; approved by core.
 1.19 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.18 04-Oct-2006  christos we have rounddown in <sys/param.h> now
 1.17 24-Sep-2006  jmcneill Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
 1.16 30-Aug-2006  christos branches: 1.16.2; 1.16.4;
fix order of decl
 1.15 30-Apr-2006  kiyohara branches: 1.15.6;
Use An appropriate flag in macro fw_bus_dma_*.
 1.14 30-Apr-2006  kiyohara Coordination of macro fw_bus_dma_tag_create().
 1.13 30-Apr-2006  kiyohara Remove `;'.
 1.12 30-Apr-2006  kiyohara No parentheses are needed around the return value.
 1.11 14-Apr-2006  christos Coverity CID 1120: Avoid NULL deref.
 1.10 14-Apr-2006  christos Coverity CID 2696: Don't use SLIST_FOREACH when freeing elements.
 1.9 28-Mar-2006  thorpej Use device_unit().
 1.8 16-Feb-2006  perry branches: 1.8.2; 1.8.4; 1.8.6;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.7 20-Dec-2005  thorpej branches: 1.7.2; 1.7.4; 1.7.6;
No longer need our own device_t typedef.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 04-Dec-2005  christos Merge the 3 copies of m_getcl() so that fast ipsec compiles again together
with net80211. XXX: We don't really have an m_getcl(), we just emulate it.
 1.4 26-Aug-2005  drochner branches: 1.4.6;
kill some more simple submatch() functions, use config_stdsubmatch()
 1.3 23-Jul-2005  kiyohara Since fwip_unicast_input_recycle() is called from interrupt context, one
can't sleep there.
 1.2 20-Jul-2005  drochner minor cleanup: some "const", global namespace sanity and fix a maclo name
 1.1 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.4.6.3 11-Dec-2005  christos Sync with head.
 1.4.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.6.1 26-Aug-2005  skrll file fw_port.h was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.7.6.2 01-Jun-2006  kardel Sync with head.
 1.7.6.1 22-Apr-2006  simonb Sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.7.2.1 18-Feb-2006  yamt sync with head.
 1.8.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.8.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.8.4.2 11-May-2006  elad sync with head
 1.8.4.1 19-Apr-2006  elad sync with head.
 1.8.2.3 03-Sep-2006  yamt sync with head.
 1.8.2.2 24-May-2006  yamt sync with head.
 1.8.2.1 01-Apr-2006  yamt sync with head.
 1.15.6.7 21-Jan-2008  yamt sync with head
 1.15.6.6 15-Nov-2007  yamt sync with head.
 1.15.6.5 27-Oct-2007  yamt sync with head.
 1.15.6.4 03-Sep-2007  yamt sync with head.
 1.15.6.3 30-Dec-2006  yamt sync with head.
 1.15.6.2 21-Jun-2006  yamt sync with head.
 1.15.6.1 30-Apr-2006  yamt file fw_port.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.16.4.2 10-Dec-2006  yamt sync with head.
 1.16.4.1 22-Oct-2006  yamt sync with head
 1.16.2.1 18-Nov-2006  ad Sync with head.
 1.20.4.2 07-May-2007  yamt sync with head.
 1.20.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.4.1 11-Jul-2007  mjf Sync with head.
 1.21.2.7 23-Oct-2007  ad Sync with head.
 1.21.2.6 20-Aug-2007  ad Sync with HEAD.
 1.21.2.5 01-Jul-2007  ad Adapt to callout API change.
 1.21.2.4 27-May-2007  ad Sync with head.
 1.21.2.3 13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.21.2.2 10-Apr-2007  ad Nuke the deferred kthread creation stuff, as it's no longer needed.
Pointed out by thorpej@.
 1.21.2.1 09-Apr-2007  ad - Add two new arguments to kthread_create1: pri_t pri, bool mpsafe.
- Fork kthreads off proc0 as new LWPs, not new processes.
 1.23.6.3 06-Nov-2007  joerg Sync with HEAD.
 1.23.6.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.23.6.1 09-Aug-2007  jmcneill Sync with HEAD.
 1.23.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.24.8.2 05-Aug-2007  rmind Improve per-CPU support for the workqueue(9):
- Make structures CPU-cache friendly, as suggested and explained
by Andrew Doran. CACHE_LINE_SIZE definition is invented.
- Use current CPU if NULL is passed to the workqueue_enqueue().
- Implemented MI CPU index, which could be used as an index of array.
Removed linked-lists usage for work queues.

The roundup2() function avoids division, but works only with power of 2.

Reviewed by: <ad>, <yamt>, <tech-kern>
 1.24.8.1 05-Aug-2007  rmind file fw_port.h was added on branch matt-mips64 on 2007-08-05 01:19:18 +0000
 1.24.6.2 13-Nov-2007  bouyer Sync with HEAD
 1.24.6.1 25-Oct-2007  bouyer Sync with HEAD.
 1.24.2.2 09-Jan-2008  matt sync with HEAD
 1.24.2.1 06-Nov-2007  matt sync with HEAD
 1.26.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.26.4.1 26-Dec-2007  ad Sync with head.
 1.26.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.27.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.27.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.27.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.29.8.1 27-Jun-2008  simonb Sync with head.
 1.29.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.29.4.3 11-Aug-2010  yamt sync with head.
 1.29.4.2 19-Aug-2009  yamt sync with head.
 1.29.4.1 04-May-2009  yamt sync with head.
 1.30.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.30.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.33.4.1 30-May-2010  rmind sync with head
 1.33.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.17 21-Nov-2014  joerg No reason not to make the string const.
 1.16 21-Sep-2014  christos ran sed too agressively.
 1.15 21-Sep-2014  christos fix cut-n-paste, use arrays instead of separate variables to avoid code
duplication.
 1.14 28-Mar-2014  christos branches: 1.14.4;
Deal with snprintf more gracefully.
 1.13 26-Aug-2010  cegger branches: 1.13.8; 1.13.18; 1.13.22;
- print expected crc when it does not match
- add and print secondary text leaf. This prints the model name of my webcam.
- add csr keys that are printed as 'unknown' otherwise
 1.12 24-Apr-2010  cegger ANSIfy, KNF
 1.11 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.10 18-Apr-2009  tsutsui branches: 1.10.2; 1.10.4;
Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
 1.9 18-Mar-2009  cegger bcopy -> memcpy
 1.8 18-Mar-2009  cegger bzero -> memset
 1.7 02-May-2008  xtraeme branches: 1.7.8; 1.7.14;
Constify, so that usr.sbin/fwctl can be built with WARNS=4.
 1.6 11-Dec-2007  lukem branches: 1.6.8; 1.6.10; 1.6.12;
use __KERNEL_RCSID()
 1.5 21-Apr-2007  kiyohara branches: 1.5.8; 1.5.16; 1.5.18; 1.5.20;
firewire.c sync to Rev.1.86 for FreeBSD.
firewirereg.h sync to Rev.1.41 for FreeBSD.
fwcrom.c sync to Rev.1.14 for FreeBSD.
fwdev.c sync to Rev.1.49 for FreeBSD.
fwmem.c sync to Rev.1.32 for FreeBSD.
fwohci.c sync to Rev.1.86 for FreeBSD.
fwohcivar.h sync to Rev.1.15 for FreeBSD.
if_fwip.c sync to Rev.1.14 for FreeBSD.
if_fwipvar.h sync to Rev.1.4 for FreeBSD.
sbp.c sync to Rev.1.89 for FreeBSD.
 1.4 04-Mar-2007  christos branches: 1.4.2; 1.4.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.3 10-May-2006  skrll branches: 1.3.6; 1.3.16;
Fix a bunch of cast lvalues.
 1.2 11-Dec-2005  christos branches: 1.2.4; 1.2.6; 1.2.8; 1.2.10; 1.2.12;
merge ktrace-lwp.
 1.1 11-Jul-2005  kiyohara branches: 1.1.6;
ieee1394 import from FreeBSD.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file fwcrom.c was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.2.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 11-May-2006  elad sync with head
 1.2.8.1 24-May-2006  yamt sync with head.
 1.2.6.1 01-Jun-2006  kardel Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.3.16.2 07-May-2007  yamt sync with head.
 1.3.16.1 12-Mar-2007  rmind Sync with HEAD.
 1.3.6.4 21-Jan-2008  yamt sync with head
 1.3.6.3 03-Sep-2007  yamt sync with head.
 1.3.6.2 21-Jun-2006  yamt sync with head.
 1.3.6.1 10-May-2006  yamt file fwcrom.c was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.4.4.1 11-Jul-2007  mjf Sync with head.
 1.4.2.1 27-May-2007  ad Sync with head.
 1.5.20.1 13-Dec-2007  bouyer Sync with HEAD
 1.5.18.1 11-Dec-2007  yamt sync with head.
 1.5.16.1 26-Dec-2007  ad Sync with head.
 1.5.8.1 09-Jan-2008  matt sync with HEAD
 1.6.12.4 09-Oct-2010  yamt sync with head
 1.6.12.3 11-Aug-2010  yamt sync with head.
 1.6.12.2 04-May-2009  yamt sync with head.
 1.6.12.1 16-May-2008  yamt sync with head.
 1.6.10.1 18-May-2008  yamt sync with head.
 1.6.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.7.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.10.4.2 05-Mar-2011  rmind sync with head
 1.10.4.1 30-May-2010  rmind sync with head
 1.10.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.10.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.13.22.1 18-May-2014  rmind sync with head
 1.13.18.2 03-Dec-2017  jdolecek update from HEAD
 1.13.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.14.4.2 15-May-2015  snj Pull up following revision(s) (requested by joerg in ticket #772):
sys/arch/arm/amlogic/amlogic_genfb.c: revision 1.4
sys/arch/arm/arm/disassem.c: revision 1.25
sys/arch/arm/omap/am335x_cm_padconf.c: revision 1.3
sys/arch/arm/omap/sitara_cm.h: revision 1.2
sys/dev/ic/i82557var.h: revision 1.51
sys/dev/ic/rtl8169.c: revision 1.143
sys/dev/ieee1394/fwcrom.c: revision 1.17
sys/external/bsd/dwc2/dwc2.c: revision 1.32
dwc2_hubd appears to be unused so #if 0 it in order to appease clang
--
Preserve const.
--
No reason not to make the string const.
--
Drop unnecessary-but-harmful casts.
--
Replace void * cast with proper __UNVOLATILE.
--
Preserve const.
--
amlogic_genfb_hdmi_write_4 is currently unused, mark it as such.
 1.14.4.1 30-Oct-2014  martin Pull up following revision(s) (requested by maxv in ticket #164):
sys/dev/ieee1394/fwcrom.c: revision 1.15
sys/dev/ieee1394/fwcrom.c: revision 1.16
sys/dev/marvell/if_gfe.c: revision 1.43
sys/dev/usb/stuirda.c: revision 1.16
sys/dev/pci/cxgb/cxgb_offload.c: revision 1.4
sys/dev/pci/twa.c: revision 1.51
sys/dev/pci/twa.c: revision 1.52
Various fixes in dev/: remove dead code and fix two inconsistencies.
 1.33 10-Nov-2021  msaitoh s/avaliable/available/
 1.32 25-Jun-2017  maxv memory leak, found by Mootja; it seems that we should check the return
value of 'fw_bindadd' in several other places, but whatever
 1.31 20-Nov-2016  riastradh Kill some more tsleep.

And no, surrounding tsleep by mutex_exit/mutex_enter does not fix
problems even if the LOCKDEBUG panic symptom goes away...
 1.30 25-Jul-2014  dholland branches: 1.30.4; 1.30.8;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.29 25-Jul-2014  dholland Add d_discard to all struct bdevsw instances I could find.

I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
 1.28 16-Mar-2014  dholland branches: 1.28.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.27 29-Apr-2012  dsl branches: 1.27.2; 1.27.4;
Change to consistently use M_FW for all malloc/free.
It probably doesn't matter any more, but the code doesn't appear to
have matched its mallocs and frees - so the stats would have been awol.
 1.26 31-Jul-2011  uebayasi branches: 1.26.2; 1.26.6;
Put back #include "ioconf.h" per popular demand.
 1.25 25-May-2011  uebayasi Declare cfdrivers using extern rather than including ioconf.h.
 1.24 26-Aug-2010  cegger branches: 1.24.2;
don't call tsleep() with any mutexes hold
 1.23 16-Aug-2010  cegger do not hold mutexes when calling tsleep(9).
Fixes LOCKDEBUG panics
 1.22 23-May-2010  christos Revert all previous kmem_ commits. This needs to be done in a different way
because we cannot call kmem_ from an interrupt context. I opened PR/43341 for
it.
 1.21 14-May-2010  kiyohara Use kmem(9) instead of malloc(9).
 1.20 10-May-2010  kiyohara Use kmem(9) instead of malloc(9).
 1.19 29-Apr-2010  kiyohara Remove unnecessary cast.
 1.18 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.17 18-Apr-2009  tsutsui branches: 1.17.2; 1.17.4;
Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
 1.16 18-Mar-2009  cegger bcopy -> memcpy
 1.15 18-Mar-2009  cegger bzero -> memset
 1.14 11-Dec-2007  lukem branches: 1.14.12; 1.14.20; 1.14.26;
use __KERNEL_RCSID()
 1.13 05-Nov-2007  kiyohara branches: 1.13.4; 1.13.6; 1.13.8;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.12 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.11 29-Jul-2007  ad branches: 1.11.4; 1.11.6; 1.11.10; 1.11.12;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.10 21-Apr-2007  kiyohara branches: 1.10.2;
firewire.c sync to Rev.1.86 for FreeBSD.
firewirereg.h sync to Rev.1.41 for FreeBSD.
fwcrom.c sync to Rev.1.14 for FreeBSD.
fwdev.c sync to Rev.1.49 for FreeBSD.
fwmem.c sync to Rev.1.32 for FreeBSD.
fwohci.c sync to Rev.1.86 for FreeBSD.
fwohcivar.h sync to Rev.1.15 for FreeBSD.
if_fwip.c sync to Rev.1.14 for FreeBSD.
if_fwipvar.h sync to Rev.1.4 for FreeBSD.
sbp.c sync to Rev.1.89 for FreeBSD.
 1.9 04-Mar-2007  christos branches: 1.9.2; 1.9.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.8 16-Nov-2006  jdolecek branches: 1.8.4;
undo previous change - crom_buf->len has been changed to uint32_t
(this is backward ABI compatible) so the check for negative value is
no longer necessary
 1.7 16-Nov-2006  elad Avoid integer overflow, as reported by Rodrigo Rubira Branco in a
message to full-disclosure:

http://archives.neohapsis.com/archives/fulldisclosure/2006-11/0261.html

Also see comment from bouyer@:

http://mail-index.netbsd.org/tech-security/2006/11/16/0001.html
 1.6 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.5 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.4 30-Aug-2006  christos branches: 1.4.2; 1.4.4;
- fix missing initializations
- remove stray semicolon, that screwed up error checking
 1.3 11-Dec-2005  christos branches: 1.3.4; 1.3.8; 1.3.18;
merge ktrace-lwp.
 1.2 20-Jul-2005  drochner branches: 1.2.6;
minor cleanup: some "const", global namespace sanity and fix a maclo name
 1.1 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 20-Jul-2005  skrll file fwdev.c was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.3.18.7 21-Jan-2008  yamt sync with head
 1.3.18.6 15-Nov-2007  yamt sync with head.
 1.3.18.5 27-Oct-2007  yamt sync with head.
 1.3.18.4 03-Sep-2007  yamt sync with head.
 1.3.18.3 30-Dec-2006  yamt sync with head.
 1.3.18.2 21-Jun-2006  yamt sync with head.
 1.3.18.1 11-Dec-2005  yamt file fwdev.c was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.3.8.1 03-Sep-2006  yamt sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.4.2 10-Dec-2006  yamt sync with head.
 1.4.4.1 22-Oct-2006  yamt sync with head
 1.4.2.1 18-Nov-2006  ad Sync with head.
 1.8.4.2 07-May-2007  yamt sync with head.
 1.8.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.4.1 11-Jul-2007  mjf Sync with head.
 1.9.2.5 23-Oct-2007  ad Sync with head.
 1.9.2.4 19-Aug-2007  ad Compile fixes.
 1.9.2.3 19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.9.2.2 27-May-2007  ad Sync with head.
 1.9.2.1 13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.10.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.11.12.2 29-Jul-2007  ad It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.11.12.1 29-Jul-2007  ad file fwdev.c was added on branch matt-mips64 on 2007-07-29 13:31:09 +0000
 1.11.10.2 13-Nov-2007  bouyer Sync with HEAD
 1.11.10.1 25-Oct-2007  bouyer Sync with HEAD.
 1.11.6.2 09-Jan-2008  matt sync with HEAD
 1.11.6.1 06-Nov-2007  matt sync with HEAD
 1.11.4.2 06-Nov-2007  joerg Sync with HEAD.
 1.11.4.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.13.8.1 13-Dec-2007  bouyer Sync with HEAD
 1.13.6.1 11-Dec-2007  yamt sync with head.
 1.13.4.1 26-Dec-2007  ad Sync with head.
 1.14.26.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.14.20.1 28-Apr-2009  skrll Sync with HEAD.
 1.14.12.3 09-Oct-2010  yamt sync with head
 1.14.12.2 11-Aug-2010  yamt sync with head.
 1.14.12.1 04-May-2009  yamt sync with head.
 1.17.4.3 31-May-2011  rmind sync with head
 1.17.4.2 05-Mar-2011  rmind sync with head
 1.17.4.1 30-May-2010  rmind sync with head
 1.17.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.17.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.17.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.24.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.26.6.1 29-Apr-2012  mrg sync to latest -current.
 1.26.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.26.2.1 23-May-2012  yamt sync with head.
 1.27.4.1 18-May-2014  rmind sync with head
 1.27.2.2 03-Dec-2017  jdolecek update from HEAD
 1.27.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.2.1 10-Aug-2014  tls Rebase.
 1.30.8.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.30.4.2 28-Aug-2017  skrll Sync with HEAD
 1.30.4.1 05-Dec-2016  skrll Sync with HEAD
 1.18 24-Jul-2021  andvar Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.
 1.17 13-Dec-2018  jakllsch branches: 1.17.16;
Fix fwdma_free() for when bus_dmamap_unload() clobbers the dmamap.

Prevents KASSERTs on detaches of sbp(4) and fwohci(4) on amd64.

We should pass the dmamem segs around seperately, not in loaded dmamap...
 1.16 23-May-2010  christos branches: 1.16.58; 1.16.60;
Revert all previous kmem_ commits. This needs to be done in a different way
because we cannot call kmem_ from an interrupt context. I opened PR/43341 for
it.
 1.15 10-May-2010  kiyohara Use kmem(9) instead of malloc(9).
 1.14 29-Apr-2010  kiyohara Call malloc(M_ZERO) instead of malloc() and memset().
 1.13 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.12 04-Jan-2008  ad branches: 1.12.10; 1.12.30; 1.12.32;
Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
 1.11 11-Dec-2007  lukem use __KERNEL_RCSID()
 1.10 05-Nov-2007  kiyohara branches: 1.10.2; 1.10.4; 1.10.6; 1.10.8;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.9 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.8 11-Mar-2007  ad branches: 1.8.12; 1.8.14; 1.8.18;
Remove #include <machine/vmparam.h>.
 1.7 16-Nov-2006  christos branches: 1.7.4; 1.7.8;
__unused removal on arguments; approved by core.
 1.6 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.5 30-Apr-2006  kiyohara branches: 1.5.6; 1.5.10; 1.5.12;
Fix memory leak.
 1.4 30-Apr-2006  kiyohara Use An appropriate flag in macro fw_bus_dma_*.
 1.3 30-Apr-2006  kiyohara Coordination of macro fw_bus_dma_tag_create().
 1.2 11-Dec-2005  christos branches: 1.2.4; 1.2.6; 1.2.8; 1.2.10; 1.2.12;
merge ktrace-lwp.
 1.1 11-Jul-2005  kiyohara branches: 1.1.6;
ieee1394 import from FreeBSD.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file fwdma.c was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.2.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 11-May-2006  elad sync with head
 1.2.8.1 24-May-2006  yamt sync with head.
 1.2.6.1 01-Jun-2006  kardel Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.5.12.2 10-Dec-2006  yamt sync with head.
 1.5.12.1 22-Oct-2006  yamt sync with head
 1.5.10.1 18-Nov-2006  ad Sync with head.
 1.5.6.7 21-Jan-2008  yamt sync with head
 1.5.6.6 15-Nov-2007  yamt sync with head.
 1.5.6.5 27-Oct-2007  yamt sync with head.
 1.5.6.4 03-Sep-2007  yamt sync with head.
 1.5.6.3 30-Dec-2006  yamt sync with head.
 1.5.6.2 21-Jun-2006  yamt sync with head.
 1.5.6.1 30-Apr-2006  yamt file fwdma.c was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.7.8.2 23-Oct-2007  ad Sync with head.
 1.7.8.1 13-Mar-2007  ad Sync with head.
 1.7.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.18.2 13-Nov-2007  bouyer Sync with HEAD
 1.8.18.1 25-Oct-2007  bouyer Sync with HEAD.
 1.8.14.2 09-Jan-2008  matt sync with HEAD
 1.8.14.1 06-Nov-2007  matt sync with HEAD
 1.8.12.2 06-Nov-2007  joerg Sync with HEAD.
 1.8.12.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.10.8.2 08-Jan-2008  bouyer Sync with HEAD
 1.10.8.1 13-Dec-2007  bouyer Sync with HEAD
 1.10.6.1 11-Dec-2007  yamt sync with head.
 1.10.4.1 26-Dec-2007  ad Sync with head.
 1.10.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.12.32.1 30-May-2010  rmind sync with head
 1.12.30.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.12.10.1 11-Aug-2010  yamt sync with head.
 1.16.60.1 10-Jun-2019  christos Sync with HEAD
 1.16.58.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.17.16.1 01-Aug-2021  thorpej Sync with HEAD.
 1.6 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.5 04-Mar-2007  christos branches: 1.5.40; 1.5.62; 1.5.64;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 16-Feb-2006  perry branches: 1.4.12; 1.4.22;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.3 24-Dec-2005  perry branches: 1.3.2; 1.3.4; 1.3.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 11-Jul-2005  kiyohara branches: 1.1.6;
ieee1394 import from FreeBSD.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file fwdma.h was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.3.2.1 18-Feb-2006  yamt sync with head.
 1.4.22.1 12-Mar-2007  rmind Sync with HEAD.
 1.4.12.3 03-Sep-2007  yamt sync with head.
 1.4.12.2 21-Jun-2006  yamt sync with head.
 1.4.12.1 16-Feb-2006  yamt file fwdma.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.5.64.1 30-May-2010  rmind sync with head
 1.5.62.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.5.40.1 11-Aug-2010  yamt sync with head.
 1.6 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.5 27-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 13-May-2004  christos branches: 1.4.4; 1.4.6;
return an error on invalid mode.
 1.3 14-Jul-2003  lukem add missing __KERNEL_RCSID()
 1.2 05-Jan-2003  jmc branches: 1.2.2;
Add some missing splx()'s noted by Krister Walfridsson
 1.1 04-Dec-2002  haya branches: 1.1.2;
New Feature: add pseudo device for IEEE 1394 isochronous stream and
isochronous reception routine for IEEE 1394 OHCI (fwohci). The
transmission part is under construction.

The minimum configuration options for this feature are:

# IEEE 1394 (i.LINK)
fwohci* at pci? dev ? function ?
pseudo-device fwiso 1
 1.1.2.3 07-Jan-2003  thorpej Sync with HEAD.
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 04-Dec-2002  thorpej file fwiso.c was added on branch nathanw_sa on 2002-12-11 06:38:05 +0000
 1.2.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.4.1 29-Apr-2005  kent sync with -current
 1.5.4.1 21-Jun-2006  yamt sync with head.
 1.2 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.1 04-Dec-2002  haya branches: 1.1.2; 1.1.8; 1.1.24;
New Feature: add pseudo device for IEEE 1394 isochronous stream and
isochronous reception routine for IEEE 1394 OHCI (fwohci). The
transmission part is under construction.

The minimum configuration options for this feature are:

# IEEE 1394 (i.LINK)
fwohci* at pci? dev ? function ?
pseudo-device fwiso 1
 1.1.24.1 21-Jun-2006  yamt sync with head.
 1.1.8.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 04-Dec-2002  thorpej file fwiso_ioctl.h was added on branch nathanw_sa on 2002-12-11 06:38:06 +0000
 1.2 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.1 04-Dec-2002  haya branches: 1.1.2; 1.1.8; 1.1.24;
New Feature: add pseudo device for IEEE 1394 isochronous stream and
isochronous reception routine for IEEE 1394 OHCI (fwohci). The
transmission part is under construction.

The minimum configuration options for this feature are:

# IEEE 1394 (i.LINK)
fwohci* at pci? dev ? function ?
pseudo-device fwiso 1
 1.1.24.1 21-Jun-2006  yamt sync with head.
 1.1.8.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 04-Dec-2002  thorpej file fwisovar.h was added on branch nathanw_sa on 2002-12-11 06:38:06 +0000
 1.19 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.18 25-Feb-2014  pooka branches: 1.18.28; 1.18.30;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.17 29-Apr-2012  dsl branches: 1.17.2; 1.17.4;
Change to consistently use M_FW for all malloc/free.
It probably doesn't matter any more, but the code doesn't appear to
have matched its mallocs and frees - so the stats would have been awol.
 1.16 31-Jul-2011  uebayasi branches: 1.16.2; 1.16.6;
Put back #include "ioconf.h" per popular demand.
 1.15 25-May-2011  uebayasi Declare cfdrivers using extern rather than including ioconf.h.
 1.14 23-May-2010  christos branches: 1.14.2;
Revert all previous kmem_ commits. This needs to be done in a different way
because we cannot call kmem_ from an interrupt context. I opened PR/43341 for
it.
 1.13 10-May-2010  kiyohara Use kmem(9) instead of malloc(9).
 1.12 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.11 18-Apr-2009  tsutsui branches: 1.11.2; 1.11.4;
Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
 1.10 18-Mar-2009  cegger bcopy -> memcpy
 1.9 12-Nov-2008  ad branches: 1.9.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.8 11-Dec-2007  lukem branches: 1.8.8; 1.8.12; 1.8.18; 1.8.20;
use __KERNEL_RCSID()
 1.7 05-Nov-2007  kiyohara branches: 1.7.4; 1.7.6; 1.7.8;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.6 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.5 29-Jul-2007  ad branches: 1.5.4; 1.5.6; 1.5.10; 1.5.12;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.4 21-Apr-2007  kiyohara branches: 1.4.2;
firewire.c sync to Rev.1.86 for FreeBSD.
firewirereg.h sync to Rev.1.41 for FreeBSD.
fwcrom.c sync to Rev.1.14 for FreeBSD.
fwdev.c sync to Rev.1.49 for FreeBSD.
fwmem.c sync to Rev.1.32 for FreeBSD.
fwohci.c sync to Rev.1.86 for FreeBSD.
fwohcivar.h sync to Rev.1.15 for FreeBSD.
if_fwip.c sync to Rev.1.14 for FreeBSD.
if_fwipvar.h sync to Rev.1.4 for FreeBSD.
sbp.c sync to Rev.1.89 for FreeBSD.
 1.3 04-Mar-2007  christos branches: 1.3.2; 1.3.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.28;
merge ktrace-lwp.
 1.1 11-Jul-2005  kiyohara branches: 1.1.6;
ieee1394 import from FreeBSD.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file fwmem.c was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.2.28.2 07-May-2007  yamt sync with head.
 1.2.28.1 12-Mar-2007  rmind Sync with HEAD.
 1.2.18.6 21-Jan-2008  yamt sync with head
 1.2.18.5 15-Nov-2007  yamt sync with head.
 1.2.18.4 27-Oct-2007  yamt sync with head.
 1.2.18.3 03-Sep-2007  yamt sync with head.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file fwmem.c was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.3.4.1 11-Jul-2007  mjf Sync with head.
 1.3.2.5 23-Oct-2007  ad Sync with head.
 1.3.2.4 19-Aug-2007  ad Compile fixes.
 1.3.2.3 19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.3.2.2 27-May-2007  ad Sync with head.
 1.3.2.1 13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.4.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.5.12.2 29-Jul-2007  ad It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.5.12.1 29-Jul-2007  ad file fwmem.c was added on branch matt-mips64 on 2007-07-29 13:31:09 +0000
 1.5.10.2 13-Nov-2007  bouyer Sync with HEAD
 1.5.10.1 25-Oct-2007  bouyer Sync with HEAD.
 1.5.6.2 09-Jan-2008  matt sync with HEAD
 1.5.6.1 06-Nov-2007  matt sync with HEAD
 1.5.4.2 06-Nov-2007  joerg Sync with HEAD.
 1.5.4.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.7.8.1 13-Dec-2007  bouyer Sync with HEAD
 1.7.6.1 11-Dec-2007  yamt sync with head.
 1.7.4.1 26-Dec-2007  ad Sync with head.
 1.8.20.2 28-Apr-2009  skrll Sync with HEAD.
 1.8.20.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.18.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.12.2 11-Aug-2010  yamt sync with head.
 1.8.12.1 04-May-2009  yamt sync with head.
 1.8.8.1 17-Jan-2009  mjf Sync with HEAD.
 1.9.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.11.4.2 31-May-2011  rmind sync with head
 1.11.4.1 30-May-2010  rmind sync with head
 1.11.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.14.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.16.6.1 29-Apr-2012  mrg sync to latest -current.
 1.16.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16.2.1 23-May-2012  yamt sync with head.
 1.17.4.1 18-May-2014  rmind sync with head
 1.17.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.30.1 10-Jun-2019  christos Sync with HEAD
 1.18.28.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.4 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.3 04-Mar-2007  christos branches: 1.3.40; 1.3.62; 1.3.64;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.28;
merge ktrace-lwp.
 1.1 11-Jul-2005  kiyohara branches: 1.1.6;
ieee1394 import from FreeBSD.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file fwmem.h was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.2.28.1 12-Mar-2007  rmind Sync with HEAD.
 1.2.18.3 03-Sep-2007  yamt sync with head.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file fwmem.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.3.64.1 30-May-2010  rmind sync with head
 1.3.62.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.3.40.1 11-Aug-2010  yamt sync with head.
 1.21 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.20 27-Feb-2005  perry branches: 1.20.4;
nuke trailing whitespace
 1.19 01-Jan-2003  thorpej branches: 1.19.2; 1.19.10; 1.19.12;
Use aprint_normal() in cfprint routines.
 1.18 22-Nov-2002  jmc Change structure/usage of interface provided callbacks. (read, write, reset)
Push these up to the ieee1394 softc level and make the naming scheme
consistant.
 1.17 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.16 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.15 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.13 03-Apr-2002  jmc Only dump the rom up to ab_retlen in error cases. Also add in
P1212_ALLOW_VENDOR_DIRECTORY_TYPE to the flags passed to the p1212 parser
 1.12 29-Mar-2002  jmc Update copyright date
 1.11 01-Mar-2002  enami Make this file compiles w/o FWNODE_DEBUG.
 1.10 27-Feb-2002  jmc Rototill fwnode.c to rely on the p1212 routines to parse and validate the ROM
 1.9 11-Feb-2002  augustss s/ab_csr/ab_addr/ so it compiles again.
 1.8 12-Jan-2002  tsutsui Call malloc(9) with M_ZERO flag instead of memset() after malloc().
 1.7 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.6 13-Nov-2001  lukem add RCSID
 1.5 14-May-2001  jmc branches: 1.5.2; 1.5.4;
Make sure and zero out the malloc'd abufs before using them.
 1.4 11-May-2001  jmc Change ab_node's to ab_req.
Use read/write instead of input/output.
Fix a bug in attach where the abuf wasn't getting zero'd out.
 1.3 03-May-2001  jmc Retabify to correct style. Also, change to using DPRINTF interface for debug output.
 1.2 01-May-2001  jmc Wrap some variable definitions with #ifdef FW_DEBUG that only apply in debug mode.
 1.1 01-May-2001  jmc Initial checkin for fwnode code. Needs extensive cleanup
 1.5.4.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.5.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.5.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.2.10 03-Jan-2003  thorpej Sync with HEAD.
 1.5.2.9 11-Dec-2002  thorpej Sync with HEAD.
 1.5.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.5.2.7 17-Apr-2002  nathanw Catch up to -current.
 1.5.2.6 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.5.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.5.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.5.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.5.2.1 14-May-2001  nathanw file fwnode.c was added on branch nathanw_sa on 2001-06-21 20:03:38 +0000
 1.19.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.10.1 29-Apr-2005  kent sync with -current
 1.19.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.20.4.1 21-Jun-2006  yamt sync with head.
 1.2 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.1 01-May-2001  jmc branches: 1.1.2; 1.1.24; 1.1.40;
Initial checkin for fwnode support
 1.1.40.1 21-Jun-2006  yamt sync with head.
 1.1.24.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.1 01-May-2001  nathanw file fwnodereg.h was added on branch nathanw_sa on 2001-06-21 20:03:38 +0000
 1.7 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.6 27-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 22-Nov-2002  jmc branches: 1.5.6; 1.5.14; 1.5.16;
Change structure/usage of interface provided callbacks. (read, write, reset)
Push these up to the ieee1394 softc level and make the naming scheme
consistant.
 1.4 27-Feb-2002  jmc Rototill fwnode.c to rely on the p1212 routines to parse and validate the ROM
 1.3 11-May-2001  jmc branches: 1.3.2; 1.3.4;
Rename input/output to read/write to match ieee1394var.h
 1.2 03-May-2001  jmc Style police. Got the tab'ing correct
 1.1 01-May-2001  jmc Initial checkin for fwnode support
 1.3.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.3.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.3.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.3.2.1 11-May-2001  nathanw file fwnodevar.h was added on branch nathanw_sa on 2001-06-21 20:03:39 +0000
 1.5.16.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.14.1 29-Apr-2005  kent sync with -current
 1.5.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.6.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.152 10-Aug-2023  mrg don't assign struct pointers to smaller then structure regions of memory.

in all cases here, the later parts of the structure are not actually
accessed, so there are no existing bugs here beyond general UB. for the
ufs ones, this also removes some casts.

found by GCC 12.
 1.151 03-Jul-2022  andvar s/bounaries/boundaries/ in comments.
 1.150 25-Jan-2022  andvar fix various typos in comments.
 1.149 05-Dec-2021  msaitoh s/transcat/transact/ in comment.
 1.148 21-Aug-2021  andvar fix some more typos in comments/log messages, improve wording as well.
 1.147 21-Aug-2021  andvar s/helt/held+s/eroneously/erroneously/+s/splitted/split/+s/recommented/recommended/
 1.146 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.145 24-Apr-2021  thorpej branches: 1.145.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.144 28-Oct-2019  joerg branches: 1.144.10;
Fix operand priority of bit op vs ternary operator.
 1.143 15-Oct-2019  msaitoh Use unsigned to avoid undefined behavior. Found by kUBSan.
 1.142 28-May-2019  msaitoh branches: 1.142.2;
s/recieve/receive/
 1.141 21-Nov-2016  riastradh branches: 1.141.16;
Let's try initializing the pointers *before* dereferencing them!

Oops.
 1.140 20-Nov-2016  riastradh KASSERT(mutex_owner(...)) ---> KASSERT(mutex_owned(...))

If this is not correct, then there's something bogus in this code
anyway, so better to fail early.

Final part of PR kern/47114.
 1.139 20-Nov-2016  riastradh Kill some more tsleep.

And no, surrounding tsleep by mutex_exit/mutex_enter does not fix
problems even if the LOCKDEBUG panic symptom goes away...
 1.138 20-Nov-2016  riastradh Defer initialization of isodma channels until we know how many.

Should fix a bug I introduced four years ago in:
https://mail-index.netbsd.org/source-changes/2012/08/04/msg036211.html
 1.137 25-Feb-2014  pooka branches: 1.137.6; 1.137.10;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.136 16-Oct-2013  christos add missing ifdefs
 1.135 12-Sep-2013  martin Make it compilable with gcc 4.8.1
 1.134 07-Apr-2013  kiyohara branches: 1.134.4;
Add '\n' to tail of printing string.
 1.133 04-Aug-2012  riastradh branches: 1.133.2;
Fix error branches and config pending races in firewire init.

This way, if anything fails, it just fails; you don't panic. This can
happen if suspending and resuming of firewire is broken (e.g., as I
encountered in PR kern/44581).
 1.132 31-Jul-2011  uebayasi branches: 1.132.2;
Put back #include "ioconf.h" per popular demand.
 1.131 25-May-2011  uebayasi Declare cfdrivers using extern rather than including ioconf.h.
 1.130 07-Sep-2010  cegger branches: 1.130.2;
convert tsleep to kpause
 1.129 29-Aug-2010  cegger fix grammar in error message
 1.128 23-May-2010  christos Revert all previous kmem_ commits. This needs to be done in a different way
because we cannot call kmem_ from an interrupt context. I opened PR/43341 for
it.
 1.127 23-May-2010  christos Don't allocate sid scratch memory from an interrupt context:

fwohci0: BUS reset
fwohci0: node_id=0xc800ffc0, gen=1, CYCLEMASTER mode
panic: kernel diagnostic assertion "!cpu_intr_p()" failed: file "../../../../ker
n/subr_kmem.c", line 195
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip ffffffff8022db1d cs 8 rflags 246 cr2 0 cpl 6 rsp fffffff
f80fafb68
breakpoint() at netbsd:breakpoint+0x5
panic() at netbsd:panic+0x2ba
kern_assert() at netbsd:kern_assert+0x2d
kmem_alloc() at netbsd:kmem_alloc+0x18a
fwohci_intr() at netbsd:fwohci_intr+0xbe2
...

I will send-pr for the next one... Looks like someone did not use DIAGNOSTIC
when made the changes.
 1.126 10-May-2010  kiyohara Use kmem(9) instead of malloc(9).
 1.125 29-Apr-2010  kiyohara + Fix typo.
+ Call aprint_error_dev() instead of aprint_error().
 1.124 19-Apr-2010  kiyohara Fix a bug.
STAILQ is not NULL termination.
 1.123 29-Mar-2010  kiyohara Remove more my debugging code.
 1.122 29-Mar-2010  kiyohara Remove debugging process.
 1.121 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.120 18-Apr-2009  tsutsui branches: 1.120.2; 1.120.4;
Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
 1.119 18-Mar-2009  cegger bcopy -> memcpy
 1.118 18-Mar-2009  cegger bzero -> memset
 1.117 18-Mar-2009  cegger buildfix: undo previous
 1.116 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.115 12-Nov-2008  ad branches: 1.115.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.114 10-May-2008  jmcneill branches: 1.114.4; 1.114.6;
Use aprint
 1.113 09-Dec-2007  jmcneill branches: 1.113.10; 1.113.12; 1.113.14; 1.113.16;
Merge jmcneill-pm branch.
 1.112 06-Nov-2007  kiyohara branches: 1.112.2; 1.112.4;
The argument of *_intr_establish() is changed to fwohci_flit.
Our ieee1394 coordinates from FreeBSD implementation.
Add fwohci_pci_shutdown() and fwohci_pci_power().
Move __KERNEL_RCSID to ahead.
 1.111 06-Nov-2007  dogcow on NetBSD, cardbus_intr_establish's fifth arg's is a symbol which returns
an int, not a void; change fwohci_intr accordingly.
 1.110 05-Nov-2007  kiyohara branches: 1.110.2;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.109 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.108 25-Sep-2007  ad branches: 1.108.2;
Use selinit() / seldestroy().
 1.107 21-Apr-2007  kiyohara branches: 1.107.6; 1.107.8; 1.107.10;
firewire.c sync to Rev.1.86 for FreeBSD.
firewirereg.h sync to Rev.1.41 for FreeBSD.
fwcrom.c sync to Rev.1.14 for FreeBSD.
fwdev.c sync to Rev.1.49 for FreeBSD.
fwmem.c sync to Rev.1.32 for FreeBSD.
fwohci.c sync to Rev.1.86 for FreeBSD.
fwohcivar.h sync to Rev.1.15 for FreeBSD.
if_fwip.c sync to Rev.1.14 for FreeBSD.
if_fwipvar.h sync to Rev.1.4 for FreeBSD.
sbp.c sync to Rev.1.89 for FreeBSD.
 1.106 04-Mar-2007  christos branches: 1.106.2; 1.106.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.105 22-Dec-2006  kiyohara branches: 1.105.2;
Include ioconf.h it for `struct cfdriver fwohci_cd'.
 1.104 21-Dec-2006  kiyohara Fix memory allocation, in case isochronous transfer fail this.
 1.103 16-Nov-2006  christos branches: 1.103.2;
__unused removal on arguments; approved by core.
 1.102 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.101 26-Sep-2006  kiyohara Fix device name in {fwohci,firewire}_print(). valiable aux is not string
pointer.
 1.100 28-May-2006  blymn branches: 1.100.6; 1.100.8;
Clean up bogus whitespace
 1.99 03-May-2006  kiyohara branches: 1.99.2;
Back out for 1.94 from 1.93.
 1.98 30-Apr-2006  kiyohara Fix memory leak.
 1.97 30-Apr-2006  kiyohara Use An appropriate flag in macro fw_bus_dma_*.
 1.96 30-Apr-2006  kiyohara use fw_bus_dmamap_create().
 1.95 30-Apr-2006  kiyohara Indented.
 1.94 30-Apr-2006  kiyohara Remove sync-ope for descritor of DMA, because its descriptor set
BUS_DMA_COHERENT flag.
 1.93 30-Apr-2006  kiyohara Coordination of macro fw_bus_dma_tag_create().
 1.92 14-Apr-2006  christos Coverity CID 727: Comment out dead code.
 1.91 11-Dec-2005  christos branches: 1.91.4; 1.91.6; 1.91.8; 1.91.10; 1.91.12;
merge ktrace-lwp.
 1.90 20-Jul-2005  drochner minor cleanup: some "const", global namespace sanity and fix a maclo name
 1.89 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.88 08-Jun-2005  fair branches: 1.88.2;
Change the name of a shadowed variable in FW_DEBUG code to make this
compile again.
 1.87 31-May-2005  christos fix handling of volatile and remove bogus casts.
 1.86 22-May-2005  christos No 0x in front of %p...
 1.85 26-Mar-2005  christos move an assignment up.
 1.84 27-Feb-2005  perry branches: 1.84.2; 1.84.4; 1.84.6;
nuke trailing whitespace
 1.83 13-Sep-2004  drochner branches: 1.83.4; 1.83.6;
a round of autoconf cleanup:
-convert submatch() style functions (passed to config_search() or
config_found_sm()) to the locator passing variants
-pass interface attributes in some cases
-make submatch() functions look uniformly as far as possible
-avoid macros which just hide cfdata members, and reduce dependencies
on "locators.h"
 1.82 04-Dec-2003  keihan netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.81 26-Oct-2003  fvdl Fix unitialized var warning, add a comment to indicate that it's use
is suspect.
 1.80 26-Oct-2003  christos Fix unitialized variable warnings.
 1.79 22-Oct-2003  mjl Typos in comments. From OpenBSD.
 1.78 29-Jun-2003  fvdl branches: 1.78.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.77 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.76 26-May-2003  haya Bugfix: fwohci_ir_read(): loop continues when the buffer size not only
greater than but also same as packet size. This bug is pointed out by
FUKAUMI Naoki.
 1.75 03-May-2003  wiz DMA, not dma nor Dma.
 1.74 02-Apr-2003  christos PR/20982: Eric Fair: fix debugging printf format errors.
 1.73 31-Jan-2003  thorpej Use aprint_*().
 1.72 06-Jan-2003  wiz synchronous, not syncronous.
 1.71 05-Jan-2003  jmc Add some missing splx()'s noted by Krister Walfridsson
 1.70 05-Jan-2003  jmc Remove arbitrary bufcnt limit in at_output.
 1.69 01-Jan-2003  thorpej Use aprint_normal() in cfprint routines.
 1.68 19-Dec-2002  jmc Add additional debugging for fwohci_arrq_input: no listener conditions
 1.67 13-Dec-2002  jmc Improve performance with disks almost 60x by redoing the callback handler to
accept ranges as well as single addresses. Still need to go through any key
areas and remove the malloc's and replace these with some sort of pooling
instead.
 1.66 09-Dec-2002  jmc Restructure how the at_output dma map gets setup. Ask for a dma map that can
support up to the max ohci descriptor segments. Then attempt to fill it in
via a load. Use the number of segments filled in as the basis for figuring
out how many descriptors to supply to the ohci DMA engine.

XXX: Still needs to account for requests which because of splits may overflow
the 6 dma descriptors available today. For now this fixes cases where a
single 512 byte write was getting split into 2 dma segments from 1 incoming
iov request
 1.65 09-Dec-2002  jmc Fix fwohci_write's sanity check against large packets. Max rec is only used
when writing directly to the device (ala IEEE1394_TCODE_WRITE_REQ_BLOCK).
Otherwise the largest size is determined strictly by speed
 1.64 06-Dec-2002  jmc Fill in sc1394_node_id after a self id cycle
 1.63 05-Dec-2002  agc Cast appropriately so that this compiles on sparc, sparc64, macppc etc.
 1.62 04-Dec-2002  haya New Feature: add pseudo device for IEEE 1394 isochronous stream and
isochronous reception routine for IEEE 1394 OHCI (fwohci). The
transmission part is under construction.

The minimum configuration options for this feature are:

# IEEE 1394 (i.LINK)
fwohci* at pci? dev ? function ?
pseudo-device fwiso 1
 1.61 01-Dec-2002  jmc Correct calculating of offsets when memcpy returned data.
 1.60 30-Nov-2002  jmc Print out some more details from incoming packets (tlabel's).

Also, when receiving a write packet, respond with a proper ack if something
was available to process it. (Fixes most of the sbp2 random hangs)
 1.59 25-Nov-2002  thorpej Add ULL to 64-bit integer constants.
 1.58 22-Nov-2002  jmc Change structure/usage of interface provided callbacks. (read, write, reset)
Push these up to the ieee1394 softc level and make the naming scheme
consistant.
 1.57 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.56 27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.55 24-Jun-2002  itojun remove obsolete use of M_LINK0. it was planned to be used to identify
isosynchronous stream from others, but end up not being used.
From: Hayakawa Koichi <haya@ilink.sony.co.jp>
 1.54 29-Mar-2002  jmc branches: 1.54.2;
Clean up some comments
 1.53 27-Feb-2002  jmc Change/pretty up some debugging info.

Also, add unit location fields to the ROM image. The p1212 spec requires
unit locations if you have 2 or more unit directories which is the case for
ipv4 and ipv6 compiled into a kernel.
 1.52 18-Feb-2002  jmc Print the tcode in hex when debugging like all other debug statements
 1.51 03-Feb-2002  jmc Add an unreg function.

Add a uio struct to the abuf so direct uio supporting calls can be setup.

Change all refs of csr in the abuf to addr as thats it's real function.
 1.50 16-Jan-2002  eeh Fix illegal pointer manipulations that cause alignment problems.
 1.49 12-Jan-2002  tsutsui Call malloc(9) with M_ZERO flag instead of memset() after malloc().
 1.48 09-Jan-2002  drochner cosmetics: print a "\n" terminated string if no "fw at fwohci" is
configured
 1.47 29-Dec-2001  ichiro implement fwohci detach routine.
 1.46 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.45 13-Nov-2001  lukem add RCSID
 1.44 12-Oct-2001  haya Bugfix: re-order double buffer only when second buffer exists.
 1.43 18-Sep-2001  tsutsui Fix typo in printf format.
 1.42 07-Sep-2001  haya Bugfix: re-order buffers when they are released.
 1.41 18-Jul-2001  onoe branches: 1.41.2;
make it compilable:
fw_verbose, fw_dump -> fwdebug (DPRINTFN)
add sc1394_ifsetiso into ieee1394_softc
 1.40 17-Jul-2001  haya New Feature: Add isochronous stream input routine. This feature has
been tested on i386. It does not have any interface for useland to
get isochoronous stream. The isochoronous acquisition interface
should be determined.
 1.39 02-Jul-2001  onoe branches: 1.39.2;
performance improvement in fwohci_pkt_get() for asynchronous read.
 1.38 02-Jul-2001  onoe set/reset low level receive handler according to IFF_UP flag of network
interface.
 1.37 02-Jul-2001  onoe FW_DEBUG only: move descriptor dump from DPRINTFN(1) to DPRINTFN(2).
fix indent in packet dump.
 1.36 29-Jun-2001  onoe Fixes to make if_fw work:
- fwohci_arrq_input: Do not return if next packet is in the buffer,
or the next packet cannot be received until the next receive interrupt.
- fwohci_uid_collect: XXX change M_WAITOK to M_NOWAIT for now, since there is
no lock but only one instance must be allowed here.
split fwohci_uid_req() and retry to get uid.
XXX need timer to wait some moment between retries...
- Add DELAY(10) for wait loop.
- split fwohci_buf_stop() into _stop_tx() and _stop_rx() because receiver
should not be stopped at bus-reset.
- split fwohci_buf_input() into _input() and _input_ppb() to improve
performance slightly.
 1.35 28-Jun-2001  onoe simplify and localize to access sc_intmask in fwohci_event_thread().
 1.34 28-Jun-2001  onoe Simplify to update sc_intmask in fwohci_intr().
 1.33 28-Jun-2001  onoe FW_DEBUG: split debug printf in fwohci_intr() and fwohci_phy_input() into
fwohci_show_intr() and fwohci_show_phypkt() respectively.
 1.32 25-Jun-2001  onoe fix printf to DPRINTFN inside FW_DEBUG
 1.31 15-May-2001  jmc Various small changes.
Clean up one bug in a DPRINTF in arrs_input which could panic on some packets.
Gut the ack/response functionality and clean it up so all packets get checked
correctly and the abuf struct isn't used once the ab_cb has happened (there
still could be ack packets waiting to be processed at that time).
Finally, add some documentation explaining read/write/inreg and their
purpose/argument calling.
 1.30 13-May-2001  jmc Add locators support
 1.29 11-May-2001  jmc Add first pass generic ack callback code (to eventually replace mbuf specific code).
Change ab_node's to ab_req.
Fix a bug where setting BIBValid on OHCI 1.0 chips (this is a reserved bit
on 1.0)
 1.28 03-May-2001  jmc Change to DPRINTF/DPRINTFN for debug output.
 1.27 01-May-2001  enami Avoid null pointer dereference.
 1.26 01-May-2001  enami Fix whitespace usage (fow now, previously existing code only just due to
my time shortage):
- Use 8 column for basic indent.
- Use 4 space for 2nd level indent.
- Use tab instead of 8 spaces.
- Don't put space before function call operator. That's unary operator.
- Wrap lines so that it fits in 80 columns.
 1.25 01-May-2001  jmc Remove some one-off debug printf's
 1.24 01-May-2001  jmc Extensive changes from fwnode integration
Move interrupt routine to simply updating state flags and ack'ing interrupts
Move main processing into kthread
Change IPL level to IPL_BIO and try not to hold splbio very much if at all.
Add baseline support for attaching/detaching/updating fwnode's.
Start adding higher level API which isn't tied to if_fw/mbuf's
 1.23 13-Apr-2001  thorpej Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.22 15-Mar-2001  enami Make fwohci works on big endian cpu (e.g., powermac g4).
 1.21 14-Mar-2001  onoe make compilable again without FW_DEBUG.
 1.20 12-Mar-2001  onoe Fix to validate selfid buffer according to the OHCI spec.
1. read 'gen' from first quadlet of the buffer.
2. raed selfid packets in the buffer.
3. confirm 'gen' field of the SELFID register matches 1.
 1.19 12-Mar-2001  onoe Reinitialize context match register at fwohci_hw_init()
to receive asynchronous stream data after suspend/resume.
 1.18 12-Mar-2001  onoe use OHCI_BITVAL(val, name), instead of
((val) & (name##_MASK)) >> name##_BITPOS
 1.17 12-Mar-2001  onoe change fw_verbose inside #ifdef FW_DEBUG
0) no verbose messages.
1) print non-fatal errors, nodeid, unique ID for other nodes.
2) extra printfs.
 1.16 03-Mar-2001  onoe branches: 1.16.2;
Do not require GUID ROM, which is optional according to the OHCI spec.
Use Global UID register as is, it should be initialized by firmware.
If it is not initialized (i.e. 0), try to read GUID ROM if exists.
On my VAIO PCG-N505AS, the version register says it implement GUID ROM,
but reading GUID ROM returns all zero bytes. I'm not sure where the bug is.
 1.15 03-Mar-2001  onoe fix length calculation not to overrun in receiving packets around MHLEN.
 1.14 13-Dec-2000  enami Add RCS Id.
 1.13 30-Nov-2000  enami Pass the right size of object (in this case, a trailer) to fwohci_buf_pktget.
Since the fp_trail is a pointer to trailer, we have to pass sizeof(*fp_trail)
instead of sizeof(fp_trail).
 1.12 30-Nov-2000  enami Make this file compiles on alpha even if FW_DEBUG is defined.
 1.11 30-Nov-2000  enami Pass the right max segment size to bus_dmamap_create.
 1.10 26-Nov-2000  takemura Add new powerhook argument values, PWR_SOFTSUSPEND, PWR_SOFTSTANDBY and
PWR_SOFTRESUME. Apm calls powerhook with the values in normal interrupt
priority level while others are protected with splhigh().
 1.9 20-Nov-2000  onoe Use DMA from mbuf instead of copy in transmit.
Still use memcpy in receiving because we must use buffer fill mode
and many packets may share single receive buffer.

XXX: Workaround(?) for CXD3222: it fails to DMA for selfid packet according
to code placement. I'm not sure about the reason (cache? timing? bug?).

Fixed the bug: transmitter sometimes stop and OACTIVE bit of if_fw
never be cleared.
Fixed the bug: freeing free buffer.

Enable ieee1394_drain and ieee1394_watchdog for loss of fragment.
 1.8 14-Nov-2000  onoe branches: 1.8.2;
Add support for link fragmentation and reassemble for IEEE-1394.
XXX: drain is still not yet implemented, thus memory leak will occur
in case of any of fragment lost.
 1.7 08-Nov-2000  onoe Add powerhook and shutdownhook to support Notebook.
Use PAGE_SIZE instead of OHCI_PAGE_SIZE for each DMA mem.
OHCI_PAGE_SIZE(2kB) will be round up PAGE_SIZE, anyway.
XXX: need more sophisticated way to manage buffer.
Clear IntEvent first not to lose SelfIDCompleted in multiple bus reset.
Be careful not to clear BusReset int event in SelfID duration to follow
the OHCI spec.
Initiate BusReset if selfid is not completed within 3sec after busreset.
 1.6 05-Nov-2000  onoe make it compilable with FW_DEBUG
 1.5 05-Nov-2000  matt Merge in my some of my stuff.
 1.4 05-Nov-2000  jdolecek make compilable without FW_DEBUG
 1.3 05-Nov-2000  onoe First Prototype implementation of network interface part for IEEE1394 (if_fw).

Current status:
Only OHCI chip is supported (fwohci).
ping (IPv4) works with Sony's implementation (SmartConnect) on Win98.
sometimes works but not stable.
Not implemented yet:
IRM (Isochronous Resource Manager) functionality.
Link layer fragmentation.
Topology map.
More to do:
clean ups
MCAP
charactor device part
dhcp

There is no entry in GENERIC config file yet.
Follow sys/dev/ieee1394/IMPLEMENTATION to enable if_fw.
 1.2 30-May-2000  augustss branches: 1.2.4;
Make this file compile. (I know it's just a placeholder, but I couldn't
resist trying it.)
 1.1 30-May-2000  matt Beginning of a IEEE 1394 framework. An attachment for PCI OHCI controllers
and bus-independent module that just begins to print things out. No real
code behind it. THIS IS A WORK IN PROGRESS. The *reg.h are woefully
incomplete.
 1.2.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.4.1 30-May-2000  minoura file fwohci.c was added on branch minoura-xpg4dl on 2000-06-22 17:07:06 +0000
 1.8.2.8 21-Apr-2001  bouyer Sync with HEAD
 1.8.2.7 27-Mar-2001  bouyer Sync with HEAD.
 1.8.2.6 12-Mar-2001  bouyer Sync with HEAD.
 1.8.2.5 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.8.2.4 08-Dec-2000  bouyer Sync with HEAD.
 1.8.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.8.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.2.1 14-Nov-2000  bouyer file fwohci.c was added on branch thorpej_scsipi on 2000-11-20 11:41:09 +0000
 1.16.2.17 07-Jan-2003  thorpej Sync with HEAD.
 1.16.2.16 03-Jan-2003  thorpej Sync with HEAD.
 1.16.2.15 29-Dec-2002  thorpej Sync with HEAD.
 1.16.2.14 19-Dec-2002  thorpej Sync with HEAD.
 1.16.2.13 11-Dec-2002  thorpej Sync with HEAD.
 1.16.2.12 18-Oct-2002  nathanw Catch up to -current.
 1.16.2.11 01-Aug-2002  nathanw Catch up to -current.
 1.16.2.10 17-Apr-2002  nathanw Catch up to -current.
 1.16.2.9 28-Feb-2002  nathanw Catch up to -current.
 1.16.2.8 11-Jan-2002  nathanw More catchup.
 1.16.2.7 08-Jan-2002  nathanw Catch up to -current.
 1.16.2.6 14-Nov-2001  nathanw Catch up to -current.
 1.16.2.5 22-Oct-2001  nathanw Catch up to -current.
 1.16.2.4 21-Sep-2001  nathanw Catch up to -current.
 1.16.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.16.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.16.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.39.2.8 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.39.2.7 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.39.2.6 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.39.2.5 16-Mar-2002  jdolecek Catch up with -current.
 1.39.2.4 11-Feb-2002  jdolecek Sync w/ -current.
 1.39.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.39.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.39.2.1 03-Aug-2001  lukem update to -current
 1.41.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.54.2.1 15-Jul-2002  gehenna catch up with -current.
 1.78.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.78.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.78.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.78.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.78.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.78.2.2 03-Aug-2004  skrll Sync with HEAD
 1.78.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.83.6.2 26-Mar-2005  yamt sync with head.
 1.83.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.83.4.1 29-Apr-2005  kent sync with -current
 1.84.6.1 09-Sep-2007  bouyer Apply patch (requested by christos in ticket #1835):
sys/dev/ieee1394/fwohci.c: patch
PR kern/36945 by Ross Philipson: Remove call to fwohci_desc_put() in an error
path where fwohci_desc_get() has not been called yet.
 1.84.4.1 09-Sep-2007  bouyer Apply patch (requested by christos in ticket #1835):
sys/dev/ieee1394/fwohci.c: patch
PR kern/36945 by Ross Philipson: Remove call to fwohci_desc_put() in an error
path where fwohci_desc_get() has not been called yet.
 1.84.2.1 09-Sep-2007  bouyer Apply patch (requested by christos in ticket #1835):
sys/dev/ieee1394/fwohci.c: patch
PR kern/36945 by Ross Philipson: Remove call to fwohci_desc_put() in an error
path where fwohci_desc_get() has not been called yet.
 1.88.2.6 21-Jan-2008  yamt sync with head
 1.88.2.5 15-Nov-2007  yamt sync with head.
 1.88.2.4 27-Oct-2007  yamt sync with head.
 1.88.2.3 03-Sep-2007  yamt sync with head.
 1.88.2.2 30-Dec-2006  yamt sync with head.
 1.88.2.1 21-Jun-2006  yamt sync with head.
 1.91.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.91.10.2 11-May-2006  elad sync with head
 1.91.10.1 19-Apr-2006  elad sync with head.
 1.91.8.2 26-Jun-2006  yamt sync with head.
 1.91.8.1 24-May-2006  yamt sync with head.
 1.91.6.2 01-Jun-2006  kardel Sync with head.
 1.91.6.1 22-Apr-2006  simonb Sync with head.
 1.91.4.1 09-Sep-2006  rpaulo sync with head
 1.99.2.1 19-Jun-2006  chap Sync with head.
 1.100.8.3 21-Dec-2006  yamt sync with head.
 1.100.8.2 10-Dec-2006  yamt sync with head.
 1.100.8.1 22-Oct-2006  yamt sync with head
 1.100.6.2 12-Jan-2007  ad Sync with head.
 1.100.6.1 18-Nov-2006  ad Sync with head.
 1.103.2.1 30-Dec-2006  riz Pull up following revision(s) (requested by kiyohara in ticket #297):
sys/dev/ieee1394/fwohci.c: revision 1.104
Fix memory allocation, in case isochronous transfer fail this.
 1.105.2.2 07-May-2007  yamt sync with head.
 1.105.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.106.4.1 11-Jul-2007  mjf Sync with head.
 1.106.2.3 23-Oct-2007  ad Sync with head.
 1.106.2.2 09-Oct-2007  ad Sync with head.
 1.106.2.1 27-May-2007  ad Sync with head.
 1.107.10.1 06-Oct-2007  yamt sync with head.
 1.107.8.3 09-Jan-2008  matt sync with HEAD
 1.107.8.2 08-Nov-2007  matt sync with -HEAD
 1.107.8.1 06-Nov-2007  matt sync with HEAD
 1.107.6.4 28-Nov-2007  jmcneill Bail out from interrupt handler if device is not active.
 1.107.6.3 06-Nov-2007  joerg Sync with HEAD.
 1.107.6.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.107.6.1 02-Oct-2007  joerg Sync with HEAD.
 1.108.2.2 13-Nov-2007  bouyer Sync with HEAD
 1.108.2.1 25-Oct-2007  bouyer Sync with HEAD.
 1.110.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.110.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.112.4.1 11-Dec-2007  yamt sync with head.
 1.112.2.1 26-Dec-2007  ad Sync with head.
 1.113.16.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.113.14.4 09-Oct-2010  yamt sync with head
 1.113.14.3 11-Aug-2010  yamt sync with head.
 1.113.14.2 04-May-2009  yamt sync with head.
 1.113.14.1 16-May-2008  yamt sync with head.
 1.113.12.1 18-May-2008  yamt sync with head.
 1.113.10.2 17-Jan-2009  mjf Sync with HEAD.
 1.113.10.1 02-Jun-2008  mjf Sync with HEAD.
 1.114.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.114.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.114.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.115.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.120.4.3 31-May-2011  rmind sync with head
 1.120.4.2 05-Mar-2011  rmind sync with head
 1.120.4.1 30-May-2010  rmind sync with head
 1.120.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.120.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.130.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.132.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.132.2.1 30-Oct-2012  yamt sync with head
 1.133.2.3 03-Dec-2017  jdolecek update from HEAD
 1.133.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.133.2.1 23-Jun-2013  tls resync from head
 1.134.4.1 18-May-2014  rmind sync with head
 1.137.10.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.137.6.1 05-Dec-2016  skrll Sync with HEAD
 1.141.16.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.141.16.1 10-Jun-2019  christos Sync with HEAD
 1.142.2.2 31-Jan-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #671):

sys/dev/pci/if_bce.c: revision 1.53
sys/dev/pci/pccbbreg.h: revision 1.16
sys/dev/ic/rt2860.c: revision 1.34
sys/dev/pci/if_alc.c: revision 1.45
sys/dev/pci/if_mcx.c: revision 1.5
sys/dev/pci/if_pcn.c: revision 1.72
sys/dev/pci/if_ale.c: revision 1.37
sys/dev/pci/if_age.c: revision 1.65
sys/dev/ieee1394/fwohcireg.h: revision 1.20
sys/dev/ieee1394/fwohci.c: revision 1.143
sys/dev/ieee1394/firewire.c: revision 1.49
sys/dev/ic/am79900reg.h: revision 1.10

Use unsigned to avoid undefined behavior. Found by kUBSan.
 1.142.2.1 27-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #492):

sys/dev/pci/sv.c: revision 1.57
sys/dev/pci/eso.c: revision 1.72
sys/dev/ieee1394/fwohci.c: revision 1.144

Fix operand priority of bit op vs ternary operator.
 1.144.10.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.145.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.21 05-Jul-2024  andvar s/vender/vendor/ in comments, log message and fw ohci register property.
 1.20 15-Oct-2019  msaitoh branches: 1.20.32;
Use unsigned to avoid undefined behavior. Found by kUBSan.
 1.19 31-Mar-2018  sevan branches: 1.19.2; 1.19.8;
Listed UniNorth device is in fact the UniNorth 2 interface, rename.
https://pci-ids.ucw.cz/read/PC/106b/0031
 1.18 29-Mar-2010  kiyohara branches: 1.18.58;
Bye-bye fw_port.h.
 1.17 05-Nov-2007  kiyohara branches: 1.17.20; 1.17.40; 1.17.42;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.16 04-Mar-2007  christos branches: 1.16.14; 1.16.16; 1.16.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.15 11-Dec-2005  christos branches: 1.15.26;
merge ktrace-lwp.
 1.14 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.13 22-Oct-2003  mjl branches: 1.13.16;
Typos in comments. From OpenBSD.
 1.12 04-Dec-2002  haya branches: 1.12.6;
New Feature: add pseudo device for IEEE 1394 isochronous stream and
isochronous reception routine for IEEE 1394 OHCI (fwohci). The
transmission part is under construction.

The minimum configuration options for this feature are:

# IEEE 1394 (i.LINK)
fwohci* at pci? dev ? function ?
pseudo-device fwiso 1
 1.11 26-Jan-2002  ichiro OCHI -> OHCI
 1.10 02-Jul-2001  onoe branches: 1.10.2;
fix typo: CLear -> Clear
 1.9 11-May-2001  jmc Add mask for getting the ACK bits out of the status area of a DMA context descriptor
 1.8 15-Mar-2001  enami - Wrap long line.
- Consistently use #define<TAB> instead of #define<SPACE>.
 1.7 12-Mar-2001  onoe use OHCI_BITVAL(val, name), instead of
((val) & (name##_MASK)) >> name##_BITPOS
 1.6 03-Mar-2001  onoe branches: 1.6.2;
Do not require GUID ROM, which is optional according to the OHCI spec.
Use Global UID register as is, it should be initialized by firmware.
If it is not initialized (i.e. 0), try to read GUID ROM if exists.
On my VAIO PCG-N505AS, the version register says it implement GUID ROM,
but reading GUID ROM returns all zero bytes. I'm not sure where the bug is.
 1.5 13-Dec-2000  enami Add RCS Id.
 1.4 20-Nov-2000  onoe Use DMA from mbuf instead of copy in transmit.
Still use memcpy in receiving because we must use buffer fill mode
and many packets may share single receive buffer.

XXX: Workaround(?) for CXD3222: it fails to DMA for selfid packet according
to code placement. I'm not sure about the reason (cache? timing? bug?).

Fixed the bug: transmitter sometimes stop and OACTIVE bit of if_fw
never be cleared.
Fixed the bug: freeing free buffer.

Enable ieee1394_drain and ieee1394_watchdog for loss of fragment.
 1.3 05-Nov-2000  matt branches: 1.3.2;
Merge in my some of my stuff.
 1.2 05-Nov-2000  onoe First Prototype implementation of network interface part for IEEE1394 (if_fw).

Current status:
Only OHCI chip is supported (fwohci).
ping (IPv4) works with Sony's implementation (SmartConnect) on Win98.
sometimes works but not stable.
Not implemented yet:
IRM (Isochronous Resource Manager) functionality.
Link layer fragmentation.
Topology map.
More to do:
clean ups
MCAP
charactor device part
dhcp

There is no entry in GENERIC config file yet.
Follow sys/dev/ieee1394/IMPLEMENTATION to enable if_fw.
 1.1 30-May-2000  matt branches: 1.1.4;
Beginning of a IEEE 1394 framework. An attachment for PCI OHCI controllers
and bus-independent module that just begins to print things out. No real
code behind it. THIS IS A WORK IN PROGRESS. The *reg.h are woefully
incomplete.
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 30-May-2000  minoura file fwohcireg.h was added on branch minoura-xpg4dl on 2000-06-22 17:07:07 +0000
 1.3.2.6 27-Mar-2001  bouyer Sync with HEAD.
 1.3.2.5 12-Mar-2001  bouyer Sync with HEAD.
 1.3.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.3.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.3.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.1 05-Nov-2000  bouyer file fwohcireg.h was added on branch thorpej_scsipi on 2000-11-20 11:41:10 +0000
 1.6.2.5 11-Dec-2002  thorpej Sync with HEAD.
 1.6.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.6.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.6.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.6.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.10.2.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.12.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.6.1 03-Aug-2004  skrll Sync with HEAD
 1.13.16.3 15-Nov-2007  yamt sync with head.
 1.13.16.2 03-Sep-2007  yamt sync with head.
 1.13.16.1 21-Jun-2006  yamt sync with head.
 1.15.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.16.20.1 13-Nov-2007  bouyer Sync with HEAD
 1.16.16.1 06-Nov-2007  matt sync with HEAD
 1.16.14.1 06-Nov-2007  joerg Sync with HEAD.
 1.17.42.1 30-May-2010  rmind sync with head
 1.17.40.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.17.20.1 11-Aug-2010  yamt sync with head.
 1.18.58.1 07-Apr-2018  pgoyette Sync with HEAD. 77 conflicts resolved - all of them $NetBSD$
 1.19.8.1 31-Jan-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #671):

sys/dev/pci/if_bce.c: revision 1.53
sys/dev/pci/pccbbreg.h: revision 1.16
sys/dev/ic/rt2860.c: revision 1.34
sys/dev/pci/if_alc.c: revision 1.45
sys/dev/pci/if_mcx.c: revision 1.5
sys/dev/pci/if_pcn.c: revision 1.72
sys/dev/pci/if_ale.c: revision 1.37
sys/dev/pci/if_age.c: revision 1.65
sys/dev/ieee1394/fwohcireg.h: revision 1.20
sys/dev/ieee1394/fwohci.c: revision 1.143
sys/dev/ieee1394/firewire.c: revision 1.49
sys/dev/ic/am79900reg.h: revision 1.10

Use unsigned to avoid undefined behavior. Found by kUBSan.
 1.19.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.20.32.1 02-Aug-2025  perseant Sync with HEAD
 1.34 04-Aug-2012  riastradh Fix error branches and config pending races in firewire init.

This way, if anything fails, it just fails; you don't panic. This can
happen if suspending and resuming of firewire is broken (e.g., as I
encountered in PR kern/44581).
 1.33 29-Apr-2012  dsl Change to consistently use M_FW for all malloc/free.
It probably doesn't matter any more, but the code doesn't appear to
have matched its mallocs and frees - so the stats would have been awol.
 1.32 23-May-2010  christos branches: 1.32.8; 1.32.12;
Revert all previous kmem_ commits. This needs to be done in a different way
because we cannot call kmem_ from an interrupt context. I opened PR/43341 for
it.
 1.31 23-May-2010  christos Don't allocate sid scratch memory from an interrupt context:

fwohci0: BUS reset
fwohci0: node_id=0xc800ffc0, gen=1, CYCLEMASTER mode
panic: kernel diagnostic assertion "!cpu_intr_p()" failed: file "../../../../ker
n/subr_kmem.c", line 195
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip ffffffff8022db1d cs 8 rflags 246 cr2 0 cpl 6 rsp fffffff
f80fafb68
breakpoint() at netbsd:breakpoint+0x5
panic() at netbsd:panic+0x2ba
kern_assert() at netbsd:kern_assert+0x2d
kmem_alloc() at netbsd:kmem_alloc+0x18a
fwohci_intr() at netbsd:fwohci_intr+0xbe2
...

I will send-pr for the next one... Looks like someone did not use DIAGNOSTIC
when made the changes.
 1.30 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.29 06-Nov-2007  kiyohara branches: 1.29.18; 1.29.38; 1.29.40;
The argument of *_intr_establish() is changed to fwohci_flit.
Our ieee1394 coordinates from FreeBSD implementation.
Add fwohci_pci_shutdown() and fwohci_pci_power().
Move __KERNEL_RCSID to ahead.
 1.28 06-Nov-2007  dogcow on NetBSD, cardbus_intr_establish's fifth arg's is a symbol which returns
an int, not a void; change fwohci_intr accordingly.
 1.27 05-Nov-2007  kiyohara branches: 1.27.2;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.26 21-Apr-2007  kiyohara branches: 1.26.6; 1.26.8; 1.26.12;
firewire.c sync to Rev.1.86 for FreeBSD.
firewirereg.h sync to Rev.1.41 for FreeBSD.
fwcrom.c sync to Rev.1.14 for FreeBSD.
fwdev.c sync to Rev.1.49 for FreeBSD.
fwmem.c sync to Rev.1.32 for FreeBSD.
fwohci.c sync to Rev.1.86 for FreeBSD.
fwohcivar.h sync to Rev.1.15 for FreeBSD.
if_fwip.c sync to Rev.1.14 for FreeBSD.
if_fwipvar.h sync to Rev.1.4 for FreeBSD.
sbp.c sync to Rev.1.89 for FreeBSD.
 1.25 11-Dec-2005  christos branches: 1.25.26; 1.25.30; 1.25.32;
merge ktrace-lwp.
 1.24 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.23 31-May-2005  christos branches: 1.23.2;
fix handling of volatile and remove bogus casts.
 1.22 27-Feb-2005  perry nuke trailing whitespace
 1.21 08-Jul-2003  itojun branches: 1.21.8; 1.21.10;
function prototype must not have variable name
 1.20 13-Dec-2002  jmc branches: 1.20.6;
Improve performance with disks almost 60x by redoing the callback handler to
accept ranges as well as single addresses. Still need to go through any key
areas and remove the malloc's and replace these with some sort of pooling
instead.
 1.19 04-Dec-2002  haya New Feature: add pseudo device for IEEE 1394 isochronous stream and
isochronous reception routine for IEEE 1394 OHCI (fwohci). The
transmission part is under construction.

The minimum configuration options for this feature are:

# IEEE 1394 (i.LINK)
fwohci* at pci? dev ? function ?
pseudo-device fwiso 1
 1.18 21-Jun-2002  itojun don't pull in sys/mbuf.h just for prototype decl
 1.17 16-Jan-2002  eeh branches: 1.17.8;
Fix illegal pointer manipulations that cause alignment problems.
 1.16 29-Dec-2001  ichiro implement fwohci detach routine.
 1.15 17-Jul-2001  haya New Feature: Add isochronous stream input routine. This feature has
been tested on i386. It does not have any interface for useland to
get isochoronous stream. The isochoronous acquisition interface
should be determined.
 1.14 15-May-2001  jmc branches: 1.14.2;
Various small changes.
Clean up one bug in a DPRINTF in arrs_input which could panic on some packets.
Gut the ack/response functionality and clean it up so all packets get checked
correctly and the abuf struct isn't used once the ab_cb has happened (there
still could be ack packets waiting to be processed at that time).
Finally, add some documentation explaining read/write/inreg and their
purpose/argument calling.
 1.13 13-May-2001  jmc Add locators support
 1.12 11-May-2001  jmc Add first pass of generalized hooks for packet completion (i.e. ack) codes. This will eventually replace the mbuf code when it moves back to if_fw.c where it belongs.
 1.11 03-May-2001  jmc Style police. Got the tab'ing correct
 1.10 01-May-2001  enami Fix whitespace usage (fow now, previously existing code only just due to
my time shortage):
- Use 8 column for basic indent.
- Use 4 space for 2nd level indent.
- Use tab instead of 8 spaces.
- Don't put space before function call operator. That's unary operator.
- Wrap lines so that it fits in 80 columns.
 1.9 01-May-2001  jmc Add proc struct for kthread, interrupt handler flags, and nodelist
 1.8 15-Mar-2001  enami Make fwohci works on big endian cpu (e.g., powermac g4).
 1.7 13-Dec-2000  enami branches: 1.7.2;
Add RCS Id.
 1.6 20-Nov-2000  onoe Use DMA from mbuf instead of copy in transmit.
Still use memcpy in receiving because we must use buffer fill mode
and many packets may share single receive buffer.

XXX: Workaround(?) for CXD3222: it fails to DMA for selfid packet according
to code placement. I'm not sure about the reason (cache? timing? bug?).

Fixed the bug: transmitter sometimes stop and OACTIVE bit of if_fw
never be cleared.
Fixed the bug: freeing free buffer.

Enable ieee1394_drain and ieee1394_watchdog for loss of fragment.
 1.5 14-Nov-2000  onoe branches: 1.5.2;
Add support for link fragmentation and reassemble for IEEE-1394.
XXX: drain is still not yet implemented, thus memory leak will occur
in case of any of fragment lost.
 1.4 08-Nov-2000  onoe Add powerhook and shutdownhook to support Notebook.
Use PAGE_SIZE instead of OHCI_PAGE_SIZE for each DMA mem.
OHCI_PAGE_SIZE(2kB) will be round up PAGE_SIZE, anyway.
XXX: need more sophisticated way to manage buffer.
Clear IntEvent first not to lose SelfIDCompleted in multiple bus reset.
Be careful not to clear BusReset int event in SelfID duration to follow
the OHCI spec.
Initiate BusReset if selfid is not completed within 3sec after busreset.
 1.3 05-Nov-2000  matt Merge in my some of my stuff.
 1.2 05-Nov-2000  onoe First Prototype implementation of network interface part for IEEE1394 (if_fw).

Current status:
Only OHCI chip is supported (fwohci).
ping (IPv4) works with Sony's implementation (SmartConnect) on Win98.
sometimes works but not stable.
Not implemented yet:
IRM (Isochronous Resource Manager) functionality.
Link layer fragmentation.
Topology map.
More to do:
clean ups
MCAP
charactor device part
dhcp

There is no entry in GENERIC config file yet.
Follow sys/dev/ieee1394/IMPLEMENTATION to enable if_fw.
 1.1 30-May-2000  matt branches: 1.1.4;
Beginning of a IEEE 1394 framework. An attachment for PCI OHCI controllers
and bus-independent module that just begins to print things out. No real
code behind it. THIS IS A WORK IN PROGRESS. The *reg.h are woefully
incomplete.
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 30-May-2000  minoura file fwohcivar.h was added on branch minoura-xpg4dl on 2000-06-22 17:07:07 +0000
 1.5.2.5 27-Mar-2001  bouyer Sync with HEAD.
 1.5.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.5.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.5.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 14-Nov-2000  bouyer file fwohcivar.h was added on branch thorpej_scsipi on 2000-11-20 11:41:10 +0000
 1.7.2.8 19-Dec-2002  thorpej Sync with HEAD.
 1.7.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.7.2.6 01-Aug-2002  nathanw Catch up to -current.
 1.7.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.7.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.7.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.7.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.7.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.14.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.14.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.14.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.2.1 03-Aug-2001  lukem update to -current
 1.17.8.1 15-Jul-2002  gehenna catch up with -current.
 1.20.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.20.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.20.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.6.1 03-Aug-2004  skrll Sync with HEAD
 1.21.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.21.8.1 29-Apr-2005  kent sync with -current
 1.23.2.3 15-Nov-2007  yamt sync with head.
 1.23.2.2 03-Sep-2007  yamt sync with head.
 1.23.2.1 21-Jun-2006  yamt sync with head.
 1.25.32.1 11-Jul-2007  mjf Sync with head.
 1.25.30.1 27-May-2007  ad Sync with head.
 1.25.26.1 07-May-2007  yamt sync with head.
 1.26.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.26.8.1 06-Nov-2007  matt sync with HEAD
 1.26.6.1 06-Nov-2007  joerg Sync with HEAD.
 1.27.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.29.40.1 30-May-2010  rmind sync with head
 1.29.38.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.29.18.1 11-Aug-2010  yamt sync with head.
 1.32.12.1 29-Apr-2012  mrg sync to latest -current.
 1.32.8.2 30-Oct-2012  yamt sync with head
 1.32.8.1 23-May-2012  yamt sync with head.
 1.3 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.76; 1.2.98; 1.2.100;
merge ktrace-lwp.
 1.1 11-Jul-2005  kiyohara branches: 1.1.6;
ieee1394 import from FreeBSD.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file fwphyreg.h was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.2.100.1 30-May-2010  rmind sync with head
 1.2.98.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.2.76.1 11-Aug-2010  yamt sync with head.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file fwphyreg.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.10 22-Nov-2002  jmc First pass (checkpoint checkin) for firewire scsi code.

There are a number of issues here for anyone trying to use this today:

1. On my test drive the command engine on the drive seems to stall after the
inquire is done. So the mode sense times out for a long time before
aborting. This obviously needs to be tracked down and fixed.

However it does do a proper inquire:

scsibus0 at sbpscsi0: 1 target, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Maxtor, 1394 storage, 60> disk fixed

2. This code is quite ugly in places as debug code was added to test things.
Definitly needs cleanup/documention in places where it's using command
structures. The structure for alloc'ing orbs, running them through the
command engine and getting state back is mostly set but implementation needs
an overhaul in places.

3. For testing I use the following config options:

fwohci* at cardbus? dev ? function ? # IEEE1394 Controller
fw* at fwbus?
options FW_DEBUG
options FWNODE_DEBUG
options P1212_DEBUG
options SBP2_DEBUG
options SBPSCSI_DEBUG
fwnode* at fwbus?
sbpscsi* at fwnode?
scsibus* at sbpscsi?
 1.9 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.8 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.5 27-Feb-2002  jmc Basic prototype/beginning of firewire disk support using sbp2/scsi. Commiting
to have a baseline.
 1.4 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.3 13-Nov-2001  lukem add RCSID
 1.2 03-May-2001  jmc branches: 1.2.2; 1.2.4;
Style police. Got the tab'ing correct
 1.1 30-Apr-2001  jmc Place holder until real fwscsi code is fleshed out.
 1.2.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.2.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.2.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.1 03-May-2001  nathanw file fwscsi.c was added on branch nathanw_sa on 2001-06-21 20:03:43 +0000
 1.6 28-Mar-2014  htodd Fix build.
 1.5 26-Aug-2010  cegger branches: 1.5.8; 1.5.18; 1.5.22;
- print expected crc when it does not match
- add and print secondary text leaf. This prints the model name of my webcam.
- add csr keys that are printed as 'unknown' otherwise
 1.4 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.3 02-May-2008  xtraeme branches: 1.3.20; 1.3.22;
Constify, so that usr.sbin/fwctl can be built with WARNS=4.
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.72; 1.2.74; 1.2.76;
merge ktrace-lwp.
 1.1 11-Jul-2005  kiyohara branches: 1.1.6;
ieee1394 import from FreeBSD.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file iec13213.h was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.2.76.3 09-Oct-2010  yamt sync with head
 1.2.76.2 11-Aug-2010  yamt sync with head.
 1.2.76.1 16-May-2008  yamt sync with head.
 1.2.74.1 18-May-2008  yamt sync with head.
 1.2.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file iec13213.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.3.22.2 05-Mar-2011  rmind sync with head
 1.3.22.1 30-May-2010  rmind sync with head
 1.3.20.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.3.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.5.22.1 18-May-2014  rmind sync with head
 1.5.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.3 08-Sep-2008  gmcgarry branches: 1.3.14; 1.3.16;
Replace most gcc-specific __attribute__ uses with BSD-style sys/cdef.h
preprocessor macros.
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.72; 1.2.76; 1.2.78; 1.2.82;
merge ktrace-lwp.
 1.1 11-Jul-2005  kiyohara branches: 1.1.6;
ieee1394 import from FreeBSD.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file iec68113.h was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.2.82.1 19-Oct-2008  haad Sync with HEAD.
 1.2.78.1 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.2.76.2 11-Aug-2010  yamt sync with head.
 1.2.76.1 04-May-2009  yamt sync with head.
 1.2.72.1 28-Sep-2008  mjf Sync with HEAD.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file iec68113.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.3.16.1 30-May-2010  rmind sync with head
 1.3.14.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.19 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.18 27-Feb-2005  perry branches: 1.18.4;
nuke trailing whitespace
 1.17 04-Aug-2003  mrg branches: 1.17.8; 1.17.10;
sprinkle some LL suffixes on >32 bit number literals
 1.16 28-Dec-2002  jmc branches: 1.16.2;
Move SBP data area's below the 4G mark as some broken devices seem to clip data
address's to 32 bits.
XXX - Need to move the if_fw fifo addr as well but this needs some testing
 1.15 09-Dec-2002  jmc Provide a macro for turning a speed number into a max rec value
 1.14 04-Dec-2002  haya New Feature: add pseudo device for IEEE 1394 isochronous stream and
isochronous reception routine for IEEE 1394 OHCI (fwohci). The
transmission part is under construction.

The minimum configuration options for this feature are:

# IEEE 1394 (i.LINK)
fwohci* at pci? dev ? function ?
pseudo-device fwiso 1
 1.13 22-Nov-2002  jmc First pass (checkpoint checkin) for firewire scsi code.

There are a number of issues here for anyone trying to use this today:

1. On my test drive the command engine on the drive seems to stall after the
inquire is done. So the mode sense times out for a long time before
aborting. This obviously needs to be tracked down and fixed.

However it does do a proper inquire:

scsibus0 at sbpscsi0: 1 target, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Maxtor, 1394 storage, 60> disk fixed

2. This code is quite ugly in places as debug code was added to test things.
Definitly needs cleanup/documention in places where it's using command
structures. The structure for alloc'ing orbs, running them through the
command engine and getting state back is mostly set but implementation needs
an overhaul in places.

3. For testing I use the following config options:

fwohci* at cardbus? dev ? function ? # IEEE1394 Controller
fw* at fwbus?
options FW_DEBUG
options FWNODE_DEBUG
options P1212_DEBUG
options SBP2_DEBUG
options SBPSCSI_DEBUG
fwnode* at fwbus?
sbpscsi* at fwnode?
scsibus* at sbpscsi?
 1.12 27-Feb-2002  jmc Move definition of if_fw fifo location to ieee1394reg.h as it's needed for
filling in unit location in the rom.

XXX: This all is really too welded together. The if_fw code should be
decoupled from this and simply be handed a method by which it can provide
the config rom back to the main code.
 1.11 27-Feb-2002  jmc Add 3 more macros for extracting info from bus info block
 1.10 03-Feb-2002  jmc Add IEEE1394_MAX_REC macro
 1.9 17-Jul-2001  haya New Feature: Add isochronous stream input routine. This feature has
been tested on i386. It does not have any interface for useland to
get isochoronous stream. The isochoronous acquisition interface
should be determined.
 1.8 01-May-2001  enami branches: 1.8.2;
Fix whitespace usage (fow now, previously existing code only just due to
my time shortage):
- Use 8 column for basic indent.
- Use 4 space for 2nd level indent.
- Use tab instead of 8 spaces.
- Don't put space before function call operator. That's unary operator.
- Wrap lines so that it fits in 80 columns.
 1.7 01-May-2001  jmc Add a 64bit version of CSR_BASE
 1.6 29-Apr-2001  jmc Add #define for 1394 ROM signature
 1.5 13-Dec-2000  enami branches: 1.5.2;
Add RCS Id.
 1.4 05-Nov-2000  matt branches: 1.4.2;
Merge in my some of my stuff.
 1.3 05-Nov-2000  onoe First Prototype implementation of network interface part for IEEE1394 (if_fw).

Current status:
Only OHCI chip is supported (fwohci).
ping (IPv4) works with Sony's implementation (SmartConnect) on Win98.
sometimes works but not stable.
Not implemented yet:
IRM (Isochronous Resource Manager) functionality.
Link layer fragmentation.
Topology map.
More to do:
clean ups
MCAP
charactor device part
dhcp

There is no entry in GENERIC config file yet.
Follow sys/dev/ieee1394/IMPLEMENTATION to enable if_fw.
 1.2 30-May-2000  matt branches: 1.2.4;
add more speeds (up to 3.2Gb/s)
 1.1 30-May-2000  matt Beginning of a IEEE 1394 framework. An attachment for PCI OHCI controllers
and bus-independent module that just begins to print things out. No real
code behind it. THIS IS A WORK IN PROGRESS. The *reg.h are woefully
incomplete.
 1.2.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.4.1 30-May-2000  minoura file ieee1394reg.h was added on branch minoura-xpg4dl on 2000-06-22 17:07:08 +0000
 1.4.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.4.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.4.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.2.1 05-Nov-2000  bouyer file ieee1394reg.h was added on branch thorpej_scsipi on 2000-11-20 11:41:10 +0000
 1.5.2.5 29-Dec-2002  thorpej Sync with HEAD.
 1.5.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.5.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.5.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.5.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.8.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.8.2.1 03-Aug-2001  lukem update to -current
 1.16.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.16.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.16.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.2.1 03-Aug-2004  skrll Sync with HEAD
 1.17.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.17.8.1 29-Apr-2005  kent sync with -current
 1.18.4.1 21-Jun-2006  yamt sync with head.
 1.23 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.22 27-Feb-2005  perry branches: 1.22.4;
nuke trailing whitespace
 1.21 04-Feb-2005  perry de-__P
 1.20 29-Jun-2003  fvdl branches: 1.20.2; 1.20.10; 1.20.12;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.19 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.18 13-Dec-2002  jmc Improve performance with disks almost 60x by redoing the callback handler to
accept ranges as well as single addresses. Still need to go through any key
areas and remove the malloc's and replace these with some sort of pooling
instead.
 1.17 04-Dec-2002  haya New Feature: add pseudo device for IEEE 1394 isochronous stream and
isochronous reception routine for IEEE 1394 OHCI (fwohci). The
transmission part is under construction.

The minimum configuration options for this feature are:

# IEEE 1394 (i.LINK)
fwohci* at pci? dev ? function ?
pseudo-device fwiso 1
 1.16 22-Nov-2002  jmc Change structure/usage of interface provided callbacks. (read, write, reset)
Push these up to the ieee1394 softc level and make the naming scheme
consistant.
 1.15 27-Feb-2002  jmc Change length values to u_int32_t
 1.14 03-Feb-2002  jmc Add an unreg function.

Add a uio struct to the abuf so direct uio supporting calls can be setup.

Change all refs of csr in the abuf to addr as thats it's real function.
 1.13 18-Jul-2001  onoe make it compilable:
fw_verbose, fw_dump -> fwdebug (DPRINTFN)
add sc1394_ifsetiso into ieee1394_softc
 1.12 15-May-2001  jmc branches: 1.12.2;
Various small changes.
Clean up one bug in a DPRINTF in arrs_input which could panic on some packets.
Gut the ack/response functionality and clean it up so all packets get checked
correctly and the abuf struct isn't used once the ab_cb has happened (there
still could be ack packets waiting to be processed at that time).
Finally, add some documentation explaining read/write/inreg and their
purpose/argument calling.
 1.11 15-May-2001  jmc Back out last change until I get fwohci rototilled better for checking the ack bits. Makes things compile again.
 1.10 14-May-2001  jmc Remove ackcb. It's a duplicate of existing functionality.
 1.9 13-May-2001  jmc Add a retries counter to abuf
 1.8 11-May-2001  jmc Change abuf to include both requestor and responder softc's (for dealing with requests from other nodes later).
Add a callback so the ACK bits can be looked at if wanted.
Change the input/output pointers to proper proto's and rename to read/write.
 1.7 03-May-2001  jmc Style police. Got the tab'ing correct
 1.6 01-May-2001  enami Fix whitespace usage (fow now, previously existing code only just due to
my time shortage):
- Use 8 column for basic indent.
- Use 4 space for 2nd level indent.
- Use tab instead of 8 spaces.
- Don't put space before function call operator. That's unary operator.
- Wrap lines so that it fits in 80 columns.
 1.5 01-May-2001  jmc Extend ieee1394_abuf to include read/write operations cleanly.
Add ieee1394_attach_args
Add sc1394_configrom_len
Add list links for nodelists from parent bus.
 1.4 13-Dec-2000  enami branches: 1.4.2;
Add RCS Id.
 1.3 05-Nov-2000  matt branches: 1.3.2;
Merge in my some of my stuff.
 1.2 05-Nov-2000  onoe First Prototype implementation of network interface part for IEEE1394 (if_fw).

Current status:
Only OHCI chip is supported (fwohci).
ping (IPv4) works with Sony's implementation (SmartConnect) on Win98.
sometimes works but not stable.
Not implemented yet:
IRM (Isochronous Resource Manager) functionality.
Link layer fragmentation.
Topology map.
More to do:
clean ups
MCAP
charactor device part
dhcp

There is no entry in GENERIC config file yet.
Follow sys/dev/ieee1394/IMPLEMENTATION to enable if_fw.
 1.1 30-May-2000  matt branches: 1.1.4;
Beginning of a IEEE 1394 framework. An attachment for PCI OHCI controllers
and bus-independent module that just begins to print things out. No real
code behind it. THIS IS A WORK IN PROGRESS. The *reg.h are woefully
incomplete.
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 30-May-2000  minoura file ieee1394var.h was added on branch minoura-xpg4dl on 2000-06-22 17:07:09 +0000
 1.3.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.3.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.3.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.1 05-Nov-2000  bouyer file ieee1394var.h was added on branch thorpej_scsipi on 2000-11-20 11:41:10 +0000
 1.4.2.5 19-Dec-2002  thorpej Sync with HEAD.
 1.4.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.4.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.4.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.4.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.12.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.12.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.12.2.1 03-Aug-2001  lukem update to -current
 1.20.12.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.12.1 12-Feb-2005  yamt sync with head.
 1.20.10.1 29-Apr-2005  kent sync with -current
 1.20.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.20.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.20.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.20.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.22.4.1 21-Jun-2006  yamt sync with head.
 1.22 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.21 30-Apr-2004  lukem branches: 1.21.12;
rework messages so that 'fw0: maximum receive packet (2) is too small' error
doesn't appear corrupted.
 1.20 03-Jul-2003  drochner maintain statistics counters
 1.19 02-Oct-2002  thorpej branches: 1.19.6;
Add trailing ; to CFATTACH_DECL.
 1.18 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.17 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.16 21-Jun-2002  itojun rm unneeded #include
 1.15 06-Mar-2002  nathanw branches: 1.15.6;
Remove a variable that is unused after the previous ALTQ commit.
 1.14 05-Mar-2002  itojun bring in latest ALTQ from kjc. ALTQify some of the drivers.
 1.13 27-Feb-2002  jmc Move definition of if_fw fifo location to ieee1394reg.h as it's needed for
filling in unit location in the rom.

XXX: This all is really too welded together. The if_fw code should be
decoupled from this and simply be handed a method by which it can provide
the config rom back to the main code.
 1.12 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.11 13-Nov-2001  lukem add RCSID
 1.10 02-Jul-2001  onoe branches: 1.10.2;
set/reset low level receive handler according to IFF_UP flag of network
interface.
 1.9 29-Jun-2001  onoe Protect to call fw_start() recursively.
 1.8 11-May-2001  jmc Remove extraneous prototype
 1.7 01-May-2001  enami Fix whitespace usage (fow now, previously existing code only just due to
my time shortage):
- Use 8 column for basic indent.
- Use 4 space for 2nd level indent.
- Use tab instead of 8 spaces.
- Don't put space before function call operator. That's unary operator.
- Wrap lines so that it fits in 80 columns.
 1.6 01-May-2001  jmc Doesn't need fwohci include's. Change struct device to ieee1394_softc.
 1.5 03-Mar-2001  onoe branches: 1.5.2;
show 16 byte ifaddr instead of EUI-64 at attach.
 1.4 14-Dec-2000  thorpej XXX ALTQ (not done in 1394 layer yet).
 1.3 12-Dec-2000  thorpej Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.
 1.2 10-Nov-2000  enami branches: 1.2.2;
Remove lonely splx in fw_detach.
 1.1 05-Nov-2000  onoe First Prototype implementation of network interface part for IEEE1394 (if_fw).

Current status:
Only OHCI chip is supported (fwohci).
ping (IPv4) works with Sony's implementation (SmartConnect) on Win98.
sometimes works but not stable.
Not implemented yet:
IRM (Isochronous Resource Manager) functionality.
Link layer fragmentation.
Topology map.
More to do:
clean ups
MCAP
charactor device part
dhcp

There is no entry in GENERIC config file yet.
Follow sys/dev/ieee1394/IMPLEMENTATION to enable if_fw.
 1.2.2.5 12-Mar-2001  bouyer Sync with HEAD.
 1.2.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.2.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.2.2.1 10-Nov-2000  bouyer file if_fw.c was added on branch thorpej_scsipi on 2000-11-22 16:03:43 +0000
 1.5.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.5.2.7 01-Aug-2002  nathanw Catch up to -current.
 1.5.2.6 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.5.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.5.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.5.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.5.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.10.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.10.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.10.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.6.1 15-Jul-2002  gehenna catch up with -current.
 1.19.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.19.6.1 03-Aug-2004  skrll Sync with HEAD
 1.21.12.1 21-Jun-2006  yamt sync with head.
 1.32 05-Jul-2024  rin sys: Drop redundant NULL check before m_freem(9)

m_freem(9) safely has accepted NULL argument at least since 4.2BSD:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c

Compile-tested on amd64/ALL.

Suggested by knakahara@
 1.31 20-Aug-2022  thorpej branches: 1.31.10;
fwip_async_output(): Replace "IF_DEQUEUE() -> IF_PREPEND() on failure" with
"IF_POLL() -> IF_DEQUEUE() on success".
 1.30 29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.29 15-Nov-2018  maxv branches: 1.29.6;
Remove the 't' argument from m_tag_find().
 1.28 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.27 10-Jun-2016  ozaki-r branches: 1.27.16; 1.27.18;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.26 25-Feb-2014  pooka branches: 1.26.6;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.25 29-Apr-2012  dsl branches: 1.25.2; 1.25.4;
Change to consistently use M_FW for all malloc/free.
It probably doesn't matter any more, but the code doesn't appear to
have matched its mallocs and frees - so the stats would have been awol.
 1.24 23-May-2010  christos branches: 1.24.8; 1.24.12;
Revert all previous kmem_ commits. This needs to be done in a different way
because we cannot call kmem_ from an interrupt context. I opened PR/43341 for
it.
 1.23 10-May-2010  kiyohara Use kmem(9) instead of malloc(9).
 1.22 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.21 11-Mar-2010  mrg branches: 1.21.2;
various aprint_* fixes.
 1.20 06-Dec-2009  dyoung branches: 1.20.2;
Simplify device-activation hook.
 1.19 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.18 18-Mar-2009  cegger bzero -> memset
 1.17 12-Nov-2008  ad branches: 1.17.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.16 07-Nov-2008  dyoung *** Summary ***

When a link-layer address changes (e.g., ifconfig ex0 link
02:de:ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor
Advertisement to update the network-/link-layer address bindings
on our LAN peers.

Refuse a change of ethernet address to the address 00:00:00:00:00:00
or to any multicast/broadcast address. (Thanks matt@.)

Reorder ifnet ioctl operations so that driver ioctls may inherit
the functions of their "class"---ether_ioctl(), fddi_ioctl(), et
cetera---and the class ioctls may inherit from the generic ioctl,
ifioctl_common(), but both driver- and class-ioctls may override
the generic behavior. Make network drivers share more code.

Distinguish a "factory" link-layer address from others for the
purposes of both protecting that address from deletion and computing
EUI64.

Return consistent, appropriate error codes from network drivers.

Improve readability. KNF.

*** Details ***

In if_attach(), always initialize the interface ioctl routine,
ifnet->if_ioctl, if the driver has not already initialized it.
Delete if_ioctl == NULL tests everywhere else, because it cannot
happen.

In the ioctl routines of network interfaces, inherit common ioctl
behaviors by calling either ifioctl_common() or whichever ioctl
routine is appropriate for the class of interface---e.g., ether_ioctl()
for ethernets.

Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR. In
the user->kernel interface, SIOCSIFADDR's argument was an ifreq,
but on the protocol->ifnet interface, SIOCSIFADDR's argument was
an ifaddr. That was confusing, and it would work against me as I
make it possible for a network interface to overload most ioctls.
On the protocol->ifnet interface, replace SIOCSIFADDR with
SIOCINITIFADDR. In ifioctl(), return EPERM if userland tries to
invoke SIOCINITIFADDR.

In ifioctl(), give the interface the first shot at handling most
interface ioctls, and give the protocol the second shot, instead
of the other way around. Finally, let compatibility code (COMPAT_OSOCK)
take a shot.

Pull device initialization out of switch statements under
SIOCINITIFADDR. For example, pull ..._init() out of any switch
statement that looks like this:

switch (...->sa_family) {
case ...:
..._init();
...
break;
...
default:
..._init();
...
break;
}

Rewrite many if-else clauses that handle all permutations of IFF_UP
and IFF_RUNNING to use a switch statement,

switch (x & (IFF_UP|IFF_RUNNING)) {
case 0:
...
break;
case IFF_RUNNING:
...
break;
case IFF_UP:
...
break;
case IFF_UP|IFF_RUNNING:
...
break;
}

unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and
#ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4).

In ipw(4), remove an if_set_sadl() call that is out of place.

In nfe(4), reuse the jumbo MTU logic in ether_ioctl().

Let ethernets register a callback for setting h/w state such as
promiscuous mode and the multicast filter in accord with a change
in the if_flags: ether_set_ifflags_cb() registers a callback that
returns ENETRESET if the caller should reset the ethernet by calling
if_init(), 0 on success, != 0 on failure. Pull common code from
ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(),
and register if_flags callbacks for those drivers.

Return ENOTTY instead of EINVAL for inappropriate ioctls. In
zyd(4), use ENXIO instead of ENOTTY to indicate that the device is
not any longer attached.

Add to if_set_sadl() a boolean 'factory' argument that indicates
whether a link-layer address was assigned by the factory or some
other source. In a comment, recommend using the factory address
for generating an EUI64, and update in6_get_hw_ifid() to prefer a
factory address to any other link-layer address.

Add a routing message, RTM_LLINFO_UPD, that tells protocols to
update the binding of network-layer addresses to link-layer addresses.
Implement this message in IPv4 and IPv6 by sending a gratuitous
ARP or a neighbor advertisement, respectively. Generate RTM_LLINFO_UPD
messages on a change of an interface's link-layer address.

In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address
that is broadcast/multicast or equal to 00:00:00:00:00:00.

Make ether_ioctl() call ifioctl_common() to handle ioctls that it
does not understand.

In gif(4), initialize if_softc and use it, instead of assuming that
the gif_softc and ifp overlap.

Let ifioctl_common() handle SIOCGIFADDR.

Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels
that certain invariants on a struct route are satisfied.

In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit
about the ioctls that we do not allow on an agr(4) member interface.

bzero -> memset. Delete unnecessary casts to void *. Use
sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with
NULL instead of "testing truth". Replace some instances of (type
*)0 with NULL. Change some K&R prototypes to ANSI C, and join
lines.
 1.15 24-Jun-2008  gmcgarry branches: 1.15.2; 1.15.4;
Replace gcc extension of comma-elimination variadic macros with aprint_debug_ifnet().
 1.14 29-Mar-2008  kiyohara branches: 1.14.4; 1.14.6; 1.14.8;
Split device_t/softc.
And cosmetic change.
 1.13 07-Feb-2008  dyoung branches: 1.13.6;
Start patching up the kernel so that a network driver always has
the opportunity to handle an ioctl before generic ifioctl handling
occurs. This will ease extending the kernel and sharing of code
between drivers.

First steps: Make the signature of ifioctl_common() match struct
ifinet->if_ioctl. Convert SIOCSIFCAP and SIOCSIFMTU to the new
ifioctl() regime, throughout the kernel.
 1.12 11-Dec-2007  lukem use __KERNEL_RCSID()
 1.11 09-Dec-2007  jmcneill branches: 1.11.2;
Merge jmcneill-pm branch.
 1.10 05-Nov-2007  kiyohara branches: 1.10.2; 1.10.4; 1.10.6;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.9 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.8 21-Apr-2007  kiyohara branches: 1.8.6; 1.8.8; 1.8.12;
firewire.c sync to Rev.1.86 for FreeBSD.
firewirereg.h sync to Rev.1.41 for FreeBSD.
fwcrom.c sync to Rev.1.14 for FreeBSD.
fwdev.c sync to Rev.1.49 for FreeBSD.
fwmem.c sync to Rev.1.32 for FreeBSD.
fwohci.c sync to Rev.1.86 for FreeBSD.
fwohcivar.h sync to Rev.1.15 for FreeBSD.
if_fwip.c sync to Rev.1.14 for FreeBSD.
if_fwipvar.h sync to Rev.1.4 for FreeBSD.
sbp.c sync to Rev.1.89 for FreeBSD.
 1.7 04-Mar-2007  christos branches: 1.7.2; 1.7.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6 16-Nov-2006  christos branches: 1.6.4;
__unused removal on arguments; approved by core.
 1.5 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.4 24-Dec-2005  perry branches: 1.4.18; 1.4.22; 1.4.24;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 23-Jul-2005  kiyohara branches: 1.2.6;
Since fwip_unicast_input_recycle() is called from interrupt context, one
can't sleep there.
 1.1 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 23-Jul-2005  skrll file if_fwip.c was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.4.24.2 10-Dec-2006  yamt sync with head.
 1.4.24.1 22-Oct-2006  yamt sync with head
 1.4.22.1 18-Nov-2006  ad Sync with head.
 1.4.18.7 11-Feb-2008  yamt sync with head.
 1.4.18.6 21-Jan-2008  yamt sync with head
 1.4.18.5 15-Nov-2007  yamt sync with head.
 1.4.18.4 27-Oct-2007  yamt sync with head.
 1.4.18.3 03-Sep-2007  yamt sync with head.
 1.4.18.2 21-Jun-2006  yamt sync with head.
 1.4.18.1 24-Dec-2005  yamt file if_fwip.c was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.6.4.2 07-May-2007  yamt sync with head.
 1.6.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.7.4.1 11-Jul-2007  mjf Sync with head.
 1.7.2.2 23-Oct-2007  ad Sync with head.
 1.7.2.1 27-May-2007  ad Sync with head.
 1.8.12.2 13-Nov-2007  bouyer Sync with HEAD
 1.8.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.8.8.3 23-Mar-2008  matt sync with HEAD
 1.8.8.2 09-Jan-2008  matt sync with HEAD
 1.8.8.1 06-Nov-2007  matt sync with HEAD
 1.8.6.4 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.8.6.3 28-Nov-2007  jmcneill Register with power management framework.
 1.8.6.2 06-Nov-2007  joerg Sync with HEAD.
 1.8.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.10.6.1 11-Dec-2007  yamt sync with head.
 1.10.4.1 26-Dec-2007  ad Sync with head.
 1.10.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.11.2.1 13-Dec-2007  bouyer Sync with HEAD
 1.13.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.13.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.13.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.14.8.1 27-Jun-2008  simonb Sync with head.
 1.14.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.14.4.4 11-Aug-2010  yamt sync with head.
 1.14.4.3 11-Mar-2010  yamt sync with head
 1.14.4.2 16-May-2009  yamt sync with head
 1.14.4.1 04-May-2009  yamt sync with head.
 1.15.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.15.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.15.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.17.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.20.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.21.2.1 30-May-2010  rmind sync with head
 1.24.12.1 29-Apr-2012  mrg sync to latest -current.
 1.24.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.24.8.1 23-May-2012  yamt sync with head.
 1.25.4.1 18-May-2014  rmind sync with head
 1.25.2.2 03-Dec-2017  jdolecek update from HEAD
 1.25.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.6.1 09-Jul-2016  skrll Sync with HEAD
 1.27.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.27.18.1 10-Jun-2019  christos Sync with HEAD
 1.27.16.2 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.27.16.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.29.6.1 29-Feb-2020  ad Sync with head.
 1.31.10.1 02-Aug-2025  perseant Sync with HEAD
 1.5 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.4 05-Nov-2007  kiyohara branches: 1.4.20; 1.4.40; 1.4.42;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.3 21-Apr-2007  kiyohara branches: 1.3.6; 1.3.8; 1.3.12;
firewire.c sync to Rev.1.86 for FreeBSD.
firewirereg.h sync to Rev.1.41 for FreeBSD.
fwcrom.c sync to Rev.1.14 for FreeBSD.
fwdev.c sync to Rev.1.49 for FreeBSD.
fwmem.c sync to Rev.1.32 for FreeBSD.
fwohci.c sync to Rev.1.86 for FreeBSD.
fwohcivar.h sync to Rev.1.15 for FreeBSD.
if_fwip.c sync to Rev.1.14 for FreeBSD.
if_fwipvar.h sync to Rev.1.4 for FreeBSD.
sbp.c sync to Rev.1.89 for FreeBSD.
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.28; 1.2.32; 1.2.34;
merge ktrace-lwp.
 1.1 11-Jul-2005  kiyohara branches: 1.1.6;
ieee1394 import from FreeBSD.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file if_fwipvar.h was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.2.34.1 11-Jul-2007  mjf Sync with head.
 1.2.32.1 27-May-2007  ad Sync with head.
 1.2.28.1 07-May-2007  yamt sync with head.
 1.2.18.4 15-Nov-2007  yamt sync with head.
 1.2.18.3 03-Sep-2007  yamt sync with head.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file if_fwipvar.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.3.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.3.8.1 06-Nov-2007  matt sync with HEAD
 1.3.6.1 06-Nov-2007  joerg Sync with HEAD.
 1.4.42.1 30-May-2010  rmind sync with head
 1.4.40.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.4.20.1 11-Aug-2010  yamt sync with head.
 1.43 11-Jul-2025  andvar Fix various typos, mainly in comments and log/error messages.
 1.42 12-Apr-2022  andvar branches: 1.42.10;
s/sould/should/ and s/shoud/should/
 1.41 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.40 24-Apr-2021  thorpej branches: 1.40.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.39 10-Nov-2019  chs branches: 1.39.10;
in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.38 23-Sep-2019  maxv Remove unused assignment. Found by the lgtm bot.
 1.37 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.36 25-Feb-2014  pooka branches: 1.36.28; 1.36.30;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.35 15-Sep-2013  martin Remove unused variables
 1.34 29-Apr-2012  dsl branches: 1.34.2; 1.34.4;
Remove everything to do with 'struct malloc_type' and the malloc link_set.
To make code in 'external' (etc) still compile, MALLOC_DECLARE() still
has to generate something of type 'struct malloc_type *', with
normal optimisation gcc generates a compile-time 0.
MALLOC_DEFINE() and friends have no effect.
Fix one or two places where the code would no longer compile.
 1.33 14-Aug-2010  cegger branches: 1.33.8; 1.33.12;
Fix sbp attach/detach.
When plugging a firewire webcam, sbp attaches.
sbpattach() calls sbp_alloc_target().
In sbp_alloc_target, crom_search_key() fails and sbp_alloc_target() returns NULL.
Move mutex and list initializations up in sbpattach() and in sbp_alloc_target()
so that destroyal of them through sbpdetach() does not cause
LOCKDEBUG panics when unplugging the firewire webcam.
 1.32 23-May-2010  christos Revert all previous kmem_ commits. This needs to be done in a different way
because we cannot call kmem_ from an interrupt context. I opened PR/43341 for
it.
 1.31 10-May-2010  kiyohara Use kmem(9) instead of malloc(9).
 1.30 29-Apr-2010  kiyohara + Use structs scsipi_inquiry_data/scsi_sense_data instead of scsi3_inquiry_data/
scsi3_sense_data.
+ s/switch()/switch ()/.
+ Change args for printf(). ("FUNCNAME ...") -> ("%s ...\n", __func__, ...)
+ Indent.
+ Remove unnecessary cast.
 1.29 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.28 12-May-2009  cegger branches: 1.28.2; 1.28.4;
struct cfdata * -> cfdata_t, no functional changes intended.
 1.27 18-Apr-2009  tsutsui Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
 1.26 18-Mar-2009  cegger bcopy -> memcpy
 1.25 18-Mar-2009  cegger bzero -> memset
 1.24 11-Jan-2009  christos branches: 1.24.2;
merge christos-time_t
 1.23 03-Jan-2009  yamt branches: 1.23.2;
remove extra semicolons.
 1.22 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.21 29-Mar-2008  kiyohara branches: 1.21.4; 1.21.10; 1.21.12;
Split device_t/softc.
And cosmetic change.
 1.20 11-Dec-2007  lukem branches: 1.20.8;
use __KERNEL_RCSID()
 1.19 05-Nov-2007  kiyohara branches: 1.19.4; 1.19.6; 1.19.8;
+ Sync to FreeBSD.
firewire.c Rev.1.101
firewire.h Rev.1.21
firewirereg.h Rev.1.50
fwdev.c Rev.1.52
fwdma.c Rev.1.9
fwmem.c Rev.1.34
fwohci.c Rev.1.93
fwohcireg.h Rev.1.23
fwohcivar.h Rev.1.16
if_fwip.c Rev.1.16
if_fwipvar.h Rev.1.5
sbp.c Rev.1.92
+ Cleanup macros in fw_port.h.
+ Fix the occurrence of the error at the resume. Don't set the buffer again.
 1.18 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.17 09-Jul-2007  ad branches: 1.17.6; 1.17.8; 1.17.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.16 21-Apr-2007  kiyohara firewire.c sync to Rev.1.86 for FreeBSD.
firewirereg.h sync to Rev.1.41 for FreeBSD.
fwcrom.c sync to Rev.1.14 for FreeBSD.
fwdev.c sync to Rev.1.49 for FreeBSD.
fwmem.c sync to Rev.1.32 for FreeBSD.
fwohci.c sync to Rev.1.86 for FreeBSD.
fwohcivar.h sync to Rev.1.15 for FreeBSD.
if_fwip.c sync to Rev.1.14 for FreeBSD.
if_fwipvar.h sync to Rev.1.4 for FreeBSD.
sbp.c sync to Rev.1.89 for FreeBSD.
 1.15 04-Mar-2007  christos branches: 1.15.2; 1.15.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 22-Dec-2006  kiyohara branches: 1.14.2;
Use macro FWBUSNOTREADY.
 1.13 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 14-May-2006  elad branches: 1.11.6; 1.11.10; 1.11.12;
integrate kauth.
 1.10 30-Apr-2006  kiyohara Do microtime() before return.
 1.9 30-Apr-2006  kiyohara Coordination of macro fw_bus_dma_tag_create().
 1.8 14-Apr-2006  christos Coverity CID 1121: Avoid NULL deref.
 1.7 11-Apr-2006  rpaulo Coverity ID 2443: In sbp_scsipi_detach_sdev() check for sdev and
target being NULL before dereferencing them.
 1.6 28-Mar-2006  thorpej Use device_unit().
 1.5 25-Feb-2006  wiz branches: 1.5.2; 1.5.4; 1.5.6;
Fix some typos.
 1.4 24-Dec-2005  perry branches: 1.4.2; 1.4.4; 1.4.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 29-Aug-2005  kiyohara branches: 1.2.6;
Remove '#if defined(cobalt)'.
 1.1 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 29-Aug-2005  skrll file sbp.c was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.4.6.2 01-Jun-2006  kardel Sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.4.2.1 01-Mar-2006  yamt sync with head.
 1.5.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.5.4.2 11-May-2006  elad sync with head
 1.5.4.1 19-Apr-2006  elad sync with head.
 1.5.2.2 24-May-2006  yamt sync with head.
 1.5.2.1 01-Apr-2006  yamt sync with head.
 1.11.12.2 10-Dec-2006  yamt sync with head.
 1.11.12.1 22-Oct-2006  yamt sync with head
 1.11.10.2 12-Jan-2007  ad Sync with head.
 1.11.10.1 18-Nov-2006  ad Sync with head.
 1.11.6.7 21-Jan-2008  yamt sync with head
 1.11.6.6 15-Nov-2007  yamt sync with head.
 1.11.6.5 27-Oct-2007  yamt sync with head.
 1.11.6.4 03-Sep-2007  yamt sync with head.
 1.11.6.3 30-Dec-2006  yamt sync with head.
 1.11.6.2 21-Jun-2006  yamt sync with head.
 1.11.6.1 14-May-2006  yamt file sbp.c was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.14.2.2 07-May-2007  yamt sync with head.
 1.14.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.4.1 11-Jul-2007  mjf Sync with head.
 1.15.2.5 23-Oct-2007  ad Sync with head.
 1.15.2.4 27-May-2007  ad Sync with head.
 1.15.2.3 13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.15.2.2 10-Apr-2007  ad Nuke the deferred kthread creation stuff, as it's no longer needed.
Pointed out by thorpej@.
 1.15.2.1 09-Apr-2007  ad - Add two new arguments to kthread_create1: pri_t pri, bool mpsafe.
- Fork kthreads off proc0 as new LWPs, not new processes.
 1.17.12.2 13-Nov-2007  bouyer Sync with HEAD
 1.17.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.17.8.2 09-Jan-2008  matt sync with HEAD
 1.17.8.1 06-Nov-2007  matt sync with HEAD
 1.17.6.2 06-Nov-2007  joerg Sync with HEAD.
 1.17.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.19.8.1 13-Dec-2007  bouyer Sync with HEAD
 1.19.6.1 11-Dec-2007  yamt sync with head.
 1.19.4.1 26-Dec-2007  ad Sync with head.
 1.20.8.2 17-Jan-2009  mjf Sync with HEAD.
 1.20.8.1 03-Apr-2008  mjf Sync with HEAD.
 1.21.12.2 28-Apr-2009  skrll Sync with HEAD.
 1.21.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.21.4.4 09-Oct-2010  yamt sync with head
 1.21.4.3 11-Aug-2010  yamt sync with head.
 1.21.4.2 16-May-2009  yamt sync with head
 1.21.4.1 04-May-2009  yamt sync with head.
 1.23.2.2 04-Jan-2009  christos fix dev_t printf format.
 1.23.2.1 03-Jan-2009  christos file sbp.c was added on branch christos-time_t on 2009-01-04 01:59:40 +0000
 1.24.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.28.4.2 05-Mar-2011  rmind sync with head
 1.28.4.1 30-May-2010  rmind sync with head
 1.28.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.28.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.33.12.1 02-Jun-2012  mrg sync to latest -current.
 1.33.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.33.8.1 23-May-2012  yamt sync with head.
 1.34.4.1 18-May-2014  rmind sync with head
 1.34.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.36.30.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.36.30.1 10-Jun-2019  christos Sync with HEAD
 1.36.28.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.39.10.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.40.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.42.10.1 02-Aug-2025  perseant Sync with HEAD
 1.7 05-Dec-2021  msaitoh availabe -> available in comment.
 1.6 29-Aug-2010  cegger Confilict -> Conflict
 1.5 29-Apr-2010  kiyohara + Use structs scsipi_inquiry_data/scsi_sense_data instead of scsi3_inquiry_data/
scsi3_sense_data.
+ s/switch()/switch ()/.
+ Change args for printf(). ("FUNCNAME ...") -> ("%s ...\n", __func__, ...)
+ Indent.
+ Remove unnecessary cast.
 1.4 29-Mar-2010  kiyohara Bye-bye fw_port.h.
 1.3 25-Feb-2006  wiz branches: 1.3.12; 1.3.70; 1.3.92; 1.3.94;
Fix some typos.
 1.2 11-Dec-2005  christos branches: 1.2.2; 1.2.4; 1.2.6;
merge ktrace-lwp.
 1.1 11-Jul-2005  kiyohara branches: 1.1.6;
ieee1394 import from FreeBSD.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file sbp.h was added on branch ktrace-lwp on 2005-11-10 14:05:22 +0000
 1.2.6.1 22-Apr-2006  simonb Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.2.2.1 01-Mar-2006  yamt sync with head.
 1.3.94.2 05-Mar-2011  rmind sync with head
 1.3.94.1 30-May-2010  rmind sync with head
 1.3.92.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.3.92.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.3.70.2 09-Oct-2010  yamt sync with head
 1.3.70.1 11-Aug-2010  yamt sync with head.
 1.3.12.2 21-Jun-2006  yamt sync with head.
 1.3.12.1 25-Feb-2006  yamt file sbp.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:08 +0000
 1.21 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.20 27-Feb-2005  perry branches: 1.20.4;
nuke trailing whitespace
 1.19 29-Jun-2004  mycroft branches: 1.19.4; 1.19.6;
Attempt to fix sbp2_free() so that it doesn't core dump. As noted in PR 21099,
but fixed differently.
 1.18 29-Jun-2003  fvdl branches: 1.18.2; 1.18.4;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.17 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.16 07-Mar-2003  jmc Redo last fix to work correctly. Need to run abort on each orb (though it
doesn't much now it will eventually) and then so a proper sbp2_free_orb.
 1.15 07-Mar-2003  drochner -Fix ORB queue corruption / use of free()d memory
caused by bad interaction of sbp2_free() and sbp2_abort().
sbp2_abort() requires that its argument ORB is on the
"active" list, and it puts it onto the freelist - sometimes.
So we had 2 causes of corruption:
-removing the ORB from a list which it isn't on
-free()ing recycleable items on the ORB freelist
-minor cosmetics
 1.14 28-Feb-2003  enami Make this file compiles when FW_DEBUG is defined but SBP2_DEBUG isn't defined.
 1.13 09-Jan-2003  thorpej Use PRIx64 to get the correct format for 64-bit hex numbers. Don't
need \n at the end of a panic().
 1.12 28-Dec-2002  jmc Implementation of page table support for 64k or greater transfers. This should
also handle uio structs passed in as well. All standard filesystem actions
are working at this stage (can copy, execute, mount, umount, fsck, etc).
 1.11 18-Dec-2002  jmc Redo state handling as ack's, status, etc can come in and be processed in
various orders depending how the upper level driver is flushing it's queue's.
This prevents the deadlocks I was seeing before with >8k writes.

XXX: Still not completely there as > 64k copies trigger bugs and the page
table support still needs to be written to break those down.
 1.10 13-Dec-2002  jmc Improve performance with disks almost 60x by redoing the callback handler to
accept ranges as well as single addresses. Still need to go through any key
areas and remove the malloc's and replace these with some sort of pooling
instead.
 1.9 09-Dec-2002  jmc Checkpoint commit:

1. Reduce debugging level to sane levels
2. Fix bugs in alloc_data_map related to allocing whole bytes of bitmap at
a time.

At this point the driver is functional. It talks to a local drive here and
can label/newfs. Performance is...lacking at the moment as its chewing cpu
heavily (probably due to the number of memcpy's) and will be the next area
attacked.
 1.8 09-Dec-2002  jmc Write sbp2_free_data_mapping and fix a bug where read responses weren't sending
back the right tlabel
 1.7 08-Dec-2002  jmc Fix logic screwup in determining which bits to set in alloc'ing data maps
 1.6 06-Dec-2002  jmc Account for corner cases better in alloc_data_mapping and only ask for a 16s
reconnect time instead of 2^16s
 1.5 03-Dec-2002  explorer make this compile without SBP2_DEBUG defined
 1.4 01-Dec-2002  jmc Checkpoint checkin:
1. Clean up some debugging and trigger some on only extreme debugging needs
2. Comment alloc data mapping a bit better and fix some of the bugs here
(note..there still are some so for now the free method is never called while
I track these down)
3. Fix the copying logic in data_resp. It was calculating negative offsets
which blew up memcpy.

At this point I can probe, inquire and get through the findroot steps of a
boot:

sd0 at scsibus0 target 0 lun 0: <Maxtor, 1394 storage, 60> disk fixed
sd0: mode sense (4) returned nonsense; using fictitious geometry
sd0: 76293 MB, 76293 cyl, 64 head, 32 sec, 512 bytes/sect x 156250000 sectors
sd0: mode sense (4) returned nonsense; using fictitious geometry
sd0: no disk label
findroot: can't open dev sd0a (6)

NOTE: This will panic my machine right now with a simple disklabel -r sd0.
Also, since the free mappings routines are if (0)'d out at the moment do not
use this code for anything except experiments and then only on a machine
you don't mind panic'ing.

Fixing the mapping routines will be the next step and then finally chasing
down the proper mode sense these drives understand.
 1.3 30-Nov-2002  jmc Tidy up some debug routines and make verbose packet dumps only when sbp2debug>2
 1.2 22-Nov-2002  jmc First pass (checkpoint checkin) for firewire scsi code.

There are a number of issues here for anyone trying to use this today:

1. On my test drive the command engine on the drive seems to stall after the
inquire is done. So the mode sense times out for a long time before
aborting. This obviously needs to be tracked down and fixed.

However it does do a proper inquire:

scsibus0 at sbpscsi0: 1 target, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Maxtor, 1394 storage, 60> disk fixed

2. This code is quite ugly in places as debug code was added to test things.
Definitly needs cleanup/documention in places where it's using command
structures. The structure for alloc'ing orbs, running them through the
command engine and getting state back is mostly set but implementation needs
an overhaul in places.

3. For testing I use the following config options:

fwohci* at cardbus? dev ? function ? # IEEE1394 Controller
fw* at fwbus?
options FW_DEBUG
options FWNODE_DEBUG
options P1212_DEBUG
options SBP2_DEBUG
options SBPSCSI_DEBUG
fwnode* at fwbus?
sbpscsi* at fwnode?
scsibus* at sbpscsi?
 1.1 27-Feb-2002  jmc branches: 1.1.2; 1.1.8;
Initial layout for SBP2 routines. Mainly just the code yanked from fwnode.c
so it's not lost.
 1.1.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.8.1 27-Feb-2002  jdolecek file sbp2.c was added on branch kqueue on 2002-03-16 16:01:06 +0000
 1.1.2.6 15-Jan-2003  thorpej Sync with HEAD.
 1.1.2.5 29-Dec-2002  thorpej Sync with HEAD.
 1.1.2.4 19-Dec-2002  thorpej Sync with HEAD.
 1.1.2.3 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.1 27-Feb-2002  nathanw file sbp2.c was added on branch nathanw_sa on 2002-02-28 04:13:36 +0000
 1.18.4.1 02-Jul-2004  he Pull up revision 1.19 (requested by mycroft in ticket #572):
Fix sbp2_free() so that it does not dump core. Fixes PR#21099
and PR#23904.
 1.18.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.18.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.2 03-Aug-2004  skrll Sync with HEAD
 1.18.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.19.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.4.1 29-Apr-2005  kent sync with -current
 1.20.4.1 21-Jun-2006  yamt sync with head.
 1.8 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.7 27-Feb-2005  perry branches: 1.7.4;
nuke trailing whitespace
 1.6 28-Dec-2002  jmc branches: 1.6.2; 1.6.10; 1.6.12;
Implementation of page table support for 64k or greater transfers. This should
also handle uio structs passed in as well. All standard filesystem actions
are working at this stage (can copy, execute, mount, umount, fsck, etc).
 1.5 19-Dec-2002  jmc Add defines for supporting page tables
 1.4 18-Dec-2002  jmc Add SBP2_MAXPHYS
 1.3 06-Dec-2002  jmc Add a def for a smaller reconnect time that will be used by default
 1.2 22-Nov-2002  jmc First pass (checkpoint checkin) for firewire scsi code.

There are a number of issues here for anyone trying to use this today:

1. On my test drive the command engine on the drive seems to stall after the
inquire is done. So the mode sense times out for a long time before
aborting. This obviously needs to be tracked down and fixed.

However it does do a proper inquire:

scsibus0 at sbpscsi0: 1 target, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Maxtor, 1394 storage, 60> disk fixed

2. This code is quite ugly in places as debug code was added to test things.
Definitly needs cleanup/documention in places where it's using command
structures. The structure for alloc'ing orbs, running them through the
command engine and getting state back is mostly set but implementation needs
an overhaul in places.

3. For testing I use the following config options:

fwohci* at cardbus? dev ? function ? # IEEE1394 Controller
fw* at fwbus?
options FW_DEBUG
options FWNODE_DEBUG
options P1212_DEBUG
options SBP2_DEBUG
options SBPSCSI_DEBUG
fwnode* at fwbus?
sbpscsi* at fwnode?
scsibus* at sbpscsi?
 1.1 27-Feb-2002  jmc branches: 1.1.2; 1.1.8;
Move over from std to here
 1.1.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.8.1 27-Feb-2002  jdolecek file sbp2reg.h was added on branch kqueue on 2002-03-16 16:01:06 +0000
 1.1.2.5 29-Dec-2002  thorpej Sync with HEAD.
 1.1.2.4 19-Dec-2002  thorpej Sync with HEAD.
 1.1.2.3 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.1 27-Feb-2002  nathanw file sbp2reg.h was added on branch nathanw_sa on 2002-02-28 04:13:36 +0000
 1.6.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.10.1 29-Apr-2005  kent sync with -current
 1.6.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.4.1 21-Jun-2006  yamt sync with head.
 1.7 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.6 27-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 28-Dec-2002  jmc branches: 1.5.2; 1.5.10; 1.5.12;
Implementation of page table support for 64k or greater transfers. This should
also handle uio structs passed in as well. All standard filesystem actions
are working at this stage (can copy, execute, mount, umount, fsck, etc).
 1.4 19-Dec-2002  jmc Add support for page tables
 1.3 18-Dec-2002  jmc Redo state handling as ack's, status, etc can come in and be processed in
various orders depending how the upper level driver is flushing it's queue's.
This prevents the deadlocks I was seeing before with >8k writes.

XXX: Still not completely there as > 64k copies trigger bugs and the page
table support still needs to be written to break those down.
 1.2 09-Dec-2002  jmc branches: 1.2.2;
Don't need sbp2_datamapping. Each one is tracked via the associated orb
 1.1 22-Nov-2002  jmc First pass (checkpoint checkin) for firewire scsi code.

There are a number of issues here for anyone trying to use this today:

1. On my test drive the command engine on the drive seems to stall after the
inquire is done. So the mode sense times out for a long time before
aborting. This obviously needs to be tracked down and fixed.

However it does do a proper inquire:

scsibus0 at sbpscsi0: 1 target, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Maxtor, 1394 storage, 60> disk fixed

2. This code is quite ugly in places as debug code was added to test things.
Definitly needs cleanup/documention in places where it's using command
structures. The structure for alloc'ing orbs, running them through the
command engine and getting state back is mostly set but implementation needs
an overhaul in places.

3. For testing I use the following config options:

fwohci* at cardbus? dev ? function ? # IEEE1394 Controller
fw* at fwbus?
options FW_DEBUG
options FWNODE_DEBUG
options P1212_DEBUG
options SBP2_DEBUG
options SBPSCSI_DEBUG
fwnode* at fwbus?
sbpscsi* at fwnode?
scsibus* at sbpscsi?
 1.2.2.4 29-Dec-2002  thorpej Sync with HEAD.
 1.2.2.3 19-Dec-2002  thorpej Sync with HEAD.
 1.2.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.2.2.1 09-Dec-2002  thorpej file sbp2var.h was added on branch nathanw_sa on 2002-12-11 06:38:09 +0000
 1.5.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.10 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.9 27-Feb-2005  perry branches: 1.9.4;
nuke trailing whitespace
 1.8 21-Feb-2005  thorpej Part 1 of a cleanup pass over the SCSI subsystem. The aim is to name
everything "scsi_*", since we really are talking about the SCSI command
set, ATAPI transport not withstanding. Improve the names of many structures,
and prepend "SCSI_" onto all SCSI command opcodes. Place items described
by the SCSI Primary Commands document into scsi_spc.h.
 1.7 13-Feb-2004  enami branches: 1.7.8; 1.7.10;
xs->timeout is in milliseconds so convert it to tick before passing
it to callout_reset().
 1.6 18-Oct-2003  enami Don't limit xfer size to SBP2_MAXPHYS. Its not transfer size limit
but just a threshold how to describe transfer.
 1.5 19-Dec-2002  jmc branches: 1.5.2;
Add a minphys routine since the single largest packet is less than minphys()
 1.4 09-Dec-2002  jmc branches: 1.4.2;
Drop default debugging level to something a bit more sane
 1.3 09-Dec-2002  jmc Ooops...Make sure for status to set error and resid before calling the
completion routines. Makes reads actually return data to userland now which
means I can now put a disklabel on the drive.
 1.2 01-Dec-2002  jmc Set the only big quirk since the drives I've tried return errors on 6 byte cdbs
 1.1 22-Nov-2002  jmc First pass (checkpoint checkin) for firewire scsi code.

There are a number of issues here for anyone trying to use this today:

1. On my test drive the command engine on the drive seems to stall after the
inquire is done. So the mode sense times out for a long time before
aborting. This obviously needs to be tracked down and fixed.

However it does do a proper inquire:

scsibus0 at sbpscsi0: 1 target, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Maxtor, 1394 storage, 60> disk fixed

2. This code is quite ugly in places as debug code was added to test things.
Definitly needs cleanup/documention in places where it's using command
structures. The structure for alloc'ing orbs, running them through the
command engine and getting state back is mostly set but implementation needs
an overhaul in places.

3. For testing I use the following config options:

fwohci* at cardbus? dev ? function ? # IEEE1394 Controller
fw* at fwbus?
options FW_DEBUG
options FWNODE_DEBUG
options P1212_DEBUG
options SBP2_DEBUG
options SBPSCSI_DEBUG
fwnode* at fwbus?
sbpscsi* at fwnode?
scsibus* at sbpscsi?
 1.4.2.3 29-Dec-2002  thorpej Sync with HEAD.
 1.4.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.4.2.1 09-Dec-2002  thorpej file sbpscsi.c was added on branch nathanw_sa on 2002-12-11 06:38:09 +0000
 1.5.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.9.4.1 21-Jun-2006  yamt sync with head.
 1.2 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.1 22-Nov-2002  jmc branches: 1.1.2; 1.1.8; 1.1.24;
First pass (checkpoint checkin) for firewire scsi code.

There are a number of issues here for anyone trying to use this today:

1. On my test drive the command engine on the drive seems to stall after the
inquire is done. So the mode sense times out for a long time before
aborting. This obviously needs to be tracked down and fixed.

However it does do a proper inquire:

scsibus0 at sbpscsi0: 1 target, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Maxtor, 1394 storage, 60> disk fixed

2. This code is quite ugly in places as debug code was added to test things.
Definitly needs cleanup/documention in places where it's using command
structures. The structure for alloc'ing orbs, running them through the
command engine and getting state back is mostly set but implementation needs
an overhaul in places.

3. For testing I use the following config options:

fwohci* at cardbus? dev ? function ? # IEEE1394 Controller
fw* at fwbus?
options FW_DEBUG
options FWNODE_DEBUG
options P1212_DEBUG
options SBP2_DEBUG
options SBPSCSI_DEBUG
fwnode* at fwbus?
sbpscsi* at fwnode?
scsibus* at sbpscsi?
 1.1.24.1 21-Jun-2006  yamt sync with head.
 1.1.8.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 22-Nov-2002  thorpej file sbpscsireg.h was added on branch nathanw_sa on 2002-12-11 06:38:09 +0000
 1.2 11-Jul-2005  kiyohara ieee1394 import from FreeBSD.
 1.1 22-Nov-2002  jmc branches: 1.1.2; 1.1.8; 1.1.24;
First pass (checkpoint checkin) for firewire scsi code.

There are a number of issues here for anyone trying to use this today:

1. On my test drive the command engine on the drive seems to stall after the
inquire is done. So the mode sense times out for a long time before
aborting. This obviously needs to be tracked down and fixed.

However it does do a proper inquire:

scsibus0 at sbpscsi0: 1 target, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Maxtor, 1394 storage, 60> disk fixed

2. This code is quite ugly in places as debug code was added to test things.
Definitly needs cleanup/documention in places where it's using command
structures. The structure for alloc'ing orbs, running them through the
command engine and getting state back is mostly set but implementation needs
an overhaul in places.

3. For testing I use the following config options:

fwohci* at cardbus? dev ? function ? # IEEE1394 Controller
fw* at fwbus?
options FW_DEBUG
options FWNODE_DEBUG
options P1212_DEBUG
options SBP2_DEBUG
options SBPSCSI_DEBUG
fwnode* at fwbus?
sbpscsi* at fwnode?
scsibus* at sbpscsi?
 1.1.24.1 21-Jun-2006  yamt sync with head.
 1.1.8.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 22-Nov-2002  thorpej file sbpscsivar.h was added on branch nathanw_sa on 2002-12-11 06:38:09 +0000

RSS XML Feed