Home | History | Annotate | only in /src/sys/arch/sgimips/mace
History log of /src/sys/arch/sgimips/mace
RevisionDateAuthorComments
 1.12 08-Dec-2018  thorpej Clean up initialization of com_regs structure, in preparation for
some additional changers.
 1.11 30-Sep-2015  macallan branches: 1.11.16; 1.11.18;
pass the port's hardware address in COM_INIT_REGS() so the com driver can
figure out wether this is the console or not
 1.10 18-Feb-2015  macallan switch sgimips to common bus_dma and bus_space in arch/mips/
Tested on O2 and Indy.
Things that are compile-tested only for lack of hardware:
- GIO ethernet cards with PCI bridges
- IP2x hardware not found on Indy
- IP1x
 1.9 01-Jul-2011  dyoung branches: 1.9.12; 1.9.30;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.8 21-Nov-2009  rmind Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.
 1.7 14-Mar-2008  cube branches: 1.7.4;
Split device_t and softc for all com(4) devices (well, everything that
uses a com_softc backend). Use proper types and ansify where appropriate.
 1.6 13-Jul-2006  gdamore branches: 1.6.34; 1.6.54; 1.6.58;
Add an option COM_REGMAP to allow com(4) to use an array of register indices.
This allows us to convert aucom to just another com attachment, and cleanup
some code in the com_arbus.c.

Additionally, we use a common com_cleanup routine rather than having a
zillion copies of it in the attachment points.

This has been tested on a number architectures, and it has been shown to get
close to comparable performance when COM_REGMAP is defined, and comparable
when it is not defined.

Approved by core@. Fixes PR port-evbmips/32362.
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.8; 1.5.16;
merge ktrace-lwp.
 1.4 29-Sep-2004  sekiya branches: 1.4.12;
Use ANSI function declarations.
 1.3 19-Jan-2004  sekiya branches: 1.3.4;
Checking for IP32 in each driver is redundant -- they're attached as children
of mace, so it is sufficient to perform the check in mace_match(). Pointed
out by soren@.
 1.2 19-Jan-2004  sekiya Attach the com and mcclock devices only if the machine is an IP32.
 1.1 18-Jan-2004  sekiya Following the example of the hpc/, gio/, and ioc/ directories, move the
mace devices to their own mace/ directory. Alter conf/files.sgimips to
reflect this change in a sane manner (i.e., pull in dev/files.dev and
mace/files.mace when appropriate).

At the same time, allow crime_intr_establish() to fall through to
mace_intr_establish(). mace devices now call cpu_intr_establish().
 1.3.4.5 19-Oct-2004  skrll Sync with HEAD
 1.3.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.4.2 03-Aug-2004  skrll Sync with HEAD
 1.3.4.1 19-Jan-2004  skrll file com_mace.c was added on branch ktrace-lwp on 2004-08-03 10:40:07 +0000
 1.4.12.2 17-Mar-2008  yamt sync with head.
 1.4.12.1 30-Dec-2006  yamt sync with head.
 1.5.16.1 15-Jun-2006  gdamore MACE com(4) driver attachment rewhack. GENERIC_IP3x compiles. No real
test though, as I lack SGI hardware.
 1.5.8.1 11-Aug-2006  yamt sync with head
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.6.58.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.54.1 24-Mar-2008  keiichi sync with head.
 1.6.34.1 23-Mar-2008  matt sync with HEAD
 1.7.4.1 11-Mar-2010  yamt sync with head
 1.9.30.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.9.30.1 06-Apr-2015  skrll Sync with HEAD
 1.9.12.1 03-Dec-2017  jdolecek update from HEAD
 1.11.18.1 10-Jun-2019  christos Sync with HEAD
 1.11.16.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.11 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.10 17-Oct-2007  garbled branches: 1.10.108; 1.10.110;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.9 26-Sep-2007  macallan add mcclock_poweroff()
 1.8 13-Apr-2007  jmcneill branches: 1.8.2; 1.8.10; 1.8.12; 1.8.14;
Remove traces of macau, it never existed in the first place apart for
a handful of register definitions.
 1.7 13-Apr-2007  jmcneill Add SGI O2 MACE audio driver, from OpenBSD.
 1.6 12-Apr-2007  jmcneill Remove pckbc_mace, it has never worked and has been replaced by macekbc
 1.5 10-Apr-2007  jmcneill Add SGI MACE ps2 keyboard/aux controller driver. ok rumble@

XXX can someone confirm that we can remove pckbc_mace?
 1.4 11-Dec-2005  christos branches: 1.4.26; 1.4.30; 1.4.32;
merge ktrace-lwp.
 1.3 23-Sep-2004  tsutsui branches: 1.3.12;
Rename if_mec_mace.c -> if_mec.c.
This file contains not only an attachment but whole driver functions.
 1.2 20-Jan-2004  jdolecek branches: 1.2.4;
cleanup old lpt(4) attachment, and glue ppbus in so that they can coexist:
* lpt device is defined in MI place (dev/ppbus/files.ppbus), dev/ic/lpt.c
is included there too; dev/ic/lpt.c is not included if ppbus is
configured or if there is alternative platform lpt (like for pc532)
* g/c MD lpt definitions and custom puc/upc attachments,
glue moved to conf/files and dev/pci/files.pci respectively; remove
device lpt definition from dev/isa/files.isa
* add ppbus parport attribute, atppc device attachments, adjust plip and lpt
glue
 1.1 18-Jan-2004  sekiya Add files.dev and files.mace
 1.2.4.5 24-Sep-2004  skrll Sync with HEAD.
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 20-Jan-2004  skrll file files.mace was added on branch ktrace-lwp on 2004-08-03 10:40:07 +0000
 1.3.12.2 27-Oct-2007  yamt sync with head.
 1.3.12.1 03-Sep-2007  yamt sync with head.
 1.4.32.1 11-Jul-2007  mjf Sync with head.
 1.4.30.2 09-Oct-2007  ad Sync with head.
 1.4.30.1 27-May-2007  ad Sync with head.
 1.4.26.1 15-Apr-2007  yamt sync with head.
 1.8.14.1 06-Oct-2007  yamt sync with head.
 1.8.12.1 06-Nov-2007  matt sync with HEAD
 1.8.10.1 02-Oct-2007  joerg Sync with HEAD.
 1.8.2.1 03-Oct-2007  garbled Sync with HEAD
 1.10.110.1 05-May-2019  isaki Remove obsoleted au{,rate,vol}conv and mulaw attributes.
audio provides the equivalent of them inseparably.
 1.10.108.1 10-Jun-2019  christos Sync with HEAD
 1.65 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.64 18-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.63 29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.62 26-Dec-2019  msaitoh branches: 1.62.2;
s/lenght/length/
 1.61 30-May-2019  msaitoh Simplify MII structure initialization and reference. No functional change.
 1.60 28-May-2019  msaitoh Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.59 23-May-2019  msaitoh -No functional change:
- KNF
- u_int*_t -> uint*_t.
 1.58 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.57 26-Jun-2018  msaitoh branches: 1.57.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.56 23-Mar-2018  jmcneill No need to print interrupt status for RX underflow as this status bit is handled already
 1.55 15-Dec-2016  ozaki-r branches: 1.55.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.54 08-Dec-2016  ozaki-r Apply deferred if_start framework

if_schedule_deferred_start checks if the if_snd queue contains packets,
so drivers don't need to check it by themselves.
 1.53 10-Jun-2016  ozaki-r branches: 1.53.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.52 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.51 13-Apr-2015  riastradh Missed a spot: rnd.h -> rndsource.h.
 1.50 10-Aug-2014  tls branches: 1.50.4;
Merge tls-earlyentropy branch into HEAD.
 1.49 22-Jul-2012  matt branches: 1.49.2; 1.49.12;
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.48 02-Feb-2012  tls 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.47 19-Nov-2011  tls branches: 1.47.2;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

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

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

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

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

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

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

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

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

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

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

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

Manual pages for the new kernel interfaces are forthcoming.
 1.46 01-Jul-2011  dyoung branches: 1.46.2;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.45 20-Feb-2011  matt Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.
 1.44 10-Jan-2011  tsutsui branches: 1.44.2; 1.44.4;
Use ether_aton_r() in sys/net/if_ethersubr.c instead of home grown copies.
Hint from ryo@. Tested on IP32 mec(4).
 1.43 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.42 19-Jan-2010  pooka branches: 1.42.2; 1.42.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.41 14-Dec-2009  matt Merge from matt-nb5-mips64
Merge mips-specific arch files.
 1.40 27-Nov-2009  tsutsui Fix typo in comment.
 1.39 02-Sep-2009  tsutsui Use a proper local variable.
 1.38 02-Sep-2009  tsutsui Invert logic around nested pmf(9) registrations for readability.
 1.37 01-Sep-2009  tsutsui Check a return value of pmf_device_register1(9) and also call
