Home | History | Annotate | Download | only in mscp
History log of /src/sys/dev/mscp/mscp.c
RevisionDateAuthorComments
 1.39  11-Jan-2024  mrg mscp(4): add ability for rronline() callback in a workqueue

when an ra(4) disk comes online the hardware interrupt ends up calling
disk_set_info(), which triggers a sleep lock/alloc in this path which
is triggered by LOCKDEBUG.

piggy-back on the existing workqueue for autoconfiguration to handle
this path and run the online completion in the work queue.

this is a little ugly, in that it puts two different types of work
into the one queue, but seems less ugly than creating a second
workqueue for what is likely another one-time event (infact, the other
user may be better handled via config_defer() -- i did not look too
closely.)

with this, LOCKDEBUG kernels work.

tested in simh.
 1.38  07-Aug-2021  thorpej branches: 1.38.6;
Merge thorpej-cfargs2.
 1.37  24-Apr-2021  thorpej branches: 1.37.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.36  27-Oct-2012  chs branches: 1.36.54;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.35  10-Jul-2012  abs branches: 1.35.2;
Adjust MSCP attach routines. The current code worked fine on simh-vax, but
unfortunately failed on at least one 'real' SCSI MSCP adaptor.
In the updated code mscp_attach() still iterates over each unit on a bus,
but mscp_dorsp() now detects if we have reached the last unit and does not
return a bogus additional unit. It also loses a few gotos and handles
noncontiguous unit numbers better.
 1.34  12-May-2009  cegger branches: 1.34.12; 1.34.18;
struct device * -> device_t, no functional changes intended.
 1.33  18-Apr-2009  tsutsui Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
 1.32  18-Mar-2009  cegger bcopy -> memcpy
 1.31  14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.30  19-Jan-2009  mjf branches: 1.30.2;
mscp(4) was being a bad monkey! It's not OK to call config_found() from
interrupt context, as my vax kernel with DIAGNOSTIC told me. Instead, we
defer the work and get it to run in thread context via a workqueue(9).

Thanks to matt@ for the review.
 1.29  08-Apr-2008  cegger branches: 1.29.4; 1.29.12;
use aprint_*_dev and device_xname
 1.28  04-Jan-2008  ad branches: 1.28.6;
B_BAD has done nothing for a long time.
 1.27  19-Oct-2007  ad branches: 1.27.2; 1.27.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.26  29-Jul-2007  ad branches: 1.26.4; 1.26.6; 1.26.10; 1.26.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.25  04-Mar-2007  christos branches: 1.25.2; 1.25.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.24  25-Mar-2006  thorpej branches: 1.24.14;
Use device_parent().
 1.23  11-Dec-2005  christos branches: 1.23.4; 1.23.6; 1.23.8; 1.23.10; 1.23.12;
merge ktrace-lwp.
 1.22  27-Feb-2005  perry branches: 1.22.4;
nuke trailing whitespace
 1.21  31-Oct-2004  he branches: 1.21.4; 1.21.6;
Include the <sys/bufq.h> header to allow these to compile again.
 1.20  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.19  04-Feb-2003  matt branches: 1.19.2;
Fix wrong argument to free due to malloc_type changes. While there,
spot blatant bug by inspection and fix that as well. (do not compare
scaled value against unscaled value).
 1.18  04-Mar-2002  simonb Don't "extern int cold;" - this is in <sys/kernel.h>.
 1.17  14-Jan-2002  tsutsui Call malloc(9) with M_ZERO flag instead of bzero() after malloc().
 1.16  13-Nov-2001  lukem add RCSID
 1.15  12-Apr-2001  thorpej branches: 1.15.2;
Upon inspection of a 4000/600 dmesg, change the splbios to splubas.

XXX THIS CODE IS SERIOUSLY BROKEN! MSCP DEVICES ARE BLOCK I/O DEVICES,
AND THUS SPLBIO SHOULD BLOCK THEIR INTERRUPTS. The VAX port really
needs to get virtualized spl*() levels.
 1.14  12-Apr-2001  thorpej splimp -> splbio
 1.13  27-May-2000  thorpej branches: 1.13.6;
sleep() -> tsleep()
 1.12  30-Mar-2000  augustss Remove register declarations.
 1.11  06-Jun-1999  ragge branches: 1.11.2; 1.11.4;
Bus'ify the mscp code also.
 1.10  29-May-1999  ragge Copied from ../../arch/vax/mscp/mscp.c,v
 1.9  05-Nov-1998  ragge EGCS fixes + TU81 fix.
 1.8  21-May-1998  ragge Small Wall fixes.
 1.7  08-Feb-1998  ragge Split out MSCP floppies as a separate device (rx) instead of handling
