Commit Graph

59 Commits

Author SHA1 Message Date
dholland 040c7cc074 Restore interrupts on error paths. From maxv's brainy list. 2015-08-30 04:16:18 +00:00
riastradh 445478ce67 MD rnd.h cleanups. Please let me know if I broke anything! 2015-04-13 21:18:40 +00:00
tls ea6af427bd Merge tls-earlyentropy branch into HEAD. 2014-08-10 16:44:32 +00:00
dholland f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland a68f9396b6 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.
2014-03-16 05:20:22 +00:00
skrll 42399a445e Remove unused variables. 2014-03-08 15:46:20 +00:00
chs cbab9cadce split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
2012-10-27 17:17:22 +00:00
skrll 9e585c4c14 u_int*_t -> uint*_t
Same code before and after.
2012-05-11 15:39:17 +00:00
tls 7b0b7dedd9 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.
2012-02-02 19:42:57 +00:00
tls 3afd44cf08 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.
2011-11-19 22:51:18 +00:00
dyoung 977de72089 Change <machine/bus.h> to <sys/bus.h> throughout.
Split bus.h -> bus_{defs,funcs}.h.

Mark acorn26/bus.h obsolete.
2011-07-19 16:05:09 +00:00
matt 96e8eba4fc Missed needed use of device_private 2011-06-03 07:21:32 +00:00
matt 3ea787b27c CFATTACH_DECL -> CFATTACH_DECL_NEW for 'struct device' devices.
change to device_t, cfdata_t.  Use device_private()
2011-06-03 07:08:48 +00:00
rmind 9303fb5a00 Remove IPL_LPT and IPL_IPI aliases, use the actual IPLs.
Fix some broken comments.
2009-11-25 14:28:49 +00:00
bjh21 c4605d6440 Make arckbd(4) compile even if the kernel is lacking wsmouse(4), wskbd(4),
rnd(4), or any combination of thoses.  Thanks to Havard Eidnes for reporting
the build breakage.
2009-02-16 21:36:09 +00:00
bjh21 a0263b80b8 I've just discovered config_found_ia(), which means that wskbd(4) and
wsmouse(4) can attach directly at arckbd(4) and I can dispose of the
ugly arcwsmouse(4) and arcwskbd(4) interpositions.  Do that, and purge
them from the documentation as well.
2009-02-14 10:20:55 +00:00
bjh21 0d3e94c475 Autoconfiguration cleanup for eca(4):
- Use device_t and cfdata_t.
- Split device_t out of eca_softc.
- Use aprint_*() rather than printf().
- Use device_xname().
2009-01-19 23:43:14 +00:00
bjh21 d7c9b7fb33 Split device_t out of softc, with one small fix where something wanted the
device_t but was getting the softc.
2009-01-19 00:11:16 +00:00
bjh21 96154ba75d Fix a bit of layout. 2009-01-18 23:25:12 +00:00
bjh21 c6e4ae9df0 Be consistent about what the void* cookies we pass to and from wscons contain,
in preparation for splitting softc and device_t.
2009-01-18 23:23:40 +00:00
bjh21 dcc1944658 Use device_xname() rather than dv_xname. 2009-01-18 22:57:55 +00:00
bjh21 792645e16e Now that I've fixed the bootstrap IIC stuff, split device_t out of softc. 2009-01-18 18:41:34 +00:00
bjh21 a3551a3ce2 Autoconfiguration cleanup for arcpp(4):
- Split device_t out of softc.
- Use device_t and cfdata_t rather than explicit structure pointers.
- Use device_*() rather than accessing parts of device_t directly.
- Use aprint_*() rather than printf().
Also ANSIfy arcpppushbytes.
2009-01-07 23:05:46 +00:00
bjh21 5ddd0631a0 Rework the bootstrap IIC stuff used by cmos_read() so that it works
properly, albeit only after iociic0 has been attached.  Happily,
cmos_read() isn't needed before that anyway.
2009-01-07 22:58:38 +00:00
bjh21 12052c1959 Make Econet code compile again. 2009-01-07 20:56:40 +00:00
bjh21 d5602e8683 Autoconfiguration cleanup for latches(4):
- Split struct device out of the softc.
- Use device_t and cfdata_t rather than explicit structure pointers.
- Use aprint_*() rather than printf().
- Use device_private() to convert device_t into softc.
2009-01-07 00:09:24 +00:00
bjh21 4c6ac02e21 Autoconfiguration cleanup for iociic(4):
- Use device_t and cfdata_t rather than explicit structure pointers.
- Use aprint_*() rather than printf().
- Pass "self" to config_found_ia rather than &sc->sc_dev.
Also an amount of KNF.
I haven't actually split the device structure off from the softc because
iociic_bootstrap_cookie() expects to allocate fake versions of both at once,
and I've not yet decided what it's best to do about that.
2009-01-07 00:06:59 +00:00
bjh21 06d5a26fdb Autoconfiguration cleanup for arckbd(4):
- Use device_t and cfdata_t rather than explicit structure pointers.
- Split device and (non-existent) softc for arcwskbd and arcwsmouse.
- Use aprint_*() rather than printf().
- Use device_*() to access fields of device_t.
- Use device_private() rather than a cast to convert from device_t to softc.
device/softc split not done for arckbd(4) itself because there are lots
of void* cookies that get treated as arckbd_softc at one end and device_t
at the other, and they'll need a little thought to clean up.
2009-01-06 23:58:00 +00:00
christos 9a5d3f2817 replace bitmask_snprintf(9) with snprintb(3) 2008-12-16 22:35:21 +00:00
cegger 681dac3dfc use device_lookup_private to get softc 2008-06-11 22:07:49 +00:00
ad 065b6ba2fb lockmgr -> mutex 2007-12-06 17:00:31 +00:00
garbled d974db0ada 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.
2007-10-17 19:52:51 +00:00
dyoung 6f7649313f Constify. 2007-08-26 22:28:52 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
pavel 934634a18c Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.
2007-02-17 22:31:36 +00:00
plunky 57c0199dcf Tidy away wsmouse_input() abstractions and update
documentation to include the W direction.
2006-11-12 19:00:42 +00:00
bjh21 213f273e6a Calls to bus_space_barrier() on acorn26 were very few and using constants that
were two generations obsolete.  Since they do nothing anyway, remove them
rather than trying to update them.
2006-09-30 15:14:21 +00:00
bjh21 51b05a4131 Use MI inittodr() and friends. 2006-09-03 11:51:29 +00:00
drochner a3464e1d27 use the "i2cbus" interface attribute rather than putting a string name
into the i2cbus attach args
2006-06-26 18:21:38 +00:00
thorpej 458b3e43f7 Use device_parent(). 2006-02-23 05:37:46 +00:00
bjh21 24b46da494 Make Econet code compile again. 2006-02-12 10:32:46 +00:00
bjh21 22ce92c5a5 Make this compile again (change of signature for arcppopen() and arcppclose()). 2006-02-12 10:30:30 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
he aafdb08c5a Fix the various todr_gettime() and todr_settime() fallouts from
-Wcast-qual differently, by instead changing the signatore of those
"functions" to take a "volatile struct timeval*" instead of a
"struct timeval*".  Many places, these functions are called with
&time, and time is declared as volatile in <sys/kernel.h>.  This
way we can get rid of all the ugly casts which now also triggered
warnings, and caused more code to be added to work around the
problem.

Reviewed by thorpej.
2005-06-04 20:14:24 +00:00
thorpej 2af80d899e New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc.  Primarily written by Steve Woodford,
with some modification by me.

(NOTE: "cvs add" was missed on this file during the initial checkin
of the new I2C code.)
2003-10-06 16:08:42 +00:00
thorpej 2652188cc4 New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc.  Primarily written by Steve Woodford,
with some modification by me.
2003-09-30 00:35:30 +00:00
lukem 1b7326b581 use __KERNEL_RCSID() in a consistent manner 2003-07-14 22:48:19 +00:00
lukem de043b8788 use __KERNEL_RCSID(0, instead of RCSID( in the kernel 2003-07-14 15:17:13 +00:00
thorpej a7f53c4d06 Use aprint_normal() for cfprint routines. 2003-01-01 00:34:05 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00