Home | History | Annotate | only in /src/sys/arch/prep/pnpbus
History log of /src/sys/arch/prep/pnpbus
RevisionDateAuthorComments
 1.6 24-Jul-2021  andvar Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.
 1.5 13-Apr-2015  riastradh branches: 1.5.34;
MD rnd.h cleanups. Please let me know if I broke anything!
 1.4 02-Feb-2012  tls branches: 1.4.6; 1.4.24;
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.3 01-Jul-2011  dyoung branches: 1.3.2; 1.3.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.2 29-Apr-2008  martin branches: 1.2.4; 1.2.6; 1.2.8;
Convert to new 2 clause license
 1.1 28-Apr-2008  garbled Add floppy support to prep (the croud goes wild)

Add an additional argument to pnpbus_intr_establish to allow overriding of
the pnp interrupt type, because some devices lie.
Change how the pnpbus match routine works, to avoid attaching it when we
are probing for cpu's.
Fix a few stray printf's in the autoconf output.
 1.2.8.2 02-Jun-2008  mjf Sync with HEAD.
 1.2.8.1 29-Apr-2008  mjf file fdc_pnpbus.c was added on branch mjf-devfs2 on 2008-06-02 13:22:34 +0000
 1.2.6.2 18-May-2008  yamt sync with head.
 1.2.6.1 29-Apr-2008  yamt file fdc_pnpbus.c was added on branch yamt-pf42 on 2008-05-18 12:32:39 +0000
 1.2.4.2 16-May-2008  yamt sync with head.
 1.2.4.1 29-Apr-2008  yamt file fdc_pnpbus.c was added on branch yamt-nfs-mp on 2008-05-16 02:23:03 +0000
 1.3.6.1 18-Feb-2012  mrg merge to -current.
 1.3.2.1 17-Apr-2012  yamt sync with head
 1.4.24.1 06-Jun-2015  skrll Sync with HEAD
 1.4.6.1 03-Dec-2017  jdolecek update from HEAD
 1.5.34.1 01-Aug-2021  thorpej Sync with HEAD.
 1.9 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.8 01-Jul-2011  dyoung branches: 1.8.2; 1.8.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.7 18-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
use device accessors, use device_private.
some softc/device_t splits (macppc needs a bunch more)
aprint*_dev used considerably more
 1.6 17-Jun-2011  matt intr.h must not include cpu due to deadly embrace with SOFTINT_COUNT.
Cleanup intr.h so MD definitions can overload common definitions.
Rototill pic/intr.c. Virtual IRQs can now be reclaimed. separate virq
from hwirq from picirq. Redo intr mask calculations.
tested on pmppc and macppc (MP).
 1.5 14-Mar-2009  dsl branches: 1.5.10;
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.4 28-Apr-2008  martin branches: 1.4.8; 1.4.14;
Remove clause 3 and 4 from TNF licenses
 1.3 28-Apr-2008  garbled Add floppy support to prep (the croud goes wild)

Add an additional argument to pnpbus_intr_establish to allow overriding of
the pnp interrupt type, because some devices lie.
Change how the pnpbus match routine works, to avoid attaching it when we
are probing for cpu's.
Fix a few stray printf's in the autoconf output.
 1.2 17-Oct-2007  garbled branches: 1.2.16; 1.2.18; 1.2.20;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.1 23-Jun-2006  garbled branches: 1.1.2; 1.1.4; 1.1.10; 1.1.16; 1.1.22; 1.1.30; 1.1.40; 1.1.42; 1.1.44; 1.1.46;
1) Modify pnpbus attachment code to properly decode pnp memory range packets.
2) Modify pnpbus attachment code to record the chipid of the device if it
has one.
3) Change the clock probes to use the chipid, rather than relying on
potentially untrustworthy subtype and interface.
4) Add decoding of memory ranges to the RESIDUAL_DUMP code.
5) Add a we@pnpbus device to allow netbooting and root device detection
from an IBM we ethernet. (it will only work if your firmware detects it)
6) Because I moved the pnpbus probe to occur prior to pci and isa, it
screwed up the root device detection and firmware path building code.
Completely rewrite the fw-path detection code to deal with this.
 1.1.46.1 25-Oct-2007  bouyer Sync with HEAD.
 1.1.44.1 18-Oct-2007  yamt sync with head.
 1.1.42.1 06-Nov-2007  matt sync with HEAD
 1.1.40.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.30.1 10-May-2007  garbled convert printf's to aprint_*.
 1.1.22.1 23-Oct-2007  ad Sync with head.
 1.1.16.3 27-Oct-2007  yamt sync with head.
 1.1.16.2 30-Dec-2006  yamt sync with head.
 1.1.16.1 23-Jun-2006  yamt file if_we_pnpbus.c was added on branch yamt-lazymbuf on 2006-12-30 20:46:50 +0000
 1.1.10.2 09-Sep-2006  rpaulo sync with head
 1.1.10.1 23-Jun-2006  rpaulo file if_we_pnpbus.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:42:43 +0000
 1.1.4.2 13-Jul-2006  gdamore Merge from HEAD.
 1.1.4.1 23-Jun-2006  gdamore file if_we_pnpbus.c was added on branch gdamore-uart on 2006-07-13 17:49:02 +0000
 1.1.2.2 26-Jun-2006  yamt sync with head.
 1.1.2.1 23-Jun-2006  yamt file if_we_pnpbus.c was added on branch yamt-pdpolicy on 2006-06-26 12:45:14 +0000
 1.2.20.2 04-May-2009  yamt sync with head.
 1.2.20.1 16-May-2008  yamt sync with head.
 1.2.18.1 18-May-2008  yamt sync with head.
 1.2.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.8.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.8.2.1 30-Oct-2012  yamt sync with head
 1.11 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.10 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 29-Mar-2008  matt branches: 1.8.2; 1.8.4;
