History log of /freebsd-9.3-release/sys/dev/sio/sio.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 267654 19-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 235405 13-May-2012 avg

MFC r228631: kern cons: introduce infrastructure for console grabbing by
kernel


# 225736 22-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


# 225214 27-Aug-2011 rwatson

Follow up to r225203 refining break-to-debugger run-time configuration
improvements:

(1) Implement new model in previously missed at91 UART driver
(2) Move BREAK_TO_DEBUGGER and ALT_BREAK_TO_DEBUGGER from opt_comconsole.h
to opt_kdb.h (spotted by np)
(3) Garbage collect now-unused opt_comconsole.h

MFC after: 3 weeks
Approved by: re (bz)


# 225203 26-Aug-2011 rwatson

Attempt to make break-to-debugger and alternative break-to-debugger more
accessible:

(1) Always compile in support for breaking into the debugger if options
KDB is present in the kernel.

(2) Disable both by default, but allow them to be enabled via tunables
and sysctls debug.kdb.break_to_debugger and
debug.kdb.alt_break_to_debugger.

(3) options BREAK_TO_DEBUGGER and options ALT_BREAK_TO_DEBUGGER continue
to behave as before -- only now instead of compiling in
break-to-debugger support, they change the default values of the
above sysctls to enable those features by default. Current kernel
configurations should, therefore, continue to behave as expected.

(4) Migrate alternative break-to-debugger state machine logic out of
individual device drivers into centralised KDB code. This has a
number of upsides, but also one downside: it's now tricky to release
sio spin locks when entering the debugger, so we don't. However,
similar logic does not exist in other device drivers, including uart.

(5) dcons requires some special handling; unlike other console types, it
allows overriding KDB's own debugger selection, so we need a new
interface to KDB to allow that to work.

GENERIC kernels in -CURRENT will now support break-to-debugger as long as
appropriate boot/run-time options are set, which should improve the
debuggability of BETA kernels significantly.

MFC after: 3 weeks
Reviewed by: kib, nwhitehorn
Approved by: re (bz)


# 218424 07-Feb-2011 mdf

Based on discussions on the svn-src mailing list, rework r218195:

- entirely eliminate some calls to uio_yeild() as being unnecessary,
such as in a sysctl handler.

- move should_yield() and maybe_yield() to kern_synch.c and move the
prototypes from sys/uio.h to sys/proc.h

- add a slightly more generic kern_yield() that can replace the
functionality of uio_yield().

- replace source uses of uio_yield() with the functional equivalent,
or in some cases do not change the thread priority when switching.

- fix a logic inversion bug in vlrureclaim(), pointed out by bde@.

- instead of using the per-cpu last switched ticks, use a per thread
variable for should_yield(). With PREEMPTION, the only reasonable
use of this is to determine if a lock has been held a long time and
relinquish it. Without PREEMPTION, this is essentially the same as
the per-cpu variable.


# 183692 08-Oct-2008 imp

Add a note about a bug in how sio manages its softc. This was
discovered by Dorr H. Clark. I'm not at all sure how to fix it, but
wanted to document it at the very least...


# 178766 04-May-2008 peter

Expand kdb_alt_break a little, most commonly used with the option
ALT_BREAK_TO_DEBUGGER. In addition to "Enter ~ ctrl-B" (to enter the
debugger), there is now "Enter ~ ctrl-P" (force panic) and
"Enter ~ ctrl-R" (request clean reboot, ala ctrl-alt-del on syscons).

We've used variations of this at work. The force panic sequence is
best used with KDB_UNATTENDED for when you just want it to dump and
get on with it.

The reboot request is a safer way of getting into single user than
a power cycle. eg: you've hosed the ability to log in (pam, rtld, etc).
It gives init the reboot signal, which causes an orderly reboot.

I've taken my best guess at what the !x86 and non-sio code changes
should be.

This also makes sio release its spinlock before calling KDB/DDB.


# 174898 25-Dec-2007 rwatson

Add a new 'why' argument to kdb_enter(), and a set of constants to use
for that argument. This will allow DDB to detect the broad category of
reason why the debugger has been entered, which it can use for the
purposes of deciding which DDB script to run.

Assign approximate why values to all current consumers of the
kdb_enter() interface.


# 174283 05-Dec-2007 julian

Stop serial console and gdb serial port from getting all screwed up.
PR: 65278
MFC in: 3 days
Submitted by: ups@


# 172568 12-Oct-2007 kevlo

Spelling fix for interupt -> interrupt


# 166901 23-Feb-2007 piso

o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@


# 160420 17-Jul-2006 imp

Restore the status quo before my last commit. Prior to it, sio took
precedence uart. With my last change, it became a tie, and uart seems
to always win on my amd64. This was not my intention, so have sio be
just a tiny bit more preferred than uart.

Note: I'm not making any judgement on the merits of uart winning. I'm
just saying that if we want to change it, we do it on purpose.


# 160046 30-Jun-2006 imp

Have sio return BIS_PROBE_DEFAULT like all the other drivers in the
tree... John Baldwin noted that sio might pass values between probe
and attach via softc. It appears that sio does leave the hardware in
a known state after probing, so other drivers that try to probe might
leave it in a worse state. It doesn't seem to pass any data in softc,
however, that I could find... I think we should not be probing for
anything but nonPnP isa, but that's a change for another day.

Submitted by: Frank Behrens
PR: 87845


# 158950 26-May-2006 phk

Eliminate gdb_checkc member from GDB_DBGPORT(), it is never used.

Use polling behaviour for gdb_getc() where convenient, this edges us
closer to the console code.


# 158947 26-May-2006 phk

Convert to use CONSOLE_DRIVER() macro:

Remove cngetc, rename cncheckc to cngetc (fix GDB console accordingly)


# 158943 26-May-2006 phk

Insert a '_' in the console function names to be more consistent with
the future.


# 155921 22-Feb-2006 jhb

- Use bus_setup_intr() and bus_teardown_intr() to register device driver
interrupt handlers rather than BUS_SETUP_INTR() and BUS_TEARDOWN_INTR().
Uses of the BUS_*() versions in the implementation of foo_intr methods
in bus drivers were not changed. Mostly this just means that some
drivers might start printing diagnostic messages like [FAST] when
appropriate as well as honoring mpsafenet=0.
- Fix two more of the ppbus drivers' identify routines to function
correctly in the mythical case of a machine with more than one ppbus.


# 153195 07-Dec-2005 imp

Use __DEVOLATILE to cast conspeed.


# 151658 25-Oct-2005 jhb

