Home | History | Annotate | only in /src/sys/arch/sun2/dev
History log of /src/sys/arch/sun2/dev
RevisionDateAuthorComments
 1.18 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.17 19-Sep-2009  tsutsui Split device_t/softc.
Tested on TME emulating SS2.

XXX: bwtwo at obmem on TME emulating sun2 didn't match and cannot test
 1.16 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.15 29-Mar-2006  thorpej branches: 1.15.62; 1.15.64; 1.15.66;
Use device_cfdata().
 1.14 11-Dec-2005  christos branches: 1.14.4; 1.14.6; 1.14.8; 1.14.10; 1.14.12;
merge ktrace-lwp.
 1.13 03-Jun-2005  tsutsui branches: 1.13.2;
Add const.
 1.12 22-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.11 04-Dec-2003  keihan branches: 1.11.8;
NetBSD.ORG -> NetBSD.org

Now all "NetBSD.ORG" are gone from src/sys.
 1.10 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.9 15-Jul-2003  lukem __KERNEL_RCSID()
 1.8 02-Oct-2002  thorpej branches: 1.8.6;
Add trailing ; to CFATTACH_DECL.
 1.7 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 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.4 22-Mar-2002  fredette branches: 1.4.4;
sc_btype has been removed from struct bwtwo_softc.
 1.3 27-Jun-2001  fredette branches: 1.3.2; 1.3.8;
Converted to use the new bus-specific attach args,
and the bus_space_peek_N functions.
 1.2 10-Apr-2001  fredette branches: 1.2.2;
Use fb_setsize_eeprom to do some intialization of the
fb structure.
 1.1 06-Apr-2001  fredette Added.
 1.2.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.1 10-Apr-2001  bouyer file bwtwo_any.c was added on branch thorpej_scsipi on 2001-04-21 17:54:47 +0000
 1.3.8.4 18-Oct-2002  nathanw Catch up to -current.
 1.3.8.3 17-Sep-2002  nathanw Catch up to -current.
 1.3.8.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.8.1 27-Jun-2001  nathanw file bwtwo_any.c was added on branch nathanw_sa on 2002-04-01 07:43:16 +0000
 1.3.2.2 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.3.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.4.1 19-May-2002  gehenna Remove unnecessary #include
 1.8.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.8.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.1 03-Aug-2004  skrll Sync with HEAD
 1.11.8.1 29-Apr-2005  kent sync with -current
 1.13.2.1 21-Jun-2006  yamt sync with head.
 1.14.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.14.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.14.8.1 01-Apr-2006  yamt sync with head.
 1.14.6.1 22-Apr-2006  simonb Sync with head.
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.15.66.2 11-Mar-2010  yamt sync with head
 1.15.66.1 16-May-2008  yamt sync with head.
 1.15.64.1 18-May-2008  yamt sync with head.
 1.15.62.1 02-Jun-2008  mjf Sync with HEAD.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 06-Apr-2001  fredette branches: 1.1.2; 1.1.10; 1.1.128; 1.1.130; 1.1.132;
Added.
 1.1.132.1 16-May-2008  yamt sync with head.
 1.1.130.1 18-May-2008  yamt sync with head.
 1.1.128.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.10.2 06-Apr-2001  fredette Added.
 1.1.10.1 06-Apr-2001  fredette file bwtworeg.h was added on branch nathanw_sa on 2001-04-06 15:14:40 +0000
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 06-Apr-2001  bouyer file bwtworeg.h was added on branch thorpej_scsipi on 2001-04-21 17:54:47 +0000
 1.4 13-Oct-2012  tsutsui Remove unused struct device menber from softc. from chs@
 1.3 11-Dec-2005  christos branches: 1.3.112; 1.3.122;
merge ktrace-lwp.
 1.2 22-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.1 22-Mar-2002  fredette branches: 1.1.4; 1.1.10; 1.1.16; 1.1.24;
Added bits to complete the sun2 console code. These are
virtually identical copies of files under sys/arch/sparc/dev,
and one day they will be merged under sys/dev/sun.
 1.1.24.1 29-Apr-2005  kent sync with -current
 1.1.16.1 24-Jan-2005  skrll Sync with HEAD.
 1.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 22-Mar-2002  jdolecek file cons.h was added on branch kqueue on 2002-06-23 17:42:29 +0000
 1.1.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.1 22-Mar-2002  nathanw file cons.h was added on branch nathanw_sa on 2002-04-01 07:43:17 +0000
 1.3.122.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.3.112.1 30-Oct-2012  yamt sync with head
 1.9 10-Aug-2012  tsutsui branches: 1.9.20; 1.9.30;
Move cn_tab initialization from late cpu_startup(9) to
early _bootstrap() in locore2.c.
Tested on TME emulating 2/120.
 1.8 30-Jul-2012  christos move console initialization to cpu_startup() so that we avoid multiple common.
 1.7 27-Dec-2009  tsutsui branches: 1.7.12;
Fix missing parenthesis in #ifdef notyet block. PR port-sun2/42524
 1.6 11-Dec-2005  christos branches: 1.6.78;
merge ktrace-lwp.
 1.5 03-Jun-2005  tsutsui Add const.
 1.4 22-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.3 15-Jul-2003  lukem branches: 1.3.8;
__KERNEL_RCSID()
 1.2 06-Sep-2002  gehenna branches: 1.2.6;
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.1 22-Mar-2002  fredette branches: 1.1.4; 1.1.6; 1.1.10;
Added bits to complete the sun2 console code. These are
virtually identical copies of files under sys/arch/sparc/dev,
and one day they will be merged under sys/dev/sun.
 1.1.10.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.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 22-Mar-2002  jdolecek file consinit.c was added on branch kqueue on 2002-06-23 17:42:29 +0000
 1.1.6.1 19-May-2002  gehenna Replace the access to devsw table and the hard-coded majors with devsw API.
 1.1.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.1.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.1 22-Mar-2002  nathanw file consinit.c was added on branch nathanw_sa on 2002-04-01 07:43:17 +0000
 1.2.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.2.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.6.1 03-Aug-2004  skrll Sync with HEAD
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.6.78.1 11-Mar-2010  yamt sync with head
 1.7.12.1 30-Oct-2012  yamt sync with head
 1.9.30.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.9.20.1 20-Jul-2016  pgoyette Adapt the machine/arch dependent code to the new {b,c}devsw reference
counting.

XXX Most of these will require testing by someone other than myself, as
I have a limited selection of hardware!
 1.37 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.36 19-Mar-2020  thorpej branches: 1.36.28;