Don't use device_private on xx_cd.cd_devs[n],
use device_lookup_private(&xx_cd, n) instead.
 1.7 29-Mar-2008  tsutsui We have to use device_private() to get softc from cd_devs[].
 1.6 29-Mar-2008  tsutsui Don't forget to initialize sc_dev.
 1.5 28-Mar-2008  tsutsui Split device_t and softc for MI mc146818 clock,
and other related misc cosmetics.
 1.4 10-Jan-2008  tsutsui branches: 1.4.6;
Move todr_attach(9) calls from each MD attachment to MI mc146818_attach().
 1.3 12-Jul-2006  garbled branches: 1.3.2; 1.3.8; 1.3.38; 1.3.44; 1.3.52;
Add support for rebooting 7024 and 7025 models. Since I cannot figure
out how to properly reboot these machines, instead we make use of the
auto-poweron-alarm time, and power cycle the machine to simulate a
reboot. This is a hack, but until I get documentation on these machines,
at least you will be able to reboot them.
 1.2 23-Jun-2006  garbled branches: 1.2.2;
1) Modify pnpbus attachment code to properly decode pnp memory range packets.
2) Modify pnpbus attachment code to record the chipid of the device if it
has one.
3) Change the clock probes to use the chipid, rather than relying on
potentially untrustworthy subtype and interface.
4) Add decoding of memory ranges to the RESIDUAL_DUMP code.
5) Add a we@pnpbus device to allow netbooting and root device detection
from an IBM we ethernet. (it will only work if your firmware detects it)
6) Because I moved the pnpbus probe to occur prior to pci and isa, it
screwed up the root device detection and firmware path building code.
Completely rewrite the fw-path detection code to deal with this.
 1.1 15-Jun-2006  garbled branches: 1.1.2; 1.1.4;
A bit of clock rototill. It's safer to detect things known by the
residual with the pnpbus probes, than it is to do it with raw isa probes,
so I've replaced the isa mkclock and mcclock code with a pnpbus attachment.

While writing the mkclock code, I realized that on motorola prep machines
the mkclock uses the same port range as the nvram part. (it's actually
the same chip/part). This was causing the nvram not to work on those
machines. Now the nvram code will recognize this, and wire up the
mkclock as well. The mkclock probe is just a stub probe used to
pre-detect the fact that this is one of those machines.
 1.1.4.4 21-Jan-2008  yamt sync with head
 1.1.4.3 30-Dec-2006  yamt sync with head.
 1.1.4.2 21-Jun-2006  yamt sync with head.
 1.1.4.1 15-Jun-2006  yamt file mcclock_pnpbus.c was added on branch yamt-lazymbuf on 2006-06-21 14:55:19 +0000
 1.1.2.2 19-Jun-2006  chap Sync with head.
 1.1.2.1 15-Jun-2006  chap file mcclock_pnpbus.c was added on branch chap-midi on 2006-06-19 03:45:06 +0000
 1.2.2.3 11-Aug-2006  yamt sync with head
 1.2.2.2 26-Jun-2006  yamt sync with head.
 1.2.2.1 23-Jun-2006  yamt file mcclock_pnpbus.c was added on branch yamt-pdpolicy on 2006-06-26 12:45:14 +0000
 1.3.52.1 10-Jan-2008  bouyer Sync with HEAD
 1.3.44.1 18-Feb-2008  mjf Sync with HEAD.
 1.3.38.1 23-Mar-2008  matt sync with HEAD
 1.3.8.2 09-Sep-2006  rpaulo sync with head
 1.3.8.1 12-Jul-2006  rpaulo file mcclock_pnpbus.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:42:43 +0000
 1.3.2.2 13-Jul-2006  gdamore Merge from HEAD.
 1.3.2.1 12-Jul-2006  gdamore file mcclock_pnpbus.c was added on branch gdamore-uart on 2006-07-13 17:49:02 +0000
 1.4.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.4.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.8.4.1 16-May-2008  yamt sync with head.
 1.8.2.1 18-May-2008  yamt sync with head.
 1.6 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.5 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4 29-Mar-2008  tsutsui branches: 1.4.2; 1.4.4;
Use CFATTACH_DECL_NEW().
XXX: this one looks a bit strange because it's attached via nvram_pnpbus.c
 1.3 29-Apr-2007  msaitoh branches: 1.3.32;
fix typos
 1.2 23-Jun-2006  garbled branches: 1.2.2; 1.2.4; 1.2.10; 1.2.16; 1.2.20; 1.2.22;
1) Modify pnpbus attachment code to properly decode pnp memory range packets.
2) Modify pnpbus attachment code to record the chipid of the device if it
has one.
3) Change the clock probes to use the chipid, rather than relying on
potentially untrustworthy subtype and interface.
4) Add decoding of memory ranges to the RESIDUAL_DUMP code.
5) Add a we@pnpbus device to allow netbooting and root device detection
from an IBM we ethernet. (it will only work if your firmware detects it)
6) Because I moved the pnpbus probe to occur prior to pci and isa, it
screwed up the root device detection and firmware path building code.
Completely rewrite the fw-path detection code to deal with this.
 1.1 15-Jun-2006  garbled branches: 1.1.2; 1.1.4;
A bit of clock rototill. It's safer to detect things known by the
residual with the pnpbus probes, than it is to do it with raw isa probes,
so I've replaced the isa mkclock and mcclock code with a pnpbus attachment.