Reorganize the interrupt handling code a bit to make a few things cleaner
and increase flexibility to allow various different approaches to be tried
in the future.
- Split struct ithd up into two pieces. struct intr_event holds the list
of interrupt handlers associated with interrupt sources.
struct intr_thread contains the data relative to an interrupt thread.
Currently we still provide a 1:1 relationship of events to threads
with the exception that events only have an associated thread if there
is at least one threaded interrupt handler attached to the event. This
means that on x86 we no longer have 4 bazillion interrupt threads with
no handlers. It also means that interrupt events with only INTR_FAST
handlers no longer have an associated thread either.
- Renamed struct intrhand to struct intr_handler to follow the struct
intr_foo naming convention. This did require renaming the powerpc
MD struct intr_handler to struct ppc_intr_handler.
- INTR_FAST no longer implies INTR_EXCL on all architectures except for
powerpc. This means that multiple INTR_FAST handlers can attach to the
same interrupt and that INTR_FAST and non-INTR_FAST handlers can attach
to the same interrupt. Sharing INTR_FAST handlers may not always be
desirable, but having sio(4) and uhci(4) fight over an IRQ isn't fun
either. Drivers can always still use INTR_EXCL to ask for an interrupt
exclusively. The way this sharing works is that when an interrupt
comes in, all the INTR_FAST handlers are executed first, and if any
threaded handlers exist, the interrupt thread is scheduled afterwards.
This type of layout also makes it possible to investigate using interrupt
filters ala OS X where the filter determines whether or not its companion
threaded handler should run.
- Aside from the INTR_FAST changes above, the impact on MD interrupt code
is mostly just 's/ithread/intr_event/'.
- A new MI ddb command 'show intrs' walks the list of interrupt events
dumping their state. It also has a '/v' verbose switch which dumps
info about all of the handlers attached to each event.
- We currently don't destroy an interrupt thread when the last threaded
handler is removed because it would suck for things like ppbus(8)'s
braindead behavior. The code is present, though, it is just under
#if 0 for now.
- Move the code to actually execute the threaded handlers for an interrrupt
event into a separate function so that ithread_loop() becomes more
readable. Previously this code was all in the middle of ithread_loop()
and indented halfway across the screen.
- Made struct intr_thread private to kern_intr.c and replaced td_ithd
with a thread private flag TDP_ITHREAD.
- In statclock, check curthread against idlethread directly rather than
curthread's proc against idlethread's proc. (Not really related to intr
changes)

Tested on: alpha, amd64, i386, sparc64
Tested on: arm, ia64 (older version of patch by cognet and marcel)


# 151383 16-Oct-2005 phk

Eliminate two unused arguments to ttycreate().


# 150460 22-Sep-2005 imp

'PC Card' instead of other variants


# 146734 29-May-2005 nyan

Remove bus_{mem,p}io.h and related code for a micro-optimization on i386
and amd64. The optimization is a trivial on recent machines.

Reviewed by: -arch (imp, marcel, dfr)


# 141530 08-Feb-2005 rwatson

Simplify the "and if we're in the debugger, don't use locks" logic,
correcting some misthinking.

Discussed with (really this time): bde


# 141186 03-Feb-2005 rwatson

When entering siocnputc() with (kdb_active), don't acquire (or
release) the sio spin mutex, as use of synchronization primitives in
the debugger can result in substantial problems. With this patch in
place entering the debugger via a serial console is made
substantially more reliable.

MFC after: 1 week
Tested by: kris
Discussed with: bde


# 136478 13-Oct-2004 phk

Use generic tty code instead of local stuff.

NB: device names are now consistent: {cua,tty}d$(port)[.lock,.init]


# 136450 12-Oct-2004 phk

Use ttyconsolemode() to set the console tty modes.


# 135516 20-Sep-2004 nyan

MFpc98: Check a pointer is NULL, remove unused variable.


# 135406 17-Sep-2004 phk

Fix an issue with ng_tty which (ab)used the tty->t_sc field which is
reserved for the device drivers:

Add a t_lsc field for line discipline private use.


# 135367 17-Sep-2004 phk

Use ttyalloc() instead of ttymalloc(NULL)


# 135329 16-Sep-2004 phk

Allocate tty at attach time rather than open time.

Use the init/lock*in/out fields in struct tty and remove them from our softc.

Use tty->t_sc to find out softc when convenient.

Mostly OK'ed by: bde


# 132561 22-Jul-2004 imp

If you insert a pccard modem and then eject it, you get a panic. This
happens because the sio device was never opened and com->tp is
therefore NULL. ttygone can't swallow a NULL, so guard against that
possibility. Other places in this function make similar checks, so I
believe this is correct.


# 132226 15-Jul-2004 phk

Preparation commit for the tty cleanups that will follow in the near
future:

rename ttyopen() -> tty_open() and ttyclose() -> tty_close().

We need the ttyopen() and ttyclose() for the new generic cdevsw
functions for tty devices in order to have consistent naming.


# 131981 11-Jul-2004 phk

Introduce ttygone() which indicates that the hardware is detached.

Move dtrwait logic to the generic TTY level.


# 131939 10-Jul-2004 marcel

Update for the KDB framework. Sanitize the alpha console code now that
it's in the way even more. Basicly: remove all alpha specific console
support from gfb(4), sio(4) and syscons(4). Rewrite the alpha console
initialization to be identical to all other platforms. In a nutshell:
call cninit().
The platform specific code now only sets or clears RB_SERIAL and thus
automaticly causes the right console to be selected.

sio.c:
o Replace the remote GDB hacks and use the GDB debug port interface
instead.
o Make debugging code conditional upon KDB instead of DDB.
o Call kdb_alt_break() instead of db_alt_break().
o Call kdb_enter() instead of breakpoint().
o Remove the ugly compatibility of using the console as the debug
port.


# 131373 30-Jun-2004 phk

Define the tty methods as typedefs.

Change the return type for t_break to void.

Add t_ioctl (more about this later).


# 131242 28-Jun-2004 jhb

- Shorten the names for the TTY related swi interrupt handlers as the
'tty:' prefix is largely redundant.
- Fix the priority of the low-priority TTY SWIs that are hung off of the
softclock thread.

Submitted by: bde (2)


# 131185 27-Jun-2004 phk

Guard against us having no tty pointer.


# 131134 26-Jun-2004 phk

Pick the hotchar out of the tty structure instead of caching private
copies.

No current line disciplines have a dynamically changing hotchar, and
expecting to receive anything sensible during a change in ldisc is
insane so no locking of the hotchar field is necessary.


# 131094 25-Jun-2004 phk

Use generic support for modemcontrol and BREAK ioctls.


# 130938 22-Jun-2004 phk

Remove the TIOCDCDTIMESTAMP option.

The RFC-2783 PPS-API (<sys/timepps.h>) provides better and more
configurable service.


# 130892 21-Jun-2004 phk

Put the pre FreeBSD-2.x tty compat code under BURN_BRIDGES.


# 130872 21-Jun-2004 phk

Give control devices their own cdevsw{} so that we can eliminate them
from the trafic functions.

Do not use com_addr() when we don't need it.


# 130585 16-Jun-2004 phk

Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.


# 130344 11-Jun-2004 phk

Deorbit COMPAT_SUNOS.

We inherited this from the sparc32 port of BSD4.4-Lite1. We have neither
a sparc32 port nor a SunOS4.x compatibility desire these days.


# 130096 04-Jun-2004 phk

Centralize the line discipline optimization determination in a function
called ttyldoptim().

Use this function from all the relevant drivers.

I belive no drivers finger linesw[] directly anymore, paving the way for
locking and refcounting.


# 130095 04-Jun-2004 phk

Manual edits to change linesw[]-frobbing to ttyld_*() calls.


# 130077 04-Jun-2004 phk

Machine generated patch which changes linedisc calls from accessing
linesw[] directly to using the ttyld...() functions

The ttyld...() functions ar inline so there is no performance hit.


# 130057 04-Jun-2004 phk

Make the remaining serial drivers call ttyioctl() rather than calling
the linedisc directly.


# 129939 01-Jun-2004 phk

There is no need to explicitly call the stop function. In all likelyhood
->l_close() did it and ttyclose certainly will.


# 129937 01-Jun-2004 phk

There is no need to explicitly call ttwakeup() and ttwwakeup() after
ttyclose() has been called. It's already been done once by ttyclose,
and probably once by the line-discipline too.


# 129934 01-Jun-2004 phk

ttyclose() increments t_gen. Remove redundant increments in drivers.


# 128899 03-May-2004 ambrisko

Remove new options and my prevention of system freeze when the sio probe
returns okay when HW probe fails. This happens when comconsole flag is
set but VGA console is used instead.

Back out requested by: bde (He will be looking at other solutions from scratch)


# 128781 30-Apr-2004 ambrisko

