Commit Graph

2302 Commits

Author SHA1 Message Date
dyoung e4f3892584 Use pmf_device_register1() instead of shutdownhook_establish() to
register com_cleanup() as the shutdown hook.

Add a generic suspend routine.  Suspend and resume com@isa.

Protect against dereferencing a NULL softc in comioctl().

Destroy both a mutex and a callout in com_detach().

Cosmetic: use aprint_*_dev().  Use PMF_FN_ARGS, PMF_FN_PROTO.
2008-02-29 07:02:04 +00:00
dyoung f580a3a869 Use PMF_FN_ARGS, PMF_FN_PROTO. 2008-02-29 06:13:39 +00:00
dyoung 82d7506fef Use device_t and accessors. 2008-02-28 00:20:04 +00:00
dyoung 212fa79969 Suspend, resume, detach.
Use mutex(9) and condvar(9) instead of splbio(9)/splx(9) and
tsleep(9)/wakeup(9).

Use device_t and accessors.  Use aprint_*_dev().
2008-02-22 23:40:49 +00:00
dyoung 288f7bb3b8 Use device_t and accessors. Use aprint_*_dev().
Add method to detach child.
2008-02-22 23:26:11 +00:00
dyoung 27794e53e5 Add methods to detach lpt at isa. 2008-02-22 20:53:58 +00:00
dyoung 3d8a594471 Let the compiler decide: inline -> static, register -> . 2008-01-31 18:45:45 +00:00
dyoung 8c145c8134 Cosmetic: constify, KNF, use device_t and accessors, use
aprint_normal_dev() instead of printf("%s: ...", dv->dv_xname).
2008-01-31 18:32:51 +00:00
he 0a4814ccdc Do a dummy pmf_device_register() in pcppi_attach() instead of only
in pcppi_isa_attach(), so that pcppi at acpi doesn't become an obstacle
to suspending.

Looked over by jmcneill.
2008-01-30 12:30:01 +00:00
dyoung bf192f5d8d In pcppi_detach(), s/pmf_device_register/pmf_device_deregister/.
Why that never blew up when I tested, I will never know.  Thanks
wiz@ for catching my mistake.
2008-01-10 08:55:31 +00:00
dyoung 636e434283 Support pcppi(4) detachment.
Use device_t, device_private().  Get rid of a struct device * cast.
2008-01-10 07:58:39 +00:00
dyoung 3a66b9167f Let us detach atabus* from wdc*, and wdc* from isa*.
Use device_t, device_private().
2008-01-10 07:44:07 +00:00
ad 0664a0459b Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
2008-01-04 21:17:40 +00:00
dyoung 09fd56f9ec Detach attimer at acpi, attimer at isa. 2008-01-03 01:21:44 +00:00
ad 4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
dyoung 80c0fcd21b Improve device detach routine. Now I can detach nsclpcsio0 and
its children.

Fix an off-by-one bug in the sensor initialization which stopped
it from completing.

Extract sensor initialization into a new subroutine.  If there is
an error while initializing sensors, do not let sc_sme dangle.
2008-01-02 10:21:08 +00:00
dyoung 66938db654 Cosmetic: fix indentation. 2008-01-02 02:25:27 +00:00
dyoung fd5d1d790d Use device_t, device_private(), aprint_error_dev(). 2007-12-31 09:12:18 +00:00
wiz 41643cbfd9 Proxy-commit for xtraeme:
Use sysmon_wdog_unregister(), not sysmon_wdog_register(), in
itesio_detach().
2007-12-31 01:53:58 +00:00
wiz 2af02278c7 Proxy-commit for xtraeme:
add dependency for itesio on sysmon_wdog.
2007-12-31 01:52:34 +00:00
xtraeme a6d89167f6 Erm, update another comment that was outdated with latest changes. 2007-12-29 06:18:35 +00:00
xtraeme 05c541c9b4 Update a comment that I wanted to correct for long time now... 2007-12-29 06:15:47 +00:00
xtraeme 7abc984e72 Added support for the Watchdog Timer built in the IT871[268] Super I/Os.
The WDT supports any value between 1 and 65535 seconds (or minutes, but
but the driver only uses seconds).
2007-12-29 06:05:06 +00:00
perry b6a2ef7569 Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
2007-12-25 18:33:32 +00:00
xtraeme 8870106a7d Do not append the device name into the sensor's description, that's
useless and redundant.
2007-12-21 01:23:41 +00:00
dyoung f2a1e06d0a Use __arraycount(). 2007-12-20 18:45:32 +00:00
christos f54e064ee9 add null pmf handlers. 2007-12-16 19:01:35 +00:00
dyoung 8fc7c0c5ca Add a resume handler for com@isa, using Jared McNeill's suggested
code from current-users.  com@acpi, et cetera, remain to be done.
2007-12-14 03:36:54 +00:00
garbled 41918d8024 Move the elink probe code from files.isa to the common conf/files so that
MCA without isa can compile.  fix by cube.
2007-12-13 21:23:48 +00:00
xtraeme fcad73742f Check return value of pmf_device_register(), pointed out by joerg.
Looks like the pmf(9) manpage declared it as void and not bool...
2007-12-13 15:36:29 +00:00
lukem ceed9c722c use __KERNEL_RCSID() 2007-12-11 11:52:26 +00:00
xtraeme 747de0248d Register to pmf(9). 2007-12-09 20:59:37 +00:00
jmcneill 4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
dyoung 550024b13d Use IFADDR_EMPTY().
(This driver should go away, comments indicate that it does not
even compile.)
2007-12-05 18:23:23 +00:00
pooka 4e38160d4d Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.
2007-12-05 17:19:46 +00:00
ad 6874e511b7 lockmgr -> mutex 2007-12-05 07:58:29 +00:00
ad 598ab03ad0 Match the docs: MUTEX_DRIVER/SPIN are now only for porting code written
for Solaris.
2007-12-05 07:06:50 +00:00
jmcneill 490542edae aprintify, on behalf of xtraeme 2007-12-01 23:40:28 +00:00
jmcneill 597a6bb9ae aprint-ify isaattach, removes a hard-to-find newline on a boot -z 2007-12-01 04:50:23 +00:00
xtraeme f517956d37 Print the error if sysmon_envsys_register() fails and add a missing
return in that case.
2007-11-22 08:15:00 +00:00
kefren 7ff1853b95 Initialize sensor's state
on behalf of xtraeme
2007-11-17 08:30:35 +00:00
xtraeme 31962fc6e5 Extend the envsys2 API (one more time, sorry) as defined in:
http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
2007-11-16 08:00:11 +00:00
xtraeme 503d8b60d1 Remove a debug printf. 2007-11-15 13:23:13 +00:00
xtraeme 0c95eec1eb - Remove an extra RCS ID line.
- Update the ifdef on itesio_isavar.h to reflect the rename.
2007-11-15 13:09:07 +00:00
xtraeme b0ac365f62 Rename it(4) to itesio(4) to accomodate for the following changes:
- The driver now uses the Super I/O address port as port argument in
  the configuration file. The Environmental Controller base address is
  fetched by the Super I/O EC LDN configuration registers.