While writing the mkclock code, I realized that on motorola prep machines
the mkclock uses the same port range as the nvram part. (it's actually
the same chip/part). This was causing the nvram not to work on those
machines. Now the nvram code will recognize this, and wire up the
mkclock as well. The mkclock probe is just a stub probe used to
pre-detect the fact that this is one of those machines.
 1.1.4.4 03-Sep-2007  yamt sync with head.
 1.1.4.3 30-Dec-2006  yamt sync with head.
 1.1.4.2 21-Jun-2006  yamt sync with head.
 1.1.4.1 15-Jun-2006  yamt file mkclock_pnpbus.c was added on branch yamt-lazymbuf on 2006-06-21 14:55:19 +0000
 1.1.2.2 19-Jun-2006  chap Sync with head.
 1.1.2.1 15-Jun-2006  chap file mkclock_pnpbus.c was added on branch chap-midi on 2006-06-19 03:45:06 +0000
 1.2.22.1 11-Jul-2007  mjf Sync with head.
 1.2.20.1 27-May-2007  ad Sync with head.
 1.2.16.1 07-May-2007  yamt sync with head.
 1.2.10.2 09-Sep-2006  rpaulo sync with head
 1.2.10.1 23-Jun-2006  rpaulo file mkclock_pnpbus.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:42:43 +0000
 1.2.4.2 13-Jul-2006  gdamore Merge from HEAD.
 1.2.4.1 23-Jun-2006  gdamore file mkclock_pnpbus.c was added on branch gdamore-uart on 2006-07-13 17:49:02 +0000
 1.2.2.2 26-Jun-2006  yamt sync with head.
 1.2.2.1 23-Jun-2006  yamt file mkclock_pnpbus.c was added on branch yamt-pdpolicy on 2006-06-26 12:45:14 +0000
 1.3.32.2 02-Jun-2008  mjf Sync with HEAD.
 1.3.32.1 03-Apr-2008  mjf 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.23 07-Sep-2025  thorpej Rather than duplicating the fields of mk48txx_softc inside
prep_mk48txx_softc (!!!), just include a mk48txx_softc inside
prep_mk48txx_softc.
 1.22 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.21 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.20 25-Jul-2014  dholland branches: 1.20.26; 1.20.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.19 16-Mar-2014  dholland branches: 1.19.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.18 28-Feb-2014  skrll G/C sys/simplelock.h includes
 1.17 27-Oct-2012  chs branches: 1.17.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.16 18-Feb-2012  rmind branches: 1.16.2;
Replace few simple_lock(9) cases.
 1.15 18-Jun-2011  matt branches: 1.15.2; 1.15.6;
struct device * -> device_t
struct cfdata * -> cfdata_t
use device accessors, use device_private.
some softc/device_t splits (macppc needs a bunch more)
aprint*_dev used considerably more
 1.14 28-Apr-2008  martin branches: 1.14.32;
Remove clause 3 and 4 from TNF licenses
 1.13 29-Mar-2008  matt branches: 1.13.2; 1.13.4;
Fix more direct references to cd_devs to device_lookup_private
 1.12 29-Mar-2008  matt Don't use device_lookup to get softc, use device_lookup_private.
 1.11 10-Jan-2008  tsutsui branches: 1.11.6;
- move todr_attach(9) calls from each MD attachment to MI mk48txx_attach()
- don't clear todr_setwen in mk48txx_attach() since it might be set by
MD attachments
 1.10 05-Jan-2008  ad Fix includes.
 1.9 17-Oct-2007  garbled branches: 1.9.2; 1.9.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.8 21-Mar-2007  garbled branches: 1.8.4; 1.8.12; 1.8.14; 1.8.16; 1.8.18;
Add a read entry point to this driver. There are two minor devices
associated with this, 0, the nvram device, and now 1, the residual
device. The devices allow the user to directly read the contents of the
kernel copy of the nvram, and the residual data respectively. There is
no provision for write.
 1.7 04-Mar-2007  christos branches: 1.7.2; 1.7.4; 1.7.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6 26-Feb-2007  garbled Finish the code in the prep nvram driver that makes it an actual device
(/dev/nvram) and implement all the associated ioctls fully. Tested with
a hacked up copy of eeprom(8). Right now it can only be used to see the
nvram GEV contents, not actually edit them. Will do that later some day.
 1.5 30-Oct-2006  garbled branches: 1.5.2; 1.5.4;
Make these files compile with -Wextra -Wno-unused
 1.4 07-Sep-2006  garbled branches: 1.4.2; 1.4.4;
Now that the interrupt bug on the 7043-140 is fixed, it also fixes the
long standing issue with interrupts onthe PowerStack E1. Remove the
quirk entry for the PowerStack E1 and revert to using the IVR.
Also, add a \n to the attachment of the mk clock printf that was missing.
 1.3 15-Jun-2006  garbled branches: 1.3.2; 1.3.4; 1.3.6;
A bit of clock rototill. It's safer to detect things known by the
residual with the pnpbus probes, than it is to do it with raw isa probes,
so I've replaced the isa mkclock and mcclock code with a pnpbus attachment.

While writing the mkclock code, I realized that on motorola prep machines
the mkclock uses the same port range as the nvram part. (it's actually
the same chip/part). This was causing the nvram not to work on those
machines. Now the nvram code will recognize this, and wire up the
mkclock as well. The mkclock probe is just a stub probe used to
pre-detect the fact that this is one of those machines.
 1.2 26-Apr-2006  garbled branches: 1.2.2; 1.2.4;
Support fixes for the Motorola Powerstack E1.
1) The E1 seems to have the int. siop wired to irq 14-level and the internal
wdc wired to irq 14-edge. special case and fail the wdc probe on E1's.
2) If we fail to map the NVRAM registers, return, rather than trying to talk
to them and panic'ing the box.
3) revert my previous "fix" to pnpbus to make irq's default to level. It
was wrong, and didn't even fix the powerstack.

With this, we have limited PowerStack E1 support. The machine cannot
talk to it's IDE controller, and cannot detect it's boot device
automatically, but it does come up and run. Tested with NFS root.
 1.1 16-Mar-2006  garbled branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
More changes to prep port:
1) Add the NVRAM device. This device allows us to speak with the nvram on
prep-based machines and read/write to it. Also add a simple IOCTL
interface for speaking with the nvram from userland. This hasn't been
tested yet, but eventually I plan to support it with the sparc eeprom
command.
2) Change the root device detection to use the nvram device to attempt to
guess the boot device. Most machines should now correctly guess thier
boot device, though I expect a few devices to still not work quite right yet.
3) change the default IRQ to level rather than edge in the pnpbus if the
flags are invalid or empty. (based on output from a PowerStack E1)
4) correctly handle older machines in pnpbus that have FixedIOPorts
rather than variable ones.