them as disk drives. It is now also allowed to change floppies without
the system complaining :-)
 1.6  04-Jul-1997  ragge Bugfix to mscp tape code; so that weof/eot works correctly.
 1.5  11-Jan-1997  ragge Many minor bug fixes; mscp subsystem seems to work rather stable now.
 1.4  13-Oct-1996  christos backout previous kprintf change
 1.3  11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2  10-Jul-1996  ragge Add support for tape drives. More extensive error checking.
 1.1  01-Jul-1996  ragge Totally new approach for MSCP devices; they are now handled more like SCSI.
All Unibus dependencies are removed.
Can support different controllers on different buses.
Allows cloning of devices.
TODO:
Write support for MSCP tapes.
 1.11.4.2  21-Apr-2001  bouyer Sync with HEAD
 1.11.4.1  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.11.2.1  21-Jun-1999  thorpej Sync w/ -current.
 1.13.6.4  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.13.6.3  28-Feb-2002  nathanw Catch up to -current.
 1.13.6.2  14-Nov-2001  nathanw Catch up to -current.
 1.13.6.1  21-Jun-2001  nathanw Catch up to -current.
 1.15.2.3  16-Mar-2002  jdolecek Catch up with -current.
 1.15.2.2  11-Feb-2002  jdolecek Sync w/ -current.
 1.15.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.2.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.19.2.4  02-Nov-2004  skrll Sync with HEAD.
 1.19.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.19.2.1  03-Aug-2004  skrll Sync with HEAD
 1.21.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.21.4.1  29-Apr-2005  kent sync with -current
 1.22.4.4  21-Jan-2008  yamt sync with head
 1.22.4.3  27-Oct-2007  yamt sync with head.
 1.22.4.2  03-Sep-2007  yamt sync with head.
 1.22.4.1  21-Jun-2006  yamt sync with head.
 1.23.12.1  28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.23.10.1  19-Apr-2006  elad sync with head.
 1.23.8.1  01-Apr-2006  yamt sync with head.
 1.23.6.1  22-Apr-2006  simonb Sync with head.
 1.23.4.1  09-Sep-2006  rpaulo sync with head
 1.24.14.1  12-Mar-2007  rmind Sync with HEAD.
 1.25.10.1  15-Aug-2007  skrll Sync with HEAD.
 1.25.2.2  23-Oct-2007  ad Sync with head.
 1.25.2.1  19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.26.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.26.12.1  29-Jul-2007  ad file mscp.c was added on branch matt-mips64 on 2007-07-29 12:15:44 +0000
 1.26.10.1  25-Oct-2007  bouyer Sync with HEAD.
 1.26.6.2  09-Jan-2008  matt sync with HEAD
 1.26.6.1  06-Nov-2007  matt sync with HEAD
 1.26.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.27.8.1  08-Jan-2008  bouyer Sync with HEAD
 1.27.2.1  18-Feb-2008  mjf Sync with HEAD.
 1.28.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.29.12.2  28-Apr-2009  skrll Sync with HEAD.
 1.29.12.1  03-Mar-2009  skrll Sync with HEAD.
 1.29.4.2  16-May-2009  yamt sync with head
 1.29.4.1  04-May-2009  yamt sync with head.
 1.30.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.34.18.1  12-Jul-2012  riz Pull up following revision(s) (requested by abs in ticket #410):
sys/dev/mscp/mscp.h: revision 1.9
sys/dev/mscp/mscp.c: revision 1.35
sys/dev/mscp/mscp_subr.c: revision 1.43
Adjust MSCP attach routines. The current code worked fine on simh-vax, but
unfortunately failed on at least one 'real' SCSI MSCP adaptor.
In the updated code
mscp_dorsp()
 1.34.12.1  30-Oct-2012  yamt sync with head
 1.35.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.36.54.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.37.8.1  04-Aug-2021  thorpej Adapt to CFARGS().
 1.38.6.1  04-Apr-2025  martin Pull up following revision(s) (requested by hans in ticket #1080):

sys/dev/mscp/mscp_disk.c: revision 1.91
sys/dev/mscp/mscp_tape.c: revision 1.44
sys/dev/mscp/mscp.c: revision 1.39
sys/dev/mscp/mscpvar.h: revision 1.19

mscp(4): add ability for rronline() callback in a workqueue

when an ra(4) disk comes online the hardware interrupt ends up calling
disk_set_info(), which triggers a sleep lock/alloc in this path which
is triggered by LOCKDEBUG.

piggy-back on the existing workqueue for autoconfiguration to handle
this path and run the online completion in the work queue.
this is a little ugly, in that it puts two different types of work
into the one queue, but seems less ugly than creating a second
workqueue for what is likely another one-time event (infact, the other
user may be better handled via config_defer() -- i did not look too
closely.)

with this, LOCKDEBUG kernels work.

tested in simh.

RSS XML Feed