- Invalidate voltage sensors if data returned is 0xff.

- Use the Super I/O Global Configuration Registers Chip ID[12] and Device
  Revision to store/print the correct information.

- Use only the Fan Extended Tachometer registers on IT871[68]F for now;
  this gives us correct data for IT8705/IT8712F again.

Inspired by the smsc(4) driver. The UPDATING file has been updated to
reflect the rename.
2007-11-15 12:53:40 +00:00
xtraeme e11006338a Add support for the VMS logical device on nsclpcsio(4) and clean up
the code. This provides 14 voltage sensors in addition to the previous
3 temperature sensors supported in the TMS logical device.

Adapted from OpenBSD, tested by dyoung.
2007-11-09 01:09:47 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
ad 2af68666da Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
2007-10-08 16:41:05 +00:00
ad 37a012a7c2 Use splhigh(), not disable_intr(). 2007-09-25 23:11:24 +00:00
xtraeme 57956a2b1e Fix aps(4) attachment. 2007-09-12 11:45:39 +00:00
xtraeme 9e048e4b24 Forgot to add aps(4) device. 2007-09-12 11:07:38 +00:00
xtraeme 1dac9ede4d New aps(4) driver for IBM Thinkpad Active Protection System.
Exports some sensors through the envsys(4) framework available
in some Thinkpad laptops.

Ported by Pierre Pronchery from OpenBSD, via PR port-i386/36852.