Still have much to do.
 1.1.8.3 01-Jun-2006  kardel Sync with head.
 1.1.8.2 22-Apr-2006  simonb Sync with head.
 1.1.8.1 16-Mar-2006  simonb file nvram_pnpbus.c was added on branch simonb-timecounters on 2006-04-22 11:37:54 +0000
 1.1.6.3 11-May-2006  elad sync with head
 1.1.6.2 19-Apr-2006  elad sync with head - hopefully this will work
 1.1.6.1 16-Mar-2006  elad file nvram_pnpbus.c was added on branch elad-kernelauth on 2006-04-19 02:33:38 +0000
 1.1.4.5 14-Sep-2006  yamt sync with head.
 1.1.4.4 26-Jun-2006  yamt sync with head.
 1.1.4.3 24-May-2006  yamt sync with head.
 1.1.4.2 11-Apr-2006  yamt sync files somehow mis-tagged by yamt-pdpolicy-base2.
 1.1.4.1 16-Mar-2006  yamt file nvram_pnpbus.c was added on branch yamt-pdpolicy on 2006-04-11 12:20:51 +0000
 1.1.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.2.2.1 19-Jun-2006  chap Sync with head.
 1.3.6.1 18-Nov-2006  ad Sync with head.
 1.3.4.1 09-Sep-2006  tron Pull up following revision(s) (requested by garbled in ticket #138):
sys/arch/prep/prep/platform.c: revision 1.22
sys/arch/prep/pnpbus/nvram_pnpbus.c: revision 1.4
Now that the interrupt bug on the 7043-140 is fixed, it also fixes the
long standing issue with interrupts onthe PowerStack E1. Remove the
quirk entry for the PowerStack E1 and revert to using the IVR.
Also, add a \n to the attachment of the mk clock printf that was missing.
 1.3.2.6 21-Jan-2008  yamt sync with head
 1.3.2.5 27-Oct-2007  yamt sync with head.
 1.3.2.4 03-Sep-2007  yamt sync with head.
 1.3.2.3 30-Dec-2006  yamt sync with head.
 1.3.2.2 21-Jun-2006  yamt sync with head.
 1.3.2.1 15-Jun-2006  yamt file nvram_pnpbus.c was added on branch yamt-lazymbuf on 2006-06-21 14:55:19 +0000
 1.4.4.1 10-Dec-2006  yamt sync with head.
 1.4.2.2 09-Sep-2006  rpaulo sync with head
 1.4.2.1 07-Sep-2006  rpaulo file nvram_pnpbus.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:42:43 +0000
 1.5.4.3 24-Mar-2007  yamt sync with head.
 1.5.4.2 12-Mar-2007  rmind Sync with HEAD.
 1.5.4.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.5.2.2 31-Mar-2007  bouyer Pull up following revision(s) (requested by garbled in ticket #531):
sys/arch/prep/include/nvram.h: revision 1.4
sys/arch/prep/pnpbus/nvram_pnpbus.c: revision 1.8
Add a read entry point to this driver. There are two minor devices
associated with this, 0, the nvram device, and now 1, the residual
device. The devices allow the user to directly read the contents of the
kernel copy of the nvram, and the residual data respectively. There is
no provision for write.
 1.5.2.1 04-Mar-2007  bouyer Pull up following revision(s) (requested by garbled in ticket #482):
share/man/man4/man4.prep/intro.4: revision 1.1
usr.sbin/eeprom/eeprom.8: revision 1.12
usr.sbin/eeprom/prephandlers.c: revision 1.1
distrib/sets/lists/base/md.prep: revision 1.13
distrib/sets/lists/comp/md.prep: revision 1.22
sys/arch/prep/conf/majors.prep: revision 1.19
share/man/man4/man4.prep/Makefile: revision 1.1
share/man/man4/Makefile: revision 1.421
usr.sbin/eeprom/defs.h: revision 1.10
share/man/man4/man4.prep/nvram.4: revision 1.1
sys/arch/prep/pnpbus/nvram_pnpbus.c: revision 1.6
usr.sbin/eeprom/Makefile: revision 1.14
etc/mtree/NetBSD.dist: revision 1.333
usr.sbin/eeprom/main.c: revision 1.17
etc/etc.prep/MAKEDEV.conf: revision 1.5
distrib/sets/lists/man/mi: revision 1.978
usr.sbin/eeprom/pathnames.h: revision 1.3
sys/arch/prep/include/Makefile: revision 1.19
sys/arch/prep/include/nvram.h: revision 1.3
Finish the code in the prep nvram driver that makes it an actual device
(/dev/nvram) and implement all the associated ioctls fully. Tested with
a hacked up copy of eeprom(8). Right now it can only be used to see the
nvram GEV contents, not actually edit them. Will do that later some day.
 1.7.6.1 29-Mar-2007  reinoud Pullup to -current
 1.7.4.1 11-Jul-2007  mjf Sync with head.
 1.7.2.2 23-Oct-2007  ad Sync with head.
 1.7.2.1 10-Apr-2007  ad Sync with head.
 1.8.18.1 25-Oct-2007  bouyer Sync with HEAD.
 1.8.16.1 18-Oct-2007  yamt sync with head.
 1.8.14.3 23-Mar-2008  matt sync with HEAD
 1.8.14.2 09-Jan-2008  matt sync with HEAD
 1.8.14.1 06-Nov-2007  matt sync with HEAD
 1.8.12.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.8.4.1 10-May-2007  garbled convert printf's to aprint_*.
 1.9.8.2 10-Jan-2008  bouyer Sync with HEAD
 1.9.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.9.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.11.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.11.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.13.4.1 16-May-2008  yamt sync with head.
 1.13.2.1 18-May-2008  yamt sync with head.
 1.14.32.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.15.6.1 24-Feb-2012  mrg sync to -current.
 1.15.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.15.2.2 30-Oct-2012  yamt sync with head
 1.15.2.1 17-Apr-2012  yamt sync with head
 1.16.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.17.2.1 18-May-2014  rmind sync with head
 1.19.2.1 10-Aug-2014  tls Rebase.
 1.20.28.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.20.28.1 10-Jun-2019  christos Sync with HEAD
 1.20.26.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.15 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.14 24-Apr-2021  thorpej branches: 1.14.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.13 21-Nov-2020  thorpej branches: 1.13.2;
malloc(9) -> kmem(9)
 1.12 10-Nov-2019  chs branches: 1.12.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.11 01-Jul-2011  dyoung branches: 1.11.54;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.10 18-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
use device accessors, use device_private.
some softc/device_t splits (macppc needs a bunch more)
aprint*_dev used considerably more
 1.9 28-Apr-2008  martin branches: 1.9.32;
Remove clause 3 and 4 from TNF licenses
 1.8 28-Apr-2008  garbled Add floppy support to prep (the croud goes wild)

Add an additional argument to pnpbus_intr_establish to allow overriding of
the pnp interrupt type, because some devices lie.
Change how the pnpbus match routine works, to avoid attaching it when we
are probing for cpu's.
Fix a few stray printf's in the autoconf output.
 1.7 17-Oct-2007  garbled branches: 1.7.16; 1.7.18; 1.7.20;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.6 27-Oct-2006  garbled branches: 1.6.8; 1.6.16; 1.6.26; 1.6.28; 1.6.30; 1.6.32;
A few changes so pnpbus devices can do isadma. Note that isadma still
does not seem to work properly on prep.
 1.5 23-Jun-2006  garbled branches: 1.5.4; 1.5.6; 1.5.8;
1) Modify pnpbus attachment code to properly decode pnp memory range packets.
2) Modify pnpbus attachment code to record the chipid of the device if it
has one.
3) Change the clock probes to use the chipid, rather than relying on
potentially untrustworthy subtype and interface.
4) Add decoding of memory ranges to the RESIDUAL_DUMP code.
5) Add a we@pnpbus device to allow netbooting and root device detection
from an IBM we ethernet. (it will only work if your firmware detects it)
6) Because I moved the pnpbus probe to occur prior to pci and isa, it
screwed up the root device detection and firmware path building code.
Completely rewrite the fw-path detection code to deal with this.
 1.4 15-Jun-2006  garbled branches: 1.4.2;
