Commit Graph

2332 Commits

Author SHA1 Message Date
jmcneill 8a962f23f2 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.
2011-11-23 23:07:28 +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
jakllsch 1d4d51395d Appease _LP64 build with GCC 4.5. 2011-08-07 19:46:22 +00:00
jakllsch ffb4d47223 The Fintek base address registers implement the bottom 3 bits as read/write,
but the address decoder in the chip ignores these three bits.  Do the same.
2011-07-31 18:23:46 +00:00
jmcneill 9f438526b6 modularize and recognize ASUS F8000 Super I/O chips 2011-07-31 17:53:26 +00:00
jmcneill 0d3a27d5dc modularize 2011-07-31 16:18:54 +00:00
jmcneill 60427626c4 add module support 2011-07-29 20:58:47 +00:00
jmcneill 17536f8e9e add module support 2011-07-15 20:56:26 +00:00
mrg 1ff8330243 fix sequence point errors. diff explains best:
-       sc->sc_playbuf = ++sc->sc_playbuf % sc->sc_nbufs;
+       sc->sc_playbuf = (sc->sc_playbuf + 1) % sc->sc_nbufs;
2011-07-02 13:14:46 +00:00
wiz 4cbd24b23f dependant -> dependent 2011-06-30 20:09:15 +00:00
pgoyette ac39d68c59 Initialize sensors states before registering. 2011-06-20 18:12:54 +00:00
tsutsui c22ffc3803 Split device_t/softc of i82586. No crash on TME emulating sun2. 2011-06-03 16:28:40 +00:00
tsutsui ff2f721f5c Split device_t/softc of all ad1848 variants properly. Compile test only.
Please check all attribute users in all files.* on device_t/softc split.

XXX: not sure if gus(4) needs device_t in ad1848_isa_softc
2011-06-02 14:12:24 +00:00
nonaka 26a17089a0 fix compile failure. 2011-06-02 12:51:52 +00:00
jakllsch c0d7afac87 Convert ltsleep() in atppc(4) to modern interfaces.
Reviewed by rmind@.
2011-05-26 02:29:23 +00:00
mrg 046a9cdb65 avoid mutex locking botch and introduce an unlocked version of
pcppi_bell_stop().  fixes a problem reported in private email.
2011-05-24 09:28:03 +00:00
dyoung b11777e520 #include <sys/bus.h>, not <machine/bus.h>. 2011-05-18 01:02:43 +00:00
mrg dad44dc109 convert a lockless + spltty() combo to a IPL_VM mutex and cv.
hopefully this will avoid the beep-didn't-stop problem i had recently
that i was able to fix by calling wakeup() on pcppi's softc from ddb.
2011-05-03 04:27:13 +00:00
plunky b0b433c20f use static inline for ec_readmem(), it is not referenced elsewhere
(avoids C99 vs GNU semantics for external inline functions)
2011-04-24 18:54:41 +00:00
kiyohara 5f8633bdc8 Fix hci_private data. slhci(4) is assuming, it is slhci_softc. not device_t. 2011-03-08 04:58:21 +00:00
jruoho ea9b26744b As suggested by Sverre Froyen in a follow-up to PR # 41698, change the
sensor names to real words (e.g. "temperature 1" instead of "TEMP_1").
No functional change; only consistent envstat(8) output with other sensors.
2011-02-16 10:08:05 +00:00
jmcneill 1785be53ab treat temperature readings of 0xff as invalid, as I'm somewhat confident
that my Thinkpad isn't idling at 255 degC.
2011-01-18 16:45:11 +00:00
jmcneill 7f772947f7 save a line of dmesg 2011-01-16 14:16:03 +00:00
jmcneill a5a55fa2c0 - catch up with OpenBSD driver, adding support for newer Thinkpad models
- add module hooks
2011-01-16 01:05:45 +00:00
uebayasi 8184d5dc03 Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants.  These are provided by sys/param.h now.
2010-11-13 13:51:57 +00:00
uebayasi e9fb4f077e Include uvm/uvm_external.h to access UVM external API (uvm_km_*(9)). 2010-11-06 10:59:45 +00:00
jmcneill cecc6dab21 If the 'no-legacy-devices' property is present and true, skip device
enumeration.
2010-08-21 17:08:15 +00:00
jakllsch ad67ca3e3a Implement user-settable rfact in itesio.
Additionally, match on IT8721.
2010-08-13 19:28:26 +00:00
pgoyette aa30923a4e Keep condvar wmesg within 8-char limit 2010-08-11 11:32:58 +00:00
chs ef8ada5da8 move a debug printf to FD_DEBUG. 2010-08-08 18:24:34 +00:00
jakllsch 30faf1fe35 Cast bus_addr_t to void * via uintptr_t to avoid
'cast to pointer from integer of different size' warnings.
Unbreaks i386 ALL kernel.

