History log of /freebsd-11-stable/sys/dev/syscons/syscons.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 331722 29-Mar-2018 eadler

Revert r330897:

This was intended to be a non-functional change. It wasn't. The commit
message was thus wrong. In addition it broke arm, and merged crypto
related code.

Revert with prejudice.

This revert skips files touched in r316370 since that commit was since
MFCed. This revert also skips files that require $FreeBSD$ property
changes.

Thank you to those who helped me get out of this mess including but not
limited to gonzo, kevans, rgrimes.

Requested by: gjb (re)


# 330919 14-Mar-2018 eadler

MFC r316136:

The switch to kernel terminal context needs to update more than the cursor
position. Especially the screen size, and potentially everything except
the input state and attributes. Do this by changing the cursor position
setting method to a general syncing method.

Use proper constructors instead of copying to create kernel terminal
contexts. We really want clones and not new instances, but there is
no method for cloning and there is nothing in the active instance that
needs to be cloned exactly.

Add proper destructors for kernel terminal contexts. I doubt that the
destructor code has every been reached, but if it was then it leaked the
memory of the clones.

Remove freeing of statically allocated memory for the non-kernel terminal
context for the same terminal as the kernel. This is in the nearly
unreachable code. This used to not happen because delicate context
swapping made the user context use the dynamic memory and kernel
context the static memory. I didn't restore this swapping since it
would have been unnatural to have all kernel contexts except 1 dynamic.

The constructor for terminal context has bad layering for reasons
related to the bug. It has to return static memory early before
malloc() works. Callers also can't allocate memory until after the
first constructor selects an emulator and tells upper layers the size
of its context. After that, the cloning hack required the cloning
code to allocate the memory, but for all other constructors it would
be better for the terminal layer to allocate and deallocate the
memory in all cases.

Zero the memory when allocating terminal contexts dynamically.


# 330918 14-Mar-2018 eadler

MFC r315984:

Restore switching to a separate kernel terminal "input" state and extend
it to a separate state for each CPU.

Terminal "input" is user or kernel output. Its state includes the current
parser state for escape sequences and multi-byte characters, and some
results of previous parsing (mainly attributes), and in teken the cursor
position, but not completed output. This state must be switched for kernel
output since the kernel can preempt anything, including itself, and this
must not affect the preempted state more than necessary. Since vty0 is
shared, it is necessary to affect the frame buffer and cursor position and
history, but escape sequences must not be affected and attributes for
further output must not be affected.

This used to work. The syscons terminal state contained mainly the parser
state for escape sequences and attributes, but not the cursor position,
and was switched. This was first broken by SMP and/or preemptive kernels.
Then there should really be a separate state for each thread, and one more
for ddb, or locking to prevent preemption. Serialization of printf() helps.
But it is arcane that full syscons escape sequences mostly work in kernel
printf(), and I have never seen them used except by me to test this fix.
They worked perfectly except for the races, since "input" from the kernel
was not special in any way.

This was broken to use teken. The general switch was removed, and the
kernel normal attribute was switched specially. The kernel reverse
attribute (config option SC_CONS_REVERSE_ATTR) became unused, and is
still unusable because teken doesn't support default reverse attributes
(it used to only be used via the ANSI escape sequence to set reverse
video).

The only new difficulty for using teken seems to be that the cursor
position is in the "input" state, so it must be updated in the active
input state for each half of the switch. Do this to complete the
restoration.

The per-CPU state is mainly to make per-CPU coloring work cleanly, at
a cost of some space. Each CPU gets its own full set of attribute
(not just the current attribute) maintained in the usual way. This
also reduces races from unserialized printf()s. However, this gives
races for serialized printf()s that otherwise have none. Nothing
prevents the CPU doing the a printf() changing in the middle of an
escape sequence.


# 330915 14-Mar-2018 eadler

MFC r315003,r315065,r315066:

Rename scteken_revattr() to scteken_sc_to_te_attr(). scteken_revattr()
looked like it might handle reverse attributes, but it actually handles
conversion of attributes in the direction indicated by the new name.
Reverse attributes are just broken.

Rename scteken_attr() to scteken_te_to_sc_attr(). scteken_attr() looked
like it might give teken attributes, but it actually gives sc attributes.

Change scteken_te_to_sc_attr() to return int instead of unsigned int.
u_char would be enough, and it promotes to int, and syscons uses int
or u_short for its attributes everywhere else (u_short holds a shifted
form and it promotes to int too).

Add a scteken_set_cursor() (sc to teken) method and use it to fix
some cases of initialization and resetting of the teken cursor position.
(This bad name is consistent with others, but it is too easy to confuse
with scteken_cursor() which goes in the opposite direction.)

The following cases were broken:
- for booting without a syscons console, the teken and sc positions for
ttyv0 were (0, 0), but are supposed to be somewhere in the middle of
the screen (after carefully preserved BIOS and loader messages) (at
least if there is no mode switch that loses the messages).
- after mode switches, the screen is cleared and the cursor is supposed to
be moved to (0, 0), but it was only moved there for sc.

The following case was hacked to work:
- for booting with a syscons console, it was arranged that scteken_init()
for the console could see a nonzero cursor position and adjust, although
this broke the sc seeing it in the non-console case above.

Fix the attribute for scteken_clear() (change it back from the user
user default normal attribute to the current attribute).

This change only fixes a logic error. scterm_clear() used to be
used for terminal reset, but teken uses a general fill function for
that, leaving scterm_clear() only used for initialization and mode
change, when using the user default attribute is correct. It is not
really a terminal function, but needs to sync its changes with the
terminal layer. Syncing of the attribute is currently broken for
terminal reset, but works for initialization and mode change.


# 330914 14-Mar-2018 eadler

MFC r315000:

Start fixing some bugs in attribute handling.

This change just does cleanups missed in r56043 17 years ago. The
default attributes were still stored in structs for the purpose of
changing them and passing around pointers to the defaults, but r56043
added another layer that made the defaults invariant and only used for
initialization and reset. Just use the defaults directly. This was
already done for the kernel defaults. The defaults for reverse
attributes aren't actually used, but are ignored in layers that no
longer support them.


# 330913 14-Mar-2018 eadler

MFC r314641,r314646,r314997,r315390:

Colorize syscons kernel console output according to a table indexed
by the CPU number.

This was originally for debugging near-deadlock conditions where
multiple CPUs either deadlock or scramble each other's output trying
to report the problem, but I found it interesting and sometimes
useful for ordinary kernel messages. Ordinary kernel messages
shouldn't be interleaved, but if they are then the colorization
makes them readable even if the interleaving is for every character
(provided the CPU printing each message doesn't change).

The default colors are 8-15 starting at 15 (bright white on black)
for CPU 0 and repeating every 8 CPUs. This works best with 8 CPUs.
Non-bright colors and nonzero background colors need special
configuration to avoid unreadable and ugly combinations so are not
configured by default. The next bright color after 15 is 8 (bright
black = dark gray) is not very readable but is the only other color
used with 2 CPUs. After that the next bright color is 9 (bright
blue) which is not much brighter than bright black, but is used with
3+ CPUs. Other bright colors are brighter.

Colorization is configured by default so that it gets tested. It can
only be turned off by configuring SC_KERNEL_CONS_ATTR to anything other
than FG_WHITE. After booting, all colors can be changed using the
syscons.kattr sysctl. This is a SYSCTL_OPAQUE, and no utility is
provided to change it (sysctl only displays it).

The default colors work in all VGA modes that I could test. In 2-color
graphics modes, all 8 bright colors are displayed as bright white, so
the colorization has no effect, but anything with a nonzero background
gives white on white unless the foreground is zero. I don't have an
mono or VGA grayscale hardware to test on. Support for mono mode seems
to have never worked right in syscons (I think bright white gives white
underline with either bold or bright), but VGA grayscale should work
better than 2-color graphics.

Implement ec_putc() (emergency kernel [syscons] console putc()) and use
it in emergency in sc_cnputc().

Locking fixes in sc_cnputc() previously turned off normal output in
near-deadlock conditions and added deferred output which might never
be completed. Emergency output goes to the frame buffer using
sufficiently atomic non-blocking writes if the console is in text
mode (in graphics mode, nothing is done, modulo races setting the
graphics mode bit). Screen updates overwrite the emergency output
if the emergency condition clears enough to reach them.

ec_putc() also works for "early" console output in normal x86 text
mode as soon as this mode is initialized (if ever). This uses a
hard-coded x86 frame buffer address before cninit() and a hopefully
MI address after cninit(). But non-x86 is more likely to not support
text mode, when ec_putc() will be null. ec_putc() has no dependencies
of syscons before cninit(), and only has them later to track syscons'
mode changes. This commit doesn't attach ec_putc() for early use.

To test emergency use, put a breakpoint in central syscons output code
like sc_puts() and do some user output. The system used to race or
deadlock in ddb output soon after entry to ddb. The locking fixes
deferred the output until after leaving ddb, so ddb was unusable and
you had to try typing c[ontinue] blindly until it exited, or better use
a serial console in parallel. Now the output goes to a window in the
middle 2/3 of the screen. Scrolling is circular and there is no cursor,
but otherwise ec_putc() provides full dumb terminal functionality and
very fast output that hides artificates from dumb overwrites.


# 330912 14-Mar-2018 eadler

MFC r305121,r305231:

Add some locking to sc_cngetc().

Keyboard input needs Giant locking, and that is not possible to do
correctly here. Use mtx_trylock() and proceed unlocked as before if
we can't acquire Giant (non-recursively), except in kdb mode don't
even try to acquire Giant. Everything here is a hack, but it often
works. Even if mtx_trylock() succeeds, this might be a LOR.

Keyboard input also needs screen locking, to handle screen updates
and switches. Add this, using the same simplistic screen locking
as for sc_cnputc().

Giant must be acquired before the screen lock, and the screen lock
must be dropped when calling the keyboard driver (else it would get a
harmless LOR if it tries to acquire Giant). It was intended that sc
cn open/close hide the locking calls, and they do for i/o functions
functions except for this complication.

Non-console keyboard input is still only Giant-locked, with screen
locking in some called functions. This is correct for the keyboard
parts only.

When Giant cannot be acquired properly, atkbd and kbdmux tend to race
and work (they assume that the caller acquired Giant properly and don't
try to acquire it again or check that it has been acquired, and the
races rarely matter), while ukbd tends to deadlock or panic (since it
does the opposite, and has other usb threads to deadlock with).

The keyboard (Giant) locking here does very little, but the screen
locking completes screen locking for console mode except for not
detecting or handling deadlock.

The log message for the previous commit didn't mention the most the
important detail that sc_cngetc() now opens and closes the keyboard
on every call again. This was moved from sc_cngetc() to scn_cngrab/
ungrab() in r228644, but the change wasn't quite complete. After
fixes for nesting in kbdd_poll() in ukbd and kbdmux, these opens
and closes should have no significant effect if done while grabbed.
They fix unusual cases when cngetc() is called while not grabbed.

This commit is the main fix for screen locking in sc_cnputc():
detect deadlock or likely-deadlock and handle it by buffering the
output atomically and printing it later if the deadlock condition
clears (and sc_cnputc() is called).

The most common deadlock is when the screen lock is held by ourself.
Then it would be safe to acquire the lock recursively if the console
driver is calling printf() in a safe context, but we don't know when
that is. It is not safe to ignore the lock even in kdb or panic mode.
But ignore it in panic mode. The only other known case of deadlock
is when another thread holds the lock but is running on a stopped CPU.
Detect that case approximately by using trylock and retrying for 1000
usec. On a 4 GHz CPU, 100 usec is almost long enough -- screen switches
take slightly longer than that. Not retrying at all is good enough
except for stress tests, and planned future versions will extend the
timeout so that the stress tests work better.

To see the behaviour when deadlock is detected, single step through
sctty_outwakeup() (or sc_puts() to start with deadlock). Another
(serial) console is needed to the buffered-only output, but the
keyboard works in this context to continue or step out of the
deadlocked region. The buffer is not large enough to hold all the
output for this.


# 330910 14-Mar-2018 eadler

MFC r305059:

Start adding locking to sc_cngetc().

Restore an splx() lost in r228644. We aren't nearly ready to remove
spl's. They give hints about missing locking. This lost one was
misplaced. Dropping it early for convenience gave race windows for
accesses to the fkey buffer. Giant locking accidentally fixed this
for non-console cases.

Put the spl's around the whole function. Since there are many returns
that would need splx() just before them for a direct fix, split the
function into a wrapper that does the spl's and a "locked" function
that does the work.

Return earlier when no keyboard is attached to match the ordering in a
planned version. This breaks the dubious feature of returning keys
from the fkey buffer after the keyboard has gone away. Losing the keys
wouldn't matter, but we keep them too long now.


# 330909 14-Mar-2018 eadler

MFC r305010:

Add screen locking calls to sc cn grab and ungrab. The locking functions
just use the same mutex locking as sc cn putc so they have the same
defects.

The locking calls to acquire the lock are actually in sc cn open and close.
Ungrab has to unlock, although this opens a race window.

Change the direct mutex lock calls in sc cn putc to the new locking
functions via the open and close functions. Putc also has to unlock, but
doesn't keep the screen open like grab. Screen open and close reduce to
locking, except screen open for grab also attempts to switch the screen.

Keyboard locking is more difficult and still null, even when keyboard
input calls screen functions, except some of the functions have locks
too deep to work right.

This organization gives a single place to fix some of the locking.


# 330897 14-Mar-2018 eadler

Partial merge of the SPDX changes

These changes are incomplete but are making it difficult
to determine what other changes can/should be merged.

No objections from: pfg


# 330896 14-Mar-2018 eadler

MFC r304804:

Less-quick fix for locking fixes in r172250. r172250 added a second
syscons spinlock for the output routine alone. It is better to extend
the coverage of the first syscons spinlock added in r162285. 2 locks
might work with complicated juggling, but no juggling was done. What
the 2 locks actually did was to cover some of the missing locking in
each other and deadlock less often against each other than a single
lock with larger coverage would against itself. Races are preferable
to deadlocks here, but 2 locks are still worse since they are harder
to understand and fix.

Prefer deadlocks to races and merge the second lock into the first one.

Extend the scope of the spinlocking to all of sc_cnputc() instead of
just the sc_puts() part. This further prefers deadlocks to races.

Extend the kdb_active hack from sc_puts() internals for the second lock
to all spinlocking. This reduces deadlocks much more than the other
changes increases them. The s/p,10* test in ddb gets much further now.
Hide this detail in the SC_VIDEO_LOCK() macro. Add namespace pollution
in 1 nested #include and reduce namespace pollution in other nested
#includes to pay for this.

Move the first lock higher in the witness order. The second lock was
unnaturally low and the first lock was unnaturally high. The second
lock had to be above "sleepq chain" and/or "callout" to avoid spurious
LORs for visual bells in sc_puts(). Other console driver locks are
already even higher (but not adjacent like they should be) except when
they are missing from the table. Audio bells also benefit from the
syscons lock being high so that audio mutexes have chance of being
lower. Otherwise, console drviver locks should be as low as possible.
Non-spurious LORs now occur if the bell code calls printf() or is
interrupted (perhaps by an NMI) and the interrupt handler calls
printf(). Previous commits turned off many bells in console i/o but
missed ones done by the teken layer.


# 330895 14-Mar-2018 eadler

MFC r304773,r304800:

Flesh out the state and flags args to sccnopen(). Set state flags to
indicate (potentially partial) success of the open. Use these to
decide what to close in sccnclose(). Only grab/ungrab use open/close
so far.

Add a per-sc variable to count successful keyboard opens and use
this instead of the grab count to decide if the keyboad state has
been switched.

Start fixing the locking by using atomic ops for the most important
counter -- the grab level one. Other racy counting will eventually
be fixed by normal mutex or kdb locking in most cases.

Use a 2-entry per-sc stack of states for grabbing. 2 is just enough
to debug grabbing, e.g., for gets(). gets() grabs once and might not
be able to do a full (or any) state switch. ddb grabs again and has
a better chance of doing a full state switch and needs a place to
stack the previous state. For more than 3 levels, grabbing just
changes the count. Console drivers should try to switch on every i/o
in case lower levels of nesting failed to switch but the current level
succeeds, but then the switch (back) must be completed on every i/o
and this flaps the state unless the switch is null. The main point
of grabbing is to make it null quite often. Syscons grabbing also
does a carefully chosen screen focus that is not done on every i/o.

Add a large comment about grabbing.

Restore some small lost comments.


# 330893 14-Mar-2018 eadler

MFC r304758:

Reorganise a little to prepare for locking fixes:
- in sccnopen(), open the keyboard before the screen. The keyboard
currently requires Giant (although it must be spinlocked to work
correctly as a console), so the previous order would be a LOR if
it has any semblance of locking.
- add a (currently dummy) state arg to scgetc().


# 330892 14-Mar-2018 eadler

MFC r304173,r304181,r304186:

Fix restoring the kbd_mode part of the keyboard state in grab/ungrab.
Simply change the mode to K_XLATE using a local variable and use the
grab level as a flag to tell screen switches not to change it again,
so that we don't need to switch scp->kbd_mode. We did the latter,
but didn't have the complications to update the keyboard mode switch
for every screen switch. sc->kbd_mode remains at its user setting
for all scp's and ungrabbing restores to it.

Restructure the grabbing functions into mere wrappers of new open and
close functions. Scattered calls to sc_cnputc() and sc_cngetc() were
broken by turning the semi-reentrant inline context-switching code in
these functions into the grabbing functions. cncheckc() calls for
panic dumps are the main broken case. The grabbing functions have
special behaviour (mainly screen switching in sc_cngrab()) which makes
them unsuitable as replacements for the inline code.

Clean up the new sc cn open and close functions (old sc cn grab and ungrab
functions). Mainly, spell sc as itself instead of as scp->sc.


# 330838 13-Mar-2018 eadler

MFC r304164:

Disable some more unsafe things in (low level) console mode:
- never call up to the tty layer to restart output for keyboard input in
console mode. This was already disallowed in kdb mode. Other cases
are rarely reached.
- disable the reboot, halt and powerdown keys in console mode. The suspend,
standby and panic keys are still allowed, and aren't even conditonal
on excessive configuration options. Some of these actions are still
available in ddb mode as ddb commands which are equally unsafe. Some
are useful at input prompts and should be restored when the locking is
fixed.
- disallow bells in kdb mode (should be in console mode, but the flag for
that is not available). Visual bell gives very alarming behaviour by
trying to use callouts which don't work in kdb mode. Audio bell uses
timeouts and hardware resources with mutexes that can deadlock in
reasonable use of ddb.

Screen switches in kdb mode are not very safe, but they are important
functionality and there is a lot of code to make them sort of work.


# 330836 13-Mar-2018 eadler

MFC r304165,r304166:

Like scr_lock, the grab count needs to be per-physical-device to work.

This bug corrupted the grab count on both vtys if the ungrabbed vty is
different from the console, and failed to restore the keyboard state
on the ungrabbed vty, but not restoring the latter usually left the
keyboard mode part of it uncorrupted at 1 (K_XLATE), while after this
fix the keyboard mode part is usually corrupted to 0 (K_RAW).

While here, rename the grab count from 'grabbed' to grab_level.


# 330833 13-Mar-2018 eadler

MFC r304161:

Change all uses of 'debugger' to kdb_active and remove this variable. This
restores avoidance of doing dangerous things like calling wakeup() and
callouts while in ddb.

Initialization of 'debugger' was broken by removing the cndbctl() console
method that was used mainly in this driver to initialize 'debugger' and
switch to the console screen on entry to ddb. The screen switch was
restored using the cngrab() method, but cngrab() is more general so it
should not initialize 'debugger' and never did. 'debugger' was just
an over-engineered alias for kdb_active anyway. It existed because
kdb_active (when it was named ddb_active) was considered as a private
kdb variable, and there are ordering problems initializing the variables
atomically with the state that they represent, but an extra variable and
method to set it increased these problems.

The bug caused LORs, but WITNESS is normally misconfigured with
WITNESS_SKIPSIN so it doesn't check the spinlocks used by wakeup() and
callouts.


# 330832 13-Mar-2018 eadler

MFC r304153:

Quick fix for locking fixes in r172250. The lock added there was per-
virtual-device, but needs to be per-physical-device so that it protects
shared data. Usually, scp->sc->write_in_progress got corrupted first
and further corruption was limited when this variable was left at nonzero
with no write in progress.

Attempt to fix missing lock destruction in r162285. Put it with the
lock destruction for r172250 after moving the latter. Both might be
unreachable.

To demonstrate the bug, find a buggy syscall or sysctl that calls
printf(9) and run this often. Run hd /dev/zero >/dev/ttyvN for any
N != 0. The console spam goes to ttyv0 and the non-console spam goes
to ttyvN, so the lock provided no protection (but it helped for
N == 0).


# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

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


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 298955 03-May-2016 pfg

sys/dev: minor spelling fixes.

Most affect comments, very few have user-visible effects.


# 284959 30-Jun-2015 markm

Huge cleanup of random(4) code.

* GENERAL
- Update copyright.
- Make kernel options for RANDOM_YARROW and RANDOM_DUMMY. Set
neither to ON, which means we want Fortuna
- If there is no 'device random' in the kernel, there will be NO
random(4) device in the kernel, and the KERN_ARND sysctl will
return nothing. With RANDOM_DUMMY there will be a random(4) that
always blocks.
- Repair kern.arandom (KERN_ARND sysctl). The old version went
through arc4random(9) and was a bit weird.
- Adjust arc4random stirring a bit - the existing code looks a little
suspect.
- Fix the nasty pre- and post-read overloading by providing explictit
functions to do these tasks.
- Redo read_random(9) so as to duplicate random(4)'s read internals.
This makes it a first-class citizen rather than a hack.
- Move stuff out of locked regions when it does not need to be
there.
- Trim RANDOM_DEBUG printfs. Some are excess to requirement, some
behind boot verbose.
- Use SYSINIT to sequence the startup.
- Fix init/deinit sysctl stuff.
- Make relevant sysctls also tunables.
- Add different harvesting "styles" to allow for different requirements
(direct, queue, fast).
- Add harvesting of FFS atime events. This needs to be checked for
weighing down the FS code.
- Add harvesting of slab allocator events. This needs to be checked for
weighing down the allocator code.
- Fix the random(9) manpage.
- Loadable modules are not present for now. These will be re-engineered
when the dust settles.
- Use macros for locks.
- Fix comments.

* src/share/man/...
- Update the man pages.

* src/etc/...
- The startup/shutdown work is done in D2924.

* src/UPDATING
- Add UPDATING announcement.

* src/sys/dev/random/build.sh
- Add copyright.
- Add libz for unit tests.

* src/sys/dev/random/dummy.c
- Remove; no longer needed. Functionality incorporated into randomdev.*.

* live_entropy_sources.c live_entropy_sources.h
- Remove; content moved.
- move content to randomdev.[ch] and optimise.

* src/sys/dev/random/random_adaptors.c src/sys/dev/random/random_adaptors.h
- Remove; plugability is no longer used. Compile-time algorithm
selection is the way to go.

* src/sys/dev/random/random_harvestq.c src/sys/dev/random/random_harvestq.h
- Add early (re)boot-time randomness caching.

* src/sys/dev/random/randomdev_soft.c src/sys/dev/random/randomdev_soft.h
- Remove; no longer needed.

* src/sys/dev/random/uint128.h
- Provide a fake uint128_t; if a real one ever arrived, we can use
that instead. All that is needed here is N=0, N++, N==0, and some
localised trickery is used to manufacture a 128-bit 0ULLL.

* src/sys/dev/random/unit_test.c src/sys/dev/random/unit_test.h
- Improve unit tests; previously the testing human needed clairvoyance;
now the test will do a basic check of compressibility. Clairvoyant
talent is still a good idea.
- This is still a long way off a proper unit test.

* src/sys/dev/random/fortuna.c src/sys/dev/random/fortuna.h
- Improve messy union to just uint128_t.
- Remove unneeded 'static struct fortuna_start_cache'.
- Tighten up up arithmetic.
- Provide a method to allow eternal junk to be introduced; harden
it against blatant by compress/hashing.
- Assert that locks are held correctly.
- Fix the nasty pre- and post-read overloading by providing explictit
functions to do these tasks.
- Turn into self-sufficient module (no longer requires randomdev_soft.[ch])

* src/sys/dev/random/yarrow.c src/sys/dev/random/yarrow.h
- Improve messy union to just uint128_t.
- Remove unneeded 'staic struct start_cache'.
- Tighten up up arithmetic.
- Provide a method to allow eternal junk to be introduced; harden
it against blatant by compress/hashing.
- Assert that locks are held correctly.
- Fix the nasty pre- and post-read overloading by providing explictit
functions to do these tasks.
- Turn into self-sufficient module (no longer requires randomdev_soft.[ch])
- Fix some magic numbers elsewhere used as FAST and SLOW.

Differential Revision: https://reviews.freebsd.org/D2025
Reviewed by: vsevolod,delphij,rwatson,trasz,jmg
Approved by: so (delphij)


# 277796 27-Jan-2015 avg

hook userland threads suspend + resume into acpi suspend code

Also, split power_suspend into power_suspend and power_suspend_early.

power_suspend_early is called before the userland is frozen.
power_suspend is called after the userland is frozen.

Currently only VT switching is hooked to power_suspend_early.
This is needed because switching away from X server requires its
cooperation, so obviously X server must not be frozen when that happens.

Freezing userland during ACPI suspend is useful because not all drivers
correctly handle suspension concurrent with other activity. This is
especially applicable to drivers ported from other operating systems
that suspend all software activity between placing drivers and hardware
into suspended state.
In particular drm2/radeon (radeonkms) depends on the described
procedure. The driver does not have any internal synchronization
between suspension activities and processing of userland requests.

Many thanks to kib for the code that allows to freeze and thaw all
userland threads.

Note that ideally we also need to park / inhibit (non-special) kernel
threads as well to ensure that they do not call into drivers.

MFC after: 17 days


# 267992 28-Jun-2014 hselasky

Pull in r267961 and r267973 again. Fix for issues reported will follow.


# 267985 27-Jun-2014 gjb

Revert r267961, r267973:

These changes prevent sysctl(8) from returning proper output,
such as:

1) no output from sysctl(8)
2) erroneously returning ENOMEM with tools like truss(1)
or uname(1)
truss: can not get etype: Cannot allocate memory