Replace manipulating IFF_OACTIVE with an internal "txbusy" field.
 1.35 29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.34 29-May-2019  msaitoh branches: 1.34.4;
Even if we don't use MII(4), use the common path of SIOC[GS]IFMEDIA in
sys/net/if_ethersubr.c if we can.
- Add ec_ifmedia into struct ethercom.
- ec_mii in struct ethercom is kept and used as it is. It might be used in
future. Note that some Ethernet drivers which _DOESN'T_ use mii(4) use
ec_mii for keeping the if_media. Those should be changed in future.
 1.33 29-May-2019  msaitoh KNF. No functional change.
 1.32 29-May-2019  msaitoh Whitespace fix. No functional change.
 1.31 05-Feb-2019  msaitoh Remove very old IFF_NOTRAILERS flag.
 1.30 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.29 26-Jun-2018  msaitoh branches: 1.29.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.28 22-Jun-2018  msaitoh It's not required to include net/bpfdesc.h. Remove it.
 1.27 15-Dec-2016  ozaki-r branches: 1.27.8; 1.27.14;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
- Where/When if_ipackets is counted up
- Note that some drivers still update packet statistics in their own
way (periodical update)
- Moved bpf_mtap run in softint
- This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
 1.26 08-Dec-2016  ozaki-r Apply deferred if_start framework

if_schedule_deferred_start checks if the if_snd queue contains packets,
so drivers don't need to check it by themselves.
 1.25 10-Jun-2016  ozaki-r branches: 1.25.2;
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.24 09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.23 20-May-2015  ozaki-r Remove leftover use of AF_NS and NS option

Unnecessary NETISR_NS is also removed.
 1.22 13-Apr-2015  riastradh MD rnd.h cleanups. Please let me know if I broke anything!
 1.21 10-Aug-2014  tls branches: 1.21.4;
Merge tls-earlyentropy branch into HEAD.
 1.20 02-Feb-2012  tls branches: 1.20.6; 1.20.20;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.19 19-Nov-2011  tls branches: 1.19.2;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.18 05-Apr-2010  joerg branches: 1.18.8;
Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.17 19-Jan-2010  pooka branches: 1.17.2; 1.17.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 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 06-Jul-2008  tsutsui branches: 1.15.2; 1.15.4;
Split device_t/softc with misc cosmetic changes.
 1.14 28-Apr-2008  martin branches: 1.14.2; 1.14.4;
Remove clause 3 and 4 from TNF licenses
 1.13 02-Jan-2008  dogcow branches: 1.13.6; 1.13.8; 1.13.10;
const char casting, to make gcc happy. (not that sun2 compiles these days
without other patches.)
 1.12 04-Mar-2007  christos branches: 1.12.20; 1.12.26; 1.12.32;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 11-Dec-2005  christos branches: 1.11.26;
merge ktrace-lwp.
 1.10 22-Jan-2005  chs branches: 1.10.8;
de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.9 30-Oct-2003  mycroft branches: 1.9.8;
This driver was broken by bouyer on 2003/01/20.
I've made it at least config up/down again -- haven't tried actually passing
traffic.
 1.8 15-Jul-2003  lukem __KERNEL_RCSID()
 1.7 20-Jan-2003  bouyer branches: 1.7.2;
bzero the part of the buffer used to pad the packet to
ETHER_MIN_LEN - ETHER_CRC_LEN.
 1.6 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.5 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 17-Dec-2001  fredette branches: 1.3.10;
Added ifmedia(4) support.
 1.2 17-Aug-2001  fredette branches: 1.2.6;
Sometimes the ec board reports a packet length that's too large.
Try to deal with this by clipping the packet length, and, under
DEBUG, printf when we do. Also zero out the packet status in
the buffer before we give it back to the board.
 1.1 27-Jun-2001  fredette branches: 1.1.2;
