Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/mly.c
RevisionDateAuthorComments
 1.56  03-Sep-2021  andvar s/existant/existent/ in comments and messages, plus few more similar fixes.
 1.55  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.54  24-Apr-2021  thorpej branches: 1.54.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.53  10-Nov-2019  chs branches: 1.53.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.52  09-Dec-2018  jdolecek use pci_intr_establish_xname() everywhere
 1.51  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.50  07-Jul-2016  msaitoh branches: 1.50.16; 1.50.18;
KNF. Remove extra spaces. No functional change.
 1.49  25-Jul-2014  dholland branches: 1.49.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.48  29-Mar-2014  christos branches: 1.48.2;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.47  16-Mar-2014  dholland 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.46  17-Oct-2013  christos - remove unused variables
- move debugging code inside debugging sections
 1.45  27-Oct-2012  chs branches: 1.45.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.44  13-Nov-2010  uebayasi branches: 1.44.8; 1.44.18;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.43  26-Nov-2009  njoly branches: 1.43.4;
Cleanup interrupt establish error messages. Do not mix
aprint_error/aprint_normal/printf calls for a single line.
 1.42  12-May-2009  cegger use device_private().
"looks good" ad@
XXX for the device_t/softc split, please check the driver that no cases have been missed.
 1.41  06-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.40  06-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.39  08-Jun-2008  tsutsui branches: 1.39.12;
Replace device_lookup() with device_lookup_private() on getting softc
for future device_t/softc spilt.
 1.38  28-Apr-2008  martin branches: 1.38.2;
Remove clause 3 and 4 from TNF licenses
 1.37  10-Apr-2008  cegger branches: 1.37.2; 1.37.4;
use aprint_*_dev and device_xname
 1.36  19-Oct-2007  ad branches: 1.36.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.35  09-Jul-2007  ad branches: 1.35.6; 1.35.8; 1.35.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.34  04-Mar-2007  christos branches: 1.34.2; 1.34.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.33  02-Dec-2006  elad branches: 1.33.2;
Change kauth(9) KPI for kauth_authorize_device_passthru() to add another
argument, u_long, serving as a bit-mask of generic requests for the
passthru request.

Discussed on tech-security@ and tech-kern@. Okay tls@.
 1.32  16-Nov-2006  christos branches: 1.32.2;
__unused removal on arguments; approved by core.
 1.31  08-Nov-2006  elad Replace securelevel checks with kauth(9) calls.
 1.30  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.29  02-Sep-2006  christos branches: 1.29.2; 1.29.4;
- fix incomplete initializer
- static goes first
 1.28  23-Aug-2006  christos Acting as Elad's keyboard:

Place the securelevel checks in their logical locations.
This will be clearer in the future when code changes to use kauth(9) calls.

input and okay ad@
 1.27  14-May-2006  elad integrate kauth.
 1.26  14-Apr-2006  christos Coverity CID 1103: Avoid NULL pointer deref.
 1.25  14-Apr-2006  christos Coverity CID 2439: Remove bogus test.
 1.24  11-Dec-2005  christos branches: 1.24.4; 1.24.6; 1.24.8; 1.24.10; 1.24.12;
merge ktrace-lwp.
 1.23  27-Feb-2005  perry branches: 1.23.4;
nuke trailing whitespace
 1.22  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.21  29-Jun-2003  fvdl branches: 1.21.2; 1.21.10; 1.21.12;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.20  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.19  01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.18  31-Mar-2003  perry For consistency, initialise->initialize.
(No it isn't anti-UK bias -- just trying to keep the whole system to
one consistent spelling.)
 1.17  06-Jan-2003  wiz interrupt with two rs.
 1.16  25-Nov-2002  thorpej Avoid strict-alias warnings.
 1.15  23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.14  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.13  30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.12  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.11  06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.10  01-Jun-2002  lukem SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field). whilst it's O(n),
this mirrors the functionality of SLIST_REMOVE() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
 1.9  14-Jan-2002  tsutsui branches: 1.9.8;