Some enhancements and bug fix.
- Define option FORCECONSPEED to force the serial console to
be CONSPEED. I've run into a lot of boards in which
the detect for prior speed doesn't work and ends up with
broken console since it is at the wrong speed.
- If a serial port is marked as a console, but console=vidconsole
and if the serial ports doesn't exist it will be probed and
attached at a 8250 chip. Then writes to that will freeze the
system.
- Add an option flags 0x400000 to mark this as a potential
comconsole in-case the one flaged with 0x10 does not exist
in the system.

This makes it easier to deploy on systems with one or two serial ports.

Obtained from: IronPort


# 128020 07-Apr-2004 imp

Back out last bad commit (again!)


# 128019 07-Apr-2004 imp

Remove advertising clause from University of California Regent's
license, per letter dated July 22, 1999 and email from Peter Wemm,
Alan Cox and Robert Watson.

Approved by: core, peter, alc, rwatson


# 127979 07-Apr-2004 imp

Last change was a bogus


# 127977 07-Apr-2004 imp

Remove advertising clause from University of California Regent's
license, per letter dated July 22, 1999 and email from Peter Wemm,
Alan Cox and Robert Watson.

Approved by: core, peter, alc, rwatson


# 127157 18-Mar-2004 njl

Back out code for auto-gdb detection that accidentally leaked into the
bus_alloc_resource_any commit.

Submitted by: bde
Pointy-hat: njl


# 127135 17-Mar-2004 njl

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


# 126080 21-Feb-2004 phk

Device megapatch 4/6:

Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.


# 126078 21-Feb-2004 phk

Device megapatch 3/6:

Add missing D_TTY flags to various drivers.

Complete asserts that dev_t's passed to ttyread(), ttywrite(),
ttypoll() and ttykqwrite() have (d_flags & D_TTY) and a struct tty
pointer.

Make ttyread(), ttywrite(), ttypoll() and ttykqwrite() the default
cdevsw methods for D_TTY drivers and remove the explicit initializations
in various drivers cdevsw structures.


# 126076 21-Feb-2004 phk

Device megapatch 1/6:

Free approx 86 major numbers with a mostly automatically generated patch.

A number of strategic drivers have been left behind by caution, and a few
because they still (ab)use their major number.


# 124669 18-Jan-2004 ru

Fixed a memory leak.

Submitted by: Stanford Metacompilation research group


# 123796 24-Dec-2003 bde

Fixed breakage of a check for boolean true by misusing NULL in rev.1.407.
This became fatal when the type of NULL was changed recently.


# 122844 17-Nov-2003 bde

Tweaked the siointr1() so that it works better at 921600 bps, especially
with multiple ports on a shared interrupt demultiplexed by the puc_intr()
handler.

siointr1() first read as much input as possible and then checked all
possibly-relevant status registers, partly for robustness and partly
for historical reasons. This is very bad if it is called for every
port sharing an interrupt like puc_intr() does. It can spend too long
reading all the input for some ports when the interrupt is for a more
urgent event on another, or just too long checking all the status
registers when there are lots of ports. The inter-character time is
too long for reading all the input even when the interrupt is for a
transmitter interrupt on the same port, and at 921600 bps the inter-char
time is 10.85 usec and was often exceeded with just 2 ports, leaving
the transmitters idle for about 6% of the time.

The tweak is to break out of the read loop after reading 1 char if
output can be done. This avoids most of the idle transmitter time for
2 active ports at 921600 bps bidirectional on the test system. It
also reduces overhead by about 20%. More complete fixes use the
programmable tx low watermark on 16950's and reduce overhead by another
65%.


# 122819 16-Nov-2003 bde

Don't waste so much space for the latency debugging buffer. Its size
will now need editing except for spot checks.

Changed this buffer from a circular one to a linear one. This is more
useful for some cases and the sysctl that prints it doesn't support
circular buffers.

Fixed (output) formatting bugs in this sysctl. An off by 1 error caused
a garbage byte to be returned after annotation of large deltas, and
a race with the writer sometimes caused premature string termination.


# 120553 28-Sep-2003 bde

Removed some nearly dead code in comparam(). We don't need to recover
from fiddling with CS_TTGO since fiddling with CS_TTGO was removed in
rev.1.218 of the i386/isa version (which was merged with loss of history
in rev.1.223 of this version).


# 120505 27-Sep-2003 bde

Cleaned up and fixed setting of speeds in comparam():
- Removed conversion of a zero input speed to the output speed. This
has been done better in ttioctl() since rev.1.108 of kern/tty.c
almost 5 years ago. comparam() did the conversion incompletely for
the case where the output speed is also zero. It had complications
to avoid using zero speeds, but would still have used a zero input
speed for setting watermarks if kern/tty.c had passed one.
- Never permit the input speed to be different from the output speed.
There was no validity check on the input speed for the case of a zero
output speed. Then we didn't change the physical speeds, but we used
the unvalidated input speed for setting watermarks and didn't return
an error, so ttioctl() stored the unvalidated input speed in the tty
struct where it could cause problems later.
- Removed complications that were to avoid using a divisor of 0. The
divisor is now always valid if the speed is accepted.


# 120495 26-Sep-2003 phk

Fix compilation on alpha.


# 120468 26-Sep-2003 bde

Use the correct speed in the delay for the transmission of a character
in the loopback test in the probe. The delay was too short for consoles
at speeds lower than about 3200 bps. This shouldn't have caused many
problems, since such low speeds are rare and the probe is forced to
succeed for consoles.


# 120457 26-Sep-2003 phk

Adhere to the new console API:
Initialize cn_name
Use cn_unit for internal housekeeping.
Forget about cn_dev.


# 120189 18-Sep-2003 bde

Fixed most of the remaining style bugs in rev.1.194. Mainly better
wording in comments.


# 120175 17-Sep-2003 bde

Miscellaneous minor style fixes (mainly for unsorting of the flags access
macros).


# 120173 17-Sep-2003 bde

Fixed bitrot in the probe in revs.1.127, 1.165 and 1.169. The
COM_NOFIFO() and COM_ESP cases are supposed to be a subsets of the
plain 16550A case, but 16650-related changes made the former fall into
the latter and then both fall into general code for printing the tx
fifo size. This mainly caused hard to parse boot messages like:
"sio0: type 16550A fifo disabled lookalike with 1 bytes FIFO".
COM_NOFIFO() on an ESP port gave a larger mess whose extent is not
clear.

Fixed some nearby style bugs.


# 120159 17-Sep-2003 bde

Cleaned up initialization of hardware flow control for 16650As. Use
defined values instead of hard-coded values. Don't repeat the register
access part of the code 4 times times or triple-space statements. This
fixes half of the style bugs in rev.1.172.

Hardware flow control of 16650As is still officially unsupported. I
was mistaken about it being broken. It is broken in 16650s but is
fixed in 16650As except for the maximum trigger level (which is no
longer used). Testing of the 16650's broken hardware flow control
watermarks by programming them on 16950s showed that their effects are
not too bad if the fifo size and trigger level are reasonably large
(16 is much better than 8).


# 120091 15-Sep-2003 bde

Quick fix for a pessimization in rev.1.194. An extra i/o instruction
was added to the fast path to support the COM_IIR_RXRDYBUG() case even
when that case is not configured. This increased the relative overhead
of sio input by almost 25% in the worst case and by 2-3% in the usual
case (usually only about 0.2% absolute per port at 115200 bps). The
quick fix is to significantly pessimize only the COM_IIR_RXRDYBUG()
case.


# 119517 28-Aug-2003 njl

Remove a duplicate comment.

Pointed out by: bde


# 119485 26-Aug-2003 njl