Oh, I'm sure I mentioned this before:
THIS DRIVER SHOULD NOT BE DOING THIS!
2010-08-03 14:06:10 +00:00
jakllsch 5da0f05200 printf() size_t with 'z' format modifier in debug code. 2010-07-27 14:34:33 +00:00
jakllsch b4db231882 Allow aria(4) to compile with AUDIO_DEBUG on LP64. 2010-07-27 05:38:18 +00:00
jym da702eb93d Add PAE to ALL kernel, so that most paddr_t format string errors get caught
during compilation.

While here, fix the compilation for ALL.
2010-07-26 22:33:23 +00:00
pgoyette f9b5eaf40f Put the original NULL pmf handler establishment back where it started, so
as not to call it in some error paths.

Instead, if there is a watchdog present, deregister the NULL handler before
establishing the one for the watchdog.
2010-07-17 21:51:43 +00:00
pgoyette 50d895a7df If this itesio(4) has a watchdog, then set up a real suspend handler to
make sure we don't suspend when the wdog time is active.
2010-07-17 21:36:26 +00:00
tsutsui d6e42f548a Tidy up a comment. 2010-06-13 03:09:32 +00:00
jym 603ac9bd31 Cast the sum of iobase and iosize to long, not just iobase. Avoids size
warnings during build when bus_addr_t is 64 bits.
2010-05-23 23:50:37 +00:00
tsutsui 9cb526aa88 Split device_t/softc. Based on patch from cegger@.
ess_pnpbios.c and ess_ofisa.c fixes by me.

Tested on ess_isapnp.c, and no crash with ess_ofisa.c on shark.
2010-05-22 16:35:00 +00:00
jakllsch 59a03cddc2 This only needs one bus_space_tag_t.
While here, rename one of the bus_space_handle_ts
to be be descriptive of its function.

Fixes crash caused by uninitialized bus_space_tag_t
discovered by Paul Goyette.
2010-05-02 18:49:13 +00:00
dyoung ad6e139a80 Add default implementations for bus_space_is_equal(9),
bus_space_tag_create(9), and bus_space_tag_destroy(9).  Use
bus_space_is_equal(9) throughout the kernel to compare
bus_space_tag_t's.  Tested on i386 and on sparc64.
2010-04-19 18:24:26 +00:00
joerg 58e867556f 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.
2010-04-05 07:19:28 +00:00
dyoung f52f7d91ef Do not use unitialized bus_space_tag_t's. Use the tag(s) from the
attachment arguments.
2010-03-24 01:13:30 +00:00
dyoung 8b0029011b isadma.c: #if 0 some diagnostic code that compares two bus_space_tag_t's.
pcdisplay.c: #if 0 some code that compares two bus_space_tag_t's
    in order to see if pcdisplay0 is console.  It does not seem to
    be helpful to compare the tags; maybe the author intended to
    compare some other bus property?

MI code should not compare an opaque type such as bus_space_tag_t!
2010-03-22 22:30:58 +00:00
dyoung f5423e5e40 Do not disestablish the interrupt handler inside of the interrupt
handler!  Stops a crash on the HP Pavilion N3270.

Cosmetic: sc->ih is a pointer, so set to NULL instead of 0.  Compare
with NULL instead of testing truth.
2010-03-22 22:25:26 +00:00
cnst 291f4cc576 support W83667HG (0xa5) in wbsio(4); its hw mon is already supported by lm(4) as W83627DHG (0xc1) 2010-03-19 02:17:41 +00:00
he 921b8ba089 Allow this driver to build for ofppc as well. 2010-03-16 12:53:17 +00:00
tsutsui 2253fb2fe8 Some KNF. 2010-03-13 15:46:09 +00:00
tsutsui 329daadadb - include "ioconf.h" for struct cfdriver we_cd
- remove unused macro
2010-03-13 15:42:09 +00:00
tsutsui 8f7c20ed4f Put several fixes to ne(4) driver for better 8 bit mode support,
especially on RTL8019AS which is also used for non-ISA local bus of
embedded controllers and some m68k machines like atari and x68k.

 * move RTL8019 probe and attach code from each bus attachment
   to MI ne2000_detect() and ne2000_attach()
 * change a method for backend and attachment to specify 8 bit mode
   to use a new sc->sc_quirk member, instead of sc->sc_dmawidth
 * handle more NE2000 8 bit mode specific settings, including
   bus_space(9) access width and available size of buffer memory
 * add a function to detect NE2000 8 bit mode
   (disabled by default, but enalbed by options NE2000_DETECT_8BIT
    to avoid possible regression on various ISA clones)
 * fix ipkdb attachment accordingly (untested)