Call malloc(9) with M_ZERO flag instead of memset() after malloc().
 1.8  13-Nov-2001  lukem add RCSID
 1.7  03-Aug-2001  ad branches: 1.7.2; 1.7.4;
Remove unnecessary test.
 1.6  01-Aug-2001  ad branches: 1.6.2;
Hook in the mly control interface on i386.
 1.5  31-Jul-2001  ad Oops, put back the initalization of "done" in mly_thread().
 1.4  30-Jul-2001  ad Assume that me->lun contains the device number if this event is for a
logical device.
 1.3  30-Jul-2001  ad - Forget to report events from logical devices.
- Cosmetic changes.
 1.2  30-Jul-2001  ad Don't match boards with a PCI class code of `I2O'.
 1.1  30-Jul-2001  ad Add a driver for Mylex AcceleRAID and eXtremeRAID controllers with v6
firmware. Based off the FreeBSD driver, and re-worked by tls, erh and I.
 1.6.2.7  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.6.2.6  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.5  11-Feb-2002  jdolecek Sync w/ -current.
 1.6.2.4  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.3  25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.6.2.2  03-Aug-2001  lukem update to -current
 1.6.2.1  01-Aug-2001  lukem file mly.c was added on branch kqueue on 2001-08-03 04:13:18 +0000
 1.7.4.3  01-Oct-2001  fvdl Catch up with -current.
 1.7.4.2  26-Sep-2001  fvdl * add a VCLONED vnode flag that indicates a vnode representing a cloned