A bit of clock rototill. It's safer to detect things known by the
residual with the pnpbus probes, than it is to do it with raw isa probes,
so I've replaced the isa mkclock and mcclock code with a pnpbus attachment.

While writing the mkclock code, I realized that on motorola prep machines
the mkclock uses the same port range as the nvram part. (it's actually
the same chip/part). This was causing the nvram not to work on those
machines. Now the nvram code will recognize this, and wire up the
mkclock as well. The mkclock probe is just a stub probe used to
pre-detect the fact that this is one of those machines.
 1.3 26-Apr-2006  garbled branches: 1.3.2; 1.3.4;
Support fixes for the Motorola Powerstack E1.
1) The E1 seems to have the int. siop wired to irq 14-level and the internal
wdc wired to irq 14-edge. special case and fail the wdc probe on E1's.
2) If we fail to map the NVRAM registers, return, rather than trying to talk
to them and panic'ing the box.
3) revert my previous "fix" to pnpbus to make irq's default to level. It
was wrong, and didn't even fix the powerstack.

With this, we have limited PowerStack E1 support. The machine cannot
talk to it's IDE controller, and cannot detect it's boot device
automatically, but it does come up and run. Tested with NFS root.
 1.2 16-Mar-2006  garbled branches: 1.2.2; 1.2.4; 1.2.6;
More changes to prep port:
1) Add the NVRAM device. This device allows us to speak with the nvram on
prep-based machines and read/write to it. Also add a simple IOCTL
interface for speaking with the nvram from userland. This hasn't been
tested yet, but eventually I plan to support it with the sparc eeprom
command.
2) Change the root device detection to use the nvram device to attempt to
guess the boot device. Most machines should now correctly guess thier
boot device, though I expect a few devices to still not work quite right yet.
3) change the default IRQ to level rather than edge in the pnpbus if the
flags are invalid or empty. (based on output from a PowerStack E1)
4) correctly handle older machines in pnpbus that have FixedIOPorts
rather than variable ones.

Still have much to do.
 1.1 09-Mar-2006  garbled branches: 1.1.2;
Prep super-commit:

1) create new pnpbus psuedo bus. This is a bus layer that reads the PNP
tree from the residual data and allows attachment of devices with the
information given therein. Based loosely on i386/pnpbios.

2) Delete obio bus, as with the pnp bus we no longer need it.

3) Create a number of functions that gather the information needed to set
up the machine from the residual data, rather than hardcoding it in.

4) Create a quirk table for machines that are bizzare enough that the
residual information is not sufficient. (such as the 6015)

5) Using the data gathering routines and the quirk table, delete struct
platform completely from the architecture. Prep is now almost completely
dynamic in figuring out the machine it is running on and setting things
up properly.

6) Add a wdc_pnpbus driver which attaches the wdc controller found on
some 7248's and the 6015. This replaces the now-defunct wdc_obio.

7) delete all the mot_* and ibm_* files, and replace them with a single
ibm_machdep.c which only contains the quirk functions for the 6015 and
the 6050.