Tested on two NE2000 ISA variants (RTL8019AS and another clone named UL0001)
in both 8 bit and 16 bit mode on i386. "Looks good" from nonaka@.

See my post on tech-kern for details:
http://mail-index.NetBSD.org/tech-kern/2010/02/26/msg007423.html
2010-03-03 13:39:57 +00:00
dyoung c1b390d493 A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
2010-02-24 22:37:54 +00:00
cnst 51998ed2d7 New wbsio(4) driver for Winbond Super I/O attachment of lm(4) on any port.
http://mail-index.netbsd.org/tech-kern/2010/02/17/msg007338.html

Reviewed by <pgoyette>, <tech-kern>.
2010-02-21 05:16:29 +00:00
cegger 3b84dd90dd essattach: printf -> aprint_* 2010-01-23 17:22:04 +00:00
pooka 10fe49d72c 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.
2010-01-19 22:06:18 +00:00
pooka 58247e10a2 hp@isa was marked non-compiling and broken 14 years ago. I'm sure
the tens of well-tested changes since then have been necessary,
but now i'll just spoil the fun for everyone by sending the driver
to the attic.
2010-01-19 12:41:41 +00:00
dyoung cd6e1fbf91 Expand PMF_FN_* macros. 2010-01-08 19:53:10 +00:00
christos 0fbbcee76f make rhis compile. 2010-01-02 02:37:08 +00:00
christos 641f5484f1 convert to pmf 2010-01-02 01:42:49 +00:00
dsl 3cac425251 Add patch from PR/11805 2009-11-27 20:56:28 +00:00
rmind dbd9b86792 Remove some unecessary includes sys/user.h header. 2009-11-23 02:13:44 +00:00
dyoung bb858bb7d5 Call the common detach routine, com_detach(), and get out on error,
before starting the bus-specific detachment.

com_activate() is going away, so don't use it any more.
2009-11-12 20:28:32 +00:00
elric 022690d221 Assign copyright to TNF on these old files. 2009-10-27 23:04:41 +00:00
snj 7e82f68c7b Switch to a 2 clause license. Approved by joff@ (copyright holder). 2009-10-23 00:39:29 +00:00
cegger 24b93ceb8b use aprint_* in attach routines 2009-09-29 11:01:39 +00:00
tsutsui df90eec26b Make local functions static. 2009-09-22 16:44:08 +00:00
tsutsui 30d1cde9f5 Split device_t/softc. Tested only on cs at ofisa on shark. 2009-09-22 15:34:22 +00:00
tsutsui 3b0a685f2b Split device_t/softc. Tested only on cs at ofisa on shark. 2009-09-22 14:55:19 +00:00
tsutsui 5977843ffd Fix wrong softc size in CFATTACH_DECL(). (not cs_softc but cs_softc_isa) 2009-09-22 14:04:56 +00:00
tsutsui 3c2460ce71 Make local functions static. 2009-09-22 13:22:53 +00:00
tsutsui d7f21e6129 Don't declare ISA specific aic_isa_attach() in MI header, and
also make local functions in aic_isa.c static.
2009-09-22 13:18:28 +00:00
tsutsui 00eb8aa546 Split device_t/softc. Tested on AHA-1520B at ISA and ISAPnP.
XXX: ISA attachment shouldn't match cards in ISAPnP mode.
2009-09-22 12:56:06 +00:00
tsutsui c8a52f80ba Split device_t/softc. Tested on AHA-1542CF. 2009-09-21 08:12:47 +00:00
tsutsui 5dcfc285a0 Misc KNF and cosmetics, and remove unnecessary casts etc. 2009-09-17 18:14:41 +00:00
tsutsui 16c0f8385d Use device_private(), proper types or variables for device_t and softc.
(not yet split though)