pmf_class_network_register(9).
 1.36 01-Sep-2009  tsutsui Replace shutdownhook_establish(9) with pmf_device_register1(9).
 1.35 09-May-2009  tsutsui Use __func__ to print function names.
 1.34 16-Mar-2009  tsutsui Add a dumb RX hardware TCPv4/UDPv4 checksum support.
 1.33 23-Aug-2008  tsutsui branches: 1.33.2; 1.33.8; 1.33.12;
If 802.1Q VLAN MTU is enabled, ignore the bad packet errror on RX.
 1.32 23-Aug-2008  tsutsui Enable ETHERCAP_VLAN_MTU.
 1.31 23-Aug-2008  tsutsui Improve mec(4)'s TX routine by reducing possible unnecessary mbuf copies
as much as possible before TX DMA.
With this new TX DMA buffer allocation strategy, most of TX packets are
sent without allocating new mbufs and copying data into them.

See the following mail for details:
http://mail-index.netbsd.org/port-sgimips/2008/08/15/msg000352.html

No objection on port-sgimips.
 1.30 14-Aug-2008  tsutsui Make sure to free an allocated mbuf on failure path.
 1.29 14-Aug-2008  tsutsui Set MEC_TXCMD_TXINT every MEC_NTXDESC_INTR packets
if more than half txdescs have been queued because
TX_EMPTY interrupts will rarely happen if TX queue is so stacked.
 1.28 12-Aug-2008  tsutsui Fix a critical botch (inverted test) I put in rev 1.21.
 1.27 10-Aug-2008  tsutsui Don't forget to unload TX dmamap on failure (in !MEC_TXSTAT_SUCCESS case).
 1.26 10-Aug-2008  tsutsui In mec_intr() call mec_init() on errors for workaround.
 1.25 10-Aug-2008  tsutsui - no need to set the TXCMD_TXINT bit against the last enqueued TX packet
because TX_EMPTY interrupt is enough to serve it on TX completion
- start TX right after each TX packet has been prepared

A quick ttcp(1) test shows ~5% improvements.
 1.24 10-Aug-2008  tsutsui Use while(cond){} instead of for(;;){if(!cond)break;}.
 1.23 10-Aug-2008  tsutsui The last txdesc is now preserved, so also set IFF_OACTIVE properly.
 1.22 10-Aug-2008  tsutsui Specify PAGE_SIZE boundary for TX dmamaps.
mec(4) hardware may have the restriction.
 1.21 07-Aug-2008  tsutsui - check TX_RING pointer in MEC_INT_STATUS in mec_rxintr() (from OpenBSD)
- preserve the last TX descriptor to avoid wraparound (as per Linux driver)
- check IFQ_IS_EMPTY() on calling mec_start() in mec_intr()
- clear IFF_OACTIVE only if a number of descriptors are freed in mec_txintr()

Seems to fix mec(4) hangup problem (and silent reboot by crime watchdog)
on heavy load. Tested by martin@ and Jorge Acereda Macia on port-sgimips.
(though Jorge still has some problem, but this should have fixed one issue)
 1.20 14-May-2008  tsutsui branches: 1.20.4;
Normalize my licenses.
 1.19 29-Apr-2008  tsutsui branches: 1.19.2;
- split softc/device_t with related changes
- always make local functions static since mips/conf/Makefile.mips
has been changed to preserve local symbols for debug
 1.18 25-Feb-2008  martin branches: 1.18.2; 1.18.4;
Add a hack to deal with hardware that misses the machine's serial number
for whatever reason - just generate a MAC address from another environemt
variable, so that the admin can adjust it.
 1.17 26-Jan-2008  tsutsui branches: 1.17.2; 1.17.6;
- call mec_reset() to make sure DMA stopped (inspired by OpenBSD)
- also stop DMA in mec_reset() before resetting chip
- set MAC address to MAC_STATION reg in mec_attach(), not in mec_reset()

Possibly fixes occasional interrupt storm from mec(4) (i.e. hangup) at boot.
 1.16 20-Jan-2008  he Remove two now-unused local variables.
 1.15 19-Jan-2008  dyoung 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.14 29-Dec-2007  tsutsui Fix typo in comments. Mostly from OpenBSD.
 1.13 17-Oct-2007  garbled branches: 1.13.2; 1.13.8;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.12 15-Jul-2007  macallan branches: 1.12.10;
sprinkle delay() and mec_mii_wait() in MII access functions
with this I no longer get spontaneous reboots during network traffic
 1.11 09-Jul-2007  ad Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.10 04-Mar-2007  christos branches: 1.10.2; 1.10.4; 1.10.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 04-Feb-2007  tsutsui branches: 1.9.2;
Accept RX packets which are larger than ETHER_MAX_LEN but can be stored
into RX mbufs.

(BTW, is there any way to allocate RX mbufs aligned at PAGE_SIZE?)
 1.8 02-Apr-2006  tsutsui branches: 1.8.8; 1.8.12;
Add some delay() on asserting MEC_MAC_CORE_RESET.
 1.7 10-Dec-2005  tsutsui branches: 1.7.4; 1.7.6; 1.7.8; 1.7.10; 1.7.12;
Use 64bit access ops for MEC_PHY_* registers (for consistency).
 1.6 03-Jun-2005  martin branches: 1.6.2;
Constify
 1.5 18-May-2005  tsutsui Fix a typo. (from OpenBSD)
 1.4 30-Jan-2005  thorpej Eliminate use of M_HASFCS.
 1.3 24-Nov-2004  tsutsui branches: 1.3.4; 1.3.6;
Fix comment.
 1.2 30-Oct-2004  thorpej When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.1 23-Sep-2004  tsutsui branches: 1.1.2;