# 267965 27-Jun-2014 emaste

Use a common tunable to choose between vt(4)/sc(4)

With this change and previous work from ray@ it will be possible to put
both in GENERIC, and have one enabled by default, but allow the other to
be selected via the loader.

(The previous implementation had separate kern.vt.disable and
hw.syscons.disable tunables, and would panic if both drivers were
compiled in and neither was explicitly disabled.)

MFC after: 1 week
Sponsored by: The FreeBSD Foundation


# 267961 27-Jun-2014 hselasky

Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after: 2 weeks
Sponsored by: Mellanox Technologies


# 267625 18-Jun-2014 ray

Allow to disable syscons(4) if "hw.syscons.disable" kenv is set.

Sponsored by: The FreeBSD Foundation


# 256377 12-Oct-2013 markm

Merge from project branch. Uninteresting commits are trimmed.

Refactor of /dev/random device. Main points include:

* Userland seeding is no longer used. This auto-seeds at boot time
on PC/Desktop setups; this may need some tweeking and intelligence
from those folks setting up embedded boxes, but the work is believed
to be minimal.

* An entropy cache is written to /entropy (even during installation)
and the kernel uses this at next boot.

* An entropy file written to /boot/entropy can be loaded by loader(8)

* Hardware sources such as rdrand are fed into Yarrow, and are no
longer available raw.

------------------------------------------------------------------------
r256240 | des | 2013-10-09 21:14:16 +0100 (Wed, 09 Oct 2013) | 4 lines

Add a RANDOM_RWFILE option and hide the entropy cache code behind it.
Rename YARROW_RNG and FORTUNA_RNG to RANDOM_YARROW and RANDOM_FORTUNA.
Add the RANDOM_* options to LINT.

------------------------------------------------------------------------
r256239 | des | 2013-10-09 21:12:59 +0100 (Wed, 09 Oct 2013) | 2 lines

Define RANDOM_PURE_RNDTEST for rndtest(4).

------------------------------------------------------------------------
r256204 | des | 2013-10-09 18:51:38 +0100 (Wed, 09 Oct 2013) | 2 lines

staticize struct random_hardware_source

------------------------------------------------------------------------
r256203 | markm | 2013-10-09 18:50:36 +0100 (Wed, 09 Oct 2013) | 2 lines

Wrap some policy-rich code in 'if NOTYET' until we can thresh out
what it really needs to do.

------------------------------------------------------------------------
r256184 | des | 2013-10-09 10:13:12 +0100 (Wed, 09 Oct 2013) | 2 lines

Re-add /dev/urandom for compatibility purposes.

------------------------------------------------------------------------
r256182 | des | 2013-10-09 10:11:14 +0100 (Wed, 09 Oct 2013) | 3 lines

Add missing include guards and move the existing ones out of the
implementation namespace.

------------------------------------------------------------------------
r256168 | markm | 2013-10-08 23:14:07 +0100 (Tue, 08 Oct 2013) | 10 lines

Fix some just-noticed problems:

o Allow this to work with "nodevice random" by fixing where the
MALLOC pool is defined.

o Fix the explicit reseed code. This was correct as submitted, but
in the project branch doesn't need to set the "seeded" bit as this
is done correctly in the "unblock" function.

o Remove some debug ifdeffing.

o Adjust comments.

------------------------------------------------------------------------
r256159 | markm | 2013-10-08 19:48:11 +0100 (Tue, 08 Oct 2013) | 6 lines

Time to eat crow for me.

I replaced the sx_* locks that Arthur used with regular mutexes;
this turned out the be the wrong thing to do as the locks need to
be sleepable. Revert this folly.

# Submitted by: Arthur Mesh <arthurmesh@gmail.com> (In original diff)

------------------------------------------------------------------------
r256138 | des | 2013-10-08 12:05:26 +0100 (Tue, 08 Oct 2013) | 10 lines

Add YARROW_RNG and FORTUNA_RNG to sys/conf/options.

Add a SYSINIT that forces a reseed during proc0 setup, which happens
fairly late in the boot process.

Add a RANDOM_DEBUG option which enables some debugging printf()s.

Add a new RANDOM_ATTACH entropy source which harvests entropy from the
get_cyclecount() delta across each call to a device attach method.

------------------------------------------------------------------------
r256135 | markm | 2013-10-08 07:54:52 +0100 (Tue, 08 Oct 2013) | 8 lines

Debugging. My attempt at EVENTHANDLER(multiuser) was a failure; use
EVENTHANDLER(mountroot) instead.

This means we can't count on /var being present, so something will
need to be done about harvesting /var/db/entropy/... .

Some policy now needs to be sorted out, and a pre-sync cache needs
to be written, but apart from that we are now ready to go.

Over to review.

------------------------------------------------------------------------
r256094 | markm | 2013-10-06 23:45:02 +0100 (Sun, 06 Oct 2013) | 8 lines

Snapshot.

Looking pretty good; this mostly works now. New code includes:

* Read cached entropy at startup, both from files and from loader(8)
preloaded entropy. Failures are soft, but announced. Untested.

* Use EVENTHANDLER to do above just before we go multiuser. Untested.

------------------------------------------------------------------------
r256088 | markm | 2013-10-06 14:01:42 +0100 (Sun, 06 Oct 2013) | 2 lines

Fix up the man page for random(4). This mainly removes no-longer-relevant
details about HW RNGs, reseeding explicitly and user-supplied
entropy.

------------------------------------------------------------------------
r256087 | markm | 2013-10-06 13:43:42 +0100 (Sun, 06 Oct 2013) | 6 lines

As userland writing to /dev/random is no more, remove the "better
than nothing" bootstrap mode.

Add SWI harvesting to the mix.

My box seeds Yarrow by itself in a few seconds! YMMV; more to follow.

------------------------------------------------------------------------
r256086 | markm | 2013-10-06 13:40:32 +0100 (Sun, 06 Oct 2013) | 11 lines

Debug run. This now works, except that the "live" sources haven't
been tested. With all sources turned on, this unlocks itself in
a couple of seconds! That is no my box, and there is no guarantee
that this will be the case everywhere.

* Cut debug prints.

* Use the same locks/mutexes all the way through.

* Be a tad more conservative about entropy estimates.

------------------------------------------------------------------------
r256084 | markm | 2013-10-06 13:35:29 +0100 (Sun, 06 Oct 2013) | 5 lines

Don't use the "real" assembler mnemonics; older compilers may not
understand them (like when building CURRENT on 9.x).

# Submitted by: Konstantin Belousov <kostikbel@gmail.com>

------------------------------------------------------------------------
r256081 | markm | 2013-10-06 10:55:28 +0100 (Sun, 06 Oct 2013) | 12 lines

SNAPSHOT.

Simplify the malloc pools; We only need one for this device.

Simplify the harvest queue.

Marginally improve the entropy pool hashing, making it a bit faster
in the process.

Connect up the hardware "live" source harvesting. This is simplistic
for now, and will need to be made rate-adaptive.

All of the above passes a compile test but needs to be debugged.

------------------------------------------------------------------------
r256042 | markm | 2013-10-04 07:55:06 +0100 (Fri, 04 Oct 2013) | 25 lines

Snapshot. This passes the build test, but has not yet been finished or debugged.

Contains:

* Refactor the hardware RNG CPU instruction sources to feed into
the software mixer. This is unfinished. The actual harvesting needs
to be sorted out. Modified by me (see below).

* Remove 'frac' parameter from random_harvest(). This was never
used and adds extra code for no good reason.

* Remove device write entropy harvesting. This provided a weak
attack vector, was not very good at bootstrapping the device. To
follow will be a replacement explicit reseed knob.

* Separate out all the RANDOM_PURE sources into separate harvest
entities. This adds some secuity in the case where more than one
is present.

* Review all the code and fix anything obviously messy or inconsistent.
Address som review concerns while I'm here, like rename the pseudo-rng
to 'dummy'.

# Submitted by: Arthur Mesh <arthurmesh@gmail.com> (the first item)

------------------------------------------------------------------------
r255319 | markm | 2013-09-06 18:51:52 +0100 (Fri, 06 Sep 2013) | 4 lines

Yarrow wants entropy estimations to be conservative; the usual idea
is that if you are certain you have N bits of entropy, you declare
N/2.

------------------------------------------------------------------------
r255075 | markm | 2013-08-30 18:47:53 +0100 (Fri, 30 Aug 2013) | 4 lines

Remove short-lived idea; thread to harvest (eg) RDRAND enropy into the
usual harvest queues. It was a nifty idea, but too heavyweight.

# Submitted by: Arthur Mesh <arthurmesh@gmail.com>

------------------------------------------------------------------------
r255071 | markm | 2013-08-30 12:42:57 +0100 (Fri, 30 Aug 2013) | 4 lines

Separate out the Software RNG entropy harvesting queue and thread
into its own files.

# Submitted by: Arthur Mesh <arthurmesh@gmail.com>

------------------------------------------------------------------------
r254934 | markm | 2013-08-26 20:07:03 +0100 (Mon, 26 Aug 2013) | 2 lines

Remove the short-lived namei experiment.

------------------------------------------------------------------------
r254928 | markm | 2013-08-26 19:35:21 +0100 (Mon, 26 Aug 2013) | 2 lines

Snapshot; Do some running repairs on entropy harvesting. More needs
to follow.

------------------------------------------------------------------------
r254927 | markm | 2013-08-26 19:29:51 +0100 (Mon, 26 Aug 2013) | 15 lines

Snapshot of current work;

1) Clean up namespace; only use "Yarrow" where it is Yarrow-specific
or close enough to the Yarrow algorithm. For the rest use a neutral
name.

2) Tidy up headers; put private stuff in private places. More could
be done here.

3) Streamline the hashing/encryption; no need for a 256-bit counter;
128 bits will last for long enough.

There are bits of debug code lying around; these will be removed
at a later stage.

------------------------------------------------------------------------
r254784 | markm | 2013-08-24 14:54:56 +0100 (Sat, 24 Aug 2013) | 39 lines

1) example (partially humorous random_adaptor, that I call "EXAMPLE")
* It's not meant to be used in a real system, it's there to show how
the basics of how to create interfaces for random_adaptors. Perhaps
it should belong in a manual page

2) Move probe.c's functionality in to random_adaptors.c
* rename random_ident_hardware() to random_adaptor_choose()

3) Introduce a new way to choose (or select) random_adaptors via tunable
"rngs_want" It's a list of comma separated names of adaptors, ordered
by preferences. I.e.:
rngs_want="yarrow,rdrand"

Such setting would cause yarrow to be preferred to rdrand. If neither of
them are available (or registered), then system will default to
something reasonable (currently yarrow). If yarrow is not present, then
we fall back to the adaptor that's first on the list of registered
adaptors.

4) Introduce a way where RNGs can play a role of entropy source. This is
mostly useful for HW rngs.

The way I envision this is that every HW RNG will use this
functionality by default. Functionality to disable this is also present.
I have an example of how to use this in random_adaptor_example.c (see
modload event, and init function)

5) fix kern.random.adaptors from
kern.random.adaptors: yarrowpanicblock
to
kern.random.adaptors: yarrow,panic,block

6) add kern.random.active_adaptor to indicate currently selected
adaptor:
root@freebsd04:~ # sysctl kern.random.active_adaptor
kern.random.active_adaptor: yarrow

# Submitted by: Arthur Mesh <arthurmesh@gmail.com>

Submitted by: Dag-Erling Smørgrav <des@FreeBSD.org>, Arthur Mesh <arthurmesh@gmail.com>
Reviewed by: des@FreeBSD.org
Approved by: re (delphij)
Approved by: secteam (des,delphij)


# 253439 17-Jul-2013 jkim

Reload font when syscons(4) is resuming without switching mode.

Reported by: adrian (more than a year ago)
Prodded by: adrian (less than a month ago)


# 247792 04-Mar-2013 davide

MFcalloutng (r244249, r244306 by mav):
- Switch syscons from timeout() to callout_reset_flags() and specify that
precision is not important there -- anything from 20 to 30Hz will be fine.
- Reduce syscons "refresh" rate to 1-2Hz when console is in graphics mode
and there is nothing to do except some polling for keyboard. Text mode
refresh would also be nice to have adaptive, but this change at least
should help laptop users who running X.

Sponsored by: Google Summer of Code 2012, iXsystems inc.
Tested by: flo, marius, ian, markj, Fabian Keil


# 246397 06-Feb-2013 hselasky

Make sure that all mouse buttons are released when clients
using /dev/consolectl close. This fixes a problem where if
a USB mouse is detached while a button is pressed, that
button is never released.

MFC after: 1 week


# 239696 25-Aug-2012 gonzo

Piggyback MIPS changes and add ARM syscons support for devices with
framebuffer

While here - sort #if defined() order alphabetically


# 239670 25-Aug-2012 rwatson

Provide basic glue to allow syscons to be used on MIPS, modelled
on PowerPC support. This was clearly not something syscons was
designed to do (very specific assumptions about the nature of VGA
consoles on PCs), but fortunately others have long since blazed
the way on making it work regardless of that.

Sponsored by: DARPA, AFRL


# 233664 29-Mar-2012 hselasky

Move tty_opened_ns() into syscons.c which is currently the
only client of this macro.

Suggested by: ed @
MFC after: 1 week


# 233661 29-Mar-2012 hselasky

Fix for NULL-pointer panic during boot, if keys are pressed too early.

MFC after: 1 week


# 230132 15-Jan-2012 uqs

Convert files to UTF-8


# 228767 21-Dec-2011 avg

sc_cngrab: switch to console vty when possible

In the future we may want to perform the switch even if the console is
currently in the graphics mode by trying to reset the video adapter first
(e.g. by executing vesa/vga bios post). That would probably require
some sort of a one-way flag as returning the control of the console back
to the interrupted application most likely would result in a mess.

Reviewed by: emaste
MFC after: 2 months


# 228644 17-Dec-2011 avg

syscons: provide a first iteration of cngrab/cnungrab implementation

- put underlying keyboard(s) into the polling mode for the whole
duration of the grab, instead of the previous behavior of going into
and out of the polling mode around each polling attempt
- ditto for setting K_XLATE mode and enabling a disabled keyboard

Inspired by: bde
MFC after: 2 months


# 228631 17-Dec-2011 avg

kern cons: introduce infrastructure for console grabbing by kernel

At the moment grab and ungrab methods of all console drivers are no-ops.

Current intended meaning of the calls is that the kernel takes control of
console input. In the future the semantics may be extended to mean that
the calling thread takes full ownership of the console (e.g. console
output from other threads could be suspended).

Inspired by: bde
MFC after: 2 months


# 228426 11-Dec-2011 avg

syscons: make sc_puts static as it is used only privately

Perhaps sc_puts should also be renamed to scputs to follow the implied
naming conventions in the file...

MFC after: 2 weeks


# 227309 07-Nov-2011 ed

Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.

The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.


# 225617 16-Sep-2011 kmacy

In order to maximize the re-usability of kernel code in user space this
patch modifies makesyscalls.sh to prefix all of the non-compatibility
calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel
entry points and all places in the code that use them. It also
fixes an additional name space collision between the kernel function
psignal and the libc function of the same name by renaming the kernel
psignal kern_psignal(). By introducing this change now we will ease future
MFCs that change syscalls.

Reviewed by: rwatson
Approved by: re (bz)


# 225221 27-Aug-2011 rwatson

Add support for alternative break-to-debugger to syscons(4). While most
keyboards allow console break sequences (such as ctrl-alt-esc) to be
entered, alternative break can prove useful under virtualisation and
remote console systems where entering control sequences can be
difficult or unreliable.

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)


# 224126 17-Jul-2011 ed

Restore binary compatibility for GIO_KEYMAP and PIO_KEYMAP.

Back in 2009 I changed the ABI of the GIO_KEYMAP and PIO_KEYMAP ioctls
to support wide characters. I created a patch to add ABI compatibility
for the old calls, but I didn't get any feedback to that.

It seems now people are upgrading from 8 to 9 they experience this
issue, so add it anyway.


# 221708 09-May-2011 jkim

Move VT switching hack for suspend/resume from bus drivers to syscons.c
using event handlers. A different version was

Submitted by: Taku YAMAMOTO (taku at tackymt dot homeip dot net)


# 216082 30-Nov-2010 jkim

Rename a variable to match scvidctl.c.


# 216081 30-Nov-2010 jkim

Stop hardcoding default font size.


# 216068 29-Nov-2010 jkim

Clean up code a bit to make it more readable.


# 216067 29-Nov-2010 jkim

Honor font size for the video mode when default fonts are compiled in kernel
and VESA mode is enabled from loader.


# 213770 13-Oct-2010 rpaulo

Explicitly tell the compiler that we don't care about the return value
of kbdd_ioctl().


# 208411 22-May-2010 jkim

Suspend screen updates when the video controller is powered down.


# 205865 29-Mar-2010 jkim

Refine r204265. We want the standard VGA palette for packed pixel mode.


# 204281 24-Feb-2010 jkim

Improve VESA mode switching via loader tunable `hint.sc.0.vesa_mode'.
The most notable change is history buffer is fully saved/restored now.


# 204265 23-Feb-2010 jkim

Yet another attempt to make palette loading more safer:

- Add a separate palette data for 8-bit DAC mode when SC_PIXEL_MODE is set
and fill it up with default gray-scale palette data for text. Now we don't
have to set `hint.sc.0.vesa_mode' to get the default palette data.
- Add a new adapter flag, V_ADP_DAC8 to track whether the controller is
using 8-bit palette format and load correct palette when switching modes.
- Set 8-bit DAC mode only for non-VGA compatible graphics mode.


# 201223 29-Dec-2009 rnoland

Update d_mmap() to accept vm_ooffset_t and vm_memattr_t.

This replaces d_mmap() with the d_mmap2() implementation and also
changes the type of offset to vm_ooffset_t.

Purge d_mmap2().

All driver modules will need to be rebuilt since D_VERSION is also
bumped.

Reviewed by: jhb@
MFC after: Not in this lifetime...


# 199171 11-Nov-2009 ed

Allow Syscons terminal emulators to provide function key strings.

xterm and cons25 have some incompatibilities when it comes to escape
sequences for special keys, such as F1 to F12, home, end, etc. Add a new
te_fkeystr() that can be used to override the strings.

scterm-sck won't do anything with this, but scterm-teken will use
teken_get_sequences() to obtain the proper sequence.


# 198858 03-Nov-2009 jkim

Fix VESA color palette corruption:

- VBE 3.0 says palette format resets to 6-bit mode when video mode changes.
We simply set 8-bit mode when we switch modes if the adapter supports it.
- VBE 3.0 also says if the mode is not VGA compatible, we must use VBE
function to save/restore palette. Otherwise, VGA function may be used.
Thus, reinstate the save/load palette functions only for non-VGA compatible
modes regardless of its palette format.
- Let vesa(4) set VESA modes even if vga(4) claims to support it.
- Reset default palette if VESA pixel mode is set initially.
- Fix more style nits.


# 198421 23-Oct-2009 jkim

Search for default 800x600 graphics mode from supported VESA mode list.
Many video controllers do not support 800x600x24 mode any more.


# 197539 27-Sep-2009 ed

Add support for VT200-style mouse input.

