History log of /freebsd-current/sys/dev/ofw/ofw_console.c
Revision Date Author Comments
# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 23d53268 17-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

tty: convert tty_lock_assert to tty_assert_locked to hide lock type

A later change, currently being iterated on in D24459, will in-fact change
the lock type to an sx so that TTY drivers can sleep on it if they need to.
Committing this ahead of time to make the review in question a little more
palatable.

tty_lock_assert() is unfortunately still needed for now in two places to
make sure that the tty lock has not been recursed upon, for those scenarios
where it's supplied by the TTY driver and possibly a mutex that is allowed
to recurse.

Suggested by: markj


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# a272a813 02-Sep-2014 John Baldwin <jhb@FreeBSD.org>

Use callout(9) instead of timeout(9).

Tested by: danfe


# e14376e4 14-Dec-2013 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Avoid warning about insecure format with clang.


# d3a0a0f3 23-Oct-2013 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Make all Open Firmware internal interfaces endian-safe by using the new
OF_getencprop() API. This removes one explicit endianness conversion in
ofw_iicbus.c.


# 22b256df 09-Sep-2013 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Make the primary name of the OF console device /dev/ofwcons, and only
alias it to the contents of the output property if it is defined. This
avoids a panic when booting machines (QEMU) where the output-device
property is not defined.

Since output-device is free-form and potentially conflicts with other
entries in /dev, I also am not sure we should be doing the aliasing at
all, but this at least makes things work again.

Approved by: re (kib)


# 9976156f 17-Dec-2011 Andriy Gapon <avg@FreeBSD.org>

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


# e5a09273 27-Aug-2011 Robert Watson <rwatson@FreeBSD.org>

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

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

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


# 4cf75455 26-Aug-2011 Robert Watson <rwatson@FreeBSD.org>

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)


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# c5e30cc0 29-May-2009 Ed Schouten <ed@FreeBSD.org>

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.


# c8978106 27-Oct-2008 Ed Schouten <ed@FreeBSD.org>

Remove unused consdev structure fields.

The cn_unit and cn_tp fields don't seem to be used anywhere. Some
drivers set them, while others don't. Just remove them, in an attempt to
make our consdev code a little easier to understand.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# bc093719 20-Aug-2008 Ed Schouten <ed@FreeBSD.org>

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


# 43d7128c 04-May-2008 Peter Wemm <peter@FreeBSD.org>

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

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

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

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

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


# 237fdd78 16-Mar-2008 Robert Watson <rwatson@FreeBSD.org>

In keeping with style(9)'s recommendations on macros, use a ';'
after each SYSINIT() macro invocation. This makes a number of
lightweight C parsers much happier with the FreeBSD kernel
source, including cflow's prcc and lxr.

MFC after: 1 month
Discussed with: imp, rink


# 3de213cc 25-Dec-2007 Robert Watson <rwatson@FreeBSD.org>

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.


# 43593547 06-Nov-2006 Robert Watson <rwatson@FreeBSD.org>

Add missing includes of priv.h.


# acd3428b 06-Nov-2006 Robert Watson <rwatson@FreeBSD.org>

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>


# 77dfeead 30-May-2006 Poul-Henning Kamp <phk@FreeBSD.org>

Fix various typos and brainos in last commit.

Submmited by: Andrew Turner <andrew@fubar.geek.nz>


# 05c3592e 26-May-2006 Poul-Henning Kamp <phk@FreeBSD.org>

Update to new console api.


# 7423b2b4 16-Oct-2005 Poul-Henning Kamp <phk@FreeBSD.org>

Make ttyconsolemode() call ttsetwater() so that drivers don't have to.


# 098ca2bd 05-Jan-2005 Warner Losh <imp@FreeBSD.org>