Use the db_alt_break() state machine instead of rolling our own. This
brings sio(4) in-line with zs(4) et al.


# 119419 24-Aug-2003 obrien

Use __FBSDID().
Also some minor style cleanups.


# 117167 02-Jul-2003 jhb

- Use the new resource_disabled() helper function to see if devices are
disabled.
- Change the apm driver to match the acpi driver's behavior by checking to
see if the device is disabled in the identify routine instead of in the
probe routine. This way if the device is disabled it is never created.

Note that a few places (ips(4), Alpha SMP) used "disable" instead of
"disabled" for their hint names, and these hints must be changed to
"disabled". If this is a big problem, resource_disabled() can always be
changed to honor both names.


# 116120 09-Jun-2003 scottl

Track the resource id of the memory port instead of just assuming that
it is 0x0. Cardbus-based sio/modem cards can now be ejected without
panic'ing.


# 115481 31-May-2003 phk

Remove extra unused variable.

Found by: FlexeLint


# 114722 05-May-2003 obrien

Revert rev 1.396 -- it broke the Alpha kernel build.


# 114334 30-Apr-2003 peter

Eliminate a compiler warning with gcc3.3 on AMD64, where speed is
a 32 bit int which can never be > ULONG_MAX / 8. Its an 'always true'
warning.


# 114293 30-Apr-2003 markm

Fix some easy, global, lint warnings. In most cases, this means
making some local variables static. In a couple of cases, this means
removing an unused variable.


# 114216 29-Apr-2003 kan

Deprecate machine/limits.h in favor of new sys/limits.h.
Change all in-tree consumers to include <sys/limits.h>

Discussed on: standards@
Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>


# 112384 18-Mar-2003 sobomax

Brucify.

Requested and reviewed by: bde
MFC after: 2 weeks


# 112275 15-Mar-2003 sobomax

Remove duplicate line introduced in the previous commit.

Submitted by: bde
MFC after: 2 weeks


# 112270 15-Mar-2003 sobomax

- Add minimal support for TI16754 4xUART chip into sio(4) driver and remove
now unnecessary hack from the previous commit;
- Add support for Interrupt Latch Register (ILR) into puc(4). So far only
ILRs compatible with specifications from Digi International are supported.
Support for other types of ILRs could be easily added later;
- Correct clock frequency for IC Book Labs Dreadnought x16 Lite board;
- Enable ILR detection/usage for IC Book Labs Dreadnought x16 boards.

Sponsored by: IC Book Labs
MFC after: 2 weeks


# 112154 12-Mar-2003 sobomax

Add initial support for IC Book Labs Dreadnought x16 Pro 16-ports card. Since
this card is based on 16750 UART, modify sio(4) a bit to ignore 16750-specific
7th bit of MCR when probing card. This allows card to be detected and attached
as 16550A-compatible device. More work needs to be done in order to enable
nice 16750-specific features such as larger fifo buffer and higher speeds.

Sponsored by: IC Book Labs
MFC after: 2 weeks


# 111821 03-Mar-2003 phk

Make nokqfilter() return the correct return value.

Ditch the D_KQFILTER flag which was used to prevent calling NULL pointers.


# 111815 03-Mar-2003 phk

Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by: re(scottl)


# 111616 27-Feb-2003 phk

Typo, I must have hit xZZ in vi(1).


# 111613 27-Feb-2003 phk

Make flags bit 0x10000 mean that PPS timestamping should use the
CTS instead of the DCD pin.


# 111194 20-Feb-2003 phk

Change the console interface to pass a "struct consdev *" instead of a
dev_t to the method functions.

The dev_t can still be found at struct consdev *->cn_dev.

Add a void *cn_arg element to struct consdev which the drivers can use
for retrieving their softc.


# 111017 16-Feb-2003 phk

Change "dev_t gdbdev" to "void *gdb_arg", some possible paths for GDB
will not have a dev_t.


# 111002 16-Feb-2003 phk

Remove #include <sys/dkstat.h>


# 110249 02-Feb-2003 phk

Set si_drv1 to our softc for all the six dev_t's we create for a serial port.


# 104933 11-Oct-2002 imp

s/modunload/kldunload


# 104094 28-Sep-2002 phk

Be consistent about "static" functions: if the function is marked
static in its prototype, mark it static at the definition too.

Inspired by: FlexeLint warning #512


# 104067 27-Sep-2002 phk

Add yet a quick flag to sio: 0x100000 "Scratch pad register missing".

The advanced stage of computer assisted hardware design and
verification is aptly illustrated by the fact that this is necessary
because only the first ports in a single-chip, dual-port async
PC-Card product lacks this register.


# 103795 22-Sep-2002 phk

Move the com_scr register address definition over with the other seven.

Approved by: bde


# 102542 28-Aug-2002 phk

Only try to flush the FIFO of 500 characters, return EIO if that fails.

This at least prevents the total hang of the machine when I open a
PCCARD sio device on -current, but it does not solve the problem.


# 98691 23-Jun-2002 n_hibma

set siocnunit to the correct value. This fixes the freeze on boot for
alphas.

Submitted by: Bernd Walter <ticso@cicely5.cicely.de>


# 98619 22-Jun-2002 n_hibma

Make this compile on Alpha.


# 98401 18-Jun-2002 n_hibma

Make the speed used by gdb over serial settable in the kernel configuration.

This facilitates the use in circumstances where you are using a serial
console as well. GDB doesn't support anything higher than 9600 baud (19k2
if you are lucky), but the console does.


# 95523 26-Apr-2002 phk

Simplify the RFC2783 and PPS_SYNC timestamp collection API.


# 93818 04-Apr-2002 jhb

Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on: i386, alpha, sparc64


# 93593 01-Apr-2002 jhb

Change the suser() API to take advantage of td_ucred as well as do a
general cleanup of the API. The entire API now consists of two functions
similar to the pre-KSE API. The suser() function takes a thread pointer
as its only argument. The td_ucred member of this thread must be valid
so the only valid thread pointers are curthread and a few kernel threads
such as thread0. The suser_cred() function takes a pointer to a struct
ucred as its first argument and an integer flag as its second argument.
The flag is currently only used for the PRISON_ROOT flag.

Discussed on: smp@


# 93470 31-Mar-2002 bde

Support more than 32 sio unit numbers. The maximum unit number is now
(65536 * 32 - 1), but MAKEDEV only supports up to (32 * 32 -1). Device
names use the unit number in base 32 for all "digits".

This required fixing an old bug in MAKEDEV:ttyminor(). Its arg was the
global $unit instead of $1.

Reminded by: Valentin K. Ponomarenko <valka@krog.ukrtel.net>
MFC-after: 1 week


# 93466 31-Mar-2002 bde

Hacks for measuring interrupt latency. Interrupt latency can be
measured accurately for periodic interrupts provided the interrupts
don't need to be serviced very quickly to keep their period almost
constant. sio output interrupts have this property (interrupt service
can be delayed for up to 1 character time without the period changing).

This is non-optional and undocumented so that it can be added and
removed easily. It has no significant effect unless it is enabled by
hacking on a variable using a debugger. Hardclock and statclock interrupts
would work even better for this, at least on i386's, provided their
interrupt handlers are fast (as they are in -current but not in -stable
or in my version of -current).


# 93126 25-Mar-2002 mike

Include <machine/limits.h> for definition of ULONG_MAX.


# 93010 23-Mar-2002 bde

Fixed some style bugs in the removal of __P(()). The main ones were
not removing tabs before "__P((", and not outdenting continuation lines
to preserve non-KNF lining up of code with parentheses. Switch to KNF
formatting and/or rewrap the whole prototype in some cases.


# 92739 20-Mar-2002 alfred

Remove __P.


# 92401 16-Mar-2002 imp

