aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ofw/ofw_console.c
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | 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
* tty: convert tty_lock_assert to tty_assert_locked to hide lock typeKyle Evans2020-04-171-1/+1
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=360051
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326255
* Use callout(9) instead of timeout(9).John Baldwin2014-09-021-8/+6
| | | | | | | Tested by: danfe Notes: svn path=/head/; revision=270975
* Avoid warning about insecure format with clang.Nathan Whitehorn2013-12-141-1/+1
| | | | Notes: svn path=/head/; revision=259398
* Make all Open Firmware internal interfaces endian-safe by using the newNathan Whitehorn2013-10-231-4/+4
| | | | | | | | OF_getencprop() API. This removes one explicit endianness conversion in ofw_iicbus.c. Notes: svn path=/head/; revision=256966
* Make the primary name of the OF console device /dev/ofwcons, and onlyNathan Whitehorn2013-09-091-7/+9
| | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=255424
* kern cons: introduce infrastructure for console grabbing by kernelAndriy Gapon2011-12-171-0/+12
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=228631
* Follow up to r225203 refining break-to-debugger run-time configurationRobert Watson2011-08-271-1/+0
| | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=225214
* Attempt to make break-to-debugger and alternative break-to-debugger moreRobert Watson2011-08-261-19/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=225203
* Last minute TTY API change: remove mutex argument from tty_alloc().Ed Schouten2009-05-291-1/+1
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=193018
* Remove unused consdev structure fields.Ed Schouten2008-10-271-3/+1
| | | | | | | | | 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. Notes: svn path=/head/; revision=184329
* Integrate the new MPSAFE TTY layer to the FreeBSD operating system.Ed Schouten2008-08-201-111/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=181905
* Expand kdb_alt_break a little, most commonly used with the optionPeter Wemm2008-05-041-2/+17
| | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=178766
* In keeping with style(9)'s recommendations on macros, use a ';'Robert Watson2008-03-161-1/+1
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=177253
* Add a new 'why' argument to kdb_enter(), and a set of constants to useRobert Watson2007-12-251-1/+1
| | | | | | | | | | | | 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. Notes: svn path=/head/; revision=174898
* Add missing includes of priv.h.Robert Watson2006-11-061-0/+1
| | | | Notes: svn path=/head/; revision=164049
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningRobert Watson2006-11-061-1/+2
| | | | | | | | | | | | | | | | 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> Notes: svn path=/head/; revision=164033
* Fix various typos and brainos in last commit.Poul-Henning Kamp2006-05-301-5/+4
| | | | | | | Submmited by: Andrew Turner <andrew@fubar.geek.nz> Notes: svn path=/head/; revision=159065
* Update to new console api.Poul-Henning Kamp2006-05-261-28/+11
| | | | Notes: svn path=/head/; revision=158964
* Make ttyconsolemode() call ttsetwater() so that drivers don't have to.Poul-Henning Kamp2005-10-161-1/+0
| | | | Notes: svn path=/head/; revision=151388
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* Add new function ttyinitmode() which sets our systemwide defaultPoul-Henning Kamp2004-10-181-6/+1
| | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=136680
* Add a couple of XXX comments and fix a couple of fine points.Poul-Henning Kamp2004-10-121-2/+14
| | | | | | | I have not tried to make this a "canonical tty driver". Notes: svn path=/head/; revision=136454
* Fix problems with the OFW console which happen when the system goesGarance A Drosehn2004-08-041-1/+1
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=133096
* Preparation commit for the tty cleanups that will follow in the nearPoul-Henning Kamp2004-07-151-1/+1
| | | | | | | | | | | | 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. Notes: svn path=/head/; revision=132226
* Update for the KDB framework:Marcel Moolenaar2004-07-101-8/+8
| | | | | | | | | 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(). Notes: svn path=/head/; revision=131916
* Better OFW console support on Sun Ultra2 machines.David E. O'Brien2004-06-241-9/+17
| | | | | | | | | | | | 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> Notes: svn path=/head/; revision=131016
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-161-3/+3
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Remove second <sys/cdefs.h> and __FBSDID.Marius Strobl2004-06-101-3/+0
| | | | Notes: svn path=/head/; revision=130323
* Machine generated patch which changes linedisc calls from accessingPoul-Henning Kamp2004-06-041-3/+3
| | | | | | | | | linesw[] directly to using the ttyld...() functions The ttyld...() functions ar inline so there is no performance hit. Notes: svn path=/head/; revision=130077
* Gainfully employ the new ttyioctl in the trivial cases.Poul-Henning Kamp2004-06-011-28/+0
| | | | Notes: svn path=/head/; revision=129944
* Device megapatch 4/6:Poul-Henning Kamp2004-02-211-2/+2
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=126080
* Device megapatch 3/6:Poul-Henning Kamp2004-02-211-3/+1
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=126078
* Device megapatch 1/6:Poul-Henning Kamp2004-02-211-3/+1
| | | | | | | | | | 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. Notes: svn path=/head/; revision=126076
* Only create the ofwcons device nodes if it has been initialized, notJake Burkholder2003-09-281-1/+2
| | | | | | | just probed. Notes: svn path=/head/; revision=120544
* Make ofw_console a low priority console device, so that uart will beJake Burkholder2003-09-281-1/+1
| | | | | | | preferred in all cases, even if the "remote" bit is not set. Notes: svn path=/head/; revision=120542
* OK, I messed up /dev/console with what I had hoped would be compatPoul-Henning Kamp2003-09-261-4/+4
| | | | | | | code. Convert remaining console drivers and hope for the best. Notes: svn path=/head/; revision=120491
* Initialize the cn_name instead of the cn_devPoul-Henning Kamp2003-09-261-1/+2
| | | | Notes: svn path=/head/; revision=120467
* Use __FBSDID().David E. O'Brien2003-08-241-0/+3
| | | | | | | Also some minor style cleanups. Notes: svn path=/head/; revision=119418
* Use __FBSDID rather than rcsid[].David E. O'Brien2003-04-031-4/+2
| | | | Notes: svn path=/head/; revision=113038
* Gigacommit to improve device-driver source compatibility betweenPoul-Henning Kamp2003-03-031-13/+8
| | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=111815
* Change the console interface to pass a "struct consdev *" instead of aPoul-Henning Kamp2003-02-201-5/+5
| | | | | | | | | | | | 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. Notes: svn path=/head/; revision=111194
* Implement the ALT_BREAK_TO_DEBUGGER option for the ofw console. This is veryHartmut Brandt2003-02-071-0/+18
| | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=110509
* Change ofwcons to use the output-device property from the firmware for theJake Burkholder2003-01-271-2/+3
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=109921
* Create the ofwcons device at SI_SUB_CONFIGURE instead of SI_SUB_DRIVERS,Jake Burkholder2002-11-181-6/+15
| | | | | | | | | 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. Notes: svn path=/head/; revision=107044
* Change the suser() API to take advantage of td_ucred as well as do aJohn Baldwin2002-04-011-1/+1
| | | | | | | | | | | | | | | 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@ Notes: svn path=/head/; revision=93593
* Move the make_dev call from the cn_probe to a sysinit that runs atJake Burkholder2002-01-091-1/+9
| | | | | | | SI_SUB_DRIVERS. cnprobe is too early. Notes: svn path=/head/; revision=89115
* 1. Lower the poll timeout for the ofw console driver from hz / 50 to hz / 4.Jake Burkholder2002-01-011-2/+2
| | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=88792