Tweaks, LKM and misc improvements by me. Added into i386/GENERIC
commented out.
2007-09-11 21:46:52 +00:00
cube c725329722 Remove 3rd clause and my name from all the licences which were only in my
name.
2007-09-10 10:35:51 +00:00
xtraeme 7edd0f0532 Add the detach method, will be used by the LKM. 2007-09-09 05:39:10 +00:00
xtraeme 2db2debe7e Add the detach method and don't bother with gpio in the LKM for now. 2007-09-09 05:26:18 +00:00
xtraeme 3efc7cfcb3 Add the detach method, will be used by the LKM. 2007-09-09 05:17:17 +00:00
xtraeme d7850b3e83 Add the detach method, will be used by the LKM. 2007-09-09 05:08:11 +00:00
xtraeme 28abae783c Add the detach method that calls driver's lm_detach() function and
unmaps the I/O space used.
2007-09-08 00:39:48 +00:00
xtraeme e8bf5d91f9 Do not enable monitoring for the sensors... if somebody wants this,
it may be enabled via userland.
2007-09-02 00:54:50 +00:00
dyoung dcd8923429 Change a bazillion occurrences of code resembling this,
error = (cmd == SIOCADDMULTI) ?
	    ether_addmulti(ifr, &sc->sc_ec) :
	    ether_delmulti(ifr, &sc->sc_ec);

	if (error == ENETRESET) {

to this,

	if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {

which does the same thing.

(A bazillion is a very large number.  This seems to make the i386
ALL kernel smaller by 3kB to 4kB.)

Use ifreq_getaddr() twice in es(4).

Whitespace nits.
2007-09-01 07:32:22 +00:00
dyoung 71e77a61b4 Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).
2007-08-26 22:45:55 +00:00
kiyohara 44c89c7646 Replace to Matthew Orgass's slhci(4).
http://mail-index.netbsd.org/tech-kern/2007/06/26/0001.html
2007-08-15 03:53:08 +00:00
ad eb171eaaa7 It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
2007-07-29 12:50:17 +00:00
mjf 05619021ad Implement bounds checking in some places in display driver code to avoid
the possibility of a local user panic.
2007-07-28 20:28:56 +00:00
xtraeme 7867660706 Fix typo that wasn't allowing to change the rfact. 2007-07-20 07:23:47 +00:00
tsutsui 12b13f1335 Fix more pesudo. 2007-07-10 12:15:00 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
xtraeme 9e341f559a Set the ENVSYS_FCHANGERFACT flag in it_setup_sensors rather than
in the refresh function.
2007-07-07 05:27:22 +00:00
xtraeme 9f0e4ef0f4 Some changes:
- Add support for the IT8716F chip, patch from FUKUMOTO Atsushi via
  PR port-i386/35796.
- Enable the flag ENVSYS_FCHANGERFACT in voltage sensors, to be able to
  increment the value returned by the driver via envstat(8).
- Update VBAT sensor reading every time we read it, otherwise it will
  always report the power on value.
- Enable all sensors that were missing before: 3 Temp + 3 Fan + 9 Voltage.
- Add new registers to set high/low limits in temperature/voltage sensors
  (still unused).
- Disable some sensors if they are reporting bogus data or simply they are
  not connected.

Tested by wiz.
2007-07-05 15:20:30 +00:00
xtraeme f50072a162 In the gtredata function, use the edata pointer rather than using
directly the edata array index in the softc.
2007-07-01 22:20:34 +00:00
xtraeme da3f163bd2 Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
  and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
  sysmon_power(9) and powerd(8), that means there is no 32 bytes event
  size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
2007-07-01 07:37:12 +00:00
dsl 716dbe1abc The cd ioctl definitions are not condusive to being called from within
the kernel (eg from withthe linux compat code).
Add CDIOCREADSUBCHANNEL_BUF and CDIOREADTOCENTRIES_BUF which are like the
  existing ioctls withoutthe _BUF, except that the data area immediately
  follows the control structure (and is fixed length).
Modify scsipi/cd.c so that it only ever has one 'struct cd_formatted_toc'
  allocated on the stack (maybe this info ought to be in the softc)
  structure since even one 800 byte on-stack buffer isn't overly friendly.
cdplay(1) still seems able to read the track-list of an ATAPI cd.
2007-06-30 22:16:38 +00:00
blymn eeece1c927 Add driver for the hardware monitoring portion of the SMSC LPC47B397 2007-06-01 14:11:59 +00:00
xtraeme ff1c414804 Split the ug(4) driver in three components:
* dev/ic/ug.c (main code shared by the attachments)
	* dev/isa/ug_isa.c (isa attachment)
	* dev/acpi/ug_acpi.c (acpi attachment)

That means that ug(4) can now be attached via ACPI.

Thanks to Mihai Chelaru for the good work.
2007-05-08 16:48:37 +00:00
xtraeme 6b5eadf8c1 Don't refresh all sensors in the gtredata function, just the sensor
that was requested. This is related to PR kern/36226.
2007-05-07 10:54:44 +00:00
xtraeme 7435f0af77 Don't refresh all sensors in the gtredata function, just the sensor
that was requested. This is related to PR kern/36226.

Patch from Mihai Chelaru in private email.
2007-05-07 07:48:28 +00:00
jnemeth f587e8e88c add support for devctl properties 2007-03-08 23:23:45 +00:00
xtraeme efdbf7cdc4 * Remove unneeded headers.
* KNF, u_intx_t -> uintx_t
* There's no need to use additional variables for iobase and iot, just
  use the members from ia.
2007-03-07 17:32:47 +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
xtraeme 840604a1a8 Replace simple_locks with mutexes, reviewed by ad@. 2007-02-18 23:34:55 +00:00
ad d14a7576fc Fix spllowersoftclock() fallout. 2007-02-16 13:42:29 +00:00
reinoud 43061c75ae Rename the B_XXX flag to B_DEVPRIVATE flag since it was never used for
debugging and its main use is in device drivers. Its used there to signal
that the flagged buffer has a special meaning or should be handled
differently.

OK'd by Bill Sudenmund on tech-kern.
2007-02-15 18:33:26 +00:00
hubertf eda05c6413 Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
2007-01-29 01:52:43 +00:00
xtraeme af41d0fea7 Merge defs from ugvar2.h into ugvar.h, suggested by tsutsui. 2007-01-20 18:32:41 +00:00
xtraeme 7a516bb827 PR kern/35438: uGuru 2005 support from Mihai Chelaru.
Also replace bcopy with memcpy.
2007-01-20 18:18:51 +00:00
cube 1ff20ac39c Make COM_HAYESP compile again. It assumes no register mapping is needed. 2007-01-10 20:59:10 +00:00
cube 16cd257563 Complete initialiser. 2007-01-10 20:38:32 +00:00
cube 747e90f203 Remove traces of scd(4), which apparently never actually had a driver in
the tree.
2007-01-09 21:59:08 +00:00
cube ecacf90d2f Remove stale config(5) entries for unexistent wl(4).
Ok'd by matt@.
2007-01-09 19:19:09 +00:00
cube ea085d876a Disable daic(4). The driver is not finished.
Ok'd by martin@.
2007-01-09 15:34:59 +00:00
xtraeme 8d4275e58d * Remove unused sensors, anyway we are showing just the sensors of what
the BIOS is reporting (and speedfan for windows).
* Simplify the code.
* Remove unused functions and unnecessary variables.
* Provide more rfact values for the voltage sensors (from OpenBSD).
* Remove the limit of 1.5 seconds for refreshing the sensors, it's
  unnecessary... we can read it every time we want.

Now I'm happy with the driver (code and envstat output):

[juan@nocturno][~]> envstat -r
   CPU Temp:     38.000 degC
System Temp:     36.000 degC
    VCORE_A:      1.664 V
      +3.3V:      3.312 V
        +5V:      4.919 V
       +12V:     12.480 V
       VBAT:      3.248 V
    CPU Fan:       3096 RPM
 System Fan:          0 RPM
[juan@nocturno][~]>
2007-01-07 01:39:24 +00:00
xtraeme 55694ceabd Driver for the Abit uGuru Hardware system monitor, contributed by
Mihai Chelaru. Minor changes (simplification and KNF) by me.

Thanks.
2007-01-06 21:27:54 +00:00
isaki 2410b4468e Correct indent. 2007-01-02 02:23:51 +00:00
cube 4cb6e56c76 Remove an error message about having FSTAR'd instances attaching at pcppi.
It's actually fine to have them.  Somehow I wish there was a way to express
that there can be only one device of that kind attaching on a given pcppi.

All of this is generic for all indirectly configured bus (i.e., specified
by kernel configuration).

Reported by uwe@.
2006-12-10 22:10:57 +00:00
uwe dbbb1cca5e When comlaining about child* attachment print "WARNING" and the child
name.  Makes it more obvious what the problem is, and easier to spot
in the dmesg output after quiet boot warns about "errors" while
detecting hardware.
2006-12-10 03:24:29 +00:00
uwe ba06ad7411 Add missing aprint_naive to the attach routine. 2006-12-10 00:40:10 +00:00
wiz 6919c6578c s/independant/independent/, from Zafer. 2006-11-24 22:04:21 +00:00
wiz fa34b615d2 Correct spelling of "immediate(ly)". From Zafer. 2006-11-24 21:23:07 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
cube c3fe38a0cd config_found() is for direct configuration, not indirect.
Change the code to use config_search/config_attach, and print a warning
when the user has device* at pcppi? in the kernel configuration file.
2006-11-05 21:06:26 +00:00
reinoud f64c33e88b Define DPRINTF(x) as an empty block to prevent gcc from complaining about
empty statements. This is still an empty statement but it will be filtered
out still.
2006-10-20 18:14:59 +00:00
pooka 1810947bb4 make compile by using __unused & other necessary tricks
and remove <0 comparisons for bus_size_t.  if a port wants signed
bus_size_t, it just might have to accept it can't use this driver.  *snif*
2006-10-16 12:58:54 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
christos 82e1169df4 fix empty if 2006-10-04 15:49:59 +00:00
christos 12288ce635 Fix empty if 2006-10-04 15:48:47 +00:00
jmcneill f135e0d607 Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
2006-09-24 03:53:07 +00:00
matt b9525730ee deal with 'bool' definitions 2006-09-11 03:37:12 +00:00
dogcow f2d329dca0 remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP. 2006-09-07 02:40:31 +00:00
christos e82a0f88ae add missing initializer. 2006-09-03 21:45:28 +00:00
christos 77c903b90a add missing initializer 2006-09-03 21:42:55 +00:00
christos 0c58aff5f5 add missing initializers 2006-09-03 06:46:22 +00:00
christos c11c8c78df add missing initializers 2006-09-03 05:29:46 +00:00
christos 60dfc6ed9c add missing initializers 2006-09-03 05:16:01 +00:00
christos eb7cb3e07d - add missing initializers
- remove impossible comparison
2006-09-03 05:12:54 +00:00
christos 624d950194 add missing initializer 2006-09-03 05:11:30 +00:00
christos 5ec7f32544 add missing initializers 2006-09-02 17:02:57 +00:00
christos a569a4d291 add missing initializer 2006-09-02 07:01:20 +00:00
christos 989f6e4d42 avoid empty if body. 2006-08-30 16:45:40 +00:00
christos a7239032fa Fix initializer 2006-08-30 16:42:04 +00:00
christos 46d616fab0 fix incomplete initializers. 2006-08-30 15:46:58 +00:00
christos 13714b86fb comment out impossible comparison. 2006-08-30 15:27:18 +00:00
christos afca61baba add missing initializers 2006-08-30 02:09:40 +00:00
christos 37fbc95466 add missing initializer 2006-08-30 01:27:56 +00:00
christos 0340a0cbcd fix incomplete initializer 2006-08-30 01:24:40 +00:00
christos cdda2124d1 Fix incomplete declaration. 2006-08-27 23:33:35 +00:00
christos 35ca6c8b5b Fix all the -D*DEBUG* code that it was rotting away and did not even compile.
Mostly from Arnaud Lacombe, many thanks!
2006-08-17 17:11:27 +00:00
gdamore 34537908ab Add an option COM_REGMAP to allow com(4) to use an array of register indices.
This allows us to convert aucom to just another com attachment, and cleanup
some code in the com_arbus.c.

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

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

Approved by core@.  Fixes PR port-evbmips/32362.
2006-07-13 22:56:00 +00:00
christos 1a9d8ea2c7 Fix use the proper ioh. 2006-07-08 18:19:01 +00:00
chap 710af63468 Ankh-Morpork, we have a MIDI driver....
Merge from chap-midi branch, after
~month for review
Comments by thorpej@ drochner@ and Alexandre Ratchov

Incorporated: points by thorpej@ drochner@; preliminary support for
a stats-collecting ioctl suggested by martin@ from comments by A.R.

PR kern/32441 kern/32442 kern/32567 kern/32588 kern/32694 kern/33590
kern/33614 and one instance of kern/32651

ok martin@
2006-06-30 13:56:25 +00:00
chap 2c3d85cc29 Not related to chap-midi branch; corrects two compilation errors induced
by a stack-police commit to the HEAD.  (Is this why so many comments about
catching up with -current say "here we go again"?)
2006-06-18 23:15:33 +00:00
xtraeme c731b8e426 * Improve description for all sensors.
* Fix some voltage values.
* Do not print rfact+data values for sensors without any returned data.
2006-06-11 18:15:17 +00:00
christos 7b128daa3b stack police: Introduce an opl_match function that uses malloc instead of
allocating ~2K of softc on the stack.
2006-06-09 21:55:33 +00:00
xtraeme 5ff5dfea17 Adapt to timecounters. 2006-06-08 05:00:25 +00:00
xtraeme 045e0f2d3d it_check(): check values from IT_RES48 and IT_RES52, if both are default
values specified by the chip, continue attaching the driver (previously
only checking IT_RES48 was enough and IT_RES52 was ignored).
2006-06-05 15:59:47 +00:00
elad 2867b68bc3 integrate kauth. 2006-05-14 21:42:26 +00:00
xtraeme 33a96be9f2 Driver for iTE IT87xxF and compatibles hardware monitor. Add
commented out entries on GENERIC and GENERIC_LAPTOP.

Adapted from OpenBSD.
2006-05-13 09:02:18 +00:00
rpaulo b93659c243 Make wtintr() prototype static too.
In wtsense(), make msg local variable const.
2006-04-26 17:21:30 +00:00
rpaulo accfad23f5 Put back sys/proc.h for wakeup/tsleep.
Fix more typos.
2006-04-26 17:19:50 +00:00
rpaulo 9f28da272d Make 3rd argument of wtwait() const. 2006-04-26 17:18:41 +00:00
rpaulo be1f3d0d34 Fix an obvious typo. 2006-04-26 17:17:03 +00:00
rpaulo 1595c18c6b ktrace-lwp merge. 2006-04-26 17:15:08 +00:00
rpaulo bf691ec7e3 ANSIfy, statify, KNfy.
(and maybe deadfy some day?)
2006-04-26 17:13:27 +00:00
christos 9df2078720 Make this compile again. 2006-04-23 00:08:50 +00:00
christos 16843a2657 Make this compile again. We really need an ALL kernel. 2006-04-22 23:56:39 +00:00
christos 407368a46e Coverity CID 2453: Add negative checks. 2006-04-14 22:52:00 +00:00
christos d9cf854027 On second thought, the whole statement is wrong. 2006-04-14 21:53:40 +00:00
christos 69283d75e0 Coverity CID 723: Fix bogus test. 2006-04-14 21:51:35 +00:00
christos db694f7eca Coverity CID 1104: Return early if no mbuf. 2006-04-14 21:49:08 +00:00
christos bb2402826a Coverity CID 1540: Avoid array overrun 2006-04-14 19:56:40 +00:00
blymn 3c0adb7d99 Make i/o statistics collection more generic, include tape drives and
nfs mounts in the set of devices that statistics will be reported on.
2006-04-14 13:09:05 +00:00
christos d7e1743903 PR/29683: Sergey Svishchev: Make this compile again.. 2006-04-13 23:16:33 +00:00
cube b08283e19d Fix grammar in a comment, and use named constants for better readability. 2006-04-13 09:47:19 +00:00
christos dd8ade94a0 Coverity CID 1320: Don't try to use drq16 as an index in an array if it is -1 2006-04-13 03:45:44 +00:00
christos afbea8995b Fix the MPU attachment on Aztech 1020 that has a separate mpu pnp device
instead of having the mpu in io[1]. From doomwarriorx at gmail dot com.
2006-04-13 00:30:19 +00:00
jmmv 7a51d4dddc Add an extra cookie to the ioctl and mmap wsdisplay accessops that points
to the screen on which they are being called.  The driver cannot guess
this by itself but it is needed to implement, at least, the getwschar and
putwschar functions in the correct place.  There are no functional changes
yet.

Tested on i386 (vga, vga_raster, machfb, vesafb), macppc and sparc64.
Suggested and reviewed by macallan@.
2006-04-12 19:38:22 +00:00
garbled 1de17f11a8 Add an option PCKBCNOTEST and defopt it. On the prep 7043 and 7248
machines, the keyboard controller will not pass this test, but if you
attach anyway, it works fine.  Note that this test is specifically
disabled in ic/pckbc.c, but given that it seems to work fine on other
machines, leave it defaulted to on.
2006-04-11 17:14:44 +00:00
thorpej 2be6494fc9 Use device_cfdata(). 2006-03-29 04:16:44 +00:00
thorpej 39cd836ee1 Use device_unit(). 2006-03-28 17:38:24 +00:00
thorpej 6e53f1366a Use device_parent(). 2006-03-25 23:14:58 +00:00
christos 5a57baa413 don't use MALLOC with a non-constant size; use malloc instead. 2006-03-17 23:29:07 +00:00
lukem a1f606d3fd Use the SI capitalization for "Hz", "kHz", and "MHz" in comments and strings.
Add a space between numbers and Hz unit.
2006-03-08 23:46:22 +00:00
dsl 6f0f9f8763 Make almost everything #include <sys/bswap.h> instead of <machine/bswap.h>
The bswap.h and endian.h files are all rather incestuous, but I want to
get the constant folding stuff into one place - sys/bswap.h
2006-01-29 21:42:40 +00:00
bouyer bf1a4d2af5 properly use ata_channel->ch_ndrive:
- initialize it properly in the bus front-ends (all 2, exept in wdc_pcmcia.c
  for the "Sandisk CompactFlash Card" where it's set to 1)
- remplace hardcoded '2' by ata_channel->ch_ndrive in MI IDE drivers.

From Christos Zoulas in kern/32501.
2006-01-16 20:30:18 +00:00
yamt 7b826aac85 initialize necessary members of struct buf. PR/32462 from Reinoud Zandijk. 2006-01-06 09:21:44 +00:00
yamt 690d424f28 - add simple functions to allocate/free a buffer for i/o.
- make bufpool static.
2006-01-04 10:13:05 +00:00
perry 3d4ed1fbc7 __inline__ -> inline 2005-12-24 23:41:33 +00:00
perry 93124077ae Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:27:29 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
yamt aec75b1cc6 - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
  have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
  from sys/bufq.h to sys/bufq_impl.h.
  (is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c.  (not tested)
2005-10-15 17:29:10 +00:00
drochner 69f432c06d -put gpio stuff inside #if NGPIO > 0
-kill gba_name in attach arg, specify interface attribute
2005-10-11 15:58:37 +00:00
jmcneill b8a32e9d53 Attach to gpiobus. From OpenBSD. 2005-09-27 02:56:27 +00:00
drochner 46ed4b50c4 s/locdesc_t/int/g 2005-08-26 12:42:11 +00:00
drochner ea5766898f oops, too much mechanical renaming -- clearly separate searched and
found locators
2005-08-25 20:52:02 +00:00
drochner fa3cb84d62 replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
2005-08-25 18:35:38 +00:00
joff ad50acb4b6 Add toaster, tsdio, toasterlcd devices 2005-08-14 04:15:44 +00:00
joff d4bc23d662 wsdisplay device driver for the 4x40 text-mode LCD on the NetBSD/toaster 2005-08-14 04:15:18 +00:00
joff bb813453e2 Device driver that exposes the burner element, magnetic latch, and front-panel
LEDs of the TS-7200 NetBSD/toaster via sysctl.
2005-08-14 04:14:35 +00:00
joff 43b39c1131 Simple driver for Technologic Systems TS-DIO24 PC104 board. No
userland interface (yet), basically just can detect a TS-DIO24 on a ISA
bus and provide an attachment for sub-devices.

The TS-DIO24 contains 24 programmable digital input/outputs.
2005-08-14 03:50:34 +00:00
christos 2709ce754e Fix compilation with FD_DEBUG. 2005-07-30 14:49:35 +00:00
drochner 83ebaf0ea5 complete attachment if the temperature monotor was successfully awoken,
minor whitespace fixes
2005-07-29 11:25:13 +00:00
drochner 21275bf194 activate the temperature sensors if the device is in standby mode
on attach (as on Soekris boards), from Aaron Hodgen per PR kern/23598
2005-07-29 11:05:27 +00:00
christos d39684a368 make the isdn drivers compile again with -Wconst, -Wshadow 2005-07-09 02:05:09 +00:00
wiz 4082e99219 Update comment. 2005-06-28 10:16:33 +00:00
kent eabe9bbfa4 remove pss(4) driver. It has never been workable and has not been
compilable for a long time.
2005-06-28 08:36:47 +00:00
christos 2ccc3ff1e9 - add const
- avoid variable shadowing.
2005-05-30 04:32:38 +00:00
christos 57fa3798ac sprinkle const. 2005-05-29 22:12:37 +00:00
christos d675f4acb4 avoid nested variables 2005-05-29 22:12:26 +00:00
lukem 5e4045c6bb add __KERNEL_RCSID 2005-05-24 05:14:37 +00:00
christos 7cdea212c0 No 0x in front of %p... 2005-05-22 15:54:45 +00:00
christos 1a54f2152a PR/22058: Onno van der Linden: duplicate detection of isa ip.
Use some more undocumented bits to find out if the card is in pnp mode or not.
2005-05-12 18:53:08 +00:00
jdolecek fc38d3f3ac Make it possible for attachment to specify that the 16bit access shouldn't
be toggled in WE_MEM_{ENABLE|DISABLE} when receiving or transmitting packets.
Use this to switch the toggle off for MCA cards, since it causes NIC resets
there.

Fixes PR kern/26895 by Dave Barnes.
2005-04-03 10:56:59 +00:00
cube d2d1a8c05c Make pcppi(4) use attimer(4) to set the pitch of the bell.
In case you don't configure an attimer(4) device in your kernel config,
you will simply lose the ability to set the pitch.  It will still beep.
2005-03-25 23:09:00 +00:00
cube 040e3b19e5 Add attimer(4) driver, with ISA and ACPI attachments.
attimer(4) is the new body of the part of pcppi(4) that mapped the TIMER1
register to set the pitch of the bell.  It was necessary to separate them
in order to have a working ACPI attachment (as the two appear as different
devices in the ACPI structures).
2005-03-25 23:06:19 +00:00
xtraeme 3141856faf This needs <machine/bus.h> now. 2005-03-21 18:27:32 +00:00
xtraeme d1c67e4716 This needs <machine/bus.h>, needed for ACPI pcppi(4) attachment. 2005-03-21 17:16:10 +00:00
xtraeme 65f27995a2 Move the struct pcppi_softc into pcppivar.h, add in this file
pcppi_attach(), which now accepts "struct pcppi_softc";
Split ISA specific bits from pcppi_attach() into pcppi_isa_attach()
(needed by the upcoming pcppi(4) ACPI attachment).

Reviewed by christos@.
2005-03-21 14:05:18 +00:00
xtraeme a2dce2fece Use ANSI function declarations. 2005-03-21 10:51:52 +00:00
christos f048688c46 PR/29683: M. B. Buchanan: mcd driver has printf formatting compile issue
and sets the wrong field to the number of ports.
2005-03-12 22:54:48 +00:00
simonb 0467cc278e Add a missing return after an "if" that checks for something then
did nothing.
2005-02-28 05:05:02 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
thorpej df9803ce96 Part 1 of a cleanup pass over the SCSI subsystem. The aim is to name
everything "scsi_*", since we really are talking about the SCSI command
set, ATAPI transport not withstanding.  Improve the names of many structures,
and prepend "SCSI_" onto all SCSI command opcodes.  Place items described
by the SCSI Primary Commands document into scsi_spc.h.
2005-02-21 00:29:06 +00:00
perry 18db93c7f6 de-__P 2005-02-04 02:10:35 +00:00
drochner 12ff682534 Whitespace police. The rest remains crap. 2005-02-01 20:33:58 +00:00
gson 8de9537c69 Update printf format in debug printf to account for sample_rate now
being an unsigned int.
2005-02-01 12:07:58 +00:00
kent c9ec679311 ansify and KNF 2005-01-14 03:41:45 +00:00
kent b85368e36f ansify and KNF 2005-01-13 15:01:27 +00:00
kent d69abf4ca0 - make this compile
- style fixes
2005-01-12 17:43:19 +00:00
kent 23b5d91433 merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework


Summary of changes:

* struct audio_params
  - remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels.  Conversion information
is conveyed by stream_filter_list_t.
  - change the type of sample_rate: u_long -> u_int
  - add `validbits,' which represents the valid data size in
precision bits.  It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.

* audio_hw_if
 - add two parameters to set_params()
	stream_filter_list_t *pfil, stream_filter_list *rfil
   A HW driver should set filter recipes for requested formats
 - constify audio_params parameters of trigger_output() and
trigger_input().  They represent audio formats for the hardware.
 - make open() and close() optional
 - add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
 to round_blocksize()

* sw_code is replaced with stream_filter_t.
  stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
  converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t

* MI audio
 - audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
 - audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
 - audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
 - ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.

* add `struct device *' parameter to ac97_attach()

* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-10 22:01:36 +00:00
tsutsui a9b3f31984 Some cosmetics:
- remove __P()
- use ansi decls
- u_int8_t, u_char -> uint8_t
- use macro for debug printfs
- some KNF
2005-01-09 16:59:41 +00:00
joff 8d1a86c97d add tscs 2005-01-08 02:56:35 +00:00
joff 4b903bb725 Support for TS-ETH10 PC/104 enet isa card based on CS8900 2005-01-08 02:55:52 +00:00
abs 964859d895 Fix comments regarding configration bounaries 2004-12-12 21:03:06 +00:00
thorpej d41e8f00bf Don't use "struct scsi_generic" in a hardware-defined structure. Instead,
use an array of 12 bytes.  Check the incoming CDB to see that it will fit,
and print and error and fail the command if it won't.
2004-12-07 14:50:56 +00:00
xtraeme 347378fc9f Add ACPI mpu(4) attachment, based on lpt_acpi.c by jmcneill@,
reviewed by christos@, cube@ and martin@.

While here, remove a printf() in mpu_attach() (ic/mpu.c) to remove
an empty line in some frontends (mpu_isa.c, etc).
2004-12-02 09:50:41 +00:00
thorpej 711247fa68 When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
2004-10-30 23:33:29 +00:00
yamt 18f717bb90 constify audio_hw_if, midi_hw_if, and radio_hw_if. 2004-10-29 12:57:15 +00:00
yamt 05f25dcc2a move buffer queue related stuffs from buf.h to their own header, bufq.h. 2004-10-28 07:07:35 +00:00
yamt 22399b45d0 change some members of struct buf from long to int.
ride on 2.0H.
2004-09-18 16:40:11 +00:00
drochner 1308c6d767 Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
2004-09-14 20:20:46 +00:00
drochner edb77e2a6d include "locators.h" explicitely where it is needed, so that
it can be removed in the isavar.h header eventually
2004-09-14 17:38:30 +00:00
drochner 863cb326e8 replace 7 identical instances if cfprint functions by a single one 2004-09-14 17:19:34 +00:00
drochner 46289e1fef Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
2004-08-30 15:05:15 +00:00
drochner 5fa053333d add centralized {eisa,isa,pci,agp,mca}busprint() functions which do
what tens of the bus' parents foo{...}bridge_print()s scattered around do
2004-08-30 10:30:38 +00:00
thorpej 9cc521a148 Move most of wdc_softc into a new atac_softc structure that contains
info common to all types of ATA controllers.
2004-08-20 06:39:37 +00:00
thorpej 2926431abf Use ANSI function decls and "static". 2004-08-19 23:30:09 +00:00
drochner a758a2aba6 allow to detach child devices and (optional selectively) bus rescans,
using the new autoconf functions
2004-08-18 11:54:47 +00:00
mycroft 48de8a7bff wdc_init_shadow_regs() must now be called after ch_wdc is filled in, or we get
a null pointer dereference.
2004-08-16 14:47:31 +00:00
thorpej 4b51cecfc2 - Split the register handles out of struct wdc_channel into a separate
wdc_regs structure, and array of which (indexed per channel) is pointed
  to by struct wdc_softc.
- Move the resulting wdc_channel structure to atavar.h and rename it to
  ata_channel.  Rename the corresponding flags.
- Add a "ch_ndrive" member to struct ata_channel, which indicates the
  maximum number of drives that can be present on the channel.  For now,
  this is always 2.  Add an ATA_MAXDRIVES constant that places an upper
  limit on this value, also currently 2.
2004-08-14 15:08:04 +00:00
mycroft a1d101ba64 Add a settype function.
Nuke address windows earlier in power up sequence.
2004-08-11 06:56:57 +00:00
mycroft a23e15bcbe Rather than having a call up from the low-level driver to get the card type,
instead have a call down from the PCMCIA mid-layer to set it.  Use this from
pcmcia_function_enable().  (Currently the policy is the same, but this would
allow for more flexibility in deciding which mode to use.)

Now it is safe to hold the socket enabled during attach, so do that.  Only
one enable/disable cycle to attach a card now!
2004-08-11 00:18:18 +00:00
mycroft 665e1f0611 Attempt to support the 688 as well. It looks vaguely right from inspecting
esl.
2004-08-07 19:32:56 +00:00
mycroft 2863ff72cc Add code to recognize the 1688, per PR 11910. Also reduce some control logic. 2004-08-06 15:11:48 +00:00
drochner f024db680d simplify some pointer arithmetics which uses typecasts on the LHS
so that gcc-3.4 doesn't complain
2004-08-05 16:43:59 +00:00
drochner 955c2f909d This is definitely what the world has been waiting for:-)
Allow to enable the game port on an ES1888, in case the firmware didn't
this. (Otherwise we still rely on the firmware having mapped the sound
related registers.)
Limit this to the "isa" attachment for now because this is the only
one I'm able to test.
Attach the "joy" device directly at "ess" to make sure the port is
enabled before the "joy" probe/attach.
This makes the joystick port usable on a "PWS" alpha (Miata).
2004-08-04 18:53:55 +00:00
mycroft 3ad7358df5 Forgot to commit this. 2004-07-09 03:39:14 +00:00
mycroft 4fe77ba8c0 Free the DMA channels as the last step. 2004-07-09 03:15:01 +00:00
mycroft 2728fe0f3f Clean up. Attempt to make these safer against stray interrupts. 2004-07-09 02:42:45 +00:00
mycroft fefce7ce70 Clean up a little. 2004-07-09 02:27:20 +00:00
mycroft 91eed7f9b9 Remove junk code. 2004-07-09 02:15:37 +00:00
mycroft 393cfb61f9 Don't halt in the close routine.
Don't reset in the open routine -- this causes our mute settings to get
toasted.
2004-07-09 02:14:40 +00:00
mycroft a9eb0d78df There's no need to halt in the close routine -- just clean up the ISA resources. 2004-07-09 02:11:17 +00:00
mycroft aa1018e714 Allow a board with no memory window configured to be attach. Fixes PR 20436. 2004-07-08 21:01:49 +00:00
mycroft 77c587044f Only attempt to map the memory window during attach, not match. If msize==0,
print a message and punt.  Fixes PR 6167 (from me!).
2004-07-03 21:29:08 +00:00
drochner 43a7f7432b fic some questionable pointer arithmetics; gcc-3.4.x
didn't like it
2004-06-24 16:56:00 +00:00
thorpej 6c0c39322a Wrap a noisy probe message in FD_DEBUG. 2004-06-04 01:12:04 +00:00
thorpej 2ecdd552dc Add the notion of "shadow registers" to the wdc driver. These shadow
registers are registers that overlap with others on many controllers, but
which may actually be distinct on some controllers.  Right now, the two
shadows are:

- wd_status (usually overlaps wd_command)
- wd_features (usually overlaps wd_error)

Add a new helper function, wdc_init_shadow_regs(), used to initialize
the shadow register handles on controllers where they do actually overlap.

Partially from Jordan Rhody @ Wasabi Systems, Inc.
2004-05-25 20:42:40 +00:00
wiz 8989ce5fa0 Fix typo in comment; from Sergey Svishchev. 2004-05-11 22:45:09 +00:00
itojun aca4c091d3 sprintf -> snprintf 2004-04-22 00:17:10 +00:00
drochner ef369e0ed6 remove license clauses 3 and 4 from my cpoyright notices 2004-03-24 17:26:53 +00:00
bjh21 dff5222d3a Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it.  This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111.  The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers.  To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned.  Thy just use rather more function pointers than before.  Tested
on i386 and (with a new host driver) acorn32.  Compiled on several other
affected architectures.
2004-03-13 17:31:33 +00:00