Added an attachment for Intel ethernet (ie) at obio.
Added support for the 3Com Ethernet (ec) at mbmem.
 1.1.2.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.1.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.2.6.3 18-Oct-2002  nathanw Catch up to -current.
 1.2.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.2.6.1 17-Aug-2001  nathanw file if_ec.c was added on branch nathanw_sa on 2002-01-08 00:28:08 +0000
 1.3.10.2 26-Oct-2005  riz Pull up following revision(s) (requested by tsutsui in ticket #5785):
sys/arch/sun2/dev/if_ec.c: revision 1.9
This driver was broken by bouyer on 2003/01/20.
I've made it at least config up/down again -- haven't tried actually passing
traffic.
 1.3.10.1 28-Jan-2003  jmc Pullup revisions 1.6-1.7 (requested by bouyer in ticket #1122)
bzero the part of the buffer used to pad the packet to
ETHER_MIN_LEN - ETHER_CRC_LEN.
 1.7.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.8.2 21-Jan-2008  yamt sync with head
 1.10.8.1 03-Sep-2007  yamt sync with head.
 1.11.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.12.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.12.20.1 09-Jan-2008  matt sync with HEAD
 1.13.10.4 11-Aug-2010  yamt sync with head.
 1.13.10.3 11-Mar-2010  yamt sync with head
 1.13.10.2 04-May-2009  yamt sync with head.
 1.13.10.1 16-May-2008  yamt sync with head.
 1.13.8.1 18-May-2008  yamt sync with head.
 1.13.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.13.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.13.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.4.1 18-Jul-2008  simonb Sync with head.
 1.14.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 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 30-May-2010  rmind sync with head
 1.17.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.18.8.1 17-Apr-2012  yamt sync with head
 1.19.2.1 18-Feb-2012  mrg merge to -current.
 1.20.20.1 07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.20.6.2 03-Dec-2017  jdolecek update from HEAD
 1.20.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.21.4.4 05-Feb-2017  skrll Sync with HEAD
 1.21.4.3 09-Jul-2016  skrll Sync with HEAD
 1.21.4.2 19-Mar-2016  skrll Sync with HEAD
 1.21.4.1 06-Jun-2015  skrll Sync with HEAD
 1.25.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.27.14.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.27.14.2 28-Jul-2018  pgoyette Sync with HEAD
 1.27.14.1 25-Jun-2018  pgoyette Sync with HEAD
 1.27.8.1 26-Jul-2018  snj Pull up following revision(s) (requested by msaitoh in ticket #938):
sys/arch/acorn32/podulebus/if_ie.c: revision 1.41
sys/arch/amiga/dev/if_es.c: revision 1.58
sys/arch/amiga/dev/if_qn.c: revision 1.45
sys/arch/arm/at91/at91emac.c: revision 1.20
sys/arch/arm/ep93xx/epe.c: revision 1.37
sys/arch/emips/ebus/if_le_ebus.c: revision 1.14
sys/arch/emips/ebus/if_le_ebus.c: revision 1.15
sys/arch/mac68k/dev/if_mc.c: revision 1.46
sys/arch/macppc/dev/am79c950.c: revision 1.39
sys/arch/newsmips/apbus/if_sn.c: revision 1.40
sys/arch/next68k/dev/mb8795.c: revision 1.59
sys/arch/playstation2/dev/if_smap.c: revision 1.25
sys/arch/playstation2/dev/if_smap.c: revision 1.26
sys/arch/sun2/dev/if_ec.c: revision 1.28
sys/arch/sun3/dev/if_ie.c: revision 1.63
sys/arch/x68k/dev/if_ne_intio.c: revision 1.19
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.75
sys/arch/xen/xen/xennetback_xenbus.c: revision 1.63
sys/dev/bi/if_ni.c: revision 1.45
sys/dev/cadence/if_cemac.c: revision 1.12
sys/dev/ic/am7990.c: revision 1.78
sys/dev/ic/am79900.c: revision 1.27
sys/dev/ic/an.c: revision 1.67
sys/dev/ic/cs89x0.c: revision 1.40
sys/dev/ic/dm9000.c: revision 1.13
sys/dev/ic/dm9000.c: revision 1.14
sys/dev/ic/dp8390.c: revision 1.88
sys/dev/ic/elink3.c: revision 1.141
sys/dev/ic/elinkxl.c: revision 1.122
sys/dev/ic/hme.c: revision 1.98
sys/dev/ic/i82586.c: revision 1.77
sys/dev/ic/lance.c: revision 1.53
sys/dev/ic/mb86950.c: revision 1.27
sys/dev/ic/mb86960.c: revision 1.86
sys/dev/ic/mtd803.c: revision 1.34
sys/dev/ic/pdq_ifsubr.c: revision 1.59
sys/dev/ic/rrunner.c: revision 1.86
sys/dev/ic/seeq8005.c: revision 1.58
sys/dev/ic/sgec.c: revision 1.47
sys/dev/ic/smc90cx6.c: revision 1.72
sys/dev/ic/smc91cxx.c: revision 1.96
sys/dev/ic/tropic.c: revision 1.49
sys/dev/ic/wi.c: revision 1.245
sys/dev/isa/if_eg.c: revision 1.93
sys/dev/isa/if_el.c: revision 1.95
sys/dev/isa/if_iy.c: revision 1.101
sys/dev/ofw/ofnet.c: revision 1.58
sys/dev/pci/if_alc.c: revision 1.27
sys/dev/pci/if_de.c: revision 1.152
sys/dev/pci/if_fpa.c: revision 1.61
sys/dev/pci/if_jme.c: revision 1.34
sys/dev/pci/if_tl.c: revision 1.108
sys/dev/pci/if_vte.c: revision 1.19
sys/dev/pci/ixgbe/ixgbe.h: revision 1.50
sys/dev/pcmcia/if_cnw.c: revision 1.62
sys/dev/pcmcia/if_malo_pcmcia.c: revision 1.17
sys/dev/pcmcia/if_ray.c: revision 1.89
sys/dev/pcmcia/if_xi.c: revision 1.81
sys/dev/pcmcia/mhzc.c: revision 1.51
sys/dev/pcmcia/xirc.c: revision 1.34
sys/dev/qbus/if_de.c: revision 1.33
sys/dev/qbus/if_qe.c: revision 1.78
sys/dev/qbus/if_qt.c: revision 1.22
sys/dev/sbus/be.c: revision 1.87
sys/dev/sbus/qe.c: revision 1.68
sys/dev/scsipi/if_se.c: revision 1.96
sys/dev/usb/if_atu.c: revision 1.59
sys/net/if_l2tp.c: revision 1.28 via patch
sys/net/if_ppp.c: revision 1.160
It's not required to include net/bpfdesc.h. Remove it.
--
Simplify like other drivers. NULL check of ifp->if_bpf is done in
bpf_mtap(), so it's not required to do it here.
--
Remove duplicated inclusion of net/bpf.h.
--
Remove duplicated inclusion of net/bpf.h.
--
Simplify bpf_mtap() call. No functional change.
 1.29.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.29.2.1 10-Jun-2019  christos Sync with HEAD
 1.34.4.1 29-Feb-2020  ad Sync with head.
 1.36.28.1 02-Aug-2025  perseant Sync with HEAD
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.76; 1.5.78;
merge ktrace-lwp.
 1.4 22-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.3 17-Aug-2001  fredette branches: 1.3.6; 1.3.22; 1.3.30;
Sometimes the ec board reports a packet length that's too large.
Try to deal with this by clipping the packet length, and, under
DEBUG, printf when we do. Also zero out the packet status in
the buffer before we give it back to the board.
 1.2 14-Aug-2001  fredette Fixed a bug where we were using ETHERMIN and ETHERMTU
where we really wanted ETHER_MIN_LEN and ETHER_MAX_LEN.
 1.1 27-Jun-2001  fredette branches: 1.1.2;
Added an attachment for Intel ethernet (ie) at obio.
Added support for the 3Com Ethernet (ec) at mbmem.
 1.1.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.3.30.1 29-Apr-2005  kent sync with -current
 1.3.22.1 24-Jan-2005  skrll Sync with HEAD.
 1.3.6.2 17-Aug-2001  fredette Sometimes the ec board reports a packet length that's too large.
Try to deal with this by clipping the packet length, and, under
DEBUG, printf when we do. Also zero out the packet status in
the buffer before we give it back to the board.
 1.3.6.1 17-Aug-2001  fredette file if_ecreg.h was added on branch nathanw_sa on 2001-08-17 20:27:13 +0000
 1.5.78.1 16-May-2008  yamt sync with head.
 1.5.76.1 18-May-2008  yamt sync with head.
 1.5.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.13 24-Oct-2021  andvar fix various typos in comments, mainly copypasta.
 1.12 25-Apr-2019  msaitoh No functional change:
- Use __arraycount().
- u_int_{8,16,32}_t -> uint_{8,16,32}_t
- KNF.
- Tabify.
- Remove extra space.
 1.11 03-Jun-2011  tsutsui branches: 1.11.54;
Split device_t/softc of i82586. No crash on TME emulating sun2.
 1.10 01-Feb-2011  chuck branches: 1.10.2;
udpate license clauses on my code to match the new-style BSD licenses.
remove no-longer-valid wustl email address for me.
based on diff that rmind@ sent me.

no functional change with this commit.
 1.9 11-Dec-2005  christos branches: 1.9.100; 1.9.106; 1.9.108;
merge ktrace-lwp.
 1.8 22-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.7 15-Jul-2003  lukem branches: 1.7.8;
__KERNEL_RCSID()
 1.6 02-Oct-2002  thorpej branches: 1.6.6;
Add trailing ; to CFATTACH_DECL.
 1.5 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 27-Jun-2001  fredette branches: 1.3.2; 1.3.8;
Converted to use the new bus-specific attach args,
and the bus_space_peek_N functions. Also uses the
sun68k-specific bus_space_copy{in,out} functions.
 1.2 10-Apr-2001  fredette branches: 1.2.2;
Fixed a bug where we were trying to map the board RAM
using the physical address of the board registers.
 1.1 06-Apr-2001  fredette Added.
 1.2.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.1 10-Apr-2001  bouyer file if_ie_mbmem.c was added on branch thorpej_scsipi on 2001-04-21 17:54:47 +0000
 1.3.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.3.8.1 27-Jun-2001  nathanw file if_ie_mbmem.c was added on branch nathanw_sa on 2002-10-18 02:40:13 +0000
 1.3.2.1 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.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.6.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.1 03-Aug-2004  skrll Sync with HEAD
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.9.108.1 08-Feb-2011  bouyer Sync with HEAD
 1.9.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.100.2 12-Jun-2011  rmind sync with head
 1.9.100.1 05-Mar-2011  rmind sync with head
 1.10.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.11.54.1 10-Jun-2019  christos Sync with HEAD
 1.19 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.18 24-Oct-2021  andvar fix various typos in comments, mainly copypasta.
 1.17 25-Apr-2019  msaitoh No functional change:
- Use __arraycount().
- u_int_{8,16,32}_t -> uint_{8,16,32}_t
- KNF.
- Tabify.
- Remove extra space.
 1.16 24-Mar-2014  christos branches: 1.16.30;
- remove unused
- use cpu_{g,s}etmodel
 1.15 03-Jun-2011  tsutsui branches: 1.15.2; 1.15.12; 1.15.16;
Split device_t/softc of i82586. No crash on TME emulating sun2.
 1.14 01-Feb-2011  chuck branches: 1.14.2;
udpate license clauses on my code to match the new-style BSD licenses.
remove no-longer-valid wustl email address for me.
based on diff that rmind@ sent me.

no functional change with this commit.
 1.13 28-Apr-2008  martin branches: 1.13.22; 1.13.28; 1.13.30;
Remove clause 3 and 4 from TNF licenses
 1.12 04-Mar-2007  christos branches: 1.12.40; 1.12.42; 1.12.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.10 11-Dec-2005  christos branches: 1.10.26;
merge ktrace-lwp.
 1.9 03-Jun-2005  tsutsui branches: 1.9.2;
Fix shadowing variable warning.
 1.8 22-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.7 15-Jul-2003  lukem branches: 1.7.8;
__KERNEL_RCSID()
 1.6 01-Apr-2003  thorpej branches: 1.6.2;
Use PAGE_SIZE rather than NBPG.
 1.5 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.4 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 01-Oct-2001  fredette branches: 1.2.4;
Changed an obio to read Multibus.
 1.1 27-Jun-2001  fredette branches: 1.1.2; 1.1.4;
Added an attachment for Intel ethernet (ie) at obio.
Added support for the 3Com Ethernet (ec) at mbmem.
 1.1.4.1 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.1.2.2 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.1.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.2 18-Oct-2002  nathanw Catch up to -current.
 1.2.4.1 01-Oct-2001  nathanw file if_ie_obio.c was added on branch nathanw_sa on 2002-10-18 02:40:14 +0000
 1.6.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.9.2.2 03-Sep-2007  yamt sync with head.
 1.9.2.1 26-Feb-2007  yamt sync with head.
 1.10.26.2 12-Mar-2007  rmind Sync with HEAD.
 1.10.26.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.12.44.1 16-May-2008  yamt sync with head.
 1.12.42.1 18-May-2008  yamt sync with head.
 1.12.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.30.1 08-Feb-2011  bouyer Sync with HEAD
 1.13.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.13.22.2 12-Jun-2011  rmind sync with head
 1.13.22.1 05-Mar-2011  rmind sync with head
 1.14.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.15.16.1 18-May-2014  rmind sync with head
 1.15.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.15.2.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.16.30.1 10-Jun-2019  christos Sync with HEAD
 1.25 25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.24 16-Mar-2014  dholland branches: 1.24.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.23 27-Oct-2012  chs branches: 1.23.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.22 24-Apr-2011  rmind branches: 1.22.4; 1.22.14;
Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.21 28-Apr-2008  martin branches: 1.21.22; 1.21.28;
Remove clause 3 and 4 from TNF licenses
 1.20 29-Mar-2008  tsutsui branches: 1.20.2; 1.20.4;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.19 19-Nov-2007  ad branches: 1.19.14;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.18 21-Oct-2007  he branches: 1.18.2;
Move declaration of kd_later() up before the first use.
 1.17 18-Oct-2007  joerg Initialise the callbacks for tty.t_rstrt_ch in ttymalloc
as all drivers but Sun/SPARC's kd.c use the same arguments.
Separate callout_reset into callout_schedule and the initial
callout_setfunc using that.
 1.16 04-Mar-2007  christos branches: 1.16.2; 1.16.18; 1.16.20; 1.16.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.15 16-Feb-2007  ad branches: 1.15.2;
More spllowersoftclock() fallout.
 1.14 01-Oct-2006  elad Adapt MD code to KAUTH_DEVICE_TTY_OPEN. Patch from Matt Fleming, thanks!
 1.13 23-Jul-2006  ad branches: 1.13.4; 1.13.6;
Use the LWP cached credentials where sane.
 1.12 14-May-2006  elad integrate kauth.
 1.11 11-Dec-2005  christos branches: 1.11.4; 1.11.6; 1.11.8; 1.11.10; 1.11.12;
merge ktrace-lwp.
 1.10 06-Sep-2005  kleink Change the driver open function's conditional for overriding exclusive tty
use from checking the proc's uid to suser(9), and account for the use of
privileges. Noted by David Holland in PR kern/31126.
 1.9 22-Jan-2005  chs branches: 1.9.8;
de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.8 25-Aug-2003  uwe branches: 1.8.8;
Undo previous as it broke things.

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.7 24-Aug-2003  uwe #include "opt_rcons.h"
 1.6 15-Jul-2003  lukem __KERNEL_RCSID()
 1.5 23-Oct-2002  jdolecek branches: 1.5.6;
g/c cons_ocount, it's not used by anything
 1.4 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.3 10-Oct-2002  martin Pass a struct cons_channel * to cc_iclose, not a struct kbd_softc *.
This argument has been previously unused, thus undetected due to void*
typing. Mmm, copy & paste. Note that sparc got it right though.

Many thanks to Valeriy E. Ushakov <uwe@netbsd.org> for debugging support.
 1.2 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.1 22-Mar-2002  fredette branches: 1.1.4; 1.1.6; 1.1.10;
Added bits to complete the sun2 console code. These are
virtually identical copies of files under sys/arch/sparc/dev,
and one day they will be merged under sys/dev/sun.
 1.1.10.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.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 22-Mar-2002  jdolecek file kd.c was added on branch kqueue on 2002-06-23 17:42:30 +0000
 1.1.6.2 08-Jun-2002  gehenna remove unused function.
 1.1.6.1 19-May-2002  gehenna Add device switch.
Replace the access to devsw table and the hard-coded majors with devsw API.
 1.1.4.5 11-Nov-2002  nathanw Catch up to -current
 1.1.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.1.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.1 22-Mar-2002  nathanw file kd.c was added on branch nathanw_sa on 2002-04-01 07:43:17 +0000
 1.5.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.6.5 04-Feb-2005  skrll Adapt to branch.
 1.5.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.5.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.6.1 03-Aug-2004  skrll Sync with HEAD
 1.8.8.1 29-Apr-2005  kent sync with -current
 1.9.8.6 07-Dec-2007  yamt sync with head
 1.9.8.5 27-Oct-2007  yamt sync with head.
 1.9.8.4 03-Sep-2007  yamt sync with head.
 1.9.8.3 26-Feb-2007  yamt sync with head.
 1.9.8.2 30-Dec-2006  yamt sync with head.
 1.9.8.1 21-Jun-2006  yamt sync with head.
 1.11.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.11.10.3 13-May-2006  elad sprinkle some #include <sys/kauth.h> in files that use kauth kpi but
don't include it yet. hopefully this will prevent some fallout.
 1.11.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.11.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.11.8.2 11-Aug-2006  yamt sync with head
 1.11.8.1 24-May-2006  yamt sync with head.
 1.11.6.1 01-Jun-2006  kardel Sync with head.
 1.11.4.1 09-Sep-2006  rpaulo sync with head
 1.13.6.1 22-Oct-2006  yamt sync with head
 1.13.4.1 18-Nov-2006  ad Sync with head.
 1.15.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.16.24.2 21-Nov-2007  bouyer Sync with HEAD
 1.16.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.16.20.2 09-Jan-2008  matt sync with HEAD
 1.16.20.1 06-Nov-2007  matt sync with HEAD
 1.16.18.2 21-Nov-2007  joerg Sync with HEAD.
 1.16.18.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.2.3 03-Dec-2007  ad Sync with HEAD.
 1.16.2.2 03-Dec-2007  ad Sync with HEAD.
 1.16.2.1 23-Oct-2007  ad Sync with head.
 1.18.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.19.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.19.14.1 03-Apr-2008  mjf 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.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.21.22.1 31-May-2011  rmind sync with head
 1.22.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.22.4.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.22.4.1 30-Oct-2012  yamt sync with head
 1.23.2.1 18-May-2014  rmind sync with head
 1.24.2.1 10-Aug-2014  tls Rebase.
 1.22 25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.21 16-Mar-2014  dholland branches: 1.21.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.20 24-Apr-2011  rmind branches: 1.20.4; 1.20.14; 1.20.18;
Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.19 06-Jul-2008  tsutsui branches: 1.19.18; 1.19.24;
Split device_t/softc with misc cosmetic changes.
 1.18 13-Jun-2008  cegger use device_lookup_private to get softc
 1.17 19-Nov-2007  ad branches: 1.17.14; 1.17.16; 1.17.18; 1.17.20; 1.17.22;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.16 18-Oct-2007  joerg branches: 1.16.2;
Initialise the callbacks for tty.t_rstrt_ch in ttymalloc
as all drivers but Sun/SPARC's kd.c use the same arguments.
Separate callout_reset into callout_schedule and the initial
callout_setfunc using that.
 1.15 17-Oct-2007  garbled Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.14 09-Jul-2007  ad branches: 1.14.8; 1.14.10; 1.14.14;
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 04-Mar-2007  christos branches: 1.13.2; 1.13.4; 1.13.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.12 01-Oct-2006  elad branches: 1.12.4;
Adapt MD code to KAUTH_DEVICE_TTY_OPEN. Patch from Matt Fleming, thanks!
 1.11 23-Jul-2006  ad branches: 1.11.4; 1.11.6;
Use the LWP cached credentials where sane.
 1.10 14-May-2006  elad integrate kauth.
 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 22-Jan-2005  chs branches: 1.8.8;
de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.7 15-Jul-2003  lukem branches: 1.7.8;
__KERNEL_RCSID()
 1.6 23-Oct-2002  jdolecek branches: 1.6.6;
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.5 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.4 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 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.1 22-Mar-2002  fredette branches: 1.1.4; 1.1.6; 1.1.10;
Added bits to complete the sun2 console code. These are
virtually identical copies of files under sys/arch/sparc/dev,
and one day they will be merged under sys/dev/sun.
 1.1.10.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.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 22-Mar-2002  jdolecek file pcons.c was added on branch kqueue on 2002-06-23 17:42:30 +0000
 1.1.6.2 08-Jun-2002  gehenna remove unused function.
 1.1.6.1 17-May-2002  gehenna Add device switch.
 1.1.4.5 11-Nov-2002  nathanw Catch up to -current
 1.1.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.1.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.1 22-Mar-2002  nathanw file pcons.c was added on branch nathanw_sa on 2002-04-01 07:43:17 +0000
 1.6.6.5 04-Feb-2005  skrll Adapt to branch.
 1.6.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.6.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.1 03-Aug-2004  skrll Sync with HEAD
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.8.8.5 07-Dec-2007  yamt sync with head
 1.8.8.4 27-Oct-2007  yamt sync with head.
 1.8.8.3 03-Sep-2007  yamt sync with head.
 1.8.8.2 30-Dec-2006  yamt sync with head.
 1.8.8.1 21-Jun-2006  yamt sync with head.
 1.9.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.9.10.3 13-May-2006  elad sprinkle some #include <sys/kauth.h> in files that use kauth kpi but
don't include it yet. hopefully this will prevent some fallout.
 1.9.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.9.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.9.8.2 11-Aug-2006  yamt 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.11.6.1 22-Oct-2006  yamt sync with head
 1.11.4.1 18-Nov-2006  ad Sync with head.
 1.12.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.13.10.1 03-Oct-2007  garbled Sync with HEAD
 1.13.4.1 11-Jul-2007  mjf Sync with head.
 1.13.2.3 03-Dec-2007  ad Sync with HEAD.
 1.13.2.2 23-Oct-2007  ad Sync with head.
 1.13.2.1 15-Jul-2007  ad Sync with head.
 1.14.14.2 21-Nov-2007  bouyer Sync with HEAD
 1.14.14.1 25-Oct-2007  bouyer Sync with HEAD.
 1.14.10.2 09-Jan-2008  matt sync with HEAD
 1.14.10.1 06-Nov-2007  matt sync with HEAD
 1.14.8.2 21-Nov-2007  joerg Sync with HEAD.
 1.14.8.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.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.17.22.2 18-Jul-2008  simonb Sync with head.
 1.17.22.1 18-Jun-2008  simonb Sync with head.
 1.17.20.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.17.20.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.17.18.1 04-May-2009  yamt sync with head.
 1.17.16.1 17-Jun-2008  yamt sync with head.
 1.17.14.2 28-Sep-2008  mjf Sync with HEAD.
 1.17.14.1 29-Jun-2008  mjf Sync with HEAD.
 1.19.24.1 06-Jun-2011  jruoho Sync with HEAD.
 1.19.18.1 31-May-2011  rmind sync with head
 1.20.18.1 18-May-2014  rmind sync with head
 1.20.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.20.4.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.21.2.1 10-Aug-2014  tls Rebase.
 1.16 04-Aug-2023  rin sun2/sc(4): Fix panic due to wrong ENOMEM for DMA buffer

Use kmem_zalloc(9) for sc->sc_dma_handles[] to zero-initialize flags.

XXX
Will soon apply to sun3.
 1.15 21-Nov-2020  thorpej malloc(9) -> kmem(9)
 1.14 21-Nov-2009  rmind branches: 1.14.76;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.13 06-Jul-2008  tsutsui Split device_t/softc with misc cosmetic changes.
 1.12 28-Apr-2008  martin branches: 1.12.2; 1.12.4;
Remove clause 3 and 4 from TNF licenses
 1.11 29-Mar-2006  thorpej branches: 1.11.62; 1.11.64; 1.11.66;
Use device_cfdata().
 1.10 11-Dec-2005  christos branches: 1.10.4; 1.10.6; 1.10.8; 1.10.10; 1.10.12;
merge ktrace-lwp.
 1.9 22-Jan-2005  chs branches: 1.9.8;
de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.8 15-Jul-2003  lukem branches: 1.8.8;
__KERNEL_RCSID()
 1.7 03-May-2003  wiz branches: 1.7.2;
DMA, not dma nor Dma.
 1.6 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.5 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.2 27-Jun-2001  fredette branches: 1.2.2; 1.2.8;
Converted to use the new bus-specific attach args,
and the bus_space_peek_N functions. Now use hand-defined
macros instead of relying on structure layout to find registers.
Allocate the DMA handles here, since the MI chipset code
doesn't do that any more.
 1.1 18-Apr-2001  fredette branches: 1.1.2;
Added support for the Sun SC scsi controller.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 18-Apr-2001  bouyer file sc_mbmem.c was added on branch thorpej_scsipi on 2001-04-21 17:54:47 +0000
 1.2.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.2.8.1 27-Jun-2001  nathanw file sc_mbmem.c was added on branch nathanw_sa on 2002-10-18 02:40:14 +0000
 1.2.2.1 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.7.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.8.8.1 29-Apr-2005  kent sync with -current
 1.9.8.1 21-Jun-2006  yamt sync with head.
 1.10.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.10.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.10.8.1 01-Apr-2006  yamt sync with head.
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.11.66.3 11-Mar-2010  yamt sync with head
 1.11.66.2 04-May-2009  yamt sync with head.
 1.11.66.1 16-May-2008  yamt sync with head.
 1.11.64.1 18-May-2008  yamt sync with head.
 1.11.62.2 28-Sep-2008  mjf Sync with HEAD.
 1.11.62.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.4.1 18-Jul-2008  simonb Sync with head.
 1.12.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.14.76.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.2 14-Jun-2001  fredette This file has been moved to sys/dev/vme.
 1.1 18-Apr-2001  fredette branches: 1.1.2;
Added support for the Sun SC scsi controller.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 18-Apr-2001  bouyer file screg.h was added on branch thorpej_scsipi on 2001-04-21 17:54:47 +0000
 1.26 12-Dec-2023  andvar remove TTY_DEBUG code from sun2/sparc64 zs.c code. it doesn't look relevant
to this particular drivers and likely is a leftover from some historical code.
 1.25 26-Oct-2022  riastradh ddb/db_active.h: New home for extern db_active.

This can be included unconditionally, and db_active can then be
queried unconditionally; if DDB is not in the kernel, then db_active
is a constant zero. Reduces need for #include opt_ddb.h, #ifdef DDB.
 1.24 11-Sep-2021  andvar Add missing double p and d for stopped and overriden accordingly.
Fix few more typos along the way, mainly in copy-pasted comments.
 1.23 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.22 24-Apr-2021  thorpej branches: 1.22.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.21 13-Oct-2012  tsutsui branches: 1.21.52;
struct device * -> device_t, struct cfdata * -> cfdata_t (from chs@)
 1.20 26-Oct-2011  mrg branches: 1.20.2; 1.20.12;
catch up with other zs ports, original commit was:

>add two new functions for z8530tty: zs_chan_lock() and zs_chan_unlock(),
>and use them instead of various spl's in the zs.c's.
>
>reviewed by ad and martin.
 1.19 13-Jun-2008  cegger use device_lookup_private to get softc
 1.18 28-Apr-2008  martin branches: 1.18.2; 1.18.4;
Remove clause 3 and 4 from TNF licenses
 1.17 29-Mar-2008  tsutsui branches: 1.17.2; 1.17.4;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.16 04-Dec-2007  tsutsui branches: 1.16.12;
Adapt sun68k ports to recent interrupt handling changes.

XXX: sun2 (m68010) doesn't have CAS instructions.
 1.15 09-Nov-2007  ad branches: 1.15.2;
Call zs_lock_init() to set up the chanstate's lock.
 1.14 11-Mar-2007  tsutsui branches: 1.14.16; 1.14.18; 1.14.22; 1.14.24;
Print correct softipl number.
 1.13 05-Oct-2006  tsutsui branches: 1.13.4; 1.13.8;
Remove incorrect comment.
 1.12 28-Mar-2006  thorpej branches: 1.12.8; 1.12.10;
Use device_is_a().
 1.11 11-Dec-2005  christos branches: 1.11.4; 1.11.6; 1.11.8; 1.11.10; 1.11.12;
merge ktrace-lwp.
 1.10 22-Jan-2005  chs branches: 1.10.8;
de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.9 13-Feb-2004  wiz branches: 1.9.8;
Uppercase CPU, plural is CPUs.
 1.8 15-Jul-2003  lukem __KERNEL_RCSID()
 1.7 28-Jan-2003  pk branches: 1.7.2;
Provide locking required by the interrupt handlers running at IPL_SERIAL.
 1.6 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.5 13-Dec-2002  fredette bcopy -> memcpy, bzero -> memset
 1.4 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.3 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.2 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.1 22-Mar-2002  fredette branches: 1.1.4; 1.1.6; 1.1.10;
Added support for the sun2 zs serial ports. As this driver
is very common on Suns, it could be made shared under sys/dev/sun.
 1.1.10.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.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 22-Mar-2002  jdolecek file zs.c was added on branch kqueue on 2002-06-23 17:42:30 +0000
 1.1.6.1 19-May-2002  gehenna Remove hard-coded major.
 1.1.4.6 03-Jan-2003  thorpej Sync with HEAD.
 1.1.4.5 19-Dec-2002  thorpej Sync with HEAD.
 1.1.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.1.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.1 22-Mar-2002  nathanw file zs.c was added on branch nathanw_sa on 2002-04-01 07:43:18 +0000
 1.7.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.8.5 07-Dec-2007  yamt sync with head
 1.10.8.4 15-Nov-2007  yamt sync with head.
 1.10.8.3 03-Sep-2007  yamt sync with head.
 1.10.8.2 30-Dec-2006  yamt sync with head.
 1.10.8.1 21-Jun-2006  yamt sync with head.
 1.11.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.11.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.11.8.1 01-Apr-2006  yamt sync with head.
 1.11.6.1 22-Apr-2006  simonb Sync with head.
 1.11.4.1 09-Sep-2006  rpaulo sync with head
 1.12.10.1 06-Oct-2006  tsutsui Sync files of recent sun3 and sun68k merge and intersil7170(4) changes
with HEAD to build sun3 kernel on this branch.
 1.12.8.1 18-Nov-2006  ad Sync with head.
 1.13.8.2 03-Dec-2007  ad Sync with HEAD.
 1.13.8.1 13-Mar-2007  ad Sync with head.
 1.13.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.14.24.2 08-Dec-2007  mjf Sync with HEAD.
 1.14.24.1 19-Nov-2007  mjf Sync with HEAD.
 1.14.22.1 13-Nov-2007  bouyer Sync with HEAD
 1.14.18.1 09-Jan-2008  matt sync with HEAD
 1.14.16.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.14.16.1 11-Nov-2007  joerg Sync with HEAD.
 1.15.2.1 08-Dec-2007  ad Sync with head.
 1.16.12.3 29-Jun-2008  mjf Sync with HEAD.
 1.16.12.2 02-Jun-2008  mjf Sync with HEAD.
 1.16.12.1 03-Apr-2008  mjf Sync with HEAD.
 1.17.4.2 04-May-2009  yamt sync with head.
 1.17.4.1 16-May-2008  yamt sync with head.
 1.17.2.2 17-Jun-2008  yamt sync with head.
 1.17.2.1 18-May-2008  yamt sync with head.
 1.18.4.1 18-Jun-2008  simonb Sync with head.
 1.18.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.20.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.20.2.1 30-Oct-2012  yamt sync with head
 1.21.52.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.22.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.18 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.17 29-Mar-2008  tsutsui branches: 1.17.2; 1.17.4;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.16 03-Oct-2006  tsutsui branches: 1.16.52;
- change find_prom_map() to take paddr_t and return vaddr_t rather than
bus_space_handle_t since bus space handle without bus space tag looks weird
- replace old sun3 obio_find_mapping() with new common find_prom_map()
- add bus_space_vaddr(), from hp300
 1.15 01-Oct-2006  tsutsui First attempt at bus_space(9) support for sun3 with common sun68k/bus.c:
- make sun3 port use common sun68k files as much as possible
- add temporary options _SUN2_ in std.sun2 until sun3 can share all
sun68k files (autoconf.c and isr.c are not yet)
- move sun68kvme declaration temporary as well from files.sun68k to files.sun2
- rename and move sun68k_find_prom_map() function to MD sources since it
can't be shared with sun3
- add bus tag members to struct confargs and initilize them where appropriate

XXX1: MD bus_dma(9) backends are not implemented (yet).
XXX2: more code (obio etc.) should be shared among sun3, sun3x and sun2.
 1.14 28-Mar-2006  thorpej branches: 1.14.8; 1.14.10;
Use device_unit().
 1.13 11-Dec-2005  christos branches: 1.13.4; 1.13.6; 1.13.8; 1.13.10; 1.13.12;
merge ktrace-lwp.
 1.12 19-Jun-2005  thorpej branches: 1.12.2;
Move common Sun ID PROM definitions into <dev/sun/idprom.h>.
 1.11 22-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.10 15-Jul-2003  lukem branches: 1.10.8;
__KERNEL_RCSID()
 1.9 02-Oct-2002  thorpej branches: 1.9.6;
Add trailing ; to CFATTACH_DECL.
 1.8 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 27-Jul-2002  fredette Fixed kgdb support by including <sun2/dev/cons.h>.
 1.5 26-Nov-2001  fredette branches: 1.5.8;
Only declare the console keyboard on zs if it's a Sun-2
or later keyboard.
 1.4 27-Jun-2001  fredette branches: 1.4.2; 1.4.8;
Converted to use the new bus-specific attach args.
Added the zs_console_flags function, used to tell
MI code what zs is tied up in the console.
 1.3 14-Jun-2001  fredette Now use the bus_space_peek_N function to probe for
the device, and common sun68k_find_prom_map function to
find a PROM mapping for a device.
 1.2 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.1 06-Apr-2001  fredette branches: 1.1.2;
Added.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 06-Apr-2001  bouyer file zs_any.c was added on branch thorpej_scsipi on 2001-04-21 17:54:47 +0000
 1.4.8.4 18-Oct-2002  nathanw Catch up to -current.
 1.4.8.3 01-Aug-2002  nathanw Catch up to -current.
 1.4.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.4.8.1 27-Jun-2001  nathanw file zs_any.c was added on branch nathanw_sa on 2002-01-08 00:28:08 +0000
 1.4.2.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.4.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.8.1 31-Aug-2002  gehenna catch up with -current.
 1.9.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.9.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.6.1 03-Aug-2004  skrll Sync with HEAD
 1.10.8.1 29-Apr-2005  kent sync with -current
 1.12.2.2 30-Dec-2006  yamt sync with head.
 1.12.2.1 21-Jun-2006  yamt sync with head.
 1.13.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.13.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.13.8.1 01-Apr-2006  yamt sync with head.
 1.13.6.1 22-Apr-2006  simonb Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.14.10.1 06-Oct-2006  tsutsui Sync files of recent sun3 and sun68k merge and intersil7170(4) changes
with HEAD to build sun3 kernel on this branch.
 1.14.8.1 18-Nov-2006  ad Sync with head.
 1.16.52.2 02-Jun-2008  mjf Sync with HEAD.
 1.16.52.1 03-Apr-2008  mjf Sync with HEAD.
 1.17.4.1 16-May-2008  yamt sync with head.
 1.17.2.1 18-May-2008  yamt sync with head.
 1.11 24-Oct-2023  andvar apply similar changes between different archs/machines for zs_kgdb.c:
1) adjust zs_kgdb_init tty attachment message for kgdb_dev type change.
(one arch uses cast to int instead, but kept one approach for consistency)
2) remove unused rr0 declaration and assignment in zs_kgdb_txint()
3) adjust kgdb_dev format specifier to %llx/d if needed.
4) add const for zs_kgdb_devname declaration (macppc only).
should fix zs_kgdb.c build for all these ports.
 1.10 28-Apr-2008  martin branches: 1.10.68; 1.10.78;
Remove clause 3 and 4 from TNF licenses
 1.9 17-Oct-2007  garbled branches: 1.9.16; 1.9.18; 1.9.20;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.8 23-Jun-2007  hauke branches: 1.8.10;
Fix a warning from gcc 4 about stripping the volatile qualifier by a cast
by doing the proper __UNVOLATILE() dance.
 1.7 04-Mar-2007  christos branches: 1.7.2; 1.7.4; 1.7.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6 11-Dec-2005  christos branches: 1.6.26;
merge ktrace-lwp.
 1.5 22-Jan-2005  chs branches: 1.5.8;
de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.4 15-Jul-2003  lukem branches: 1.4.8;
__KERNEL_RCSID()
 1.3 13-Dec-2002  fredette branches: 1.3.6;
bcopy -> memcpy, bzero -> memset
 1.2 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.1 22-Mar-2002  fredette branches: 1.1.4; 1.1.6; 1.1.10;
Added support for the sun2 zs serial ports. As this driver
is very common on Suns, it could be made shared under sys/dev/sun.
 1.1.10.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.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 22-Mar-2002  jdolecek file zs_kgdb.c was added on branch kqueue on 2002-06-23 17:42:30 +0000
 1.1.6.1 19-May-2002  gehenna Replace the access to devsw table and the hard-coded majors with devsw API.
 1.1.4.4 19-Dec-2002  thorpej Sync with HEAD.
 1.1.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.1.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.1 22-Mar-2002  nathanw file zs_kgdb.c was added on branch nathanw_sa on 2002-04-01 07:43:18 +0000
 1.3.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.3.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.6.1 03-Aug-2004  skrll Sync with HEAD
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.5.8.1 03-Sep-2007  yamt sync with head.
 1.6.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.7.10.1 26-Jun-2007  garbled Sync with HEAD.
 1.7.4.1 11-Jul-2007  mjf Sync with head.
 1.7.2.1 15-Jul-2007  ad Sync with head.
 1.8.10.1 06-Nov-2007  matt sync with HEAD
 1.9.20.1 16-May-2008  yamt sync with head.
 1.9.18.1 18-May-2008  yamt sync with head.
 1.9.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.78.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.10.68.1 20-Jul-2016  pgoyette Adapt the machine/arch dependent code to the new {b,c}devsw reference
counting.

XXX Most of these will require testing by someone other than myself, as
I have a limited selection of hardware!
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 22-Mar-2002  fredette branches: 1.1.4; 1.1.10; 1.1.118; 1.1.120; 1.1.122;
Added support for the sun2 zs serial ports. As this driver
is very common on Suns, it could be made shared under sys/dev/sun.
 1.1.122.1 16-May-2008  yamt sync with head.
 1.1.120.1 18-May-2008  yamt sync with head.
 1.1.118.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 22-Mar-2002  jdolecek file zsreg.h was added on branch kqueue on 2002-06-23 17:42:30 +0000
 1.1.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.1 22-Mar-2002  nathanw file zsreg.h was added on branch nathanw_sa on 2002-04-01 07:43:18 +0000
 1.9 13-Mar-2020  rin Fix build without kbd at zstty, simplify.
 1.8 07-Jul-2016  msaitoh branches: 1.8.18;
KNF. Remove extra spaces. No functional change.
 1.7 29-Mar-2008  tsutsui branches: 1.7.48; 1.7.68;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.6 11-Mar-2007  tsutsui branches: 1.6.38;
Fix a comment.
 1.5 11-Dec-2005  christos branches: 1.5.26; 1.5.30;
merge ktrace-lwp.
 1.4 22-Jan-2005  chs branches: 1.4.8;
de-__P, remove register, ansify, b* -> mem*, u_int*_t -> uint*_t.
 1.3 07-Aug-2003  agc branches: 1.3.8;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 03-May-2003  wiz branches: 1.2.2;
DMA, not dma nor Dma.
 1.1 22-Mar-2002  fredette branches: 1.1.4; 1.1.10;
Added support for the sun2 zs serial ports. As this driver
is very common on Suns, it could be made shared under sys/dev/sun.
 1.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 22-Mar-2002  jdolecek file zsvar.h was added on branch kqueue on 2002-06-23 17:42:31 +0000
 1.1.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.1 22-Mar-2002  nathanw file zsvar.h was added on branch nathanw_sa on 2002-04-01 07:43:18 +0000
 1.2.2.4 24-Jan-2005  skrll Sync with HEAD.
 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.3.8.1 29-Apr-2005  kent sync with -current
 1.4.8.1 03-Sep-2007  yamt sync with head.
 1.5.30.1 13-Mar-2007  ad Sync with head.
 1.5.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.6.38.1 03-Apr-2008  mjf Sync with HEAD.
 1.7.68.1 09-Jul-2016  skrll Sync with HEAD
 1.7.48.1 03-Dec-2017  jdolecek update from HEAD
 1.8.18.1 08-Apr-2020  martin Merge changes from current as of 20200406

RSS XML Feed