Home | History | Annotate | Download | only in ieee1394
History log of /src/sys/dev/ieee1394/firewire.c
RevisionDateAuthorComments
 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().

RSS XML Feed