8) Modify GENERIC to work with all this stuff.
 1.1.2.5 26-Jun-2006  yamt sync with head.
 1.1.2.4 24-May-2006  yamt sync with head.
 1.1.2.3 01-Apr-2006  yamt sync with head.
 1.1.2.2 13-Mar-2006  yamt sync with head.
 1.1.2.1 09-Mar-2006  yamt file pnpbus.c was added on branch yamt-pdpolicy on 2006-03-13 09:06:59 +0000
 1.2.6.3 01-Jun-2006  kardel Sync with head.
 1.2.6.2 22-Apr-2006  simonb Sync with head.
 1.2.6.1 16-Mar-2006  simonb file pnpbus.c was added on branch simonb-timecounters on 2006-04-22 11:37:54 +0000
 1.2.4.3 11-May-2006  elad sync with head
 1.2.4.2 19-Apr-2006  elad sync with head - hopefully this will work
 1.2.4.1 16-Mar-2006  elad file pnpbus.c was added on branch elad-kernelauth on 2006-04-19 02:33:38 +0000
 1.2.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.3.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.3.2.1 19-Jun-2006  chap Sync with head.
 1.4.2.4 27-Oct-2007  yamt sync with head.
 1.4.2.3 30-Dec-2006  yamt sync with head.
 1.4.2.2 21-Jun-2006  yamt sync with head.
 1.4.2.1 15-Jun-2006  yamt file pnpbus.c was added on branch yamt-lazymbuf on 2006-06-21 14:55:19 +0000
 1.5.8.1 10-Dec-2006  yamt sync with head.
 1.5.6.2 09-Sep-2006  rpaulo sync with head
 1.5.6.1 23-Jun-2006  rpaulo file pnpbus.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:42:43 +0000
 1.5.4.1 18-Nov-2006  ad Sync with head.
 1.6.32.1 25-Oct-2007  bouyer Sync with HEAD.
 1.6.30.1 18-Oct-2007  yamt sync with head.
 1.6.28.1 06-Nov-2007  matt sync with HEAD
 1.6.26.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.6.16.2 10-May-2007  garbled convert printf's to aprint_*.
 1.6.16.1 01-May-2007  garbled Rename the prep isa io and mem bus space tags to genppc_* to promote
sharing of isa functionality.
 1.6.8.1 23-Oct-2007  ad Sync with head.
 1.7.20.1 16-May-2008  yamt sync with head.
 1.7.18.1 18-May-2008  yamt sync with head.
 1.7.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.32.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.11.54.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.12.8.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.13.2.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.13.2.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.13.2.4 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.13.2.3 03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.13.2.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.13.2.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.14.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.8 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.7 18-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
use device accessors, use device_private.
some softc/device_t splits (macppc needs a bunch more)
aprint*_dev used considerably more
 1.6 28-Apr-2008  martin branches: 1.6.32;
Remove clause 3 and 4 from TNF licenses
 1.5 28-Apr-2008  garbled Add floppy support to prep (the croud goes wild)

Add an additional argument to pnpbus_intr_establish to allow overriding of
the pnp interrupt type, because some devices lie.
Change how the pnpbus match routine works, to avoid attaching it when we
are probing for cpu's.
Fix a few stray printf's in the autoconf output.
 1.4 27-Oct-2006  garbled branches: 1.4.52; 1.4.54; 1.4.56;
A few changes so pnpbus devices can do isadma. Note that isadma still
does not seem to work properly on prep.
 1.3 23-Jun-2006  garbled branches: 1.3.4; 1.3.6; 1.3.8;
1) Modify pnpbus attachment code to properly decode pnp memory range packets.
2) Modify pnpbus attachment code to record the chipid of the device if it
has one.
3) Change the clock probes to use the chipid, rather than relying on
potentially untrustworthy subtype and interface.
4) Add decoding of memory ranges to the RESIDUAL_DUMP code.
5) Add a we@pnpbus device to allow netbooting and root device detection
from an IBM we ethernet. (it will only work if your firmware detects it)
6) Because I moved the pnpbus probe to occur prior to pci and isa, it
screwed up the root device detection and firmware path building code.
Completely rewrite the fw-path detection code to deal with this.
 1.2 15-Jun-2006  garbled branches: 1.2.2;
A bit of clock rototill. It's safer to detect things known by the
residual with the pnpbus probes, than it is to do it with raw isa probes,
so I've replaced the isa mkclock and mcclock code with a pnpbus attachment.

While writing the mkclock code, I realized that on motorola prep machines
the mkclock uses the same port range as the nvram part. (it's actually
the same chip/part). This was causing the nvram not to work on those
machines. Now the nvram code will recognize this, and wire up the
mkclock as well. The mkclock probe is just a stub probe used to
pre-detect the fact that this is one of those machines.
 1.1 09-Mar-2006  garbled branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10; 1.1.12;
Prep super-commit:

1) create new pnpbus psuedo bus. This is a bus layer that reads the PNP
tree from the residual data and allows attachment of devices with the
information given therein. Based loosely on i386/pnpbios.

2) Delete obio bus, as with the pnp bus we no longer need it.

3) Create a number of functions that gather the information needed to set
up the machine from the residual data, rather than hardcoding it in.

4) Create a quirk table for machines that are bizzare enough that the
residual information is not sufficient. (such as the 6015)

5) Using the data gathering routines and the quirk table, delete struct
platform completely from the architecture. Prep is now almost completely
dynamic in figuring out the machine it is running on and setting things
up properly.

6) Add a wdc_pnpbus driver which attaches the wdc controller found on
some 7248's and the 6015. This replaces the now-defunct wdc_obio.

7) delete all the mot_* and ibm_* files, and replace them with a single
ibm_machdep.c which only contains the quirk functions for the 6015 and
the 6050.