Start each of the license/copyright comments with /*-, minor shuffle of lines


# 95bc5689 18-Oct-2004 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# c5c5a2ad 12-Oct-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Add a couple of XXX comments and fix a couple of fine points.

I have not tried to make this a "canonical tty driver".


# b11ef345 03-Aug-2004 Garance A Drosehn <gad@FreeBSD.org>

Fix problems with the OFW console which happen when the system goes
into single-user mode (as seen on sparc64 and PPC). Problems were due
to a minor oversight in the changes committed in revision 1.25.

Submitted by: grehan
Tested by: gad & yongari


# 672c05d4 15-Jul-2004 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 8cabb94f 10-Jul-2004 Marcel Moolenaar <marcel@FreeBSD.org>

Update for the KDB framework:
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().


# a82b25f9 23-Jun-2004 David E. O'Brien <obrien@FreeBSD.org>

Better OFW console support on Sun Ultra2 machines.
Ultra2 users may want to set OFWCONS_POLL_HZ to a value of '20'.
I have left default value at '4' as higher values can consume a more
than is acceptable amount of CPU, and we don't have a consensus yet
what is an optimal value.

Submitted by: Pyun YongHyeon <yongari@kt-is.co.kr>


# 89c9c53d 16-Jun-2004 Poul-Henning Kamp <phk@FreeBSD.org>

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


# 543912b3 10-Jun-2004 Marius Strobl <marius@FreeBSD.org>

Remove second <sys/cdefs.h> and __FBSDID.


# 2140d01b 04-Jun-2004 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 138fbf67 01-Jun-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Gainfully employ the new ttyioctl in the trivial cases.


# dc08ffec 21-Feb-2004 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 8e1f1df0 21-Feb-2004 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# c9c7976f 21-Feb-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Device megapatch 1/6:

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

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


# 278667af 28-Sep-2003 Jake Burkholder <jake@FreeBSD.org>

Only create the ofwcons device nodes if it has been initialized, not
just probed.


# 5dbb0622 27-Sep-2003 Jake Burkholder <jake@FreeBSD.org>

Make ofw_console a low priority console device, so that uart will be
preferred in all cases, even if the "remote" bit is not set.


# 3f99f14b 26-Sep-2003 Poul-Henning Kamp <phk@FreeBSD.org>

OK, I messed up /dev/console with what I had hoped would be compat
code. Convert remaining console drivers and hope for the best.


# 2f06c3e7 26-Sep-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Initialize the cn_name instead of the cn_dev


# aad970f1 24-Aug-2003 David E. O'Brien <obrien@FreeBSD.org>

Use __FBSDID().
Also some minor style cleanups.


# 8368cf8f 03-Apr-2003 David E. O'Brien <obrien@FreeBSD.org>

Use __FBSDID rather than rcsid[].


# 7ac40f5f 02-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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)


# 263444cf 20-Feb-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 761f89f9 07-Feb-2003 Hartmut Brandt <harti@FreeBSD.org>

Implement the ALT_BREAK_TO_DEBUGGER option for the ofw console. This is very
handy if the machine is on another floor. A minor issue with this is that
these functions are also used by the debugger, so its possible to break into
the debugger from the debugger.

PR: sparc64/47143
Reviewed by: benno
Approved by: jake (mentor)


# 984e2655 26-Jan-2003 Jake Burkholder <jake@FreeBSD.org>

Change ofwcons to use the output-device property from the firmware for the
name of the device that it creates. Update /etc/ttys accordingly.

An alias is created for the old name so that old /etc/ttys will continue to
work, but due to aliases being implemented as symlinks in devfs you cannot
login as root when using the alias device.

Discussed with: grehan


# a121cb6a 17-Nov-2002 Jake Burkholder <jake@FreeBSD.org>

Create the ofwcons device at SI_SUB_CONFIGURE instead of SI_SUB_DRIVERS,
after configure() has run. Only create the device if ofwcons is the
highest priority console. Make a dev alias with the same name as the
firmware output-device property.


# 44731cab 01-Apr-2002 John Baldwin <jhb@FreeBSD.org>

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@


# 47a1c915 08-Jan-2002 Jake Burkholder <jake@FreeBSD.org>

Move the make_dev call from the cn_probe to a sysinit that runs at
SI_SUB_DRIVERS. cnprobe is too early.


# cbecdd57 01-Jan-2002 Jake Burkholder <jake@FreeBSD.org>

1. Lower the poll timeout for the ofw console driver from hz / 50 to hz / 4.
This gives a bit of a sluggish console, but it prevents the console from
getting stuck if we poll too fast, as well as other badness on certain
machines.
2. Fix a test for != 0 that should have been > 0.

Noticed by: Jamey Wood <Jamey.Wood@Sun.COM> and myself
Submitted by: tmm (2)


# b40ce416 12-Sep-2001 Julian Elischer <julian@FreeBSD.org>

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


# c22c65b1 30-Jul-2001 Jake Burkholder <jake@FreeBSD.org>

Quiet uninitialized variable warning (also a bug).


# 707fed20 16-Jun-2001 Benno Rice <benno@FreeBSD.org>

OpenFirmware kernel support, as used by the PowerPC and hopefully other
ports later on.

This includes the basic MI interface routines as well as a console driver.
The MD code is kept in the MD directories.

Reviewed by: obrien