Add device ID for Xircom modem. Also add work around from gwk@sgi.com
to put the device into 8 bit mode a second time. This appears to have
no ill effects on other devices, and appears to be necessary for the
xircom modem.

Submitted by: gwk@sgi.com, many others that found his patch in the archives.


# 91280 26-Feb-2002 imp

Until I can figure out how to live without the volatile qualifier on
comdefaultrate, comment out the support for machdep.conspeed for now.


# 91276 26-Feb-2002 imp

Add an experimental tunable: machdep.conspeed.

# I'm not sure where to document this.


# 89986 30-Jan-2002 jhay

Add support for different serial clock frequencies and not just the
standard one of 1.8432MHz. This will be used by the puc (PCI
"universal" communication card) device driver.

Reviewed by: bde


# 89470 17-Jan-2002 bmah

Cosmetic fix: Not every machine that uses the sio driver has a BIOS.

Pointed out by: imp


# 89463 17-Jan-2002 imp

While I'm not sure that I like the wording of the BIOS message in the
previous commit, it should always print due to lack of {} around the
second line in the if statement. The message should likely say
something more like "There's no hardware responding at this IRQ.
Device not present (or disbaled)," but that is too long. We generally
don't give elementary advise in device driver messages anyway. Be
that as it may, the problem with it printing all the time should be
corrected.


# 89447 17-Jan-2002 bmah

Make sio device probe messages less misleading, for the case that
a port is either disabled or not responding.

PR: 33963
Submitted by: Kevin Oberman <oberman@es.net>
MFC after: 2 weeks


# 88900 05-Jan-2002 jhb

Change the preemption code for software interrupt thread schedules and
mutex releases to not require flags for the cases when preemption is
not allowed:

The purpose of the MTX_NOSWITCH and SWI_NOSWITCH flags is to prevent
switching to a higher priority thread on mutex releease and swi schedule,
respectively when that switch is not safe. Now that the critical section
API maintains a per-thread nesting count, the kernel can easily check
whether or not it should switch without relying on flags from the
programmer. This fixes a few bugs in that all current callers of
swi_sched() used SWI_NOSWITCH, when in fact, only the ones called from
fast interrupt handlers and the swi_sched of softclock needed this flag.
Note that to ensure that swi_sched()'s in clock and fast interrupt
handlers do not switch, these handlers have to be explicitly wrapped
in critical_enter/exit pairs. Presently, just wrapping the handlers is
sufficient, but in the future with the fully preemptive kernel, the
interrupt must be EOI'd before critical_exit() is called. (critical_exit()
can switch due to a deferred preemption in a fully preemptive kernel.)

I've tested the changes to the interrupt code on i386 and alpha. I have
not tested ia64, but the interrupt code is almost identical to the alpha
code, so I expect it will work fine. PowerPC and ARM do not yet have
interrupt code in the tree so they shouldn't be broken. Sparc64 is
broken, but that's been ok'd by jake and tmm who will be fixing the
interrupt code for sparc64 shortly.

Reviewed by: peter
Tested on: i386, alpha


# 88582 28-Dec-2001 bde

Fixed locking bugs in rev.1.346:

(1) Don't attempt aquire the non-recursive lock sio_lock recursively.
Doing so caused unbounded recursion in some setups. E.g., if DDB,
BREAK_TO_DEBUGGER and WITNESS are configured; if the debugger is
entered using a break, then WITNESS will actually detect the invalid
recursion and will add to it attempting to print a message about it.

(2) Don't use sio_lock before it has been initialized. The old check
(sio_inited != 0) didn't work when sio_inited was boolean because
sio_inited was set too early, and became just wrong when sio_inited
was changed to a tri-state variable in rev.1.348.

Reported and fixed in another way by: fenner (1)


# 88451 23-Dec-2001 tanimura

Fix typo first, then controvert.


# 88433 23-Dec-2001 dillon

Back out an inappropriate backout. If Anyone wants to set the FIFO
level that high they should first fix the problems with the system that
cause silo overflows. It is far more important for the serial device
to work.


# 88432 23-Dec-2001 bde

Backed out previous unapproved commit.


# 88431 22-Dec-2001 dillon

This problem has been in the serial driver for years, and I occassionally
see people trip over it. Do not set the FIFO trigger to just before it
would otherwise overflow. Give it a little more slop so characters aren't
lost if the interrupt is delayed by other system activities.

MFC maybe: 7 days


# 86909 26-Nov-2001 imp

bde suggests that sio really wants to manage its own softc. This
allows us to move the sio softc data structure back into sio.c and
reduce the complexity of the non sio.c sio files.

Submitted by: bde

# I didn't fix the locking issues that bruce also submitted.


# 85426 24-Oct-2001 jlemon

cn_tab no longer exists, use cnadd() to add a console device. Note that
this may result in duplicate console output in some cases.


# 85371 23-Oct-2001 jlemon

Add a siocnterm function for the CONS_DRIVER function vector.


# 85365 23-Oct-2001 imp

Break out the bus front ends into their own files. Rewrite
sio_pccard_detach to use new siodetach. Add an extra arg to sioprobe
to tell driver to probe/not probe the device for IRQs.

This incorporates most of Bruce's review material. I'm at a good
checkpoint, but there will be more to come based on bde's further
reviews.

Reviewed by: bde


# 85302 22-Oct-2001 imp

First commit after a repo copy of isa/sio* -> dev/sio:

Move sio from isa/sio.c to dev/sio/sio.c. The next step is to break
out the front end attachments, improve support for these parts on
different busses, and maybe, if we're lucky, merging in pc98 support.
It will also be MI and live in conf/files rather than files.*.

Approved by: bde
Tested with: i386, pc98


# 85209 20-Oct-2001 jhb

- Make the sio_inited handling more properly MP safe.
- If we are booting with a serial console, then pass the MTX_QUIET flag to
mtx_init of the sio lock as otherwise KTR_VERBOSE simply doesn't work.


# 84103 29-Sep-2001 jlemon

Add support for 28800 baud to sio.

PR: 30906
Submitted by: "Daniel O'Connor" <darius@chowder.dons.net.au>


# 84029 27-Sep-2001 jlemon

Gate low level console output on mtx_lock_spin(&sio_lock), if the
sio_lock has been initialized. This prevents the low level console
output (kernel printf) from clobbering the sio settings if the system
happens to be in the middle of comstart().


# 83832 22-Sep-2001 dfr

Tweak so I can use a serial console on ia64.


# 83546 16-Sep-2001 murray

Recognize two cheap PCI 16550 devices :

CyberSerial (1-port) 16550
Oxford Semiconductor Dual Port 16550

Sort the list of PCI devices while I'm here.


# 83366 12-Sep-2001 julian

KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after: ha ha ha ha


# 83246 09-Sep-2001 dd

Add a missing newline to an error message.

PR: 30436
Submitted by: Joerg Lehners <Lehners@Informatik.Uni-Oldenburg.DE>


# 82696 31-Aug-2001 murray

Add ID for the Best Data Smart One 56SPS Voice modem.

PR: kern/24851
Submitted by: Daniel Rudy <dcrudy@aol.com>


# 82685 31-Aug-2001 murray

Add OMRON ME5614ISA PnP modem.

PR: kern/22801
Submitted by: Ryuzo Okada <R.Okada@mm.neweb.ne.jp>


# 82682 31-Aug-2001 murray

Add PCI device IDs for Kuotech dual port serial cards.
Also give example of the flags needed to use these cards.

PR: kern/21242
Submitted by: Shigeki Moride <moride@portside.net>


# 82555 30-Aug-2001 msmith

Add ACPI attachments.


# 81793 16-Aug-2001 imp