Right now if applications want to use the mouse on the command line,
they use sysmouse(4) and install a signal handler in the kernel to
deliver signals when mouse events arrive. This conflicts with my plan to
change to TERM=xterm, so implement proper VT200-style mouse input.

Because mouse input is now streamed through the TTY, it means you can
now SSH to another system on the console and use the mouse there as
well. The disadvantage of the VT200 mouse protocol, is that it doesn't
seem to generate events when moving the cursor. Only when pressing and
releasing mouse buttons.

There are different protocols as well, but this one seems to be most
commonly supported.

Reported by: Paul B. Mahol <onemda gmail com>
Tested with: vim(1)


# 197315 18-Sep-2009 ed

Just use ttydisc_rint_simple() instead of doing it ourselves.

This code seems to do exactly the same as ttydisc_rint_simple() does
nowadays. Just remove it.

Obtained from: //depot/user/ed/newcons/sys/dev/syscons/syscons.c


# 197109 11-Sep-2009 delphij

Make use of the more flexable device hints by adding a new field,
vesa_mode to specify VESA mode, as suggested by jhb@.


# 197085 11-Sep-2009 delphij

Extend the usage of sc(4)'s hint variable 'flag'. Bit 0x80 now means
"set vesa mode" and higher 16bits of the flag would be the desired mode.

One can now set, for instance, hint.sc.0.flags=0x01680180, which means
that the system should set VESA mode 0x168 upon boot.

Submitted by: paradox <ddkprog yahoo com>, swell k at gmail.com with
some minor changes.


# 193018 29-May-2009 ed

Last minute TTY API change: remove mutex argument from tty_alloc().

I don't want people to override the mutex when allocating a TTY. It has
to be there, to keep drivers like syscons happy. So I'm creating a
tty_alloc_mutex() which can be used in those cases. tty_alloc_mutex()
should eventually be removed.

The advantage of this approach, is that we can just remove a function,
without breaking the regular API in the future.


# 192143 15-May-2009 ed

Turn consolectl into a simple device node, not a TTY.

Apart from the 16 virtual terminals, Syscons allocates two device nodes
that should not really be TTYs, even though they are. One of them is
consolectl. In RELENG_7 and before, these device nodes are used in
single user mode. After I simplified input path, we only use this device
node to call ioctl() on (moused, Xorg, vidcontrol).

When you call ioctl() on consolectl, it will behave the same as being
called on the first window.


# 190868 09-Apr-2009 emax

Remove obsolete/bogus layering.

Reviewed by: freebsd-current@, freebsd-hackers@
MFC after: 1 week


# 189617 10-Mar-2009 ed

Make a 1:1 mapping between syscons stats and terminal emulators.

After I imported libteken into the source tree, I noticed syscons didn't
store the cursor position inside the terminal emulator, but inside the
virtual terminal stat. This is not very useful, because when you
implement more complex forms of line wrapping, you need to keep track of
more state than just the cursor position.

Because the kernel messages didn't share the same terminal emulator as
ttyv0, this caused a lot of strange things, like kernel messages being
misplaced and a missing notification to resize the terminal emulator for
kernel messages never to be resized when using vidcontrol.

This patch just removes kernel_console_ts and adds a special parameter
to te_puts to determine whether messages should be printed using regular
colors or the ones for kernel messages.

Reported by: ache
Tested by: nyan, garga (older version)


# 189596 09-Mar-2009 ed

Don't call into the TTY layer when inside kdb.

We should just leave the underlying TTY objects alone when scrolling
around in KDB. It should be handled by Syscons exclusively.

Reported by: pluknet gmail com


# 186681 01-Jan-2009 ed

Replace syscons terminal renderer by a new renderer that uses libteken.

Some time ago I started working on a library called libteken, which is
terminal emulator. It does not buffer any screen contents, but only
keeps terminal state, such as cursor position, attributes, etc. It
should implement all escape sequences that are implemented by the
cons25 terminal emulator, but also a fair amount of sequences that are
present in VT100 and xterm.

A lot of random notes, which could be of interest to users/developers:

- Even though I'm leaving the terminal type set to `cons25', users can
do experiments with placing `xterm-color' in /etc/ttys. Because we
only implement a subset of features of xterm, this may cause
artifacts. We should consider extending libteken, because in my
opinion xterm is the way to go. Some missing features:

- Keypad application mode (DECKPAM)
- Character sets (SCS)

- libteken is filled with a fair amount of assertions, but unfortunately
we cannot go into the debugger anymore if we fail them. I've done
development of this library almost entirely in userspace. In
sys/dev/syscons/teken there are two applications that can be helpful
when debugging the code:

- teken_demo: a terminal emulator that can be started from a regular
xterm that emulates a terminal using libteken. This application can
be very useful to debug any rendering issues.

- teken_stress: a stress testing application that emulates random
terminal output. libteken has literally survived multiple terabytes
of random input.

- libteken also includes support for UTF-8, but unfortunately our input
layer and font renderer don't support this. If users want to
experiment with UTF-8 support, they can enable `TEKEN_UTF8' in
teken.h. If you recompile your kernel or the teken_demo application,
you can hold some nice experiments.

- I've left PC98 the way it is right now. The PC98 platform has a custom
syscons renderer, which supports some form of localised input. Maybe
we should port PC98 to libteken by the time syscons supports UTF-8?

- I've removed the `dumb' terminal emulator. It has been broken for
years. It hasn't survived the `struct proc' -> `struct thread'
conversion.

- To prevent confusion among people that want to hack on libteken:
unlike syscons, the state machines that parse the escape sequences are
machine generated. This means that if you want to add new escape
sequences, you have to add an entry to the `sequences' file. This will
cause new entries to be added to `teken_state.h'.

- Any rendering artifacts that didn't occur prior to this commit are by
accident. They should be reported to me, so I can fix them.

Discussed on: current@, hackers@
Discussed with: philip (at 25C3)


# 185028 17-Nov-2008 emax

Undo revision 185013 until better solution is found.

Pointed out by: bde


# 185013 16-Nov-2008 emax

More locking for syscons(4). This should prevent races with sckbdevent().

PR: kern/127446
Submitted by: Eygene Ryabinkin rea-fbsd at codelabs dot ru


# 182527 31-Aug-2008 ed

Disable processing of output data after disabling scroll lock by force.

The syscons code disabled scroll lock inside sc_cnputs() if it's going
to print a system message. The code currently wants to process any TTY
output data as well, but we cannot do this, because the TTY lock is a
sleep mutex, while cnputs() picks up a spin mutex.

Disable the code for now. It solves a panic when a console message is
printed while scroll lock is enabled. One solution would be to
initialize a task structure here.

Reported by: Paul B. Mahol <onemda gmail com>


# 182117 24-Aug-2008 ed

Make syscons(4) use ttyv0 instead of consolectl as its primary window.

When I was hacking on uart(4) to make it work with the MPSAFE TTY layer,
I noticed there was a difference between the way syscons and uart work
with respect to consoles:

- The uart(4) driver sets cn_name to the corresponding ttyu%r node,
which means init(8) (which opens /dev/console) will have its output
redirected to /dev/ttyu%r. After /etc/rc is done, it can spawn a getty
on that device node as well.

- Syscons used a little different approach. Apart from the /dev/ttyv%r
nodes, it creates a /dev/consolectl node. This device node is used by
moused and others to deliver their data, but for some reason it also
acts as a TTY, which shares its stat structure with ttyv0. This device
node is used as a console (run conscontrol).

There are a couple advantages of this approach:

- Because we use two different TTY's to represent the 0th syscons
window, we allocate two sets of TTY buffers. Even if you don't use
/dev/consolectl after the system has booted (systems that don't run
moused), it seems the buffers are still allocated.

- We have to apply an evil hack to redirect input to /dev/consolectl.
Because each window (stat) is associated not associated with one TTY,
syscons solves this by redirecting all input to closed TTY's to
consolectl.

This means that opening /dev/ttyv0 while in single user mode will
probably cause strange things to happen with respect to keyboard input
redirection.

The first patch that I discussed with philip@ turned consolectl into a
symlink to ttyv0, but this was not a good idea, because in theory we
would want consolectl to be a simple device node, which contains all the
`privileged' ioctl()'s. Apart from that, it didn't work, because each
time /dev/ttyv0 got revoked, moused also lost its descriptor to deliver
input, which meant you had to plug out/in your mouse to make it work
again. This version just leaves the consolectl device the way it is. It
can still be used to write output to ttyv0, but it can no longer receive
any input.

In my opinion this patch is not a complete solution, but it's already a
step in the good direction. It would allow us to turn consolectl into a
special (non-TTY) device node in the far future. It shaves off 15 KB of
wasted TTY buffer space.

Discussed with: philip


# 181905 20-Aug-2008 ed

Integrate the new MPSAFE TTY layer to the FreeBSD operating system.

The last half year I've been working on a replacement TTY layer for the
FreeBSD kernel. The new TTY layer was designed to improve the following:

- Improved driver model:

The old TTY layer has a driver model that is not abstract enough to
make it friendly to use. A good example is the output path, where the
device drivers directly access the output buffers. This means that an
in-kernel PPP implementation must always convert network buffers into
TTY buffers.

If a PPP implementation would be built on top of the new TTY layer
(still needs a hooks layer, though), it would allow the PPP
implementation to directly hand the data to the TTY driver.

- Improved hotplugging:

With the old TTY layer, it isn't entirely safe to destroy TTY's from
the system. This implementation has a two-step destructing design,
where the driver first abandons the TTY. After all threads have left
the TTY, the TTY layer calls a routine in the driver, which can be
used to free resources (unit numbers, etc).

The pts(4) driver also implements this feature, which means
posix_openpt() will now return PTY's that are created on the fly.

- Improved performance:

One of the major improvements is the per-TTY mutex, which is expected
to improve scalability when compared to the old Giant locking.
Another change is the unbuffered copying to userspace, which is both
used on TTY device nodes and PTY masters.

Upgrading should be quite straightforward. Unlike previous versions,
existing kernel configuration files do not need to be changed, except
when they reference device drivers that are listed in UPDATING.

Obtained from: //depot/projects/mpsafetty/...
Approved by: philip (ex-mentor)
Discussed: on the lists, at BSDCan, at the DevSummit
Sponsored by: Snow B.V., the Netherlands
dcons(4) fixed by: kan


# 181286 04-Aug-2008 kib

Lower the priority of the sleep in the syscons for "waitvt" wchan to
PZERO + 1. The sleeping process at the priority <= PZERO is counted as
blocked, or, as comment states, 'disk wait'. PZERO + 1 works as well,
and does not cause user confusion.

Reported by: sam <samflanker at gmail com>
MFC after: 1 week


# 177642 26-Mar-2008 phk

The "free-lance" timer in the i8254 is only used for the speaker
these days, so de-generalize the acquire_timer/release_timer api
to just deal with speakers.

The new (optional) MD functions are:
timer_spkr_acquire()
timer_spkr_release()
and
timer_spkr_setfreq()

the last of which configures the timer to generate a tone of a given
frequency, in Hz instead of 1/1193182th of seconds.

Drop entirely timer2 on pc98, it is not used anywhere at all.

Move sysbeep() to kern/tty_cons.c and use the timer_spkr*() if
they exist, and do nothing otherwise.

Remove prototypes and empty acquire-/release-timer() and sysbeep()
functions from the non-beeping archs.

This eliminate the need for the speaker driver to know about
i8254frequency at all. In theory this makes the speaker driver MI,
contingent on the timer_spkr_*() functions existing but the driver
does not know this yet and still attaches to the ISA bus.

Syscons is more tricky, in one function, sc_tone(), it knows the hz
and things are just fine.

In the other function, sc_bell() it seems to get the period from
the KDMKTONE ioctl in terms if 1/1193182th second, so we hardcode
the 1193182 and leave it at that. It's probably not important.

Change a few other sysbeep() uses which obviously knew that the
argument was in terms of i8254 frequency, and leave alone those
that look like people thought sysbeep() took frequency in hertz.

This eliminates the knowledge of i8254_freq from all but the actual
clock.c code and the prof_machdep.c on amd64 and i386, where I think
it would be smart to ask for help from the timecounters anyway [TBD].


# 177431 20-Mar-2008 bland

Improve VT_WAITACTIVE semantics.
- Wait for requested vty activation regardless its open state.
- Remove redundant console cleanup.

Approved by: kib
MFC after: 1 week


# 175640 24-Jan-2008 kib

Do not dereference NULL scp in the case the screen is not opened.
Instead, return ENXIO to the ioctl caller.

Reported and tested by: Pawel Worach <pawel.worach gmail com>
Discussed with: markus
MFC after: 3 days


# 174985 29-Dec-2007 wkoszek

Replace explicit calls to video methods with their respective variants
implemented with macros. This patch improves code readability. Reasoning
behind vidd_* is a sort of "video discipline".

List of macros is supposed to be complete--all methods of video_switch
ought to have their respective macros from now on.

Functionally, this code should be no-op. My intention is to leave current
behaviour of touched code as is.

No objections: rwatson
Silence on: freebsd-current@
Approved by: cognet


# 174984 29-Dec-2007 wkoszek

Remove explicit calls to keyboard methods with their respective variants
implemented with macros. This patch improves code readability. Reasoning
behind kbdd_* is a "keyboard discipline".

List of macros is supposed to be complete--all methods of keyboard_switch
should have their respective macros from now on.

Functionally, this code should be no-op. My intention is to leave current
behaviour of code as is.

Glanced at by: rwatson
Reviewed by: emax, marcel
Approved by: cognet


# 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.


# 172250 20-Sep-2007 simokawa

Serialize output routine of terminal emulator (te_puts()) by a lock.
- The output routine of low level console is not protected by any lock
by default.
- Increment and decrement of sc->write_in_progress are not atomic and
this may cause console hang.
- We also have many other states used by emulator that should be protected
by the lock.
- This change does not fix interspersed messages which PRINTF_BUFR_SIZE
kernel option should fix.

Approved by: re (bmah)
MFC after: 1 week


# 172238 19-Sep-2007 marcus

Fix a bug that will cause a process that calls the VT_WAITACTIVE ioctl
to become unkillable when that process is sent a termination signal. The
process will sit in waitvt looping in the kernel, and chewing up all
available CPU until the system is rebooted.

Submitted by: Jilles Tjoelker <jilles@stack.nl>
Reviewed by: bde
Approved by: re (kensmith)
MFC after: 1 week


# 170305 04-Jun-2007 jeff

- Change comments and asserts to reflect the removal of the global
scheduler lock.

Tested by: kris, current@
Tested on: i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)


# 164333 16-Nov-2006 ru

Replace magic numbers for console bell types with defines.


# 164050 06-Nov-2006 ru

Sometimes the vty switching has to be delayed; the vty
to be switched to is saved in sc->delayed_next_scr and
the actual switch is performed later. It was possible
to get into the endless loop when attempting to switch
to a closed vty (which is not allowed and beep-alerted
when attempted) and when the visual beep was in effect.
This caused sc->delayed_next_scr to never be reset and
endless attempts to switch to a closed vty and endless
visual beeping. How to repeat:

- boot into single-user
- run "kbdcontrol -b visual"
- quickly press Alt+F2 two times

PR: kern/68016
X-MFC after: 6.2-RELEASE


# 164033 06-Nov-2006 rwatson

Sweep kernel replacing suser(9) calls with priv(9) calls, assigning
specific privilege names to a broad range of privileges. These may
require some future tweaking.

Sponsored by: nCircle Network Security, Inc.
Obtained from: TrustedBSD Project
Discussed on: arch@
Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri,
Alex Lyashkov <umka at sevcity dot net>,
Skip Ford <skip dot ford at verizon dot net>,
Antoine Brodin <antoine dot brodin at laposte dot net>


# 162711 27-Sep-2006 ru

Fix our ioctl(2) implementation when the argument is "int". New
ioctls passing integer arguments should use the _IOWINT() macro.
This fixes a lot of ioctl's not working on sparc64, most notable
being keyboard/syscons ioctls.

Full ABI compatibility is provided, with the bonus of fixing the
handling of old ioctls on sparc64.

Reviewed by: bde (with contributions)
Tested by: emax, marius
MFC after: 1 week


# 162285 13-Sep-2006 scottl

Introduce a spinlock for synchronizing access to the video output hardware
in syscons. This replaces a simple access semaphore that was assumed to be
protected by Giant but often was not. If two threads that were otherwise
SMP-safe called printf at the same time, there was a high likelyhood that
the semaphore would get corrupted and result in a permanently frozen video
console. This is similar to what is already done in the serial console
drivers.


# 158960 26-May-2006 phk

Convert to new console api


# 158941 26-May-2006 phk

GC the cn_dbctl_t hook for consoles, it is unused.

This used to make syscons switch to vty0 when we entered DDB but this
was lost in the KDB shuffle. We may want to bring it back down the road
but it should be done by calling cn_init_t/cn_term_t instead, possibly
with a flag argument saying "Debugger!"


# 158503 12-May-2006 keramida

Check the return code of sc_clean_up() in the only place where it
was not checked at all. There is only one case when sc_clean_up()
can fail, because of wait_scrn_saver_stop(), but it doesn't hurt
to check anyway.

Reviewed by: rodrigc
Found by: Coverity Prevent


# 156126 28-Feb-2006 emax

Integrate kbdmux(4) into syscons(4) and kbd code.

By default syscons(4) will look for the kbdmux(4) keyboard first, and then,
if not found, look for any keyboard.

Current kbd code is modified so if kbdmux(4) is the current keyboard, all
new keyboards are automatically added to the kbdmux(4).

Switch to kbdmux(4) can be done at boot time, by loading kbdmux module at
the loader prompt, or at runtime, by kldload'ing the kbdmux module and
releasing current active keyboard.

If, for whatever reason, kbdmux(4) is not required/desired then just do
not load it and everything should work as before. It is also possible to
kldunload kbdmux at runtime and syscons(4) will automatically switch to
the first available keyboard.

No response from: freebsd-current@
MFC after: 1 day


# 154369 14-Jan-2006 brooks

When SC_DISABLE_KDBKEY or SC_DISABLE_REBOOT are not defined allow the
same behavior to be controlled by the sysctls, hw.syscons.kbd_kbdkey
and hw.syscons.kbd_reboot respectively.

Apologies to the submitter for taking so long to commit this simple
change.

PR: kern/72728
Submitted by: Luca Morettoni <morettoni at libero dot it>
MFC After: 3 days


# 153072 04-Dec-2005 ru

Fix -Wundef.


# 150686 28-Sep-2005 marius

Add a font width argument to vi_load_font_t, vi_save_font_t and vi_putm_t
and do some preparations for handling 12x22 fonts (currently lots of code
implies and/or hardcodes a font width of 8 pixels). This will be required
on sparc64 which uses a default font size of 12x22 in order to add font
loading and saving support as well as to use a syscons(4)-supplied mouse
pointer image.
This API breakage is committed now so it can be MFC'ed in time for 6.0
and later on upcoming framebuffer drivers destined for use on sparc64
and which are expected to rely on using font loading internally and on
a syscons(4)-supplied mouse pointer image can be easily MFC'ed to
RELENG_6 rather than requiring a backport.

Tested on: i386, sparc64, make universe
MFC after: 1 week


# 149640 30-Aug-2005 rodrigc

Prevent division by zero errors in sc_mouse_move()
by explicitly setting sc->font_width, in the same
places where sc->font_size is set, instead of
relying on the default initialized value of 0 for sc->font_width.

PR: kern/84836
Reported by: Andrey V. Elsukov <bu7cher at yandex dot ru>
MFC after: 2 days


# 147980 13-Jul-2005 emax

kbdmux(4) keyboard multiplexer integration

o Add two new ioctl's KBADDKBD and KBRELKBD. These are used to add and remove
keyboard to (and from) kbdmux(4) keyboard multiplexer;

o Introduce new kbd_find_keyboard2() function. It does exactly the same job
as kbd_find_keyboard() function except it allows to specify starting index.
This function can be used to iterate over keyboards array;

o Re-implement kbd_find_keyboard() as call to kbd_find_keyboard2() with starting
index of zero;

o Make sure syscons(4) passed KBADDKBD and KBRELKBD ioctl's onto currently
active keyboard.

These changes should not have any visible effect.

MFC after: 1 week


# 146736 29-May-2005 delphij

Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.

Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.

Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.

Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]


# 146478 21-May-2005 marius

- Not every architecture defaults to a black background (e.g. sparc64
uses white) so base the color of the border on SC_NORM_ATTR rather
than hardcoding BG_BLACK.
- Use SC_DRIVER_NAME rather than hardcoding 'sc' in message strings
(see also sys/dev/syscons/syscons.h rev. 1.82).


# 146235 15-May-2005 nyan

Remove the ADJUST_CLOCK ioctl on pc98. It's not used at all.


# 142692 27-Feb-2005 phk

Remove debug printout of major/minor numbers, print name instead.


# 138249 01-Dec-2004 scottl

Remove the last vestiges of the userconfig option. None of this actually
did anything, so this commit should be considered a NO-OP.


# 136680 18-Oct-2004 phk

Add new function ttyinitmode() which sets our systemwide default
modes on a tty structure.

Both the ".init" and the current settings are initialized allowing
the function to be used both at attach and open time.

The function takes an argument to decide if echoing should be enabled.
Echoing should not be enabled for regular physical serial ports
unless they are consoles, in which case they should be configured
by ttyconsolemode() instead.

Use the new function throughout.


# 136505 14-Oct-2004 phk

Fix echo in console mode.


# 135942 29-Sep-2004 nectar

Disallow negative coordinates and sizes in the syscons CONS_SCRSHOT
ioctl.

Reported by: Christer Oberg <christer.oberg@deprotect.com>


# 135693 23-Sep-2004 peter

Implement the KDENABIO etc ioctl's for amd64 as well.


# 133186 05-Aug-2004 des

Just because we have a serial console attached does not mean we don't
want a splash screen.

There seems to be some confusion in the syscons code as to the meaning of
the SC_KERNEL_CONSOLE flag. Its absence is sometimes interpreted to mean
"I am not the system console", and sometimes to mean "I am not the only
VGA console" (see the font loading code for an example of the latter).
Someone with better syscons fu than myself should take a closer look.


# 132993 02-Aug-2004 scottl

Document machdep.enable_panic_key.

Submitted by: Craig Rodrigues


# 132772 28-Jul-2004 kan

Avoid casts as lvalues.


# 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.


# 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.


# 130640 17-Jun-2004 phk

Second half of the dev_t cleanup.

The big lines are:
NODEV -> NULL
NOUDEV -> NODEV
udev_t -> dev_t
udev2dev() -> findcdev()

Various minor adjustments including handling of userland access to kernel
space struct cdev etc.


# 130585 16-Jun-2004 phk

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


# 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.


# 129944 01-Jun-2004 phk