8) Modify GENERIC to work with all this stuff.
 1.1.12.1 13-Jul-2006  gdamore Merge from HEAD.
 1.1.10.1 19-Jun-2006  chap Sync with head.
 1.1.8.2 22-Apr-2006  simonb Sync with head.
 1.1.8.1 09-Mar-2006  simonb file pnpbusvar.h was added on branch simonb-timecounters on 2006-04-22 11:37:54 +0000
 1.1.6.2 19-Apr-2006  elad sync with head - hopefully this will work
 1.1.6.1 09-Mar-2006  elad file pnpbusvar.h was added on branch elad-kernelauth on 2006-04-19 02:33:38 +0000
 1.1.2.3 26-Jun-2006  yamt sync with head.
 1.1.2.2 13-Mar-2006  yamt sync with head.
 1.1.2.1 09-Mar-2006  yamt file pnpbusvar.h was added on branch yamt-pdpolicy on 2006-03-13 09:06:59 +0000
 1.2.2.3 30-Dec-2006  yamt sync with head.
 1.2.2.2 21-Jun-2006  yamt sync with head.
 1.2.2.1 15-Jun-2006  yamt file pnpbusvar.h was added on branch yamt-lazymbuf on 2006-06-21 14:55:19 +0000
 1.3.8.1 10-Dec-2006  yamt sync with head.
 1.3.6.2 09-Sep-2006  rpaulo sync with head
 1.3.6.1 23-Jun-2006  rpaulo file pnpbusvar.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:42:43 +0000
 1.3.4.1 18-Nov-2006  ad Sync with head.
 1.4.56.1 16-May-2008  yamt sync with head.
 1.4.54.1 18-May-2008  yamt sync with head.
 1.4.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.32.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.16 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.15 20-Oct-2017  jdolecek move ata_queue_alloc(1) and ata_queue_free() calls to ata_channel_init()
and ata_channel_destroy() respectively, to make attachment code simpler,
and to make it easier to spot special queue manipulation like cmdide(4)

on topic of PR kern/52606
 1.14 07-Oct-2017  jdolecek Merge support for SATA NCQ (Native Command Queueing) from jdolecek-ncq branch

ATA subsystem was changed to support several outstanding commands, and use
NCQ xfers if supported by both the controller and the disk, including NCQ
error recovery. Set NCQ high priority for BPRIO_TIMECRITICAL xfers
if supported. Added FUA support.

Done some work towards MP-safe, all ATA code tsleep()/wakeup() replaced
by condvars, and switched most code from spl* to mutexes (separate
wd(4) and ata channel lock).

Introduced new option WD_CHAOS_MONKEY to facilitate testing of error
handling, fixed several uncovered issues. Also fixed several problems
with kernel dump to wd(4) disk.

Tested with ahcisata(4), mvsata(4), siisata(4), piixide(4) on amd64,
with and without port multiplier, both disk and ATAPI devices; other
drivers and archs mechanically adjusted and compile-tested. NCQ is
supported for ahcisata(4) and siisata(4) for any controller, for
mvsata(4) only Gen IIe ones for now. Also enabled ATAPI support in
mvsata(4).

Thanks to Matt Thomas for initial ATA infrastructure patch, and
Jonathan A.Kollasch for siisata(4) NCQ changes and general testing.

Also fixes PR kern/43169 (wd(4)); and PR kern/11811, PR kern/47041,
PR kern/51979 (kernel dump)
 1.13 31-Jul-2012  bouyer branches: 1.13.2; 1.13.28;
Apply back changes that were reverted on Jul 24 and Jul 26 (general ata/wdc
cleanup and SATA PMP support), now that I'm back to fix the fallouts.
 1.12 26-Jul-2012  jakllsch Revert, with intention of restoring in a less invasive way, the SATA Port
Multiplier code.

ok christos@
 1.11 02-Jul-2012  bouyer Add sata Port MultiPlier (PMP) support to the ata bus layer,
as described in
http://mail-index.netbsd.org/tech-kern/2012/06/23/msg013442.html
PMP support in integrated to the atabus layer.
struct ata_channel's ch_drive[] is not dynamically allocated, and ch_ndrive
(renamed to ch_ndrives) closely reflects the size of the ch_drive[] array.
Add helper functions atabus_alloc_drives() and atabus_free_drives()
to manage ch_drive[]/ch_ndrives.
Add wdc_maxdrives to struct wdc_softc so that bus front-end can specify
how much drive they really support (master/slave or single).
ata_reset_drive() callback gains a uint32_t *sigp argument which,
when not NULL, will contain the signature of the device being reset.
While there, some cosmetic changes:
- added a drive_type enum to ata_drive_datas, and stop encoding the
probed drive type in drive_flags (we were out of drive flags anyway).
- rename DRIVE_ATAPIST to DRIVE_ATAPIDSCW to better reflect what this
really is
- remove ata_channel->ata_drives, it's redundant with the pointer in
ata_drive_datas
- factor out the interpretation of SATA signatures in sata_interpet_sig()

propagate these changes to the ATA HBA drivers, and add support for PMP
to ahcisata(4) and siisata(4).

Thanks to:
- Protocase (http://www.protocase.com/) which provided a system
with lots of controllers, SATA PMP and drive slots
- Conservation Genomics Laboratory, Department of Biology, New Mexico State
University for hosting the above system
- Brook Milligan, who set up remote access and has been very responsive
when SATA cable move was needed
 1.10 01-Jul-2011  dyoung branches: 1.10.2;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 28-Apr-2008  garbled Add floppy support to prep (the croud goes wild)

Add an additional argument to pnpbus_intr_establish to allow overriding of
the pnp interrupt type, because some devices lie.
Change how the pnpbus match routine works, to avoid attaching it when we
are probing for cpu's.
Fix a few stray printf's in the autoconf output.
 1.7 18-Mar-2008  cube branches: 1.7.2; 1.7.4;
Split device_t and softc for ATA devices, as well as wd(4). Other
cosmetic changes where appropriate.
 1.6 20-Mar-2007  garbled branches: 1.6.14; 1.6.30; 1.6.34;
Special case the MTX604 and other RAVEN based machines to not attach
wdc@pnpbus.
 1.5 15-Jun-2006  garbled branches: 1.5.2; 1.5.8; 1.5.12; 1.5.14; 1.5.18; 1.5.20; 1.5.22;
A bit of clock rototill. It's safer to detect things known by the
residual with the pnpbus probes, than it is to do it with raw isa probes,
so I've replaced the isa mkclock and mcclock code with a pnpbus attachment.

While writing the mkclock code, I realized that on motorola prep machines
the mkclock uses the same port range as the nvram part. (it's actually
the same chip/part). This was causing the nvram not to work on those
machines. Now the nvram code will recognize this, and wire up the
mkclock as well. The mkclock probe is just a stub probe used to
pre-detect the fact that this is one of those machines.
 1.4 26-Apr-2006  garbled branches: 1.4.2; 1.4.4;
Support fixes for the Motorola Powerstack E1.
1) The E1 seems to have the int. siop wired to irq 14-level and the internal
wdc wired to irq 14-edge. special case and fail the wdc probe on E1's.
2) If we fail to map the NVRAM registers, return, rather than trying to talk
to them and panic'ing the box.
3) revert my previous "fix" to pnpbus to make irq's default to level. It
was wrong, and didn't even fix the powerstack.

With this, we have limited PowerStack E1 support. The machine cannot
talk to it's IDE controller, and cannot detect it's boot device
automatically, but it does come up and run. Tested with NFS root.
 1.3 29-Mar-2006  thorpej branches: 1.3.2; 1.3.4;
Use device_cfdata().
 1.2 16-Mar-2006  garbled branches: 1.2.2;
More changes to prep port:
1) Add the NVRAM device. This device allows us to speak with the nvram on
prep-based machines and read/write to it. Also add a simple IOCTL
interface for speaking with the nvram from userland. This hasn't been
tested yet, but eventually I plan to support it with the sparc eeprom
command.
2) Change the root device detection to use the nvram device to attempt to
guess the boot device. Most machines should now correctly guess thier
boot device, though I expect a few devices to still not work quite right yet.
3) change the default IRQ to level rather than edge in the pnpbus if the
flags are invalid or empty. (based on output from a PowerStack E1)
4) correctly handle older machines in pnpbus that have FixedIOPorts
rather than variable ones.

Still have much to do.
 1.1 09-Mar-2006  garbled branches: 1.1.2;
Prep super-commit:

1) create new pnpbus psuedo bus. This is a bus layer that reads the PNP
tree from the residual data and allows attachment of devices with the
information given therein. Based loosely on i386/pnpbios.

2) Delete obio bus, as with the pnp bus we no longer need it.

3) Create a number of functions that gather the information needed to set
up the machine from the residual data, rather than hardcoding it in.

4) Create a quirk table for machines that are bizzare enough that the
residual information is not sufficient. (such as the 6015)

5) Using the data gathering routines and the quirk table, delete struct
platform completely from the architecture. Prep is now almost completely
dynamic in figuring out the machine it is running on and setting things
up properly.

6) Add a wdc_pnpbus driver which attaches the wdc controller found on
some 7248's and the 6015. This replaces the now-defunct wdc_obio.

7) delete all the mot_* and ibm_* files, and replace them with a single
ibm_machdep.c which only contains the quirk functions for the 6015 and
the 6050.

8) Modify GENERIC to work with all this stuff.
 1.1.2.5 26-Jun-2006  yamt sync with head.
 1.1.2.4 24-May-2006  yamt sync with head.
 1.1.2.3 01-Apr-2006  yamt sync with head.
 1.1.2.2 13-Mar-2006  yamt sync with head.
 1.1.2.1 09-Mar-2006  yamt file wdc_pnpbus.c was added on branch yamt-pdpolicy on 2006-03-13 09:06:59 +0000
 1.2.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.2.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.3.4.3 01-Jun-2006  kardel Sync with head.
 1.3.4.2 22-Apr-2006  simonb Sync with head.
 1.3.4.1 29-Mar-2006  simonb file wdc_pnpbus.c was added on branch simonb-timecounters on 2006-04-22 11:37:54 +0000
 1.3.2.3 11-May-2006  elad sync with head
 1.3.2.2 19-Apr-2006  elad sync with head - hopefully this will work
 1.3.2.1 29-Mar-2006  elad file wdc_pnpbus.c was added on branch elad-kernelauth on 2006-04-19 02:33:38 +0000
 1.4.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.4.2.1 19-Jun-2006  chap Sync with head.
 1.5.22.1 29-Mar-2007  reinoud Pullup to -current
 1.5.20.1 11-Jul-2007  mjf Sync with head.
 1.5.18.1 10-Apr-2007  ad Sync with head.
 1.5.14.1 24-Mar-2007  yamt sync with head.
 1.5.12.1 31-Mar-2007  bouyer Pull up following revision(s) (requested by garbled in ticket #528):
sys/arch/prep/pci/pci_machdep.c: revision 1.29
sys/arch/prep/pnpbus/wdc_pnpbus.c: revision 1.6
Special case the MTX604 and other RAVEN based machines to not attach
wdc@pnpbus.
The motorola RAVEN is both a pchb and an MPIC. Block out the pci
configuration of it's mem area to keep the PIC available.
 1.5.8.2 09-Sep-2006  rpaulo sync with head
 1.5.8.1 15-Jun-2006  rpaulo file wdc_pnpbus.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:42:43 +0000
 1.5.2.4 24-Mar-2008  yamt sync with head.
 1.5.2.3 03-Sep-2007  yamt sync with head.
 1.5.2.2 21-Jun-2006  yamt sync with head.
 1.5.2.1 15-Jun-2006  yamt file wdc_pnpbus.c was added on branch yamt-lazymbuf on 2006-06-21 14:55:19 +0000
 1.6.34.2 02-Jun-2008  mjf Sync with HEAD.
 1.6.34.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.30.1 24-Mar-2008  keiichi sync with head.
 1.6.14.1 23-Mar-2008  matt sync with HEAD
 1.7.4.1 16-May-2008  yamt sync with head.
 1.7.2.1 18-May-2008  yamt sync with head.
 1.10.2.1 30-Oct-2012  yamt sync with head
 1.13.28.2 27-Sep-2017  jdolecek change wdc_init_shadow_regs() to accept only struct wdc_regs, it doesn't
touch anything else

factor out the probe-only struct ata_channel initialization to wdcprobe(), to
reduce duplication of logic in individual drivers, and to actually work now
that more init is needed beyond the memset()
 1.13.28.1 26-Sep-2017  jdolecek switch to ata_queue_alloc() so that this at least compiles
 1.13.2.1 03-Dec-2017  jdolecek update from HEAD

RSS XML Feed