Home | History | Annotate | Download | only in pnpbus
History log of /src/sys/arch/prep/pnpbus/nvram_pnpbus.c
RevisionDateAuthorComments
 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)

RSS XML Feed