Gainfully employ the new ttyioctl in the trivial cases.


# 127745 02-Apr-2004 kensmith

Rearrangements needed for syscons(4) to be used as a console device
on architectures that need to call cninit() before the machine is
ready to support mutexes (required by make_dev()).

- Remove make_dev() call from scinit() when flags indicate
unit is the system console, rely on sc_attach_unit() to
handle it.
- When trying to access current screen's status (scr_stat
structure) use the static one provided for the initial
system console if no dev_t is available.
- When calling make_dev() in sc_attach_unit() catch special
case of system's initial console and set up dev_t structure
to include pointer to console's scr_stat struct.

Reviewed by: marcel
Tested by: marcel, grehan (ppc), others on current@
Approved by: rwatson (mentor)


# 127188 18-Mar-2004 ru

Fixed a nasty old bug where a visual bell in the currently active
VTY prevented waking up processes waiting for the output queue to
get free on other VTYs.

In collaboration with: Vsevolod Lobko
MFC after: 1 week


# 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.


# 125801 14-Feb-2004 phk

Try again to get rid of makedev().


# 125773 13-Feb-2004 phk

Back out my last commit to syscons, things seem to be far more evil
than suspected.

and obviously nobody runs the patches I post to -current :-(

Poul-Henning


# 125750 12-Feb-2004 phk

Don't use makedev() to hack up dev_t's early in boot, do it right
with make_dev() (and avoid doing it again later).


# 125467 04-Feb-2004 kan

Eliminate global cons_unavailable flag and replace it by the status
bit maintained on a per-device basis. Single variable is inadequate
on machines running with multiple consoles enabled.


# 124770 21-Jan-2004 grehan

__powerpc__ conditional code for the syscons OpenFirmware/PPC framebuffer.
Took the opportunity to reduce

__i386__ || __ia64__ || __amd64__ || __sparc64__ || __powerpc__

to

!__alpha__

reviewed by: gallatin


# 121704 29-Oct-2003 njl

Fix a panic that occurs when resuming. For some reason, sc->cur_scp is
NULL.

Submitted by: Andrew Thompson <andy@fud.org.nz>


# 120488 26-Sep-2003 phk

Convert to cn_name rather than cn_dev.


# 119443 25-Aug-2003 nyan

Merge pc98 support from sys/pc98/pc98/syscons.c.


# 119420 24-Aug-2003 obrien

Use __FBSDID().
Also some minor style cleanups.


# 119388 24-Aug-2003 jake

- Add a font width field to struct scr_stat. Use this instead of '8'.
- Use the values in the video info for the font size and width instead
of second guessing.


# 119379 23-Aug-2003 jake

Add sparc64 ifdefs.


# 119378 23-Aug-2003 jake

Fix endian bugs accessing ioctl arguments that are passed by value.


# 114857 09-May-2003 peter

Trivial addition of __amd64__ to the ifdefs for platforms that use
i386-style vga console support.

Approved by: re


# 112569 24-Mar-2003 jake

- Add vm_paddr_t, a physical address type. This is required for systems
where physical addresses larger than virtual addresses, such as i386s
with PAE.
- Use this to represent physical addresses in the MI vm system and in the
i386 pmap code. This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
detection code, and due to kvtop returning vm_paddr_t instead of u_long.

Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.

Sponsored by: DARPA, Network Associates Laboratories
Discussed with: re, phk (cdevsw change)


# 112537 24-Mar-2003 jhb

Don't call sysbeep() in sc_bell() if either duration or pitch is zero.
Otherwise sysbeep() makes an annoying clicking sound on some systems.
'kbdcontrol -b off' just sets the duration and pitch to zero, it doesn't
set the QUIET_BELL flag.

Tested by: SorAlx <soralx@cydem.zp.ua>
PR: misc/41772
MFC after: 1 week


# 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)


# 111748 02-Mar-2003 des

More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9).


# 111632 27-Feb-2003 mux

When DDB is in the kernel, unlock VTY switching so that we
don't end up freezing the box. This makes VTY locking useless
in the DDB case but a box which is supposed to be physically
secure shouldn't compile DDB anyway.

Reviewed by: silence on -audit


# 111462 25-Feb-2003 mux

Cleanup of the d_mmap_t interface.

- Get rid of the useless atop() / pmap_phys_address() detour. The
device mmap handlers must now give back the physical address
without atop()'ing it.
- Don't borrow the physical address of the mapping in the returned
int. Now we properly pass a vm_offset_t * and expect it to be
filled by the mmap handler when the mapping was successful. The
mmap handler must now return 0 when successful, any other value
is considered as an error. Previously, returning -1 was the only
way to fail. This change thus accidentally fixes some devices
which were bogusly returning errno constants which would have been
considered as addresses by the device pager.
- Garbage collect the poorly named pmap_phys_address() now that it's
no longer used.
- Convert all the d_mmap_t consumers to the new API.

I'm still not sure wheter we need a __FreeBSD_version bump for this,
since and we didn't guarantee API/ABI stability until 5.1-RELEASE.

Discussed with: alc, phk, jake
Reviewed by: peter
Compile-tested on: LINT (i386), GENERIC (alpha and sparc64)
Runtime-tested on: i386


# 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.


# 111162 20-Feb-2003 cognet

Add a "hw.syscons.bell" sysctl, which can disable the bell at syscons level.


# 111119 19-Feb-2003 imp

Back out M_* changes, per decision of the TRB.

Approved by: trb


# 109623 21-Jan-2003 alfred

Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


# 105310 17-Oct-2002 kbyanc

Make kqueue(2) work for virtual terminals.

PR: 40486
Submitted by: Jilles Tjoelker <jilles+fbsd-bugs@stack.nl>


# 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


# 102241 21-Aug-2002 archie

Don't use "NULL" when "0" is really meant.


# 102108 19-Aug-2002 sobomax

1. Allow information about current history size be retrieved using ioctl(2);

2. modify screen dumpung routine, so that in addition to visible area, it
allows to grab any portion of history buffer as well.


# 99704 10-Jul-2002 dd

Add a VT_LOCKSWITCH ioctl that disallows vty switching. Something
like this can be emulated by VT_SETMODEing to VT_PROCESS and never
releasing the vty, but this has a number of problems, most notably
that a process must stay resident for the lock to be in effect.

Reviewed by: roam, sheldonh


# 97918 06-Jun-2002 alfred

Make sc_saver_keyb_only (sceen saver interrupted by keyboard input only)
the default.


# 96033 04-May-2002 mux

When a program launched on the local console exits, the shell will
call read() to get the next command, and scread() disables the
screensaver. We don't want this behaviour in the sc_saver_keybonly
case.

Submitted by: Olivier Houchard <doginou@ci0.org>


# 94617 13-Apr-2002 obrien

Turn on TGA support.

Submitted by: Andrew M. Miklic <AndrwMklc@cs.com>


# 93902 05-Apr-2002 alfred

remove blanktime sysctl, this can't be done as easily as it looks.

Requested by: jhb


# 93897 05-Apr-2002 alfred

Add some functionality via sysctl to syscons.

hw.syscons.saver.keybonly: used to specify that only input is to
interrupt the screensaver. This allows one to run a chatty console
app but still have the screen blank out until a key is pressed.
There should probably also be an ioctl for this, we'll do that later.

hw.syscons.saver.blanktime: exports the screensaver timeout via sysctl.

Submitted by: Olivier Houchard <doginou@cognet.ci0.org>


# 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@


# 92459 16-Mar-2002 sobomax

Extend CONS_GETINFO ioctl to provide information about size of the currently
displayed font.

MFC after: 2 weeks


# 91406 27-Feb-2002 jhb

Simple p_ucred -> td_ucred changes to start using the per-thread ucred
reference.


# 85835 01-Nov-2001 iwasaki

Some fix for the recent apm module changes.
- Now that apm loadable module can inform its existence to other kernel
components (e.g. i386/isa/clock.c:startrtclock()'s TCS hack).
- Exchange priority of SI_SUB_CPU and SI_SUB_KLD for above purpose.
- Add simple arbitration mechanism for APM vs. ACPI. This prevents
the kernel enables both of them.
- Remove obsolete `#ifdef DEV_APM' related code.
- Add abstracted interface for Powermanagement operations. Public apm(4)
functions, such as apm_suspend(), should be replaced new interfaces.
Currently only power_pm_suspend (successor of apm_suspend) is implemented.

Reviewed by: peter, arch@ and audit@


# 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.


# 84589 06-Oct-2001 dfr

Enable console. There are far too many 'ifdef __i386__' in this file.


# 83977 26-Sep-2001 rwatson

o Modify syscons ioctl securelevel checks to use securelevel_gt() (oh look,
yet another API to do direct hardware I/O access.)

Obtained from: TrustedBSD Project


# 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


# 81230 07-Aug-2001 yokota

Don't call wakeup() while we are in DDB. The patch was
developed by bde. I added the same check in one more place
where wakeup() might be called during the DDB session.
Submitted by: bde


# 81050 02-Aug-2001 yokota

Use #ifdef DEV_SPLASH (from opt_splash.h) rather than
#if NSPLASH > 0 (from splash.h) to test the presence
of the splash driver.


# 81030 02-Aug-2001 yokota

Refine cursor type/shape control escape sequences and
ioctls. We can now add ve, vi and vs capabilities to
cons25 in termcap.

Discussed with and tested by: ache


# 80964 01-Aug-2001 dd

Fix grammar nit.


# 80151 22-Jul-2001 yokota

- Fix "off by one" error in VT_WAITACTIVATE. Correctly accept
0 as meaning the requesting vty.
- Accept 0 as the requesting vty in VT_ACTIVATE as in VT_WAITACTIVE.

PR: 24423
MFC after: 10 days


# 80041 20-Jul-2001 yokota

Define a couple of subroutines to replace duplicated common code. You
shoulnd't see any functional difference.


# 79622 12-Jul-2001 yokota

- Define a convenience macro ISTTYOPEN().
- Slightly refine screen saver logic.

No functional change.
MFC after: 2 weeks


# 79534 10-Jul-2001 yokota

Fix dependencies between kernel options:
- When both SC_PIXEL_MODE and SC_NO_FONT_LOADING are defined,
quietly drop SC_NO_FONT_LOADING, because the pixel(raster)
console requires font.
- When SC_NO_FONT_LOADING is defined, force SC_ALT_MOUSE_IMAGE.
Without font, the arrow-shaped mouse cursor cannot be drawn.
- Fiddle and simplify some internal macros.
MFC after: 2 weeks


# 79023 30-Jun-2001 yokota

Remove the resume method. It is not necessary any more, because
keyboard drivers have it now...
MFC after: 4 weeks


# 79021 30-Jun-2001 yokota

If we are in DDB, don't switch to a vty in the VT_PROCESS mode.
MFC after: 2 weeks


# 78962 29-Jun-2001 jhb

Add a new MI pointer to the process' trapframe p_frame instead of using
various differently named pointers buried under p_md.

Reviewed by: jake (in principle)


# 78950 29-Jun-2001 yokota

Test "sc->kbd != NULL" rather than "sc != NULL" before
accessing the keyboard in scopen().
MFC after: 2 weeks


# 77253 26-May-2001 dd

In the VIRTUAL_TTY macro, add a check to make sure that the result of
SC_DEV isn't NULL; if it is, evaluate to NULL and don't dereference
NULL. Callers of VIRTUAL_TTY must already check for the result being
NULL since si_tty can be NULL, so this should be safe.

This fixes a panic when trying to switch to a different vty in an
environment such as userconfig (-c option to the kernel).

PR: 26508


# 76800 18-May-2001 nik

Note, previous commit was

Reviewed by: -arch


# 76798 18-May-2001 nik

Add a new ioctl to syscons, CONS_SCRSHOT. Given a userland buffer, it
copies out the current contents of the video buffer for a syscons terminal,
providing a snapshot of the text and attributes.

Based heavily on work originally submitted by Joel Holveck <joelh@gnu.org>
for 2.2.x almost 30 months ago, which I cleaned up a little, and forward
ported to -current.

See also the usr.bin/scrshot utility.


# 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)


# 75893 23-Apr-2001 jhb

Change the pfind() and zpfind() functions to lock the process that they
find before releasing the allproc lock and returning.

Reviewed by: -smp, dfr, jake


# 74810 26-Mar-2001 phk

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


# 74125 11-Mar-2001 ache

Don't require that mouse cursor must be visible before mouse paste.

Paste always happens to current _text_ cursor position independently of
mouse cursor position in any case and old variant force user to press
mouse paste button _two_ times if mouse cursor is invisible.


# 74118 11-Mar-2001 ache

Implement keyboard paste

PR: 25499
Submitted by: Gaspar Chilingarov <nm@web.am>


# 73929 07-Mar-2001 jhb

Grab the process lock while calling psignal and before calling psignal.


# 73799 05-Mar-2001 ache

Fix longstanding mouse cursor bug: blinking and eating all CPU while near text
cursor.
The reason is: mouse cursor goes into hide/visible loop while text cursor even
not moved.

PR: 25536
Submitted by: David Xu <davidx@viasoft.com.cn>


# 71262 19-Jan-2001 peter

Convert apm from a bogus 'count' into a plain option. Clean out some
other cruft from the files.alpha and files.ia64 that were related to this.


# 69781 08-Dec-2000 dwmalone

Convert more malloc+bzero to malloc+M_ZERO.

Submitted by: josh@zipperup.org
Submitted by: Robert Drehmel <robd@gmx.net>


# 66834 08-Oct-2000 phk

Initiate deorbit burn sequence for <machine/console.h>.

Replace all in-tree uses with necessary subset of <sys/{fb,kb,cons}io.h>.
This is also the appropriate fix for exo-tree sources.

Put warnings in <machine/console.h> to discourage use.
November 15th 2000 the warnings will be converted to errors.
January 15th 2001 the <machine/console.h> files will be removed.


# 65759 11-Sep-2000 dwmalone

Add the ability to define a "shutdown" and "shutdown and poweroff" key
to syscons. I have a man page to follow describing the format of the
kbdmap file.

PR: 19273
Reviewed by: sheldonh


# 65268 30-Aug-2000 msmith

Make it possible to pass boot()'s flags to shutdown_nice() so that the
kernel can instigate an orderly shutdown but still determine the form of
that shutdown. Make it possible eg. to cleanly shutdown and power off the
system under ACPI when the power button is pressed.


# 63855 25-Jul-2000 markm

o Fix a horrible bug where small reads (< 8 bytes) would return the
wrong bytes.

o Improve the public interface; use void* instead of char* or u_int64_t
to pass arbitrary data around.
Submitted by: kris ("horrible bug")


# 63264 16-Jul-2000 markm

Don't break the ability to debug the kernel when gathering entropy.

Pointed out by: bde


# 62842 09-Jul-2000 markm

Add entropy-harvesting calls.

/dev/random now has new-and-improved entropy!


# 62069 25-Jun-2000 markm

Remove old entropy-harvesting hooks; this is going to be re-engineered
later.


# 59823 01-May-2000 ache

Back out t_timeout initializing, now in ttyregister


# 59817 01-May-2000 ache

Initialize t_timeout to -1 for console to set its default value once in ttyopen


# 59604 24-Apr-2000 obrien

* Use sys/sys/random.h rather than a i386 specific one.
* There was nothing that should be machine dependant about
i386/isa/random_machdep.c, so it is now sys/kern/kern_random.c.


# 58965 03-Apr-2000 yokota

Unbreak LINT.


# 58872 31-Mar-2000 yokota

- Fix SC_ALT_MOUSE_IMAGE; don't blink the mouse cursor.
- Fix non-destructive, underline text cursor.


# 57129 10-Feb-2000 yokota

- Fix text cursor logic so that multiple instances of the "normal" cursor
won't appear on the screen, and "blinking" and "destructive" cursor
won't appear in the vty for which the text cursor is currently hidden.

Approved by: jkh


# 56836 29-Jan-2000 peter

Use config's conditional compilation rather than using #ifdefs that make
modular compilation harder. I'm doing this because people seem to like
cut/pasting examples of bad practices in existing code.


# 56329 20-Jan-2000 yokota

Unconditionally define sc_paste().


# 56328 20-Jan-2000 yokota

Fix wrong usage of FONT_NONE. It was not meant to be set in
scp->font_size in the first place. It is redundant now and is
removed.

Found by: bde


# 56043 15-Jan-2000 yokota

This is the 3rd stage of syscons code reorganization.

- Split terminal emulation code from the main part of the driver so
that we can have alternative terminal emulator modules if we like in
the future. (We are not quite there yet, though.)

- Put sysmouse related code in a separate file, thus, simplifying the
main part of the driver.

As some files are added to the source tree, you need to run config(8)
before you compile a new kernel next time.

You shouldn't see any functional change by this commit; this is only
internal code reorganization.


# 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


# 54543 13-Dec-1999 yokota

- Remember the keyboard repeat delay and rate.
- Add a new ioctl, KDGETREPEAT, to retrieve the keyboard repeat rate.
- Delete unnecessary #include.


# 54381 10-Dec-1999 yokota

Add "panic key" function to syscons. When this key is defined in a
keymap and pressed, the system panic will be forced.

This feature must be specifically enabled by a new sysctl variable:
machdep.enable_panic_key. Its default value is 0. The panic key
won't do anything unless this variable is set to non-zero.

To use the panic key, add a keyword 'panic' to a key in your
keymap file. The following example assigns the panic function
to SysReq (Alt-PrintScreen) key (keycode 84).

083 del '.' '.' '.' '.' '.' boot boot N
084 panic nop nop nop panic nop nop nop O
085 nop nop nop nop nop nop nop nop O

PR: kern/13721


# 54144 05-Dec-1999 yokota

Fix cursor position calculation.

Submitted by: Cejka Rudolf <cejkar@dcse.fee.vutbr.cz>


# 53816 28-Nov-1999 yokota

- Fail VT switching when the controlling program, such as the
X server, is not responding to the VT switching protocol. (This part
of the code has been somewhat wrong in -CURRENT, but -STABLE has the
correct code...)


# 51966 06-Oct-1999 yokota

- Remove cdevsw_add().


# 51756 28-Sep-1999 phk

Introduce ttyread() and ttywrite() which do the canonical thing.

Use them in many tty drivers.

Reviewed by: julian, bde


# 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


# 51404 19-Sep-1999 yokota

- Hang the scr_stat struct from dev_t.
- Remove sc_get_scr_stat(). It's not necessary anymore.
- Call ttymalloc() to allocate the struct tty for each vty, rather than
statically declaring an array of struct tty. We still need a statically
allocated struct tty for the first vty which is used for the kernel
console I/O, though.
- Likewise, call ttymalloc() for /dev/sysmouse and /dev/consolectl.
- Delete unnecessary test on the pointer struct tty *tp in some functions.
- Delete unused code in scmouse.c.

WARNING: this change requires you to recompile screen savers!


# 50652 30-Aug-1999 phk

s/si_tty_tty/si_tty/g


# 50477 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 50107 21-Aug-1999 msmith

Implement a new generic mechanism for attaching handler functions to
events, in order to pave the way for removing a number of the ad-hoc
implementations currently in use.

Retire the at_shutdown family of functions and replace them with
new event handler lists.

Rework kern_shutdown.c to take greater advantage of the use of event
handlers.

Reviewed by: green


# 49986 17-Aug-1999 billf

Wrap two declarations that are only used in an #ifdef in their own #ifdef.

Reviewed by: bde


# 49694 13-Aug-1999 dt

Fix a warning on the alpha.


# 49558 09-Aug-1999 phk

Merge the cons.c and cons.h to the best of my ability. alpha may or
may not compile, I can't test it.


# 49547 08-Aug-1999 phk

register tty devices so they will look right in pstat.


# 48879 18-Jul-1999 yokota

- Clear relevant variables when the keyboard is not available.
- Do not touch the `tty' struct when it's not yet available.
- Initialize correct bits in `fonts_loaded'.


# 48667 07-Jul-1999 yokota

- Fixed memory leak in sc_alloc_history_buffer().
- Correctly observe the variable `extra_history_size' when changing
the size of history (scroll back) buffer.
- Added sc_free_history_buffer().

Pointed out by: des


# 48418 01-Jul-1999 peter

Tidy up a few warnings when used without splash. (things defined but not
used)


# 48416 01-Jul-1999 peter

Fix warnings on the Alpha.


# 48338 29-Jun-1999 yokota

Fill in tp->t_windowsize AFTER the call to (*linesw[tp->t_line].l_open)(),
rather than BEFORE the call. Otherwise the structure will be `zero'ed out
by l_open, which actually is ttyopen(), if !TS_OPEN.

PR: kern/12420


# 48239 26-Jun-1999 peter

Fix a dev_t/udev_t issue


# 48184 24-Jun-1999 yokota

Fix ESC[P (delete N chars) and ESC[@ (insert N chars). These deletion
and insertion should affect the line the cursor is on only.


# 48104 22-Jun-1999 yokota

The second phase of syscons reorganization.

- Split syscons source code into manageable chunks and reorganize
some of complicated functions.

- Many static variables are moved to the softc structure.

- Added a new key function, PREV. When this key is pressed, the vty
immediately before the current vty will become foreground. Analogue
to PREV, which is usually assigned to the PrntScrn key.
PR: kern/10113
Submitted by: Christian Weisgerber <naddy@mips.rhein-neckar.de>

- Modified the kernel console input function sccngetc() so that it
handles function keys properly.

- Reorganized the screen update routine.

- VT switching code is reorganized. It now should be slightly more
robust than before.

- Added the DEVICE_RESUME function so that syscons no longer hooks the
APM resume event directly.

- New kernel configuration options: SC_NO_CUTPASTE, SC_NO_FONT_LOADING,
SC_NO_HISTORY and SC_NO_SYSMOUSE.
Various parts of syscons can be omitted so that the kernel size is
reduced.

SC_PIXEL_MODE
Made the VESA 800x600 mode an option, rather than a standard part of
syscons.

SC_DISABLE_DDBKEY
Disables the `debug' key combination.

SC_ALT_MOUSE_IMAGE
Inverse the character cell at the mouse cursor position in the text
console, rather than drawing an arrow on the screen.
Submitted by: Nick Hibma (n_hibma@FreeBSD.ORG)

SC_DFLT_FONT
makeoptions "SC_DFLT_FONT=_font_name_"
Include the named font as the default font of syscons. 16-line,
14-line and 8-line font data will be compiled in. This option replaces
the existing STD8X16FONT option, which loads 16-line font data only.

- The VGA driver is split into /sys/dev/fb/vga.c and /sys/isa/vga_isa.c.

- The video driver provides a set of ioctl commands to manipulate the
frame buffer.

- New kernel configuration option: VGA_WIDTH90
Enables 90 column modes: 90x25, 90x30, 90x43, 90x50, 90x60. These
modes are mot always supported by the video card.
PR: i386/7510
Submitted by: kbyanc@freedomnet.com and alexv@sui.gda.itesm.mx.

- The header file machine/console.h is reorganized; its contents is now
split into sys/fbio.h, sys/kbio.h (a new file) and sys/consio.h
(another new file). machine/console.h is still maintained for
compatibility reasons.

- Kernel console selection/installation routines are fixed and
slightly rebumped so that it should now be possible to switch between
the interanl kernel console (sc or vt) and a remote kernel console
(sio) again, as it was in 2.x, 3.0 and 3.1.

- Screen savers and splash screen decoders
Because of the header file reorganization described above, screen
savers and splash screen decoders are slightly modified. After this
update, /sys/modules/syscons/saver.h is no longer necessary and is
removed.


# 47676 01-Jun-1999 jlemon

Unifdef VM86

Reviewed by: silence on on -current


# 47640 31-May-1999 phk

Simplify cdevsw registration.

The cdevsw_add() function now finds the major number(s) in the
struct cdevsw passed to it. cdevsw_add_generic() is no longer
needed, cdevsw_add() does the same thing.

cdevsw_add() will print an message if the d_maj field looks bogus.

Remove nblkdev and nchrdev variables. Most places they were used
bogusly. Instead check a dev_t for validity by seeing if devsw()
or bdevsw() returns NULL.

Move bdevsw() and devsw() functions to kern/kern_conf.c

Bump __FreeBSD_version to 400006

This commit removes:
72 bogus makedev() calls
26 bogus SYSINIT functions

if_xe.c bogusly accessed cdevsw[], author/maintainer please fix.

I4b and vinum not changed. Patches emailed to authors. LINT
probably broken until they catch up.


# 47625 30-May-1999 phk

This commit should be a extensive NO-OP:

Reformat and initialize correctly all "struct cdevsw".

Initialize the d_maj and d_bmaj fields.

The d_reset field was not removed, although it is never used.

I used a program to do most of this, so all the files now use the
same consistent format. Please keep it that way.

Vinum and i4b not modified, patches emailed to respective authors.


# 47034 12-May-1999 bde

Removed global variable `Crtat'. This was once (bogusly) shared with
pcvt, but it had rotted into unuse here, and of course its type had
become inconsisent with its type in pcvt.

Fixed some minor style bugs.


# 46894 10-May-1999 dfr

Adjust console stuff now that makedev is no longer a macro.


# 46112 27-Apr-1999 phk

Suser() simplification:

1:
s/suser/suser_xxx/

2:
Add new function: suser(struct proc *), prototyped in <sys/proc.h>.

3:
s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/

The remaining suser_xxx() calls will be scrutinized and dealt with
later.

There may be some unneeded #include <sys/cred.h>, but they are left
as an exercise for Bruce.

More changes to the suser() API will come along with the "jail" code.


# 45720 16-Apr-1999 peter

Bring the 'new-bus' to the i386. This extensively changes the way the
i386 platform boots, it is no longer ISA-centric, and is fully dynamic.
Most old drivers compile and run without modification via 'compatability
shims' to enable a smoother transition. eisa, isapnp and pccard* are
not yet using the new resource manager. Once fully converted, all drivers
will be loadable, including PCI and ISA.

(Some other changes appear to have snuck in, including a port of Soren's
ATA driver to the Alpha. Soren, back this out if you need to.)

This is a checkpoint of work-in-progress, but is quite functional.

The bulk of the work was done over the last few years by Doug Rabson and
Garrett Wollman.

Approved by: core


# 44628 10-Mar-1999 yokota

Keyboard driver update in preparation for the USB keyboard driver.

- Refined internal interface in keyboard drivers so that:
1. the side effect of device probe is kept minimal,
2. polling mode function is added,
3. and new ioctl and configuration options are added (see below).

- Added new ioctl: KDSETREPEAT
Set keyboard typematic rate. There has existed an ioctl command,
KDSETRAD, for the same purpose. However, KDSETRAD is dependent on
the AT keyboard. KDSETREPEAT provides more generic interface.
KDSETRAD will still be supported in the atkbd driver.

- Added new configuration options:
ATKBD_DFLT_KEYMAP
Specify a keymap to be used as the default, built-in keymap.
(There has been undocumented options, DKKEYMAP, UKKEYMAP, GRKEYMAP,
SWKEYMAP, RUKEYMAP, ESKEYMAP, and ISKEYMAP to set the default keymap.
These options are now gone for good. The new option is more general.)

KBD_DISABLE_KEYMAP_LOADING
Don't allow the user to change the keymap.


# 43664 05-Feb-1999 yokota

- Don't assume the line length in the video memory is always the same as
the screen width.
- Store the current video mode information in the `video_adapter' struct.
- The size of the `v_offscreensize' field in the VESA mode information
block is u_int16, not u_int8.


# 43425 30-Jan-1999 phk

Use suser() to check for super user rather than examining cr_uid directly.
Use TTYDEF_SPEED rather than 9600 a couple of places.

Reviewed by: bde, with a few grumbles.


# 43351 28-Jan-1999 dillon

Fix warnings related to -Wall -Wcast-qual


# 43314 27-Jan-1999 dillon

Fix warnings in preparation for adding -Wall -Wcast-qual to the
kernel compile


# 43228 26-Jan-1999 yokota

Pull down the splash screen when someone is about to read from the
keyboard. Do this in scread(), rather than in scopen().


# 42831 19-Jan-1999 yokota

syscons
- Bring down the splash screen when a vty is opened for the first
time.
- Make sure the splash screen/screen saver is stopped before
switching vtys.
- Read and save initial values in the BIOS data area early.
VESA BIOS may change BIOS data values when switching modes.
- Fix missing '&' operator.
- Move ISA specific part of driver initialization to syscons_isa.c.

atkbd
- kbdtables.h is now in /sys/dev/kbd.

all
- Adjust for forthcoming alpha port. Submitted by: dfr


# 42748 17-Jan-1999 yokota

- Examine the error code from the screen saver and act accordingly.
0 success
EAGAIN try again later
other don't call this screen saver again
- Test flags consistently to examine the status of the screen saver.
scrn_blanked: the screen saver is running
scp->status & SAVER_RUNNING: the saver is running in this vty
- Correctlyu preserve status flag bits in set/restore_scrn_saver_mdoe().


# 42610 12-Jan-1999 yokota

Get conditional compilation right so that unnecessary reference
to splash-relatec call won't be made if there is no splash pseudo
device.


# 42504 11-Jan-1999 yokota

The first stage of console driver reorganization: activate new
keyboard and video card drivers.

Because of the changes, you are required to update your kernel
configuration file now!

The files in sys/dev/syscons are still i386-specific (but less so than
before), and won't compile for alpha and PC98 yet.

syscons still directly accesses the video card registers here and
there; this will be rectified in the later stages.


# 42373 07-Jan-1999 yokota

Remove a hard-coded table of kernel console I/O functions exported
from sc, vt and sio drivers. Use instead a linker_set to collect them.

Staticize ??cngetc(), ??cnputc(), etc functions in sc and vt drivers.
We must still have siocngetc() and siocnputc() as globals because they
are directly referred to by i386-gdbstub.c :-(

Oked by: bde


# 41591 07-Dec-1998 archie

The "easy" fixes for compiling the kernel -Wunused: remove unreferenced static
and local variables, goto labels, and functions declared but not defined.


# 41004 08-Nov-1998 dfr

* Fix a couple of places in the device pager where an address was
truncated to 32 bits.
* Change the calling convention of the device mmap entry point to
pass a vm_offset_t instead of an int for the offset allowing
devices with a larger memory map than (1<<32) to be supported
on the alpha (/dev/mem is one such).

These changes are required to allow the X server to mmap the various
I/O regions used for device port and memory access on the alpha.


# 40836 03-Nov-1998 yokota

Don't update the screen while the cursor shape is being changed
by the user-land program.
PR: i386/8344


# 40565 22-Oct-1998 bde

Initialize isa_devtab entries for interrupt handlers in individual
device drivers, not in ioconf.c. Use a different hack in isa_device.h
so that a new config(8) is not required yet.

pc98 parts approved by: kato


# 39874 01-Oct-1998 ache

Restore static of sc_flags.
Restore set_destructive_cursor prototype.


# 39858 01-Oct-1998 yokota

Yet another round of fixes for the VESA support code.

- Express various sizes in bytes, rather than Kbytes, in the video
mode and adapter information structures.
- Fill 0 in the linear buffer size field if the linear frame buffer
is not available.
- Remove SW_VESA_USER ioctl. It is still experimetal and was not meant
to be released.
- Fix missing cast operator.
- Correctly handle pointers returned by the VESA BIOS. The pointers
may point to the area either in the BIOS ROM or in the buffer supplied
by the caller.
- Set the destructive cursor at the right moment.


# 39742 29-Sep-1998 ache

Fix destructive cursor shape after text mode switch.
This is only for standard modes, I don't check vesa modes yet.


# 39668 26-Sep-1998 yokota

Cosmetic changes:
- there were too many global variables (there still are :-).
- the data section was bloated by explicit initializations of static
variables to 0 (only fixed the recently changed ones).
- WRAPHIST() had silly parentheses around foo->bar.
- the comment about inline functions was stale.
- the comment about Userconfig presumes too much about the boot environment.
- `i' was reused confusingly in scioctl().
- the declaration of `butmap' used a deprecated K&R misfeature.
- the initializeation of `butmap' had an unnecessary line break.
- `unsigned char' was not consistently (mis)spelled as u_char.
- English was poor in a comment in videoio.c.
Submitted by: bde


# 39667 26-Sep-1998 yokota

- Use `u_long cmd' ioctl arg.
- Fix some external function declaration.
Submitted by: bde


# 39591 23-Sep-1998 yokota

Fix and update for VESA BIOS support in syscons.

- Handle pixel (raster text) mode properly.
- Clear screen and paint border right.
- Paint text attribute (colors).
- Fix off-by-one errors.
- Add some sanity checks.
- Fix some function prototypes.
- Add some comment lines.
- Define generic text mode numbers so that the user can just give
"80x25", "80x60", "132x25"..., rather than "VGA_xxx", to `vidcontrol'
to change the current video mode. `vidoio.c' and `vesa.c' will map
these numbers to real video mode numbers appropriate and available
with the given video hardware. I believe this will be useful to make
syscons more portable across archtectures.


# 39287 15-Sep-1998 sos

Add VESA support to syscons.

Kazu writes:

The VESA support code requires vm86 support. Make sure your kernel
configuration file has the following line.
options "VM86"
If you want to statically link the VESA support code to the kernel,
add the following option to the kernel configuration file.
options "VESA"

The vidcontrol command now accepts the following video mode names:
VESA_132x25, VESA_132x43, VESA_132x50, VESA_132x60, VESA_800x600

The VESA_800x600 mode is a raster display mode. The 80x25 text will
be displayed on the 800x600 screen. Useful for some laptop computers.

vidcontrol accepts the new `-i <info>' option, where <info> must be
either `adapter' or `mode'. When the `-i adapter' option is given,
vidcontrol will print basic information (not much) on the video
adapter. When the `-i mode' option is specified, vidcontrol will
list video modes which are actually supported by the video adapter.

Submitted by: Kazutaka YOKOTA yokota@FreeBSD.ORG


# 39162 14-Sep-1998 sos

Make /dev/vga a softlink to /dev/ttyv0 under DEVFS using /etc/rc.devfs

Remove the hack from syscons that added a /dev/vga node in DEVFS
it broke root acces on ttyv0 because dev_mkdb screwed up.


# 38485 23-Aug-1998 bde

Added D_TTY to the cdevswitch flags for all tty drivers. This is required
for the Lite2 fix for always returning EIO in dead_read().

Cleaned up the cdevswitch initializers for all tty drivers.

Removed explicit calls to ttsetwater() from all (tty) drivers. ttsetwater()
is now called centrally for opens, not just for parameter changes.


# 38421 18-Aug-1998 sos

Fix one forgotten instance of \n to \r


# 38313 14-Aug-1998 sos

Changed \n to \r in the mouse cutbuffer, this makes pine & Emacs
behave better when using the cut&paste functionality.

Submitted by: Barry Bierbauch <pivrnec@vszbr.cz>


# 38216 10-Aug-1998 yokota

A workaround for screen flicker; eliminate some I/O access to the VGA
chip.

It has been observed that the problem is most apparent:

a) in notebook computers,
b) and/or in the systems with C&T video chips.