device.
* rename REVOKEALL to REVOKEALIAS, and add a REVOKECLONE flag, to pass
to VOP_REVOKE
* the revoke system call will revoke all aliases, as before, but not the
clones
* vdevgone is called when detaching a device, so make it use REVOKECLONE
to get rid of all clones as well
* clean up all uses of VOP_OPEN wrt. locking.
* add a few VOPS to spec_vnops that need to do something when it's a
clone vnode (access and getattr)
* add a copy of the vnode vattr structure of the original 'master' vnode
to the specinfo of a cloned vnode. could possibly redirect getattr to
the 'master' vnode, but this has issues with revoke
* add a vdev_reassignvp function that disassociates a vnode from its
original device, and reassociates it with the specified dev_t. to be
used by cloning devices only, in case a new minor is allocated.
* change all direct references in drivers to v_devcookie and v_rdev
to vdev_privdata(vp) and vdev_rdev(vp). for diagnostic purposes
when debugging race conditions that still exist wrt. locking and
revoking vnodes.
* make the locking state of a vnode consistent when passed to
d_open and d_close (unlocked). locked would be better, but has
some deadlock issues
 1.7.4.1  07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.7.2.10  07-Jan-2003  thorpej Sync with HEAD.
 1.7.2.9  11-Dec-2002  thorpej Sync with HEAD.
 1.7.2.8  11-Nov-2002  nathanw Catch up to -current
 1.7.2.7  18-Oct-2002  nathanw Catch up to -current.
 1.7.2.6  17-Sep-2002  nathanw Catch up to -current.
 1.7.2.5  20-Jun-2002  nathanw Catch up to -current.
 1.7.2.4  28-Feb-2002  nathanw Catch up to -current.
 1.7.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.7.2.2  24-Aug-2001  nathanw Catch up with -current.
 1.7.2.1  03-Aug-2001  nathanw file mly.c was added on branch nathanw_sa on 2001-08-24 00:10:13 +0000
 1.9.8.2  20-Jun-2002  gehenna catch up with -current.
 1.9.8.1  16-May-2002  gehenna Add the character device switch.
 1.21.12.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.21.10.1  29-Apr-2005  kent sync with -current
 1.21.2.4  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.21.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.21.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.23.4.4  27-Oct-2007  yamt sync with head.
 1.23.4.3  03-Sep-2007  yamt sync with head.
 1.23.4.2  30-Dec-2006  yamt sync with head.
 1.23.4.1  21-Jun-2006  yamt sync with head.
 1.24.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.24.10.1  19-Apr-2006  elad sync with head.
 1.24.8.2  03-Sep-2006  yamt sync with head.
 1.24.8.1  24-May-2006  yamt sync with head.
 1.24.6.1  22-Apr-2006  simonb Sync with head.
 1.24.4.1  09-Sep-2006  rpaulo sync with head
 1.29.4.2  10-Dec-2006  yamt sync with head.
 1.29.4.1  22-Oct-2006  yamt sync with head
 1.29.2.2  12-Jan-2007  ad Sync with head.
 1.29.2.1  18-Nov-2006  ad Sync with head.
 1.32.2.1  04-Dec-2006  tron Pull up following revision(s) (requested by elad in ticket #247):
sys/dev/ic/dpt.c: revision 1.55
sys/dev/pci/amr.c: revision 1.43
sys/secmodel/bsd44/secmodel_bsd44_securelevel.c: revision 1.19
sys/dev/pci/mly.c: revision 1.33
share/man/man9/kauth.9: revision 1.37
sys/dev/ic/mlx.c: revision 1.49
sys/dev/ic/icp_ioctl.c: revision 1.14
sys/dev/i2o/iop.c: revision 1.62
sys/dev/pci/twe.c: revision 1.82
sys/sys/kauth.h: revision 1.25
sys/dev/i2o/dpti.c: revision 1.31
sys/kern/kern_auth.c: revision 1.33
sys/dev/tc/stic.c: revision 1.37
Change kauth(9) KPI for kauth_authorize_device_passthru() to add another
argument, u_long, serving as a bit-mask of generic requests for the
passthru request.
Discussed on tech-security@ and tech-kern@. Okay tls@.
 1.33.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.34.4.1  11-Jul-2007  mjf Sync with head.
 1.34.2.4  23-Oct-2007  ad Sync with head.
 1.34.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.34.2.2  10-Apr-2007  ad Nuke the deferred kthread creation stuff, as it's no longer needed.
Pointed out by thorpej@.
 1.34.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.35.12.1  25-Oct-2007  bouyer Sync with HEAD.
 1.35.8.1  06-Nov-2007  matt sync with HEAD
 1.35.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.36.16.3  29-Jun-2008  mjf Sync with HEAD.
 1.36.16.2  02-Jun-2008  mjf Sync with HEAD.
 1.36.16.1  05-Apr-2008  mjf - add "file-system DEVFS" and "pseudo-device devfsctl" to conf/std seeing
as these are always needed.

- convert many, many drivers over to the New Devfs World Order. For a
list of device drivers yet to be converted see,
http://www.netbsd.org/~mjf/devfs-todo.html.

- add a new device_unregister_all(device_t) function to remove all device
names associated with a device_t, which saves us having to construct
device names when the driver is detached.

- add a DEV_AUDIO type for devices.
 1.37.4.4  11-Mar-2010  yamt sync with head
 1.37.4.3  16-May-2009  yamt sync with head
 1.37.4.2  04-May-2009  yamt sync with head.
 1.37.4.1  16-May-2008  yamt sync with head.
 1.37.2.2  17-Jun-2008  yamt sync with head.
 1.37.2.1  18-May-2008  yamt sync with head.
 1.38.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.39.12.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.43.4.1  05-Mar-2011  rmind sync with head
 1.44.18.3  03-Dec-2017  jdolecek update from HEAD
 1.44.18.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.44.18.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.44.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.44.8.1  30-Oct-2012  yamt sync with head
 1.45.2.1  18-May-2014  rmind sync with head
 1.48.2.1  10-Aug-2014  tls Rebase.
 1.49.4.1  09-Jul-2016  skrll Sync with HEAD
 1.50.18.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.50.18.1  10-Jun-2019  christos Sync with HEAD
 1.50.16.2  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.50.16.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.53.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.54.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed