Home | History | Annotate | only in /src/sys/dev/sbus
History log of /src/sys/dev/sbus
RevisionDateAuthorComments
 1.5 29-Oct-2021  macallan install mgxreg.h so we can use it from Xorg
 1.4 11-Apr-2001  jdolecek Put back all header files defining ioctls
 1.3 11-Apr-2001  jdolecek Only install headers which are actually used by our userland. This
saves about 2.2MB under /usr/include/dev/. Discussed on tech-kern@
recently.

I HOPE to get the list right. The headers I left in are ones
used for MI tools and those whose usage I discovered by grep over tree sources.
Feel free to put needed includes back in if you encounter anything which
should not be removed from lists.
 1.2 28-Jul-1998  augustss branches: 1.2.14; 1.2.26;
Add missing .include <bsd.kinc.mk>
 1.1 28-Jul-1998  pk One header to install.
 1.2.26.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.14.1 21-Apr-2001  bouyer Sync with HEAD
 1.34 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.33 24-Apr-2021  thorpej branches: 1.33.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.32 19-Oct-2013  mrg branches: 1.32.46;
- remove set but unused variable.
- put variables only inside #ifdef inside that same #ifdef.
use __USE() where appropriate.
 1.31 30-Jul-2013  macallan avoid uninitialized use of defattr
 1.30 23-Oct-2012  macallan branches: 1.30.2;
support anti-aliased fonts
 1.29 20-Oct-2012  macallan - only sync the drawing engine when we're about to access video memory
- use the blitter to draw the cursor
- use the glyphcache to minimize vram access
-> about 15% to 20% speedup
 1.28 11-Jan-2012  macallan branches: 1.28.6;
use rasops_init(0, 0)
 1.27 15-Nov-2010  uebayasi branches: 1.27.8; 1.27.12;
This doesn't use uvm(9) API.
 1.26 14-Nov-2010  uebayasi Include uvm/uvm_extern.h to access uvmexp. gtmpsc.c doesn't need
uvm(9) API at all.
 1.25 13-Nov-2010  uebayasi 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.24 29-Jan-2010  macallan branches: 1.24.4;
avoid using PAGE_SIZE directly so sparc/GENERIC builds again
 1.23 27-Jan-2010  macallan round the space we bus_space_map() up to PAGE_SIZE alignment
 1.22 17-Sep-2009  tsutsui Include "ioconf.h" instead of extern struct cfdriver foo_cd decls.
 1.21 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.20 20-Aug-2009  macallan call vcons_replay_msgbuf() if we're the console
 1.19 26-May-2009  macallan use BUS_SPACE_MAP_LARGE
 1.18 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.17 16-Apr-2009  macallan use sparc_bus_map_large() to map the I128 framebuffer
 1.16 12-Dec-2008  macallan branches: 1.16.2;
fix stride value returned by /dev/fb
 1.15 12-Jun-2008  cegger branches: 1.15.4;
use device_lookup_private to get softc
 1.14 17-May-2008  macallan branches: 1.14.2;
unbork previous by actually using CFATTACH_DECL_NEW(). Doh.
 1.13 17-May-2008  macallan magic number reduction - no functional change
 1.12 17-May-2008  macallan don't map more video memory than we really need
 1.11 16-May-2008  macallan struct device * -> device_t
 1.10 29-Apr-2008  martin branches: 1.10.2;
Convert to new 2 clause license
 1.9 05-Apr-2008  cegger branches: 1.9.2; 1.9.4;
use aprint_*_dev and device_xname
 1.8 19-Oct-2007  ad branches: 1.8.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.7 11-Sep-2007  macallan branches: 1.7.4; 1.7.6;
clean up a little bit, while there let userland mmap the whole glint video
memory.
Note: this needs changes in the XF86 driver committed a few minutes ago.
 1.6 01-Sep-2007  macallan branches: 1.6.2; 1.6.4; 1.6.6;
add screen blanking support
 1.5 30-Aug-2007  macallan attach a /dev/fb* so X can talk to the board
 1.4 28-Aug-2007  macallan add hardware cursor support
 1.3 27-Aug-2007  macallan branches: 1.3.2;
let userland mmap() the GLint framebuffer and make it visible when switching
to WSDISPLAYIO_MODE_MAPPED - so X with wsfb can run in 24bit colour
 1.2 26-Aug-2007  macallan cleanup, fix some typos
 1.1 26-Aug-2007  macallan add a driver for Fujitsu AG-10e graphics boards
Features so far:
- use the blitter for scrolling and solid fills
- the usual wscons stuff, virtual consoles etc.
Things missing:
- /dev/fb* support
- XFree86 support although wsfb in 8bit should work
- hardware cursor support for X
- character drawing in hardware so we can run the blitter completely
asynchronous
 1.3.2.1 06-Nov-2007  matt sync with HEAD
 1.6.6.4 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.6.6.3 02-Oct-2007  joerg Sync with HEAD.
 1.6.6.2 03-Sep-2007  jmcneill Sync with HEAD.
 1.6.6.1 01-Sep-2007  jmcneill file agten.c was added on branch jmcneill-pm on 2007-09-03 16:48:37 +0000
 1.6.4.3 27-Oct-2007  yamt sync with head.
 1.6.4.2 03-Sep-2007  yamt sync with head.
 1.6.4.1 01-Sep-2007  yamt file agten.c was added on branch yamt-lazymbuf on 2007-09-03 14:38:26 +0000
 1.6.2.2 03-Sep-2007  skrll Sync with HEAD.
 1.6.2.1 01-Sep-2007  skrll file agten.c was added on branch nick-csl-alignment on 2007-09-03 10:21:58 +0000
 1.7.6.1 25-Oct-2007  bouyer Sync with HEAD.
 1.7.4.3 23-Oct-2007  ad Sync with head.
 1.7.4.2 09-Oct-2007  ad Sync with head.
 1.7.4.1 11-Sep-2007  ad file agten.c was added on branch vmlocking on 2007-10-09 13:42:03 +0000
 1.8.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.8.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.8.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.4.6 11-Mar-2010  yamt sync with head
 1.9.4.5 16-Sep-2009  yamt sync with head
 1.9.4.4 20-Jun-2009  yamt sync with head
 1.9.4.3 16-May-2009  yamt sync with head
 1.9.4.2 04-May-2009  yamt sync with head.
 1.9.4.1 16-May-2008  yamt sync with head.
 1.9.2.2 17-Jun-2008  yamt sync with head.
 1.9.2.1 18-May-2008  yamt sync with head.
 1.10.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.14.2.1 18-Jun-2008  simonb Sync with head.
 1.15.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.15.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.16.2.2 23-Jul-2009  jym Sync with HEAD.
 1.16.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.24.4.1 05-Mar-2011  rmind sync with head
 1.27.12.1 18-Feb-2012  mrg merge to -current.
 1.27.8.3 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.27.8.2 30-Oct-2012  yamt sync with head
 1.27.8.1 17-Apr-2012  yamt sync with head
 1.28.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.30.2.2 18-May-2014  rmind sync with head
 1.30.2.1 28-Aug-2013  rmind sync with head
 1.32.46.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.33.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.99 15-Oct-2025  thorpej These drivers can use ether_getaddr() instead of prom_getether() now.
 1.98 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.97 02-Sep-2022  thorpej Remove unnecessary inclusion of <net/netisr.h>.
 1.96 19-Mar-2020  thorpej Don't bother with IFF_OACTIVE. Just keep processing so long as
sc->sc_rb.rb_td_nbusy is less than sc->sc_rb.rb_ntbuf.
 1.95 29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.94 29-May-2019  msaitoh branches: 1.94.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.93 28-May-2019  msaitoh Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.92 26-Apr-2019  msaitoh No functional change:
- u_int_{8,16,32}_t -> uint_{8,16,32}_t
- KNF.
- Tabify.
- Remove extra space.
 1.91 05-Feb-2019  msaitoh Remove very old IFF_NOTRAILERS flag.
 1.90 22-Jan-2019  msaitoh Change MII PHY read/write API from:

int (*mii_readreg_t)(device_t, int, int);
void (*mii_writereg_t)(device_t, int, int, int);
to:

int (*mii_readreg_t)(device_t, int, int, uint16_t *);
int (*mii_writereg_t)(device_t, int, int, uint16_t);

Now we can test if a read/write operation failed or not by the return value.

In 802.3 spec says that the PHY shall not respond to read/write transaction
to the unimplemented register(22.2.4.3). Detecting timeout can be used to
check whether a register is implemented or not (if the register conforms to
the spec). ukphy(4) can be used this for MII_MMDACR and MII_MMDAADR.

Note that I noticed that the following code do infinite loop in the
read/wirte function. If it accesses unimplemented PHY register, it will hang.
It should be fixed:

arm/at91/at91emac.c
arm/ep93xx/epe.c
arm/omap/omapl1x_emac.c
mips/ralink/ralink_eth.c
arch/powerpc/booke/dev/pq3etsec.c(read)
dev/cadence/if_cemac.c <- hkenken
dev/ic/lan9118.c


Tested with the following device:

axe+ukphy
axe+rgephy
axen+rgephy (tested by Andrius V)
wm+atphy
wm+ukphy
wm+igphy
wm+ihphy
wm+makphy
sk+makphy
sk+brgphy
sk+gentbi
msk+makphy
sip+icsphy
sip+ukphy
re+rgephy
bge+brgphy
bnx+brgphy
gsip+gphyter
rtk+rlphy
fxp+inphy (tested by Andrius V)
tlp+acphy
ex+exphy
epic+qsphy
vge+ciphy (tested by Andrius V)
vr+ukphy (tested by Andrius V)
vte+ukphy (tested by Andrius V)

Not tested (MAC):
arm:at91emac
arm:cemac
arm:epe
arm:geminigmac
arm:enet
arm:cpsw
arm:emac(omac)
arm:emac(sunxi)
arm:npe
evbppc:temac
macppc:bm
macppc:gm
mips:aumac
mips:ae
mips:cnmac
mips:reth
mips:sbmac
playstation2:smap
powerpc:tsec
powerpc:emac(ibm4xx)
sgimips:mec
sparc:be
sf
ne(ax88190, dl10019)
awge
ep
gem
hme
smsh
mtd
sm
age
alc
ale
bce
cas
et
jme
lii
nfe
pcn
ste
stge
tl
xi
aue
mue
smsc
udav
url

Not tested (PHY):
amhphy
bmtphy
dmphy
etphy
glxtphy
ikphy
iophy
lxtphy
nsphyter
pnaphy
rdcphy
sqphy
tlphy
tqphy
urlphy
 1.89 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.88 26-Jun-2018  msaitoh branches: 1.88.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.87 22-Jun-2018  msaitoh It's not required to include net/bpfdesc.h. Remove it.
 1.86 25-Jun-2017  maxv branches: 1.86.4;
spl leak, found by Mootja a long time ago
 1.85 15-Dec-2016  ozaki-r branches: 1.85.8;
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.84 02-Oct-2016  christos MFREE -> m_free
 1.83 10-Jun-2016  ozaki-r branches: 1.83.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.82 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.81 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.80 09-Jun-2013  msaitoh branches: 1.80.8; 1.80.10;
Don't "return" but "break" in MII_TICK when the interface isn't doing
autonegotiaton or the link is up to update the status.
 1.79 22-Jul-2012  matt branches: 1.79.2;
Fix mii_statchg to take a 'struct ifnet *' instead of device_t. This fixes
problem with a common MDIO bus used for multiple interfaces.
Some drivers converted to CFATTACL_DECL_NEW.
 1.78 02-Feb-2012  tls branches: 1.78.2;
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.77 05-Apr-2010  joerg branches: 1.77.8; 1.77.12;
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.76 19-Jan-2010  pooka branches: 1.76.2; 1.76.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.75 22-Sep-2009  tsutsui Remove some more unnecessary casts.
 1.74 18-Sep-2009  tsutsui Use the common ether_crc32_le() function for multicast hash.
 1.73 18-Sep-2009  tsutsui Misc KNF.
 1.72 18-Sep-2009  tsutsui Make local functions static.
 1.71 18-Sep-2009  tsutsui Use uint8_t pointers for TX/RX buffers to avoid extra pointer casts.
 1.70 18-Sep-2009  tsutsui Adjust attach messages.
 1.69 18-Sep-2009  tsutsui Split device_t/softc.
 1.68 18-Sep-2009  tsutsui Make be(4) is properly initialized at the first ifconfig(8) command:
- make beinit() and bestop() match struct ifnet
- if ether_ioctl() returns ENETRESET always call init function
 1.67 18-Sep-2009  tsutsui - use device_private(), proper types and variables for device_t/softc
- remove unnecessary casts against void pointer

XXX: many inconsistent use of aprint_*(9) and printf(9)
 1.66 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.65 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.64 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.63 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.62 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.61 26-Dec-2008  macallan branches: 1.61.2;
move callout_init(sc->sc_tick_ch) before we're trying to callout_stop()
the ticker.
 1.60 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.59 04-May-2008  xtraeme branches: 1.59.6; 1.59.8; 1.59.10;
mii_dev is a device_t now.
 1.58 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.57 05-Apr-2008  cegger branches: 1.57.2; 1.57.4;
use aprint_*_dev and device_xname
 1.56 19-Jan-2008  dyoung branches: 1.56.6;
Make many ethernet drivers share the common code for MII media
handling, ether_mediastatus() and ether_mediachange(). Check for
a non-ENXIO error return from mii_mediachg(). (ENXIO indicates
that a PHY is suspended.)

This patch shrinks the source code size by 979 lines. There was
a 5100-byte savings on the NetBSD/i386 kernel configuration, ALL.

I have made a few miscellaneous changes, too:

gem(4): use LIST_EMPTY(), LIST_FOREACH().
mtd(4): handle media ioctls, for a change!
axe(4): do not track link status in sc->axe_link any longer
nfe(4), aue(4), axe(4), udav(4), url(4): do not reset all PHYs
on a change of media

Except for the change to mtd(4), no functional changes are intended.

XXX This patch affects more architectures than I can feasibly
XXX compile and run. I have compiled macppc, sparc64, i386. I
XXX have run the patches on i386 boxen with bnx(4) and sip(4).
XXX Compiling and running on evbmips (MERAKI, ADM5120) is in
XXX progress.
 1.55 19-Oct-2007  ad branches: 1.55.2; 1.55.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.54 01-Sep-2007  dyoung branches: 1.54.4;
Change a bazillion occurrences of code resembling this,

error = (cmd == SIOCADDMULTI) ?
ether_addmulti(ifr, &sc->sc_ec) :
ether_delmulti(ifr, &sc->sc_ec);

if (error == ENETRESET) {

to this,

if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {

which does the same thing.

(A bazillion is a very large number. This seems to make the i386
ALL kernel smaller by 3kB to 4kB.)

Use ifreq_getaddr() twice in es(4).

Whitespace nits.
 1.53 09-Jul-2007  ad branches: 1.53.2; 1.53.6; 1.53.8;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.52 04-Mar-2007  christos branches: 1.52.2; 1.52.4;
fix fallout from caddr_t changes.
 1.51 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.50 24-Nov-2006  christos branches: 1.50.4;
fix spelling of accommodate; from Zapher.
 1.49 07-Sep-2006  dogcow branches: 1.49.2; 1.49.4;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.48 24-Dec-2005  perry branches: 1.48.4; 1.48.8;
__inline__ -> inline
 1.47 11-Dec-2005  christos merge ktrace-lwp.
 1.46 05-Nov-2005  bouyer ETHERCAP_VLAN_MTU is a flag for ec_capabilities, the size of the 802.1q
encaptulation header is ETHER_VLAN_ENCAP_LEN. Pointed out by der Mouse on
tech-kern.
 1.45 04-Feb-2005  perry branches: 1.45.4; 1.45.6;
de-__P
 1.44 30-Oct-2004  thorpej branches: 1.44.4; 1.44.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.43 04-May-2004  pk Fix incorrect diagnostic.
 1.42 17-Mar-2004  pk branches: 1.42.2;
Rename PROM_getprop*() => prom_getprop*().
 1.41 15-Mar-2004  pk Replace myetheraddr() by prom_getether().
 1.40 16-Oct-2003  pk Enable VLAN encapsulation.
 1.39 03-May-2003  wiz branches: 1.39.2;
DMA, not dma nor Dma.
 1.38 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.37 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.36 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.35 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.34 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.33 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.32 22-May-2002  wiz bcmp -> memcmp.
 1.31 20-Mar-2002  eeh branches: 1.31.4; 1.31.6;
Get rid of unnecessary BUS_SPACE_MAP_LINEAR.
 1.30 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.29 13-Nov-2001  lukem add RCSIDs
 1.28 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.27 12-Sep-2001  eeh Properly initialize sc->sc_bustag.
 1.26 20-Mar-2001  pk branches: 1.26.2; 1.26.4;
Fix fall-out from previous change: the map's DMA address is valid only
after bus_dmamap_load().
 1.25 08-Mar-2001  thorpej Use bus_dmamap_load(), not bus_dmamap_load_raw().
 1.24 14-Jan-2001  thorpej branches: 1.24.2;
Use splnet() to block network interrupts, not splimp().
 1.23 14-Dec-2000  thorpej ALTQ'ify.
 1.22 15-Nov-2000  thorpej Move bpfattach()/bpfdetach() calls into ether_ifattach()/ether_ifdetach().
 1.21 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.20 10-May-2000  pk branches: 1.20.4;
No need to specify page alignment; this is automatic.
 1.19 10-May-2000  pk Fix bogus `boundary' argument in bus_dmamap_create().
 1.18 09-May-2000  pk Conform bus_dmamem_{alloc,map} usage to bus_dma(9) specs.
 1.17 23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.16 14-Feb-2000  pk Make promiscuous mode go again.
 1.15 02-Feb-2000  thorpej Don't dry to diving MIIF_NOISOLATE in the PHY drivers. Instead, pass
flags down from the parent to child vi mii_attach().
 1.14 02-Feb-2000  thorpej Bring some order to the chaos which was the MII code function naming
"conventions".
 1.13 23-Dec-1999  pk * remove full duplex modes for the internal transceiver
* internal transceiver needs to be reset for the BMSR_LINK bit to
be even remotely reliable
* because of previous, maintain link state, so we won't be sensing speed
all the time when interface flags need to be changed (e.g. entering/exiting
promiscuous mode)
* in auto-speed mode, report link condition changes on the console
 1.12 22-Dec-1999  pk Streamline media code a bit by some `pseudo-mii' code designed to handle
the on-board transceiver.
 1.11 21-Dec-1999  pk Shuffle some code around to allow two PHYs to attach. Only one PHY can
be used at a time, but it's now possible to select one by using ifconfig(8)'s
`instance' parameter.
 1.10 20-Dec-1999  pk * Remove spurious blockade in the path to get the transceiver status word.
* Make sure to flip the 10baseT/100baseTX bit when doing autoselect.
* Miscellaneous cosmetics.
 1.9 21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.8 12-Nov-1999  thorpej Call mii_down() as appropriate.
 1.7 04-Nov-1999  thorpej Adapt to mii_phy_probe() change.
 1.6 18-May-1999  thorpej branches: 1.6.2; 1.6.4; 1.6.8;
Rework layer 2 protocol input routines. Instead of calling e.g. ether_input()
directly, call the function pointer (*if_input)(ifp, m). The input routine
expects the packet header to be at the head of the packet, and will adjust
as necessary. Privatize the layer 2 input and output routines, allowing
*_ifattach() to set them up as appropriate.
 1.5 23-Mar-1999  pk branches: 1.5.4;
Fix promiscuous modes - patches from Jason Wright.
 1.4 19-Feb-1999  pk Don't try to use the MII routines for the internal PHY.
 1.3 18-Jan-1999  pk Fix AF_NS code.
 1.2 17-Jan-1999  pk Share ring buffer code and data structure for `be' and `qe' in
the QEC module. Adapt the QEC interrupt establish code to suit the
needs of the `qe' device.
 1.1 16-Jan-1999  pk Import Jason Wright's Bigmac driver, written for OpenBSD.
Heavily pounded on by me to make it fit our driver model.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.4.1 15-Nov-1999  fvdl Sync with -current
 1.6.2.6 27-Mar-2001  bouyer Sync with HEAD.
 1.6.2.5 12-Mar-2001  bouyer Sync with HEAD.
 1.6.2.4 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.6.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.6.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.6.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.20.4.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.24.2.9 11-Dec-2002  thorpej Sync with HEAD.
 1.24.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.24.2.7 27-Aug-2002  nathanw Catch up to -current.
 1.24.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.24.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.24.2.4 14-Nov-2001  nathanw Catch up to -current.
 1.24.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.24.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.24.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.26.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.26.2.6 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.26.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.26.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.26.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.26.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.26.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.31.6.1 22-Nov-2002  tron Pull up revision 1.33 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.31.4.2 29-Aug-2002  gehenna catch up with -current.
 1.31.4.1 30-May-2002  gehenna Catch up with -current.
 1.39.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.39.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.39.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.39.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.39.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.39.2.1 03-Aug-2004  skrll Sync with HEAD
 1.42.2.1 10-Jul-2004  tron branches: 1.42.2.1.2;
Pull up revision 1.43 (requested by martin in ticket #628):
Fix incorrect diagnostic.
 1.42.2.1.2.2 06-Nov-2005  riz Pull up following revision(s) (requested by bouyer in ticket #5968):
sys/dev/sbus/be.c: revision 1.46
ETHERCAP_VLAN_MTU is a flag for ec_capabilities, the size of the 802.1q
encaptulation header is ETHER_VLAN_ENCAP_LEN. Pointed out by der Mouse on
tech-kern.
 1.42.2.1.2.1 24-Jan-2005  he Pull up revision 1.44 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
 1.44.6.1 12-Feb-2005  yamt sync with head.
 1.44.4.1 29-Apr-2005  kent sync with -current
 1.45.6.5 21-Jan-2008  yamt sync with head
 1.45.6.4 27-Oct-2007  yamt sync with head.
 1.45.6.3 03-Sep-2007  yamt sync with head.
 1.45.6.2 30-Dec-2006  yamt sync with head.
 1.45.6.1 21-Jun-2006  yamt sync with head.
 1.45.4.1 06-Nov-2005  tron Pull up following revision(s) (requested by bouyer in ticket #933):
sys/dev/sbus/be.c: revision 1.46
ETHERCAP_VLAN_MTU is a flag for ec_capabilities, the size of the 802.1q
encaptulation header is ETHER_VLAN_ENCAP_LEN. Pointed out by der Mouse on
tech-kern.
 1.48.8.1 14-Sep-2006  yamt sync with head.
 1.48.4.1 09-Sep-2006  rpaulo sync with head
 1.49.4.1 10-Dec-2006  yamt sync with head.
 1.49.2.1 12-Jan-2007  ad Sync with head.
 1.50.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.52.4.1 11-Jul-2007  mjf Sync with head.
 1.52.2.3 23-Oct-2007  ad Sync with head.
 1.52.2.2 09-Oct-2007  ad Sync with head.
 1.52.2.1 01-Jul-2007  ad Adapt to callout API change.
 1.53.8.2 23-Mar-2008  matt sync with HEAD
 1.53.8.1 06-Nov-2007  matt sync with HEAD
 1.53.6.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.53.6.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.53.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.54.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.55.8.1 20-Jan-2008  bouyer Sync with HEAD
 1.55.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.56.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.56.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.57.4.5 11-Aug-2010  yamt sync with head.
 1.57.4.4 11-Mar-2010  yamt sync with head
 1.57.4.3 16-May-2009  yamt sync with head
 1.57.4.2 04-May-2009  yamt sync with head.
 1.57.4.1 16-May-2008  yamt sync with head.
 1.57.2.1 18-May-2008  yamt sync with head.
 1.59.10.1 08-Jan-2009  snj Pull up following revision(s) (requested by macallan in ticket #215):
sys/dev/sbus/be.c: revision 1.61
move callout_init(sc->sc_tick_ch) before we're trying to
callout_stop() the ticker.
 1.59.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.59.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.59.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.61.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.76.4.1 30-May-2010  rmind sync with head
 1.76.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.77.12.1 18-Feb-2012  mrg merge to -current.
 1.77.8.3 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.77.8.2 30-Oct-2012  yamt sync with head
 1.77.8.1 17-Apr-2012  yamt sync with head
 1.78.2.1 13-Mar-2018  snj Pull up following revision(s) (requested by msaitoh in ticket #1533):
sys/dev/sbus/be.c: 1.86
spl leak, found by Mootja a long time ago
 1.79.2.2 03-Dec-2017  jdolecek update from HEAD
 1.79.2.1 23-Jun-2013  tls resync from head
 1.80.10.6 28-Aug-2017  skrll Sync with HEAD
 1.80.10.5 05-Feb-2017  skrll Sync with HEAD
 1.80.10.4 05-Oct-2016  skrll Sync with HEAD
 1.80.10.3 09-Jul-2016  skrll Sync with HEAD
 1.80.10.2 19-Mar-2016  skrll Sync with HEAD
 1.80.10.1 06-Jun-2015  skrll Sync with HEAD
 1.80.8.1 03-Mar-2018  snj Pull up following revision(s) (requested by msaitoh in ticket #1575):
sys/dev/sbus/be.c: 1.86
spl leak, found by Mootja a long time ago
 1.83.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.83.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.85.8.2 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.85.8.1 26-Feb-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #590):
sys/dev/sbus/be.c: revision 1.86
spl leak, found by Mootja a long time ago
 1.86.4.4 26-Jan-2019  pgoyette Sync with HEAD
 1.86.4.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.86.4.2 28-Jul-2018  pgoyette Sync with HEAD
 1.86.4.1 25-Jun-2018  pgoyette Sync with HEAD
 1.88.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.88.2.1 10-Jun-2019  christos Sync with HEAD
 1.94.4.1 29-Feb-2020  ad Sync with head.
 1.10 12-Dec-2021  andvar fix various typos, mainly in comments.
 1.9 19-Sep-2009  tsutsui u_intNN_t -> uintNN_t
 1.8 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.7 11-Dec-2005  christos branches: 1.7.70; 1.7.72; 1.7.74;
merge ktrace-lwp.
 1.6 16-Oct-2003  pk Enable VLAN encapsulation.
 1.5 03-May-2003  wiz branches: 1.5.2;
DMA, not dma nor Dma.
 1.4 24-Jul-2000  mycroft Purge C++-style comments.
 1.3 20-Dec-1999  pk branches: 1.3.4;
#define the bit positions of the MIF I/O lines.
 1.2 17-Jan-1999  pk branches: 1.2.8; 1.2.14;
Share ring buffer code and data structure for `be' and `qe' in
the QEC module. Adapt the QEC interrupt establish code to suit the
needs of the `qe' device.
 1.1 16-Jan-1999  pk Initial revision
 1.2.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.4.1 26-Jul-2000  mycroft Approved by thorpej:
Do not use C++-style comments in C code.

syssrc/sys/dev/sbus/bereg.h 1.3 -> 1.4
syssrc/sys/dev/sbus/qereg.h 1.2 -> 1.3
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.74.2 11-Mar-2010  yamt sync with head
 1.7.74.1 16-May-2008  yamt sync with head.
 1.7.72.1 18-May-2008  yamt sync with head.
 1.7.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.47 26-Sep-2021  thorpej Change the kqueue filterops::f_isfd field to filterops::f_flags, and
define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd.
Field and flag name aligned with OpenBSD.

This does not constitute a functional or ABI change, as the field location
and size, and the value placed in that field, are the same as the previous
code, but we're bumping __NetBSD_Version__ so 3rd-party module source code
can adapt, as needed.

NetBSD 9.99.89
 1.46 18-Dec-2020  thorpej Use sel{record,remove}_knote().
 1.45 23-May-2020  ad branches: 1.45.2;
Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.44 10-Nov-2019  chs 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.43 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.42 25-Oct-2017  maya branches: 1.42.2; 1.42.4;
Use C99 initializer for filterops

Mostly done with spatch with touchups for indentation

@@
expression a;
identifier b,c,d;
identifier p;
@@
const struct filterops p =
- { a, b, c, d
+ {
+ .f_isfd = a,
+ .f_attach = b,
+ .f_detach = c,
+ .f_event = d,
};
 1.41 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.40 16-Mar-2014  dholland branches: 1.40.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.39 17-Sep-2009  tsutsui branches: 1.39.12; 1.39.22; 1.39.26;
Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.38 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.37 24-Apr-2008  ad branches: 1.37.2;
Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.36 21-Apr-2008  ad Don't send signals from a hardware interrupt handler. XXX This is still
dodgy, because sc->sc_asyncproc can exit and we don't find out about
that.
 1.35 13-Apr-2008  tsutsui branches: 1.35.2;
Split device_t/softc for MI ncr53c9x and some related devices,
with various cleanup.
 1.34 05-Apr-2008  cegger use aprint_*_dev and device_xname
 1.33 02-Mar-2008  nakayama Fix previous.
sc_rsel and sc_wsel are in bpp_softc, not in lsi64854_softc.
 1.32 01-Mar-2008  rmind Welcome to 4.99.55:

- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call. It will
indicate which event (POLL_IN, POLL_OUT, etc) happen. If unknown,
zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>
 1.31 05-Dec-2007  pooka branches: 1.31.8; 1.31.12;
Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.
 1.30 19-Oct-2007  ad branches: 1.30.2; 1.30.4;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.29 04-Mar-2007  christos branches: 1.29.2; 1.29.14; 1.29.16; 1.29.20;
fix fallout from caddr_t changes.
 1.28 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.27 09-Feb-2007  ad branches: 1.27.2;
Merge newlock2 to head.
 1.26 15-Oct-2006  martin Add missing initializer
 1.25 11-Dec-2005  christos branches: 1.25.20; 1.25.22;
merge ktrace-lwp.
 1.24 27-Feb-2005  perry branches: 1.24.4;
nuke trailing whitespace
 1.23 04-Feb-2005  perry de-__P
 1.22 17-Mar-2004  pk branches: 1.22.8; 1.22.10;
Rename PROM_getprop*() => prom_getprop*().
 1.21 29-Jun-2003  fvdl branches: 1.21.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.20 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.19 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.18 26-Nov-2002  christos si_ -> sel_
 1.17 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.16 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.15 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.14 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.13 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.12 20-Mar-2002  eeh branches: 1.12.4;
Get rid of unnecessary BUS_SPACE_MAP_LINEAR.
 1.11 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.10 13-Nov-2001  lukem add RCSIDs
 1.9 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.8 01-Nov-2000  eeh branches: 1.8.2; 1.8.4; 1.8.6;
Fix warning in a debug printf.
 1.7 31-Oct-2000  eeh Clean up a #define that doesn't belong. Oops. That's what I get for
working this late.
 1.6 31-Oct-2000  eeh Get the bpp driver to work properly.
 1.5 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.4 14-Jun-2000  pk branches: 1.4.2;
Eliminate a race condition reported by mouse on port-sparc.
 1.3 21-Nov-1999  pk branches: 1.3.2;
Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.2 28-Feb-1999  pk branches: 1.2.8; 1.2.14;
Fix what is probably a past-o.
 1.1 21-Sep-1998  pk LSI63854 based parallel port driver skeleton.
 1.2.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.2.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.2.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.8.6.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.8.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.8.4.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.8.4.6 02-Oct-2002  jdolecek do not need the (void *) cast for kn_hook anymore
 1.8.4.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.4.4 18-Jun-2002  jdolecek make compile (g/c unused code)
 1.8.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.8.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.4.1 12-Sep-2001  thorpej Add kqueue support (not compiled yet).
 1.8.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.8.2.6 11-Nov-2002  nathanw Catch up to -current
 1.8.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.8.2.4 17-Sep-2002  nathanw Catch up to -current.
 1.8.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.8.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.12.4.1 16-May-2002  gehenna Add the character device switch.
 1.21.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.21.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.21.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.21.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.21.2.1 03-Aug-2004  skrll Sync with HEAD
 1.22.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.22.10.1 12-Feb-2005  yamt sync with head.
 1.22.8.1 29-Apr-2005  kent sync with -current
 1.24.4.7 17-Mar-2008  yamt sync with head.
 1.24.4.6 07-Dec-2007  yamt sync with head
 1.24.4.5 27-Oct-2007  yamt sync with head.
 1.24.4.4 03-Sep-2007  yamt sync with head.
 1.24.4.3 26-Feb-2007  yamt sync with head.
 1.24.4.2 30-Dec-2006  yamt sync with head.
 1.24.4.1 21-Jun-2006  yamt sync with head.
 1.25.22.1 22-Oct-2006  yamt sync with head
 1.25.20.2 19-Jan-2007  ad Acquire proclist_mutex before sending signals.
 1.25.20.1 18-Nov-2006  ad Sync with head.
 1.27.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.29.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.29.16.3 23-Mar-2008  matt sync with HEAD
 1.29.16.2 09-Jan-2008  matt sync with HEAD
 1.29.16.1 06-Nov-2007  matt sync with HEAD
 1.29.14.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.29.14.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.29.2.1 23-Oct-2007  ad Sync with head.
 1.30.4.1 08-Dec-2007  ad Sync with head.
 1.30.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.31.12.2 02-Jun-2008  mjf Sync with HEAD.
 1.31.12.1 03-Apr-2008  mjf Sync with HEAD.
 1.31.8.1 24-Mar-2008  keiichi sync with head.
 1.35.2.1 18-May-2008  yamt sync with head.
 1.37.2.2 11-Mar-2010  yamt sync with head
 1.37.2.1 16-May-2008  yamt sync with head.
 1.39.26.1 18-May-2014  rmind sync with head
 1.39.22.2 03-Dec-2017  jdolecek update from HEAD
 1.39.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.39.12.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.40.2.1 10-Aug-2014  tls Rebase.
 1.42.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.42.4.1 10-Jun-2019  christos Sync with HEAD
 1.42.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.45.2.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 21-Sep-1998  pk branches: 1.1.144; 1.1.146; 1.1.148;
LSI63854 based parallel port driver skeleton.
 1.1.148.1 16-May-2008  yamt sync with head.
 1.1.146.1 18-May-2008  yamt sync with head.
 1.1.144.1 02-Jun-2008  mjf Sync with HEAD.
 1.30 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.29 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.28 19-Sep-2009  tsutsui Make bwtwo(4) match prior to genfb(4).
Required by bwtwo(4) on TME emulating SS2.
 1.27 18-Sep-2009  tsutsui - use device_private(), proper types and variables for device_t/softc
- remove unnecessary casts against void pointer

XXX: many inconsistent use of aprint_*(9) and printf(9)
 1.26 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.25 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.24 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.23 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.22 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.21 28-Apr-2008  martin branches: 1.21.8; 1.21.14;
Remove clause 3 and 4 from TNF licenses
 1.20 05-Apr-2008  cegger branches: 1.20.2; 1.20.4;
use aprint_*_dev and device_xname
 1.19 04-Mar-2007  christos branches: 1.19.36;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 29-Mar-2006  thorpej branches: 1.18.14;
Use device_cfdata().
 1.17 11-Dec-2005  christos branches: 1.17.4; 1.17.6; 1.17.8; 1.17.10; 1.17.12;
merge ktrace-lwp.
 1.16 03-Jun-2005  tsutsui branches: 1.16.2;
Add const.
 1.15 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.14 04-Dec-2003  keihan NetBSD.ORG -> NetBSD.org

Now all "NetBSD.ORG" are gone from src/sys.
 1.13 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.12 24-Apr-2003  martin branches: 1.12.2;
Fix attachment for sparc64 systems (missing bus_space_vaddr).
Patches submitted in PR 21188.
 1.11 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.10 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.9 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.8 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.7 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.6 11-Mar-2002  pk branches: 1.6.4;
Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.5 13-Nov-2001  lukem add RCSIDs
 1.4 05-Oct-2001  pooka add cast to u_long before cast to caddr_t make these compile on sparc64
 1.3 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.2 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.1 20-Aug-2000  pk branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Move cgsix and bwtwo Sbus attach code here from arch/sparc.
 1.1.8.2 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.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.1.6.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.6.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.7 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.6 17-Sep-2002  nathanw Catch up to -current.
 1.1.4.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.4 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.3 22-Oct-2001  nathanw Catch up to -current.
 1.1.4.2 08-Oct-2001  nathanw Catch up to -current.
 1.1.4.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.1.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 20-Aug-2000  bouyer file bwtwo_sbus.c was added on branch thorpej_scsipi on 2000-11-20 22:35:48 +0000
 1.6.4.1 16-May-2002  gehenna Remove unnecessary header.
 1.12.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16.2.2 03-Sep-2007  yamt sync with head.
 1.16.2.1 21-Jun-2006  yamt sync with head.
 1.17.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.17.10.1 19-Apr-2006  elad sync with head.
 1.17.8.1 01-Apr-2006  yamt sync with head.
 1.17.6.1 22-Apr-2006  simonb Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.18.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.4.4 11-Mar-2010  yamt sync with head
 1.20.4.3 16-May-2009  yamt sync with head
 1.20.4.2 04-May-2009  yamt sync with head.
 1.20.4.1 16-May-2008  yamt sync with head.
 1.20.2.1 18-May-2008  yamt sync with head.
 1.21.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.21.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.32 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.31 09-Mar-2022  macallan turns out we can map the full amount of VRAM on a 4MB board even when in
double buffer mode

thanks foo bar
 1.30 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.29 26-May-2009  macallan use BUS_SPACE_MAP_LARGE
 1.28 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.27 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.26 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.25 12-Dec-2008  macallan branches: 1.25.2;
device_t-ify
 1.24 28-Apr-2008  martin branches: 1.24.8;
Remove clause 3 and 4 from TNF licenses
 1.23 05-Apr-2008  cegger branches: 1.23.2; 1.23.4;
use aprint_*_dev and device_xname
 1.22 19-Oct-2007  ad branches: 1.22.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.21 11-Apr-2007  macallan branches: 1.21.8; 1.21.10; 1.21.14;
return 100 in match() so we beat genfb
 1.20 04-Mar-2007  christos branches: 1.20.2; 1.20.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 29-Mar-2006  thorpej branches: 1.19.14;
Use device_cfdata().
 1.18 11-Dec-2005  christos branches: 1.18.4; 1.18.6; 1.18.8; 1.18.10; 1.18.12;
merge ktrace-lwp.
 1.17 04-Jun-2005  tsutsui branches: 1.17.2;
Add const.
 1.16 16-May-2005  macallan Added support for virtual consoles, colour and some code to determine the
usable amount of VRAM for XFree86
 1.15 25-Feb-2005  martin branches: 1.15.2;
From Micahel Lorenz: wsdisplay support for cg6
 1.14 04-Feb-2005  perry de-__P
 1.13 17-Mar-2004  pk branches: 1.13.8; 1.13.10;
Rename PROM_getprop*() => prom_getprop*().
 1.12 02-Oct-2002  thorpej branches: 1.12.6;
Add trailing ; to CFATTACH_DECL.
 1.11 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.10 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.9 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.8 20-Mar-2002  eeh Use bus_space_vaddr() correctly. Ugh.
 1.7 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.6 13-Nov-2001  lukem add RCSIDs
 1.5 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.4 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.3 04-Dec-2000  fvdl branches: 1.3.2; 1.3.4; 1.3.6;
Clean up warnings in 32bit compile (bus_space_handle_t is 64bit wide
but will only contain 32bit values; casting via u_long is safe)
 1.2 12-Sep-2000  pk branches: 1.2.2;
yank error.
 1.1 20-Aug-2000  pk Move cgsix and bwtwo Sbus attach code here from arch/sparc.
 1.2.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.2.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 12-Sep-2000  bouyer file cgsix_sbus.c was added on branch thorpej_scsipi on 2000-11-20 22:35:48 +0000
 1.3.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.4.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.3.2.2 08-Oct-2001  nathanw Catch up to -current.
 1.3.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.12.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.12.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.12.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.6.1 03-Aug-2004  skrll Sync with HEAD
 1.13.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.10.1 12-Feb-2005  yamt sync with head.
 1.13.8.1 29-Apr-2005  kent sync with -current
 1.15.2.1 08-Jun-2005  tron Pull up revision 1.16 (requested by martin in ticket #378):
Added support for virtual consoles, colour and some code to determine the
usable amount of VRAM for XFree86
 1.17.2.3 27-Oct-2007  yamt sync with head.
 1.17.2.2 03-Sep-2007  yamt sync with head.
 1.17.2.1 21-Jun-2006  yamt sync with head.
 1.18.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.18.10.1 19-Apr-2006  elad sync with head.
 1.18.8.1 01-Apr-2006  yamt sync with head.
 1.18.6.1 22-Apr-2006  simonb Sync with head.
 1.18.4.1 09-Sep-2006  rpaulo sync with head
 1.19.14.2 15-Apr-2007  yamt sync with head.
 1.19.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.20.4.1 11-Jul-2007  mjf Sync with head.
 1.20.2.2 23-Oct-2007  ad Sync with head.
 1.20.2.1 27-May-2007  ad Sync with head.
 1.21.14.1 25-Oct-2007  bouyer Sync with HEAD.
 1.21.10.1 06-Nov-2007  matt sync with HEAD
 1.21.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.22.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.22.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.4.5 11-Mar-2010  yamt sync with head
 1.23.4.4 20-Jun-2009  yamt sync with head
 1.23.4.3 16-May-2009  yamt sync with head
 1.23.4.2 04-May-2009  yamt sync with head.
 1.23.4.1 16-May-2008  yamt sync with head.
 1.23.2.1 18-May-2008  yamt sync with head.
 1.24.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.24.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.25.2.2 23-Jul-2009  jym Sync with HEAD.
 1.25.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.32 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.31 21-Apr-2016  macallan more RASTERCONSOLE purging
 1.30 14-Sep-2010  macallan branches: 1.30.18; 1.30.36;
always make sure we can access the framebuffer - having more than one wsdisplay
is perfectly reasonable these days
 1.29 18-Sep-2009  tsutsui branches: 1.29.2; 1.29.4;
Split device_t/softc. Tested on SS1+.

XXX: sparc/dev/cgthree.c in Attic had an attachment for cgthree* at obio?
XXX: and sparc/conf/files.sparc still has an entry of nonexistent (or not yet)
XXX: sparc/dev/cgthree_obio.c. Is there any sun4m machine which requires it?
 1.28 18-Sep-2009  tsutsui - use device_private(), proper types and variables for device_t/softc
- remove unnecessary casts against void pointer

XXX: many inconsistent use of aprint_*(9) and printf(9)
 1.27 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.26 16-Sep-2009  tsutsui Make cgthree(4) match prior to genfb(4). Required by cgthree(4) on SS1+.
 1.25 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.24 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.23 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.22 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.21 28-Apr-2008  martin branches: 1.21.8; 1.21.14;
Remove clause 3 and 4 from TNF licenses
 1.20 05-Apr-2008  cegger branches: 1.20.2; 1.20.4;
use aprint_*_dev and device_xname
 1.19 19-Oct-2007  ad branches: 1.19.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.18 04-Mar-2007  christos branches: 1.18.2; 1.18.14; 1.18.16; 1.18.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 29-Mar-2006  thorpej branches: 1.17.14;
Use device_cfdata().
 1.16 11-Dec-2005  christos branches: 1.16.4; 1.16.6; 1.16.8; 1.16.10; 1.16.12;
merge ktrace-lwp.
 1.15 04-Jun-2005  tsutsui branches: 1.15.2;
Add const.
 1.14 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.13 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.12 24-Apr-2003  martin branches: 1.12.2;
Fix attachment for sparc64 systems (missing bus_space_vaddr).
Patches submitted in PR 21188.
 1.11 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.10 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.9 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.8 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.7 03-Aug-2002  soren CG3 on at least the Classic doesn't have a "model" name, so fake one.
 1.6 11-Mar-2002  pk branches: 1.6.4;
Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.5 13-Nov-2001  lukem add RCSIDs
 1.4 05-Oct-2001  pooka add cast to u_long before cast to caddr_t make these compile on sparc64
 1.3 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.2 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.1 20-Aug-2000  pk branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Split & move cgthree sbus attachment from arch/sparc.
 1.1.8.2 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.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.1.6.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.6.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.7 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.6 13-Aug-2002  nathanw Catch up to -current.
 1.1.4.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.4 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.3 22-Oct-2001  nathanw Catch up to -current.
 1.1.4.2 08-Oct-2001  nathanw Catch up to -current.
 1.1.4.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.1.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 20-Aug-2000  bouyer file cgthree_sbus.c was added on branch thorpej_scsipi on 2000-11-20 22:35:48 +0000
 1.6.4.1 29-Aug-2002  gehenna catch up with -current.
 1.12.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.2.3 27-Oct-2007  yamt sync with head.
 1.15.2.2 03-Sep-2007  yamt sync with head.
 1.15.2.1 21-Jun-2006  yamt sync with head.
 1.16.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.16.10.1 19-Apr-2006  elad sync with head.
 1.16.8.1 01-Apr-2006  yamt sync with head.
 1.16.6.1 22-Apr-2006  simonb Sync with head.
 1.16.4.1 09-Sep-2006  rpaulo sync with head
 1.17.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.18.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.18.16.1 06-Nov-2007  matt sync with HEAD
 1.18.14.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.18.2.1 23-Oct-2007  ad Sync with head.
 1.19.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.4.5 09-Oct-2010  yamt sync with head
 1.20.4.4 11-Mar-2010  yamt sync with head
 1.20.4.3 16-May-2009  yamt sync with head
 1.20.4.2 04-May-2009  yamt sync with head.
 1.20.4.1 16-May-2008  yamt sync with head.
 1.20.2.1 18-May-2008  yamt sync with head.
 1.21.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.21.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.29.4.1 05-Mar-2011  rmind sync with head
 1.29.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.30.36.1 22-Apr-2016  skrll Sync with HEAD
 1.30.18.1 03-Dec-2017  jdolecek update from HEAD
 1.8 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.7 24-Apr-2021  thorpej branches: 1.7.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.6 21-Apr-2016  macallan branches: 1.6.34;
fix some tpyos, add some comments
 1.5 11-Jan-2012  macallan branches: 1.5.6; 1.5.24;
use rasops_init(0, 0)
 1.4 18-Aug-2010  macallan branches: 1.4.8; 1.4.12;
- add support for running the console in 8 bit colour
- make shadow fb optional
- use VCONS_DONT_READ if there's no shadow fb
 1.3 14-Apr-2010  macallan branches: 1.3.2; 1.3.4; 1.3.6;
add the missing bits to allow X to run in 24bit with the wsfb driver
still no hardware acceleration though
 1.2 08-Apr-2010  macallan use a shadow framebuffer
 1.1 24-Mar-2010  macallan first stab at a driver for the cg12 / matrox cg3
for now it uses the same monochrome overlay as OBP, otherwise it's got the
usual wsdisplay / vcons goodies
TODO:
- fill in mmap and ioctl methods so we can at least run X in monochrome
- figure out where the 24bit buffer is ( and maybe if there's an 8 bit buffer )
- see if we can do any acceleration
- find the DAC registers
 1.3.6.3 09-Oct-2010  yamt sync with head
 1.3.6.2 11-Aug-2010  yamt sync with head.
 1.3.6.1 14-Apr-2010  yamt file cgtwelve.c was added on branch yamt-nfs-mp on 2010-08-11 22:54:10 +0000
 1.3.4.3 05-Mar-2011  rmind sync with head
 1.3.4.2 30-May-2010  rmind sync with head
 1.3.4.1 14-Apr-2010  rmind file cgtwelve.c was added on branch rmind-uvmplock on 2010-05-30 05:17:42 +0000
 1.3.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.3.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.3.2.1 14-Apr-2010  uebayasi file cgtwelve.c was added on branch uebayasi-xip on 2010-04-30 14:43:47 +0000
 1.4.12.1 18-Feb-2012  mrg merge to -current.
 1.4.8.1 17-Apr-2012  yamt sync with head
 1.5.24.1 22-Apr-2016  skrll Sync with HEAD
 1.5.6.1 03-Dec-2017  jdolecek update from HEAD
 1.6.34.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.7.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.3 21-Apr-2016  macallan fix some tpyos, add some comments
 1.2 14-Apr-2010  macallan branches: 1.2.2; 1.2.4; 1.2.6; 1.2.24; 1.2.42;
add the missing bits to allow X to run in 24bit with the wsfb driver
still no hardware acceleration though
 1.1 24-Mar-2010  macallan first stab at a driver for the cg12 / matrox cg3
for now it uses the same monochrome overlay as OBP, otherwise it's got the
usual wsdisplay / vcons goodies
TODO:
- fill in mmap and ioctl methods so we can at least run X in monochrome
- figure out where the 24bit buffer is ( and maybe if there's an 8 bit buffer )
- see if we can do any acceleration
- find the DAC registers
 1.2.42.1 22-Apr-2016  skrll Sync with HEAD
 1.2.24.1 03-Dec-2017  jdolecek update from HEAD
 1.2.6.2 11-Aug-2010  yamt sync with head.
 1.2.6.1 14-Apr-2010  yamt file cgtwelvereg.h was added on branch yamt-nfs-mp on 2010-08-11 22:54:10 +0000
 1.2.4.2 30-May-2010  rmind sync with head
 1.2.4.1 14-Apr-2010  rmind file cgtwelvereg.h was added on branch rmind-uvmplock on 2010-05-30 05:17:42 +0000
 1.2.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.2.2.1 14-Apr-2010  uebayasi file cgtwelvereg.h was added on branch uebayasi-xip on 2010-04-30 14:43:47 +0000
 1.53 21-Jul-2022  andvar s/pedning/pending/
 1.52 08-May-2019  isaki Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.51 16-Mar-2019  isaki branches: 1.51.2;
Use C99 style struct initializer to audio_hw_if.
 1.50 02-May-2017  martin branches: 1.50.10;
Make it compile with AUDIODEBUG
 1.49 23-Nov-2011  jmcneill branches: 1.49.8; 1.49.26; 1.49.40;
Merge jmcneill-audiomp3 branch, which is derived from ad-audiomp2. From
the original ad-audiomp branch notes:

Add MP locking to the audio drivers.

Making the audio drivers MP safe is necessary before efforts
can be made to make the VM system MP safe.

The are two locks per device instance, an ISR lock and
a character device lock. The ISR lock replaces calls to
splaudio()/splx(), and will be held across calls to device
methods which were called at splaudio() before (e.g.
trigger_output). The character device lock is held across
calls to nearly all of the methods, excluding some only
used for initialization, e.g. get_locks.

Welcome to 5.99.57.
 1.48 02-Jun-2011  christos branches: 1.48.2; 1.48.4;
split audiocs
 1.47 18-Sep-2009  tsutsui branches: 1.47.4; 1.47.6; 1.47.10;
- use device_private(), proper types and variables for device_t/softc
- remove unnecessary casts against void pointer

XXX: many inconsistent use of aprint_*(9) and printf(9)
 1.46 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.45 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.44 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.43 16-Dec-2008  christos branches: 1.43.2;
replace bitmask_snprintf(9) with snprintb(3)
 1.42 29-Apr-2008  ad branches: 1.42.8;
Another compile fix.
 1.41 29-Apr-2008  martin Pass the "right" softc to the soft interrupt handler
 1.40 29-Apr-2008  martin Make it compile
 1.39 29-Apr-2008  ad Use sparc_softintr to pass down device interrupt to the correct IPL.
MI slowpath softints are fine for notifications but have to much latency
to provide the card with the next block to play/record. PR kern/37540.
 1.38 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.37 05-Apr-2008  cegger branches: 1.37.2; 1.37.4;
use aprint_*_dev and device_xname
 1.36 03-Dec-2007  ad branches: 1.36.14;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.35 19-Oct-2007  ad branches: 1.35.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.34 15-Oct-2006  martin branches: 1.34.6; 1.34.8; 1.34.22; 1.34.24; 1.34.28;
Add missing initializer
 1.33 11-Dec-2005  christos branches: 1.33.20; 1.33.22;
merge ktrace-lwp.
 1.32 15-Jan-2005  kent branches: 1.32.10;
ansify and KNF
 1.31 10-Jan-2005  kent merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework


Summary of changes:

* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.

* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()

* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t

* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.

* add `struct device *' parameter to ac97_attach()

* all of audio HW drivers follow audio_hw_if and ac97 changes
 1.30 29-Oct-2004  yamt branches: 1.30.2;
constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.29 10-Sep-2003  uwe Get rid of the disgusting struct apc_dma *dma = NULL; hack now that we
have proper definitions for offsets of APM DMA registers.

NULL out round_buffersize and round_blocksize in audio_hw_if. We
don't seem to have any special requirements and audio(9) already
provides enough rounding.
 1.28 03-May-2003  wiz branches: 1.28.2;
DMA, not dma nor Dma.
 1.27 27-Feb-2003  pk Back out rev. 1.26; I forgot about the Javastations..
 1.26 27-Feb-2003  pk Some machine have a `SUNW,CS4231' node, but no actual hardware. It seems
these can be identified by a `serial' device type.
From Julian Coleman.
 1.25 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.24 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.23 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.22 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.21 16-Jul-2002  mrg fix a bug introduced in rev 1.19:
- finish bus_space-ification of cs4231_sbus_trigger_input().

this stops recording on the sbus cs4231 from crashing.
 1.20 27-Mar-2002  pk branches: 1.20.2; 1.20.4;
cs4231_sbus_regdump(): add missing ')'
 1.19 21-Mar-2002  eeh Properly bus_space_*=ify this so it uses accessors.
 1.18 12-Mar-2002  uwe Rework the driver to add EBus DMA support and improve APC DMA support.
Audio-related stuff is left almost intact.

* support audiocs at ebus playback and capture
tested on krups and u5 (thanks, martin)
* make first attempt at supporting audiocs at sbus capture
* nb: full-duplex is not tested
* while here, fix CSAUDIO_MONITOR_MUTE to be of CSAUDIO_MONITOR_CLASS
i.e. outputs.monitor.mute -> monitor.monitor.mute

Ok by pk, eeh.
 1.17 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.16 13-Nov-2001  lukem add RCSIDs
 1.15 09-Jul-2000  pk branches: 1.15.2; 1.15.4;
Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.14 04-Jun-2000  cgd branches: 1.14.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.13 14-Apr-2000  mrg branches: 1.13.2;
add some casts to (u_long) to shut up gcc
 1.12 21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.11 05-Jun-1999  mrg branches: 1.11.2; 1.11.8;
split sbus audiocs code up so we can share it with the ebus. XXX ebus DMA is probably different.
 1.10 19-Mar-1999  eeh branches: 1.10.4;
Use correctly bus_space_*() macros to access device registers.
 1.9 17-Feb-1999  mycroft Update comments.
 1.8 17-Feb-1999  mycroft Pass the direction to the allocm and round_buffersize methods.
Some drivers need this to properly allocate DMAable memory.
 1.7 12-Jan-1999  kleink Avoid arithmetic on void *.
 1.6 25-Sep-1998  pk Fix a silly yank-o.
 1.5 07-Sep-1998  pk Missing bits in DEBUG mode.
 1.4 29-Aug-1998  pk Nuke unnecessary header files.
 1.3 29-Aug-1998  pk Make compile without AUDIO_DEBUG
 1.2 28-Aug-1998  pk Nuke Dprintf; fix formats.
Add missing copyright.
 1.1 27-Aug-1998  pk CS4231 audio driver. Play only for now.
 1.10.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.13.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.14.2.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.15.4.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.15.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.15.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.15.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.15.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.2.5 11-Dec-2002  thorpej Sync with HEAD.
 1.15.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.15.2.3 01-Aug-2002  nathanw Catch up to -current.
 1.15.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.15.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.20.4.1 18-Jul-2002  lukem Pull up revision 1.21 (requested by mrg in ticket #512):
fix a bug introduced in rev 1.19:
- finish bus_space-ification of cs4231_sbus_trigger_input().
this stops recording on the sbus cs4231 from crashing.
 1.20.2.1 20-Jul-2002  gehenna catch up with -current.
 1.28.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.28.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.28.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.28.2.1 03-Aug-2004  skrll Sync with HEAD
 1.30.2.1 03-Jan-2005  kent adopt the filter pipeline framework
 1.32.10.3 07-Dec-2007  yamt sync with head
 1.32.10.2 27-Oct-2007  yamt sync with head.
 1.32.10.1 30-Dec-2006  yamt sync with head.
 1.33.22.1 22-Oct-2006  yamt sync with head
 1.33.20.1 18-Nov-2006  ad Sync with head.
 1.34.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.34.24.2 09-Jan-2008  matt sync with HEAD
 1.34.24.1 06-Nov-2007  matt sync with HEAD
 1.34.22.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.34.22.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.34.8.1 23-Oct-2007  ad Sync with head.
 1.34.6.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.35.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.36.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.36.14.1 02-Jun-2008  mjf Sync with HEAD.
 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.1 18-May-2008  yamt sync with head.
 1.42.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.43.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.47.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.47.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.47.4.1 12-Jun-2011  rmind sync with head
 1.48.4.4 22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.48.4.3 22-Nov-2011  macallan we need to initialize the locks before using them
Now this works on my Ultra 1
 1.48.4.2 20-Nov-2011  mrg complete the port to audiomp: don't forget to take sc_intr_lock in the
hardware interrupt routines.
 1.48.4.1 20-Nov-2011  mrg make audiocs(4) compile. i don't have anything handy to actually test
this easily, but this was just updating the alloc/free to kmem and
hooking into ad1848_get_locks().
 1.48.2.1 17-Apr-2012  yamt sync with head
 1.49.40.1 11-May-2017  pgoyette Sync with HEAD
 1.49.26.1 28-Aug-2017  skrll Sync with HEAD
 1.49.8.1 03-Dec-2017  jdolecek update from HEAD
 1.50.10.1 10-Jun-2019  christos Sync with HEAD
 1.51.2.2 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.51.2.1 21-Apr-2019  isaki Adapt ad1848/cs4231 families to audio2.
 1.45 06-Feb-2021  isaki Remove an extra mutex_spin_exit() in error path.
This is a part of rev 1.38.
 1.44 06-Feb-2021  isaki Remove something like counters.
- Counting {open,close} is done by the MI audio layer.
- trigger_* is not called again between trigger_* and halt_*.
 1.43 25-Aug-2020  skrll branches: 1.43.2;
Style on config_finalize_register arguments - make consistent will all
other callers of config_finalize_register
 1.42 29-Feb-2020  isaki round_blocksize must return a multiple of the framesize
even if passed blocksize is greater than the upper limit.
 1.41 08-Jun-2019  isaki branches: 1.41.2; 1.41.4;
Clean get_props().
- Make get_props() return AUDIO_PROP_{PLAYBACK,CAPTURE} properly.
This eliminates need for audio.c to take care of such (old)
drivers which don't return both of PLAYBACK and CAPTURE.
- All get_props() doesn't need to return AUDIO_PROP_MMAP.
It is handled in the audio layer now.
 1.40 08-May-2019  isaki Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.39 03-Sep-2018  riastradh branches: 1.39.2;
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.38 12-Jan-2018  mrg branches: 1.38.2; 1.38.4;
fix several KASSERT()s and locking in a few places.
fixes DIAGNOSTIC kernels and still plays.
 1.37 21-Dec-2017  macallan overhaul the dbri driver and make it work again in the New Order Of Things
- fix switching between control and data mode
- make sure interrupts can happen in control mode
- implement audioif.commit_settings()
- switch to control mode only if needed - for changes in sample rate or format
but not for things like volume control
should fix PR 52786
 1.36 08-Dec-2017  mrg fix audiomp bugs:
- switch from tsleep/wakeup to condvar
- fix locking in a bunch of places. there were several locking
against myself issues.

also:
- don't let dbri_process_interrupt_buffer() loop more than once
over the array of intrs.

this fixes hangs when using audio on ss20 in -current, but does
not make audio work. it eventually times out with eg:

dbri0: switching to control mode timed out (0 f6)

and may leave a sample in the audio buffer repeating.
 1.35 19-Oct-2013  mrg branches: 1.35.4; 1.35.22;
- remove set but unused variable.
- put variables only inside #ifdef inside that same #ifdef.
use __USE() where appropriate.
 1.34 23-Nov-2011  jmcneill branches: 1.34.8; 1.34.12;
Merge jmcneill-audiomp3 branch, which is derived from ad-audiomp2. From
the original ad-audiomp branch notes:

Add MP locking to the audio drivers.

Making the audio drivers MP safe is necessary before efforts
can be made to make the VM system MP safe.

The are two locks per device instance, an ISR lock and
a character device lock. The ISR lock replaces calls to
splaudio()/splx(), and will be held across calls to device
methods which were called at splaudio() before (e.g.
trigger_output). The character device lock is held across
calls to nearly all of the methods, excluding some only
used for initialization, e.g. get_locks.

Welcome to 5.99.57.
 1.33 09-Mar-2011  macallan branches: 1.33.4; 1.33.6;
change dbri's DMA segment size to a power of two value - the ship allows
segments up to 0x1fff bytes but even rounded to 32bit this seems to
confuse the rest of the audio code these days
TODO: we don't need to interrupt at every single segment
either way, with this mpg123 doesn't produce semi-random funny noises
anymore
 1.32 11-Jan-2011  macallan branches: 1.32.2;
use config_finalize_register() instead of config_interrupts() to detect the
codec and attach audio. For some reason we run into a locking panic with
config_interrupts().
Tested on my SS20
 1.31 24-Feb-2010  dyoung branches: 1.31.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.30 18-Feb-2010  macallan Abort setup when we find no audio codec to avoid crashing later on with
ISDN-only cards.
Should fix PR41055
 1.29 14-Jan-2010  macallan branches: 1.29.2;
set a delta value for the master channel so volume control via PMF works
 1.28 08-Jan-2010  dyoung Expand PMF_FN_* macros.
 1.27 02-Jan-2010  tsutsui Fix botches in mechanical changes to make this compile:
dbri.c:165: warning: 'dbri_sus' declared 'static' but never defined
dbri.c: In function 'dbri_resume':
dbri.c:2188: error: 'sc' undeclared
dbri.c:2189: error: break statement not within loop or switch
 1.26 02-Jan-2010  christos convert to pmf
 1.25 20-Sep-2009  tsutsui u_intNN_t -> uintNN_t
 1.24 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.23 16-May-2009  martin we can not free() a dmamap!
 1.22 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.21 03-Jan-2009  yamt branches: 1.21.2;
remove extra semicolons.
 1.20 16-May-2008  macallan branches: 1.20.6;
struct device * -> device_t
 1.19 09-May-2008  macallan move to 2 clause license
 1.18 05-Apr-2008  cegger branches: 1.18.2; 1.18.4; 1.18.6;
use aprint_*_dev and device_xname
 1.17 03-Dec-2007  ad branches: 1.17.14;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.16 19-Oct-2007  ad branches: 1.16.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.15 20-Jul-2007  macallan branches: 1.15.4; 1.15.6; 1.15.10; 1.15.12;
make this work with the onboard codec found on my SS20
 1.14 12-Jul-2007  macallan branches: 1.14.2;
- don't pretend to support 8bit stereo - the hardware can do it but not the
way we currently use it ( needs a 2nd pipe for each direction )
- 8bit mono a-law and u-law should work now
- add support for audio input
 1.13 14-Mar-2007  macallan - add dummy input methods so we don't panic if someone tries to read
- add dummy input mixer controls
- restart tx DMA on PWR_RESUME
- power up on PWR_RESUME only if we really have to
- add an option to control wether to spin or sleep when waiting for the chip
to switch between data and control mode
 1.12 11-Mar-2007  macallan branches: 1.12.2;
whitespace police, some cleanup - no functional changes
 1.11 11-Mar-2007  macallan some more overhaul:
- use static consistently
- convert to auconv instead of pretending to support LE samples
 1.10 10-Mar-2007  macallan adjust some debug output verbosity and use aprint_*()
 1.9 08-Mar-2007  macallan branches: 1.9.2;
make the dbri driver work again
while there enforce some alignment rules, adjust some timeouts, retry when
probing the codec fails
 1.8 04-Mar-2007  mrg fix fall out from caddr_t changes.
 1.7 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6 24-Sep-2006  jmcneill branches: 1.6.4;
Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
 1.5 28-May-2006  blymn branches: 1.5.4; 1.5.8; 1.5.10;
Clean up bogus whitespace
 1.4 09-Mar-2006  macallan branches: 1.4.4;
keep the chip powered down when not in use on machines that support it
( like SPARCbooks ) - needs testing on other machines
tested on my SPARCbook 3GX
 1.3 11-Dec-2005  christos branches: 1.3.4; 1.3.6; 1.3.8; 1.3.10;
merge ktrace-lwp.
 1.2 28-Jul-2005  macallan branches: 1.2.6;
Updated license
 1.1 16-Jul-2005  macallan driver for the audio part of SUNW,DBRI ISDN/audio controllers
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 28-Jul-2005  skrll file dbri.c was added on branch ktrace-lwp on 2005-11-10 14:07:47 +0000
 1.3.10.1 19-Apr-2006  elad sync with head.
 1.3.8.2 26-Jun-2006  yamt sync with head.
 1.3.8.1 13-Mar-2006  yamt sync with head.
 1.3.6.2 01-Jun-2006  kardel Sync with head.
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.4.1 19-Jun-2006  chap Sync with head.
 1.5.10.1 22-Oct-2006  yamt sync with head
 1.5.8.1 18-Nov-2006  ad Sync with head.
 1.5.4.6 07-Dec-2007  yamt sync with head
 1.5.4.5 27-Oct-2007  yamt sync with head.
 1.5.4.4 03-Sep-2007  yamt sync with head.
 1.5.4.3 30-Dec-2006  yamt sync with head.
 1.5.4.2 21-Jun-2006  yamt sync with head.
 1.5.4.1 28-May-2006  yamt file dbri.c was added on branch yamt-lazymbuf on 2006-06-21 15:06:47 +0000
 1.6.4.2 24-Mar-2007  yamt sync with head.
 1.6.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.2.5 23-Oct-2007  ad Sync with head.
 1.9.2.4 20-Aug-2007  ad Sync with HEAD.
 1.9.2.3 15-Jul-2007  ad Sync with head.
 1.9.2.2 10-Apr-2007  ad Sync with head.
 1.9.2.1 13-Mar-2007  ad Sync with head.
 1.12.2.1 11-Jul-2007  mjf Sync with head.
 1.14.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.15.12.2 20-Jul-2007  macallan make this work with the onboard codec found on my SS20
 1.15.12.1 20-Jul-2007  macallan file dbri.c was added on branch matt-mips64 on 2007-07-20 22:21:52 +0000
 1.15.10.1 25-Oct-2007  bouyer Sync with HEAD.
 1.15.6.2 09-Jan-2008  matt sync with HEAD
 1.15.6.1 06-Nov-2007  matt sync with HEAD
 1.15.4.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.15.4.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.16.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.17.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.17.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.4.5 11-Mar-2010  yamt sync with head
 1.18.4.4 20-Jun-2009  yamt sync with head
 1.18.4.3 16-May-2009  yamt sync with head
 1.18.4.2 04-May-2009  yamt sync with head.
 1.18.4.1 16-May-2008  yamt sync with head.
 1.18.2.1 18-May-2008  yamt sync with head.
 1.20.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.2.2 23-Jul-2009  jym Sync with HEAD.
 1.21.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.31.2.2 21-Apr-2011  rmind sync with head
 1.31.2.1 05-Mar-2011  rmind sync with head
 1.32.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.33.6.2 20-Nov-2011  mrg convert spl*() to use the sc_intr_lock mutex, and hold it in a couple
of other places we should as well.
 1.33.6.1 20-Nov-2011  mrg port to audiomp: update allocm/freem, and add get_locks() support.
bots on my ss20, but i haven't really tested it yet.
 1.33.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.33.4.1 17-Apr-2012  yamt sync with head
 1.34.12.1 18-May-2014  rmind sync with head
 1.34.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.22.2 13-Jan-2018  snj Pull up following revision(s) (requested by mrg in ticket #503):
sys/dev/sbus/dbri.c: up to 1.38
sys/dev/sbus/dbrivar.h: up to 1.15
fix audiomp bugs:
- switch from tsleep/wakeup to condvar
- fix locking in a bunch of places. there were several locking
against myself issues.

also:
- don't let dbri_process_interrupt_buffer() loop more than once
over the array of intrs.

this fixes hangs when using audio on ss20 in -current, but does
not make audio work. it eventually times out with eg:

dbri0: switching to control mode timed out (0 f6)

and may leave a sample in the audio buffer repeating.
--
fix several KASSERT()s and locking in a few places.
fixes DIAGNOSTIC kernels and still plays.
 1.35.22.1 13-Jan-2018  snj Pull up following revision(s) (requested by macallan in ticket #476):
sys/dev/sbus/dbrivar.h: revision 1.15
sys/dev/ic/cs4215reg.h: revision 1.5
sys/dev/sbus/dbri.c: revision 1.37
overhaul the dbri driver and make it work again in the New Order Of Things
- fix switching between control and data mode
- make sure interrupts can happen in control mode
- implement audioif.commit_settings()
- switch to control mode only if needed - for changes in sample rate or format
but not for things like volume control
should fix PR 52786
 1.35.4.1 21-Mar-2018  martin Pull up following revision(s) (requested by mrg in ticket #1586):
sys/dev/sbus/dbrivar.h: revision 1.14
sys/dev/sbus/dbrivar.h: revision 1.15
sys/dev/ic/cs4215reg.h: revision 1.5
sys/dev/sbus/dbri.c: revision 1.36
sys/dev/sbus/dbri.c: revision 1.37
sys/dev/sbus/dbri.c: revision 1.38

fix audiomp bugs:
- switch from tsleep/wakeup to condvar
- fix locking in a bunch of places. there were several locking
against myself issues.
also:
- don't let dbri_process_interrupt_buffer() loop more than once
over the array of intrs.

this fixes hangs when using audio on ss20 in -current, but does
not make audio work. it eventually times out with eg:
dbri0: switching to control mode timed out (0 f6)
and may leave a sample in the audio buffer repeating.

overhaul the dbri driver and make it work again in the New Order Of Things
- fix switching between control and data mode
- make sure interrupts can happen in control mode
- implement audioif.commit_settings()
- switch to control mode only if needed - for changes in sample rate or format
but not for things like volume control
should fix PR 52786

fix several KASSERT()s and locking in a few places.

fixes DIAGNOSTIC kernels and still plays.
 1.38.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.38.4.1 10-Jun-2019  christos Sync with HEAD
 1.38.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.39.2.3 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.39.2.2 01-May-2019  isaki Adapt dbri to audio2.
- Add some mutex_enter/exit.
- Remove DBRI_BIG_BUFFER option. Such big buffer will not necessary
in audio2.
Thank you, macallan@.
 1.39.2.1 21-Apr-2019  isaki Use C99 style struct initializer to audio_format.
 1.41.4.1 29-Feb-2020  ad Sync with head.
 1.41.2.1 21-Mar-2020  martin Pull up following revision(s) (requested by isaki in ticket #792):

sys/arch/amiga/dev/aucc.c: revision 1.48
sys/dev/pci/auixp.c: revision 1.49
sys/dev/pci/gcscaudio.c: revision 1.19
sys/dev/pci/auich.c: revision 1.159
sys/dev/sbus/dbri.c: revision 1.42
sys/dev/pci/auvia.c: revision 1.85
sys/dev/pci/auacer.c: revision 1.39

Drop 512 bytes limit on auvia_round_blocksize().

This fixes attach on 6 channels device.
PR kern/55017.

round_blocksize must return a multiple of the framesize.
aucc(4) supports 3 channels mode.

round_blocksize must return a multiple of the framesize
even if passed blocksize is greater than the upper limit.

round_blocksize must return a multiple of the framesize.

It's not divisible when blk=GCSCAUDI_PRD_SIZE_MAX and channels=4.
round_blocksize must return a multiple of the framesize
even if 6 channels mode.

I believe that keeping "good alignment" is just a wish, not constraint.
 1.43.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.6 09-May-2008  macallan move to 2 clause license
 1.5 08-Mar-2007  macallan branches: 1.5.36; 1.5.38; 1.5.40; 1.5.42;
make the dbri driver work again
while there enforce some alignment rules, adjust some timeouts, retry when
probing the codec fails
 1.4 09-Mar-2006  macallan branches: 1.4.8; 1.4.18;
keep the chip powered down when not in use on machines that support it
( like SPARCbooks ) - needs testing on other machines
tested on my SPARCbook 3GX
 1.3 11-Dec-2005  christos branches: 1.3.4; 1.3.6; 1.3.8; 1.3.10;
merge ktrace-lwp.
 1.2 28-Jul-2005  macallan branches: 1.2.6;
Updated license
 1.1 16-Jul-2005  macallan driver for the audio part of SUNW,DBRI ISDN/audio controllers
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 28-Jul-2005  skrll file dbrireg.h was added on branch ktrace-lwp on 2005-11-10 14:07:47 +0000
 1.3.10.1 19-Apr-2006  elad sync with head.
 1.3.8.1 13-Mar-2006  yamt sync with head.
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.18.1 12-Mar-2007  rmind Sync with HEAD.
 1.4.8.3 03-Sep-2007  yamt sync with head.
 1.4.8.2 21-Jun-2006  yamt sync with head.
 1.4.8.1 09-Mar-2006  yamt file dbrireg.h was added on branch yamt-lazymbuf on 2006-06-21 15:06:47 +0000
 1.5.42.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.5.40.1 16-May-2008  yamt sync with head.
 1.5.38.1 18-May-2008  yamt sync with head.
 1.5.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.17 06-Feb-2021  isaki Remove something like counters.
- Counting {open,close} is done by the MI audio layer.
- trigger_* is not called again between trigger_* and halt_*.
 1.16 08-May-2019  isaki branches: 1.16.10;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.15 21-Dec-2017  macallan branches: 1.15.4; 1.15.8;
overhaul the dbri driver and make it work again in the New Order Of Things
- fix switching between control and data mode
- make sure interrupts can happen in control mode
- implement audioif.commit_settings()
- switch to control mode only if needed - for changes in sample rate or format
but not for things like volume control
should fix PR 52786
 1.14 08-Dec-2017  mrg fix audiomp bugs:
- switch from tsleep/wakeup to condvar
- fix locking in a bunch of places. there were several locking
against myself issues.

also:
- don't let dbri_process_interrupt_buffer() loop more than once
over the array of intrs.

this fixes hangs when using audio on ss20 in -current, but does
not make audio work. it eventually times out with eg:

dbri0: switching to control mode timed out (0 f6)

and may leave a sample in the audio buffer repeating.
 1.13 23-Nov-2011  jmcneill branches: 1.13.24; 1.13.42;
Merge jmcneill-audiomp3 branch, which is derived from ad-audiomp2. From
the original ad-audiomp branch notes:

Add MP locking to the audio drivers.

Making the audio drivers MP safe is necessary before efforts
can be made to make the VM system MP safe.

The are two locks per device instance, an ISR lock and
a character device lock. The ISR lock replaces calls to
splaudio()/splx(), and will be held across calls to device
methods which were called at splaudio() before (e.g.
trigger_output). The character device lock is held across
calls to nearly all of the methods, excluding some only
used for initialization, e.g. get_locks.

Welcome to 5.99.57.
 1.12 11-Jan-2011  macallan branches: 1.12.8; 1.12.10;
use config_finalize_register() instead of config_interrupts() to detect the
codec and attach audio. For some reason we run into a locking panic with
config_interrupts().
Tested on my SS20
 1.11 17-Sep-2009  tsutsui branches: 1.11.4;
Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.10 16-May-2008  macallan struct device * -> device_t
 1.9 09-May-2008  macallan move to 2 clause license
 1.8 03-Dec-2007  ad branches: 1.8.14; 1.8.16; 1.8.18; 1.8.20;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.7 12-Jul-2007  macallan branches: 1.7.6; 1.7.8; 1.7.14;
- don't pretend to support 8bit stereo - the hardware can do it but not the
way we currently use it ( needs a 2nd pipe for each direction )
- 8bit mono a-law and u-law should work now
- add support for audio input
 1.6 14-Mar-2007  macallan - add dummy input methods so we don't panic if someone tries to read
- add dummy input mixer controls
- restart tx DMA on PWR_RESUME
- power up on PWR_RESUME only if we really have to
- add an option to control wether to spin or sleep when waiting for the chip
to switch between data and control mode
 1.5 04-Mar-2007  christos branches: 1.5.2; 1.5.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 09-Mar-2006  macallan branches: 1.4.8; 1.4.18;
keep the chip powered down when not in use on machines that support it
( like SPARCbooks ) - needs testing on other machines
tested on my SPARCbook 3GX
 1.3 11-Dec-2005  christos branches: 1.3.4; 1.3.6; 1.3.8; 1.3.10;
merge ktrace-lwp.
 1.2 28-Jul-2005  macallan branches: 1.2.6;
Updated license
 1.1 16-Jul-2005  macallan driver for the audio part of SUNW,DBRI ISDN/audio controllers
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 28-Jul-2005  skrll file dbrivar.h was added on branch ktrace-lwp on 2005-11-10 14:07:47 +0000
 1.3.10.1 19-Apr-2006  elad sync with head.
 1.3.8.1 13-Mar-2006  yamt sync with head.
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.18.2 24-Mar-2007  yamt sync with head.
 1.4.18.1 12-Mar-2007  rmind Sync with HEAD.
 1.4.8.4 07-Dec-2007  yamt sync with head
 1.4.8.3 03-Sep-2007  yamt sync with head.
 1.4.8.2 21-Jun-2006  yamt sync with head.
 1.4.8.1 09-Mar-2006  yamt file dbrivar.h was added on branch yamt-lazymbuf on 2006-06-21 15:06:47 +0000
 1.5.4.1 11-Jul-2007  mjf Sync with head.
 1.5.2.2 15-Jul-2007  ad Sync with head.
 1.5.2.1 10-Apr-2007  ad Sync with head.
 1.7.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.8.1 09-Jan-2008  matt sync with HEAD
 1.7.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.8.20.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.8.18.3 11-Mar-2010  yamt sync with head
 1.8.18.2 04-May-2009  yamt sync with head.
 1.8.18.1 16-May-2008  yamt sync with head.
 1.8.16.1 18-May-2008  yamt sync with head.
 1.8.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.4.1 05-Mar-2011  rmind sync with head
 1.12.10.1 20-Nov-2011  mrg port to audiomp: update allocm/freem, and add get_locks() support.
bots on my ss20, but i haven't really tested it yet.
 1.12.8.1 17-Apr-2012  yamt sync with head
 1.13.42.2 13-Jan-2018  snj Pull up following revision(s) (requested by mrg in ticket #503):
sys/dev/sbus/dbri.c: up to 1.38
sys/dev/sbus/dbrivar.h: up to 1.15
fix audiomp bugs:
- switch from tsleep/wakeup to condvar
- fix locking in a bunch of places. there were several locking
against myself issues.

also:
- don't let dbri_process_interrupt_buffer() loop more than once
over the array of intrs.

this fixes hangs when using audio on ss20 in -current, but does
not make audio work. it eventually times out with eg:

dbri0: switching to control mode timed out (0 f6)

and may leave a sample in the audio buffer repeating.
--
fix several KASSERT()s and locking in a few places.
fixes DIAGNOSTIC kernels and still plays.
 1.13.42.1 13-Jan-2018  snj Pull up following revision(s) (requested by macallan in ticket #476):
sys/dev/sbus/dbrivar.h: revision 1.15
sys/dev/ic/cs4215reg.h: revision 1.5
sys/dev/sbus/dbri.c: revision 1.37
overhaul the dbri driver and make it work again in the New Order Of Things
- fix switching between control and data mode
- make sure interrupts can happen in control mode
- implement audioif.commit_settings()
- switch to control mode only if needed - for changes in sample rate or format
but not for things like volume control
should fix PR 52786
 1.13.24.1 21-Mar-2018  martin Pull up following revision(s) (requested by mrg in ticket #1586):
sys/dev/sbus/dbrivar.h: revision 1.14
sys/dev/sbus/dbrivar.h: revision 1.15
sys/dev/ic/cs4215reg.h: revision 1.5
sys/dev/sbus/dbri.c: revision 1.36
sys/dev/sbus/dbri.c: revision 1.37
sys/dev/sbus/dbri.c: revision 1.38

fix audiomp bugs:
- switch from tsleep/wakeup to condvar
- fix locking in a bunch of places. there were several locking
against myself issues.
also:
- don't let dbri_process_interrupt_buffer() loop more than once
over the array of intrs.

this fixes hangs when using audio on ss20 in -current, but does
not make audio work. it eventually times out with eg:
dbri0: switching to control mode timed out (0 f6)
and may leave a sample in the audio buffer repeating.

overhaul the dbri driver and make it work again in the New Order Of Things
- fix switching between control and data mode
- make sure interrupts can happen in control mode
- implement audioif.commit_settings()
- switch to control mode only if needed - for changes in sample rate or format
but not for things like volume control
should fix PR 52786

fix several KASSERT()s and locking in a few places.

fixes DIAGNOSTIC kernels and still plays.
 1.15.8.1 01-May-2019  isaki Adapt dbri to audio2.
- Add some mutex_enter/exit.
- Remove DBRI_BIG_BUFFER option. Such big buffer will not necessary
in audio2.
Thank you, macallan@.
 1.15.4.1 10-Jun-2019  christos Sync with HEAD
 1.16.10.1 03-Apr-2021  thorpej Sync with HEAD.
 1.40 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.39 22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.38 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.37 10-May-2021  thorpej branches: 1.37.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.36 24-Apr-2021  thorpej branches: 1.36.2; 1.36.4;
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.35 17-Sep-2009  tsutsui branches: 1.35.80;
Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.34 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.33 17-May-2008  macallan branches: 1.33.12;
device_t
 1.32 28-Apr-2008  martin branches: 1.32.2;
Remove clause 3 and 4 from TNF licenses
 1.31 13-Apr-2008  tsutsui branches: 1.31.2; 1.31.4;
Split device_t/softc for MI ncr53c9x and some related devices,
with various cleanup.
 1.30 05-Apr-2008  cegger use aprint_*_dev and device_xname
 1.29 19-Oct-2007  ad branches: 1.29.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.28 28-Feb-2006  kleink branches: 1.28.24; 1.28.38; 1.28.40; 1.28.44;
Fix inverted device_is_a() logic in previous conversion.
 1.27 27-Feb-2006  thorpej Use device_is_a().
 1.26 11-Dec-2005  christos branches: 1.26.2; 1.26.4; 1.26.6;
merge ktrace-lwp.
 1.25 30-May-2005  christos branches: 1.25.2;
avoid shadow variables.
 1.24 04-Feb-2005  perry de-__P
 1.23 30-Jun-2004  pk branches: 1.23.4; 1.23.6;
Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.
 1.22 27-Jun-2004  pk Bus tags should now be constructed by copying the parent's bus tag and
then changing the fields that need to be handled by the child bus.
 1.21 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.20 06-Feb-2003  hannken branches: 1.20.2;
Remove unneeded #include's.

Approved by: Paul Kranenburg <pk@netbsd.org>
 1.19 06-Feb-2003  martin Add <sys/lock.h> include for ncr53c9xvar.h.
 1.18 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.17 10-Dec-2002  pk bus_intr_establish() signature change.

The additional `fast trap' argument is ignored in these drivers.
 1.16 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.15 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.14 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.13 27-Sep-2002  thorpej Compare the driver name against "ledma", rather than looking for
&ledma_ca.
 1.12 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.11 21-Mar-2002  eeh branches: 1.11.2;
Fixup attachment code to use sbus_promaddr_to_handle() and not specify
BUS_SPACE_MAP_LINEAR.
 1.10 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.9 14-Jan-2002  tsutsui Call malloc(9) with M_ZERO flag instead of bzero() after malloc().
 1.8 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.7 13-Nov-2001  lukem add RCSIDs
 1.6 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.5 09-Jul-2000  pk branches: 1.5.2; 1.5.4; 1.5.6;
Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.4 11-Jan-2000  pk branches: 1.4.4;
Remove old-style boot device recognition.
 1.3 05-Sep-1998  pk branches: 1.3.12;
Assign my copyrights to TNF.
 1.2 29-Aug-1998  pk Adjust for some small changes in lsi64854 back-end driver.
 1.1 29-Aug-1998  pk Use bus_space_*() to access device registers.
Add `esp' and `le' DMA engine.
 1.3.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.4.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.5.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.5.4.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.5.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.5.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.5.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.5.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.5.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.5.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.5.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.11.2.1 26-Mar-2002  eeh Probe and attach through devprops.
 1.20.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.20.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.20.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.2.1 03-Aug-2004  skrll Sync with HEAD
 1.23.6.1 12-Feb-2005  yamt sync with head.
 1.23.4.1 29-Apr-2005  kent sync with -current
 1.25.2.2 27-Oct-2007  yamt sync with head.
 1.25.2.1 21-Jun-2006  yamt sync with head.
 1.26.6.1 22-Apr-2006  simonb Sync with head.
 1.26.4.1 09-Sep-2006  rpaulo sync with head
 1.26.2.1 01-Mar-2006  yamt sync with head.
 1.28.44.1 25-Oct-2007  bouyer Sync with HEAD.
 1.28.40.1 06-Nov-2007  matt sync with HEAD
 1.28.38.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.28.24.1 23-Oct-2007  ad Sync with head.
 1.29.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.31.4.4 11-Mar-2010  yamt sync with head
 1.31.4.3 16-May-2009  yamt sync with head
 1.31.4.2 04-May-2009  yamt sync with head.
 1.31.4.1 16-May-2008  yamt sync with head.
 1.31.2.1 18-May-2008  yamt sync with head.
 1.32.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.33.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.35.80.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.36.4.1 31-May-2021  cjep sync with head
 1.36.2.1 13-May-2021  thorpej Sync with HEAD.
 1.37.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.57 28-Mar-2022  riastradh sys: Split struct device into a private device_impl.h.

Include this only inside autoconf itself, and a few files that abuse
autoconf in ways I can't confidently make easy fixes for.

XXX kernel ABI change requires bump -- no more use of struct device
internals allowed, previously done by some drivers
 1.56 23-Feb-2021  mrg introduce DDB_END_CMD and replace more than 20 copies of the same
list of NULLs and 0. idea from rillig@.

all touched ports built, several booted.
 1.55 10-Nov-2019  chs branches: 1.55.8;
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.54 06-Feb-2018  mrg branches: 1.54.4;
db_esp() has a missing {} issue in debug code.
 1.53 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.52 12-Sep-2013  martin Remove unused variable
 1.51 17-Sep-2009  tsutsui branches: 1.51.12; 1.51.22; 1.51.26;
Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.50 08-Sep-2009  tsutsui sbus_establish() should take device_t self for the device itself,
not device_t parent even if sbus is grandparent of the device,
otherwise (*sd_reset)() callbacks will be called with an wrong device_t.
Even in such case, sbus_establish() looks for an sbus though device tree.
XXX: (*sd_reset)() isn't called anyway, and these stuff seems really bogus.
 1.49 08-Sep-2009  tsutsui Fix botch on device_t/softc split caused by awful casts around
registration of (*sd_reset)(device_t) in struct sbusdev via sbus_establish().

XXX: (*sd_reset)() in struct sbusdev seems called from only sbusreset(),
XXX: but there is no function which calls sbusreset()???
 1.48 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.47 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.46 28-Apr-2008  martin branches: 1.46.14;
Remove clause 3 and 4 from TNF licenses
 1.45 23-Apr-2008  tsutsui branches: 1.45.2;
Since device_t is split out from softc, we have to allocate struct device
separately after allocating struct lsi64854_softc to fake it. (untested)

"lsc->sc_dev is not initialized" is pointed out by martin@.
 1.44 13-Apr-2008  tsutsui branches: 1.44.2;
Split device_t/softc for MI ncr53c9x and some related devices,
with various cleanup.
 1.43 05-Apr-2008  cegger use aprint_*_dev and device_xname
 1.42 08-Mar-2008  mjacob Don't panic if you can't find the corresponding DMA device- just don't
configure the device.

It turns out that if you have a SUNW,fas card installed, the assumption
that dma devices pair with esp devices is then broken, but that's a problem
to fix another day.
 1.41 13-Feb-2008  simonb branches: 1.41.2; 1.41.6;
KNF previous change.
 1.40 13-Feb-2008  dogcow make it compile.
 1.39 12-Feb-2008  joerg Introduce device_find_by_xname and device_find_by_driver_unit to replace
alldevs iterations all over src.

Patch discussed with and improved on suggestioned from cube@.
 1.38 19-Oct-2007  ad branches: 1.38.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.37 22-Sep-2007  martin branches: 1.37.4;
Add a ddb command table at first attach to register "mach esp".
 1.36 04-Mar-2007  christos branches: 1.36.2; 1.36.14; 1.36.16;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.35 28-Mar-2006  thorpej branches: 1.35.14;
Use device_unit().
 1.34 25-Mar-2006  thorpej Use device_parent().
 1.33 11-Dec-2005  christos branches: 1.33.4; 1.33.6; 1.33.8; 1.33.10; 1.33.12;
merge ktrace-lwp.
 1.32 01-Jun-2005  jdc branches: 1.32.2;
Add const (catching up with additions to MI ddb code).
 1.31 27-Feb-2005  perry nuke trailing whitespace
 1.30 04-Feb-2005  perry de-__P
 1.29 17-Mar-2004  pk branches: 1.29.8; 1.29.10;
Rename PROM_getprop*() => prom_getprop*().
 1.28 22-Feb-2003  tsutsui branches: 1.28.2;
hz -> Hz
 1.27 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.26 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.25 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.24 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.23 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.22 25-Sep-2002  mycroft Additional fixes to make 16 targets work on FAS366.
 1.21 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.20 21-Mar-2002  eeh branches: 1.20.2; 1.20.4; 1.20.6;
Fixup attachment code to use sbus_promaddr_to_handle() and not specify
BUS_SPACE_MAP_LINEAR.
 1.19 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.18 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.17 13-Nov-2001  lukem add RCSIDs
 1.16 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.15 11-Sep-2001  pk The `ESC' DMA chip must be reset before we can access the esp registers.
 1.14 25-Apr-2001  bouyer branches: 1.14.2; 1.14.4;
Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.13 29-Mar-2001  petrov fas support added
 1.12 03-Dec-2000  eeh branches: 1.12.2;
Turn on TAG QUEUE support and add some debug stuff.
 1.11 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.10 05-Jun-2000  nisimura branches: 1.10.2;
Have MI ncr53c9x_attach() the 2nd and 3rd arguments for scsipi_adater
and scsipi_device respectively, with size reduction of ncr53c9x_softc.
Specifying NULL instructs the driver to use default adapter and default
device codes. Every target port has ncr53c9x_attach(sc, NULL, NULL) anyway.
 1.9 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.8 11-Jan-2000  pk branches: 1.8.2;
Remove old-style boot device recognition.
 1.7 21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.6 26-Mar-1999  mjacob branches: 1.6.8; 1.6.14;
Add support for the PTI SBS430. It's a FAS200 type chip- it's a bit funky
in that the registers aren't spread by a longword like all the other SBus/ESP
cards. Otherwise it's much the same. It'll make Brad Salai happy.
 1.5 19-Nov-1998  thorpej Adapt to the new scsipi_adapter interface.
 1.4 10-Oct-1998  thorpej Garbage-collect the open_target_lu and close_target_lu entry points from
struct scsipi_adapter; they were not used.

Add a scsipi_ioctl entry point to struct scsipi_adapter. This will be
used to issue ioctl commands to the host adapters.

Inspired by PR #6090, from Matt Jacob.
 1.3 15-Sep-1998  pk bootpath check needs to keep checking for two formats.
 1.2 29-Aug-1998  pk Adjust for some small changes in lsi64854 back-end driver.
 1.1 29-Aug-1998  pk Use bus_space_*() to access device registers.
Add `esp' and `le' DMA engine.
 1.6.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.8.5 21-Apr-2001  bouyer Sync with HEAD
 1.6.8.4 08-Dec-2000  bouyer Sync with HEAD.
 1.6.8.3 27-Nov-2000  bouyer Make it work again.
 1.6.8.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.8.1 19-Oct-1999  thorpej Adapt for scsipi API changes.
 1.8.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.10.2.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.12.2.10 11-Dec-2002  thorpej Sync with HEAD.
 1.12.2.9 18-Oct-2002  nathanw Catch up to -current.
 1.12.2.8 27-Aug-2002  nathanw Catch up to -current.
 1.12.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.12.2.6 08-Jan-2002  nathanw Catch up to -current.
 1.12.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.12.2.4 08-Oct-2001  nathanw Catch up to -current.
 1.12.2.3 21-Sep-2001  nathanw Catch up to -current.
 1.12.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.12.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.14.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.14.2.6 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.14.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.14.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.14.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.20.6.2 22-Nov-2002  tron Pull up revision 1.22 (requested by martin in ticket #948):
Additional fixes to make 16 targets work on FAS366.
 1.20.6.1 22-Nov-2002  tron Pull up revision 1.21 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.20.4.1 29-Aug-2002  gehenna catch up with -current.
 1.20.2.1 26-Mar-2002  eeh Match and attach through devprops.
 1.28.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.28.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.28.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.28.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.28.2.1 03-Aug-2004  skrll Sync with HEAD
 1.29.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.29.10.1 12-Feb-2005  yamt sync with head.
 1.29.8.1 29-Apr-2005  kent sync with -current
 1.32.2.5 17-Mar-2008  yamt sync with head.
 1.32.2.4 27-Feb-2008  yamt sync with head.
 1.32.2.3 27-Oct-2007  yamt sync with head.
 1.32.2.2 03-Sep-2007  yamt sync with head.
 1.32.2.1 21-Jun-2006  yamt sync with head.
 1.33.12.2 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.33.12.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.33.10.1 19-Apr-2006  elad sync with head.
 1.33.8.1 01-Apr-2006  yamt sync with head.
 1.33.6.1 22-Apr-2006  simonb Sync with head.
 1.33.4.1 09-Sep-2006  rpaulo sync with head
 1.35.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.36.16.2 23-Mar-2008  matt sync with HEAD
 1.36.16.1 06-Nov-2007  matt sync with HEAD
 1.36.14.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.36.14.1 02-Oct-2007  joerg Sync with HEAD.
 1.36.2.2 23-Oct-2007  ad Sync with head.
 1.36.2.1 09-Oct-2007  ad Sync with head.
 1.37.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.38.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.41.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.41.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.41.2.1 24-Mar-2008  keiichi sync with head.
 1.44.2.1 18-May-2008  yamt sync with head.
 1.45.2.4 11-Mar-2010  yamt sync with head
 1.45.2.3 16-Sep-2009  yamt sync with head
 1.45.2.2 16-May-2009  yamt sync with head
 1.45.2.1 16-May-2008  yamt sync with head.
 1.46.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.51.26.1 18-May-2014  rmind sync with head
 1.51.22.2 03-Dec-2017  jdolecek update from HEAD
 1.51.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.51.12.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.54.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.55.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.45 19-Jul-2023  macallan - make colour depth in fb mode configurable, default to 8bit
- support ioctl(FBIO*CMAP)
 1.44 08-May-2019  isaki Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.43 06-Sep-2018  maxv branches: 1.43.2;
Retire the 'midway' driver. Discussed on tech-net@ recently and also three
years ago, part of removing the network ATM code.
 1.42 11-Feb-2016  macallan branches: 1.42.16; 1.42.18;
switch to 32bit colour in WSDISPLAYIO_MODE_MAPPED, now X with wsfb will work
Not optimal though - for some reason the framebuffer's endianness in 32bit
colour is wrong and I have no idea (yet) how to change that, so many apps
using xrender will crash.
 1.41 04-Jan-2015  macallan support hardware acceleration, adapted from OpenBSD
TODO: figure out how to do host blits so we can get away without mapping the
framebuffer
 1.40 16-Dec-2014  macallan first draft of a driver for SMSI,mgx
More or less an Alliance Semiconductors ProMotion AT24 with some PCI-SBus
glue and 4MB framebuffer. No acceleration yet, just enough wsdisplay/vcons
setup and DAC programming to be functional.
 1.39 20-Oct-2012  macallan branches: 1.39.14;
- only sync the drawing engine when we're about to access video memory
- use the blitter to draw the cursor
- use the glyphcache to minimize vram access
-> about 15% to 20% speedup
 1.38 21-Sep-2012  macallan support anti-aliased fonts, glyph caching etc.
 1.37 18-Aug-2010  macallan branches: 1.37.8; 1.37.18;
- add support for running the console in 8 bit colour
- make shadow fb optional
- use VCONS_DONT_READ if there's no shadow fb
 1.36 24-Mar-2010  macallan first stab at a driver for the cg12 / matrox cg3
for now it uses the same monochrome overlay as OBP, otherwise it's got the
usual wsdisplay / vcons goodies
TODO:
- fill in mmap and ioctl methods so we can at least run X in monochrome
- figure out where the 24bit buffer is ( and maybe if there's an 8 bit buffer )
- see if we can do any acceleration
- find the DAC registers
 1.35 01-Mar-2010  macallan branches: 1.35.2;
make latching optional.
The SPARCbook docs claim it's necessary but my 3GX happily works without.
 1.34 27-Jan-2010  macallan branches: 1.34.2;
tcx doesn't use bt_dac
 1.33 06-Aug-2009  macallan make the tcx driver do something useful:
- attach a wsdisplay
- make it work with an S24
- accelerate scrolling and character drawing
This isn't quite finished yet, it works fine as a console but most things
X will need are not functional right now.
 1.32 23-Apr-2009  macallan Add wscons support
 1.31 26-Aug-2007  macallan branches: 1.31.26; 1.31.34; 1.31.36; 1.31.40; 1.31.44;
add a driver for Fujitsu AG-10e graphics boards
Features so far:
- use the blitter for scrolling and solid fills
- the usual wscons stuff, virtual consoles etc.
Things missing:
- /dev/fb* support
- XFree86 support although wsfb in 8bit should work
- hardware cursor support for X
- character drawing in hardware so we can run the blitter completely
asynchronous
 1.30 20-Jul-2007  macallan branches: 1.30.4; 1.30.6;
pull in mulaw with dbri
Although dbri supports mulaw and a-law in hardware we can unly use it in mono
so for 8bit stereo we need to use sw encoding
 1.29 11-Apr-2007  macallan branches: 1.29.4;
add an sbus frontend fro genfb
in theory this should work on any SBus framebuffer
tested on various cgsix and p9100, needs to be tested on more hardware
 1.28 14-Mar-2007  macallan - add dummy input methods so we don't panic if someone tries to read
- add dummy input mixer controls
- restart tx DMA on PWR_RESUME
- power up on PWR_RESUME only if we really have to
- add an option to control wether to spin or sleep when waiting for the chip
to switch between data and control mode
 1.27 11-Mar-2007  macallan branches: 1.27.2;
don't pull in stuff we don't actually use:
- nuke mulaw from dbri
- nuke rasops16 and rasops32 from pnozz
 1.26 24-Nov-2006  martin branches: 1.26.4; 1.26.8;
Snapshot of work in progress gem @ sbus attachement. Don't use at home
yet!
Thanks to Steve Rikli for providing hardware and test equipement,
and to uwe for a lot help understanding the hardware.
 1.25 09-Mar-2006  macallan branches: 1.25.10; 1.25.12;
keep the chip powered down when not in use on machines that support it
( like SPARCbooks ) - needs testing on other machines
tested on my SPARCbook 3GX
 1.24 09-Mar-2006  macallan this should have been committed with p9100.*
add the vcons attribute to pnozz
 1.23 11-Dec-2005  christos branches: 1.23.4; 1.23.6; 1.23.8; 1.23.10;
merge ktrace-lwp.
 1.22 16-Jul-2005  macallan driver for the audio part of SUNW,DBRI ISDN/audio controllers
 1.21 16-May-2005  macallan branches: 1.21.2;
Added:
- wscons support
- acceleration
- virtual consoles
- colour
- made cg3 emulation optional for native XFree driver
 1.20 27-Feb-2005  perry branches: 1.20.2;
nuke trailing whitespace
 1.19 24-Jul-2004  mrg branches: 1.19.4; 1.19.6;
Hauke Fath's port of the openbsd SUNW,spif driver from PR#26061.
the driver was originally written by Jason L. Wright.

XXX: i haven't tested this on sparc64 at all...
 1.18 13-Sep-2002  ad branches: 1.18.6;
Driver for the Sun ZX/Leo framebuffer. This would be called leo, but the
amiga port already has a driver by that name.
 1.17 03-Oct-2001  mrg frontend driver for the 16 port serial card by aurora technologies. this
doesn't quite work yet -- interrupt acknowledgement is hosed (and thus the
device keeps interrupting). uses the newly commited cd18xx backend.
 1.16 08-Dec-2000  martin branches: 1.16.2; 1.16.4; 1.16.6;
Remove esp specific function from ddb when esp @ sbus is not included
in the kernel config. Makes compiling sbus-less kernels possible again.
 1.15 22-Aug-2000  pk Declare drivers moved here from arch/sparc.
 1.14 25-Mar-2000  mycroft Move esp declaration to conf/files.
 1.13 27-Jun-1999  pk branches: 1.13.2;
Add the Sbus front-end for the HME driver.
 1.12 05-Jun-1999  mrg split sbus audiocs code up so we can share it with the ebus. XXX ebus DMA is probably different.
 1.11 17-Jan-1999  pk branches: 1.11.4;
Add `qe' network interface device.
 1.10 26-Nov-1998  pk Use `pcmciabus' to attach the Sbus to PCMCIA bridge.
 1.9 22-Nov-1998  pk Define STP4020 chipset driver by its nickname `nell'.
XXX - also define a `pcic' attribute here, so we can attach a pcmcia bus
 1.8 23-Sep-1998  pk Make dma_sbus.c dependent on dma_sbus attribute.
 1.7 21-Sep-1998  pk Add `bpp' device: the parallel port glued onto the LSI64854 DMA controller.
 1.6 29-Aug-1998  pk Use bus_space_*() to access device registers.
Add `esp' and `le' DMA engine.
 1.5 27-Aug-1998  pk Add audiocs.
 1.4 27-Aug-1998  mrg move isp_sbus attachment into /sys/dev/sbus.
 1.3 28-Jul-1998  pk Magma driver has been moved to <dev/sbus>
 1.2 27-Jul-1998  pk Add `le at sbus', `le at lebuffer' and `en at sbus'.
 1.1 27-Jul-1998  pk sbus configuration file.
 1.11.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.11.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.13.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.16.6.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.16.4.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.16.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.16.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.18.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.18.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.6.1 03-Aug-2004  skrll Sync with HEAD
 1.19.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.4.1 29-Apr-2005  kent sync with -current
 1.20.2.1 08-Jun-2005  tron Pull up revision 1.21 (requested by martin in ticket #379):
Added:
- wscons support
- acceleration
- virtual consoles
- colour
- made cg3 emulation optional for native XFree driver
 1.21.2.3 03-Sep-2007  yamt sync with head.
 1.21.2.2 30-Dec-2006  yamt sync with head.
 1.21.2.1 21-Jun-2006  yamt sync with head.
 1.23.10.1 19-Apr-2006  elad sync with head.
 1.23.8.1 13-Mar-2006  yamt sync with head.
 1.23.6.1 22-Apr-2006  simonb Sync with head.
 1.23.4.1 09-Sep-2006  rpaulo sync with head
 1.25.12.1 10-Dec-2006  yamt sync with head.
 1.25.10.1 12-Jan-2007  ad Sync with head.
 1.26.8.5 09-Oct-2007  ad Sync with head.
 1.26.8.4 20-Aug-2007  ad Sync with HEAD.
 1.26.8.3 27-May-2007  ad Sync with head.
 1.26.8.2 10-Apr-2007  ad Sync with head.
 1.26.8.1 13-Mar-2007  ad Sync with head.
 1.26.4.3 15-Apr-2007  yamt sync with head.
 1.26.4.2 24-Mar-2007  yamt sync with head.
 1.26.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.27.2.1 11-Jul-2007  mjf Sync with head.
 1.29.4.2 03-Sep-2007  skrll Sync with HEAD.
 1.29.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.30.6.2 20-Jul-2007  macallan pull in mulaw with dbri
Although dbri supports mulaw and a-law in hardware we can unly use it in mono
so for 8bit stereo we need to use sw encoding
 1.30.6.1 20-Jul-2007  macallan file files.sbus was added on branch matt-mips64 on 2007-07-20 22:23:09 +0000
 1.30.4.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.31.44.1 21-Apr-2010  matt sync to netbsd-5
 1.31.40.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.31.36.2 18-Oct-2009  bouyer Back out ticket 960
 1.31.36.1 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #960):
sys/dev/sbus/zxreg.h: revision 1.7
sys/dev/sbus/files.sbus: revision 1.32
sys/dev/sbus/zxvar.h: revision 1.4
sys/dev/sbus/zx.c: revision 1.27
Add wscons support
 1.31.34.1 28-Apr-2009  skrll Sync with HEAD.
 1.31.26.5 09-Oct-2010  yamt sync with head
 1.31.26.4 11-Aug-2010  yamt sync with head.
 1.31.26.3 11-Mar-2010  yamt sync with head
 1.31.26.2 19-Aug-2009  yamt sync with head.
 1.31.26.1 04-May-2009  yamt sync with head.
 1.34.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.34.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.35.2.2 05-Mar-2011  rmind sync with head
 1.35.2.1 30-May-2010  rmind sync with head
 1.37.18.2 03-Dec-2017  jdolecek update from HEAD
 1.37.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.37.8.1 30-Oct-2012  yamt sync with head
 1.39.14.2 19-Mar-2016  skrll Sync with HEAD
 1.39.14.1 06-Apr-2015  skrll Sync with HEAD
 1.42.18.1 10-Jun-2019  christos Sync with HEAD
 1.42.16.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.43.2.2 05-May-2019  isaki Remove obsoleted au{,rate,vol}conv and mulaw attributes.
audio provides the equivalent of them inseparably.
 1.43.2.1 01-May-2019  isaki Adapt dbri to audio2.
- Add some mutex_enter/exit.
- Remove DBRI_BIG_BUFFER option. Such big buffer will not necessary
in audio2.
Thank you, macallan@.
 1.14 04-Oct-2025  thorpej Use device_{get,set}prop_bool() for "is_console".
 1.13 06-Sep-2020  riastradh uvm/uvm_extern.h, not machine/pmap.h, for pmap(9). Sort includes.
 1.12 05-Sep-2020  riastradh Round of uvm.h cleanup.

The poorly named uvm.h is generally supposed to be for uvm-internal
users only.

- Narrow it to files that actually need it -- mostly files that need
to query whether curlwp is the pagedaemon, which should maybe be
exposed by an external header.

- Use uvm_extern.h where feasible and uvm_*.h for things not exposed
by it. We should split up uvm_extern.h but this will serve for now
to reduce the uvm.h dependencies.

- Use uvm_stat.h and #ifdef UVMHIST uvm.h for files that use
UVMHIST(ubchist), since ubchist is declared in uvm.h but the
reference evaporates if UVMHIST is not defined, so we reduce header
file dependencies.

- Make uvm_device.h and uvm_swap.h independently includable while
here.

ok chs@
 1.11 24-Jul-2014  riastradh Add enable/disable polling hooks to genfb_ops.
 1.10 07-Oct-2010  macallan branches: 1.10.18; 1.10.32;
finish device_t-ification
 1.9 18-Sep-2009  tsutsui branches: 1.9.2; 1.9.4;
- use device_private(), proper types and variables for device_t/softc
- remove unnecessary casts against void pointer

XXX: many inconsistent use of aprint_*(9) and printf(9)
 1.8 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.7 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.6 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.5 29-Apr-2008  martin branches: 1.5.14;
Convert to new 2 clause license
 1.4 05-Apr-2008  cegger branches: 1.4.2; 1.4.4;
use aprint_*_dev and device_xname
 1.3 19-Oct-2007  ad branches: 1.3.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.2 05-Aug-2007  macallan branches: 1.2.2; 1.2.4; 1.2.8; 1.2.10;
fix typo - fbsize is /height/ * stride. Doh.
 1.1 11-Apr-2007  macallan branches: 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.14;
add an sbus frontend fro genfb
in theory this should work on any SBus framebuffer
tested on various cgsix and p9100, needs to be tested on more hardware
 1.1.14.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.1.14.1 09-Aug-2007  jmcneill Sync with HEAD.
 1.1.10.1 15-Aug-2007  skrll Sync with HEAD.
 1.1.8.2 11-Jul-2007  mjf Sync with head.
 1.1.8.1 11-Apr-2007  mjf file genfb_sbus.c was added on branch mjf-ufs-trans on 2007-07-11 20:08:14 +0000
 1.1.6.4 23-Oct-2007  ad Sync with head.
 1.1.6.3 20-Aug-2007  ad Sync with HEAD.
 1.1.6.2 09-Jun-2007  ad Sync with head.
 1.1.6.1 11-Apr-2007  ad file genfb_sbus.c was added on branch vmlocking on 2007-06-09 21:37:25 +0000
 1.1.4.2 15-Apr-2007  yamt sync with head.
 1.1.4.1 11-Apr-2007  yamt file genfb_sbus.c was added on branch yamt-idlelwp on 2007-04-15 16:03:31 +0000
 1.2.10.2 05-Aug-2007  macallan fix typo - fbsize is /height/ * stride. Doh.
 1.2.10.1 05-Aug-2007  macallan file genfb_sbus.c was added on branch matt-mips64 on 2007-08-05 03:23:03 +0000
 1.2.8.1 25-Oct-2007  bouyer Sync with HEAD.
 1.2.4.3 27-Oct-2007  yamt sync with head.
 1.2.4.2 03-Sep-2007  yamt sync with head.
 1.2.4.1 05-Aug-2007  yamt file genfb_sbus.c was added on branch yamt-lazymbuf on 2007-09-03 14:38:30 +0000
 1.2.2.1 06-Nov-2007  matt sync with HEAD
 1.3.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.4.4 09-Oct-2010  yamt sync with head
 1.4.4.3 11-Mar-2010  yamt sync with head
 1.4.4.2 16-May-2009  yamt sync with head
 1.4.4.1 16-May-2008  yamt sync with head.
 1.4.2.1 18-May-2008  yamt sync with head.
 1.5.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.9.4.1 05-Mar-2011  rmind sync with head
 1.9.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.10.32.1 10-Aug-2014  tls Rebase.
 1.10.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30 06-Sep-2018  maxv Retire the 'midway' driver. Discussed on tech-net@ recently and also three
years ago, part of removing the network ATM code.
 1.29 18-Jul-2011  mrg branches: 1.29.52; 1.29.54;
convert the remaining dev/sbus drivers to CFATTACH_DECL_NEW, cfdata_t
and device_t, including the pci frontend and backend for en(4).
 1.28 01-Feb-2011  chuck 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.27 18-Sep-2009  tsutsui branches: 1.27.4; 1.27.6; 1.27.8;
- use device_private(), proper types and variables for device_t/softc
- remove unnecessary casts against void pointer

XXX: many inconsistent use of aprint_*(9) and printf(9)
 1.26 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.25 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.24 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.23 05-Apr-2008  cegger branches: 1.23.4; 1.23.18;
use aprint_*_dev and device_xname
 1.22 19-Oct-2007  ad branches: 1.22.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.21 11-Dec-2005  christos branches: 1.21.30; 1.21.44; 1.21.46; 1.21.50;
merge ktrace-lwp.
 1.20 27-Feb-2005  perry branches: 1.20.4;
nuke trailing whitespace
 1.19 04-Feb-2005  perry de-__P
 1.18 10-Dec-2002  pk branches: 1.18.6; 1.18.14; 1.18.16;
Remove the `flags' argument from bus_intr_establish().
 1.17 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.16 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.15 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14 20-Mar-2002  eeh Get rid of unnecessary BUS_SPACE_MAP_LINEAR.
 1.13 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.12 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.11 13-Nov-2001  lukem add RCSIDs
 1.10 09-Jul-2000  pk branches: 1.10.2; 1.10.4;
Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.9 21-Nov-1999  pk branches: 1.9.4;
Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.8 29-Mar-1999  cjs branches: 1.8.8; 1.8.14;
Make `sun4m DMA not supported yet' message print only for this device,
rather than every sbus device probed.
 1.7 20-Aug-1998  pk Remove vestiges of sparc-specific interrupt handling.
 1.6 27-Jul-1998  pk Moved to dev/sbus from arch/sparc/dev
Get headers from <dev/sbus>
 1.5 21-Mar-1998  pk Account for changed bus attachment scheme.
 1.4 24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.3 13-Oct-1996  christos backout previous kprintf change
 1.2 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.1 22-Jun-1996  chuck sbus specific stuff for eni155s sbus atm card.
XXX: only works on sun4c, needs something better than vtophys() for
machines with IOMMUs(?).
 1.8.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.4.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.10.4.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.10.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.10.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.10.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.2.5 11-Dec-2002  thorpej Sync with HEAD.
 1.10.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.10.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.10.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.10.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.18.16.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.18.16.1 12-Feb-2005  yamt sync with head.
 1.18.14.1 29-Apr-2005  kent sync with -current
 1.18.6.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.18.6.1 04-Feb-2005  skrll Sync with HEAD.
 1.20.4.1 27-Oct-2007  yamt sync with head.
 1.21.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.21.46.1 06-Nov-2007  matt sync with HEAD
 1.21.44.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.21.30.1 23-Oct-2007  ad Sync with head.
 1.22.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.4.2 11-Mar-2010  yamt sync with head
 1.23.4.1 16-May-2009  yamt sync with head
 1.27.8.1 08-Feb-2011  bouyer Sync with HEAD
 1.27.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.27.4.1 05-Mar-2011  rmind sync with head
 1.29.54.1 10-Jun-2019  christos Sync with HEAD
 1.29.52.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.15 15-Oct-2025  thorpej These drivers can use ether_getaddr() instead of prom_getether() now.
 1.14 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.13 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.12 04-Aug-2009  martin Fix small oversight in device_t/softc split. Pointed out by <jdc>.
 1.11 27-Jul-2009  dyoung Do a complete device_t/softc split for the PCI attachment. I have
not finished the device_t/softc split for the SBus attachment
because I don't have an SBus gem(4) to test with.

Convert from legacy shutdownhooks to a PMF shutdown hook. Add PMF
suspend/resume handlers.

Factor a detachment hook out of gem_attach(). During device
attachment, track which resources are reserved in sc_attach_state,
and release only those resources during detachment.

Tested on gem0 and gem1 at pci1 on a Sun Fire V120.
 1.10 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.9 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.8 20-Nov-2008  jdc branches: 1.8.4;
Read the chip revision from the Sbus register.
 1.7 06-May-2008  jdc branches: 1.7.6; 1.7.8;
Add more initialisation steps (read reset register; pause; set burst size
in config register).

This fixes the continuous interrupt stream previously seen. It is now
possible to run `ifconfig gem0 up`. However, "gem0: device timeout"
messages appear and we don't appear to receive any interrupts.
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 28-Apr-2008  jdc Set (and display) the chip revision.
Set the GEM_SUN_GEM flag.
 1.4 05-Apr-2008  cegger branches: 1.4.2; 1.4.4;
use aprint_*_dev and device_xname
 1.3 22-Mar-2008  jdc Check the "shared-pins" property for the value "serdes".
Makes SBUS GEM 1000Base-SX cards attach.
 1.2 19-Oct-2007  ad branches: 1.2.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.1 24-Nov-2006  martin branches: 1.1.4; 1.1.6; 1.1.8; 1.1.14; 1.1.28; 1.1.30; 1.1.34;
Snapshot of work in progress gem @ sbus attachement. Don't use at home
yet!
Thanks to Steve Rikli for providing hardware and test equipement,
and to uwe for a lot help understanding the hardware.
 1.1.34.1 25-Oct-2007  bouyer Sync with HEAD.
 1.1.30.1 06-Nov-2007  matt sync with HEAD
 1.1.28.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.1.14.1 23-Oct-2007  ad Sync with head.
 1.1.8.2 12-Jan-2007  ad Sync with head.
 1.1.8.1 24-Nov-2006  ad file if_gem_sbus.c was added on branch newlock2 on 2007-01-12 00:57:48 +0000
 1.1.6.4 24-Mar-2008  yamt sync with head.
 1.1.6.3 27-Oct-2007  yamt sync with head.
 1.1.6.2 30-Dec-2006  yamt sync with head.
 1.1.6.1 24-Nov-2006  yamt file if_gem_sbus.c was added on branch yamt-lazymbuf on 2006-12-30 20:49:33 +0000
 1.1.4.2 10-Dec-2006  yamt sync with head.
 1.1.4.1 24-Nov-2006  yamt file if_gem_sbus.c was added on branch yamt-splraiseipl on 2006-12-10 07:18:15 +0000
 1.2.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.2.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.2.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.4.4.5 11-Mar-2010  yamt sync with head
 1.4.4.4 19-Aug-2009  yamt sync with head.
 1.4.4.3 16-May-2009  yamt sync with head
 1.4.4.2 04-May-2009  yamt sync with head.
 1.4.4.1 16-May-2008  yamt sync with head.
 1.4.2.1 18-May-2008  yamt sync with head.
 1.7.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.35 15-Oct-2025  thorpej These drivers can use ether_getaddr() instead of prom_getether() now.
 1.34 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.33 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.32 08-Sep-2009  tsutsui Fix botch on device_t/softc split caused by awful casts around
registration of (*sd_reset)(device_t) in struct sbusdev via sbus_establish().

XXX: (*sd_reset)() in struct sbusdev seems called from only sbusreset(),
XXX: but there is no function which calls sbusreset()???
 1.31 17-May-2009  tsutsui u_intNN_t -> uintNN_t
 1.30 17-May-2009  tsutsui Split device_t/softc.
Tested PCI HME on i386. Sbus HME is compile test only.
 1.29 17-May-2009  tsutsui Use device_private() to get struct sbus_softc from device_t parent.

XXX: sbus_softc has been split from device_t on sparc, but not on sparc64!?
 1.28 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.27 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.26 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.25 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.24 28-Apr-2008  martin branches: 1.24.8; 1.24.14;
Remove clause 3 and 4 from TNF licenses
 1.23 05-Apr-2008  cegger branches: 1.23.2; 1.23.4;
use aprint_*_dev and device_xname
 1.22 19-Oct-2007  ad branches: 1.22.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.21 11-Dec-2005  christos branches: 1.21.30; 1.21.44; 1.21.46; 1.21.50;
merge ktrace-lwp.
 1.20 04-Feb-2005  perry branches: 1.20.6;
de-__P
 1.19 17-Mar-2004  pk branches: 1.19.8; 1.19.10;
Rename PROM_getprop*() => prom_getprop*().
 1.18 15-Mar-2004  pk Replace myetheraddr() by prom_getether().
 1.17 10-Dec-2002  pk branches: 1.17.6;
Remove the `flags' argument from bus_intr_establish().
 1.16 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.15 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.14 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.13 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.12 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.11 20-Mar-2002  eeh branches: 1.11.4; 1.11.6;
Get rid of unnecessary BUS_SPACE_MAP_LINEAR.
 1.10 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.9 13-Nov-2001  lukem add RCSIDs
 1.8 05-Oct-2001  thorpej Minor tidying up of the HME driver attach:
- Print nicer-looking message.
- Use bus_space_subregion() when appropriate, rather than arithmetic
on a bus_space_handle_t.
 1.7 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.6 28-Feb-2001  mrg branches: 1.6.2; 1.6.4; 1.6.6;
match SUNW,qfe; PR#12301 from Rob Quinn <rquinn@sprint.net>
 1.5 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.4 25-Jun-2000  eeh Get PCI HME working.
 1.3 21-Nov-1999  pk branches: 1.3.4;
Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.2 04-Nov-1999  mrg find "SUNW,hme" as well as "hme". this matches the onboard
ultra2 hme. haven't actually tested this beyond it probing
because my scsibus is hanging. anyway, it reports:

hme0 at sbus0 slot 14 offset 0x8c00000 vector 21 ipl 6: address 08:00:20:8f:7f:8f
 1.1 27-Jun-1999  pk branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10;
Add the Sbus front-end for the HME driver.
 1.1.10.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.6.1 15-Nov-1999  fvdl Sync with -current
 1.1.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.1.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.1.2.1 27-Jun-1999  thorpej file if_hme_sbus.c was added on branch chs-ubc2 on 1999-07-01 23:36:01 +0000
 1.3.4.2 31-Jul-2000  mrg pull up 1.5 (approved by thorpej):
>Get PCI HME working.
 1.3.4.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.6.6.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.6.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.6.4.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.6.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.6.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.6.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.6.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.6.2.5 27-Aug-2002  nathanw Catch up to -current.
 1.6.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.6.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.6.2.2 22-Oct-2001  nathanw Catch up to -current.
 1.6.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.11.6.1 22-Nov-2002  tron Pull up revision 1.12 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.11.4.1 29-Aug-2002  gehenna catch up with -current.
 1.17.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.17.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.6.1 03-Aug-2004  skrll Sync with HEAD
 1.19.10.1 12-Feb-2005  yamt sync with head.
 1.19.8.1 29-Apr-2005  kent sync with -current
 1.20.6.1 27-Oct-2007  yamt sync with head.
 1.21.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.21.46.1 06-Nov-2007  matt sync with HEAD
 1.21.44.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.21.30.1 23-Oct-2007  ad Sync with head.
 1.22.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.4.6 11-Mar-2010  yamt sync with head
 1.23.4.5 16-Sep-2009  yamt sync with head
 1.23.4.4 20-Jun-2009  yamt sync with head
 1.23.4.3 16-May-2009  yamt sync with head
 1.23.4.2 04-May-2009  yamt sync with head.
 1.23.4.1 16-May-2008  yamt sync with head.
 1.23.2.1 18-May-2008  yamt sync with head.
 1.24.14.2 23-Jul-2009  jym Sync with HEAD.
 1.24.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.24.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.44 15-Oct-2025  thorpej These drivers can use ether_getaddr() instead of prom_getether() now.
 1.43 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.42 29-May-2022  rin Audit unload/unmap v.s. free against DMA buffer for sys/dev;
make sure that bus_dmamap_unload(9) [or bus_dmamap_destroy(9)] or
bus_dmamem_unmap(9) are preceding to freeing DMA buffer, if it is
loaded or mapped, respectively.

This is mandatory for some archs. See, e.g.:

http://www.nerv.org/netbsd/?q=id:20210511T013030Z.013443cc790088147e4beed43f53dedabeaf9312
http://www.nerv.org/netbsd/?q=id:20220511T172220Z.561179f0b6fcc5b9cd73e274f69d74e2ce9e4c93

For some drivers, resource leaks for error paths are fixed at
the same time.

XXX XXX XXX
Compile test only (at least one arch per driver).
 1.41 29-May-2019  msaitoh KNF. No functional change.
 1.40 19-Jan-2010  pooka branches: 1.40.64;
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.39 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.38 16-Sep-2009  tsutsui Rewrite code which looks for an unallocated lebuffer and pairs it
with possible orphaned this le at sbus one on old PROMs not using
homegrown struct sbusdev but common cfdriver_t and device_t structures.
Now nothing refers struct sbusdev registered by sbus_establish().

Tested an SBus le/esp combo card on SS1+.
 1.37 08-Sep-2009  tsutsui Fix botch on device_t/softc split caused by awful casts around
registration of (*sd_reset)(device_t) in struct sbusdev via sbus_establish().

XXX: (*sd_reset)() in struct sbusdev seems called from only sbusreset(),
XXX: but there is no function which calls sbusreset()???
 1.36 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.35 04-Apr-2008  tsutsui branches: 1.35.2; 1.35.4;
Split device_t/softc for le(4) and variants and misc cosmetic changes.
 1.34 19-Oct-2007  ad branches: 1.34.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.33 04-Mar-2007  christos branches: 1.33.2; 1.33.14; 1.33.16; 1.33.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.32 11-Dec-2005  christos branches: 1.32.26;
merge ktrace-lwp.
 1.31 04-Feb-2005  perry branches: 1.31.6;
de-__P
 1.30 17-Mar-2004  pk branches: 1.30.8; 1.30.10;
Rename PROM_getprop*() => prom_getprop*().
 1.29 15-Mar-2004  pk Replace myetheraddr() by prom_getether().
 1.28 11-Nov-2003  pk Remove ancient DDB-dependent `hide/integrate'.
Simplify lewrcsr/lerdcsr; read-back after write doesn't hurt on sun4 so
skip the cpu type test in generic kernels.
 1.27 10-Dec-2002  pk branches: 1.27.6;
Remove the `flags' argument from bus_intr_establish().
 1.26 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.25 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.24 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.23 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.22 12-Sep-2002  tsutsui bus_dmamap_load() can't take BUS_DMA_COHERENT flag.
 1.21 20-Mar-2002  eeh Get rid of unnecessary BUS_SPACE_MAP_LINEAR.
 1.20 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.19 13-Nov-2001  lukem add RCSIDs
 1.18 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.17 30-May-2001  mrg branches: 1.17.2; 1.17.4;
use _KERNEL_OPT
 1.16 20-Oct-2000  mrg branches: 1.16.2;
ensure DMA mappings are not mapped streamable. fixes ethernet problems on
ultrasparc sbus class machines. from eeh.
 1.15 20-Oct-2000  mrg rework to use bus_dmamem_map() then bus_dmamem_load(), rather than
bus_dmamem_load_raw() then bus_dmamem_map().

tested on SS2 and SS5 and sbus cards.
 1.14 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.13 10-May-2000  pk branches: 1.13.4;
No need to specify page alignment; this is automatic.
 1.12 10-May-2000  pk Load DMA buffer before mapping it into kernel space.
 1.11 09-May-2000  pk Conform bus_dmamem_{alloc,map} usage to bus_dma(9) specs.
 1.10 11-Jan-2000  pk Remove old-style boot device recognition.
 1.9 21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.8 16-May-1999  mrg branches: 1.8.2; 1.8.8;
white space.
 1.7 29-Aug-1998  pk branches: 1.7.8;
Nuke unnecessary header files.
 1.6 29-Aug-1998  pk Use bus_space_*() to access device registers.
Add `esp' and `le' DMA engine.
 1.5 28-Aug-1998  pk XXX - BUS_DMA_BIT24 does not exist everywhere..
 1.4 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.3 30-Jul-1998  pk Enable bus_dmamem_alloc/bus_dmamem_map
 1.2 28-Jul-1998  pk branches: 1.2.2;
Supported medium is IFM_10_5
 1.1 27-Jul-1998  pk Lance front-ends on Sbus moved here.
 1.2.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.7.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.13.4.2 25-Oct-2000  tv Pullup 1.15 and 1.16 [mrg]:
rework to use bus_dmamem_map() then bus_dmamem_load(), rather than
bus_dmamem_load_raw() then bus_dmamem_map().

ensure DMA mappings are not mapped streamable. fixes ethernet problems on
ultrasparc sbus class machines. from eeh.
 1.13.4.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.16.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.16.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.16.2.5 17-Sep-2002  nathanw Catch up to -current.
 1.16.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.16.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.16.2.2 08-Oct-2001  nathanw Catch up to -current.
 1.16.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.17.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.17.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.17.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.17.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.17.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.27.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.27.6.1 03-Aug-2004  skrll Sync with HEAD
 1.30.10.1 12-Feb-2005  yamt sync with head.
 1.30.8.1 29-Apr-2005  kent sync with -current
 1.31.6.2 27-Oct-2007  yamt sync with head.
 1.31.6.1 03-Sep-2007  yamt sync with head.
 1.32.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.33.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.33.16.1 06-Nov-2007  matt sync with HEAD
 1.33.14.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.33.2.1 23-Oct-2007  ad Sync with head.
 1.34.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.35.4.3 11-Mar-2010  yamt sync with head
 1.35.4.2 16-Sep-2009  yamt sync with head
 1.35.4.1 16-May-2008  yamt sync with head.
 1.35.2.1 18-May-2008  yamt sync with head.
 1.40.64.1 10-Jun-2019  christos Sync with HEAD
 1.31 15-Oct-2025  thorpej These drivers can use ether_getaddr() instead of prom_getether() now.
 1.30 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.29 29-May-2019  msaitoh KNF. No functional change.
 1.28 19-Jan-2010  pooka branches: 1.28.64;
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.27 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.26 08-Sep-2009  tsutsui sbus_establish() should take device_t self for the device itself,
not device_t parent even if sbus is grandparent of the device,
otherwise (*sd_reset)() callbacks will be called with an wrong device_t.
Even in such case, sbus_establish() looks for an sbus though device tree.
XXX: (*sd_reset)() isn't called anyway, and these stuff seems really bogus.
 1.25 08-Sep-2009  tsutsui Fix botch on device_t/softc split caused by awful casts around
registration of (*sd_reset)(device_t) in struct sbusdev via sbus_establish().

XXX: (*sd_reset)() in struct sbusdev seems called from only sbusreset(),
XXX: but there is no function which calls sbusreset()???
 1.24 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.23 04-Apr-2008  tsutsui branches: 1.23.2; 1.23.4;
Split device_t/softc for le(4) and variants and misc cosmetic changes.
 1.22 19-Oct-2007  ad branches: 1.22.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.21 11-Dec-2005  christos branches: 1.21.30; 1.21.44; 1.21.46; 1.21.50;
merge ktrace-lwp.
 1.20 04-Feb-2005  perry branches: 1.20.6;
de-__P
 1.19 17-Mar-2004  pk branches: 1.19.8; 1.19.10;
Rename PROM_getprop*() => prom_getprop*().
 1.18 15-Mar-2004  pk Replace myetheraddr() by prom_getether().
 1.17 11-Nov-2003  pk Remove ancient DDB-dependent `hide/integrate'.
Simplify lewrcsr/lerdcsr; read-back after write doesn't hurt on sun4 so
skip the cpu type test in generic kernels.
 1.16 10-Dec-2002  pk branches: 1.16.6;
Remove the `flags' argument from bus_intr_establish().
 1.15 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.14 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.13 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12 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.11 20-Mar-2002  eeh Get rid of unnecessary BUS_SPACE_MAP_LINEAR.
 1.10 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.9 13-Nov-2001  lukem add RCSIDs
 1.8 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.7 30-May-2001  mrg branches: 1.7.2; 1.7.4;
use _KERNEL_OPT
 1.6 09-Jul-2000  pk branches: 1.6.2;
Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.5 11-Jan-2000  pk branches: 1.5.4;
Remove old-style boot device recognition.
 1.4 21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.3 29-Aug-1998  pk branches: 1.3.12; 1.3.18;
Use bus_space_*() to access device registers.
Add `esp' and `le' DMA engine.
 1.2 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.1 27-Jul-1998  pk Lance front-ends on Sbus moved here.
 1.3.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.4.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.6.2.6 11-Dec-2002  thorpej Sync with HEAD.
 1.6.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.6.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.6.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.6.2.2 08-Oct-2001  nathanw Catch up to -current.
 1.6.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.7.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.7.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.7.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.16.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.6.1 03-Aug-2004  skrll Sync with HEAD
 1.19.10.1 12-Feb-2005  yamt sync with head.
 1.19.8.1 29-Apr-2005  kent sync with -current
 1.20.6.1 27-Oct-2007  yamt sync with head.
 1.21.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.21.46.1 06-Nov-2007  matt sync with HEAD
 1.21.44.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.21.30.1 23-Oct-2007  ad Sync with head.
 1.22.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.4.3 11-Mar-2010  yamt sync with head
 1.23.4.2 16-Sep-2009  yamt sync with head
 1.23.4.1 16-May-2008  yamt sync with head.
 1.23.2.1 18-May-2008  yamt sync with head.
 1.28.64.1 10-Jun-2019  christos Sync with HEAD
 1.39 15-Oct-2025  thorpej These drivers can use ether_getaddr() instead of prom_getether() now.
 1.38 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.37 29-May-2022  rin Audit unload/unmap v.s. free against DMA buffer for sys/dev;
make sure that bus_dmamap_unload(9) [or bus_dmamap_destroy(9)] or
bus_dmamem_unmap(9) are preceding to freeing DMA buffer, if it is
loaded or mapped, respectively.

This is mandatory for some archs. See, e.g.:

http://www.nerv.org/netbsd/?q=id:20210511T013030Z.013443cc790088147e4beed43f53dedabeaf9312
http://www.nerv.org/netbsd/?q=id:20220511T172220Z.561179f0b6fcc5b9cd73e274f69d74e2ce9e4c93

For some drivers, resource leaks for error paths are fixed at
the same time.

XXX XXX XXX
Compile test only (at least one arch per driver).
 1.36 25-Apr-2019  msaitoh KNF. No functional change.
 1.35 19-Jan-2010  pooka branches: 1.35.64;
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.34 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.33 08-Sep-2009  tsutsui sbus_establish() should take device_t self for the device itself,
not device_t parent even if sbus is grandparent of the device,
otherwise (*sd_reset)() callbacks will be called with an wrong device_t.
Even in such case, sbus_establish() looks for an sbus though device tree.
XXX: (*sd_reset)() isn't called anyway, and these stuff seems really bogus.
 1.32 08-Sep-2009  tsutsui Fix botch on device_t/softc split caused by awful casts around
registration of (*sd_reset)(device_t) in struct sbusdev via sbus_establish().

XXX: (*sd_reset)() in struct sbusdev seems called from only sbusreset(),
XXX: but there is no function which calls sbusreset()???
 1.31 12-Apr-2009  tsutsui Don't immediately switch UTP/AUI ports on lost carrior.
It may take a while for modern switches to set 10baseT media.
 1.30 28-Apr-2008  martin branches: 1.30.8; 1.30.10; 1.30.14; 1.30.18;
Remove clause 3 and 4 from TNF licenses
 1.29 04-Apr-2008  tsutsui branches: 1.29.2; 1.29.4;
Split device_t/softc for le(4) and variants and misc cosmetic changes.
 1.28 19-Oct-2007  ad branches: 1.28.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.27 04-Mar-2007  christos branches: 1.27.2; 1.27.14; 1.27.16; 1.27.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.26 11-Dec-2005  christos branches: 1.26.26;
merge ktrace-lwp.
 1.25 04-Feb-2005  perry branches: 1.25.6;
de-__P
 1.24 15-Mar-2004  pk branches: 1.24.8; 1.24.10;
Replace myetheraddr() by prom_getether().
 1.23 11-Nov-2003  pk Remove ancient DDB-dependent `hide/integrate'.
Simplify lewrcsr/lerdcsr; read-back after write doesn't hurt on sun4 so
skip the cpu type test in generic kernels.
 1.22 10-Dec-2002  pk branches: 1.22.6;
Remove the `flags' argument from bus_intr_establish().
 1.21 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.20 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.19 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.18 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.17 20-Mar-2002  eeh Get rid of unnecessary BUS_SPACE_MAP_LINEAR.
 1.16 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.15 13-Nov-2001  lukem add RCSIDs
 1.14 30-May-2001  mrg branches: 1.14.2;
use _KERNEL_OPT
 1.13 20-Oct-2000  mrg branches: 1.13.2;
ensure DMA mappings are not mapped streamable. fixes ethernet problems on
ultrasparc sbus class machines. from eeh.
 1.12 20-Oct-2000  mrg rework to use bus_dmamem_map() then bus_dmamem_load(), rather than
bus_dmamem_load_raw() then bus_dmamem_map().

tested on SS2 and SS5 and sbus cards.
 1.11 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.10 10-May-2000  pk branches: 1.10.4;
No need to specify page alignment; this is automatic.
 1.9 10-May-2000  pk Load DMA buffer before mapping it into kernel space.
 1.8 09-May-2000  pk Conform bus_dmamem_{alloc,map} usage to bus_dma(9) specs.
 1.7 11-Jan-2000  pk Remove old-style boot device recognition.
 1.6 21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.5 26-Sep-1998  pk branches: 1.5.12; 1.5.18;
hwreset(): delay required after diddling the medium selection bit.
 1.4 06-Sep-1998  eeh Removed some spurious `long's.
 1.3 31-Aug-1998  pk A few modest simplifications.
 1.2 29-Aug-1998  pk Adjust for some small changes in lsi64854 back-end driver.
 1.1 29-Aug-1998  pk Use bus_space_*() to access device registers.
Add `esp' and `le' DMA engine.
 1.5.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.4.2 25-Oct-2000  tv Pullup 1.12 and 1.13 [mrg]:
rework to use bus_dmamem_map() then bus_dmamem_load(), rather than
bus_dmamem_load_raw() then bus_dmamem_map().

ensure DMA mappings are not mapped streamable. fixes ethernet problems on
ultrasparc sbus class machines. from eeh.
 1.10.4.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.13.2.5 11-Dec-2002  thorpej Sync with HEAD.
 1.13.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.13.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.13.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.13.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.14.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.14.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.14.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.22.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.22.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.22.6.1 03-Aug-2004  skrll Sync with HEAD
 1.24.10.1 12-Feb-2005  yamt sync with head.
 1.24.8.1 29-Apr-2005  kent sync with -current
 1.25.6.2 27-Oct-2007  yamt sync with head.
 1.25.6.1 03-Sep-2007  yamt sync with head.
 1.26.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.27.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.27.16.1 06-Nov-2007  matt sync with HEAD
 1.27.14.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.27.2.1 23-Oct-2007  ad Sync with head.
 1.28.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.29.4.4 11-Mar-2010  yamt sync with head
 1.29.4.3 16-Sep-2009  yamt sync with head
 1.29.4.2 04-May-2009  yamt sync with head.
 1.29.4.1 16-May-2008  yamt sync with head.
 1.29.2.1 18-May-2008  yamt sync with head.
 1.30.18.1 21-Apr-2010  matt sync to netbsd-5
 1.30.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.30.10.1 19-Jun-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #818):
sys/dev/sbus/if_le_ledma.c: revision 1.31
Don't immediately switch UTP/AUI ports on lost carrior.
It may take a while for modern switches to set 10baseT media.
 1.30.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.35.64.1 10-Jun-2019  christos Sync with HEAD
 1.81 07-Sep-2012  macallan set isp_xffree, like the PCI frontend does
now this works again
 1.80 26-Mar-2010  mjacob branches: 1.80.8; 1.80.14; 1.80.16;
Synchronize with other platforms:

Strongly architect handles so we can more easily detect bogus
handles. This switches us to a full 32 bits for all handles.

Handle the case of FC disks disappearing and then reappearing-
at least at the FC transport level.

Some better and finer control of debug and non-debug printouts.
 1.79 17-Sep-2009  tsutsui branches: 1.79.2; 1.79.4;
Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.78 07-Sep-2009  tsutsui Split device_t/softc.
Tested QLogic 1020 Fast Wide SCSI HBA at PCI.
Sbus attachment is untested, but not so much quirks in it.
 1.77 25-Jun-2009  mjacob Update ISP driver to latest and greatest. Includes support for the 8Gb part.
 1.76 17-May-2009  tsutsui Use device_private() to get struct sbus_softc from device_t parent.

XXX: sbus_softc has been split from device_t on sparc, but not on sparc64!?
 1.75 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.74 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.73 07-Apr-2008  cegger branches: 1.73.4; 1.73.18;
use device_xname() and get rid of isp_name
 1.72 05-Apr-2008  cegger use aprint_*_dev and device_xname
 1.71 11-Mar-2008  mjacob Checkpoint of some fairly major isp(4) rototilling.

Reintroduce more of a 'channel' concept in preparation for NP-IV support.
This gets rid of the chanA/chanB concept as the 2400 can have up to 128
virtual channels. Actually, with MID firmware you can also have the 2200
and 2300 support 'channels, but they do it with an FL-Port topology.
Because FC cards can now have 'channels', just about every support
function for fibre channel had to be redone to have a channel index
as well. Rototill isp_ioctl.h for channel stuff as well.

Pick up a lot of work about fabric management (hopefully better) and keep
work in place that will allow for dynamic attachment/detachment of devices
(if I can figure out how to make the midlayer support it).

Merge the target code with external trees. Eventually it might even
be sorted out on NetBSD.

Update some firmware stuff.
 1.70 19-Oct-2007  ad branches: 1.70.12; 1.70.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.69 07-Jul-2007  mjacob branches: 1.69.6; 1.69.8; 1.69.12;
Remove some #if'd out dead code.
Put in the boundary limit for SBus/ISP dma engines (16MiB).
 1.68 24-May-2007  mjacob Major update to isp(4) driver to bring it in line with external sources.

The major changes are:

+ 4Gb (24XX) card support
+ Rewritten fabric and loop evaluation code
+ New f/w sets

The 4Gb changes required major rototilling, which caused a rewrite of
fabric and loop eval code. The latter can now be set up to tune for
dynamic device arrival/departure if the framework is set up for it,
or to be firm about waiting for devices.

Testing has been principally on amd64, i386 and sparc64 and seems to
not have broken things for me.
 1.67 04-Mar-2007  christos branches: 1.67.2; 1.67.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.66 15-Oct-2006  martin branches: 1.66.4;
Missing initializers
 1.65 29-Mar-2006  thorpej branches: 1.65.8; 1.65.10;
Use device_cfdata().
 1.64 11-Dec-2005  christos branches: 1.64.4; 1.64.6; 1.64.8; 1.64.10; 1.64.12;
merge ktrace-lwp.
 1.63 27-Feb-2005  perry branches: 1.63.4;
nuke trailing whitespace
 1.62 17-Mar-2004  pk branches: 1.62.8; 1.62.10;
Rename PROM_getprop*() => prom_getprop*().
 1.61 04-Dec-2003  keihan netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.60 03-May-2003  wiz branches: 1.60.2;
DMA, not dma nor Dma.
 1.59 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.58 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.57 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.56 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.55 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.54 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.53 18-May-2002  mjacob Pointy hat to me on the last delta.
 1.52 17-May-2002  mjacob Replicate change that Matt Thomas made in isp_pci- if we get ENOMEM/EAGAIN
in bus_dmamap_load, return CMD_EAGAIN rather than just make the command dead.
 1.51 21-Mar-2002  eeh branches: 1.51.4;
Fixup attachment code to use sbus_promaddr_to_handle() and not specify
BUS_SPACE_MAP_LINEAR.
 1.50 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.49 21-Feb-2002  mjacob Implement F/W crashdumps for 2200 && 2300 cards (kernel compile option).

Distinguish between 2312 and 2300 cards (they *are* different). Enable
RIO (Reduced Interrupt Operation) for the LVD cards (hey- I've seen
batched completions of the 30 commands at a time with this,....)...

If we get a Port Logout on local loop topologies, we have to force the
f/w to log back in. The easiest way (for us) to do this is to force
a LIP. This also will wake up the disk that probably just had a f/w crash.

Implement mailbox 'continuations'- this allows interrupts to re-drive
a mailbox command if it's one that just essentially repeats the previous
mailbox command (e.g., f/w download). This saves a boatload of sleep/wakeup
twitches.

If we're not a 2300 and we're about to return with a 'bogus interrupt'- check
the semaphore register to be non-zero at all and outgoing mailbox 0- this
seems to be where some of the lost ISP1080 commands came from.
 1.48 14-Dec-2001  mjacob Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.

The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it).

One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.

Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.

For NetBSD, it does a ddi_dmamap_sync as appropriate. This gets us out of
the explicit ddi_dmamap_sync on the whole response queue that we did for SBus
cards at each interrupt.

Set things up so that platforms that cannot have an SBus don't get a lot of
the SBus code checks (dead coded out).

Additional changes:

Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.

Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).

Explicitly decode GetAllNext SNS Response back *as* a GetAllNext response.
Otherwise, we won't unswizzle it correctly.

Nuke some additional __P macros.
 1.47 13-Nov-2001  lukem add RCSIDs
 1.46 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.45 01-Sep-2001  mjacob branches: 1.45.2;
Add support for 2 Gigabit cards (2300/2312). This necessitated a change
in how interrupts are down- the 23XX has not only a different place to check
for an interrupt, but unlike all other QLogic cards, you have to read the
status as a 32 bit word- not 16 bit words. Rather than have device specific
functions as called from the core module (in isp_intr), it makes more sense
to have the platform/bus modules do the gruntwork of splitting out the
isr, semaphore register and the first outgoing mailbox register (if needed)
*prior* to calling isp_intr (if calling isp_intr is necessary at all).
 1.44 06-Jul-2001  mjacob branches: 1.44.2;
twiddle isp_xflist calculation to match more closes isp_pci.c
 1.43 12-Apr-2001  mjacob Clean up bus dma code for request/response queues.
 1.42 14-Mar-2001  mjacob ansify code
 1.41 08-Mar-2001  thorpej Use bus_dmamap_load(), not bus_dmamap_load_raw(), and add
BUS_DMA_STREAMING to data transfer map loads.
 1.40 28-Feb-2001  mjacob branches: 1.40.2;
Oh, god, make the pain stop. "Fix" this one more time- but for the next
to last time.

It turns out that in fact, sparc64 was *not* working. There is a discussion
within the tech-kern@netbsd.org mail list as of just prior to this date
that contains the details.

Suffice to say that for sparc64 we have to add back in the usage
of BUS_DMA_COHERENT again to the call to bus_dmamap_load_raw. PK
added the usage of bus_dmamap_load_raw- which agrees with the
man page description of it- but now does not match what the
original BusDma author seems to think it's supposed to do.

While we're at it, do a specific set of steps for setting up and,
if necessary, tearing down, mailbox dma mappings.
 1.39 25-Feb-2001  mjacob this was *still* wrong
 1.38 25-Feb-2001  mjacob More Kudos to Izumi: fix another argument to bus_dmamap_sync
 1.37 24-Feb-2001  mjacob Now that the underlying code for bus_dmamap_sync appears to do the
right thing, don't use the illegal and "just worked by chance" addition
of BUS_DMA_COHERENT to bus_dmamap_load_raw. There still is a necessity
to add to the architecture to allow one to hint that this should be
a cache coherent mapping.

Fix offset argument to be zero for flushing data tranfers. Kudos to Izumi
for spotting this.
 1.36 23-Feb-2001  mjacob Add missing BUS_DMA_COHERENT to bus_dmamap_load_raw calls for request
and response queues- this makes this work on UltraSparc now.
 1.35 23-Feb-2001  mjacob Implement bootverbose recognition. Move interrupt registry up a bit so we can
use interrupting mailbox commands for isp_init. Set default HBA role.
Rename request/response dma maps to be more consistent with PCI version.
Enable bus_dmamap_sync on request queue- we already do this for response
queue- better do it for the request queue as well.

Checked to be working against a Sparc10.
 1.34 23-Dec-2000  wiz Fix pathnames in comment.
 1.33 22-Oct-2000  mjacob fix SBus bursting *correctly* this time
 1.32 17-Oct-2000  mjacob quiet chatty boot messages
 1.31 16-Oct-2000  mjacob Turn on 32 byte bursting for ISP
 1.30 14-Aug-2000  mjacob Add a maintenance note. Add a bus specific isp_sbus_intr function- this is
so we, ahem, note we're on an interrupt stack so we don't try and sleep
on any mailbox commands we might want to run.
 1.29 01-Aug-2000  mjacob Core version 2.0 (platform version 1.0) rewrite of ISP driver. Some
interace cleanups, some new common functions. The major impact that
will be noticeable right away is that if you boot with not Fibre connected
to the FC cards, you no longer hang indefinitely.
 1.28 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.27 05-Jul-2000  mjacob Use new isp_handle_index inline function. Change order in whch
some things are done. Remember to enable interrupts after calling
isp_reset but before isp_attach.
 1.26 10-May-2000  pk branches: 1.26.4;
No need to specify page alignment; this is automatic.
 1.25 10-May-2000  pk Fix bogus `boundary' argument in bus_dmamap_create().
 1.24 09-May-2000  pk Conform bus_dmamem_{alloc,map} usage to bus_dma(9) specs.
 1.23 19-Feb-2000  mjacob correct oops on last checkin
 1.22 19-Feb-2000  mjacob Handle > 12 byte CDBs.
 1.21 14-Jan-2000  mjacob There is no readily available tool to set NVRAM on isp's on sparc,
so ignore it.
 1.20 09-Jan-2000  mjacob The trigger for not downloading f/w is now a
NULL f/w pointer, not a nonzero f/w length.
 1.19 09-Jan-2000  mjacob The sense of being able to sleep for DMA resources was reversed. Oops.
 1.18 20-Dec-1999  mjacob get back to looking at config flags
 1.17 04-Dec-1999  mjacob Add back in inclusion of microcode and rationalize it. request/response
queue indices need to be u_int16_t wide.
 1.16 21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.15 28-Oct-1999  mjacob Remove reference to loadable f/w.
 1.14 14-Oct-1999  mjacob branches: 1.14.2; 1.14.4;
We alloc xflist and dma maps in mailbox setup. We swizzle endian stuff
at the end of dma setup.
 1.13 30-Sep-1999  thorpej branches: 1.13.2;
Update for SCSPI changes.
 1.12 27-May-1999  pk Fix bus_size_t/size_t/int confusion.
 1.11 25-Apr-1999  pk It is no longer necessary to protect bus_dma_[un]load() at splbio, since
sparc bus_dma*() functions now protect their own internals..
 1.10 26-Mar-1999  mjacob branches: 1.10.2;
roll internal release tag
 1.9 23-Mar-1999  pk Call bus_dma_[un]load() at splbio.
 1.8 17-Mar-1999  mjacob prototype 1080/1240 support caused register offset rewhack
 1.7 09-Feb-1999  mjacob roll internal release level
 1.6 30-Jan-1999  mjacob roll internal release tag and finally use bus_space I/O
 1.5 10-Jan-1999  mjacob turn on SBUS bursts
 1.4 28-Dec-1998  mjacob clean up headers
 1.3 18-Sep-1998  mjacob Make changes as required for new return values from dma setup routine
for isp. Unable to test in running kernel because they're not buildable today,
but should be okay.
 1.2 08-Sep-1998  mjacob add bustype tag to softc
 1.1 27-Aug-1998  mrg move isp_sbus attachment into /sys/dev/sbus.
 1.10.2.3 15-Jan-2000  he Pull up revisions 1.19-1.20 (via patch, requested by mjacob):
Fix a bug where the sense of when to sleep waiting for DMA
resources was reversed. Fix internal functionality where it's
now a firmware pointer being NULL instead of firmware length
being zero that disables f/w loading.
 1.10.2.2 08-Jan-2000  he Pull up revisions 1.12,1.14-1.18 (via patch, requested by mjacob):
Untangle Qlogic firmware copyright problems and update firmware.
Untangle some MD support issues for said firmware. Add 1280 (Dual
LVD), 1240 (Dual Ultra), 2200 (2nd Generation Qlogic FC chipset).
Fix some synchronous negotiation problems for parallel SCSI.
Firm up some Fabric Support issues.
 1.10.2.1 26-Apr-1999  perry branches: 1.10.2.1.2;
pullup 1.10->1.11 (pk)
 1.10.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.14.4.1 15-Nov-1999  fvdl Sync with -current
 1.14.2.6 21-Apr-2001  bouyer Sync with HEAD
 1.14.2.5 27-Mar-2001  bouyer Sync with HEAD.
 1.14.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.14.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.14.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.2.1 20-Oct-1999  thorpej Eliminate sleeping from adapter routines.
 1.26.4.5 20-Mar-2001  he Pull up revision 1.42 (requested by mjacob):
ANSIfication and conversion of handles to 16 bits.
 1.26.4.4 16-Mar-2001  he Pull up revision 1.35 (via patch) and 1.36-1.40 (requested by mjacob):
Set default HBA role (to ISP_ROLE_INITIATOR).
 1.26.4.3 25-Jan-2001  jhawk Pull up revisions 1.31-1.34 (requested by mjacob):
Add in correct SBus bursting; upgrade to 2.01.26 firmware; pull to latest
initiator mode level; make changes to WWN default handling; quiet
chatty boot messages; fix endian code so MacPPC works; fix bug in
lock recursion counter; fix bug which excluded all but NL-ports from
being logged into on a fabric.
 1.26.4.2 28-Aug-2000  mjacob Complete rewrite of internals for isp core version 2.0.
Pullup to netbsd-1-5 approved by thorpej@netbsd.org.
 1.26.4.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.40.2.12 11-Dec-2002  thorpej Sync with HEAD.
 1.40.2.11 18-Oct-2002  nathanw Catch up to -current.
 1.40.2.10 20-Jun-2002  nathanw Catch up to -current.
 1.40.2.9 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.40.2.8 28-Feb-2002  nathanw Catch up to -current.
 1.40.2.7 08-Jan-2002  nathanw Catch up to -current.
 1.40.2.6 14-Nov-2001  nathanw Catch up to -current.
 1.40.2.5 08-Oct-2001  nathanw Catch up to -current.
 1.40.2.4 21-Sep-2001  nathanw Catch up to -current.
 1.40.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.40.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.40.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.44.2.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.44.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.44.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.44.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.44.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.45.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.51.4.1 30-May-2002  gehenna Catch up with -current.
 1.60.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.60.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.60.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.60.2.1 03-Aug-2004  skrll Sync with HEAD
 1.62.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.62.8.1 29-Apr-2005  kent sync with -current
 1.63.4.5 17-Mar-2008  yamt sync with head.
 1.63.4.4 27-Oct-2007  yamt sync with head.
 1.63.4.3 03-Sep-2007  yamt sync with head.
 1.63.4.2 30-Dec-2006  yamt sync with head.
 1.63.4.1 21-Jun-2006  yamt sync with head.
 1.64.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.64.10.1 19-Apr-2006  elad sync with head.
 1.64.8.1 01-Apr-2006  yamt sync with head.
 1.64.6.1 22-Apr-2006  simonb Sync with head.
 1.64.4.1 09-Sep-2006  rpaulo sync with head
 1.65.10.1 22-Oct-2006  yamt sync with head
 1.65.8.1 18-Nov-2006  ad Sync with head.
 1.66.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.67.4.1 11-Jul-2007  mjf Sync with head.
 1.67.2.3 23-Oct-2007  ad Sync with head.
 1.67.2.2 15-Jul-2007  ad Sync with head.
 1.67.2.1 27-May-2007  ad Sync with head.
 1.69.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.69.8.2 23-Mar-2008  matt sync with HEAD
 1.69.8.1 06-Nov-2007  matt sync with HEAD
 1.69.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.70.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.70.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.70.12.1 24-Mar-2008  keiichi sync with head.
 1.73.18.2 23-Jul-2009  jym Sync with HEAD.
 1.73.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.73.4.6 11-Aug-2010  yamt sync with head.
 1.73.4.5 11-Mar-2010  yamt sync with head
 1.73.4.4 16-Sep-2009  yamt sync with head
 1.73.4.3 18-Jul-2009  yamt sync with head.
 1.73.4.2 20-Jun-2009  yamt sync with head
 1.73.4.1 16-May-2009  yamt sync with head
 1.79.4.1 30-May-2010  rmind sync with head
 1.79.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.80.16.1 01-Nov-2012  matt sync with netbsd-6-0-RELEASE.
 1.80.14.1 13-Sep-2012  riz Pull up following revision(s) (requested by macallan in ticket #550):
sys/dev/sbus/isp_sbus.c: revision 1.81
set isp_xffree, like the PCI frontend does
now this works again
 1.80.8.1 30-Oct-2012  yamt sync with head
 1.41 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.40 22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.39 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.38 10-May-2021  thorpej branches: 1.38.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.37 24-Apr-2021  thorpej branches: 1.37.2; 1.37.4;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.36 17-Sep-2009  tsutsui branches: 1.36.80;
Fix a message format in error path.
 1.35 17-Sep-2009  tsutsui Split device_t/softc.
Tested on:
> lebuffer0 at sbus0 slot 3 offset 0x40000: 128K memory
 1.34 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.33 17-May-2009  tsutsui Use device_private() to get struct sbus_softc from device_t parent.

XXX: sbus_softc has been split from device_t on sparc, but not on sparc64!?
 1.32 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.31 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.30 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.29 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.28 28-Apr-2008  martin branches: 1.28.8; 1.28.14;
Remove clause 3 and 4 from TNF licenses
 1.27 05-Apr-2008  cegger branches: 1.27.2; 1.27.4;
use aprint_*_dev and device_xname
 1.26 19-Oct-2007  ad branches: 1.26.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.25 11-Dec-2005  christos branches: 1.25.30; 1.25.44; 1.25.46; 1.25.50;
merge ktrace-lwp.
 1.24 30-May-2005  christos branches: 1.24.2;
avoid shadow variables.
 1.23 04-Feb-2005  perry de-__P
 1.22 19-Jul-2004  pk branches: 1.22.4; 1.22.6;
No need to allocate our own bus tag here.
 1.21 30-Jun-2004  pk Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.
 1.20 27-Jun-2004  pk Bus tags should now be constructed by copying the parent's bus tag and
then changing the fields that need to be handled by the child bus.
 1.19 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.18 02-Oct-2002  thorpej branches: 1.18.6;
Add trailing ; to CFATTACH_DECL.
 1.17 01-Oct-2002  uwe Add missing args to CFATTACH_DECL.
 1.16 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.15 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14 27-Sep-2002  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.13 20-Mar-2002  eeh Use bus_space_vaddr() correctly. (XXX do we really need this?)
 1.12 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.11 14-Jan-2002  tsutsui Call malloc(9) with M_ZERO flag instead of bzero() after malloc().
 1.10 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.9 13-Nov-2001  lukem add RCSIDs
 1.8 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.7 14-Apr-2000  mrg branches: 1.7.6; 1.7.8; 1.7.10;
add some casts to (u_long) to shut up gcc
 1.6 11-Jan-2000  pk Remove old-style boot device recognition.
 1.5 29-Aug-1998  pk branches: 1.5.12;
Nuke unnecessary header files.
 1.4 29-Jul-1998  pk Use sbus_destroy_attach_args().
 1.3 27-Jul-1998  pk Change copyright.
 1.2 27-Jul-1998  pk Get headers from dev/sbus.
 1.1 27-Jul-1998  mrg move these files to sys/dev/sbus. currently uses a hack to access the correct "sbusvar.h" XXX fix me.
 1.5.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.10.1 01-Oct-2001  fvdl Catch up with -current.
 1.7.8.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.7.8.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.8.3 16-Mar-2002  jdolecek Catch up with -current.
 1.7.8.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.7.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.6.6 18-Oct-2002  nathanw Catch up to -current.
 1.7.6.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.7.6.4 28-Feb-2002  nathanw Catch up to -current.
 1.7.6.3 08-Jan-2002  nathanw Catch up to -current.
 1.7.6.2 14-Nov-2001  nathanw Catch up to -current.
 1.7.6.1 08-Oct-2001  nathanw Catch up to -current.
 1.18.6.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.6.2 04-Feb-2005  skrll Sync with HEAD.
 1.18.6.1 03-Aug-2004  skrll Sync with HEAD
 1.22.6.1 12-Feb-2005  yamt sync with head.
 1.22.4.1 29-Apr-2005  kent sync with -current
 1.24.2.1 27-Oct-2007  yamt sync with head.
 1.25.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.25.46.1 06-Nov-2007  matt sync with HEAD
 1.25.44.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.25.30.1 23-Oct-2007  ad Sync with head.
 1.26.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.27.4.5 11-Mar-2010  yamt sync with head
 1.27.4.4 20-Jun-2009  yamt sync with head
 1.27.4.3 16-May-2009  yamt sync with head
 1.27.4.2 04-May-2009  yamt sync with head.
 1.27.4.1 16-May-2008  yamt sync with head.
 1.27.2.1 18-May-2008  yamt sync with head.
 1.28.14.2 23-Jul-2009  jym Sync with HEAD.
 1.28.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.28.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.36.80.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.37.4.1 31-May-2021  cjep sync with head
 1.37.2.1 13-May-2021  thorpej Sync with HEAD.
 1.38.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.8 17-Sep-2009  tsutsui Split device_t/softc.
Tested on:
> lebuffer0 at sbus0 slot 3 offset 0x40000: 128K memory
 1.7 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 04-Mar-2007  christos branches: 1.5.36; 1.5.38; 1.5.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 11-Dec-2005  christos branches: 1.4.26;
merge ktrace-lwp.
 1.3 19-Jul-2004  pk branches: 1.3.12;
No need to allocate our own bus tag here.
 1.2 27-Jul-1998  pk branches: 1.2.48;
Change copyright.
 1.1 27-Jul-1998  mrg move these files to sys/dev/sbus. currently uses a hack to access the correct "sbusvar.h" XXX fix me.
 1.2.48.1 03-Aug-2004  skrll Sync with HEAD
 1.3.12.1 03-Sep-2007  yamt sync with head.
 1.4.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.5.40.2 11-Mar-2010  yamt sync with head
 1.5.40.1 16-May-2008  yamt sync with head.
 1.5.38.1 18-May-2008  yamt sync with head.
 1.5.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.64 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.63 24-Apr-2021  thorpej branches: 1.63.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.62 12-Apr-2021  mrg handle cd1400_compute_baud() failure and avoid reading uninitialised
variables.
 1.61 10-Nov-2019  chs branches: 1.61.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.60 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.59 25-Jul-2014  dholland branches: 1.59.26; 1.59.28;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.58 16-Mar-2014  dholland branches: 1.58.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.57 19-Oct-2013  mrg - remove set but unused variable.
- put variables only inside #ifdef inside that same #ifdef.
use __USE() where appropriate.
 1.56 27-Oct-2012  chs branches: 1.56.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.55 24-Apr-2011  rmind branches: 1.55.4; 1.55.14;
Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.54 17-Sep-2009  tsutsui branches: 1.54.4; 1.54.6;
Include "ioconf.h" instead of extern struct cfdriver foo_cd decls.
 1.53 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.52 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.51 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.50 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.49 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.48 02-Jul-2008  plunky branches: 1.48.4; 1.48.10;
change licence of my old code to two-clause BSD licence
remove my name from advertising list
 1.47 11-Jun-2008  drochner mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.46 05-Apr-2008  cegger branches: 1.46.2; 1.46.4; 1.46.6; 1.46.8;
use aprint_*_dev and device_xname
 1.45 19-Nov-2007  ad branches: 1.45.14;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.44 19-Oct-2007  ad branches: 1.44.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.43 08-Oct-2007  ad branches: 1.43.2;
Use the softint API.
 1.42 12-Aug-2007  macallan branches: 1.42.2; 1.42.4;
make this compile (again?) on sparc64 by sprinkling bus_space_vaddr().
Needs testing on both sparc and sparc64 - I don't have a magma.
 1.41 09-Jul-2007  ad branches: 1.41.2; 1.41.6;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.40 04-Mar-2007  mrg branches: 1.40.2; 1.40.4;
fix fall out from caddr_t changes.
 1.39 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.38 01-Oct-2006  elad branches: 1.38.4;
More from Matt Fleming:

Adapt to KAUTH_DEVICE_TTY_PRIVSET and KAUTH_DEVICE_TTY_OPEN.
 1.37 01-Oct-2006  elad Adapt MD code to KAUTH_DEVICE_TTY_OPEN, batch #2 from Matt Fleming, thanks!

Also, add forgotten splx() calls in some places.
 1.36 23-Sep-2006  jmcneill PR# 29516: magma.c comments are wrong, also splhigh is excessive
 1.35 21-Jul-2006  ad branches: 1.35.4; 1.35.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.34 15-May-2006  yamt include kauth.h for kauth_authorize_generic.
 1.33 14-May-2006  elad integrate kauth.
 1.32 24-Dec-2005  perry branches: 1.32.4; 1.32.6; 1.32.8; 1.32.10; 1.32.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.31 11-Dec-2005  christos merge ktrace-lwp.
 1.30 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.29 27-Feb-2005  perry branches: 1.29.4;
nuke trailing whitespace
 1.28 17-Mar-2004  pk branches: 1.28.8; 1.28.10;
Rename PROM_getprop*() => prom_getprop*().
 1.27 29-Jun-2003  fvdl branches: 1.27.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.26 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.25 22-Feb-2003  tsutsui hz -> Hz
 1.24 17-Dec-2002  pk Establish high-level interrupt with IPL_SERIAL.
 1.23 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.22 10-Dec-2002  pk Switch to softintr(9).
 1.21 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.20 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.19 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.18 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.17 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.16 21-Mar-2002  eeh branches: 1.16.4;
Use bus_space_vaddr().
 1.15 17-Mar-2002  atatat Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.14 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.13 22-Jan-2002  pk Support for the ` Magma 2+1HS Sp' (from mouse on port-sparc):
- allow for sbus node name matching
- get clock frequency from prom property.
 1.12 13-Nov-2001  lukem add RCSIDs
 1.11 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.10 02-May-2001  scw branches: 1.10.2; 1.10.4;
Add `l_poll' to `struct linesw' and provide an xxxpoll() entry point
in each tty driver to indirect through it.

This allows tty line-disciplines to handle poll(2) system calls.
 1.9 02-Nov-2000  eeh branches: 1.9.2;
Adapt to the new line discipline scheme.
 1.8 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.7 04-Jun-2000  cgd branches: 1.7.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.6 23-Mar-2000  thorpej branches: 1.6.2;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.5 21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.4 28-Jul-1998  pk branches: 1.4.14; 1.4.20;
Fix #includes
 1.3 03-Jun-1998  pk Update from Iain on the parallel port stuff.
 1.2 20-May-1998  pk Do not assume that a parallel component is always configured.
Squash compiler warnings if MAGMA_DEBUG is on.
 1.1 19-May-1998  pk Magma SBus serial & parallel port driver from Iain Hibbert.
 1.4.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.14.2 22-Nov-2000  bouyer Sync with HEAD.
 1.4.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.7.2.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.9.2.10 19-Dec-2002  thorpej Sync with HEAD.
 1.9.2.9 11-Dec-2002  thorpej Sync with HEAD.
 1.9.2.8 11-Nov-2002  nathanw Catch up to -current
 1.9.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.9.2.6 17-Sep-2002  nathanw Catch up to -current.
 1.9.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.9.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.9.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.9.2.2 08-Oct-2001  nathanw Catch up to -current.
 1.9.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.4.3 13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.10.4.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.10.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.10.2.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.10.2.5 28-Jun-2002  jdolecek g/c mbpp poll(), it returned ENODEV anyway
 1.10.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.10.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.10.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.10.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.4.1 16-May-2002  gehenna Add the character device switch.
 1.27.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.27.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.27.2.4 04-Feb-2005  skrll Adapt to branch.
 1.27.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.27.2.1 03-Aug-2004  skrll Sync with HEAD
 1.28.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.28.8.1 29-Apr-2005  kent sync with -current
 1.29.4.5 07-Dec-2007  yamt sync with head
 1.29.4.4 27-Oct-2007  yamt sync with head.
 1.29.4.3 03-Sep-2007  yamt sync with head.
 1.29.4.2 30-Dec-2006  yamt sync with head.
 1.29.4.1 21-Jun-2006  yamt sync with head.
 1.32.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.32.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.32.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.32.8.2 11-Aug-2006  yamt sync with head
 1.32.8.1 24-May-2006  yamt sync with head.
 1.32.6.1 01-Jun-2006  kardel Sync with head.
 1.32.4.1 09-Sep-2006  rpaulo sync with head
 1.35.6.1 22-Oct-2006  yamt sync with head
 1.35.4.1 18-Nov-2006  ad Sync with head.
 1.38.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.40.4.1 11-Jul-2007  mjf Sync with head.
 1.40.2.4 23-Oct-2007  ad Sync with head.
 1.40.2.3 20-Aug-2007  ad Sync with HEAD.
 1.40.2.2 01-Jul-2007  ad Adapt to callout API change.
 1.40.2.1 17-Jun-2007  ad - Increase the number of thread priorities from 128 to 256. How the space
is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
is provided, with hooks for fast-path MD code that can run the interrupt
threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.
 1.41.6.3 21-Nov-2007  joerg Sync with HEAD.
 1.41.6.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.41.6.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.41.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.42.4.1 14-Oct-2007  yamt sync with head.
 1.42.2.2 09-Jan-2008  matt sync with HEAD
 1.42.2.1 06-Nov-2007  matt sync with HEAD
 1.43.2.2 21-Nov-2007  bouyer Sync with HEAD
 1.43.2.1 25-Oct-2007  bouyer Sync with HEAD.
 1.44.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.45.14.3 02-Jul-2008  mjf Sync with HEAD.
 1.45.14.2 29-Jun-2008  mjf Sync with HEAD.
 1.45.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.46.8.2 03-Jul-2008  simonb Sync with head.
 1.46.8.1 18-Jun-2008  simonb Sync with head.
 1.46.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.46.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.46.4.3 11-Mar-2010  yamt sync with head
 1.46.4.2 16-May-2009  yamt sync with head
 1.46.4.1 04-May-2009  yamt sync with head.
 1.46.2.1 17-Jun-2008  yamt sync with head.
 1.48.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.48.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.54.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.54.4.1 31-May-2011  rmind sync with head
 1.55.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.55.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.55.4.1 30-Oct-2012  yamt sync with head
 1.56.2.1 18-May-2014  rmind sync with head
 1.58.2.1 10-Aug-2014  tls Rebase.
 1.59.28.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.59.28.1 10-Jun-2019  christos Sync with HEAD
 1.59.26.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.61.10.2 17-Apr-2021  thorpej Sync with HEAD.
 1.61.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.63.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.20 09-Jul-2018  christos Remove duplicate copies of the SET/CLR/ISSET macros.
 1.19 09-Jul-2018  kre Avoid redefining SET/CLR/ISSET (which in the kernel are normally
defined in <sys/types.h>). These redefinitions (when they are,
that is, when types.h is included) were sneaking through because
they were defined identically ... until CLR in <sys/types.h> was
changed... Avoid that issue arising again.
 1.18 15-Nov-2014  christos branches: 1.18.18; 1.18.20;
centralize the dialout/call unit macros.
 1.17 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.16 17-Sep-2009  tsutsui branches: 1.16.12; 1.16.22;
Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.15 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.14 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.13 02-Jul-2008  plunky branches: 1.13.10;
change licence of my old code to two-clause BSD licence
remove my name from advertising list
 1.12 04-Mar-2007  christos branches: 1.12.36; 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 16-Feb-2006  perry branches: 1.11.20;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.10 24-Dec-2005  perry branches: 1.10.2; 1.10.4; 1.10.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 04-Feb-2005  perry branches: 1.8.6;
de-__P
 1.7 22-Feb-2003  tsutsui branches: 1.7.2; 1.7.10; 1.7.12;
hz -> Hz
 1.6 10-Dec-2002  pk Switch to softintr(9).
 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-Jan-2002  pk branches: 1.4.8;
Support for the ` Magma 2+1HS Sp' (from mouse on port-sparc):
- add sbus node name field to board info structure
 1.3 23-Mar-2000  thorpej branches: 1.3.6; 1.3.8; 1.3.10;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.2 07-Jun-1998  pk branches: 1.2.14;
Update from Iain for the parallel port stuff.
 1.1 19-May-1998  pk Magma SBus serial & parallel port driver from Iain Hibbert.
 1.2.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.10.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.3.8.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.8.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.3.6.3 11-Dec-2002  thorpej Sync with HEAD.
 1.3.6.2 17-Sep-2002  nathanw Catch up to -current.
 1.3.6.1 28-Feb-2002  nathanw Catch up to -current.
 1.4.8.1 16-May-2002  gehenna Remove a prototype.
 1.7.12.1 12-Feb-2005  yamt sync with head.
 1.7.10.1 29-Apr-2005  kent sync with -current
 1.7.2.1 04-Feb-2005  skrll Sync with HEAD.
 1.8.6.2 03-Sep-2007  yamt sync with head.
 1.8.6.1 21-Jun-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.10.2.1 18-Feb-2006  yamt sync with head.
 1.11.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.44.1 03-Jul-2008  simonb Sync with head.
 1.12.42.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.12.40.3 11-Mar-2010  yamt sync with head
 1.12.40.2 16-May-2009  yamt sync with head
 1.12.40.1 04-May-2009  yamt sync with head.
 1.12.36.1 02-Jul-2008  mjf Sync with HEAD.
 1.13.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.22.2 03-Dec-2017  jdolecek update from HEAD
 1.16.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.16.12.1 30-Oct-2012  yamt sync with head
 1.18.20.1 10-Jun-2019  christos Sync with HEAD
 1.18.18.1 28-Jul-2018  pgoyette Sync with HEAD
 1.2 02-Jul-2008  plunky change licence of my old code to two-clause BSD licence
remove my name from advertising list
 1.1 03-Jun-1998  pk branches: 1.1.146; 1.1.150; 1.1.152; 1.1.154;
Magma parallel port ioctls per Iain Hibbert.
 1.1.154.1 03-Jul-2008  simonb Sync with head.
 1.1.152.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.1.150.1 04-May-2009  yamt sync with head.
 1.1.146.1 02-Jul-2008  mjf Sync with HEAD.
 1.24 19-Jul-2023  macallan - make colour depth in fb mode configurable, default to 8bit
- support ioctl(FBIO*CMAP)
 1.23 28-Jun-2023  macallan following a hunch...
- cache DEC and FG registers, only write them if the value actually changes
- wait for the engine to go idle before writing DEC
- wait for FIFO slots on everything else
with this we avoid waiting if possible and still avoid overlapping blit and
fill commands
 1.22 28-Jun-2023  macallan wait for the engine to go idle before issuing rectfill commands
we get occasional overlap with blit commands if we just wait for fifo slots
needs further investigation, it is possible that not all writes to drawing
engine registers are pipelined and of course we don't have docs
 1.21 28-Jun-2023  macallan fix tpyo - now the glyph cache can actually work...
 1.20 11-Nov-2021  macallan branches: 1.20.4;
provide an endian-flipped view of the framebuffer via mmap() if we know how
for now this is sparc64 only
 1.19 31-Oct-2021  macallan remove accidentially committed debug goop
thanks ryo@
 1.18 30-Oct-2021  macallan actually mmap() the blitter registers when asked to, while there do some
magic number reduction
 1.17 22-Oct-2021  macallan return 0 in mgx_ioctl()::FBIOG*
now Xorg can find us
 1.16 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.15 24-Apr-2021  thorpej branches: 1.15.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.14 03-Sep-2018  riastradh branches: 1.14.14;
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.13 28-Mar-2018  macallan branches: 1.13.2;
set WSSCREEN_RESIZE
 1.12 04-Aug-2017  macallan branches: 1.12.2; 1.12.4;
- store bitmap fonts in vram
- don't try to force buffer flushes
- avoid 64bit writes to vram
-> no more corruption of font bitmaps
 1.11 29-Jul-2017  macallan make comment match code...
 1.10 29-Jul-2017  macallan - use hardware to draw bitmap fonts
- while there enable font loading etc.
 1.9 07-May-2016  macallan add Sun /dev/fb* style goop
 1.8 04-Mar-2016  macallan allow mmap()ing blitter registers
 1.7 25-Feb-2016  joerg Mark mgx_wait_host explicitly as unused.
 1.6 11-Feb-2016  macallan support screen blanking and hw cursor
 1.5 11-Feb-2016  macallan switch to 32bit colour in WSDISPLAYIO_MODE_MAPPED, now X with wsfb will work
Not optimal though - for some reason the framebuffer's endianness in 32bit
colour is wrong and I have no idea (yet) how to change that, so many apps
using xrender will crash.
 1.4 06-Jan-2015  macallan branches: 1.4.2;
implement WSDISPLAYIO_*CMAP and WSDISPLAYIO_GET_FBINFO ioctl()s
now X with wsfb works properly
 1.3 06-Jan-2015  macallan - enable alpha fonts now that we have acceleration and glyphcache
- fix drawing of underlined characters
- try to flush framebuffer writes before reading them with the blitter
 1.2 04-Jan-2015  macallan support hardware acceleration, adapted from OpenBSD
TODO: figure out how to do host blits so we can get away without mapping the
framebuffer
 1.1 16-Dec-2014  macallan first draft of a driver for SMSI,mgx
More or less an Alliance Semiconductors ProMotion AT24 with some PCI-SBus
glue and 4MB framebuffer. No acceleration yet, just enough wsdisplay/vcons
setup and DAC programming to be functional.
 1.4.2.5 28-Aug-2017  skrll Sync with HEAD
 1.4.2.4 29-May-2016  skrll Sync with HEAD
 1.4.2.3 19-Mar-2016  skrll Sync with HEAD
 1.4.2.2 06-Apr-2015  skrll Sync with HEAD
 1.4.2.1 06-Jan-2015  skrll file mgx.c was added on branch nick-nhusb on 2015-04-06 15:18:13 +0000
 1.12.4.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.12.4.1 30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.12.2.2 03-Dec-2017  jdolecek update from HEAD
 1.12.2.1 04-Aug-2017  jdolecek file mgx.c was added on branch tls-maxphys on 2017-12-03 11:37:32 +0000
 1.13.2.1 10-Jun-2019  christos Sync with HEAD
 1.14.14.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.15.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.20.4.1 05-Jul-2023  martin Pull up following revision(s) (requested by abs in ticket #224):

sys/dev/wscons/wsdisplay_vconsvar.h: revision 1.34
sys/dev/wscons/wsdisplay_glyphcachevar.h: revision 1.6
sys/arch/sparc/dev/cgfourteen.c: revision 1.94
sys/arch/sparc/dev/cgfourteen.c: revision 1.95
sys/dev/sbus/mgx.c: revision 1.21
sys/dev/sbus/mgx.c: revision 1.22
sys/dev/sbus/mgx.c: revision 1.23
sys/dev/wscons/wsdisplay_vcons.c: revision 1.65
sys/dev/wscons/wsdisplay_vcons.c: revision 1.66
sys/dev/wscons/wsdisplay_glyphcache.c: revision 1.12
sys/arch/sparc/dev/sxvar.h: revision 1.5
sys/arch/sparc/dev/sx.c: revision 1.6
sys/arch/sparc/dev/sx.c: revision 1.7

make vcons_putchar_buffer() return a flag indicating if anything actually
changed, skip the actual drawing op if nothing did

add flags for drivers to requesr R2L bit/byte-ordered fonts, default to
L2R, chack them in vcons_load_font() instead of just trusting that we'd get
what we need

initialize the diagnostic register with the value suggested by the SunOS
header. This sets a bunch of undocumented bits and yields a 10% speed increase
when rendering antialiased text.

use macros compatible with xf86-video-suncg14 to issue SX instructions
much more readable, alignment weirdness is handled automatically and code is
interchangable

allow drivers to specify horizontal alignment of glyph cache cells
for things like SX which have alignment restrictions

add counter to periodically drain the instruction queue in order to avoid
stalling the MBus during long SX operations

adapted from xf86-video-suncg14
- use sx_wait() to avoid stalling the MBus
- request 32bit alignment for glyphcache cells

wait for the engine to go idle before issuing rectfill commands
we get occasional overlap with blit commands if we just wait for fifo slots
needs further investigation, it is possible that not all writes to drawing
engine registers are pipelined and of course we don't have docs

following a hunch...
- cache DEC and FG registers, only write them if the value actually changes
- wait for the engine to go idle before writing DEC
- wait for FIFO slots on everything else
with this we avoid waiting if possible and still avoid overlapping blit and
fill commands
 1.7 11-Nov-2021  macallan provide an endian-flipped view of the framebuffer via mmap() if we know how
for now this is sparc64 only
 1.6 30-Oct-2021  macallan actually mmap() the blitter registers when asked to, while there do some
magic number reduction
 1.5 29-Jul-2017  macallan branches: 1.5.2;
- use hardware to draw bitmap fonts
- while there enable font loading etc.
 1.4 11-Feb-2016  macallan support screen blanking and hw cursor
 1.3 11-Feb-2016  macallan switch to 32bit colour in WSDISPLAYIO_MODE_MAPPED, now X with wsfb will work
Not optimal though - for some reason the framebuffer's endianness in 32bit
colour is wrong and I have no idea (yet) how to change that, so many apps
using xrender will crash.
 1.2 04-Jan-2015  macallan branches: 1.2.2;
support hardware acceleration, adapted from OpenBSD
TODO: figure out how to do host blits so we can get away without mapping the
framebuffer
 1.1 16-Dec-2014  macallan first draft of a driver for SMSI,mgx
More or less an Alliance Semiconductors ProMotion AT24 with some PCI-SBus
glue and 4MB framebuffer. No acceleration yet, just enough wsdisplay/vcons
setup and DAC programming to be functional.
 1.2.2.4 28-Aug-2017  skrll Sync with HEAD
 1.2.2.3 19-Mar-2016  skrll Sync with HEAD
 1.2.2.2 06-Apr-2015  skrll Sync with HEAD
 1.2.2.1 04-Jan-2015  skrll file mgxreg.h was added on branch nick-nhusb on 2015-04-06 15:18:13 +0000
 1.5.2.2 03-Dec-2017  jdolecek update from HEAD
 1.5.2.1 29-Jul-2017  jdolecek file mgxreg.h was added on branch tls-maxphys on 2017-12-03 11:37:32 +0000
 1.66 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.65 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.64 24-Apr-2021  thorpej branches: 1.64.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.63 21-Apr-2016  macallan branches: 1.63.34;
more RASTERCONSOLE purging
 1.62 25-Jul-2014  dholland branches: 1.62.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.61 16-Mar-2014  dholland branches: 1.61.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.60 19-Nov-2013  macallan get rid of junk variable
 1.59 27-Oct-2012  chs branches: 1.59.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.58 05-Oct-2012  macallan get rid of gc_attr & allocattr()
 1.57 21-Sep-2012  macallan support anti-aliased fonts, glyph caching etc.
 1.56 11-Jan-2012  macallan branches: 1.56.6;
use rasops_init(0, 0)
 1.55 04-May-2010  macallan branches: 1.55.8; 1.55.12;
use box drawing font if needed
 1.54 01-Mar-2010  macallan branches: 1.54.2;
make latching optional.
The SPARCbook docs claim it's necessary but my 3GX happily works without.
 1.53 01-Mar-2010  macallan fix ancient typo, noticed by mouse@
 1.52 24-Feb-2010  dyoung A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.51 08-Jan-2010  dyoung branches: 1.51.2;
Expand PMF_FN_* macros.
 1.50 19-Sep-2009  tsutsui u_intNN_t -> uintNN_t
 1.49 17-Sep-2009  tsutsui Include "ioconf.h" instead of extern struct cfdriver foo_cd decls.
 1.48 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.47 20-Aug-2009  macallan call vcons_replay_msgbuf() if we're the console
 1.46 03-Jun-2009  macallan make this compile again without tctrl
 1.45 27-May-2009  macallan use pmf, while there do some cleanup, fix typos etc.
 1.44 27-May-2009  macallan finally commit a lot of stuff that's been sitting in my source tree for
several ages:
- convert to device_t
- add support for programming colour depth and such, use it to reset the
console to something usable when we enter ddb or exit X etc.
- basic power management
TODO:
- convert to PMF
- get rid of rconsole code so we don't need to map the framebuffer
- power down the whole DAC when not in use
 1.43 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.42 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.41 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.40 26-Dec-2008  he branches: 1.40.2;
Sprinkle #if NTCTRL > 0 so that this builds again without
warning that some static function is defined but never used.
 1.39 11-Jun-2008  drochner branches: 1.39.4;
mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.38 28-Apr-2008  martin branches: 1.38.2; 1.38.4;
Remove clause 3 and 4 from TNF licenses
 1.37 05-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 04-Mar-2007  christos branches: 1.35.2; 1.35.14; 1.35.16; 1.35.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.34 24-Sep-2006  jmcneill branches: 1.34.4;
Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
 1.33 28-May-2006  blymn branches: 1.33.6; 1.33.8;
Clean up bogus whitespace
 1.32 15-Apr-2006  jmmv branches: 1.32.2;
Remove the getwschar and putwschar accessops from wsdisplay drivers as
requested by uwe@. These were wrong because they were receiving an
emulcookie yet they were accessops (thus having to receive an accesscookie).
Instead, just handle the WSDISPLAYIO_{GET,PUT}WSCHAR ioctls from the
driver's ioctl accessop.

As this reduces the amount of code needed to handle these operations to
two small functions in each driver, remove the WSDISPLAY_CHARFUNCS kernel
option.

Reviewed by, at least, uwe@ and macallan@. No objections in tech-kern@.
 1.31 12-Apr-2006  jmmv Add an extra cookie to the ioctl and mmap wsdisplay accessops that points
to the screen on which they are being called. The driver cannot guess
this by itself but it is needed to implement, at least, the getwschar and
putwschar functions in the correct place. There are no functional changes
yet.

Tested on i386 (vga, vga_raster, machfb, vesafb), macppc and sparc64.
Suggested and reviewed by macallan@.
 1.30 06-Apr-2006  drochner kill NULL initialisation of get/setborder
 1.29 29-Mar-2006  thorpej Use device_cfdata().
 1.28 08-Mar-2006  macallan branches: 1.28.2;
sprinkle #if NWSDISPLAY > 0 to make this compile cleanly without wscons again
 1.27 06-Mar-2006  macallan branches: 1.27.2;
- use vcons
- enable the external VGA port when tctrl detects a monitor
 1.26 14-Dec-2005  christos branches: 1.26.4; 1.26.6; 1.26.8;
proc -> lwp
 1.25 11-Dec-2005  christos merge ktrace-lwp.
 1.24 12-Nov-2005  macallan Add hardware cursor support, needs testing.
 1.23 04-Jun-2005  tsutsui branches: 1.23.2;
Fix a shadowing variable.
 1.22 16-May-2005  macallan forgot to include rasops_glue.h
 1.21 16-May-2005  macallan Added:
- wscons support
- acceleration
- virtual consoles
- colour
- made cg3 emulation optional for native XFree driver
 1.20 27-Feb-2005  perry branches: 1.20.2;
nuke trailing whitespace
 1.19 17-Mar-2004  pk branches: 1.19.8; 1.19.10;
Rename PROM_getprop*() => prom_getprop*().
 1.18 25-Aug-2003  uwe Undo previous as it broke things.

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.17 24-Aug-2003  uwe #include "opt_rcons.h"
 1.16 29-Jun-2003  fvdl branches: 1.16.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.15 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.14 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.13 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.12 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.11 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.10 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.9 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.8 11-Mar-2002  pk branches: 1.8.4; 1.8.6;
Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.7 08-Dec-2001  cyber The prom doesn't setup the fb if its not set to console.
We shouldn't try to configure it in that case.
This will make serial console work. completes fix to PR#14213
(Private email determined PR author was using serial console.)
 1.6 08-Dec-2001  soren Pass sbus addresses to sbus_bus_map(), not sbus_bus_addr()'d ones.
 1.5 13-Nov-2001  lukem add RCSIDs
 1.4 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.3 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.2 07-Jan-2001  mrg branches: 1.2.2; 1.2.4; 1.2.6;
avoid unused variables if not RASTERCONSOLE
 1.1 20-Aug-2000  pk branches: 1.1.2;
Move these SBus drivers here from arch/sparc.
 1.1.2.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.1.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 20-Aug-2000  bouyer file p9100.c was added on branch thorpej_scsipi on 2000-11-20 22:35:48 +0000
 1.2.6.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.2.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.4.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.4.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.4.4 28-Jun-2002  jdolecek hook fbkqfilter to leaf drivers' kqfilter
 1.2.4.3 28-Jun-2002  jdolecek prove kqfilter hook; it's very simple equivalent of seltrue()
 1.2.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.9 11-Nov-2002  nathanw Catch up to -current
 1.2.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.7 17-Sep-2002  nathanw Catch up to -current.
 1.2.2.6 27-Aug-2002  nathanw Catch up to -current.
 1.2.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.2.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.2.2 08-Oct-2001  nathanw Catch up to -current.
 1.2.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.8.6.1 22-Nov-2002  tron Pull up revision 1.9 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.8.4.2 29-Aug-2002  gehenna catch up with -current.
 1.8.4.1 16-May-2002  gehenna Add the character device switch.
 1.16.2.7 11-Dec-2005  christos Sync with head.
 1.16.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.16.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.16.2.4 04-Feb-2005  skrll Adapt to branch.
 1.16.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.8.1 29-Apr-2005  kent sync with -current
 1.20.2.2 08-Jun-2005  tron Pull up revision 1.22 (requested by martin in ticket #379):
forgot to include rasops_glue.h
 1.20.2.1 08-Jun-2005  tron Pull up revision 1.21 (requested by martin in ticket #379):
Added:
- wscons support
- acceleration
- virtual consoles
- colour
- made cg3 emulation optional for native XFree driver
 1.23.2.4 27-Oct-2007  yamt sync with head.
 1.23.2.3 03-Sep-2007  yamt sync with head.
 1.23.2.2 30-Dec-2006  yamt sync with head.
 1.23.2.1 21-Jun-2006  yamt sync with head.
 1.26.8.5 26-Jun-2006  yamt sync with head.
 1.26.8.4 24-May-2006  yamt sync with head.
 1.26.8.3 11-Apr-2006  yamt sync with head
 1.26.8.2 01-Apr-2006  yamt sync with head.
 1.26.8.1 13-Mar-2006  yamt sync with head.
 1.26.6.2 01-Jun-2006  kardel Sync with head.
 1.26.6.1 22-Apr-2006  simonb Sync with head.
 1.26.4.1 09-Sep-2006  rpaulo sync with head
 1.27.2.1 19-Apr-2006  elad sync with head.
 1.28.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.28.2.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.32.2.1 19-Jun-2006  chap Sync with head.
 1.33.8.1 22-Oct-2006  yamt sync with head
 1.33.6.1 18-Nov-2006  ad Sync with head.
 1.34.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.35.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.35.16.1 06-Nov-2007  matt sync with HEAD
 1.35.14.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.35.2.1 23-Oct-2007  ad Sync with head.
 1.36.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.36.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.36.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.37.4.7 11-Aug-2010  yamt sync with head.
 1.37.4.6 11-Mar-2010  yamt sync with head
 1.37.4.5 16-Sep-2009  yamt sync with head
 1.37.4.4 20-Jun-2009  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.4.1 18-Jun-2008  simonb Sync with head.
 1.38.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.39.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.39.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.40.2.2 23-Jul-2009  jym Sync with HEAD.
 1.40.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.51.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.51.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.54.2.1 30-May-2010  rmind sync with head
 1.55.12.1 18-Feb-2012  mrg merge to -current.
 1.55.8.3 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.55.8.2 30-Oct-2012  yamt sync with head
 1.55.8.1 17-Apr-2012  yamt sync with head
 1.56.6.3 03-Dec-2017  jdolecek update from HEAD
 1.56.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.56.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.59.2.1 18-May-2014  rmind sync with head
 1.61.2.1 10-Aug-2014  tls Rebase.
 1.62.4.1 22-Apr-2016  skrll Sync with HEAD
 1.63.34.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.64.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.6 21-Sep-2012  macallan support anti-aliased fonts, glyph caching etc.
 1.5 27-May-2009  macallan branches: 1.5.12; 1.5.22;
add a bunch of register definitions
 1.4 28-Apr-2008  martin branches: 1.4.10; 1.4.14; 1.4.18;
Remove clause 3 and 4 from TNF licenses
 1.3 06-Mar-2006  macallan branches: 1.3.62; 1.3.64; 1.3.66;
- use vcons
- enable the external VGA port when tctrl detects a monitor
 1.2 12-Nov-2005  macallan branches: 1.2.6; 1.2.8; 1.2.10;
Add hardware cursor support, needs testing.
 1.1 16-May-2005  macallan branches: 1.1.2; 1.1.4; 1.1.10;
Added:
- wscons support
- acceleration
- virtual consoles
- colour
- made cg3 emulation optional for native XFree driver
 1.1.10.3 11-Dec-2005  christos Sync with head.
 1.1.10.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.10.1 16-May-2005  skrll file p9100reg.h was added on branch ktrace-lwp on 2005-11-10 14:07:47 +0000
 1.1.4.1 21-Jun-2006  yamt sync with head.
 1.1.2.2 08-Jun-2005  tron Pull up revision 1.1 (requested by martin in ticket #379):
Added:
- wscons support
- acceleration
- virtual consoles
- colour
- made cg3 emulation optional for native XFree driver
 1.1.2.1 16-May-2005  tron file p9100reg.h was added on branch netbsd-3 on 2005-06-08 11:57:27 +0000
 1.2.10.1 13-Mar-2006  yamt sync with head.
 1.2.8.1 22-Apr-2006  simonb Sync with head.
 1.2.6.1 09-Sep-2006  rpaulo sync with head
 1.3.66.2 20-Jun-2009  yamt sync with head
 1.3.66.1 16-May-2008  yamt sync with head.
 1.3.64.1 18-May-2008  yamt sync with head.
 1.3.62.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.18.1 21-Apr-2010  matt sync to netbsd-5
 1.4.14.1 23-Jul-2009  jym Sync with HEAD.
 1.4.10.2 18-Oct-2009  bouyer back out ticket #993
 1.4.10.1 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #993):
sys/dev/sbus/p9100reg.h: revision 1.5
add a bunch of register definitions
 1.5.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.5.12.1 30-Oct-2012  yamt sync with head
 1.81 15-Oct-2025  thorpej These drivers can use ether_getaddr() instead of prom_getether() now.
 1.80 29-Jun-2024  riastradh if_stats(9): Add ifp argument to if_stat..._ref.

This will enable us to pass the ifp through to a dtrace probe inside.

No functional change intended in this change, but this is an API
change visible to modules so it shouldn't be pulled up.

PR kern/58377
 1.79 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.78 02-Sep-2022  thorpej Remove unnecessary inclusion of <net/netisr.h>.
 1.77 19-Mar-2020  thorpej Don't bother with IFF_OACTIVE. Just keep processing so long as
sc->sc_rb.rb_td_nbusy is less than sc->sc_rb.rb_ntbuf.
 1.76 29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.75 29-May-2019  msaitoh branches: 1.75.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.74 28-May-2019  msaitoh Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.73 23-May-2019  msaitoh Whitespace fix (mainly tabify).
 1.72 23-May-2019  msaitoh -No functional change:
- KNF
- u_int*_t -> uint*_t.
 1.71 05-Feb-2019  msaitoh Remove very old IFF_NOTRAILERS flag.
 1.70 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.69 26-Jun-2018  msaitoh branches: 1.69.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.68 22-Jun-2018  msaitoh It's not required to include net/bpfdesc.h. Remove it.
 1.67 15-Dec-2016  ozaki-r branches: 1.67.8; 1.67.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.66 02-Oct-2016  christos MFREE -> m_free
 1.65 10-Jun-2016  ozaki-r branches: 1.65.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.64 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.63 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.62 23-Jun-2012  jdc branches: 1.62.2; 1.62.16;
Fix multicast filter set up: we need to byte-swap the hash before writing to
the chip. While here, remove open-coded copy of ether_crc32_le().
 1.61 22-Jun-2012  jdc Fix fallout from revision 1.46, and call ether_ioctl() in the default path.
Patch from John D. Baker in PR port-sparc/46572.
 1.60 02-Feb-2012  tls branches: 1.60.2;
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.59 18-Jul-2011  mrg branches: 1.59.2; 1.59.6;
convert the remaining dev/sbus drivers to CFATTACH_DECL_NEW, cfdata_t
and device_t, including the pci frontend and backend for en(4).
 1.58 05-Apr-2010  joerg 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.57 19-Jan-2010  pooka branches: 1.57.2; 1.57.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.56 22-Sep-2009  tsutsui Remove some more unnecessary casts.
 1.55 19-Sep-2009  tsutsui u_intNN_t -> uintNN_t
 1.54 18-Sep-2009  tsutsui Use uint8_t pointers for TX/RX buffers to avoid extra pointer casts.
 1.53 18-Sep-2009  tsutsui - use device_private(), proper types and variables for device_t/softc
- remove unnecessary casts against void pointer

XXX: many inconsistent use of aprint_*(9) and printf(9)
 1.52 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.51 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.50 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.49 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.48 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.47 16-Dec-2008  christos branches: 1.47.2;
replace bitmask_snprintf(9) with snprintb(3)
 1.46 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.45 28-Apr-2008  martin branches: 1.45.6; 1.45.8;
Remove clause 3 and 4 from TNF licenses
 1.44 05-Apr-2008  cegger branches: 1.44.2; 1.44.4;
use aprint_*_dev and device_xname
 1.43 19-Oct-2007  ad branches: 1.43.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.42 01-Sep-2007  dyoung branches: 1.42.4;
Change a bazillion occurrences of code resembling this,

error = (cmd == SIOCADDMULTI) ?
ether_addmulti(ifr, &sc->sc_ec) :
ether_delmulti(ifr, &sc->sc_ec);

if (error == ENETRESET) {

to this,

if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {

which does the same thing.

(A bazillion is a very large number. This seems to make the i386
ALL kernel smaller by 3kB to 4kB.)

Use ifreq_getaddr() twice in es(4).

Whitespace nits.
 1.41 04-Mar-2007  christos branches: 1.41.2; 1.41.10; 1.41.14; 1.41.16;
fix fallout from caddr_t changes.
 1.40 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.39 07-Sep-2006  dogcow branches: 1.39.8;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.38 24-Dec-2005  perry branches: 1.38.4; 1.38.8;
__inline__ -> inline
 1.37 11-Dec-2005  christos merge ktrace-lwp.
 1.36 30-May-2005  christos branches: 1.36.2;
avoid shadow variables.
 1.35 27-Feb-2005  perry nuke trailing whitespace
 1.34 04-Feb-2005  perry de-__P
 1.33 30-Oct-2004  thorpej branches: 1.33.4; 1.33.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.32 17-Mar-2004  pk branches: 1.32.4;
Rename PROM_getprop*() => prom_getprop*().
 1.31 15-Mar-2004  pk Replace myetheraddr() by prom_getether().
 1.30 03-May-2003  wiz branches: 1.30.2;
DMA, not dma nor Dma.
 1.29 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.28 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.27 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.26 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.25 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.24 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.23 22-May-2002  wiz bcmp -> memcmp.
 1.22 20-Mar-2002  eeh branches: 1.22.4; 1.22.6;
Don't use BUS_SPACE_MAP_LINEAR if you don't need to.
 1.21 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.20 06-Mar-2002  frueauf Make this work after it got broken a year ago in r1.15 (pasto?):
In qeattach() sc->sc_rb.rb_dmabase needs to be set after the buffer got
loaded via bus_dmamem_map(), not before.

Fixes my own pr kern/15817.
 1.19 13-Nov-2001  lukem add RCSIDs
 1.18 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.17 12-Sep-2001  eeh Properly initialize sc->sc_bustag and sc->sc_dmatag;
 1.16 30-Mar-2001  christos branches: 1.16.2; 1.16.4;
make all debugging messages conditional on sc->sc_debug.
 1.15 08-Mar-2001  thorpej Use bus_dmamap_load(), not bus_dmamap_load_raw().
 1.14 14-Jan-2001  thorpej branches: 1.14.2;
Use splnet() to block network interrupts, not splimp().
 1.13 14-Dec-2000  thorpej ALTQ'ify.
 1.12 15-Nov-2000  thorpej Move bpfattach()/bpfdetach() calls into ether_ifattach()/ether_ifdetach().
 1.11 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.10 10-May-2000  pk branches: 1.10.4;
No need to specify page alignment; this is automatic.
 1.9 10-May-2000  pk Fix bogus `boundary' argument in bus_dmamap_create().
 1.8 09-May-2000  pk Conform bus_dmamem_{alloc,map} usage to bus_dma(9) specs.
 1.7 24-Jun-1999  pk branches: 1.7.2;
Don't turn on the engine too early.
Add and use QEDEBUG.
 1.6 18-May-1999  thorpej Rework layer 2 protocol input routines. Instead of calling e.g. ether_input()
directly, call the function pointer (*if_input)(ifp, m). The input routine
expects the packet header to be at the head of the packet, and will adjust
as necessary. Privatize the layer 2 input and output routines, allowing
*_ifattach() to set them up as appropriate.
 1.5 23-Mar-1999  pk branches: 1.5.4;
Fix promiscuous modes - patches from Jason Wright.
 1.4 09-Mar-1999  mrg make this compile on SUN4U. XXX icky, reader beware.
 1.3 03-Feb-1999  mrg use <dev/sbus/sbusvar.h> not <sparc/dev/sbusvar.h>
 1.2 18-Jan-1999  pk Fix AF_NS code.
 1.1 17-Jan-1999  pk Import Jason Wright's Sbus Quad ethernet (`qe') driver as found in OpenBSD.
Heavily pounded on by me to make it fit our driver model.
Also added: auto media selection; shared ring buffer code with `be'.
 1.5.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.7.2.6 21-Apr-2001  bouyer Sync with HEAD
 1.7.2.5 12-Mar-2001  bouyer Sync with HEAD.
 1.7.2.4 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.7.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.7.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.7.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.4.2 22-Jan-2002  he Pull up revision 1.16 (requested by pk):
Make all debugging messages conditional on sc->sc_debug.
 1.10.4.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.14.2.9 11-Dec-2002  thorpej Sync with HEAD.
 1.14.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.14.2.7 27-Aug-2002  nathanw Catch up to -current.
 1.14.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.14.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.14.2.4 14-Nov-2001  nathanw Catch up to -current.
 1.14.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.14.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.14.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.16.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.16.2.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.16.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.16.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.16.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.16.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.22.6.1 22-Nov-2002  tron Pull up revision 1.24 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.22.4.2 29-Aug-2002  gehenna catch up with -current.
 1.22.4.1 30-May-2002  gehenna Catch up with -current.
 1.30.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.30.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.30.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.30.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.30.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.30.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.30.2.1 03-Aug-2004  skrll Sync with HEAD
 1.32.4.1 24-Jan-2005  he Pull up revision 1.33 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
 1.33.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.33.6.1 12-Feb-2005  yamt sync with head.
 1.33.4.1 29-Apr-2005  kent sync with -current
 1.36.2.4 27-Oct-2007  yamt sync with head.
 1.36.2.3 03-Sep-2007  yamt sync with head.
 1.36.2.2 30-Dec-2006  yamt sync with head.
 1.36.2.1 21-Jun-2006  yamt sync with head.
 1.38.8.1 14-Sep-2006  yamt sync with head.
 1.38.4.1 09-Sep-2006  rpaulo sync with head
 1.39.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.41.16.1 06-Nov-2007  matt sync with HEAD
 1.41.14.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.41.14.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.41.10.1 03-Sep-2007  skrll Sync with HEAD.
 1.41.2.2 23-Oct-2007  ad Sync with head.
 1.41.2.1 09-Oct-2007  ad Sync with head.
 1.42.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.43.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.43.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.44.4.5 11-Aug-2010  yamt sync with head.
 1.44.4.4 11-Mar-2010  yamt sync with head
 1.44.4.3 16-May-2009  yamt sync with head
 1.44.4.2 04-May-2009  yamt sync with head.
 1.44.4.1 16-May-2008  yamt sync with head.
 1.44.2.1 18-May-2008  yamt sync with head.
 1.45.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.45.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.45.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.47.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.57.4.1 30-May-2010  rmind sync with head
 1.57.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.59.6.1 18-Feb-2012  mrg merge to -current.
 1.59.2.2 30-Oct-2012  yamt sync with head
 1.59.2.1 17-Apr-2012  yamt sync with head
 1.60.2.1 04-Jul-2012  riz Pull up following revision(s) (requested by jdc in ticket #367):
sys/dev/sbus/qe.c: revision 1.61
sys/dev/sbus/qe.c: revision 1.62
Fix fallout from revision 1.46, and call ether_ioctl() in the default path.
Patch from John D. Baker in PR port-sparc/46572.
Fix multicast filter set up: we need to byte-swap the hash before writing to
the chip. While here, remove open-coded copy of ether_crc32_le().
 1.62.16.5 05-Feb-2017  skrll Sync with HEAD
 1.62.16.4 05-Oct-2016  skrll Sync with HEAD
 1.62.16.3 09-Jul-2016  skrll Sync with HEAD
 1.62.16.2 19-Mar-2016  skrll Sync with HEAD
 1.62.16.1 06-Jun-2015  skrll Sync with HEAD
 1.62.2.1 03-Dec-2017  jdolecek update from HEAD
 1.65.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.65.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.67.14.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.67.14.2 28-Jul-2018  pgoyette Sync with HEAD
 1.67.14.1 25-Jun-2018  pgoyette Sync with HEAD
 1.67.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.69.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.69.2.1 10-Jun-2019  christos Sync with HEAD
 1.75.4.1 29-Feb-2020  ad Sync with head.
 1.55 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.54 22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.53 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.52 10-May-2021  thorpej branches: 1.52.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.51 24-Apr-2021  thorpej branches: 1.51.2; 1.51.4;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.50 19-Sep-2009  tsutsui branches: 1.50.80;
u_intNN_t -> uintNN_t
 1.49 19-Sep-2009  tsutsui Split device_t/softc.
Tested on:
---
qec0 at sbus0 slot 3 offset 0x20000: 128K memory
be0 at qec0 slot 0 offset 0x0 level 4 (ipl 7): rev 1, address 00:80:17:xx:xx:xx
 1.48 18-Sep-2009  tsutsui Use uint8_t pointers for TX/RX buffers to avoid extra pointer casts.
 1.47 18-Sep-2009  tsutsui - wrap a long line
- ANSIfy
 1.46 18-Sep-2009  tsutsui - use device_private(), proper types and variables for device_t/softc
- remove unnecessary casts against void pointer

XXX: many inconsistent use of aprint_*(9) and printf(9)
 1.45 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.44 17-May-2009  tsutsui Use device_private() to get struct sbus_softc from device_t parent.

XXX: sbus_softc has been split from device_t on sparc, but not on sparc64!?
 1.43 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.42 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.41 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.40 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.39 28-Apr-2008  martin branches: 1.39.8; 1.39.14;
Remove clause 3 and 4 from TNF licenses
 1.38 05-Apr-2008  cegger branches: 1.38.2; 1.38.4;
use aprint_*_dev and device_xname
 1.37 19-Oct-2007  ad branches: 1.37.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.36 04-Mar-2007  christos branches: 1.36.2; 1.36.14; 1.36.16; 1.36.20;
fix fallout from caddr_t changes.
 1.35 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.34 11-Dec-2005  christos branches: 1.34.26;
merge ktrace-lwp.
 1.33 30-May-2005  christos branches: 1.33.2;
avoid shadow variables.
 1.32 04-Feb-2005  perry de-__P
 1.31 30-Jun-2004  pk branches: 1.31.4; 1.31.6;
Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.
 1.30 28-Jun-2004  pk Put back qec_bus_map(), since sparc64's mainbus and sbus drivers do not
use the tag's translation ranges yet.
 1.29 27-Jun-2004  pk Bus tags should now be constructed by copying the parent's bus tag and
then changing the fields that need to be handled by the child bus.
 1.28 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.27 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.26 10-Dec-2002  pk branches: 1.26.6;
Remove the `flags' argument from bus_intr_establish().
 1.25 10-Dec-2002  pk bus_intr_establish() signature change.

The additional `fast trap' argument is ignored in these drivers.
 1.24 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.23 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.22 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.21 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.20 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.19 20-Mar-2002  eeh branches: 1.19.4; 1.19.6;
Clean up bus space a bit. XXX is sc_buffer ever actually used after it's
mapped in?
 1.18 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.17 14-Jan-2002  tsutsui Call malloc(9) with M_ZERO flag instead of bzero() after malloc().
 1.16 04-Dec-2001  wiz Replace some misuses of "then" with "than".
 1.15 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.14 13-Nov-2001  lukem add RCSIDs
 1.13 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.12 04-Dec-2000  fvdl branches: 1.12.2; 1.12.4; 1.12.6;
Avoid compile warning on sparc64 32bit. sc_buffer doesn't seem to be
used at all, this line can probably be removed.
 1.11 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.10 11-Jan-2000  pk branches: 1.10.4;
Remove old-style boot device recognition.
 1.9 24-Jun-1999  pk branches: 1.9.2;
Issue a reset command when initializing.
 1.8 17-Jan-1999  pk branches: 1.8.4;
Share ring buffer code and data structure for `be' and `qe' in
the QEC module. Adapt the QEC interrupt establish code to suit the
needs of the `qe' device.
 1.7 16-Jan-1999  pk Convert to bus_space(9).
Add buffer allocations needed by the be driver.
 1.6 30-Aug-1998  pk Use sbus attach args features.
getpropA() => getprop()
 1.5 29-Aug-1998  pk Nuke unnecessary header files.
 1.4 21-Aug-1998  pk vm_offset_t => vaddr_t.
 1.3 29-Jul-1998  pk Use sbus_destroy_attach_args().
 1.2 28-Jul-1998  pk Fix #includes.
Remove #ifdef SUN4C & SUN4M.
 1.1 27-Jul-1998  pk qec `bus' driver; much like lebuffer.
 1.8.4.1 01-Jul-1999  thorpej Sync w/ -current.
 1.9.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.9.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.4.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.12.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.12.4.6 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.12.4.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.12.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.12.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.12.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.12.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.2.8 11-Dec-2002  thorpej Sync with HEAD.
 1.12.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.12.2.6 27-Aug-2002  nathanw Catch up to -current.
 1.12.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.12.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.12.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.12.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.12.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.19.6.1 22-Nov-2002  tron Pull up revision 1.20 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.19.4.1 29-Aug-2002  gehenna catch up with -current.
 1.26.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.26.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.26.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.26.6.1 03-Aug-2004  skrll Sync with HEAD
 1.31.6.1 12-Feb-2005  yamt sync with head.
 1.31.4.1 29-Apr-2005  kent sync with -current
 1.33.2.2 27-Oct-2007  yamt sync with head.
 1.33.2.1 03-Sep-2007  yamt sync with head.
 1.34.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.36.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.36.16.1 06-Nov-2007  matt sync with HEAD
 1.36.14.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.2.1 23-Oct-2007  ad Sync with head.
 1.37.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.38.4.5 11-Mar-2010  yamt sync with head
 1.38.4.4 20-Jun-2009  yamt sync with head
 1.38.4.3 16-May-2009  yamt sync with head
 1.38.4.2 04-May-2009  yamt sync with head.
 1.38.4.1 16-May-2008  yamt sync with head.
 1.38.2.1 18-May-2008  yamt sync with head.
 1.39.14.2 23-Jul-2009  jym Sync with HEAD.
 1.39.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.39.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.50.80.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.51.4.1 31-May-2021  cjep sync with head
 1.51.2.1 13-May-2021  thorpej Sync with HEAD.
 1.52.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.4 19-Sep-2009  tsutsui u_intNN_t -> uintNN_t
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 16-Jan-1999  pk branches: 1.2.140; 1.2.142; 1.2.144;
Convert to bus_space(9).
Add buffer allocations needed by the be driver.
 1.1 27-Jul-1998  pk qec device register definitions (from OpenBSD).
 1.2.144.2 11-Mar-2010  yamt sync with head
 1.2.144.1 16-May-2008  yamt sync with head.
 1.2.142.1 18-May-2008  yamt sync with head.
 1.2.140.1 02-Jun-2008  mjf Sync with HEAD.
 1.14 19-Sep-2009  tsutsui Split device_t/softc.
Tested on:
---
qec0 at sbus0 slot 3 offset 0x20000: 128K memory
be0 at qec0 slot 0 offset 0x0 level 4 (ipl 7): rev 1, address 00:80:17:xx:xx:xx
 1.13 18-Sep-2009  tsutsui Use uint8_t pointers for TX/RX buffers to avoid extra pointer casts.
 1.12 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.11 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.10 04-Mar-2007  christos branches: 1.10.36; 1.10.38; 1.10.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 11-Dec-2005  christos branches: 1.9.26;
merge ktrace-lwp.
 1.8 04-Feb-2005  perry branches: 1.8.6;
de-__P
 1.7 30-Jun-2004  pk branches: 1.7.4; 1.7.6;
The sc_range and sc_nrange fields are no longer used.
 1.6 03-May-2003  wiz branches: 1.6.2;
DMA, not dma nor Dma.
 1.5 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.4 17-Jan-1999  pk branches: 1.4.20; 1.4.22; 1.4.34; 1.4.36;
Share ring buffer code and data structure for `be' and `qe' in
the QEC module. Adapt the QEC interrupt establish code to suit the
needs of the `qe' device.
 1.3 16-Jan-1999  pk Convert to bus_space(9).
Add buffer allocations needed by the be driver.
 1.2 29-Jul-1998  pk `struct rom_range' => `struct sbus_range'
 1.1 27-Jul-1998  pk qec `bus' driver; much like lebuffer.
 1.4.36.1 22-Nov-2002  tron Pull up revision 1.5 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.4.34.1 29-Aug-2002  gehenna catch up with -current.
 1.4.22.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.20.1 27-Aug-2002  nathanw Catch up to -current.
 1.6.2.4 04-Feb-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.6.1 12-Feb-2005  yamt sync with head.
 1.7.4.1 29-Apr-2005  kent sync with -current
 1.8.6.1 03-Sep-2007  yamt sync with head.
 1.9.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.10.40.2 11-Mar-2010  yamt sync with head
 1.10.40.1 16-May-2008  yamt sync with head.
 1.10.38.1 18-May-2008  yamt sync with head.
 1.10.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.7 19-Sep-2009  tsutsui u_intNN_t -> uintNN_t
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 03-May-2003  wiz branches: 1.5.100; 1.5.102; 1.5.104;
DMA, not dma nor Dma.
 1.4 25-Dec-2002  jdolecek fix typo in QE_CR_STAT_BITS - bit indication for EDEFER was wrong
Reported in kern/19557 by Ron Roskens
 1.3 24-Jul-2000  mycroft branches: 1.3.2;
Purge C++-style comments.
 1.2 20-Apr-1999  pk branches: 1.2.2; 1.2.12;
Correct QESTAT `%b' format string.
 1.1 17-Jan-1999  pk branches: 1.1.2;
Import Jason Wright's Sbus Quad ethernet (`qe') driver as found in OpenBSD.
Heavily pounded on by me to make it fit our driver model.
Also added: auto media selection; shared ring buffer code with `be'.
 1.1.2.1 23-Apr-1999  perry branches: 1.1.2.1.2;
pullup 1.1->1.2 (pk)
 1.1.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.12.1 26-Jul-2000  mycroft Approved by thorpej:
Do not use C++-style comments in C code.

syssrc/sys/dev/sbus/bereg.h 1.3 -> 1.4
syssrc/sys/dev/sbus/qereg.h 1.2 -> 1.3
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.1 29-Dec-2002  thorpej Sync with HEAD.
 1.5.104.2 11-Mar-2010  yamt sync with head
 1.5.104.1 16-May-2008  yamt sync with head.
 1.5.102.1 18-May-2008  yamt sync with head.
 1.5.100.1 02-Jun-2008  mjf Sync with HEAD.
 1.27 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.26 17-May-2008  macallan device_t
 1.25 28-Apr-2008  martin branches: 1.25.2;
Remove clause 3 and 4 from TNF licenses
 1.24 11-Dec-2005  christos branches: 1.24.70; 1.24.72; 1.24.74;
merge ktrace-lwp.
 1.23 04-Jun-2005  tsutsui Add const.
 1.22 27-Feb-2005  perry nuke trailing whitespace
 1.21 04-Feb-2005  perry de-__P
 1.20 01-Aug-2003  pk branches: 1.20.8; 1.20.10;
Get machine/dev/sbusvar.h for SUN4D too.
 1.19 27-Sep-2002  thorpej branches: 1.19.6;
Declare all cfattach structures const.
 1.18 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.17 20-Mar-2002  eeh branches: 1.17.2; 1.17.4; 1.17.6;
Oops. Missing semicolon.
 1.16 20-Mar-2002  eeh Add sbus_promaddr_to_handle() to convert a prom address to a bus_space_handle_t.
 1.15 15-Mar-2002  eeh Get rid of bus_type_t.
 1.14 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.13 03-Feb-2002  darrenr add missing #include for SUN4 options
 1.12 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.11 01-Nov-2000  eeh branches: 1.11.2; 1.11.4; 1.11.6;
Pass along the bus frequency too, for devices that need it.
 1.10 11-Jan-2000  pk Remove old-style boot device recognition.
 1.9 06-Sep-1998  eeh branches: 1.9.12;
Do it right for a change.
 1.8 06-Sep-1998  eeh Oops. Fix overenthusiastic macro.
 1.7 05-Sep-1998  eeh The `address' field from the prom is really an unsigned 32-bit value.
Make it so.
 1.6 05-Sep-1998  eeh Remove function name conflict.
 1.5 05-Sep-1998  pk sparc64 uses more of this file.
 1.4 25-Aug-1998  pk Also include SUN4 in the temporary split
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 29-Jul-1998  pk branches: 1.2.2;
Move some Sbus structures in here.
* attach arguments now directly support multiple register and
interrupt sets.
* address translation (`ranges') has been made bus-specific
* introduce sbus_destroy_attach_arg() to clean up after
attaching an an Sbus device.
 1.1 27-Jul-1998  pk Move "sbusvar.h" hack in here.
Also define SBUS_BURST_* values here.
 1.2.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.9.12.2 22-Nov-2000  bouyer Sync with HEAD.
 1.9.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.11.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.11.4.6 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.11.4.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.11.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.11.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.11.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.11.2.4 27-Aug-2002  nathanw Catch up to -current.
 1.11.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.11.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.11.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.17.6.1 22-Nov-2002  tron Pull up revision 1.18 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.17.4.1 29-Aug-2002  gehenna catch up with -current.
 1.17.2.1 26-Mar-2002  eeh sbus_setup_attach_args() needs to return a struct device pointer now.
 1.19.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.19.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.19.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.19.6.1 03-Aug-2004  skrll Sync with HEAD
 1.20.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.10.1 12-Feb-2005  yamt sync with head.
 1.20.8.1 29-Apr-2005  kent sync with -current
 1.24.74.3 11-Mar-2010  yamt sync with head
 1.24.74.2 04-May-2009  yamt sync with head.
 1.24.74.1 16-May-2008  yamt sync with head.
 1.24.72.1 18-May-2008  yamt sync with head.
 1.24.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.25.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.28 07-Dec-2021  andvar fix typos in word "instead", mainly in log messages.
 1.27 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.26 24-Apr-2021  thorpej branches: 1.26.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.25 12-Nov-2019  msaitoh branches: 1.25.10;
Add missing initialization of sc_dev.
 1.24 18-Jul-2011  mrg branches: 1.24.46; 1.24.54; 1.24.60;
convert the remaining dev/sbus drivers to CFATTACH_DECL_NEW, cfdata_t
and device_t, including the pci frontend and backend for en(4).
 1.23 18-Sep-2009  tsutsui - use device_private(), proper types and variables for device_t/softc
- remove unnecessary casts against void pointer

XXX: many inconsistent use of aprint_*(9) and printf(9)
 1.22 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.21 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.20 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.19 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.18 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.17 29-May-2008  mrg branches: 1.17.6; 1.17.12;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.16 05-Apr-2008  cegger branches: 1.16.2; 1.16.4; 1.16.6;
use aprint_*_dev and device_xname
 1.15 11-Dec-2005  christos branches: 1.15.70;
merge ktrace-lwp.
 1.14 27-Feb-2005  perry nuke trailing whitespace
 1.13 04-Feb-2005  perry de-__P
 1.12 17-Mar-2004  pk branches: 1.12.8; 1.12.10;
Rename PROM_getprop*() => prom_getprop*().
 1.11 10-Dec-2002  pk branches: 1.11.6;
Remove the `flags' argument from bus_intr_establish().
 1.10 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.9 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.6 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.5 04-Sep-2002  martin Adapt to sbusvar.h changes.
 1.4 20-Mar-2002  eeh branches: 1.4.4;
Get rid of unnecessary BUS_SPACE_MAP_LINEAR.
 1.3 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.2 13-Nov-2001  lukem branches: 1.2.2;
add RCSIDs
 1.1 03-Oct-2001  mrg branches: 1.1.2; 1.1.4;
frontend driver for the 16 port serial card by aurora technologies. this
doesn't quite work yet -- interrupt acknowledgement is hosed (and thus the
device keeps interrupting). uses the newly commited cd18xx backend.
 1.1.4.2 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.4.1 03-Oct-2001  fvdl file sio16.c was added on branch thorpej-devvp on 2001-10-11 00:02:26 +0000
 1.1.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.5 17-Sep-2002  nathanw Catch up to -current.
 1.1.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2 08-Oct-2001  nathanw Catch up to -current.
 1.1.2.1 03-Oct-2001  nathanw file sio16.c was added on branch nathanw_sa on 2001-10-08 20:11:27 +0000
 1.2.2.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.2.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.1 13-Nov-2001  thorpej file sio16.c was added on branch kqueue on 2002-01-10 19:58:13 +0000
 1.4.4.1 16-May-2002  gehenna Remove unnecessary header.
 1.11.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.11.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.6.1 03-Aug-2004  skrll Sync with HEAD
 1.12.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.12.10.1 12-Feb-2005  yamt sync with head.
 1.12.8.1 29-Apr-2005  kent sync with -current
 1.15.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.16.4.3 11-Mar-2010  yamt sync with head
 1.16.4.2 16-May-2009  yamt sync with head
 1.16.4.1 04-May-2009  yamt sync with head.
 1.16.2.1 04-Jun-2008  yamt sync with head
 1.17.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.17.6.1 28-Apr-2009  skrll Sync with HEAD.
 1.24.60.1 14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #425):

sys/dev/sbus/sio16.c: revision 1.25
sys/dev/gpib/mt.c: revision 1.33
sys/arch/mvme68k/dev/wdsc.c: revision 1.33
sys/dev/gpib/ct.c: revision 1.31
sys/dev/isa/mcd.c: revision 1.119
sys/dev/pci/if_stge.c: revision 1.73
sys/dev/gpib/ppi.c: revision 1.25
sys/dev/pcmcia/if_tr_pcmcia.c: revision 1.29
sys/arch/amiga/dev/zssc.c: revision 1.46
sys/arch/mac68k/obio/iwm_fd.c: revision 1.57
sys/arch/amiga/dev/if_qn.c: revision 1.48
sys/dev/isa/tcic2_isa.c: revision 1.28
sys/dev/isa/uha_isa.c: revision 1.42
sys/dev/pci/neo.c: revision 1.55
sys/arch/next68k/dev/nextdisplay.c: revision 1.22
sys/dev/isa/if_iy.c: revision 1.111

Add missing initialization of sc_dev.

Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.

Add missing initialization of sc_dev.
 1.24.54.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.24.46.1 14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1439):

sys/dev/sbus/sio16.c: revision 1.25
sys/dev/gpib/mt.c: revision 1.33
sys/arch/mvme68k/dev/wdsc.c: revision 1.33
sys/dev/gpib/ct.c: revision 1.31
sys/dev/isa/mcd.c: revision 1.119
sys/dev/pci/if_stge.c: revision 1.73
sys/dev/gpib/ppi.c: revision 1.25
sys/dev/pcmcia/if_tr_pcmcia.c: revision 1.29
sys/arch/amiga/dev/zssc.c: revision 1.46
sys/arch/mac68k/obio/iwm_fd.c: revision 1.57
sys/arch/amiga/dev/if_qn.c: revision 1.48
sys/dev/isa/tcic2_isa.c: revision 1.28
sys/dev/isa/uha_isa.c: revision 1.42
sys/dev/pci/neo.c: revision 1.55
sys/arch/next68k/dev/nextdisplay.c: revision 1.22
sys/dev/isa/if_iy.c: revision 1.111

Add missing initialization of sc_dev.


Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.


Add missing initialization of sc_dev.
 1.25.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.26.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.35 26-Oct-2022  riastradh spif(4): Convert to ttylock/ttyunlock.
 1.34 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.33 24-Apr-2021  thorpej branches: 1.33.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.32 10-Nov-2019  chs branches: 1.32.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.31 25-Jul-2014  dholland branches: 1.31.28;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.30 16-Mar-2014  dholland branches: 1.30.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.29 15-Sep-2013  martin Remove unused variables
 1.28 18-Jul-2011  mrg branches: 1.28.2; 1.28.12; 1.28.16;
convert the remaining dev/sbus drivers to CFATTACH_DECL_NEW, cfdata_t
and device_t, including the pci frontend and backend for en(4).
 1.27 02-Jul-2011  mrg avoid some uninitialised variable warnings from GCC 4.5. i'm pretty
sure they can't happen in practise, but i can see why GCC isn't sure.
 1.26 24-Apr-2011  rmind Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.25 19-Sep-2009  tsutsui branches: 1.25.4; 1.25.6;
u_intNN_t -> uintNN_t
 1.24 17-Sep-2009  tsutsui Include "ioconf.h" instead of extern struct cfdriver foo_cd decls.
 1.23 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.22 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.21 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.20 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.19 11-Dec-2008  hauke branches: 1.19.2;
Fix warning about missing initializer that showed up in sparc64
builds, but, strangely enough, not in sparc builds.

Relevant for netbsd-{4,5} release branches.
 1.18 11-Jun-2008  drochner branches: 1.18.2; 1.18.4; 1.18.6;
mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.17 11-Jun-2008  cegger - use device_lookup_private to get softc
- ansify
fixes build errors about pointer type mismatches in assignment
 1.16 25-May-2008  ad branches: 1.16.2;
Properly fix the "hanging in tty" bug that was worked around with cv_wakeup()
some time again.
 1.15 05-Apr-2008  cegger branches: 1.15.2; 1.15.4; 1.15.6;
use aprint_*_dev and device_xname
 1.14 19-Nov-2007  ad branches: 1.14.14;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.13 07-Nov-2007  ad Merge tty changes from the vmlocking branch.
 1.12 19-Oct-2007  ad branches: 1.12.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.11 08-Oct-2007  ad branches: 1.11.2;
Use the softint API.
 1.10 04-Mar-2007  christos branches: 1.10.2; 1.10.14; 1.10.16; 1.10.18;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 01-Oct-2006  elad branches: 1.9.2; 1.9.4;
More from Matt Fleming:

Adapt to KAUTH_DEVICE_TTY_PRIVSET and KAUTH_DEVICE_TTY_OPEN.
 1.8 01-Oct-2006  elad Adapt MD code to KAUTH_DEVICE_TTY_OPEN, batch #2 from Matt Fleming, thanks!

Also, add forgotten splx() calls in some places.
 1.7 21-Jul-2006  ad branches: 1.7.4; 1.7.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.6 15-May-2006  yamt include kauth.h for kauth_authorize_generic.
 1.5 14-May-2006  elad integrate kauth.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.6; 1.4.8; 1.4.10; 1.4.12;
merge ktrace-lwp.
 1.3 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.2 27-Feb-2005  perry branches: 1.2.4;
nuke trailing whitespace
 1.1 24-Jul-2004  mrg branches: 1.1.2; 1.1.6; 1.1.8;
Hauke Fath's port of the openbsd SUNW,spif driver from PR#26061.
the driver was originally written by Jason L. Wright.

XXX: i haven't tested this on sparc64 at all...
 1.1.8.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.6.1 29-Apr-2005  kent sync with -current
 1.1.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.5 04-Feb-2005  skrll Adapt to branch.
 1.1.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.2 03-Aug-2004  skrll Sync with HEAD
 1.1.2.1 24-Jul-2004  skrll file spif.c was added on branch ktrace-lwp on 2004-08-03 10:51:05 +0000
 1.2.4.6 07-Dec-2007  yamt sync with head
 1.2.4.5 15-Nov-2007  yamt sync with head.
 1.2.4.4 27-Oct-2007  yamt sync with head.
 1.2.4.3 03-Sep-2007  yamt sync with head.
 1.2.4.2 30-Dec-2006  yamt sync with head.
 1.2.4.1 21-Jun-2006  yamt sync with head.
 1.4.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.4.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.4.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.4.8.2 11-Aug-2006  yamt sync with head
 1.4.8.1 24-May-2006  yamt sync with head.
 1.4.6.1 01-Jun-2006  kardel Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.7.6.1 22-Oct-2006  yamt sync with head
 1.7.4.1 18-Nov-2006  ad Sync with head.
 1.9.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.2.1 10-Dec-2010  bouyer Pull up following revision(s) (requested by hauke in ticket #1412):
sys/dev/sbus/spif.c: revision 1.19
Fix warning about missing initializer that showed up in sparc64
builds, but, strangely enough, not in sparc builds.
Relevant for netbsd-{4,5} release branches.
 1.10.18.1 14-Oct-2007  yamt sync with head.
 1.10.16.3 09-Jan-2008  matt sync with HEAD
 1.10.16.2 08-Nov-2007  matt sync with -HEAD
 1.10.16.1 06-Nov-2007  matt sync with HEAD
 1.10.14.3 21-Nov-2007  joerg Sync with HEAD.
 1.10.14.2 11-Nov-2007  joerg Sync with HEAD.
 1.10.14.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.10.2.2 23-Oct-2007  ad Sync with head.
 1.10.2.1 17-Jun-2007  ad - Increase the number of thread priorities from 128 to 256. How the space
is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
is provided, with hooks for fast-path MD code that can run the interrupt
threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.
 1.11.2.3 21-Nov-2007  bouyer Sync with HEAD
 1.11.2.2 13-Nov-2007  bouyer Sync with HEAD
 1.11.2.1 25-Oct-2007  bouyer Sync with HEAD.
 1.12.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.12.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.14.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.14.14.2 29-Jun-2008  mjf Sync with HEAD.
 1.14.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.15.4.3 11-Mar-2010  yamt sync with head
 1.15.4.2 16-May-2009  yamt sync with head
 1.15.4.1 04-May-2009  yamt sync with head.
 1.15.2.2 17-Jun-2008  yamt sync with head.
 1.15.2.1 04-Jun-2008  yamt sync with head
 1.16.2.1 18-Jun-2008  simonb Sync with head.
 1.18.6.1 07-Jan-2011  riz Pull up following revision(s) (requested by hauke in ticket #1506):
sys/dev/sbus/spif.c: revision 1.19
Fix warning about missing initializer that showed up in sparc64
builds, but, strangely enough, not in sparc builds.
Relevant for netbsd-{4,5} release branches.
 1.18.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.18.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.18.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.19.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.25.4.1 31-May-2011  rmind sync with head
 1.28.16.1 18-May-2014  rmind sync with head
 1.28.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.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.30.2.1 10-Aug-2014  tls Rebase.
 1.31.28.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.32.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.33.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.7 09-Jul-2018  christos Remove duplicate copies of the SET/CLR/ISSET macros.
 1.6 09-Jul-2018  kre Avoid redefining SET/CLR/ISSET (which in the kernel are normally
defined in <sys/types.h>). These redefinitions (when they are,
that is, when types.h is included) were sneaking through because
they were defined identically ... until CLR in <sys/types.h> was
changed... Avoid that issue arising again.
 1.5 15-Nov-2014  christos branches: 1.5.18; 1.5.20;
centralize the dialout/call unit macros.
 1.4 12-May-2009  cegger branches: 1.4.22;
struct device * -> device_t, no functional changes intended.
 1.3 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.2 11-Dec-2005  christos branches: 1.2.74; 1.2.90;
merge ktrace-lwp.
 1.1 24-Jul-2004  mrg branches: 1.1.2;
Hauke Fath's port of the openbsd SUNW,spif driver from PR#26061.
the driver was originally written by Jason L. Wright.

XXX: i haven't tested this on sparc64 at all...
 1.1.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.2 03-Aug-2004  skrll Sync with HEAD
 1.1.2.1 24-Jul-2004  skrll file spifreg.h was added on branch ktrace-lwp on 2004-08-03 10:51:05 +0000
 1.2.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.74.1 16-May-2009  yamt sync with head
 1.4.22.1 03-Dec-2017  jdolecek update from HEAD
 1.5.20.1 10-Jun-2019  christos Sync with HEAD
 1.5.18.1 28-Jul-2018  pgoyette Sync with HEAD
 1.5 31-Oct-2022  andvar s/interrut/interrupt/ and s/accelelerator/accelerator/ in comments.
 1.4 18-Jul-2011  mrg convert the remaining dev/sbus drivers to CFATTACH_DECL_NEW, cfdata_t
and device_t, including the pci frontend and backend for en(4).
 1.3 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.2 11-Dec-2005  christos branches: 1.2.74;
merge ktrace-lwp.
 1.1 24-Jul-2004  mrg branches: 1.1.2;
Hauke Fath's port of the openbsd SUNW,spif driver from PR#26061.
the driver was originally written by Jason L. Wright.

XXX: i haven't tested this on sparc64 at all...
 1.1.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.2 03-Aug-2004  skrll Sync with HEAD
 1.1.2.1 24-Jul-2004  skrll file spifvar.h was added on branch ktrace-lwp on 2004-08-03 10:51:05 +0000
 1.2.74.1 11-Mar-2010  yamt sync with head
 1.73 24-Dec-2022  andvar s/reqest/request/, s/requst/request/ and s/reuqest/request/ in comments.
 1.72 04-May-2022  andvar fix various typos in comments and log messages.
 1.71 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.70 24-Apr-2021  thorpej branches: 1.70.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.69 01-Dec-2015  martin branches: 1.69.34;
Remove some diagnostic/debug messages.
 1.68 04-Oct-2015  joerg Drop unused (inline) function.
 1.67 27-Oct-2012  chs branches: 1.67.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.66 26-Jul-2011  dyoung branches: 1.66.2; 1.66.12;
Don't set the iobase and iosize members of pcmciabus_attach_args because
they're not used in any meaningful way.
 1.65 18-Jul-2011  mrg convert the remaining dev/sbus drivers to CFATTACH_DECL_NEW, cfdata_t
and device_t, including the pci frontend and backend for en(4).
 1.64 19-Sep-2009  tsutsui u_intNN_t -> uintNN_t
 1.63 18-Sep-2009  tsutsui - use device_private(), proper types and variables for device_t/softc
- remove unnecessary casts against void pointer

XXX: many inconsistent use of aprint_*(9) and printf(9)
 1.62 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.61 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.60 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.59 16-Mar-2009  dsl ANSIfy functions with function-pointer arguments
 1.58 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.57 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.56 16-Dec-2008  christos branches: 1.56.2;
replace bitmask_snprintf(9) with snprintb(3)
 1.55 28-Apr-2008  martin branches: 1.55.8;
Remove clause 3 and 4 from TNF licenses
 1.54 05-Apr-2008  cegger branches: 1.54.2; 1.54.4;
use aprint_*_dev and device_xname
 1.53 06-Jan-2008  martin branches: 1.53.6;
With the new IPL world, things are easier for us: if we can get the
nell hardware interrupt handler run at IPL_VM, we can call the socket
drivers interrupt handler directly.
This is always possible on sparc64, but on sparc we might have to fall
back to the old softint bounce. Since this uses arbitrary IPLs, we
can not use the new softint_* for this - we'll have to use the old
sparc_softintr_* functions.
 1.52 19-Oct-2007  ad branches: 1.52.2; 1.52.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.51 08-Oct-2007  ad branches: 1.51.2;
Use the softint API.
 1.50 09-Jul-2007  ad branches: 1.50.6; 1.50.8; 1.50.10;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.49 11-Dec-2006  jdc branches: 1.49.6; 1.49.8;
Add an explicit NULL for the card_detect function (that we don't have/need)
in struct pcmcia_chip_functions {}.
This now compiles again (adding -Wextra exposed this).

OK martin@.
 1.48 29-Mar-2006  thorpej branches: 1.48.8; 1.48.10; 1.48.12;
Use device_cfdata().
 1.47 24-Dec-2005  perry branches: 1.47.4; 1.47.6; 1.47.8; 1.47.10; 1.47.12;
__inline__ -> inline
 1.46 10-Nov-2005  martin Use mstohz() for timeout calculations.
Avoid local stack addresses as tsleep identifiers.
 1.45 05-Nov-2005  martin Rename the wait channels (one was a copy&pasto, the other much too long)
 1.44 01-Jun-2005  jdc branches: 1.44.2;
Rename "delay" variable to avoid shadowing the "delay" from param.h.
 1.43 27-Feb-2005  perry nuke trailing whitespace
 1.42 04-Feb-2005  perry de-__P
 1.41 11-Aug-2004  mycroft branches: 1.41.4; 1.41.6;
Clear IOIE in settype(), too. Not that we currently change modes without
powering down the socket, but...
 1.40 11-Aug-2004  mycroft Clear some more ICR0 bits on socket enable/disable.
 1.39 11-Aug-2004  mycroft Add a settype() function.
XXX Note that I haven't even compiled this, but any problems are likely to be
more straightforward than crashing with a null pointer dereference.
 1.38 05-Jul-2004  pk Use bus_space_tag_alloc(). Remove unused `sc_bustag' from softc.
 1.37 05-Jul-2004  martin Adapt to new (non optional) bus space on sparc.
 1.36 18-May-2004  martin Handle STP4020_ISR0_SCINT (status change interrupt posted) - by ignoring
it.
 1.35 23-Dec-2003  martin branches: 1.35.2;
Only ACK pending interrupts (instead of all possible). Log interrupts we
probably should have handled but didn't. Minor cleanup.
 1.34 07-Jan-2003  martin branches: 1.34.2;
Add SUN4U magic to make nell work without things like WI_AT_BIGENDIAN_HACK.

XXX - need to move this (as well as the equivalent sparc stuff added
recently) outa here into sbus_machdep or something. We should not need
to know details of the actual bus_space implementation here.
 1.33 03-Jan-2003  martin Separate the sbus bus_space_tag_t used for access to nell hardware from
the self constructed little endian pcmcia bus_space_tag_t used for the
client drivers.
 1.32 03-Jan-2003  mrg part one of bus_space(9) fixes to enable bus spaces to override the
bus_space_{read,write}_[1248]() functions, which will allow 16-bit
PCMCIA support to work without additional hacks in MI drivers.
this option is not enabled yet.
 1.31 02-Jan-2003  martin Call interrupt handlers from a soft interrupt to decouple them from the
(sometimes excessive) SPL assigned by the firmware to the sbus interrupt.
Protect access to hardware by splhigh().
 1.30 01-Jan-2003  thorpej Use aprint_normal() in cfprint routines.
 1.29 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.28 10-Oct-2002  martin Only use one interrupt handler for both status changes and pcmcia IO
intterupts. No more races between the two interrupt handlers, without any
locking, and the driver becomes a bit simpler too.

Use the last bit of the config flags to select between the first and the
second sbus interrupt level the firmware has assigned to us.
 1.27 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.26 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.25 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.24 04-Sep-2002  martin Adapt to recent sbusvar.h changes.

Use a slightly less conservative timing configuration.
 1.23 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.22 25-Mar-2002  martin branches: 1.22.2; 1.22.4;
Remove dummy_splraise() - it is not needed according to Paul Kranenburg.
We may revisit this once a general interrupt queuing mechanism is
available and we can avoid calling the pcmcia cards interrupt handler at
an exsessive IPL.
 1.21 20-Mar-2002  eeh Get rid of unnecessary BUS_SPACE_MAP_LINEAR.
 1.20 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.19 10-Mar-2002  martin Remove another old debug message.
Return the real mapping size in *_mem_map and *_io_map.
Minor cleanup.
 1.18 08-Mar-2002  martin branches: 1.18.2;
Shuffle around some initialization code a bit.
Configure power supply on VPP1 at 5V when powering up a socket.
Get rid of stray interrupts.
Make the driver quiet for normal operation when not in debugging mode.

This makes ray0 at nell0 actually work when compiled with RAY_USE_AMEM=1.
 1.17 04-Mar-2002  simonb Don't "extern int cold;" - this is in <sys/kernel.h>.
 1.16 03-Mar-2002  martin Try to configure timing correctly.
Get rid of some ad hoc debuging printfs.
 1.15 01-Mar-2002  martin Simplify the way the hardware windows are mapped and adapt the pcmcia
chipset functions acordingly. Initialize timing registers (for now to
the slowest possible setting).

Add some debug output. XXX - clean this up.

This is not ready for prime time, but I can attach ray0 and wi0 now in my
LX.
 1.14 15-Dec-2001  soren To make dev/pcmcia work on platforms with 64-bit bus_addr_t and
32-bit bus_size_t (sparc), change the pcmcia_mem_map(9) offsetp
argument to bus_size_t as it is used as a bus_space offset.
 1.13 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.12 13-Nov-2001  lukem add RCSIDs
 1.11 09-Jul-2000  pk branches: 1.11.2; 1.11.4;
Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.10 22-Feb-2000  pk branches: 1.10.4;
Simplify the attach routine a bit.
 1.9 22-Feb-2000  pk Fix some off-by-one errors; patch from Jonathan O'Brien.
 1.8 13-Jan-2000  joda (stp4020_chip_mem_map): explicitly don't handle 8-bit memory
 1.7 21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.6 05-Nov-1999  pk Fix some diagnostic output with a patch from Jonathan O'Brien.
 1.5 06-Jul-1999  thorpej branches: 1.5.2; 1.5.4; 1.5.8;
Make the kthread API a bit more friendly to loadable kernel modules.
 1.4 29-Mar-1999  pk branches: 1.4.4;
Initialize automatics in stp4020print(); noticed by Jonathan O'Brien.
 1.3 27-Feb-1999  pk Fix the bus print function.
 1.2 27-Feb-1999  pk Our device name differs from the PROMs node name.
 1.1 22-Nov-1998  pk The beginnings of a driver for the Sbus <=> PCMCIA bridge chipset STP4020.
 1.4.4.1 02-Aug-1999  thorpej Update from trunk.
 1.5.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.4.1 15-Nov-1999  fvdl Sync with -current
 1.5.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.4.1 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.11.4.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.11.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.11.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.11.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.2.10 07-Jan-2003  martin Catch up to -current.
 1.11.2.9 03-Jan-2003  thorpej Sync with HEAD (again).
 1.11.2.8 03-Jan-2003  thorpej Sync with HEAD.
 1.11.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.11.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.11.2.5 17-Sep-2002  nathanw Catch up to -current.
 1.11.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.11.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.11.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.11.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.18.2.1 17-Mar-2002  thorpej IPL_IMP -> IPL_VM
 1.22.4.1 19-Jun-2003  msaitoh Apply patch (requested by martin in ticket #1319):
Make it compilable.
 1.22.2.1 20-Jun-2002  gehenna catch up with -current.
 1.34.2.8 11-Dec-2005  christos Sync with head.
 1.34.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.34.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.34.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.34.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.34.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.34.2.2 12-Aug-2004  skrll Sync with HEAD.
 1.34.2.1 03-Aug-2004  skrll Sync with HEAD
 1.35.2.1 20-May-2004  tron Pull up revision 1.36 (requested by martin in ticket #352):
Handle STP4020_ISR0_SCINT (status change interrupt posted) - by ignoring
it.
 1.41.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.41.6.1 12-Feb-2005  yamt sync with head.
 1.41.4.1 29-Apr-2005  kent sync with -current
 1.44.2.5 21-Jan-2008  yamt sync with head
 1.44.2.4 27-Oct-2007  yamt sync with head.
 1.44.2.3 03-Sep-2007  yamt sync with head.
 1.44.2.2 30-Dec-2006  yamt sync with head.
 1.44.2.1 21-Jun-2006  yamt sync with head.
 1.47.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.47.10.1 19-Apr-2006  elad sync with head.
 1.47.8.1 01-Apr-2006  yamt sync with head.
 1.47.6.1 22-Apr-2006  simonb Sync with head.
 1.47.4.1 09-Sep-2006  rpaulo sync with head
 1.48.12.1 12-Dec-2006  tron Pull up following revision(s) (requested by jdc in ticket #270):
sys/dev/sbus/stp4020.c: revision 1.49
Add an explicit NULL for the card_detect function (that we don't have/need)
in struct pcmcia_chip_functions {}.
This now compiles again (adding -Wextra exposed this).
OK martin@.
 1.48.10.1 18-Dec-2006  yamt sync with head.
 1.48.8.1 12-Jan-2007  ad Sync with head.
 1.49.8.1 11-Jul-2007  mjf Sync with head.
 1.49.6.5 23-Oct-2007  ad Sync with head.
 1.49.6.4 15-Jul-2007  ad Sync with head.
 1.49.6.3 15-Jul-2007  ad Sync with head.
 1.49.6.2 17-Jun-2007  ad - Increase the number of thread priorities from 128 to 256. How the space
is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
is provided, with hooks for fast-path MD code that can run the interrupt
threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.
 1.49.6.1 13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.50.10.1 14-Oct-2007  yamt sync with head.
 1.50.8.2 09-Jan-2008  matt sync with HEAD
 1.50.8.1 06-Nov-2007  matt sync with HEAD
 1.50.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.51.2.1 25-Oct-2007  bouyer Sync with HEAD.
 1.52.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.52.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.53.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.53.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.54.4.4 11-Mar-2010  yamt sync with head
 1.54.4.3 16-May-2009  yamt sync with head
 1.54.4.2 04-May-2009  yamt sync with head.
 1.54.4.1 16-May-2008  yamt sync with head.
 1.54.2.1 18-May-2008  yamt sync with head.
 1.55.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.55.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.56.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.66.12.2 03-Dec-2017  jdolecek update from HEAD
 1.66.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.66.2.1 30-Oct-2012  yamt sync with head
 1.67.14.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.69.34.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.70.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.5 06-Aug-2025  andvar s/attibute/attribute/ and s/previosly/previously/ in comments.
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 23-Dec-2003  martin Only ACK pending interrupts (instead of all possible). Log interrupts we
probably should have handled but didn't. Minor cleanup.
 1.1 22-Nov-1998  pk branches: 1.1.44;
The beginnings of a driver for the Sbus <=> PCMCIA bridge chipset STP4020.
 1.1.44.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.44.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.44.1 03-Aug-2004  skrll Sync with HEAD
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.62 02-Jun-2025  jdc Use normal (not error) output if we're the console.
 1.61 25-Sep-2022  thorpej branches: 1.61.10;
Remove unnecessary include of <sys/malloc.h>.
 1.60 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.59 24-Apr-2021  thorpej branches: 1.59.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.58 24-Jan-2018  riastradh branches: 1.58.20;
Fix integer overflows noted by Silvio Cesare of InfoSect.

Someone^TM should name these idioms so we can eliminate this class of
copypasta bug.
 1.57 23-Sep-2016  macallan - finally fix tcx_clearscreen() and tcx_eraserows() to actually work, and
not just by accident
- sprinkle volatile in order to force gcc 5.4 to emit ldd/std for 64bit
accesses - BLIT and STIP spaces require those
 1.56 25-Jul-2014  dholland branches: 1.56.4; 1.56.8;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.55 22-Jul-2014  macallan restore the right colour map when X exits
 1.54 16-Jul-2014  macallan - move all register definitions and hardware documenting comments to
tcxreg.h
- expand hardware documenting comments
no functional change
 1.53 07-Jul-2014  macallan actually put the colour space ID where it belongs in tcx_clearscreen()
 1.52 24-Jun-2014  macallan use STIP/BLIT on 8bit tcx and RSTIP/RBLIT on S24
 1.51 18-Jun-2014  macallan 8bit tcx doesn't implement a hardware cursor, so don't pretend it does.
Also, avoid poking the hw cursor registers in that case. Real hardware doesn't
care but qemu does.
 1.50 17-Jun-2014  macallan fix a few 8bit tcx issues:
- set ROP when clearing the screen, tcx actually uses it
- deal with possible 2MB VRAM tcx
while there, consistently use aprint_* in tcxattach()
 1.49 17-Jun-2014  macallan remove last remnants of CG8 emulation
 1.48 13-May-2014  martin Do not attach if the STIP register is way too small (this happens in qemu
due to buggy emulation and causes crashes).
 1.47 09-May-2014  jdc Cosmetic fix: s/8bit/8-bit/ and new line for 8-bit only TCX's.
 1.46 29-Apr-2014  macallan return a match score >1 to beat out genfb if present
 1.45 16-Mar-2014  dholland branches: 1.45.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.44 11-Jan-2012  macallan branches: 1.44.6; 1.44.10;
use rasops_init(0, 0)
 1.43 04-May-2010  macallan branches: 1.43.8; 1.43.12;
use box drawing font if needed
 1.42 17-Sep-2009  tsutsui branches: 1.42.2; 1.42.4;
Include "ioconf.h" instead of extern struct cfdriver foo_cd decls.
 1.41 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.40 26-Aug-2009  macallan adjust some mmap ranges so X can work, also use FBTYPE_TCXCOLOR
 1.39 20-Aug-2009  macallan call vcons_replay_msgbuf() if we're the console
 1.38 20-Aug-2009  macallan use vcons_replay_msgbuf()
 1.37 20-Aug-2009  macallan add support for a hardware cursor via wsdisplay
 1.36 19-Aug-2009  macallan clear the screen and initialize it with the right WID to bypass the LUT on
24bit boards when switching to WSDISPLAYIO_MODE_FB
Now 24bit X with wsfb looks right.
TODO:
- hardware cursor
- acceleration
 1.35 19-Aug-2009  macallan - more cosmetics
- support screen blanking ioctl()s on both /dev/fb* and wsdisplay
 1.34 19-Aug-2009  macallan - some cosmetic fixes
- add support for screen blanking via /dev/fb*
- reimplement colour map ioctl()s for /dev/fb*
- implement mmap and ioctl for wscons, map 8 or 24bit framebuffer depending
on hardware
With this X works with the wsfb driver in 24bit.
TODO:
- fix wsfb to use the right pixel format for S24
- implement wsdisplay colour map ioctl()s
- add hardware cursor support for wscons and /dev/fb*
 1.33 18-Aug-2009  macallan device_t-ify
 1.32 06-Aug-2009  macallan make the tcx driver do something useful:
- attach a wsdisplay
- make it work with an S24
- accelerate scrolling and character drawing
This isn't quite finished yet, it works fine as a console but most things
X will need are not functional right now.
 1.31 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.30 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.29 18-Apr-2009  tsutsui Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
 1.28 18-Mar-2009  cegger bcopy -> memcpy
 1.27 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.26 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.25 11-Jun-2008  drochner branches: 1.25.4; 1.25.10;
mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.24 28-Apr-2008  martin branches: 1.24.2; 1.24.4;
Remove clause 3 and 4 from TNF licenses
 1.23 05-Apr-2008  cegger branches: 1.23.2; 1.23.4;
use aprint_*_dev and device_xname
 1.22 19-Oct-2007  ad branches: 1.22.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.21 04-Mar-2007  christos branches: 1.21.2; 1.21.14; 1.21.16; 1.21.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20 07-Jan-2007  jdc branches: 1.20.2;
Allow this to compile with -DDEBUG: convert proc to lwp->l_proc.
 1.19 29-Mar-2006  thorpej branches: 1.19.8;
Use device_cfdata().
 1.18 11-Dec-2005  christos branches: 1.18.4; 1.18.6; 1.18.8; 1.18.10; 1.18.12;
merge ktrace-lwp.
 1.17 04-Feb-2005  perry branches: 1.17.6;
de-__P
 1.16 14-Jul-2004  pk branches: 1.16.4; 1.16.6;
Make this compile with the TCX_CG8 option turned on (PR#26269).
 1.15 29-Jun-2003  fvdl branches: 1.15.2; 1.15.4;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.14 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.13 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.12 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.11 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.10 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.9 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.8 23-Aug-2002  thorpej Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.7 27-Mar-2002  darrenr branches: 1.7.2; 1.7.4;
Merge in the patch (PR kern/15963) to provide unaccelerated 24bit support
for the S24.
 1.6 20-Mar-2002  eeh Use bus_space_vaddr().
 1.5 11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.4 13-Nov-2001  lukem add RCSIDs
 1.3 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.2 22-Aug-2000  pk branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
Get tcxreg.h from the correct location.
 1.1 20-Aug-2000  pk Move these SBus drivers here from arch/sparc.
 1.2.8.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.2.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.6.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.2.6.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.6.5 28-Jun-2002  jdolecek hook fbkqfilter to leaf drivers' kqfilter
 1.2.6.4 28-Jun-2002  jdolecek prove kqfilter hook; it's very simple equivalent of seltrue()
 1.2.6.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.6.2 16-Mar-2002  jdolecek Catch up with -current.
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.7 11-Nov-2002  nathanw Catch up to -current
 1.2.4.6 18-Oct-2002  nathanw Catch up to -current.
 1.2.4.5 17-Sep-2002  nathanw Catch up to -current.
 1.2.4.4 27-Aug-2002  nathanw Catch up to -current.
 1.2.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.2.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 22-Aug-2000  bouyer file tcx.c was added on branch thorpej_scsipi on 2000-11-20 22:35:48 +0000
 1.7.4.1 22-Nov-2002  tron Pull up revision 1.8 (requested by martin in ticket #948):
Use the structures defined in bsd_openprom.h for "reg", "range",
and "intr" properties, rather than having identical-except-for-names
sbus_* and iommu_* versions.
 1.7.2.2 29-Aug-2002  gehenna catch up with -current.
 1.7.2.1 16-May-2002  gehenna Add the character device switch.
 1.15.4.1 15-Jul-2004  he Pull up revision 1.16 (requested by pk in ticket #659):
Make this compile with the TCX_CG8 option turned on,
fixes PR#26269.
 1.15.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.15.2.4 04-Feb-2005  skrll Adapt to branch.
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16.6.1 12-Feb-2005  yamt sync with head.
 1.16.4.1 29-Apr-2005  kent sync with -current
 1.17.6.4 27-Oct-2007  yamt sync with head.
 1.17.6.3 03-Sep-2007  yamt sync with head.
 1.17.6.2 26-Feb-2007  yamt sync with head.
 1.17.6.1 21-Jun-2006  yamt sync with head.
 1.18.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.18.10.1 19-Apr-2006  elad sync with head.
 1.18.8.1 01-Apr-2006  yamt sync with head.
 1.18.6.1 22-Apr-2006  simonb Sync with head.
 1.18.4.1 09-Sep-2006  rpaulo sync with head
 1.19.8.1 12-Jan-2007  ad Sync with head.
 1.20.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.21.16.1 06-Nov-2007  matt sync with HEAD
 1.21.14.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.21.2.1 23-Oct-2007  ad Sync with head.
 1.22.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.22.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.4.7 11-Aug-2010  yamt sync with head.
 1.23.4.6 11-Mar-2010  yamt sync with head
 1.23.4.5 16-Sep-2009  yamt sync with head
 1.23.4.4 19-Aug-2009  yamt sync with head.
 1.23.4.3 16-May-2009  yamt sync with head
 1.23.4.2 04-May-2009  yamt sync with head.
 1.23.4.1 16-May-2008  yamt sync with head.
 1.23.2.2 17-Jun-2008  yamt sync with head.
 1.23.2.1 18-May-2008  yamt sync with head.
 1.24.4.1 18-Jun-2008  simonb Sync with head.
 1.24.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.25.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.42.4.1 30-May-2010  rmind sync with head
 1.42.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.43.12.1 18-Feb-2012  mrg merge to -current.
 1.43.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.43.8.1 17-Apr-2012  yamt sync with head
 1.44.10.1 18-May-2014  rmind sync with head
 1.44.6.2 03-Dec-2017  jdolecek update from HEAD
 1.44.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.45.2.1 10-Aug-2014  tls Rebase.
 1.56.8.1 04-Nov-2016  pgoyette Sync with HEAD
 1.56.4.1 05-Oct-2016  skrll Sync with HEAD
 1.58.20.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.59.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.61.10.1 02-Aug-2025  perseant Sync with HEAD
 1.6 16-Jul-2014  macallan - move all register definitions and hardware documenting comments to
tcxreg.h
- expand hardware documenting comments
no functional change
 1.5 06-Aug-2009  macallan branches: 1.5.22; 1.5.36;
make the tcx driver do something useful:
- attach a wsdisplay
- make it work with an S24
- accelerate scrolling and character drawing
This isn't quite finished yet, it works fine as a console but most things
X will need are not functional right now.
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 27-Feb-2005  perry nuke trailing whitespace
 1.1 20-Aug-2000  pk branches: 1.1.2; 1.1.26; 1.1.34; 1.1.36;
Move these SBus drivers here from arch/sparc.
 1.1.36.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.34.1 29-Apr-2005  kent sync with -current
 1.1.26.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 20-Aug-2000  bouyer file tcxreg.h was added on branch thorpej_scsipi on 2000-11-20 22:35:49 +0000
 1.3.74.2 19-Aug-2009  yamt sync with head.
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.36.1 10-Aug-2014  tls Rebase.
 1.5.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.25 21-Jan-2022  thorpej Don't bother with prom_node_to_devhandle() if we're just forwarding along
our own node; use device_handle(self) instead.
 1.24 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.23 10-May-2021  thorpej branches: 1.23.4;
Associate the OpenBoot / OpenFirmware node with attached devices
at config_found() time.
 1.22 24-Apr-2021  thorpej branches: 1.22.2; 1.22.4;
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 18-Jul-2011  mrg branches: 1.21.70;
convert the remaining dev/sbus drivers to CFATTACH_DECL_NEW, cfdata_t
and device_t, including the pci frontend and backend for en(4).
 1.20 18-Sep-2009  tsutsui - use device_private(), proper types and variables for device_t/softc
- remove unnecessary casts against void pointer

XXX: many inconsistent use of aprint_*(9) and printf(9)
 1.19 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.18 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.17 18-Mar-2009  cegger bzero -> memset
 1.16 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.15 28-Apr-2008  martin branches: 1.15.8; 1.15.14;
Remove clause 3 and 4 from TNF licenses
 1.14 19-Oct-2007  ad branches: 1.14.16; 1.14.18; 1.14.20;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.13 11-Dec-2005  christos branches: 1.13.30; 1.13.44; 1.13.46; 1.13.50;
merge ktrace-lwp.
 1.12 04-Feb-2005  perry branches: 1.12.6;
de-__P
 1.11 17-Mar-2004  pk branches: 1.11.8; 1.11.10;
Rename PROM_getprop*() => prom_getprop*().
 1.10 01-Jan-2003  thorpej branches: 1.10.2;
Use aprint_normal() in cfprint routines.
 1.9 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.8 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 13-Nov-2001  lukem add RCSIDs
 1.5 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.4 28-Jun-2000  mrg branches: 1.4.2; 1.4.4; 1.4.6;
remove include of <vm/vm.h>
 1.3 11-Jan-2000  pk Remove old-style boot device recognition.
 1.2 27-Jul-1998  pk branches: 1.2.14;
get headers from dev/sbus
 1.1 18-Apr-1998  pk Skeleton code for the SBus expander box.
 1.2.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.4.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.4.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.2.4 03-Jan-2003  thorpej Sync with HEAD.
 1.4.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.4.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.4.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.10.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.11.10.1 12-Feb-2005  yamt sync with head.
 1.11.8.1 29-Apr-2005  kent sync with -current
 1.12.6.1 27-Oct-2007  yamt sync with head.
 1.13.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.13.46.1 06-Nov-2007  matt sync with HEAD
 1.13.44.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.13.30.1 23-Oct-2007  ad Sync with head.
 1.14.20.4 11-Mar-2010  yamt sync with head
 1.14.20.3 16-May-2009  yamt sync with head
 1.14.20.2 04-May-2009  yamt sync with head.
 1.14.20.1 16-May-2008  yamt sync with head.
 1.14.18.1 18-May-2008  yamt sync with head.
 1.14.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.21.70.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.4.1 31-May-2021  cjep sync with head
 1.22.2.1 13-May-2021  thorpej Sync with HEAD.
 1.23.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.5 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4 11-Dec-2005  christos branches: 1.4.70; 1.4.72; 1.4.74;
merge ktrace-lwp.
 1.3 04-Jun-2005  tsutsui Add const.
 1.2 11-Jan-2000  pk branches: 1.2.28;
Remove old-style boot device recognition.
 1.1 18-Apr-1998  pk branches: 1.1.14;
Skeleton code for the SBus expander box.
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.28.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.74.1 16-May-2008  yamt sync with head.
 1.4.72.1 18-May-2008  yamt sync with head.
 1.4.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.47 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.46 24-Apr-2021  thorpej branches: 1.46.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.45 10-Nov-2019  chs branches: 1.45.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.44 13-Mar-2019  thorpej In zx_cursor_color(), don't throw away the second half of the color
map data.
 1.43 13-Mar-2019  thorpej Fix an issue with FIOCSCURSOR FB_CUR_SETCMAP on zx described here:

http://mail-index.netbsd.org/port-sparc/2019/02/11/msg002134.html

by replacing the fubyte() calls with copyin() into temporary buffers.

The other issue in zx_cursor_color() mentioned in that message will
be addressed separately.
 1.42 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.41 21-Apr-2016  macallan branches: 1.41.16; 1.41.18;
more RASTERCONSOLE purging
 1.40 20-Nov-2015  christos kill subyte.
 1.39 11-Jan-2012  macallan branches: 1.39.6; 1.39.24;
use rasops_init(0, 0)
 1.38 09-Dec-2010  uebayasi branches: 1.38.8; 1.38.12;
Fix DEBUG build.
 1.37 13-Nov-2010  uebayasi 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.36 04-May-2010  macallan use box drawing font if needed
 1.35 05-Jan-2010  macallan branches: 1.35.2; 1.35.4;
fix off by one in zx_copyrect()
 1.34 05-Jan-2010  macallan fix off by one error in zx_fillrect()
while there, use vcons_replay_msgbuf()
 1.33 19-Sep-2009  tsutsui u_intNN_t -> uintNN_t
 1.32 17-Sep-2009  tsutsui Include "ioconf.h" instead of extern struct cfdriver foo_cd decls.
 1.31 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.30 26-May-2009  macallan use BUS_SPACE_MAP_LARGE
 1.29 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.28 05-May-2009  macallan clear screen on attach
 1.27 23-Apr-2009  macallan Add wscons support
 1.26 29-Mar-2009  tsutsui Get width, height, and linebytes values from prom_getpropint().
 1.25 27-Mar-2009  tsutsui Use bus_space(9) to access registers. SETREG() macro using bogus casts
against packed structures doesn't work on gcc4. (no character on screen)
See also:
http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html

Should be pulled up to netbsd-4 and netbsd-5.
 1.24 11-Jun-2008  drochner branches: 1.24.4; 1.24.6; 1.24.10;
mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.23 11-Jun-2008  cegger - use device_lookup_private to get softc
- ansify
fixes build errors about pointer type mismatches in assignment
 1.22 28-Apr-2008  martin branches: 1.22.2; 1.22.4;
Remove clause 3 and 4 from TNF licenses
 1.21 05-Apr-2008  cegger branches: 1.21.2; 1.21.4;
use aprint_*_dev and device_xname
 1.20 19-Oct-2007  ad branches: 1.20.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.19 04-Mar-2007  christos branches: 1.19.2; 1.19.14; 1.19.16; 1.19.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 07-Jan-2007  jdc branches: 1.18.2;
Allow this to compile with -DDEBUG: convert proc to lwp->l_proc.
 1.17 29-Mar-2006  thorpej branches: 1.17.8; 1.17.12;
Use device_cfdata().
 1.16 11-Dec-2005  christos branches: 1.16.4; 1.16.6; 1.16.8; 1.16.10; 1.16.12;
merge ktrace-lwp.
 1.15 04-Jun-2005  tsutsui branches: 1.15.2;
Fix a shadowing variable.
 1.14 27-Feb-2005  perry nuke trailing whitespace
 1.13 13-Nov-2003  chs branches: 1.13.8; 1.13.10;
eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.
 1.12 28-Oct-2003  chs uninitialized variables.
 1.11 28-Oct-2003  ad Uninitialized variable.
 1.10 25-Aug-2003  uwe Undo previous as it broke things.

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.9 24-Aug-2003  uwe #include "opt_rcons.h"
 1.8 29-Jun-2003  fvdl branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.7 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.6 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.5 02-Oct-2002  thorpej branches: 1.5.2;
Add trailing ; to CFATTACH_DECL.
 1.4 30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 18-Sep-2002  ad Squash some bugs.
 1.1 13-Sep-2002  ad branches: 1.1.2;
Driver for the Sun ZX/Leo framebuffer. This would be called leo, but the
amiga port already has a driver by that name.
 1.1.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.1.2.1 13-Sep-2002  nathanw file zx.c was added on branch nathanw_sa on 2002-09-17 21:21:09 +0000
 1.5.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.5.2.1 02-Oct-2002  jdolecek file zx.c was added on branch kqueue on 2002-10-10 18:42:09 +0000
 1.8.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.2.4 04-Feb-2005  skrll Adapt to branch.
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.13.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.8.1 29-Apr-2005  kent sync with -current
 1.15.2.4 27-Oct-2007  yamt sync with head.
 1.15.2.3 03-Sep-2007  yamt sync with head.
 1.15.2.2 26-Feb-2007  yamt sync with head.
 1.15.2.1 21-Jun-2006  yamt sync with head.
 1.16.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.16.10.1 19-Apr-2006  elad sync with head.
 1.16.8.1 01-Apr-2006  yamt sync with head.
 1.16.6.1 22-Apr-2006  simonb Sync with head.
 1.16.4.1 09-Sep-2006  rpaulo sync with head
 1.17.12.1 15-Apr-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #1300):
sys/dev/sbus/zx.c: revision 1.25 via patch
sys/dev/sbus/zxreg.h: revision 1.6 via patch
sys/dev/sbus/zxvar.h: revision 1.3
Use bus_space(9) to access registers. SETREG() macro using bogus casts
against packed structures doesn't work on gcc4. (no character on screen)
See also:
http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html
 1.17.8.1 12-Jan-2007  ad Sync with head.
 1.18.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.19.16.1 06-Nov-2007  matt sync with HEAD
 1.19.14.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.19.2.1 23-Oct-2007  ad Sync with head.
 1.20.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.20.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.21.4.6 11-Aug-2010  yamt sync with head.
 1.21.4.5 11-Mar-2010  yamt sync with head
 1.21.4.4 20-Jun-2009  yamt sync with head
 1.21.4.3 16-May-2009  yamt sync with head
 1.21.4.2 04-May-2009  yamt sync with head.
 1.21.4.1 16-May-2008  yamt sync with head.
 1.21.2.2 17-Jun-2008  yamt sync with head.
 1.21.2.1 18-May-2008  yamt sync with head.
 1.22.4.1 18-Jun-2008  simonb Sync with head.
 1.22.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.24.10.2 23-Jul-2009  jym Sync with HEAD.
 1.24.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.24.6.3 18-Oct-2009  bouyer Back out ticket 960
 1.24.6.2 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #960):
sys/dev/sbus/zxreg.h: revision 1.7
sys/dev/sbus/files.sbus: revision 1.32
sys/dev/sbus/zxvar.h: revision 1.4
sys/dev/sbus/zx.c: revision 1.27
Add wscons support
 1.24.6.1 03-Apr-2009  snj branches: 1.24.6.1.4;
Pull up following revision(s) (requested by tsutsui in ticket #647):
sys/dev/sbus/zx.c: revision 1.25
sys/dev/sbus/zxreg.h: revision 1.6
sys/dev/sbus/zxvar.h: revision 1.3
Use bus_space(9) to access registers. SETREG() macro using bogus casts
against packed structures doesn't work on gcc4. (no character on screen)
See also:
http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html
Should be pulled up to netbsd-4 and netbsd-5.
 1.24.6.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.24.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.35.4.2 05-Mar-2011  rmind sync with head
 1.35.4.1 30-May-2010  rmind sync with head
 1.35.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.38.12.1 18-Feb-2012  mrg merge to -current.
 1.38.8.1 17-Apr-2012  yamt sync with head
 1.39.24.2 22-Apr-2016  skrll Sync with HEAD
 1.39.24.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.39.6.1 03-Dec-2017  jdolecek update from HEAD
 1.41.18.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.41.18.1 10-Jun-2019  christos Sync with HEAD
 1.41.16.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.45.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.46.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.7 23-Apr-2009  macallan Add wscons support
 1.6 27-Mar-2009  tsutsui Use bus_space(9) to access registers. SETREG() macro using bogus casts
against packed structures doesn't work on gcc4. (no character on screen)
See also:
http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html

Should be pulled up to netbsd-4 and netbsd-5.
 1.5 08-Sep-2008  gmcgarry branches: 1.5.2; 1.5.4; 1.5.8;
Replace most gcc-specific __attribute__ uses with BSD-style sys/cdef.h
preprocessor macros.
 1.4 28-Apr-2008  martin branches: 1.4.2; 1.4.6;
Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.24; 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 27-Feb-2005  perry nuke trailing whitespace
 1.1 13-Sep-2002  ad branches: 1.1.2; 1.1.4; 1.1.10; 1.1.18; 1.1.20;
Driver for the Sun ZX/Leo framebuffer. This would be called leo, but the
amiga port already has a driver by that name.
 1.1.20.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.18.1 29-Apr-2005  kent sync with -current
 1.1.10.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.4.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.4.1 13-Sep-2002  jdolecek file zxreg.h was added on branch kqueue on 2002-10-10 18:42:10 +0000
 1.1.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.1.2.1 13-Sep-2002  nathanw file zxreg.h was added on branch nathanw_sa on 2002-09-17 21:21:10 +0000
 1.3.74.2 04-May-2009  yamt sync with head.
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.2 28-Sep-2008  mjf Sync with HEAD.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.24.1 15-Apr-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #1300):
sys/dev/sbus/zx.c: revision 1.25 via patch
sys/dev/sbus/zxreg.h: revision 1.6 via patch
sys/dev/sbus/zxvar.h: revision 1.3
Use bus_space(9) to access registers. SETREG() macro using bogus casts
against packed structures doesn't work on gcc4. (no character on screen)
See also:
http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html
 1.4.6.1 19-Oct-2008  haad Sync with HEAD.
 1.4.2.1 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.5.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.4.3 18-Oct-2009  bouyer Back out ticket 960
 1.5.4.2 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #960):
sys/dev/sbus/zxreg.h: revision 1.7
sys/dev/sbus/files.sbus: revision 1.32
sys/dev/sbus/zxvar.h: revision 1.4
sys/dev/sbus/zx.c: revision 1.27
Add wscons support
 1.5.4.1 03-Apr-2009  snj branches: 1.5.4.1.4;
Pull up following revision(s) (requested by tsutsui in ticket #647):
sys/dev/sbus/zx.c: revision 1.25
sys/dev/sbus/zxreg.h: revision 1.6
sys/dev/sbus/zxvar.h: revision 1.3
Use bus_space(9) to access registers. SETREG() macro using bogus casts
against packed structures doesn't work on gcc4. (no character on screen)
See also:
http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html
Should be pulled up to netbsd-4 and netbsd-5.
 1.5.4.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.5.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.6 19-Sep-2009  tsutsui u_intNN_t -> uintNN_t
 1.5 17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.4 23-Apr-2009  macallan Add wscons support
 1.3 27-Mar-2009  tsutsui Use bus_space(9) to access registers. SETREG() macro using bogus casts
against packed structures doesn't work on gcc4. (no character on screen)
See also:
http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html

Should be pulled up to netbsd-4 and netbsd-5.
 1.2 28-Apr-2008  martin branches: 1.2.8; 1.2.10; 1.2.14;
Remove clause 3 and 4 from TNF licenses
 1.1 13-Sep-2002  ad branches: 1.1.2; 1.1.4; 1.1.62; 1.1.108; 1.1.110; 1.1.112;
Driver for the Sun ZX/Leo framebuffer. This would be called leo, but the
amiga port already has a driver by that name.
 1.1.112.3 11-Mar-2010  yamt sync with head
 1.1.112.2 04-May-2009  yamt sync with head.
 1.1.112.1 16-May-2008  yamt sync with head.
 1.1.110.1 18-May-2008  yamt sync with head.
 1.1.108.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.62.1 15-Apr-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #1300):
sys/dev/sbus/zx.c: revision 1.25 via patch
sys/dev/sbus/zxreg.h: revision 1.6 via patch
sys/dev/sbus/zxvar.h: revision 1.3
Use bus_space(9) to access registers. SETREG() macro using bogus casts
against packed structures doesn't work on gcc4. (no character on screen)
See also:
http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html
 1.1.4.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.4.1 13-Sep-2002  jdolecek file zxvar.h was added on branch kqueue on 2002-10-10 18:42:10 +0000
 1.1.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.1.2.1 13-Sep-2002  nathanw file zxvar.h was added on branch nathanw_sa on 2002-09-17 21:21:11 +0000
 1.2.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.10.3 18-Oct-2009  bouyer Back out ticket 960
 1.2.10.2 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #960):
sys/dev/sbus/zxreg.h: revision 1.7
sys/dev/sbus/files.sbus: revision 1.32
sys/dev/sbus/zxvar.h: revision 1.4
sys/dev/sbus/zx.c: revision 1.27
Add wscons support
 1.2.10.1 03-Apr-2009  snj branches: 1.2.10.1.4;
Pull up following revision(s) (requested by tsutsui in ticket #647):
sys/dev/sbus/zx.c: revision 1.25
sys/dev/sbus/zxreg.h: revision 1.6
sys/dev/sbus/zxvar.h: revision 1.3
Use bus_space(9) to access registers. SETREG() macro using bogus casts
against packed structures doesn't work on gcc4. (no character on screen)
See also:
http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html
Should be pulled up to netbsd-4 and netbsd-5.
 1.2.10.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.2.8.1 28-Apr-2009  skrll Sync with HEAD.

RSS XML Feed