Define the new configuration option SC_BAD_FLICKER in the kernel
configuration file to remove outb()/outw() calls in question.


# 38052 03-Aug-1998 yokota

1. Reorganized screen saver related code so that both the LKM screen
saver and splash screen can all work properly with syscons. Note that
the splash screen option (SC_SPLASH_SCREEN) does not work yet, as it
requires additional code from msmith.

- Reorganized the splash screen code to match the latest development
in this area.
- Delay screen switch in `switch_scr()' until the screen saver is
stopped, if one is running,
- Start the screen saver immediately, if any, when the `saver' key is
pressed. (There will be another commit for `kbdcontrol' to support
this keyword in the keymap file.)
- Do not always stop the screen saver when mouse-related ioctls
are called. Stop it only if the mouse is moved or buttons are
clicked; don't stop it if any other mouse ioctls are called.

2. Added provision to write userland screen savers. (Contact me if you
are interested in writing one.)

- Added CONS_IDLE, CONS_SAVERMODE, and CONS_SAVERSTART ioctls to
support userland screen savers.

3. Some code clean-ups.


# 38047 03-Aug-1998 yokota

- When the system is shut down, switch to the vty0 if possible.
- Don't try to ring bell when system is going down. Beacuse the clock
code is about to be stopped, the timeout routine won't be called
anymore.


# 38046 03-Aug-1998 yokota

Fix the bug which always reallocated the cut buffer whenever
the screen mode is changed even if another vty has larger size.
Reallocate the buffer only when the new screen size is larger than
the current cut buffer size.


# 38045 03-Aug-1998 yokota

Don't accept the blank time value, if it is too big.

PR: bin/6188


# 38043 03-Aug-1998 yokota

- Add new bell types: "quiet.normal" and "quiet.visual".
When bell is of "quiet" types, the console won't ring (or flush)
if the ringing process is in a background vty.
PR: i386/2853

- Modify the escape sequence 'ESC[=%d;%dB' so that bell pitch and
duration are set in hertz and msecs by kbdcontrol(1).
There will be a corresponding kbdcontrol patch.
PR: bin/6037
Submitted by: Kouichi Hirabayashi (kh@eve.mogami-wire.co.jp)


# 37683 15-Jul-1998 bde

Changed %n to %r in devfs name format strings. %n has almost gone away.


# 37639 14-Jul-1998 bde

Don't pretend to support ix86's with 16-bit ints by using longs
just to ensure 32-bit variables. Doing so broke i386's with 64-bit
longs.


# 37414 06-Jul-1998 imp

Add the ability to suspend as well as hibernate to the system. This
is the kernel part of my commits, the userlevel stuff will be done in
a separate commit. Add the ability to suspend as well as hibernate to
syscons. Create a new virtual key like hibernate for suspend. Update
apm_bios.h to define more apm bios goodies.


# 37136 24-Jun-1998 yokota

Don't refer to mouse_info.u.datea.[xyz] while processing MOUSE_BUTTON_EVENT
ioctl. These fields don't have valid values for this ioctl.
PR: kern/6928
Submitted by: Bill Fenner <fenner@parc.xerox.com>


# 36948 13-Jun-1998 steve

Add a symlink from /dev/vga to /dev/ttyv0 when using DEVFS
for programs like doscmd.

PR: 6920
Submitted by: Luoqi Chen <luoqi@chen.ml.org>


# 36735 07-Jun-1998 dfr

This commit fixes various 64bit portability problems required for
FreeBSD/alpha. The most significant item is to change the command
argument to ioctl functions from int to u_long. This change brings us
inline with various other BSD versions. Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.

The prototype FreeBSD/alpha machdep will follow in a couple of days
time.


# 36119 17-May-1998 phk

s/nanoruntime/nanouptime/g
s/microruntime/microuptime/g

Reviewed by: bde


# 35248 17-Apr-1998 des

Stop the screensaver before switching consoles.


# 35223 16-Apr-1998 des

Swapped "should we just return" and "should we stop the screensaver"
in scrn_timer() to avoid deadlock with graphical screensavers.


# 35030 04-Apr-1998 yokota

More fixes to deal with fonts:
- Set the correct value scp->font_size in init_scp().
- Set scp->font_size to FONT_NONE for VGA_MODEX.

Interim fix for a font problem:
- A kludge to display the correct font on some video cards.
We should be able to load multiple fonts to the VGA plane #2 and switch
between fonts by setting the font select register in the VGA sequencer.
It appears that the current code isn't functioning as expected on
some VGA cards (I have reports on Millenium and Mach64 cards). This is
either a bug in syscons or a hardware compatibility problem ;-<
This kludge will always load only one font set at a time and always use
the font page #0 on the plane #2. It is an interim kludge until
we find the exact cause and solution.

Small adjustment for mouse cursor handling:
- Turn off the mouse cursor early when changing video modes.

Video mode switch fixes:
- Stop the screen saver when changing video modes.
- Enclose the critical section with a pair of spltty()/splx().
- A kludge to prevent scrn_update() from accessing video memory in less-
critical sections in video mode change; artificially turn on the
UNKNOWN_MODE flag.

PR: bin/5899, bin/5907
Tested by: ache and a couple of users
OKed by: sos


# 35029 04-Apr-1998 phk

Time changes mark 2:

* Figure out UTC relative to boottime. Four new functions provide
time relative to boottime.

* move "runtime" into struct proc. This helps fix the calcru()
problem in SMP.

* kill mono_time.

* add timespec{add|sub|cmp} macros to time.h. (XXX: These may change!)

* nanosleep, select & poll takes long sleeps one day at a time

Reviewed by: bde
Tested by: ache and others


# 33327 13-Feb-1998 phk

Fix a couple of lines that dropped out in my merge yesterday.

Complained about by: ache


# 33321 13-Feb-1998 phk

Hmm, it is generally an advantage to commit the most recent version of
ones changes: A faster character painter procedure and fix on cursor
bug.


# 33283 12-Feb-1998 phk

Add support for VESA mode 0x102 (800x600x4) in syscons. You can activate
this using option "-b" to the boot blocks. It is smartest to compile
a font into your kernel (See LINT), but not mandatory, but apart from
the cursor you will see nothing on the screen until you load a font.

This mode allows XF86_VGA16 to run in 800x600 mode on otherwise unsupported
graphics hardware.

A number of buglets in the cursor handling in syscons may become
visible this way.


# 33280 12-Feb-1998 phk

Fix a white-space nit which I happened to notice.


# 33272 12-Feb-1998 yokota

Oops, sorry, a #define line for my debugging session slipped into
the last commit ;-<


# 33242 11-Feb-1998 yokota

- Move the mouse cursor to the center of the screen after video
mode switch in ioctl.
Possibly related to PR: kern/4271

- A kludge: initialize scp->xpixel and ypixel even in the text mode.
If the console enters the `unknown' graphics mode via the ioctl KDSETMODE
(KD_GRAPHICS), these fields are not set (because syscons cannot know
the correct values), but set_mouse_pos() need to refer to these field
to adjust the mouse position.

- Turn off MOUSE_VISIBLE when switching video mode by ioctl.

- another new option: SC_MOUSE_CHAR
Define the first character code of four consecutive codes to be used for
the mouse cursor. Default codes are 0xd0 through 0xd3. Beware that
if you decide to use any codes outside the range of 0xc0-0xdf,
the mouse cursor may not look good, because of the way VGA displays
characters in 9-dot-wide character cells.
Requested by several people.

(This patch was tested by a person who recently reported, in the -current
ML, a page fault problem in the kernel (draw_mouse_iamge()) after
X server shutdown. The patch cured his problem.)


# 33241 11-Feb-1998 yokota

- A new semaphore: font_loading_in_progress.
Don't touch/update the screen while manipulating font data.
Possibly related to PR: kern/4271

- Set up VGA in alphanumeric mode rather than graphics mode when
loading font into video memory. This will drastically reduce flicker.
PR: bin/2977

- Set up scp->font_size properly during video mode switch caused by
ioctl.


# 33240 11-Feb-1998 yokota

- Break scrn_timer() into two pieces. Now screen update is done in a
separate routine: scupdate() called from scrn_timer().

- Make sure that the screen is updated for the low-level console
routines sccngetc() and sccncheckc(). A new routine, sccnupdate(),
is introduced and will call scupdate() above.
Requested by: bde and msmith

OKed by: sos


# 33239 11-Feb-1998 yokota

- Ignore KBD_RAW_MODE and KBD_CODE_MODE in scgetc() when it's called
from the low-level console routines sccngetc() and sccncheckc().
Submitted by: bde (a long time ago)

- Don't try to ring bell and immediately return from do_bell() while
device probe is in progress at boot time; the timeout queue is not
functional yet.
PR: kern/2424

- Stop running the screen saver after panic() is called: check
if `panicstr' is non-NULL during scrn_timer().
PR: kern/5314

- A new option: SC_DISABLE_REBOOT
The reboot key (usually Ctl-Alt-Del) will be ignored if this option
is defined. You may still have the reboot key defined in the keymap and
it won't cause error when the keymap is loaded, but it will be quietly
treated as nop.

OKed by: sos


# 32726 24-Jan-1998 eivind

Make all file-system (MFS, FFS, NFS, LFS, DEVFS) related option new-style.

This introduce an xxxFS_BOOT for each of the rootable filesystems.
(Presently not required, but encouraged to allow a smooth move of option *FS
to opt_dontuse.h later.)

LFS is temporarily disabled, and will be re-enabled tomorrow.


# 32633 20-Jan-1998 yokota

- Add binary compatibility support for obsolete console/mouse ioctls
so that existing programs which were compiled before the introduction
of the new mouse code and use these ioctls will run unmodified.

Suggested by msmith.


# 32457 12-Jan-1998 julian

add devfs entries for a few more syscons devices (e.g. sysmouse)


# 32364 09-Jan-1998 yokota

- Produce the accent letter if the user hits the accent key twice.
(accent_key + space does still print the accent letter too, as in
the previous commit.)
Requested by a couple of users.
- Clear the accent flag when the next_screen key is pressed.
- Added some comment lines regarding accent key processing.


# 32315 07-Jan-1998 yokota

Added accent (dead) key support to syscons and kbdcontrol.

With a keymap with accent key definitions loaded to syscons, you press
an accent key followed by a regular letter key to produce an accented
letter. Press an accent key followed by the space bar to get the
accent letter itself.

Code is based on the ideas and work by jmrueda@diatel.upm.es and
totii@est.is.

PR: i386/4016

console.h
- Defined structures and constants for accent (dead) keys.

syscons.c, kbdtables.h
- When an accent key is pressed, set the corresponding index to
`accents'. If the next key is the space key, produce the accent char
itself. Otherwise search the accent key map entry, indexed by
`accents', for a matching pair of a regular char and an accented char.
- Added ioctl functions to set and get the accent key map (PIO_DEADKEYMAP
and GIO_DEADKEYMAP).


# 31603 07-Dec-1997 yokota

- Add support for the following mice to psm/moused/sysmouse:

MS IntelliMouse, Kensington Thinking Mouse, Genius NetScroll,
Genius NetMouse, Genius NetMouse Pro, ALPS GlidePoint, ASCII
MieMouse, Logitech MouseMan+, FirstMouse+

- The `psm' driver is made to recognize various models of PS/2 mice
and enable their extra features so that their additional buttons and
wheel/roller are recognized. The name of the detected model will be
printed at boot time.

- A set of new ioctl functions are added to the `psm', `mse' and
`sysmouse' drivers so that the userland program (such as the X server)
can query device information and change driver settings.

- The wheel/roller movement is handled as the `Z' axis movement by the
mouse drivers and the moused daemon. The Z axis movement may be mapped
to another axis movement or buttons.

- The mouse drivers support a new, standard mouse data format,
MOUSE_PROTO_SYSMOUSE format which can encode x, y, and x axis movement
and up to 10 buttons.

/sys/i386/include/mouse.h
- Added some fields to `mousestatus_t' to store Z axis movement
and flag bits.
- Added the field `model' to `mousehw_t' to store mouse model code.
Defined model codes.
- Extended `mousemode_t'.
- Added new protocols and some constants for them.
- Added new ioctl functions and structures.
- Removed obsolete ioctl definitions.

/sys/i386/include/console.h
- Added `dz' field to the structure `mouse_data' to pass Z axis movement
to `syscons/sysmouse'.
- Removed LEFT_BUTTON, MIDDLE_BUTTON and RIGHT_BUTTON. Use button bits
defined in `mouse.h' instead.

/sys/i386/isa/psm.c
- Added a set of functions to detect various mice which have additional
features (wheel and buttons) unavailable in the standard PS/2 mouse.
- Refined existing ioctl functions and added new ones. Most important
of all is MOUSE_SETLEVEL which manipulates the output level of the driver.
While the output level remains zero, the output from the `psm' driver is
in the standard PS/2 mouse format (three bytes long). When the level
is set to one, the `psm' driver will send data in the extended format.
At the level two the driver uses the format which is native to the
connected mouse is used. (Meaning that the output from the device is
passed to the caller as is, unmodified.) The `psm' driver will pass
such extended data format as is to the caller if the output level is
two, but emulates the standard format if the output level is zero.
- Added kernel configuration flags to set initial resolution
(PSM_CONFIG_RESOLUTION) and acceleration (PSM_CONFIG_ACCEL).
- Removed the compile options PSM_ACCEL, PSM_CHECKSYNC and PSM_EMULATION.
Acceleration ratio is now specified by the kernel configuration flags
stated above. Sync check logic is refined and now standard.
The sync check can be turned off by the new kernel configuration flags
PSM_CONFIG_NOCHECKSYNC (0x100). PSM_EMULATION has been of little use.
- Summer clean up :-) Removed unused code and obsolete comments.

/sys/i386/isa/mse.c
- Created mseioctl() to deal with ioctl functions MOUSE_XXXX.
Most importantly, the MOUSE_SETLEVEL ioctl will change the
output format from the 5 byte format to the new, extended format
so that the caller can take advantage of Z axis movement and additional
buttons.
- Use constants defined in `mouse.h' rather than magic numbers.

/sys/i386/isa/syscons.c
- Changed scioctl() to reflect the new `console.h' and some of the new
ioctls defined in `mouse.h'. Most importantly, the MOUSE_SETLEVEL
ioctl will change the `sysmouse' output format from the MouseSystems
5 byte format to the new, extended format so that the caller can
take advantage of Z axis movement and additional buttons.
- Added support for double/triple click actions of the left button and
single click action of the right button in the virtual console. The
left button double click will select a word under the mouse pointer.
The triple click will select a line and the single click of the right
button will extend the selected region to the current position of
the mouse pointer. This will make the cut/paste support more compatible
with xterm.

/sys/i386/isa/kbdio.h
- Added PSM_INTELLI_ID.


# 31577 06-Dec-1997 bde

Use ENOIOCTL instead of -1 (= ERESTART) for tty ioctls that are
not handled at a particular level. This fixes mainly restarting
of interrupted TIOCDRAINs and TIOCSETA{W,F}s.


# 31412 25-Nov-1997 sos

Move the hardware currsor off screen when getting back from an
unknown mode.
Fix warning on uninitialized var.


# 31334 21-Nov-1997 yokota

Make comp_vgaregs() less strict about VGA register values when
checking the BIOS video mode paramter table. Now syscons uses the
parameter table even if some bits in the table are different from the
current VGA register settings.

Even if comp_vgaregs() finds that the BIOS video parameter table looks
totally unfamiliar to it, syscons allows the user to change the
current video mode to some modes which are based on the VGA 80x25
mode. They are VGA 80x30, VGA 80x50, VGA 80x60. In this case the user
will be warned, during boot, that video mode switching is only
paritally supported on his machine.

PR: bin/4477


# 31017 07-Nov-1997 phk

Rename some local variables to avoid shadowing other local variables.

Found by: -Wshadow


# 31016 07-Nov-1997 phk

Remove a bunch of variables which were unused both in GENERIC and LINT.

Found by: -Wunused


# 30726 26-Oct-1997 yokota

- Slightly change the way the border color register is updated so that
flicker won't occur when set_border() is called.

- Properly restore the border color when switching virtual consoles.

Pointed out by: tony@dell.com
OKed by: sos


# 30662 23-Oct-1997 yokota

Reject unreasonable values passed to CONS_HISTORY ioctl. It did not
check the value and caused kernel panic when a large value was given.

- Move the configuration option SC_HISTORY_SIZE from syscons.h to
syscons.c.
- Define the maximum total number of history lines of all consoles.
It is SC_HISTORY_SIZE*MAXCONS or 1000*MAXCONS; whichever is larger.
CONS_HISTORY will allow the user to set the history size up to
SC_HISTORY_SIZE unconditionally (or the current height of the console
if it is larger than SC_HISTORY_SIZE). If the user requests a larger
buffer, it will be granted only if the total number of all allocated
history lines and the requested number of lines won't exceed the maximum.
- Don't free the previous history buffer and leave the history buffer
pointer holding a invalid pointer. Set the pointer to NULL first, then
free the buffer.

PR: bin/4592


# 30043 01-Oct-1997 sos

Add a new keyboard mode K_CODE. Returns a single byte for each key
much like the scancode mode.
However the keys that (for no good reason) returns extension codes
etc, are translated into singlebyte codes.
Needed by libvgl. This makes life ALOT easier, also the XFree86
folks could use this.


# 29875 26-Sep-1997 itojun

tiny update of ESC sequence parser.
- some addition of comments (for readability)
- iso-2022 G0 designation support. This does almost nothing. Just for
avoiding garbled screen when got "ESC ( B".
(how about G1/2/3 designation? I'm not sure)


# 29368 14-Sep-1997 peter

Update select -> poll in drivers.


# 29121 04-Sep-1997 yokota

Add a new compile option SC_HISTORY_SIZE to specify the history buffer
size in terms of lines (instead of bytes). When changing video mode
in ioctl SW_XXX commands, syscons checks scp->history_size and
allocate a history buffer at least as large as the new screen size.
(This was unnecessary before, because HISTORY_SIZE was as large as 100
lines and this is bigger than the maximum screen size: 60 lines).
Similar adjustment is done in ioctl CONS_HISTORY command too.

PR: kern/4169
Reviewed by: sos


# 28022 09-Aug-1997 sos

Fix the checks for screenborder for the mousepointer.


# 27990 08-Aug-1997 sos

Yeah I'm back hacking syscons !!

Add support for MODEX 320x240x256color with "unchained" adressing, giving
access to all 256K on all VGA's, those with that much memory that is :)

Also make sysmouse use the right resolution in graphics modes.


# 27699 26-Jul-1997 phk

Fix a brino in my last commit.

Noticed by: smp


# 27674 25-Jul-1997 phk

Add option for compiling in a 8x16 font.


# 27555 20-Jul-1997 bde

Removed unused #includes.


# 27426 15-Jul-1997 yokota

Screen saver related fixes.

1. Add new interface, add_scrn_saver()/remove_scrn_saver(), to declare
loading/unloading of a screen saver. The screen saver calls these
functions to notify syscons of loading/unloading events.

It was possible to load multiple savers each of which will try to
remember the previous saver in a local variable (`old_saver'). The
scheme breaks easily if the user load two savers and unload them in a
wrong order; if the first saver is unloaded first, `old_saver' in the
second saver points to nowhere.

Now only one screen saver is allowed in memory at a time.

Soeren will be looking into this issue again later. syscons is
becoming too heavy. It's time to cut things down, rather than adding
more...

2. Make scrn_timer() to be the primary caller of the screen saver
(*current_saver)(). scintr(), scioctl() and ansi_put() update
`scrn_time_stamp' to indicate that they want to stop the screen saver.

There are three exceptions, however.

One is remove_scrn_saver() which need to stop the current screen saver
if it is running. To guard against scrn_timer() calling the saver during
this operation, `current_saver' is set to `none_saver' early.

The others are sccngetc() and sccncheckc(); they will unblank the
screen too. When the kernel enters DDB (via the hot key or a
break point), the screen saver will be stopped by sccngetc().
However, we have a reentrancy problem here. If the system has been in
the middle of the screen saver...

(The screen saver reentrancy problem has always been with sccnputc()
and sccngetc() in the -current source. So, the new code is doing no
worse, I reckon.)

3. Use `mono_time' rather than `time'.

4. Make set_border() work for EGA and CGA in addition to VGA. Do
nothing for MDA.

Changes to the LKM screen saver modules will follow shortly. YOU NEED
TO RECOMPILE BOTH SCREEN SAVERS AND KERNEL AS OF THESE CHANGES.

Reviewed by: sos and bde


# 27385 14-Jul-1997 yokota

scgetc() referred to `spcl' in different ways when a key is pressed
and released. It should use `spcl' consistently in both cases,
otherwise shift/control/alt state may not be correctly set/reset.

(Even with this fix, you can still make syscons confused and fail to
change internal state if you really want to, by installing a really
arcane and artificial keymap.)

PR: i386/4030
Reviewed by: sos


# 27293 09-Jul-1997 brian

Don't allow CONS_HISTORY ioctl to alter history pointers
while in "scroll mode" (return EBUSY).
Suggested by: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>


# 27276 08-Jul-1997 brian

Remove useless comparison.

Suggested by: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>


# 27263 07-Jul-1997 brian

YAMF2.2: Handle indirect results of "kbdcontrol -h X"
where X < 25.


# 27114 30-Jun-1997 yokota

Fixes annoying behavior and a bug regarding the destructive
cursor (CHAR_CURSOR)

1. Reduced the number of calls to set_destructive_cursor(). The
destructive cursor produced noticeable overhead on the system. It was
caused by draw_cursor_image() calling set_destructive_cursor() every
so often.

set_destructive_cursor() absolutely needs to be called when

a) the character code under the cursor has changed either because
the cursor moved or because the screen was updated or the mouse
pointer overlapped the cursor.
b) Or a new font has been loaded,
c) or the video mode has been changed,
d) or the cursor shape has been changed,
e) or the user switched virtual consoles.

2. Turn off the configuration flag CHAR_CURSOR (destructive cursor) in
scattach() if we have a non-VGA card. The destructive cursor works
only for VGA.

3. Removed redundant calls to set_destructive_cursor() in some places.

4. Fixed the "disappearing mouse pointer" problem. The mouse pointer
looked hidden under the destructive cursor when it overlaped the cursor.

A slightly different version of the patch was reviewd and OKed by
sos and ache.


# 27084 29-Jun-1997 ache

dev->id_flags --> flags
(not compiles otherwise)


# 27063 29-Jun-1997 yokota

A fix/work-around for ThinkPad 535.

Add a new configuration flag, KBD_NORESET (0x20) to tell scprobe() not
to reset the keyboard.

IBM ThinkPad 535 has the `Fn' key with which the user can perform
certain functions in conjunction with other keys. For example, `Fn' +
PageUP/PageDOWN adjust speaker volume, `Fn' + Home/End change
brightness of LCD screen. It can also be used to suspend the system.

It appears that these functions are implemented at the keyboard level
or the keyboard controller level and totally independent from BIOS or
OS. But, if the keyboard is reset (as is done in scprobe()), they
become unavailable. (There are other laptops which have similar
functions associated with the `Fn' key. But, they aren't affected by
keyboard reset.)

ThinkPad 535 doesn't have switches or buttons to adjust brightness and
volume, or to put the system into the suspend mode. Therefore, it is
essential to preserve these `Fn' key functions in FreeBSD. The new
flag make scprobe() skip keyboard reset.

If this flag is not set, scprobe() behaves in the same say as before.

(If we only knew a way to detect ThinkPad 535, we could skip keyboard
reset automatically, but...)


# 26807 22-Jun-1997 yokota

The syscons driver doesn't really check the presence of the display
adapter during the system boot. It always assumes there is at least a
monochrome adapter.

This is rather strange assumption. If there is no dispaly adapter, the
console driver cannot be any good...

In this patch, scinit() is split into two parts; the first part is
now called scvidprobe() which will detect the presence of video card
at the CGA or MONO buffer address and returns TRUE if found. It is
called during sccnprobe() and scprobe(). Both will fail if no video
card is found.

The second part, whose name stays the same as before, scinit(), is
called from sccninit() and scattach() to complete initialization of
the found video card.

The keyboard probe code is moved from scprobe() to sckbdprobe();
scprobe() now calls scvidprobe() and sckbdprobe() to carry out device
probe. (This is rather a cosmetic change, but it sure makes the code
look better organized.)

The problem pointed out by Joerg.


# 25828 15-May-1997 yokota

1) font loading (two fixes)

When an ioctl command SW_XXXX is issued, scioctl() checks if the font
appropriate for the specified mode is already loaded. The check was
correctly done for 8 line and 16 line fonts, but not for 14 line font.

The symbols FONT_8, FONT_14 and FONT_16 were defined as numbers but
were sometimes treated as bit flags. They are now defined as bit
flags.

2) screen blinking (two fixes)

Removed a redundant call to timeout() in do_bell().

Don't let blink_screen() write to the video buffer if the screen is in
the graphics (UNKNOWN) mode.

3) screen saver timeout

The ioctl command CONS_BLANKTIME sets the screen saver's timeout. The
value of zero will disable the screen saver. If the screen saver is
currently running it should be stopped.

4) border color and destructive cursor (two fixes)

The border color and the cursor type can be changed via escape
sequences. But only VGA can change the border color and set the
cursor type to destructive (CHAR_CURSOR) in the current syscons.
scan_esc() failed to check this.

Reviewed by: sos


# 25552 07-May-1997 peter

simplify IOPL gain/remove privs code. It's easier with md_regs
being a trapframe.


# 25527 07-May-1997 yokota

Now that we have replaced video-related block copy calls with
sc_bcopy(), which is generic_bcopy() in reality, there is no point in
retaining bcopyw() calls in the source code.
OKed by : sos


# 25310 30-Apr-1997 ache

Restore CRTC start address check back after looking into more sources


# 25293 29-Apr-1997 ache

In comp_vgaregs skip cursor shape and 4 unused bytes (6 total)
instead of 2 unused.
Previus code broke syscons on Diamond Stealth 3D 3000
(video mode ptr was NULL with no real reason)


# 25190 27-Apr-1997 yokota

Addresses the following two problems.

1) i586_bcopy() problem

There have been a number of reports that the syscons doesn't work
properly if i586_bcopy() is enabled.

The problem prevented users from installing 2.2(.1)-RELEASE. The
symptom is that the system looks frozen during device probe or just
before the main installation menu. The workaround was to specify the
flag 0x01 to the npx device so that i586_bcopy() is disabled.

The patch forces the syscons to call generic_bcopy() when copying
to/from the video memory, even if CPU is Pentium and i586_bcopy() is
enabled. i586_bcopy() is still called for copy operations between
non-video memory regions.

PR: kern/2277, kern/3066, kern/3107, kern/3134

2) video mode parameter table problem

The syscons reads and uses the video mode parameter table provided by
the VGA BIOS to set VGA registers when changing video mode and
modifying font data. It appears that in some VGA BIOSes the table is
not ordered as the syscons expects, and this leads to screen
corruption.

The problem prevented users from installing 2.2(.1)-RELEASE. The
symptom is the corrupt screen or strange vertical lines soon after the
kernel is loaded into memory (just after the kernel decompression).

The patch performs simplistic test and if it fails, set video_mode_ptr
to NULL so that the video mode switching won't happen.

This is an interim kludge. There should be a better way to deal with
the problem.

PR: kern/2498, conf/2775, conf/3354

Reviewed by: sos
Tested by: PR originators (not all of them, though)


# 25049 20-Apr-1997 bde

Fixed the type of timeout functions and removed casts that hid the
type mismatches. Not taking an arg in scrn_timer() broke `cc -mrtd'.


# 24773 10-Apr-1997 yokota

Preserve some bits in the keyboard controller command byte when
resetting the keyboard.

Well, sorry, this bug is totally my fault. I DID intend to preserve
them, but somehow I failed.

The bug puts some old keyboard controllers in a strange state,
resulting in keyboard freeze or random key input.

The fix closes PR kern/3067.


# 24598 03-Apr-1997 brian

Make the default VERASE key the <-- key and remove root's
`stty's. 'nuff said.

Inventor: joerg@FreeBSD.org
Reviewer: sos@FreeBSD.org


# 24338 28-Mar-1997 yokota

Interim patch/kludge for keyboard lock-up when `kbdcontrol' tries to
change typematic rate, or the X server (XFree86 or Accelerated X)
starts up.

So far, there have been two independent reports from Dell Latitude XPi
notebook/laptop owners. The Latitude seems to be the only system which
suffers from this problem. (I don't know the problem is with the
entire Latitude line or with only some Latitude models) No problem
report has been heard about other systems (I certainly cannot
reproduce the problem in my -current and 2.2 systems).

In 3.0-CURRENT, 2.2-RELEASE and 2.2-GAMMA-970310, when programming the
keyboard LED/repeat-rate, `set_keyboard()' in `syscons' tells the
keyboard controller not to generate keyboard interrupt (IRQ1) and then
enable tty interrupts, expecting the keyboard interrupt doesn't occur.

It appears that somehow Latitude's keyboard controller still generates
the keyboard interrupt thereafter, and `set_keyboard()' doesn't see
the return code from the keyboard because it is consumed by the
keyboard interrupt handler.

The patch entirely disables tty interrupts while setting LED and
typematic rate in `set_keyboard()', making the routine behave more
like the previous versions of `syscons' (versions in 2.1.X and
2.2-ALPHA, -BETA, and some -GAMMAs). The reporter said this patch
eliminated the problem.

(I also found another typo/bug, but the reporter and I found that it
wasn't the cause of the problem...)

This should go into RELENG_2_2.


# 24203 24-Mar-1997 bde

Don't include <sys/ioctl.h> in the kernel. Stage 1: don't include
it when it is not used. In most cases, the reasons for including it
went away when the special ioctl headers became self-sufficient.


# 23248 01-Mar-1997 jmg

make sure that the user supplied signals in struct vt_mode are actually
valid signals, else return EINVAL for ioctl VT_SETMODE.

this fixes a problem that anybody with vty access can panic the system.

2.2-Candidate (and 2.1.0 I believe)

Reviewed-by: sos


# 23209 28-Feb-1997 bde

Fixed spelling error in a variable name.


# 23194 28-Feb-1997 yokota

Removed an obsolete test which prevented mouse movement from quiting
screen saver. Added a missing `break' statement in set_normal_mode().

Reviewed by: sos


# 22975 22-Feb-1997 peter

Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.


# 22640 13-Feb-1997 sos

Oops, cut/paste could be done on tthe WRONG vty :(
pointed out by Kazu.


# 22128 30-Jan-1997 sos

Fixed the "switch to next screen" command (normally bound to the
key "print scrn".
It used to stop at the first non-open vty, now it skips the non-open
ones and thereby enable one to cycle around all open vty by pressing
"print scrn".


# 21964 23-Jan-1997 sos

Add save/restore cursor as pr SCO screen(HW) manpage.
Fix ESC[2J to not move cursor home
Clear mouse cutmarking on more cases.
Minor changes by me.

Submitted by: ache


# 21884 20-Jan-1997 sos

Fix the bug that caused CTRL & ALT keys to be hanging sometimes after
an X seesion. Really stupid error of me, and I've been looking at
this code SO many times. Thanks to Kazutaka YOKOTA for seeing this..

Submitted by: Kazutaka YOKOTA


# 21875 19-Jan-1997 sos

Oops, the position of the savefont code was wrong, cur_console
wasn't set yet.


# 21849 18-Jan-1997 sos

Oops! I commented out the waiting for retrace loops, because the
one in draw_mouse causes spontanious hangs on my p5-100 when I
move the mouse excessively. Forgot that on the last commit, so
using the mouse or destructive cursor would produce large amounts
of flicker..


# 21805 17-Jan-1997 sos

Bruce pointed out a bogon:

cur_console is NULL when copy_font() is first called from scinit(). This
is apparently harmless when scinit() is called early from sccninit() -
page 0 is apparently mapped r/w then, and 0->status contains suitable
garbage. However, when there is a serial console, scinit() is first
called from scattach() when the page tables are completely initialized,
so the NULL pointer causes a panic.

Submitted by: bruce


# 21731 15-Jan-1997 sos

Upgrade the kbdio rutines to provide queued kbd & mouse events.
Minor other updates to syscons by me.

Submitted by: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 20664 18-Dec-1996 alex

Hawaii-Five-Typo


# 20197 07-Dec-1996 sos

Fix the broken support for monochrome VGA's.
It was MY fault after all, damn..


# 20073 01-Dec-1996 sos

Alot of fixes from kazu:

1. All the suggestions earlier made by Bruce: renaming some symbols,
stricter error checking, removing redundant code, etc.

2. The `psm' driver preserves the default counter resolution and
report rate, whatever they are after reset. (Based on reports and
suggestion from Nate and Rob Bolin).

3. The `psm' driver now does not check the so-called sync. bit in the
first byte of the data packet by default, so that the tapping feature
of ALPUS GlidePoint works (based on reports from Louis Mamakos). I
tested the code with ALPUS Desktop GlidePoint (M/N GP101) and found
no problem; tapping worked. It appears ALPUS produces several models
of GlidePoint. I hope the other models are OK too.

The check code can still be activated by defining the PSM_CHECKSYNC
option in the config file. (The bit checking slightly reduces, if not
completely eliminates, weird mouse behavior cased by unsynchronized
mouse data packets. It also helps us to detect if the mouse interrupt
can ever be lost. But, well, if there are devices which cannot be
supported this way...)

4. The `psm' driver does not include the protocol emulation code by
default. The code can still be compiled in if the PSM_EMULATION option
is specified in the config file. Louis Mamakos suggests the emulation
code is putting too much in the kernel, and `moused' works well.
I will think about this later and decide if the entire emulation
code should be removed.

5. And, of course, the fix in `scprobe()' from Bruce to cure the
UserConfig problem. My code in `kbdio.c' is slightly different from
his patch, but has the same effect. There still is a possibility that
`scprobe()' gets confused, if, for whatever reasons, the user holds
down a key for very long time during the boot process. But we cannot
cope with everything, can we?

Submitted by: Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp)


# 19869 19-Nov-1996 nate

Fix UserConfig w/syscons.

The 'getchar' function in syscons (sccngetc) is used by UserConfig to
get keyboard input from the user. When it was modified to use the
shared keyboard port routines it used the port passed in during the
probe routine. Since the probe routine was not yet called, the port was
set to 0, which is obviously not going to work.

Pre-initialize sc_port to IO_KBD which is really a kludge, but it's how
the previous driver did it's job.

Found by: remote GDB


# 19771 15-Nov-1996 sos

Only poll the keyboard if the data left in the buffer is from the
kbd, not if its from the psm device.


# 19753 14-Nov-1996 sos

Finally a start at sharing the kdb controller routines between
syscons and psm, curtesy Kazutaka Yokota with minor changes by
me. This contains an update of the psm driver as well.
This also fixes the breakage that I introduced to the psm driver by
making syscons poll for keyboard events in the atempt to fix the
hanging keyboard problem.

It works perfectly for me, and I'd like to hear from all that
have had keyboard/ps/2 mouse problems if this is the cure...

Submitted by: Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp)


# 19658 11-Nov-1996 sos

1. Avoid a race in scclose(). tty.c has kludges so that the race is
actually harmless.

2. Fixed code to match comment in scintr().

3. Don't allow even root to take control of the machine when securelevel > 0.
I've secured the accesses to PSL_IOPL in all drivers and asked pst to
review it, but he seems to be busy. Write access to /dev/kmem and
other critival devices currently leaks across raisings of securelevel
via open fd's, so there may as well be a similar leak for PSL_IOPL.

4. (Most important.) Don't corrupt memory beyond the screen buffers if
the cursor happens to be off the 80x25 screen when syscons starts.

5. Fix console cursor update (not perfect yet).
Submitted by: bruce
~


# 19655 11-Nov-1996 nate

Removed 'XT_KEYBOARD' option from syscons. Document new-style way of
getting the same behavior using the flags, which can be done inside of
UserConfig. (Also document other syscons flags which were previously
undocumented).

Requested by: bde


# 19613 10-Nov-1996 nate

Allow us to enable the 'XT_KEYBOARD' code using a configuration flag.
This allows the user to add modify syscons's configuration flags using
UserConfig that will allow older/quirky hardware (most notably older IBM
ThinkPad laptops) to work with the standard boot kernel.

Inspired by: The Nomads


# 19405 04-Nov-1996 sos

Fix the hanging keyboard problem under Xaccel. Apprently we are loosing
an interrupt somewhere. The solution here is to check for keyboard
input each time the screen update timer ticks. Not pretty, but works.


# 19197 26-Oct-1996 sos

Use the calibrated/adjustable i8254 frequency `timer_freq' instead of
TIMER_FREQ.

Fixed missing splx() in scrn_timer(). The bug was harmless because of the
undocumented behaviour that the ipl is automatically restored for timeout
functions (see softclock()). Perhaps we should depend on this behaviour.

Fixed the ddb fix in rev.1.176. The in_debugger flag was no use because
it only works when the debugger is entered via the keyboard hotkey. The
debugger may be entered for breakpoints and traps, and the console putc
routine has no way of knowing when it was, so the console putc routine
must (almost?) always remove the cursor image.

Not fixed: console switching in ddb doesn't work (ISTR it working), and
console 0 shouldn't be switched to for the debugger hotkey unless console
0 is /dev/console.

Fixed side effects from calling add_keyboard_randomness() in the console
getc routine by not calling it. add_keyboard_randomness() currently
always reenables interrupts on 386's and 486's. This is very bad if the
console getc routine is called from the debugger and the debugger was
entered with interrupts disabled.

Fixed preservation of initial screen and now-bogus comment about it. It
was broken by setting the initial scr_buf to `buffer' instead of Crtat.
`buffer' was full of nulls and the first scroll cleared everything above
the things written through syscons.

Submitted by: bruce (bde@freebsd.org)


# 19123 23-Oct-1996 pst

Remove SC_KBD_PROBE_WORKS option and replace it with a simple run-time flag
bit (0x0008) in the sc driver configuration line. This way it's easy to
boink a generic kernel.

Also, document and place in an opt_ file the #define's for overriding which
serial port is the system console.
Approved by: sos


# 19022 18-Oct-1996 sos

Changed mouse functionality a bit, now the pointer disappears if
there is keyboard input.
The mousepointer is shown again immediately if moved.

Also a function pointer used to install a userwritten extra
ioctl handler (sc_user_ioctl). This way its is possible to
install user defined videomodes etc etc. No further changes
should be in the kernel.


# 18948 15-Oct-1996 sos

Corrected the setting of winsize on open().
Problem pointed out by David Nugent - davidn@blaze.net.au.


# 18831 09-Oct-1996 bde

Don't claim the console when the driver is disabled. The getc/putc
part of the console driver usually works when the driver is disabled,
but the normal read/write part doesn't (it caused a panic).


# 18647 02-Oct-1996 jkh

scresume erroneously used before declared. Move the function
rather than add another APM ifdef just for the forward decl.
[Boy, sure a lot of warnings in here!]


# 18646 02-Oct-1996 sos

Fixed the userconfig problem (and one with ddb as well).
The rudimentary support for a splash page is there, and works, it
just needs a splash page...


# 18629 01-Oct-1996 sos

Fixed the "missing updates" reported by ache.
Moved a little closer to having a splash page capability.


# 18617 01-Oct-1996 jkh

#ifdef another instance of toggle_splash_screen() which Soren missed.


# 18588 30-Sep-1996 sos

Dont make splash screen the default :)


# 18587 30-Sep-1996 sos

Fix a couble of nasties regarding mouse pointer and different
resolutions.
Allow middle mouse button to be used for pasting.
Also added the beginnings of support for a splash page.


# 18288 14-Sep-1996 bde

Changed cncheckc() interface so that it is 8-bit clean - return -1
instead of 0 if there is no input.

syscons.c:
Added missing spl locking in sccncheckc(). Return the same value as
sccngetc() would. It is wrong for sccngetc() to return non-ASCII, but
stripping the non-ASCII bits doesn't help.


# 18224 10-Sep-1996 peter

Hack workaround XFree86 switching failure when used with /dev/sysmouse
and xdm, possibly in general.

What was happening was that the server was doing a tcsetattr(.. TCSADRAIN)
on the mouse fd after a write. Since /dev/sysmouse had a null t_oproc,
the drain failed with EIO. Somehow this spammed XFree86 (!@&^#%*& binary
release!!), and the driver was left in a bogus state (ie: switch_in_progress
permanently TRUE).

The simplest way out was to implement a dummy scmousestart() routine to
accept any characters from the tty system and toss them into the void.

It would probably be more correct to intercept scwrite()'s to the mouse
device, but that's executed for every single write to the screen.
Supplying a start routine to eat the characters is only executed for the
mouse port during startup/shutdown, so it should be faster.


# 18191 09-Sep-1996 sos

The poor nsccons variable was gone agian this time hidden by
an ifdef , wonder who broke it this time :)

Submitted by: ache


# 18174 08-Sep-1996 sos

Make syscons replicate a mousesystems mouse on minor 128..

This enables other consumers of the mouse, to get it info via
moused/syscons.
In order to use it run moused (from sysconfig), and then tell
your Xserver that it should use /dev/sysmouse (mknod sysmouse c 12 128)
and it a mousesystems mouse. Everybody will be happy then :)
Remember that moused still needs to know what kind of mouse you
have..

Comments welcome, as is test results...


# 18125 07-Sep-1996 bde

Fixed another easy case of const poisoning in the kernel. Cosmetic.

(A pointer to a const was misused to avoid loading loading the same
value twice, but gcc does exactly the same optimization automatically.
It can see that the value hasn't changed.)


# 18088 06-Sep-1996 pst

Add option SC_KBD_PROBE_WORKS to syscons driver.

If you define this, it means your keyboard is actually probable using the
brain-dammaged probe routine in syscons, and if the keyboard is NOT found,
then you don't want syscons to activate itself further.

This makes life sane for those of us who use serial consoles most of the
time and want "the right thing" to happen when we plug a keyboard in.


# 18084 06-Sep-1996 phk

Remove devconf, it never grew up to be of any use.


# 18034 04-Sep-1996 sos

Fixed a panic when switching to 40x25 mode, and cursor was beyond the
new buffer.


# 17993 01-Sep-1996 sos

Fixed a couple of bugs in the mousepointer code.
Changed update strategy slightly.
Make set_mode & copy_font externally visible.


# 17870 28-Aug-1996 bde

Fixed restoral of nsscons variable. The tty for /dev/console was lost.
A warning was introduced.


# 17628 16-Aug-1996 peter

restore nsccons variable from rev 1.115 that was deleted in rev 1.136
during phk's staticize/cleanup commits. pstat needs it, the MAXCONS
option is not visible anywhere else, and pstat uses it to find the bounds
of the sccons[MAXCONS] array, which varies.


# 17340 30-Jul-1996 ache

Fix GIO_ATTR ioctl return to match SYSV


# 16879 01-Jul-1996 bde

Added or restored #include of <machine/md_var.h>. Some declarations
moved from <machine/cpufunc.h> to better places.


# 16806 27-Jun-1996 joerg

Bump various timeouts in scprobe(). This finally fixes the broken
keyboard reset one of my earlier commits has been causing.


# 16769 26-Jun-1996 sos

Fixed bug in pasting 8bit char (ache).
Added linefeeds in cuts that extend beyond one line.
Prepared for the mousefunctions to be used in nontext modes.


# 16733 25-Jun-1996 bde

Added #include of <machine/md_var.h>. This will be needed when
some declarations are moved from <machine/cpufunc.h> to better
places.


# 16693 25-Jun-1996 sos

Change the way moused talk to syscons, now its only delivering mouseevents
via an ioctl (MOUSE_ACTION).
Fixed a couple of bugs (destructive cursor, uncut, jitter).
Now applications can use the mouse via the MOUSE_MODE ioctl, its
possible to have a signal sent on mouseevents, makeing an event loop
in the application take over mouseevents.


# 16633 23-Jun-1996 bde

Moved declarations of static functions to the correct file. This fixes
hundreds of warnings from -Wunused in lkm/syscons/*.


# 16567 21-Jun-1996 sos

Oops, fix a bug that caused updates to the screen to happen, without
anything actually changed, in this case the mousepointer logic.


# 16564 21-Jun-1996 sos

Some news for syscons (long overdue):

Real support for a Textmode mousecursor, works by reprogramming the
charset. Together with this support for cut&paste in text mode.
To use it a userland daemon is needed (moused), which provides
the interface to the various mice protokols.
Bug fixes here and there, all known PR's closed by this update.


# 16441 17-Jun-1996 wpaul

Stomp another compiler warning: sc_devfs_token[] should only be declared
if DEVFS is #defined.


# 15925 27-May-1996 peter

Fix the warnings about "cant inline call to xxx" by reordering two
functions. It seems gcc wants to have seen the definitions of the
function before it will insert it inline in a caller.


# 15746 12-May-1996 joerg

Fix the "well-known retries bug" (a logic-o).


# 15739 11-May-1996 joerg

Give up waiting for a successful keyboard reset after some
unreasonable time. I've got a PCI mainboard that simply doesn't grok
it, so continuing with a warning (and a keyboard that's working
nevertheless :) seems to be better than spin-looping forever.


# 15562 02-May-1996 ache

Fix ^[[1K (clear from beginning of line to cursor) and
^[[2K (clear whole line), they not work _initially_


# 15502 01-May-1996 bde

Fixed a race that caused panics in kernel printfs when the screen timeout
routine changed the screen pointers while output was in progress.


# 15390 26-Apr-1996 sos

Removed options MAXCONS & HARDFONT, they are no longer in use
(and havn't been for long, sigh)


# 14848 27-Mar-1996 bde

Moved the initialization of the devfs devices to after the initialization
of the devswitch so that it actually works.


# 14328 02-Mar-1996 peter

Add more options into the conf/options and i386/conf/options.i386 files
and the #include hooks so that 'make depend' is more useful. This
covers most of the options I regularly use (but not all) and some other
easy ones.


# 14086 13-Feb-1996 phk

use devfs_add_devswf and avoid local variable.


# 13967 08-Feb-1996 pst

Close kern/627 - panic if syscons not attached


# 13914 05-Feb-1996 ache

Deliver all bells to current console, use different pitch
for non-originating bells.


# 13228 04-Jan-1996 wollman

Convert DDB to new-style option.


# 12840 14-Dec-1995 bde

Removed my devsw access functions [un]register_cdev() and
getmajorbyname() which were a better (sigh) temporary interface to
the going-away devswitches.

Note that SYSINIT()s to initialize the devswitches would be fatal
in syscons.c and pcvt_drv.c (and are bogus elsewhere) because they
get called independently of whether the device is attached; thus
devices that share a major clobber each other's devswitch entries
until the last one wins.

conf.c:
Removed stale #includes and comments.


# 12731 10-Dec-1995 bde

Removed new alias d_size_t for d_psize_t.

Removed old aliases d_rdwr_t and d_ttycv_t for d_read_t/d_write_t and
d_devtotty_t.

Sorted declarations of switch functions into switch order.

Removed duplicated comments and declarations of nonexistent switch
functions.


# 12724 10-Dec-1995 phk

Staticize and cleanup.


# 12675 08-Dec-1995 julian

Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are
in the same file as their devsw structure. I've also added DEVFS
support for nearly every device in the system, however
many of the devices have 'incorrect' names under DEVFS
because I couldn't quickly work out the correct naming conventions.
(but devfs won't be coming on line for a month or so anyhow so that doesn't
matter)

If you "OWN" a device which would normally have an entry in /dev
then search for the devfs_add_devsw() entries and munge to make them right..
check out similar devices to see what I might have done in them in you
can't see what's going on..
for a laugh compare conf.c conf.h defore and after... :)
I have not doen DEVFS entries for any DISKSLICE devices yet as that will be
a much more complicated job.. (pass 5 :)

pass 4 will be to make the devsw tables of type (cdevsw * )
rather than (cdevsw)
seems to work here..
complaints to the usual places.. :)


# 12662 07-Dec-1995 dg

Untangled the vm.h include file spaghetti.


# 12659 06-Dec-1995 bde

Replaced #includes of <sys/user.h> by less gross headers, usually
<sys/vm.h>. Many device drivers need only the definition of vtophys()
from vm.

Added nearby #includes of <sys/conf.h> where appropriate.


# 12541 30-Nov-1995 ache

Fix my color/attr separation patch.
Swap foreground/background logic to allow DIM REVERSE


# 12494 27-Nov-1995 ache

Separate colors & attributes as Terry points
Reviewed by: soren


# 12475 24-Nov-1995 bde

Fixed a comment.


# 12420 20-Nov-1995 phk

Fix compiler warnings.


# 12078 04-Nov-1995 markm

Remove the #ifdev DEVRANDOM's, as promised.

/dev/random is now a part of the kernel! you will need to make
the device in /dev: sh MAKEDEV random
and take a look at some test code in src/tools/test/random.


# 11875 28-Oct-1995 markm

Theodore Ts'po's random number gernerator for Linux, ported by me.
This code will only be included in your kernel if you have
'options DEVRANDOM', but that will fall away in a couple of days.
Obtained from: Theodore Ts'o, Linux


# 11466 14-Oct-1995 bde

Don't allow i/o operations for non-root users.

Add prototypes.


# 10666 10-Sep-1995 bde

Make pcvt and syscons live in the same kernel. If both are enabled, then
the first one in the config has priority. They can be switched using
userconfig().

i386/i386/conf.c:
Initialize the shared syscons/pcvt cdevsw entry to `nx'.

Add cdevsw registration functions.

Use devsw functions of the correct type if they exist.

i386/i386/cons.c:
Add renamed syscons entry points to constab.

i386/i386/cons.h:
Declare the renamed syscons entry points.

i386/i386/machdep.c:
Repeat console initialization after userconfig() in case the current
console has become wrong. This depends on cn functions not wiring down
anything important.

sys/conf.h:
Declare new functions.

i386/isa/isa.[ch]:
Add a function to decide which display driver has priority. Should be
done better.

i386/isa/syscons.c:
Rename pccn* -> sccn*.

Initialize CRTC start address in case the previous driver has moved it.

i386/isa/syscons.c, i386/isa/pcvt/*
Initialize the bogusly shared variable Crtat dynamically in case the
stored value was changed by the previous driver.

Initialize cdevsw table from a template.

Don't grab the console if another display driver has priority.

i386/isa/syscons.h, i386/isa/pcvt/pcvt_hdr.h:
Don't externally declare now-static cdevsw functions.

i386/isa/pcvt/pcvt_hdr.h:
Set the sensitive hardware flag so that pcvt doesn't always have lower
priority than syscons. This also fixes the "stupid" detection of the
display after filling the display with text.

i386/isa/pcvt/pcvt_out.c:
Don't be confused the off-screen cursor offset 0xffff set by syscons.

kern/subr_xxx.c:
Add enough nxio/nodev/null devsw functions of the correct type for syscons
and pcvt.


# 10082 16-Aug-1995 nate

Added missing semi-colon in the XT_KEYBOARD code. W/out it the code
would not compile.


# 10005 08-Aug-1995 dyson

Fixed a problem that malloc(..,..,M_NOWAIT) was being called without checking
for return values. It just so happens that in the cases where it is likely
to fail, it is okay to change the M_NOWAIT to M_WAITOK -- and all will
be well. This problem was manfest as a panic very regularly on a 4MB
system right after bootup.


# 9824 31-Jul-1995 bde

Obtained from: partly from ancient patches of mine via 1.1.5

Introduce TS_CONNECTED and TS_ZOMBIE states. TS_CONNECTED is set
while a connection is established. It is set while (TS_CARR_ON or
CLOCAL is set) and TS_ZOMBIE is clear. TS_ZOMBIE is set for on to
off transitions of TS_CARR_ON that occur when CLOCAL is clear and
is cleared for off to on transitions of CLOCAL. I/o can only occur
while TS_CONNECTED is set. TS_ZOMBIE prevents further i/o.

Split the input-event sleep address TSA_CARR_ON(tp) into TSA_CARR_ON(tp)
and TSA_HUP_OR_INPUT(tp). The former address is now used only for
off to on carrier transitions and equivalent CLOCAL transitions.
The latter is used for all input events, all carrier transitions
and certain CLOCAL transitions. There are some harmless extra
wakeups for rare connection- related events. Previously there were
too many extra wakeups for non-rare input events.

Drivers now call l_modem() instead of setting TS_CARR_ON directly
to handle even the initial off to on transition of carrier. They
should always have done this. l_modem() now handles TS_CONNECTED
and TS_ZOMBIE as well as TS_CARR_ON.

gnu/isdn/iitty.c:
Set TS_CONNECTED for first open ourself to go with bogusly setting
CLOCAL.

i386/isa/syscons.c, i386/isa/pcvt/pcvt_drv.c:
We fake carrier, so don't also fake CLOCAL.

kern/tty.c:
Testing TS_CONNECTED instead of TS_CARR_ON fixes TIOCCONS forgetting to
test CLOCAL. TS_ISOPEN was tested instead, but that broke when we disabled
the clearing of TS_ISOPEN for certain transitions of CLOCAL.

Testing TS_CONNECTED fixes ttyselect() returning false success for output
to devices in state !TS_CARR_ON && !CLOCAL.

Optimize the other selwakeup() call (this is not related to the other
changes).

kern/tty_pty.c:
ptcopen() can be declared in traditional C now that dev_t isn't short.


# 9626 21-Jul-1995 bde

Move the inline code for waking up writers to a new function
ttwwakeup(). The conditions for doing the wakeup will soon become
more complicated and I don't want them duplicated in all drivers.

It's probably not worth making ttwwakeup() a macro or an inline
function. The cost of the function call is relatively small when
there is a process to wake up. There is usually a process to wake
up for large writes and the system call overhead dwarfs the function
call overhead for small writes.


# 9484 11-Jul-1995 bde

Fix races in scstart(). q_to_b() wasn't called at spltty(), so there
were two races:
- q_to_b() might unexpectedly return 0 (e.g, after a keyboard signal
flushes the output queue and isn't echoed). ansi_put() interprets
0 bytes as 4GB...
- more output (e.g. for echoes) might arrive afer q_to_b() returns 0.
Then scstart() returns presumably and the new output might not be
handled for a long time.

Remove unused function scxint().

Fix prototypes (foo() isn't a prototype).


# 9483 11-Jul-1995 bde

Speed up the inner loop of ansi_put() by a few percent.

syscons' output is now only about 4-5 times slower than I want.
It loses a factor of 2 for scrolling output by unnecessarily copying
the screen buffer, a factor of 4/3 for dumb OPOST processing, and
a factor of 3/2 for clist processing.


# 9219 14-Jun-1995 bde

Don't convert \n to \r\n in pccnputc(). This is the responsibility of
cnputc().


# 8876 30-May-1995 rgrimes

Remove trailing whitespace.


# 8683 21-May-1995 sos

Fixed problem with "char" cursor..

Submitted by: ache


# 8123 28-Apr-1995 sos

Added nsccons variable for use by pstat
Submitted by: ache


# 8061 25-Apr-1995 sos

Added mark_all() call so that screen is proberly updated
when scroll-lock history is disengaged.


# 8017 23-Apr-1995 bde

Correct the type of the `c' arg to pccnputc().

Move declarations of console functions to cons.h so that they can't be
defined inconsistently in several places. They should be config(8)ed.


# 7780 12-Apr-1995 wollman

Add a class field to devconf and mst drivers.
For those where it was easy, drivers were also fixed to call
dev_attach() during probe rather than attach (in keeping with the
new design articulated in a mail message five months ago). For
a few that were really easy, correct state tracking was added as well.
The `fd' driver was fixed to correctly fill in the description.
The CPU identify code was fixed to attach a `cpu' device. The code
was also massively reordered to fill in cpu_model with somethingremotely
resembling what identifycpu() prints out. A few bytes saved by using
%b to format the features list rather than lots of ifs.


# 7623 04-Apr-1995 sos

Fixes to the hardware cursor emulation.
Submitted by: ache


# 7564 01-Apr-1995 bde

Fix count in mark_for_update() for insert-char(s) and delete-char(s).
Everything from the cursor to the end of the line must be updated.

Fix comment about erase-char(s).


# 7498 30-Mar-1995 sos

Emulate hw cursor closely, and get start&end scanlines from BIOS.


# 7475 29-Mar-1995 sos

Optimized the way physical screen updates are done. Now only
update what has actually been touched. This should speed up
screen access on slow hardware.
Introduced setting of "destructive" cursor size, much like
the old hardware cursor.


# 6851 03-Mar-1995 sos

Minor update to syscons.
Let "grey delete" be a function key (default is 0x7f)
Fix the xor cursor again..
Made the backspace key generate del as default
Made CTRL-space generate nul as default.


# 6782 27-Feb-1995 pst

Incorporate bde's code-review comments.

(a) bring back ttselect, now that we have xxxdevtotty() it isn't dangerous.
(b) remove all of the wrappers that have been replaced by ttselect
(c) fix formatting in syscons.c and definition in syscons.h
(d) add cxdevtotty

NOT DONE:
(e) make pcvt work... it was already broken...when someone fixes pcvt to
link properly, just rename get_pccons to xxxdevtotty and we're done


# 6712 25-Feb-1995 pst

(a) remove the pointer to each driver's tty structure array from cdevsw
(b) add a function callback vector to tty drivers that will return a pointer
to a valid tty structure based upon a dev_t
(c) make syscons structures the same size whether or not APM is enabled so
utilities don't crash if NAPM changes (and make the damn kernel compile!)
(d) rewrite /dev/snp ioctl interface so that it is device driver and i386
independant


# 6628 22-Feb-1995 sos

Next syscons update (given up on numbering :)

Removed screensavers from syscons, they are now LKM's. This makes it
possible to do some really "interesting" screensavers...
Fixed bug that sometimes caused garbage to appear when leaving
"scroll-lock" history.
Reformattet indentation, it got too deep for a normal 80 pos screen.
Split up in syscons.c & syscons.h for use with the saver-lkm's.
Temporarily removed -s option from vidcontrol, savers should now
be loaded with modload.


# 6512 17-Feb-1995 phk

This is the latest version of the APM stuff from HOSOKAWA, I have looked
briefly over it, and see some serious architectural issues in this stuff.

On the other hand, I doubt that we will have any solution to these issues
before 2.1, so we might as well leave this in.

Most of the stuff is bracketed by #ifdef's so it shouldn't matter too much
in the normal case.

Reviewed by: phk
Submitted by: HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>


# 6374 14-Feb-1995 sos

Fixed cursor xor problem...


# 6229 07-Feb-1995 sos

Fixed the bug that caused the cursor to disappear under
boot with -c option


# 6208 05-Feb-1995 sos

Fixed the annoing bug that caused writes to /dev/console to go to
the active virtual terminal (Boy, do I have little hair left).
Misc other fixes, try to enable cursor earlier in the game.


# 6161 03-Feb-1995 sos

Allow all characters except "real" control chars.
Fix NULL reference when serial console (thanks bruce).


# 6098 01-Feb-1995 sos

Syscons bug fix: tab now right (thanks bruce!)
Mouse arrow support almost finished.


# 6044 30-Jan-1995 sos

Reviewed by:
Submitted by:
Obtained from:


# 5994 28-Jan-1995 sos

Third round in syscons update.

Display update method changed, now allways write in memory buffer,
then periodically update physical display.
Speed improvements (now > 5 times faster than the old syscons).
History now circular buffer, with changeable size.
History scroll by up/down line, up/down page, home and end.
Backtab proberly implemented.
Now space for 96 function keys, 63 allocated standard, default now
SCO/SYSV compat again as in the old days.
New keyboard definition files ~share/syscons/keymaps/*
Misc fixes for old "hacks" that broke SCO/SYSV compat.
More that I forgot before writing this...


# 5932 26-Jan-1995 ache

Get rid of overloaded Back tab, now F(64)


# 5920 26-Jan-1995 ache

o Restore removed hardware cursor support and make it _default_
case, software cursor now optional case. Driver must provide
raw things (what hardware do for us, exactly) as default case,
all driver features must be _optional_. Modern VGAs have internal
configuration utilities to set cursor shape/blinking which stored
into cards ROM, and syscons nuke out such features completely
by forcing software cursor. Moreover, software cursor is hard
to distinguish on standouted (or near standouted) fields and
tends to disappearse from the screen.
Set "flags 0x4" to enable software cursor now.

o Cleanup screen savers.

o Don't draw cursor if saver or blinker is active.

o Duplicated code moved to functons.

o Add more checks for blinker in progress, character lost otherwise
when blinker restore old contents.

o Reduce blinking counter to 3, too slow in old variant.

o Fix timeout code in scrn_timer(), old variant can reenter iself,
if action takes too long time.

o Disable visual bell for scroll lock mode, saved screen
becomes overwritted otherwise.


# 5747 20-Jan-1995 sos

Second round in syscons update:

Support for pseudo graphic mouse cursor (not complete yet)
Some cheap speed fixes.
More cleanups.
Call ourselves scxxxx finally.


# 5572 13-Jan-1995 sos

Oops, forgot one change when DDB is defined.


# 5567 13-Jan-1995 ache

Use (n - 1) in ESC [ xxx d and ESC [ xxx `


# 5553 12-Jan-1995 ache

Back out cursor wrap (restore original thing)
Submitted by: Bill Paul


# 5536 12-Jan-1995 sos

First round in syscons update. Several new features has been added:

No kernel config options anymore besides keyboard language layout.
Virtual consoles are now dynamically allocated, no NCONS anymore.
Software cursor blinking/nonblinking.
Visual bell for laptops (don't beep at meetings :-).
Cursor/bell default type setable via config "flags" instead of as defines.
Cursor/bell type setable via ioctl's.
New video modes 80x30 80x60 for some laptops, and those with multisync monitors.
Scroll-lock history (length currently fixed at 100 lines).
Lots of cleanups, some only commented out for now (will goaway soon).
Support for new features in vidcontrol/kbdcontrol.
Updated manpages.


# 5359 03-Jan-1995 bde

Don't allow negative console numbers for the VT_WAITACTIVE ioctl. Use the
correct console number for the VT_WAITACTIVE ioctl. Invalid console numbers
caused waiting on an invalid pointer.

Use bcopyw() instead of move_up() and move_down(). bcopyw() handles
overlapped copies and should be faster. Actually use bcopy(). bcopy()
is slightly faster if video memory is 16-bit and about twice as fast if
it is 32-bit. bcopy() is said to fail on someGA's, but syscons already
depends on it working for other accesses to video memory.


# 5329 31-Dec-1994 ats

Change the errors in the XT_KEYBOARD patch. red in the face. Thanks Bruce.


# 5320 31-Dec-1994 jkh

Miscellaneous changes from Bill Paul:

- /sys/i386/isa/if_ed.c doesn't quite know how to deal with SMC EtherEZ
ethernet cards. The EtherEZ looks just like the Elite Ultra, except it
has only 8K of shared memory. The only way to have it properly detected
is to zero and test a few bytes of memory just about the first 8K region.
If it clears properly, it's an Elite Ultra, otherwise it's an EtherEZ.

I've also got an EtherEZ patch for netboot (Makefile, ether.c and ether.h).

- /sys/i386/isa/syscons.c wraps at the next to the last column rather than
the last column, like it should. You don't really notice this unless you
use certain programs that write all the way out to, say, the 80th column,
like VMSmail. Along with a one-line fix for this are some changes to
implement a non-blinking cursor. Put 'options "NOBLINK_CURSOR"' in your
config file and give it a try. :)

Submitted by: wpaul


# 5240 27-Dec-1994 dg

Fixed two security holes in the pcmmap() function.

Submitted by: Bruce Evans


# 5237 26-Dec-1994 ats

Add a patch that someone on the net has used to run on his IBM Thinkpad.
Sorry, lost the name and mail of the original author. The whole patch
is ifdefed, so it should not disturb someone else in the moment.


# 5162 18-Dec-1994 joerg

Initialize syscons also in cases where it ain't the system's console
(i.e., there's a comconsole).


# 5160 18-Dec-1994 joerg

Move the code providing the equivalent of ICRNL for console input from
the device driver(s) to cons.c.


# 5003 06-Dec-1994 sos

Changed the behavior of KDMKTONE to comply with svr4, default to
old behavior if no argument present.


# 4757 21-Nov-1994 ache

Fix wrong size check for scroll forward/backward ('S'/'T')


# 4756 21-Nov-1994 ache

Attempt to fix scroll forward/ scroll backward bug bringed by vi,
'S' and 'T' use count 1 in fillw() instead of count == n.


# 4685 19-Nov-1994 ache

More intelligent BackTab fix using BTAB special key (unused before)


# 4573 17-Nov-1994 sos

Added support for the MicroSoft Natural keyboard
Add support for ws_xpixel & ws_ypixel in winsize.
Submitted by: Natural support suggested by Kaleb Keithley (kaleb@x.org)


# 4186 05-Nov-1994 bde

The style in my patch011 is inconsistent and out of date. It should
have been changed _before_ committing the patch.


# 4114 03-Nov-1994 ache

Fix for 'pstat -t' works on vtys
Submitted by: jhay@mikom.csir.co.za


# 3925 27-Oct-1994 phk

The other half of patch011, read Numlck state from bios.


# 3917 26-Oct-1994 bde

Fix initialization of video_mode_ptr. It only worked if the segments
in the far pointers are multiples of 4K (as is normal when the video
BIOS is at seg 0xc000). Disallow mode switching if the pointer is bad.

Use a new pa_to_va() macro for all BIOS and video addresses in syscons.


# 3834 24-Oct-1994 wollman

Fixed cut&paste error.

Submitted by: davidg


# 3816 23-Oct-1994 wollman

Finished device configuration database work for all ISA devices (except `ze')
and all SCSI devices (except that it's not done quite the way I want). New
information added includes:

- A text description of the device
- A ``state''---unknown, unconfigured, idle, or busy
- A generic parent device (with support in the m.i. code)
- An interrupt mask type field (which will hopefully go away) so that
. ``doconfig'' can be written

This requires a new version of the `lsdev' program as well (next commit).


# 3728 19-Oct-1994 phk

Peter Dufaults comconsole changes.

Submitted by: Peter Dufault


# 3680 18-Oct-1994 ache

Remove color_display, GIO_COLOR now exists


# 3671 17-Oct-1994 sos

Added more SCO compat ioctl's.


# 3670 17-Oct-1994 phk

isa_device.h: Added flag for sensitive HW. ed# seems to break if anything
else has been probed. This feature could go away again, if we can curb the
problem another way.

if_ed.c, syscons.c: Set the above flag. ed# because it needs it, syscons
because it looks stupid to "detect" the display you have already filled up
with text :-)

bt742a.c: Check bt_cmd() return-val during probe, thus failing on adaptec's.
Also silenced various printf's during the probe.

isa.c: Probe devices with the above flag set before the rest. Reduce the
number of "conflict" messages per device to one.

***
Please test the GENERIC-kernel now, if nobody can make it fail, GENERICAH
and GENERICBT has a finite and short life-expectancy...
***


# 3662 17-Oct-1994 ache

Initialize color_display as undefined, cosmetique


# 3629 15-Oct-1994 ache

Add color_display variable for CPU_COLORDISP sysctl.


# 3324 02-Oct-1994 ache

Fix 'cursor-disappearce-after-switching-screen-from-X' bug


# 3310 02-Oct-1994 phk

Ripped out APM-hooks. Not ready for prime time yet.


# 3300 02-Oct-1994 ache

Make fat cursor as early as possible, per Bruce suggestion


# 3258 01-Oct-1994 dg

Laptop Advanced Power Management support by HOSOKAWA Tatsumi.

Submitted by: HOSOKAWA Tatsumi


# 3201 29-Sep-1994 ache

Fix broken FAT_CURSOR support, don't set cursor shape on VGA


# 3186 29-Sep-1994 sos

Changed header slightly.


# 3141 27-Sep-1994 ache

Bug fixed: cursor shaping in mode swithching produce wrong results for
non-fat cursors, cursor_start goes beyond font size.


# 3139 26-Sep-1994 ache

Refuse text mode switching when proper font not loaded


# 3063 25-Sep-1994 ache

1)Back out my previous change: only 8x16 font grabbing available,
more work required to grab all fonts
2)Make standard VGA font as default, make HARDFONTS an option
(load iso8859 fonts instead)
3)Check fonts_loaded for all restore (copy_font...palette)
sequences.


# 3057 24-Sep-1994 ache

SAVE all fonts, if NO_HARDFONTS defined, not only 8x16


# 2783 15-Sep-1994 sos

Added support for many more videomodes, including graphic modes up til
320x200 256col VGA. This is nessesary for the iBCS stuff to work right.
(And we get the benefit of more video modes). Uses the videocard BIOS
to optain mode tables.
Added a "green" saver, switches off the syncs for "green" monitors.

Reviewed by:
Submitted by:
Obtained from:


# 2320 27-Aug-1994 dg

1) Changed ddb into a option rather than a pseudo-device (use options DDB
in your kernel config now).
2) Added ps ddb function from 1.1.5. Cleaned it up a bit and moved into its
own file.
3) Added \r handing in db_printf.
4) Added missing memory usage stats to statclock().
5) Added dummy function to pseudo_set so it will be emitted if there
are no other pseudo declarations.


# 2142 20-Aug-1994 dg

1) cleaned up after Garrett - fixed more redundant declarations, changed
use of timeout_t -> timeout_func_t in aha1542 and aha1742 drivers.
2) fix a bug in the portalfs that was uncovered by better prototyping -
specifically, the time must be converted from timeval to timespec
before storing in va_atime.
3) fixed/added some miscellaneous prototypes


# 2092 17-Aug-1994 sos

Oops, changed order of include lines...

Reviewed by:
Submitted by:


# 2087 17-Aug-1994 sos

Updated to latest 1.1.5.1+ version

Reviewed by:
Submitted by:


# 2078 15-Aug-1994 wollman

Add option KBD_RESET_FAIL_OK so that GCC 2.6 doesn't break my
console.


# 2056 13-Aug-1994 wollman

Change all #includes to follow the current Berkeley style. Some of these
``changes'' are actually not changes at all, but CVS sometimes has trouble
telling the difference.

This also includes support for second-directory compiles. This is not
quite complete yet, as `config' doesn't yet do the right thing. You can
still make it work trivially, however, by doing the following:

rm /sys/compile
mkdir /usr/obj/sys/compile
ln -s M-. /sys/compile
cd /sys/i386/conf
config MYKERNEL
cd ../../compile/MYKERNEL
ln -s /sys @
rm machine
ln -s @/i386/include machine
make depend
make


# 1808 01-Aug-1994 dg

Fixed a bug that was introduced in the conversion from 1.1.5 to 2.0.


# 1549 25-May-1994 rgrimes

The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.

Reviewed by: Rodney W. Grimes
Submitted by: John Dyson and David Greenman


# 1416 26-Apr-1994 sos

Fixed missing bounds check in scroll up/down sequence, that could
cause a panic (and did).


# 1394 21-Apr-1994 sos

Changed timer usage to new functions in clock.c


# 1353 11-Apr-1994 ache

Patch from S0ren, 80x50 font trashed after switching from X console


# 1345 07-Apr-1994 ache

Fix arguments of CONS_GETINFO


# 1320 01-Apr-1994 ache

Replace CAPS led with ALTGR led for ALTGR mode (soft) keyboards,
currently affects only russian keyboard.


# 1287 21-Mar-1994 dg

previous optimization from John wasn't quite ready for primetime.


# 1286 20-Mar-1994 dg

Two fixes from John Dyson to fix hangs and panics when using ctrl-T:

1) tty.c: gather all the info about the processes before calling ttyprintf
(which may block).
2) syscons.c: handle asynchronous output properly (data structures may
be corrupted otherwise).


# 1249 08-Mar-1994 dg

Modified pccnprobe to not set cn_tp = CONSOLE_TTY if __FreeBSD__ is
defined. This code should probably be yanked out.


# 1242 06-Mar-1994 guido

Removed a #warning that I left here.


# 1235 02-Mar-1994 guido

Ttys structures are now allocated dynamically via ttymalloc/ttyfree.
This inetrface should be used from now on.
pseudo device pty xx still keeps its meaning: a maximum of
xx ptys is allowed.
A ringbuffer is now 2040 bytes long, per Garrett Wollman's request.
The changes are inspired by the way NetBSD did it (thanks for that!),
though I made it slihghtly different, including the interface so
at least 75% of the allocated space is deallocated when the tty is
closed.
Note further that it is easy to modify the ringbuffer length runtime.
This will have to wait untill some later date...


-Guido


# 1105 07-Feb-1994 dg

From: Chris Wiener <cwiener@CRLABS.COM>

When the keyboard is probed, the LED's blink quickly and
"Keyboard reset failed" is printed on the console. The
init routine keeps trying endlessly with the same behavior
as above.

I got the latest -current sup sources (06-Feb-94 12:00 GMT) to work using the
old syscons.c. The following patch makes the new syscons work:


# 1089 04-Feb-1994 chmr

Make the screen savers runtime switchable. Everybody wants a
different default saver, and the size increase in the kernel is
minimal ( < 2.5K ).


# 1077 02-Feb-1994 ache

Make BLANK_SAVER default to stop best saver war.


# 1071 01-Feb-1994 nate

Moved paren in sgetc to where it belongs. (My fault, I must have wiped it
out when I applied the patch to get the new features by hand)


# 1070 01-Feb-1994 rich

Add missing arg to Debugger() call.
Add missing close paren in sgetc() definition.


# 1069 01-Feb-1994 ache

Make old SNAKE_SAVER code compile with new syscons changes.


# 1067 01-Feb-1994 ache

1) Restore removed SNAKE_SAVER (Nate, WHY you do it?)
2) Make SNAKE_SAVER like default, if no saver specified in "options"
3) Remove #ifdef STAR_SAVER before line /* make screensaver happy */
this code needed in any case.


# 1063 01-Feb-1994 ache

Comment #define STAR_SAVER, it is configuration "options"


# 1061 01-Feb-1994 nate

From: sos@login.dkuug.dk (S|ren Schmidt)
Subject: syscons-1.3
Date: Sat, 29 Jan 94 23:33:50 MET

But here is the (hopefully) final syscons-1.3....

....

I've changed sgetc so it works as the pccons parallel
(it now uses a scgetc internally).


[
There were a couple changes that Bruce Evans sent me that were applied
to this version along with some changes that S'ren didn't incorporate
into the final version. There will be only minor changes if anything
from this version to his final release.
]


# 984 18-Jan-1994 nate

Changed the default 'reboot' routine from cpu_reset() to shutdown_nice().

If you want to disable the reboot feature, then re-define the keymap to
not have a RBT call.


# 974 14-Jan-1994 dg

"New" VM system from John Dyson & myself. For a run-down of the
major changes, see the log of any effected file in the sys/vm
directory (swap_pager.c for instance).


# 924 03-Jan-1994 dg

Convert syscall to trapframe. Based on work done by John Brezak.


# 889 21-Dec-1993 rich

Don't cast 2nd arg to fillw() per David's comments. The cast
breaks cursor positioning.


# 887 21-Dec-1993 rich

cast arg 2 of fillw() calls to type caddr_t as in pccons.
add "manual escape to debugger" arg in call to Debugger().
cast 1st arg to untimeout() to type timeout_func_t as done for timeout().


# 876 18-Dec-1993 ache

Fix tsleep "waitvt" wait data from vak@kiae.su


# 802 27-Nov-1993 rich

Fix conflicting prototypes and return values.


# 794 23-Nov-1993 chmr

Changed return(-1) in switch_scr to return(EINVAL), because -1 is
ERESTART on return from a system call.


# 686 30-Oct-1993 jkh

Now that STAR_SAVER and SNAKE_SAVER are kernel options, add code
to make sure that bad things don't happen if both are (incorrectly)
defined at once.


# 685 30-Oct-1993 jkh

Fixed bug where syscons.c wouldn't compile if DDB was enabled.
Removed FAT_CURSOR and STAR_SAVER as compiled in defaults - these should
be kernel options!


# 679 28-Oct-1993 rgrimes

Put back the $Id$ strings


# 677 28-Oct-1993 jkh

This is syscons version 1.1


# 627 18-Oct-1993 jkh

Patch from stever@csuohio.edu (Steve Ratliff) to make FAT_CURSOR work
on HDA/CGA displays.


# 619 16-Oct-1993 rgrimes

Removed all patch kit headers, sccsid and rcsid strings, put $Id$ in, some
minor cleanup. Added $Id$ to files that did not have any version info, etc


# 583 12-Oct-1993 rgrimes

Use KERNBASE for locating stuff in kernel virtual memory, not hard coded
constants.


# 558 08-Oct-1993 jkh

Removed FAT_CURSOR as default since it breaks certain CGA displays
and it is better to conform to the lowest common denominator.
Those wishing to retain it can always use options FAT_CURSOR in
their config files.


# 542 04-Oct-1993 jkh

Latest changs for XFree86 2.0


# 530 30-Sep-1993 rgrimes

Change #include <sys/console.h> to <machine/console.h>, file will be moved
shortly


# 516 28-Sep-1993 jkh

From: "Andrew A. Chernov, Black Mage" <ache@astral.msk.su>
AltGr Lock code for zero repeat count ommited, so AltGr Lock
works only one time and never again :-)


# 514 28-Sep-1993 jkh

Version number support for XFree86


# 512 27-Sep-1993 jkh

Change to sio for recognising the last serial port on a multiport
card correctly.

Updated syscons to 0.2e, added features for upcoming XFree86 2.0,
fixed crashbug.


# 419 08-Sep-1993 jkh

Soren's latest syscons changes.


# 352 28-Aug-1993 rgrimes

Replaced the return (1)'s with return (IO_KBDSIZE) in the probe code so
that the printfs during the probing prints the range instead of just the
start address.


# 308 20-Aug-1993 rgrimes

Added from: line to reference the pccons.c derivation of this code, otherwise
the BSD copyright would be very bad to have on this file.


# 210 30-Jul-1993 jkh

Updated syscons to 0.2b - please test this! It won't be in the ALPHA
release, but it's still worth testing.


# 192 26-Jul-1993 jkh

Added necessary files for syscons (may move font include later, but for now
it's easier to leave there since I don't feel like breaking anything).