Fix the so-called "half-baked-probe" code that I wrote a long time ago
to properly clear the interrupt register on the no error case. Also,
set the mcr register to zero when we find we can't support the chip.

This fixes the hang on sio driver attach problem in the new pci pccard
code that some people have reported. At least on my machine. I'd
like to get this into 4.4.

Submitted by: bde
PR: kern/29742

MFC after: 1 day


# 78504 20-Jun-2001 iedowse

The serial console break-to-debugger support only functioned while
the console device was open. At other times, the interrupts that
are used to detect the break signal or ~^B sequence were disabled,
so these events would not be noticed until the next open (e.g. the
next kernel printf). This was mainly a problem while there was no
getty running on the console, such as during bootup or shutdown.

For serial consoles with break-to-debugger support, we now enable
the generation of interrupts at attach time, and we leave them
enabled while the device is closed.

Reviewed by: bde (I've since made chages as per his suggestions)


# 77750 05-Jun-2001 imp

Close the line displine on detach. Lots of folks have submittd this, and
I think bde even reviewed it once.

Also, change the name of ActionTEC pat to more generic Lucent Kermit
chip. Add stub for Xircom card. Add cardbus attachment too.


# 77726 04-Jun-2001 joerg

Move out the files from src/sys/isa/ic/ to src/sys/dev/ic/, so they
can be made userland-visible as <dev/ic/...>. Also, those files are
not supposed to contain any bus-specific details at all, so placing
them under .../isa/ has been a misnomer from the beginning.

The files in src/sys/dev/ic/ have been repo-copied from their old
location (this commit is a forced null commit there to record this
message).


# 77222 26-May-2001 sanpei

add Dualmode Zoom/FaxModem 56K (internal) Model 2919

PR: kern/27476
Submitted by: Eric Beyer <lnxfrk@earthlink.net>


# 76869 20-May-2001 sanpei

Add SmartLink 5634PCV SurfRider

PR: kern/26952
Submitted by: Simon Dick <simond@irrelevant.org>


# 76650 15-May-2001 jhb

Remove unneeded includes of sys/ipl.h and machine/ipl.h.


# 76166 01-May-2001 markm

Undo part of the tangle of having sys/lock.h and sys/mutex.h included in
other "system" header files.

Also help the deprecation of lockmgr.h by making it a sub-include of
sys/lock.h and removing sys/lockmgr.h form kernel .c files.

Sort sys/*.h includes where possible in affected files.

OK'ed by: bde (with reservations)


# 74810 26-Mar-2001 phk

Send the remains (such as I have located) of "block major numbers" to
the bit-bucket.


# 73961 07-Mar-2001 sanpei

Add GVC1601 - Rockwell V.34 Plug & Play Modem

PR: kern/25204
Submitted by: Victor Ivanov <v0rbiz@icon.bg>


# 73960 07-Mar-2001 sanpei

Add IOD0081 - I-O DATA DEVICE,INC. IFML-560

PR: kern/25173
Submitted by: Yohsuke Fujikawa <yohsuke@mx2.nisiq.net>


# 72521 15-Feb-2001 jlemon

Extend kqueue down to the device layer.

Backwards compatible approach suggested by: peter


# 72358 11-Feb-2001 markm

RIP <machine/lock.h>.

Some things needed bits of <i386/include/lock.h> - cy.c now has its
own (only) copy of the COM_(UN)LOCK() macros, and IMASK_(UN)LOCK()
has been moved to <i386/include/apic.h> (AKA <machine/apic.h>).
Reviewed by: jhb


# 72238 09-Feb-2001 jhb

- Catch up to the new swi API changes:
- Use swi_* function names.
- Use void * to hold cookies to handlers instead of struct intrhand *.
- In sio.c, use 'driver_name' instead of "sio" as the name of the driver
lock to minimize diffs with cy(4).


# 72200 09-Feb-2001 bmilekic

Change and clean the mutex lock interface.

mtx_enter(lock, type) becomes:

mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)

similarily, for releasing a lock, we now have:

mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.

The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.

Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:

MTX_QUIET and MTX_NOSWITCH

The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:

mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.

Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.

Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.

Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.

Finally, caught up to the interface changes in all sys code.

Contributors: jake, jhb, jasone (in no particular order)


# 71880 31-Jan-2001 peter

Remove count for NSIO. The only places it was used it were incorrect.
(alpha-gdbstub.c got sync'ed up a bit with the i386 version)


# 70356 26-Dec-2000 tanimura

Add OZO8008 - Zoom (33.6k Modem).

PR: kern/23336
Submitted by: Paulo Menezes <root@samurai.dee.uc.pt>


# 70174 18-Dec-2000 jhb

Convert the sio driver to use a spin mutex instead of a s_lock. This is
going to hurt sio(4) performance for the time being. As we get closer to
release and have more of the kernel unlocked we can come back to doing
arcane optimizations to workaround the limitations of the sio hardware.


# 67551 25-Oct-2000 jhb

- Overhaul the software interrupt code to use interrupt threads for each
type of software interrupt. Roughly, what used to be a bit in spending
now maps to a swi thread. Each thread can have multiple handlers, just
like a hardware interrupt thread.
- Instead of using a bitmask of pending interrupts, we schedule the specific
software interrupt thread to run, so spending, NSWI, and the shandlers
array are no longer needed. We can now have an arbitrary number of
software interrupt threads. When you register a software interrupt
thread via sinthand_add(), you get back a struct intrhand that you pass
to sched_swi() when you wish to schedule your swi thread to run.
- Convert the name of 'struct intrec' to 'struct intrhand' as it is a bit
more intuitive. Also, prefix all the members of struct intrhand with
'ih_'.
- Make swi_net() a MI function since there is now no point in it being
MD.

Submitted by: cp


# 66920 10-Oct-2000 tanimura

Add MAE0021 - Jetstream Int V.90 56k Voice Series 2.

PR: i386/19920
Submitted by: Peter Ortner <port@iname.com>


# 66822 08-Oct-2000 bde

Use schedsofttty() again so that siopoll() gets scheduled as designed
(SMPng casualty in rev.1.308 with wrong fix in rev.1.310).


# 66698 05-Oct-2000 jhb

- Heavyweight interrupt threads on the alpha for device I/O interrupts.
- Make softinterrupts (SWI's) almost completely MI, and divorce them
completely from the x86 hardware interrupt code.
- The ihandlers array is now gone. Instead, there is a MI shandlers array
that just contains SWI handlers.
- Most of the former machine/ipl.h files have moved to a new sys/ipl.h.
- Stub out all the spl*() functions on all architectures.

Submitted by: dfr


# 66230 22-Sep-2000 jhb

- Wrap functions and variables that aren't used in the alpha console probe
with #ifndef __alpha__/#endif
- Add function prototypes for functions used during the alpha console
probe and gdb port setup inside of #ifdef __alpha__/#endif.


# 65822 13-Sep-2000 jhb

- Remove the inthand2_t type and use the equivalent driver_intr_t type from
newbus for referencing device interrupt handlers.
- Move the 'struct intrec' type which describes interrupt sources into
sys/interrupt.h instead of making it just be a x86 structure.
- Don't create 'ithd' and 'intrec' typedefs, instead, just use 'struct ithd'
and 'struct intrec'
- Move the code to translate new-bus interrupt flags into an interrupt thread
priority out of the x86 nexus code and into a MI ithread_priority()
function in sys/kern/kern_intr.c.
- Remove now-uneeded x86-specific headers from sys/dev/ata/ata-all.c and
sys/pci/pci_compat.c.


# 65715 11-Sep-2000 jhb

Forced commit to note that the previous commit only applied to the alpha
architecture. Also, forgot an acknowledgement:

Detective help from: wpaul


# 65714 11-Sep-2000 jhb

Add a nasty hack to get remote kernel gdb working from ddb. ddb would
complain before that a suitable gdb port had not been setup because gdbdev
was NULL. This abuses the fact that the gdb port is hard-coded to the
address normally assigned to sio1 and thus hard-codes in sio1 as the gdb
port. Yuck.


# 65605 08-Sep-2000 jhb

Back out my previous commit as well as some SMPng changes to revert the
siosetwater() function to its previous behavior of always disabling
interrupts and obtaining the com_lock before returning.

Requested by: bde (in principle)


# 65602 08-Sep-2000 grog

siointr1: Schedule soft interrupt when needed. This fixes the "no
interrupt" problem people had seen with SMPng.

Approved by: jasone
Tested by: bp


# 65596 07-Sep-2000 jhb

Fix a problem where we would recursively try to get the com lock within
comparam when calling siosetwater().

Noticed by: bp


# 65557 06-Sep-2000 jasone

Major update to the way synchronization is done in the kernel. Highlights
include:

* Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The
alpha port is still in transition and currently uses both.)

* Per-CPU idle processes.

* Interrupts are run in their own separate kernel threads and can be
preempted (i386 only).

Partially contributed by: BSDi (BSD/OS)
Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh


# 65469 05-Sep-2000 sheldonh

Add ZTIA001 - Zoom Internal V90 Faxmodem.

PR: 21028
Submitted by: Glenn Johnson <glennpj@charter.net>


# 65438 04-Sep-2000 sheldonh

Add Boca K56Flex PnP modem.

PR: 21000
Submitted by: Andrew Sparrow <spadger@best.com>


# 65131 27-Aug-2000 phk

Call destroy_dev() when sio devices go away.


# 64688 15-Aug-2000 peter

Add another USR modem.

PR: 20621
Submitted by: Masanori Taira <mtaira@logicaleffect.com>


# 62573 04-Jul-2000 phk

Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.

Pointed out by: bde


# 62454 03-Jul-2000 phk

Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:

Sanitize SYSCTL_HANDLER_ARGS so that simplistic tools can grog our
sources:

-sysctl_vm_zone SYSCTL_HANDLER_ARGS
+sysctl_vm_zone (SYSCTL_HANDLER_ARGS)


# 61649 14-Jun-2000 ps

Add option ALT_BREAK_TO_DEBUGGER.

Implement the Solaris way to break into DDB over a serial console
instead of sending a break. Sending the character sequence
CR ~ ^b will break the kernel into DDB (if DDB is enabled).

Reviewed by: peter


# 60947 26-May-2000 tanimura

Add SUP1670 - Supra 336i V+ Intl. Since we update the PnP IDs
more frequently than the core part of the sio driver, it might
be good to move the PnP IDs to sio_isapnp.h or something like
that.

PR: i386/18828
Submitted by: J.P. King <jpk28@cam.ac.uk>


# 60708 19-May-2000 tanimura

Add RSS0262 - 5614Jx3[G] V90+K56Flex Modem.

PR: kern/18168
Submitted by: Tony Voet <voet@engineer.com>


# 60696 19-May-2000 tanimura

Add ACH2012 - 5634BTS 56K Video Ready Modem.

PR: kern/17351
Submitted by: Eric D. Futch <efutch@nyct.net>


# 60674 18-May-2000 tanimura

Add a couple of new PnP IDs.

o OZO800f - Zoom 2812 (56k Modem)
PR: kern/18603
Submitted by: Matt Loschert <loschert@servint.com>

o DAV0336 - DAVICOM 336PNP MODEM
PR: kern/18608
Submitted by: Martijn Plak <martijn@be3.com>


# 60471 12-May-2000 nyan

Use bus_space stuff except where it needs high performance.

Reviewed by: bde


# 59888 02-May-2000 tanimura

Add the logical ID of FUJITSU Modem 33600 PNP/I2.

PR: kern/18257
Submitted by: Takanori Watanabe <takawata@shidahara1.planet.sci.kobe-u.ac.jp>


# 58885 01-Apr-2000 imp

Add support for pci modems. ONLY CONTROLLER BASED MODEMS. This
doesn't support winmodems, softmodems, hcf or any other modem that
relies on the host to do any sort of soft control for any aspect of
the modem's function. There are two modems known to work:
3COM FaxModem PCI.
ActionTec 56k VoiceMessaging PCI Modem
and the following modem might work
Multitech PCI FaxModem (not sure about this)
and the serial pci cards might work too. I have neither these
hardware items so I can't add support for them.


# 58848 31-Mar-2000 peter

Recognize USR3050 "U.S. Robotics 56K FAX INT" fax modem.

PR: 17702
Submitted by: Scot W. Hetzel <hetzels@westbend.net>


# 58377 20-Mar-2000 phk

Isolate the Timecounter internals in their own two files.

Make the public interface more systematically named.

Remove the alternate method, it doesn't do any good, only ruins performance.

Add counters to profile the usage of the 8 access functions.

Apply the beer-ware to my code.

The weird +/- counts are caused by two repocopies behind the scenes:
kern/kern_clock.c -> kern/kern_tc.c
sys/time.h -> sys/timetc.h
(thanks peter!)


# 57915 11-Mar-2000 imp

Fix crashes on card eject for pccard modems. We check for NULL when
we get the com address. If so, we go ahead and return. Bruce thinks
there's a bug in the pccard layer that it terminates devices with
extreme prejustice rather than letting them deside for themselves when
to terminate (and he's likely right). This fix doesn't change that,
but instead works around it by checking for NULL pointers at more
places than before.

The detach routine still calls functions at interrupt level that
aren't reentrant. In theory this could cause a problem, but none
showed up in practice. Future versions should correct this problem,
likely by making the detach process a thread/process at the pccard
level. NEWCARD will do this, and the current pccard layer should
likely be modified to that as well, should it live long enough.

A few style nits of the same form that were in my original patch sent
off to bde were also fixed as part of this process. Mostly use of
!ptr and return ENOPARENS.

This should prevent a crash on suspend with an active ppp link as
well, but that wasn't tested.

Reviewed by: bde
Approved by: jkh


# 57769 05-Mar-2000 peter

Recognize another modem, "PMC2430 - Pace 56 Voice Internal Modem"

Submitted by: Mark Ovens <mark@ukug.uk.freebsd.org>


# 57680 02-Mar-2000 peter

Fix two more problems with freeing the softc data manually. subr_bus.c
is responsible for this and this will lead to malloc 'freeing already
free' type panics. One was in the probe code, the other was in the
pccard eject? code.

Not explicitly approved by: jkh (but the first is fallout from subr_bus.c
rev 1.54 which was an approved commit, the second is the same problem)


# 57234 15-Feb-2000 bde

Fixed regressions in rev.1.274:
1) Non-AST4 multiport cards were broken by bypassing the code that changes
`idev' to the multiport master device.
2) AST4 multiport cards apparently were broken by inverting the test for
the master device having an irq.
3) Error handling for nonexistent master devices was broken by removing a
check for a null pointer.
4) `int' error codes returned by bus_get_resource() were assigned directly
to the boolean variable com->no_irq. Probably harmless, since the
boolean is implemented as a u_char.

Submitted by: part 1) by Chris Radek <cradek@in221.inetnebr.com>
part 2) by yokota
Approved by: jkh


# 56788 29-Jan-2000 bde

"Completed" the previous fix. Return ENOMEM on memory allocation failure
in sioattach(), not ENXIO. Free resources before returning early in
sioprobe() and sioattach().


# 56461 23-Jan-2000 n_hibma

Return ENXIO on error, not 0. Seems to have been skipped when converting
to newbus.

Reviewed by: bde


# 56229 18-Jan-2000 peter

Add another four device ID's for isa pnp modems. The USR's seem to use
the same vendor and logical ID. The rest I am not sure whether they
are vendor or logical, but it won't hurt if I've put a vendor ID here
as merely will not match. These came from the old sio-pnp code, hence
the uncertainty about which ID it is.


# 55868 13-Jan-2000 gallatin

Make this compile on alpha


# 55823 11-Jan-2000 yokota

Add a new mechanism, cndbctl(), to tell the console driver that
ddb is entered. Don't refer to `in_Debugger' to see if we
are in the debugger. (The variable used to be static in Debugger()
and wasn't updated if ddb is entered via traps and panic anyway.)

- Don't refer to `in_Debugger'.
- Add `db_active' to i386/i386/db_interface.d (as in
alpha/alpha/db_interface.c).
- Remove cnpollc() stub from ddb/db_input.c.
- Add the dbctl function to syscons, pcvt, and sio. (The function for
pcvt and sio is noop at the moment.)

Jointly developed by: bde and me

(The final version was tweaked by me and not reviewed by bde. Thus,
if there is any error in this commit, that is entirely of mine, not
his.)

Some changes were obtained from: NetBSD


# 55124 27-Dec-1999 peter

Recognize the GVC0505 (GVC 56k Faxmodem) as a sio device.

Obtained from: Dan J Fraser <dfraser@capybara.org> (for NetBSD)


# 54944 21-Dec-1999 peter

Extract a list of extra isa pnp modem ID's from NetBSD and OpenBSD. Some
of these are bound to have a PNP05xx compatid, but there's no easy way to
tell. Since it's just an ID list and uses the pnp header's description
strings rather than encoding strings here, it doesn't seem to be too
expensive to err on the safe side.


# 54920 20-Dec-1999 peter

Add SUP2070 (Diamond SupraExpress 56i)
Submitted by: Kenneth Wayne Culver <culverk@wam.umd.edu>

Add MOT4560
Obtained from: wollman


# 54386 10-Dec-1999 imp

o Make pccard work at all by including card.h
o fix return type of sio_pccard_detach
o don't free softc in deatch, since that is done by newbus
o disconnect interrupt we used to have. Add cookie to com so that we can
tear down the interrupt on unload
o Set gone earlier, but likely doesn't matter

This makes sio pccards work again. Cards that are active when ejects may
not work (but they might, softc goes away quickly).

These changes are unreviewed by bde. I'll make any style changes he wants.


# 54206 06-Dec-1999 peter

Fix a pair of silly warnings that I introduced (that would have been
nasty on an Alpha or some other sizeof(int) != sizeof(long) machine).


# 54194 06-Dec-1999 peter

Use bus_get_resource() instead of bus_get_resource_start() as the latter
returns "0" on failure, which is indistinguishable from (say) irq 0. This
should stop a couple of stray messages that turn up.

Also, if a BUS_SETUP_INTR() fails with INTR_TYPE_FAST, try falling back to
a normal interrupt. This might help pccard folks with a shared slot
interrupt. This whole thing needs to be revisited.


# 53978 01-Dec-1999 imp

Fix the hang on card eject problem and maybe the hang on suspend
problem.

o Create new timeout routine so we don't detach the card inside a ISR
but instead drop back to spl0 via a timeout of 0.
o Actually delete the child of the pccard device rather than just faking
it badly.
o Fix sio, ed and ep to have pccard detach routines that are int rather
than void.
o Fix ep and ed pccard detach routines to use if_detach rather than just
if_down. if_detach destroys the device, while if_down just marks it
down. In this incarnation of the pccard things, we map the disable
the slot action to detach the driver, which removes the driver from the
device tree. When that is done, a panic would soon follow as the
ifconfig tried to down the device.

Didn't fix:
o Should cache the pccard dev child's pointer in struct slot
o remove now unused parts of struct slot
o Any driver using softc after detach has been called. sio's softc used
to be statically allocated, so you could check sc->gone, but that is
now gone.
o Didn't remove gone from softc of drivers that use the old pccard method.

Didn't test:
o ed driver changes
o sio driver changes on pccards
o suspend (no laptop or apm support on my desktop)


# 53370 18-Nov-1999 peter

Argh, don't turn the IIR test on unless it's a pccard. These tests mess
up the subsequent probes.


# 53344 18-Nov-1999 peter

Merge some typo fixes from dev/sio/sio.c (siostop -> comstop)
Remove EXTRA_SIO/NSIOTOT and make it fully dynamic (from dev/sio/sio.c)
Make sio work for pccard here - pccardd doesn't activate interrupts
until after prove has succeeded.
Mark the initial reset of likely sio ports as broken as it depended on
config supplying a list of locations to probe, devices are now proved
standalone.
Optimize a bit of COM_NOAST4() logic.
Use bus_get_resource_start() etc rather than using isa-centric calls.
Reactivate the IIR_TXRDYBUG test, I've got a card here with it.
Try to be a bit smarter about activating interrupts (ie: don't panic
if polled)
Fix some style bugs that have crept in over time (there are still more).


# 52585 28-Oct-1999 imp

Last change to pccard_nbk now obviates the need to check the name of
the device in question.
Also fix warnings on if_ep_pccard.c


# 52471 25-Oct-1999 imp

Add newbus pccard attachment for sio. Some of this code was written
by Peter Wemm, but I've not merged all the changes he sent to me yet.
This has not been reviewed by bde, so I'm committing to resolve any
issues he has with this when he returns from FreeBSD CON 99.

I've had four reports of this working for them. I've been able to
communicate to both my built in modem and a pccard modem with these
patches.


# 52125 11-Oct-1999 steve

Add support for the USRobotics Courier V.Everything (USR0101) modem.

Submitted by: Robert Blayzor <robert@superior.net>


# 51918 03-Oct-1999 deischen

Change pnp ID for the SupraExpress 56i Sp V.90 modem (logical ID
0x8024b04e) so that the cards description is used instead of overriding
it. While I'm here, add an ID for the SUP2080 and the SUP2030.

PR: kern/13983
Submitted by: Kurt D. Zeilenga <Kurt@OpenLDAP.Org> (SUP2030)
dfr (rest of change)
Reviewed by: dfr


# 51912 03-Oct-1999 deischen

Add logical device ID for the Diamond SupraExpress 56K PnP modem:

Vendor ID SUP2480 (0x8024b04e), Serial Number 0x00001334
PnP Version 1.0, Vendor Version 0
Device Description: SupraExpress 56i Sp V.90

Reviewed by: dfr


# 51658 25-Sep-1999 phk

Remove five now unused fields from struct cdevsw. They should never
have been there in the first place. A GENERIC kernel shrinks almost 1k.

Add a slightly different safetybelt under nostop for tty drivers.

Add some missing FreeBSD tags


# 51654 25-Sep-1999 phk

This patch clears the way for removing a number of tty related
fields in struct cdevsw:

d_stop moved to struct tty.
d_reset already unused.
d_devtotty linkage now provided by dev_t->si_tty.

These fields will be removed from struct cdevsw together with
d_params and d_maxio Real Soon Now.

The changes in this patch consist of:

initialize dev->si_tty in *_open()
initialize tty->t_stop
remove devtotty functions
rename ttpoll to ttypoll
a few adjustments to these changes in the generic code
a bump of __FreeBSD_version
add a couple of FreeBSD tags


# 51088 08-Sep-1999 peter

Make it build, copy from dev/sio/sio.c:
isa_set_flags -> device_set_flags
isa_get_flags -> device_get_flags


# 51078 08-Sep-1999 peter

Restore the old sio* - bruce can fix it himself.