Rename if_mec_mace.c -> if_mec.c.
This file contains not only an attachment but whole driver functions.
 1.1.2.7 11-Dec-2005  christos Sync with head.
 1.1.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.1.2.4 29-Nov-2004  skrll Sync with HEAD.
 1.1.2.3 02-Nov-2004  skrll Sync with HEAD.
 1.1.2.2 24-Sep-2004  skrll Sync with HEAD.
 1.1.2.1 23-Sep-2004  skrll file if_mec.c was added on branch ktrace-lwp on 2004-09-24 10:53:17 +0000
 1.3.6.1 12-Feb-2005  yamt sync with head.
 1.3.4.1 29-Apr-2005  kent sync with -current
 1.6.2.6 27-Feb-2008  yamt sync with head.
 1.6.2.5 04-Feb-2008  yamt sync with head.
 1.6.2.4 21-Jan-2008  yamt sync with head
 1.6.2.3 03-Sep-2007  yamt sync with head.
 1.6.2.2 26-Feb-2007  yamt sync with head.
 1.6.2.1 21-Jun-2006  yamt sync with head.
 1.7.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.7.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.7.8.1 11-Apr-2006  yamt sync with head
 1.7.6.1 22-Apr-2006  simonb Sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.8.12.1 05-Nov-2008  snj Pull up following revision(s) (requested by tsutsui in ticket #1221):
sys/arch/sgimips/mace/if_mec.c: revision 1.9
sys/arch/sgimips/mace/if_mec.c: revision 1.12
sys/arch/sgimips/mace/if_mec.c: revision 1.14
sys/arch/sgimips/mace/if_mec.c: revision 1.17
sys/arch/sgimips/mace/if_mec.c: revision 1.18
sys/arch/sgimips/mace/if_mec.c: revision 1.20
sys/arch/sgimips/mace/if_mec.c: revision 1.21 via patch
sys/arch/sgimips/mace/if_mec.c: revision 1.22
sys/arch/sgimips/mace/if_mec.c: revision 1.23
sys/arch/sgimips/mace/if_mec.c: revision 1.24
sys/arch/sgimips/mace/if_mec.c: revision 1.25
sys/arch/sgimips/mace/if_mec.c: revision 1.26 via patch
sys/arch/sgimips/mace/if_mec.c: revision 1.27 via patch
sys/arch/sgimips/mace/if_mec.c: revision 1.28
sys/arch/sgimips/mace/if_mec.c: revision 1.29
sys/arch/sgimips/mace/if_mec.c: revision 1.30 via patch
sys/arch/sgimips/mace/if_mecreg.h: revision 1.4
Accept RX packets which are larger than ETHER_MAX_LEN but can be stored
into RX mbufs.
(BTW, is there any way to allocate RX mbufs aligned at PAGE_SIZE?)
sprinkle delay() and mec_mii_wait() in MII access functions
with this I no longer get spontaneous reboots during network traffic
Fix typo in comments. Mostly from OpenBSD.
- call mec_reset() to make sure DMA stopped (inspired by OpenBSD)
- also stop DMA in mec_reset() before resetting chip
- set MAC address to MAC_STATION reg in mec_attach(), not in mec_reset()
Possibly fixes occasional interrupt storm from mec(4) (i.e. hangup) at boot.
Add a hack to deal with hardware that misses the machine's serial number
for whatever reason - just generate a MAC address from another environemt
variable, so that the admin can adjust it.
Normalize my licenses.
- check TX_RING pointer in MEC_INT_STATUS in mec_rxintr() (from OpenBSD)
- preserve the last TX descriptor to avoid wraparound (as per Linux driver)
- check IFQ_IS_EMPTY() on calling mec_start() in mec_intr()
- clear IFF_OACTIVE only if a number of descriptors are freed in mec_txintr()
Seems to fix mec(4) hangup problem (and silent reboot by crime watchdog)
on heavy load. Tested by martin@ and Jorge Acereda Macia on port-sgimips.
(though Jorge still has some problem, but this should have fixed one issue)
Specify PAGE_SIZE boundary for TX dmamaps.
mec(4) hardware may have the restriction.
The last txdesc is now preserved, so also set IFF_OACTIVE properly.
Use while(cond){} instead of for(;;){if(!cond)break;}.
- no need to set the TXCMD_TXINT bit against the last enqueued TX packet
because TX_EMPTY interrupt is enough to serve it on TX completion
- start TX right after each TX packet has been prepared
A quick ttcp(1) test shows ~5% improvements.
In mec_intr() call mec_init() on errors for workaround.
Don't forget to unload TX dmamap on failure (in !MEC_TXSTAT_SUCCESS case).
Fix a critical botch (inverted test) I put in rev 1.20.
Set MEC_TXCMD_TXINT every MEC_NTXDESC_INTR packets
if more than half txdescs have been queued because
TX_EMPTY interrupts will rarely happen if TX queue is so stacked.
Make sure to free an allocated mbuf on failure path.
 1.8.8.1 09-Feb-2007  ad Sync with HEAD.
 1.9.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.10.10.1 03-Oct-2007  garbled Sync with HEAD
 1.10.4.1 11-Jul-2007  mjf Sync with head.
 1.10.2.2 20-Aug-2007  ad Sync with HEAD.
 1.10.2.1 15-Jul-2007  ad Sync with head.
 1.12.10.3 23-Mar-2008  matt sync with HEAD
 1.12.10.2 09-Jan-2008  matt sync with HEAD
 1.12.10.1 06-Nov-2007  matt sync with HEAD
 1.13.8.2 20-Jan-2008  bouyer Sync with HEAD
 1.13.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.13.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.17.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.17.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.17.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.17.2.1 24-Mar-2008  keiichi sync with head.
 1.18.4.6 11-Aug-2010  yamt sync with head.
 1.18.4.5 11-Mar-2010  yamt sync with head
 1.18.4.4 16-Sep-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.19.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.19.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.20.4.1 19-Oct-2008  haad Sync with HEAD.
 1.33.12.1 10-Sep-2009  matt Add preliminary LP64 support for sgimips
 1.33.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.33.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.42.4.2 05-Mar-2011  rmind sync with head
 1.42.4.1 30-May-2010  rmind sync with head
 1.42.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.44.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.44.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.46.2.2 30-Oct-2012  yamt sync with head
 1.46.2.1 17-Apr-2012  yamt sync with head
 1.47.2.1 18-Feb-2012  mrg merge to -current.
 1.49.12.1 07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

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

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

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.49.2.2 03-Dec-2017  jdolecek update from HEAD
 1.49.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.50.4.4 05-Feb-2017  skrll Sync with HEAD
 1.50.4.3 09-Jul-2016  skrll Sync with HEAD
 1.50.4.2 19-Mar-2016  skrll Sync with HEAD
 1.50.4.1 06-Jun-2015  skrll Sync with HEAD
 1.53.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.55.14.3 26-Jan-2019  pgoyette Sync with HEAD
 1.55.14.2 28-Jul-2018  pgoyette Sync with HEAD
 1.55.14.1 30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.57.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.57.2.1 10-Jun-2019  christos Sync with HEAD
 1.62.2.1 29-Feb-2020  ad Sync with head.
 1.7 23-Sep-2004  tsutsui Rename if_mec_mace.c -> if_mec.c.
This file contains not only an attachment but whole driver functions.
 1.6 18-Aug-2004  tsutsui Remove bogus TABs. (from OpenBSD)
 1.5 01-Aug-2004  tsutsui branches: 1.5.2;
- It turns out alignment restriction for TX descs is 8kbytes, not 64kbytes.
- Use MEC_TX_ALIAS register to set/clear TX interrupt enable bit.
 1.4 14-Jul-2004  tsutsui Now multicast on mec0 is confirmed working, so remove XXX comment
in mec_setfilter() function.

Thanks to Gerald Heinig for providing multicast test programs.
 1.3 11-Jul-2004  tsutsui Add a working driver for O2 (IP32) on-board MACE MAC-110 Ethernet.

Note:
- I don't have any hardware docments for this device, so this driver might
have some odd descriptions guessed by results of try-and-errors.
(the only info I have is the Linux driver, but I think it doesn't describe
the hardware specifications very well anyway)
- All RX packets and most TX packets are copied from/to buffers in the driver
due to hardware restriction, so performance is not so good for now.
Maybe RX packets can be directly DMA'ed to mbufs by the same method used
of fxp(4), but the hardware seems to require 4kbyte aligned RX buffers.
- Multicast filter setup function is not tested yet (no info).
- Currently only tested on R5000 O2 with disabled L2 cache, so needs
more tests on other CPU (i.e. RM5200/R10000/R12000) models.
- Currently BUS_DMA_COHERENT is not used for the device control data DMA
to avoid performance issue on memcpy() against RX buffers, but it might be
problematic when L2 cache is enabled or on R10000 models.
 1.2 19-Jan-2004  sekiya branches: 1.2.2;
Checking for IP32 in each driver is redundant -- they're attached as children
of mace, so it is sufficient to perform the check in mace_match(). Pointed
out by soren@.
 1.1 18-Jan-2004  sekiya Following the example of the hpc/, gio/, and ioc/ directories, move the
mace devices to their own mace/ directory. Alter conf/files.sgimips to
reflect this change in a sane manner (i.e., pull in dev/files.dev and
mace/files.mace when appropriate).

At the same time, allow crime_intr_establish() to fall through to
mace_intr_establish(). mace devices now call cpu_intr_establish().
 1.2.2.3 12-Aug-2004  jmc Pullup rev 1.5 (requested by tsutsui in ticket #746)

- It turns out alignment restriction for TX descs is 8kbytes, not 64kbytes.
- Use MEC_TX_ALIAS register to set/clear TX interrupt enable bit.
 1.2.2.2 15-Jul-2004  tron Pull up revision 1.4 (requested by tsutsui in ticket #652):
Now multicast on mec0 is confirmed working, so remove XXX comment
in mec_setfilter() function.
Thanks to Gerald Heinig for providing multicast test programs.
 1.2.2.1 15-Jul-2004  tron Pull up revision 1.3 (requested by tsutsui in ticket #652):
Add a working driver for O2 (IP32) on-board MACE MAC-110 Ethernet.
Note:
- I don't have any hardware docments for this device, so this driver might
have some odd descriptions guessed by results of try-and-errors.
(the only info I have is the Linux driver, but I think it doesn't describe
the hardware specifications very well anyway)
- All RX packets and most TX packets are copied from/to buffers in the driver
due to hardware restriction, so performance is not so good for now.
Maybe RX packets can be directly DMA'ed to mbufs by the same method used
of fxp(4), but the hardware seems to require 4kbyte aligned RX buffers.
- Multicast filter setup function is not tested yet (no info).
- Currently only tested on R5000 O2 with disabled L2 cache, so needs
more tests on other CPU (i.e. RM5200/R10000/R12000) models.
- Currently BUS_DMA_COHERENT is not used for the device control data DMA
to avoid performance issue on memcpy() against RX buffers, but it might be
problematic when L2 cache is enabled or on R10000 models.
 1.5.2.6 19-Oct-2004  skrll Sync with HEAD
 1.5.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.3 25-Aug-2004  skrll Sync with HEAD.
 1.5.2.2 03-Aug-2004  skrll Sync with HEAD
 1.5.2.1 01-Aug-2004  skrll file if_mec_mace.c was added on branch ktrace-lwp on 2004-08-03 10:40:07 +0000
 1.4 07-Aug-2008  tsutsui - check TX_RING pointer in MEC_INT_STATUS in mec_rxintr() (from OpenBSD)
- preserve the last TX descriptor to avoid wraparound (as per Linux driver)
- check IFQ_IS_EMPTY() on calling mec_start() in mec_intr()
- clear IFF_OACTIVE only if a number of descriptors are freed in mec_txintr()

Seems to fix mec(4) hangup problem (and silent reboot by crime watchdog)
on heavy load. Tested by martin@ and Jorge Acereda Macia on port-sgimips.
(though Jorge still has some problem, but this should have fixed one issue)
 1.3 10-Dec-2005  tsutsui branches: 1.3.24; 1.3.74; 1.3.78; 1.3.80; 1.3.84;
Use 64bit access ops for MEC_PHY_* registers (for consistency).
 1.2 11-Jul-2004  tsutsui branches: 1.2.2; 1.2.14;
Add a working driver for O2 (IP32) on-board MACE MAC-110 Ethernet.

Note:
- I don't have any hardware docments for this device, so this driver might
have some odd descriptions guessed by results of try-and-errors.
(the only info I have is the Linux driver, but I think it doesn't describe
the hardware specifications very well anyway)
- All RX packets and most TX packets are copied from/to buffers in the driver
due to hardware restriction, so performance is not so good for now.
Maybe RX packets can be directly DMA'ed to mbufs by the same method used
of fxp(4), but the hardware seems to require 4kbyte aligned RX buffers.
- Multicast filter setup function is not tested yet (no info).
- Currently only tested on R5000 O2 with disabled L2 cache, so needs
more tests on other CPU (i.e. RM5200/R10000/R12000) models.
- Currently BUS_DMA_COHERENT is not used for the device control data DMA
to avoid performance issue on memcpy() against RX buffers, but it might be
problematic when L2 cache is enabled or on R10000 models.
 1.1 18-Jan-2004  sekiya branches: 1.1.2;
Following the example of the hpc/, gio/, and ioc/ directories, move the
mace devices to their own mace/ directory. Alter conf/files.sgimips to
reflect this change in a sane manner (i.e., pull in dev/files.dev and
mace/files.mace when appropriate).

At the same time, allow crime_intr_establish() to fall through to
mace_intr_establish(). mace devices now call cpu_intr_establish().
 1.1.2.1 15-Jul-2004  tron Pull up revision 1.2 (requested by tsutsui in ticket #652):
Add a working driver for O2 (IP32) on-board MACE MAC-110 Ethernet.
Note:
- I don't have any hardware docments for this device, so this driver might
have some odd descriptions guessed by results of try-and-errors.
(the only info I have is the Linux driver, but I think it doesn't describe
the hardware specifications very well anyway)
- All RX packets and most TX packets are copied from/to buffers in the driver
due to hardware restriction, so performance is not so good for now.
Maybe RX packets can be directly DMA'ed to mbufs by the same method used
of fxp(4), but the hardware seems to require 4kbyte aligned RX buffers.
- Multicast filter setup function is not tested yet (no info).
- Currently only tested on R5000 O2 with disabled L2 cache, so needs
more tests on other CPU (i.e. RM5200/R10000/R12000) models.
- Currently BUS_DMA_COHERENT is not used for the device control data DMA
to avoid performance issue on memcpy() against RX buffers, but it might be
problematic when L2 cache is enabled or on R10000 models.
 1.2.14.1 21-Jun-2006  yamt sync with head.
 1.2.2.5 11-Dec-2005  christos Sync with head.
 1.2.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.2 03-Aug-2004  skrll Sync with HEAD
 1.2.2.1 11-Jul-2004  skrll file if_mecreg.h was added on branch ktrace-lwp on 2004-08-03 10:40:07 +0000
 1.3.84.1 19-Oct-2008  haad Sync with HEAD.
 1.3.80.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.3.78.1 04-May-2009  yamt sync with head.
 1.3.74.1 28-Sep-2008  mjf Sync with HEAD.
 1.3.24.1 05-Nov-2008  snj Pull up following revision(s) (requested by tsutsui in ticket #1221):
sys/arch/sgimips/mace/if_mec.c: revision 1.9
sys/arch/sgimips/mace/if_mec.c: revision 1.12
sys/arch/sgimips/mace/if_mec.c: revision 1.14
sys/arch/sgimips/mace/if_mec.c: revision 1.17
sys/arch/sgimips/mace/if_mec.c: revision 1.18
sys/arch/sgimips/mace/if_mec.c: revision 1.20
sys/arch/sgimips/mace/if_mec.c: revision 1.21 via patch
sys/arch/sgimips/mace/if_mec.c: revision 1.22
sys/arch/sgimips/mace/if_mec.c: revision 1.23
sys/arch/sgimips/mace/if_mec.c: revision 1.24
sys/arch/sgimips/mace/if_mec.c: revision 1.25
sys/arch/sgimips/mace/if_mec.c: revision 1.26 via patch
sys/arch/sgimips/mace/if_mec.c: revision 1.27 via patch
sys/arch/sgimips/mace/if_mec.c: revision 1.28
sys/arch/sgimips/mace/if_mec.c: revision 1.29
sys/arch/sgimips/mace/if_mec.c: revision 1.30 via patch
sys/arch/sgimips/mace/if_mecreg.h: revision 1.4
Accept RX packets which are larger than ETHER_MAX_LEN but can be stored
into RX mbufs.
(BTW, is there any way to allocate RX mbufs aligned at PAGE_SIZE?)
sprinkle delay() and mec_mii_wait() in MII access functions
with this I no longer get spontaneous reboots during network traffic
Fix typo in comments. Mostly from OpenBSD.
- call mec_reset() to make sure DMA stopped (inspired by OpenBSD)
- also stop DMA in mec_reset() before resetting chip
- set MAC address to MAC_STATION reg in mec_attach(), not in mec_reset()
Possibly fixes occasional interrupt storm from mec(4) (i.e. hangup) at boot.
Add a hack to deal with hardware that misses the machine's serial number
for whatever reason - just generate a MAC address from another environemt
variable, so that the admin can adjust it.
Normalize my licenses.
- check TX_RING pointer in MEC_INT_STATUS in mec_rxintr() (from OpenBSD)
- preserve the last TX descriptor to avoid wraparound (as per Linux driver)
- check IFQ_IS_EMPTY() on calling mec_start() in mec_intr()
- clear IFF_OACTIVE only if a number of descriptors are freed in mec_txintr()
Seems to fix mec(4) hangup problem (and silent reboot by crime watchdog)
on heavy load. Tested by martin@ and Jorge Acereda Macia on port-sgimips.
(though Jorge still has some problem, but this should have fixed one issue)
Specify PAGE_SIZE boundary for TX dmamaps.
mec(4) hardware may have the restriction.
The last txdesc is now preserved, so also set IFF_OACTIVE properly.
Use while(cond){} instead of for(;;){if(!cond)break;}.
- no need to set the TXCMD_TXINT bit against the last enqueued TX packet
because TX_EMPTY interrupt is enough to serve it on TX completion
- start TX right after each TX packet has been prepared
A quick ttcp(1) test shows ~5% improvements.
In mec_intr() call mec_init() on errors for workaround.
Don't forget to unload TX dmamap on failure (in !MEC_TXSTAT_SUCCESS case).
Fix a critical botch (inverted test) I put in rev 1.20.
Set MEC_TXCMD_TXINT every MEC_NTXDESC_INTR packets
if more than half txdescs have been queued because
TX_EMPTY interrupts will rarely happen if TX queue is so stacked.
Make sure to free an allocated mbuf on failure path.
 1.9 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.8 21-Nov-2009  rmind Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.
 1.7 07-Mar-2008  cube branches: 1.7.4;
Split the softc from the device_t for all lpt(4) variants and attachments
except the ppbus stuff (which doesn't compile) and ulpt(4) which is
unrelated and can be dealt with separately.

As usual, it comes with related cosmetic changes.
 1.6 11-Dec-2005  christos branches: 1.6.50; 1.6.70; 1.6.74;
merge ktrace-lwp.
 1.5 29-Sep-2004  sekiya branches: 1.5.12;
Use ANSI function declarations.
 1.4 12-Jul-2004  tsutsui branches: 1.4.2;
Reenable lpt at mace since shared interrupt code was fixed in mace.c rev 1.2.
 1.3 25-Mar-2004  sekiya The lpt driver doesn't play nicely with the serial ports -- they share the
same interrupt, and something isn't quite right with the mace interrupt
dispatcher. Disable for now.

Pointed out by Tillman Hodgson and confirmed by ozone on port-sgimips.
 1.2 19-Jan-2004  sekiya Checking for IP32 in each driver is redundant -- they're attached as children
of mace, so it is sufficient to perform the check in mace_match(). Pointed
out by soren@.
 1.1 18-Jan-2004  sekiya Following the example of the hpc/, gio/, and ioc/ directories, move the
mace devices to their own mace/ directory. Alter conf/files.sgimips to
reflect this change in a sane manner (i.e., pull in dev/files.dev and
mace/files.mace when appropriate).

At the same time, allow crime_intr_establish() to fall through to
mace_intr_establish(). mace devices now call cpu_intr_establish().
 1.4.2.5 19-Oct-2004  skrll Sync with HEAD
 1.4.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.2 03-Aug-2004  skrll Sync with HEAD
 1.4.2.1 12-Jul-2004  skrll file lpt_mace.c was added on branch ktrace-lwp on 2004-08-03 10:40:07 +0000
 1.5.12.1 17-Mar-2008  yamt sync with head.
 1.6.74.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.70.1 24-Mar-2008  keiichi sync with head.
 1.6.50.1 23-Mar-2008  matt sync with HEAD
 1.7.4.1 11-Mar-2010  yamt sync with head
 1.2 13-Apr-2007  jmcneill Remove traces of macau, it never existed in the first place apart for
a handful of register definitions.
 1.1 18-Jan-2004  sekiya branches: 1.1.4; 1.1.18; 1.1.56; 1.1.60; 1.1.62;
Following the example of the hpc/, gio/, and ioc/ directories, move the
mace devices to their own mace/ directory. Alter conf/files.sgimips to
reflect this change in a sane manner (i.e., pull in dev/files.dev and
mace/files.mace when appropriate).

At the same time, allow crime_intr_establish() to fall through to
mace_intr_establish(). mace devices now call cpu_intr_establish().
 1.1.62.1 11-Jul-2007  mjf Sync with head.
 1.1.60.2 15-Jul-2007  ad Sync with head.
 1.1.60.1 27-May-2007  ad Sync with head.
 1.1.56.1 15-Apr-2007  yamt sync with head.
 1.1.18.1 03-Sep-2007  yamt sync with head.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 18-Jan-2004  skrll file macaureg.h was added on branch ktrace-lwp on 2004-08-03 10:40:07 +0000
 1.27 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.26 03-Aug-2023  mrg check a pointer's value not the address of a pointer.

found by GCC 12.
 1.25 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.24 24-Apr-2021  thorpej branches: 1.24.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.23 13-Jul-2016  macallan branches: 1.23.32;
appease gcc by removing now unnecessary cast
 1.22 30-Jun-2015  macallan shorten the interrupt name so the level field is actually readable in systat
 1.21 18-Feb-2015  macallan switch sgimips to common bus_dma and bus_space in arch/mips/
Tested on O2 and Indy.
Things that are compile-tested only for lack of hardware:
- GIO ethernet cards with PCI bridges
- IP2x hardware not found on Indy
- IP1x
 1.20 16-Dec-2013  mrg branches: 1.20.6;
- remove unused variables
- use (void) when we don't care about the return value
 1.19 27-Oct-2012  chs branches: 1.19.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.18 18-Aug-2011  macallan branches: 1.18.2; 1.18.12;
device_t-ify
 1.17 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.16 14-Dec-2009  matt Merge from matt-nb5-mips64
Merge mips-specific arch files.
 1.15 23-Aug-2008  tsutsui branches: 1.15.12;
KNF and misc cosmetics.
 1.14 02-Feb-2008  sekiya branches: 1.14.6; 1.14.10; 1.14.12; 1.14.16;
Garbage-collect my old broken attempt at creating a ringbuffer for the audio
chip. Fix grammar in a comment while I'm here.
 1.13 17-Oct-2007  garbled branches: 1.13.2;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.12 09-Jul-2007  ad branches: 1.12.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.11 14-Apr-2007  jmcneill branches: 1.11.2;
We don't use the RTC interrupt (yet), so mask it as well.
 1.10 14-Apr-2007  jmcneill Disable count/compare timer interrupts, as NetBSD does not use these.
 1.9 04-Mar-2007  christos branches: 1.9.2; 1.9.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.8 26-Nov-2005  tsutsui branches: 1.8.26;
Use aprint_debug() instead of aprint_normal() for messages
of establishing/disestablishing mace interrupt.
 1.7 26-Aug-2005  drochner branches: 1.7.6;
s/locdesc_t/int/g
 1.6 30-Jun-2005  drochner branches: 1.6.2;
adaptions to config_search() change, and minor autoconf fixes, mostly from Havard Eidnes
 1.5 06-Sep-2004  sekiya Use the mace interrupt handler for PCI interrupts.

From KIYOHARA Takashi
 1.4 10-Jul-2004  tsutsui branches: 1.4.2;
Count mace interrupts by evcnt(9).
 1.3 10-Jul-2004  tsutsui Remove a debug printf.
 1.2 10-Jul-2004  tsutsui Make sure shared interrupts properly handled.
 1.1 18-Jan-2004  sekiya branches: 1.1.2;
Following the example of the hpc/, gio/, and ioc/ directories, move the
mace devices to their own mace/ directory. Alter conf/files.sgimips to
reflect this change in a sane manner (i.e., pull in dev/files.dev and
mace/files.mace when appropriate).

At the same time, allow crime_intr_establish() to fall through to
mace_intr_establish(). mace devices now call cpu_intr_establish().
 1.1.2.1 15-Jul-2004  he Pull up revisions 1.2-1.3 (requested by tsutsui in ticket #657):
Make sure shared interrupts are properly handled. Makes
com0/com1/lpt0 on mace work if more than one is configured.
 1.4.2.6 11-Dec-2005  christos Sync with head.
 1.4.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.2 03-Aug-2004  skrll Sync with HEAD
 1.4.2.1 10-Jul-2004  skrll file mace.c was added on branch ktrace-lwp on 2004-08-03 10:40:07 +0000
 1.6.2.3 04-Feb-2008  yamt sync with head.
 1.6.2.2 03-Sep-2007  yamt sync with head.
 1.6.2.1 21-Jun-2006  yamt sync with head.
 1.7.6.1 29-Nov-2005  yamt sync with head.
 1.8.26.2 15-Apr-2007  yamt sync with head.
 1.8.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.4.1 11-Jul-2007  mjf Sync with head.
 1.9.2.2 15-Jul-2007  ad Sync with head.
 1.9.2.1 27-May-2007  ad Sync with head.
 1.11.2.1 03-Oct-2007  garbled Sync with HEAD
 1.12.10.2 23-Mar-2008  matt sync with HEAD
 1.12.10.1 06-Nov-2007  matt sync with HEAD
 1.13.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.14.16.1 19-Oct-2008  haad Sync with HEAD.
 1.14.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.14.10.2 11-Mar-2010  yamt sync with head
 1.14.10.1 04-May-2009  yamt sync with head.
 1.14.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.15.12.2 23-Nov-2009  matt mips3_ld/mips3_sd need to be passed a volatile uint64_t *
 1.15.12.1 10-Sep-2009  matt Add preliminary LP64 support for sgimips
 1.18.12.3 03-Dec-2017  jdolecek update from HEAD
 1.18.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.18.2.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.18.2.1 30-Oct-2012  yamt sync with head
 1.19.2.1 18-May-2014  rmind sync with head
 1.20.6.3 05-Oct-2016  skrll Sync with HEAD
 1.20.6.2 22-Sep-2015  skrll Sync with HEAD
 1.20.6.1 06-Apr-2015  skrll Sync with HEAD
 1.23.32.6 05-Apr-2021  thorpej Treat config_probe() as if it were a boolean function; don't compare
return value > 0... except for the odd balls, which are now really easy
to spot.
 1.23.32.5 05-Apr-2021  thorpej config_match() -> config_probe() for the straight-forward indirect config
cases. There are still a few odd balls using config_match() which should
be sorted out later.
 1.23.32.4 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.23.32.3 03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.23.32.2 21-Mar-2021  thorpej CFARG_IATTR usage audit:

If a device carries only one interface attribute, there is no need
to specify it when calling config_search(); that specification is
meant only to disambiguate which interface attribute (which is a
proxy for "what kind of attach args are being used") is having
children attached. cfparent_match() will take care of ensuring that
any potential children can attach to one of the parent's iterface
attributes, and if the parent only carries one, no disambiguation is
necessary.
 1.23.32.1 20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.24.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.9 01-Oct-2019  chs in many device attach paths, allocate memory with KM_SLEEP instead of KM_NOSLEEP
and remove code to handle failures that can no longer happen.
 1.8 04-Apr-2015  macallan branches: 1.8.18;
malloc() -> kmem_alloc() for private data, also kmem_free() them if we
don't finish attaching for whatever reason

found by Brainy
 1.7 27-Oct-2012  chs branches: 1.7.12; 1.7.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.6 01-Jul-2011  dyoung branches: 1.6.2; 1.6.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.5 20-Feb-2011  matt Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.
 1.4 05-May-2008  jmcneill branches: 1.4.22; 1.4.28; 1.4.30;
Use 2-clause license.
 1.3 08-Mar-2008  tnn branches: 1.3.2; 1.3.4;
- Attach the keyboard controller even if we're on serial console.
- If arcbios is using graphics console, then attach the keyboard as the
console keyboard. Makes ddb work on the framebuffer console.
 1.2 14-Apr-2007  jmcneill branches: 1.2.2; 1.2.6; 1.2.8; 1.2.18; 1.2.20; 1.2.36; 1.2.40;
Don't bother attaching if the keyboard is not the console. Reduce the
amount of time that macekbc_wait takes before timing out, and don't
bother checking the status of unattached ports in the interrupt handler.
 1.1 10-Apr-2007  jmcneill Add SGI MACE ps2 keyboard/aux controller driver. ok rumble@

XXX can someone confirm that we can remove pckbc_mace?
 1.2.40.2 02-Jun-2008  mjf Sync with HEAD.
 1.2.40.1 03-Apr-2008  mjf Sync with HEAD.
 1.2.36.1 24-Mar-2008  keiichi sync with head.
 1.2.20.3 17-Mar-2008  yamt sync with head.
 1.2.20.2 03-Sep-2007  yamt sync with head.
 1.2.20.1 14-Apr-2007  yamt file macekbc.c was added on branch yamt-lazymbuf on 2007-09-03 14:29:20 +0000
 1.2.18.1 23-Mar-2008  matt sync with HEAD
 1.2.8.2 11-Jul-2007  mjf Sync with head.
 1.2.8.1 14-Apr-2007  mjf file macekbc.c was added on branch mjf-ufs-trans on 2007-07-11 20:01:44 +0000
 1.2.6.2 09-Jun-2007  ad Sync with head.
 1.2.6.1 14-Apr-2007  ad file macekbc.c was added on branch vmlocking on 2007-06-09 21:37:01 +0000
 1.2.2.2 15-Apr-2007  yamt sync with head.
 1.2.2.1 14-Apr-2007  yamt file macekbc.c was added on branch yamt-idlelwp on 2007-04-15 16:02:54 +0000
 1.3.4.1 16-May-2008  yamt sync with head.
 1.3.2.1 18-May-2008  yamt sync with head.
 1.4.30.1 05-Mar-2011  bouyer Sync with HEAD
 1.4.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.22.1 05-Mar-2011  rmind sync with head
 1.6.12.2 03-Dec-2017  jdolecek update from HEAD
 1.6.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.6.2.1 30-Oct-2012  yamt sync with head
 1.7.14.1 06-Apr-2015  skrll Sync with HEAD
 1.7.12.1 16-May-2015  snj Pull up following revision(s) (requested by maxv in ticket #761):
sys/arch/sgimips/dev/scn.c: revision 1.8
sys/arch/sgimips/mace/macekbc.c: revision 1.8
sys/dev/hpc/hpcfb.c: revision 1.59
sys/dev/i2c/i2c.c: revision 1.47
sys/dev/ic/mfi.c: revision 1.57
sys/dev/if_ndis/if_ndis_pci.c: revision 1.21
sys/dev/sysmon/sysmon_power.c: revisions 1.50-1.52
sys/dev/usb/umass_isdata.c: revision 1.31
fix double free, found by Brainy.
--
Free cmd on error if we allocated it.
Found by Brainy, reported by maxv@.
--
don't leak rl (but there are other leaks), found by Brainy.
--
Free ped if we can't hand it to the power daemon.
Found by Brainy, reported by maxv@.
--
don't forget to free the dictionary.
--
another missing free dict.
--
fix leak, found by Brainy.
--
don't malloc a tiny, fixed size buffer to scribble into, then not use it
and never free it either
found by Brainy
--
malloc() -> kmem_alloc() for private data, also kmem_free() them if we
don't finish attaching for whatever reason
found by Brainy
 1.8.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3 13-Apr-2007  jmcneill Add some MACE audio bit definitions, from OpenBSD.
 1.2 11-Dec-2005  christos branches: 1.2.26; 1.2.30; 1.2.32;
merge ktrace-lwp.
 1.1 18-Jan-2004  sekiya branches: 1.1.4; 1.1.18;
Following the example of the hpc/, gio/, and ioc/ directories, move the
mace devices to their own mace/ directory. Alter conf/files.sgimips to
reflect this change in a sane manner (i.e., pull in dev/files.dev and
mace/files.mace when appropriate).

At the same time, allow crime_intr_establish() to fall through to
mace_intr_establish(). mace devices now call cpu_intr_establish().
 1.1.18.1 03-Sep-2007  yamt sync with head.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 18-Jan-2004  skrll file macereg.h was added on branch ktrace-lwp on 2004-08-03 10:40:07 +0000
 1.2.32.1 11-Jul-2007  mjf Sync with head.
 1.2.30.1 27-May-2007  ad Sync with head.
 1.2.26.1 15-Apr-2007  yamt sync with head.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 06-Sep-2004  sekiya Use the mace interrupt handler for PCI interrupts.

From KIYOHARA Takashi
 1.1 18-Jan-2004  sekiya branches: 1.1.4;
Following the example of the hpc/, gio/, and ioc/ directories, move the
mace devices to their own mace/ directory. Alter conf/files.sgimips to
reflect this change in a sane manner (i.e., pull in dev/files.dev and
mace/files.mace when appropriate).

At the same time, allow crime_intr_establish() to fall through to
mace_intr_establish(). mace devices now call cpu_intr_establish().
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 18-Jan-2004  skrll file macevar.h was added on branch ktrace-lwp on 2004-08-03 10:40:07 +0000
 1.14 07-Jun-2019  isaki mavb supports only playback for now, so drop FULLDUPLEX and INDEPENDENT
property. These properies are valid only for bidirectional device.
 1.13 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.12 16-Mar-2019  isaki branches: 1.12.2;
Use C99 style struct initializer to audio_hw_if.
 1.11 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.10 17-Feb-2015  macallan branches: 1.10.16; 1.10.18;
move DAC1 output channel to master so things like OSS and kmix work
as expected
 1.9 27-Oct-2012  chs branches: 1.9.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.8 23-Nov-2011  jmcneill branches: 1.8.8;
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.7 01-Jul-2011  dyoung branches: 1.7.2; 1.7.4;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.6 23-Aug-2008  tsutsui KNF and misc cosmetics.
 1.5 26-Jan-2008  jmcneill branches: 1.5.6; 1.5.10; 1.5.12; 1.5.16;
Use auconv to create our encoding list for us.
 1.4 17-Oct-2007  garbled branches: 1.4.2;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.3 09-Jul-2007  ad branches: 1.3.2; 1.3.12; 1.3.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.2 13-Apr-2007  jmcneill branches: 1.2.2; 1.2.4; 1.2.6;
GC a few commented out lines of code, no functional change.
 1.1 13-Apr-2007  jmcneill Add SGI O2 MACE audio driver, from OpenBSD.
 1.2.6.3 15-Jul-2007  ad Sync with head.
 1.2.6.2 09-Jun-2007  ad Sync with head.
 1.2.6.1 13-Apr-2007  ad file mavb.c was added on branch vmlocking on 2007-06-09 21:37:02 +0000
 1.2.4.1 03-Oct-2007  garbled Sync with HEAD
 1.2.2.2 15-Apr-2007  yamt sync with head.
 1.2.2.1 13-Apr-2007  yamt file mavb.c was added on branch yamt-idlelwp on 2007-04-15 16:02:55 +0000
 1.3.14.3 04-Feb-2008  yamt sync with head.
 1.3.14.2 03-Sep-2007  yamt sync with head.
 1.3.14.1 09-Jul-2007  yamt file mavb.c was added on branch yamt-lazymbuf on 2007-09-03 14:29:20 +0000
 1.3.12.2 23-Mar-2008  matt sync with HEAD
 1.3.12.1 06-Nov-2007  matt sync with HEAD
 1.3.2.2 11-Jul-2007  mjf Sync with head.
 1.3.2.1 09-Jul-2007  mjf file mavb.c was added on branch mjf-ufs-trans on 2007-07-11 20:01:45 +0000
 1.4.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.5.16.1 19-Oct-2008  haad Sync with HEAD.
 1.5.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.5.10.1 04-May-2009  yamt sync with head.
 1.5.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.7.4.4 22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.7.4.3 20-Nov-2011  jmcneill no need to enter intr_lock from trigger_output, it's already held
 1.7.4.2 20-Nov-2011  jmcneill fix size passed to kmem_free in stream filter dtor
 1.7.4.1 20-Nov-2011  jmcneill adapt to audiomp api changes
 1.7.2.2 30-Oct-2012  yamt sync with head
 1.7.2.1 17-Apr-2012  yamt sync with head
 1.8.8.2 03-Dec-2017  jdolecek update from HEAD
 1.8.8.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.9.14.1 06-Apr-2015  skrll Sync with HEAD
 1.10.18.1 10-Jun-2019  christos Sync with HEAD
 1.10.16.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.12.2.4 04-May-2019  isaki Correct precision.
Tested by naru@. Thanks.
 1.12.2.3 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.12.2.2 21-Apr-2019  isaki Adapt to audio2.
- The driver does not support recording so drop CAPTURE property.
 1.12.2.1 21-Apr-2019  isaki Use C99 style struct initializer to audio_format.
 1.1 13-Apr-2007  jmcneill branches: 1.1.2; 1.1.6; 1.1.8; 1.1.20;
Add SGI O2 MACE audio driver, from OpenBSD.
 1.1.20.2 03-Sep-2007  yamt sync with head.
 1.1.20.1 13-Apr-2007  yamt file mavbreg.h was added on branch yamt-lazymbuf on 2007-09-03 14:29:21 +0000
 1.1.8.2 11-Jul-2007  mjf Sync with head.
 1.1.8.1 13-Apr-2007  mjf file mavbreg.h was added on branch mjf-ufs-trans on 2007-07-11 20:01:46 +0000
 1.1.6.2 09-Jun-2007  ad Sync with head.
 1.1.6.1 13-Apr-2007  ad file mavbreg.h was added on branch vmlocking on 2007-06-09 21:37:02 +0000
 1.1.2.2 15-Apr-2007  yamt sync with head.
 1.1.2.1 13-Apr-2007  yamt file mavbreg.h was added on branch yamt-idlelwp on 2007-04-15 16:02:55 +0000
 1.19 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.18 07-Sep-2025  thorpej Remove unnecessary NULL-initialization of TODR handle fields.
 1.17 18-Feb-2015  macallan switch sgimips to common bus_dma and bus_space in arch/mips/
Tested on O2 and Indy.
Things that are compile-tested only for lack of hardware:
- GIO ethernet cards with PCI bridges
- IP2x hardware not found on Indy
- IP1x
 1.16 20-Nov-2014  christos branches: 1.16.2;
use the inline bcdtobin and bintobcd directly instead through a macro.
 1.15 16-Dec-2013  mrg - remove unused variables
- use (void) when we don't care about the return value
 1.14 01-Jul-2011  dyoung branches: 1.14.2; 1.14.12; 1.14.16;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.13 13-Dec-2009  tsutsui Split device_t/softc, some KNF.
 1.12 13-Dec-2009  tsutsui Use todr_[gs]ettime_ymdhms() format.
 1.11 12-Dec-2009  tsutsui Remove `volatile' qualifier from argument types of
struct timeval passed to todr_gettime(9) and todr_settime(9).
We no longer have an ancient and volatile struct timeval `time'
global since we have switched to MI timercounter(9) on all port.

XXX1: some of these RTC drivers still assume 32bit time_t
XXX2: some of these should be rewritten to use todr_[gs]ettime_ymdhms()
XXX3: todr(9) man page doesn't mention todr_[gs]ettime_ymdhms()
 1.10 03-Apr-2009  uebayasi Include sys/device.h. Fix build.
 1.9 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.8 17-Oct-2007  garbled branches: 1.8.20; 1.8.28; 1.8.34;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.7 26-Sep-2007  macallan add mcclock_poweroff()
 1.6 24-Jul-2007  pooka branches: 1.6.4; 1.6.6; 1.6.8;
remove TNF advertising clause from file copyrighted to me
 1.5 05-Sep-2006  rumble branches: 1.5.12; 1.5.20; 1.5.24; 1.5.26;
Switch sgimips to MI todr.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.8;
merge ktrace-lwp.
 1.3 19-Jan-2004  sekiya branches: 1.3.4; 1.3.18;
Checking for IP32 in each driver is redundant -- they're attached as children
of mace, so it is sufficient to perform the check in mace_match(). Pointed
out by soren@.
 1.2 19-Jan-2004  sekiya Attach the com and mcclock devices only if the machine is an IP32.
 1.1 18-Jan-2004  sekiya Following the example of the hpc/, gio/, and ioc/ directories, move the
mace devices to their own mace/ directory. Alter conf/files.sgimips to
reflect this change in a sane manner (i.e., pull in dev/files.dev and
mace/files.mace when appropriate).

At the same time, allow crime_intr_establish() to fall through to
mace_intr_establish(). mace devices now call cpu_intr_establish().
 1.3.18.3 27-Oct-2007  yamt sync with head.
 1.3.18.2 03-Sep-2007  yamt sync with head.
 1.3.18.1 30-Dec-2006  yamt sync with head.
 1.3.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.4.2 03-Aug-2004  skrll Sync with HEAD
 1.3.4.1 19-Jan-2004  skrll file mcclock_mace.c was added on branch ktrace-lwp on 2004-08-03 10:40:07 +0000
 1.4.8.1 14-Sep-2006  yamt sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.26.1 15-Aug-2007  skrll Sync with HEAD.
 1.5.24.1 07-Aug-2007  matt Sync with HEAD.
 1.5.20.1 03-Oct-2007  garbled Sync with HEAD
 1.5.12.2 09-Oct-2007  ad Sync with head.
 1.5.12.1 20-Aug-2007  ad Sync with HEAD.
 1.6.8.1 06-Oct-2007  yamt sync with head.
 1.6.6.1 06-Nov-2007  matt sync with HEAD
 1.6.4.1 02-Oct-2007  joerg Sync with HEAD.
 1.8.34.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.28.1 28-Apr-2009  skrll Sync with HEAD.
 1.8.20.2 11-Mar-2010  yamt sync with head
 1.8.20.1 04-May-2009  yamt sync with head.
 1.14.16.1 18-May-2014  rmind sync with head
 1.14.12.2 03-Dec-2017  jdolecek update from HEAD
 1.14.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16.2.1 06-Apr-2015  skrll Sync with HEAD
 1.26 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.25 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.24 24-Apr-2021  thorpej branches: 1.24.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.23 07-Jul-2020  thorpej branches: 1.23.4;
Overhaul the interface to pci_configure_bus():
- Don't expose how PCI bus configuration resource management is implemented.
Provide a new resource provider API:

==> pciconf_resource_init() -- Initialize a PCI configuration resources
container.
==> pciconf_resource_add() -- Add a PCI configuration resource to the
container (I/O, MEM, or prefetchable MEM). Multiple resources of
each type may be added.
==> pciconf_resource_fini() -- Tear down the PCI configurtation resources
container once the bus has been configured.

This is much easier to use than the previous method of providing an
extent map for each kind of resource, and works better for e.g. ACPI
platforms that provide potentially multiple PCI resources in tables
provided by firmware.

- Re-implement PCI configuration resource management using vmem arenas,
rather than extent maps.
 1.22 14-Jun-2020  chs replace EX_NOWAIT with EX_WAITOK in device attach methods.
remove checks for failures that can no longer occur.
 1.21 05-Aug-2016  macallan simplify macepci_intr():
- use uint32_t
- always clear all error bits
- avoid a compiler bug(?) which caused the test for MACE_PERR_MASTER_ABORT
to fail on n32
now my O2 no longer hangs when leaving cold
 1.20 02-Oct-2015  msaitoh branches: 1.20.2;
PCI Extended Configuration stuff written by nonaka@:
- Add PCI Extended Configuration Space support into x86.
- Check register offset of pci_conf_read() in MD part. It returns (pcireg_t)-1
if it isn't accessible.
- Decode Extended Capability in PCI Extended Configuration Space.
Currently the following extended capabilities are decoded:
- Advanced Error Reporting
- Virtual Channel
- Device Serial Number
- Power Budgeting
- Root Complex Link Declaration
- Root Complex Event Collector Association
- Access Control Services
- Alternative Routing-ID Interpretation
- Address Translation Services
- Single Root IO Virtualization
- Page Request
- TPH Requester
- Latency Tolerance Reporting
- Secondary PCI Express
- Process Address Space ID
- LN Requester
- L1 PM Substates
The following extended capabilities are not decoded yet:
- Root Complex Internal Link Control
- Multi-Function Virtual Channel
- RCRB Header
- Vendor Unique
- Configuration Access Correction
- Multiple Root IO Virtualization
- Multicast
- Resizable BAR
- Dynamic Power Allocation
- Protocol Multiplexing
- Downstream Port Containment
- Precision Time Management
- M-PCIe
- Function Reading Status Queueing
- Readiness Time Reporting
- Designated Vendor-Specific
 1.19 24-Sep-2015  macallan on mips64 we can use the whole PCI space, not just the two 32MB windows
accessible via KSEG*
 1.18 18-Feb-2015  macallan switch sgimips to common bus_dma and bus_space in arch/mips/
Tested on O2 and Indy.
Things that are compile-tested only for lack of hardware:
- GIO ethernet cards with PCI bridges
- IP2x hardware not found on Indy
- IP1x
 1.17 29-Mar-2014  christos branches: 1.17.6;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.16 26-Mar-2014  christos kill sprintf.
 1.15 27-Oct-2012  chs branches: 1.15.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.14 27-Jan-2012  para branches: 1.14.6;
converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.13 01-Jul-2011  dyoung branches: 1.13.2; 1.13.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.12 17-May-2011  dyoung PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED changed their functional
role in NetBSD (drivers are no longer supposed to write these to
pa_flags) without changing name. Correct that.

Rename PCI_FLAGS_IO_ENABLED to PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_ENABLED to PCI_FLAGS_MEM_OKAY, thus making their names
consistent with the other PCI flags and poisoning 3rd-party driver
sources that use the flags in the old bad way.

This patch produces no binary changes in this set of PCI kernels when
they are compiled w/o 'options DIAGNOSTIC' and w/ -V MKREPRO=yes:

algor P4032 P5064 P6032
alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE
evbarm-el GUMSTIX HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321
evbarm-el IXDP425 IXM1200 KUROBOX_PRO
evbarm-el LUBBOCK MARVELL_NAS NAPPI NSLU2 SHEEVAPLUG SMDK2800 TEAMASA_NPWR
evbarm-el TEAMASA_NPWR_FC TS7200 TWINTAIL ZAO425
evbmips-el AP30 DBAU1500 DBAU1550 MALTA MERAKI MTX-1 OMSAL400 RB153 WGT624V3
evbmips64-el XLSATX
evbppc EV64260 MPC8536DS MPC8548CDS OPENBLOCKS200 OPENBLOCKS266
evbppc OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
iyonix GENERIC
landisk GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sbmips-el GENERIC
sgimips GENERIC32_IP2x GENERIC32_IP3x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC
 1.11 11-May-2011  dyoung Now that GENERIC32_IPX3x builds again, fix some pci_attach_args
constification that I'd missed.
 1.10 20-Feb-2011  matt Merge forward matt-nb5-mips64
Adapt to new interrupt/spl framework
Deal with arcbios calls being O32 and kernels being N32/N64.
Need to save/restore T8 across arcbios calls.
 1.9 17-Apr-2007  sekiya branches: 1.9.54; 1.9.58; 1.9.64; 1.9.66;
Nuke homegrown PCI configuration routines. #ifdef'd out by tsutsui@ a long
time ago; this is just garbage collection.
 1.8 30-Aug-2006  rumble branches: 1.8.8; 1.8.12; 1.8.14;
Generalise pci/pci_machdep.c further and move all mace-specific code into
mace/pci_mace.c in preparation for pci devices on the gio(4) bus.
 1.7 17-Apr-2006  tsutsui branches: 1.7.6;
Switch macepci to use MI pci_configure_bus(9) rather than its own fixup code.
Tested on my O2 with several devices, and ok'ed by sekiya.
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.6; 1.6.8; 1.6.10; 1.6.12;
merge ktrace-lwp.
 1.5 29-Sep-2004  sekiya branches: 1.5.12;
Use ANSI function declarations.
 1.4 06-Sep-2004  sekiya Use the mace interrupt handler for PCI interrupts.

From KIYOHARA Takashi
 1.3 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.2 19-Jan-2004  sekiya branches: 1.2.4;
Checking for IP32 in each driver is redundant -- they're attached as children
of mace, so it is sufficient to perform the check in mace_match(). Pointed
out by soren@.
 1.1 18-Jan-2004  sekiya Following the example of the hpc/, gio/, and ioc/ directories, move the
mace devices to their own mace/ directory. Alter conf/files.sgimips to
reflect this change in a sane manner (i.e., pull in dev/files.dev and
mace/files.mace when appropriate).

At the same time, allow crime_intr_establish() to fall through to
mace_intr_establish(). mace devices now call cpu_intr_establish().
 1.2.4.6 19-Oct-2004  skrll Sync with HEAD
 1.2.4.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.4 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.3 03-Sep-2004  skrll Sync with HEAD
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 19-Jan-2004  skrll file pci_mace.c was added on branch ktrace-lwp on 2004-08-03 10:40:07 +0000
 1.5.12.3 03-Sep-2007  yamt sync with head.
 1.5.12.2 30-Dec-2006  yamt sync with head.
 1.5.12.1 21-Jun-2006  yamt sync with head.
 1.6.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.6.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.6.8.2 03-Sep-2006  yamt sync with head.
 1.6.8.1 24-May-2006  yamt sync with head.
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.7.6.1 10-Sep-2006  tron Pull up following revision(s) (requested by rumble in ticket #137):
sys/arch/sgimips/include/pci_machdep.h: revision 1.9
sys/arch/sgimips/pci/pci_machdep.c: revision 1.19
sys/arch/sgimips/mace/pci_mace.c: revision 1.8
Generalise pci/pci_machdep.c further and move all mace-specific code into
mace/pci_mace.c in preparation for pci devices on the gio(4) bus.
 1.8.14.1 11-Jul-2007  mjf Sync with head.
 1.8.12.1 27-May-2007  ad Sync with head.
 1.8.8.1 07-May-2007  yamt sync with head.
 1.9.66.1 05-Mar-2011  bouyer Sync with HEAD
 1.9.64.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.58.2 31-May-2011  rmind sync with head
 1.9.58.1 05-Mar-2011  rmind sync with head
 1.9.54.1 20-Jan-2010  matt Adjust things to the new world order.
 1.13.6.1 18-Feb-2012  mrg merge to -current.
 1.13.2.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.13.2.2 30-Oct-2012  yamt sync with head
 1.13.2.1 17-Apr-2012  yamt sync with head
 1.14.6.3 03-Dec-2017  jdolecek update from HEAD
 1.14.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.15.2.1 18-May-2014  rmind sync with head
 1.17.6.3 05-Oct-2016  skrll Sync with HEAD
 1.17.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.17.6.1 06-Apr-2015  skrll Sync with HEAD
 1.20.2.1 06-Aug-2016  pgoyette Sync with HEAD
 1.23.4.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.24.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.3 18-Feb-2015  macallan switch sgimips to common bus_dma and bus_space in arch/mips/
Tested on O2 and Indy.
Things that are compile-tested only for lack of hardware:
- GIO ethernet cards with PCI bridges
- IP2x hardware not found on Indy
- IP1x
 1.2 11-Dec-2005  christos branches: 1.2.122; 1.2.142;
merge ktrace-lwp.
 1.1 18-Jan-2004  sekiya branches: 1.1.4;
Following the example of the hpc/, gio/, and ioc/ directories, move the
mace devices to their own mace/ directory. Alter conf/files.sgimips to
reflect this change in a sane manner (i.e., pull in dev/files.dev and
mace/files.mace when appropriate).

At the same time, allow crime_intr_establish() to fall through to
mace_intr_establish(). mace devices now call cpu_intr_establish().
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 18-Jan-2004  skrll file pcireg_mace.h was added on branch ktrace-lwp on 2004-08-03 10:40:07 +0000
 1.2.142.1 06-Apr-2015  skrll Sync with HEAD
 1.2.122.1 03-Dec-2017  jdolecek update from HEAD
 1.6 12-Apr-2007  jmcneill Remove pckbc_mace, it has never worked and has been replaced by macekbc
 1.5 11-Dec-2005  christos branches: 1.5.26; 1.5.30; 1.5.32;
merge ktrace-lwp.
 1.4 29-Sep-2004  sekiya branches: 1.4.12;
Use ANSI function declarations.
 1.3 14-Feb-2004  bjh21 branches: 1.3.4;
Add a new MI attribute, pckbc_machdep_cnattach, and change pckbc_cnattach()
to only call pckbc_machdep_cnattach() if this is present. This allows
pckbc_machdep_cnattach() to be omitted entirely on most ports, where it only
returns ENXIO anyway.

The devices with this attribute at the moment are pc(4) on i386 and bebox, and
pckbc on sparc, where pckbc_machdep_cnattach() mysteriously returns 0 rather
than ENXIO.
 1.2 19-Jan-2004  sekiya Checking for IP32 in each driver is redundant -- they're attached as children
of mace, so it is sufficient to perform the check in mace_match(). Pointed
out by soren@.
 1.1 18-Jan-2004  sekiya Following the example of the hpc/, gio/, and ioc/ directories, move the
mace devices to their own mace/ directory. Alter conf/files.sgimips to
reflect this change in a sane manner (i.e., pull in dev/files.dev and
mace/files.mace when appropriate).

At the same time, allow crime_intr_establish() to fall through to
mace_intr_establish(). mace devices now call cpu_intr_establish().
 1.3.4.5 19-Oct-2004  skrll Sync with HEAD
 1.3.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.4.2 03-Aug-2004  skrll Sync with HEAD
 1.3.4.1 14-Feb-2004  skrll file pckbc_mace.c was added on branch ktrace-lwp on 2004-08-03 10:40:08 +0000
 1.4.12.1 03-Sep-2007  yamt sync with head.
 1.5.32.1 11-Jul-2007  mjf Sync with head.
 1.5.30.1 27-May-2007  ad Sync with head.
 1.5.26.1 15-Apr-2007  yamt sync with head.

RSS XML Feed