No crash on gxemul emulating hpcmips mobilepro.
2009-09-14 13:41:15 +00:00
tsutsui 5770fb4ee0 u_intNN_t -> uintNN_t 2009-09-14 12:49:33 +00:00
tsutsui f3f3dfb33a Make compile with options DEBUG. 2009-09-12 18:52:25 +00:00
jmcneill f6062bf27a aprint-ify 2009-09-01 21:46:52 +00:00
jmcneill 41dd5e0736 Not much sense in printing 'AT Timer' when the 'attimer' driver attaches. 2009-08-23 16:02:53 +00:00
cegger 06ffd276b6 build fix: isa_detach_hook() needs isa_chipset_tag_t as first argument. 2009-08-19 16:23:28 +00:00
dyoung 40bc016e8a Let us safely detach the ISA bus and devices attaching to the ISA
bus:

1 Add isadetach() for detaching the ISA bus, and add some helper
  routines that release resources held for ISA DMA.

2 In isachilddetached(), forget references to child devices.

While I am here, change ISA_DMA_DRQ_ISFREE(...) == 0 to the simpler
expression, !ISA_DMA_DRQ_ISFREE(...).
2009-08-18 16:52:42 +00:00
haad f5b48500f1 Add support for DIOCGDISKINFO to disk like device drivers. Change
partutil.c::getdiskinfo to use it to get disk geometry info.
Use DIOCGWEDGEINFO ioctl to get information about partition size, if disk
driver doesn't support it use old DIOCGDINFO. This patch adds support for
wedge like devices(lvm logical volumes, ZFS zvol partitions) to newfs and
other tools.

No objections on tech-userlevel@.
2009-06-05 21:52:31 +00:00
cegger ab57cc6f1b struct device * -> device_t, no functional changes intended. 2009-05-12 09:10:15 +00:00
cegger 8a46564d1d struct cfdata * -> cfdata_t, no functional changes intended. 2009-05-12 08:44:19 +00:00
cegger f2bccc0a8e struct device * -> device_t, use device_private() 2009-05-05 12:07:15 +00:00
dyoung 64670508f7 Detach pcppi0 at isa0 during shutdown. 2009-04-17 20:46:37 +00:00
mlelstv 485e52e2b3 attach and detach do not mix.
Create a new detach function that calls the parent function after
dealing with the private instance counter.
2009-04-10 10:18:50 +00:00
dyoung 99084a32b0 Decrease midi_pcppi_attached when midi at pcppi detaches. 2009-04-08 00:12:27 +00:00
dyoung 1de2a73134 Make pcppi(4) detach the "speaker" from attimer(4), so that the
corresponding attimer(4) resource is not perpetually busy: now it
is possible to detach and to reattach pcppi(4).  Make attimer(4)'s
device-detachment hook return EBUSY if pcppi(4) is still attached, so
that pcppi(4) cannot end up with a dangling pointer to attimer(4).
2009-04-07 22:30:09 +00:00
dyoung 00644496f7 Fix spelling: indrect -> indirect. 2009-04-07 21:48:46 +00:00
dyoung 18789e2def Detach midi at pcppi during shutdown. Sprinkle static. 2009-04-07 18:31:12 +00:00
dyoung 0d1ba3e899 During shutdown, detach devices in an orderly fashion.
Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks.  For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown.  Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags.  Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag.  The default for kern.detachall is 0.  SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress.  In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs.  Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.
2009-04-02 00:09:32 +00:00
cegger df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +00:00
dsl 98ae204731 Add some 'int' into function definitions where the K&R one didn't
specify a type.
2009-03-17 18:19:15 +00:00
dsl 7cc9af7d64 ANSIfy functions with function-pointer arguments 2009-03-16 23:11:09 +00:00
cegger 05d33dc7bf ansify function definitions 2009-03-16 09:32:38 +00:00
dsl 82357f6d42 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.
2009-03-14 21:04:01 +00:00
dsl 454af1c0e8 Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
2009-03-14 15:35:58 +00:00
ad 0fa70e9b6f 'boot -z' bogons 2009-03-14 11:08:28 +00:00
dyoung 6e3de811e0 Use the right format specifiers to print the new struct timeval. 2009-02-27 23:13:32 +00:00
bouyer 73920b4161 More printf format fixes. 2009-02-13 23:31:23 +00:00