summaryrefslogtreecommitdiff
path: root/sys/dev/dcons
AgeCommit message (Collapse)Author
2024-07-26Deprecate contigfree(9) in favour of free(9)Bjoern A. Zeeb
As of 9e6544dd6e02c46b805d11ab925c4f3b18ad7a4b contigfree(9) is no longer needed and should not be used anymore. We leave a wrapper for 3rd party code in at least 15.x but remove (almost) all other cases from the tree. This leaves one use of contigfree(9) untouched; that was the original trigger for 9e6544dd6e02 and is handled in D45813 (to be committed seperately later). Sponsored by: The FreeBSD Foundation Reviewed by: markj, kib Tested by: pho (10h stress test run) Differential Revision: https://reviews.freebsd.org/D46099
2023-08-16sys: Remove $FreeBSD$: one-line .h patternWarner Losh
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16sys: Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2022-10-03Fix various places which cast a pointer to a vm_paddr_t or vice versa.John Baldwin
GCC warns about the mismatched sizes on i386 where vm_paddr_t is 64 bits. Reviewed by: imp, markj Differential Revision: https://reviews.freebsd.org/D36750
2022-05-09dcons: Remove unused devclass argument to DRIVER_MODULE.John Baldwin
2020-02-26Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
2019-05-20Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer
This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
2019-05-10Allow dcons(4) to be unloaded when loaded as a module.Ian Lepore
When the module is unloaded, the tty devices are destroyed. That requires implementing the tsw_free callback to avoid a panic. This driver requires no particular cleanup to be done from the callback, but the module itself must remain in memory until the deferred tsw_free callbacks are invoked. These changes implement that by incrementing a reference count variable in the detach routine, and decrementing it in the tsw_free callback. The MOD_UNLOAD event handler doesn't return until the count drops to zero. PR: 237758 Notes: svn path=/head/; revision=347422
2019-01-30i386: Merge PAE and non-PAE pmaps into same kernel.Konstantin Belousov
Effectively all i386 kernels now have two pmaps compiled in: one managing PAE pagetables, and another non-PAE. The implementation is selected at cold time depending on the CPU features. The vm_paddr_t is always 64bit now. As result, nx bit can be used on all capable CPUs. Option PAE only affects the bus_addr_t: it is still 32bit for non-PAE configs, for drivers compatibility. Kernel layout, esp. max kernel address, low memory PDEs and max user address (same as trampoline start) are now same for PAE and for non-PAE regardless of the type of page tables used. Non-PAE kernel (when using PAE pagetables) can handle physical memory up to 24G now, larger memory requires re-tuning the KVA consumers and instead the code caps the maximum at 24G. Unfortunately, a lot of drivers do not use busdma(9) properly so by default even 4G barrier is not easy. There are two tunables added: hw.above4g_allow and hw.above24g_allow, the first one is kept enabled for now to evaluate the status on HEAD, second is only for dev use. i386 now creates three freelists if there is any memory above 4G, to allow proper bounce pages allocation. Also, VM_KMEM_SIZE_SCALE changed from 3 to 1. The PAE_TABLES kernel config option is retired. In collaboarion with: pho Discussed with: emaste Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D18894 Notes: svn path=/head/; revision=343567
2018-04-13i386 4/4G split.Konstantin Belousov
The change makes the user and kernel address spaces on i386 independent, giving each almost the full 4G of usable virtual addresses except for one PDE at top used for trampoline and per-CPU trampoline stacks, and system structures that must be always mapped, namely IDT, GDT, common TSS and LDT, and process-private TSS and LDT if allocated. By using 1:1 mapping for the kernel text and data, it appeared possible to eliminate assembler part of the locore.S which bootstraps initial page table and KPTmap. The code is rewritten in C and moved into the pmap_cold(). The comment in vmparam.h explains the KVA layout. There is no PCID mechanism available in protected mode, so each kernel/user switch forth and back completely flushes the TLB, except for the trampoline PTD region. The TLB invalidations for userspace becomes trivial, because IPI handlers switch page tables. On the other hand, context switches no longer need to reload %cr3. copyout(9) was rewritten to use vm_fault_quick_hold(). An issue for new copyout(9) is compatibility with wiring user buffers around sysctl handlers. This explains two kind of locks for copyout ptes and accounting of the vslock() calls. The vm_fault_quick_hold() AKA slow path, is only tried after the 'fast path' failed, which temporary changes mapping to the userspace and copies the data to/from small per-cpu buffer in the trampoline. If a page fault occurs during the copy, it is short-circuit by exception.s to not even reach C code. The change was motivated by the need to implement the Meltdown mitigation, but instead of KPTI the full split is done. The i386 architecture already shows the sizing problems, in particular, it is impossible to link clang and lld with debugging. I expect that the issues due to the virtual address space limits would only exaggerate and the split gives more liveness to the platform. Tested by: pho Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 1 month Differential revision: https://reviews.freebsd.org/D14633 Notes: svn path=/head/; revision=332489
2017-11-18spdx: initial adoption of licensing ID tags.Pedro F. Giffuni
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. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
2015-05-22CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than tenJung-uk Kim
years for head. However, it is continuously misused as the mpsafe argument for callout_init(9). Deprecate the flag and clean up callout_init() calls to make them more consistent. Differential Revision: https://reviews.freebsd.org/D2613 Reviewed by: jhb MFC after: 2 weeks Notes: svn path=/head/; revision=283291
2015-01-21Garbage collect dragonfly and legacy FreeBSD system support from dcons(4).Will Andrews
Submitted by: gibbs MFC after: 1 week Sponsored by: Spectra Logic MFSpectraBSD: 1110990 on 2015/01/06 Notes: svn path=/head/; revision=277505
2013-02-19MFcalloutng:Alexander Motin
Make dcons input polling adaptive, reducing poll rate to 1Hz after several minutes of inactivty to reduce global interrupt rate. Most of users never used FireWire debugging, so it is not very useful to consume power by it. Notes: svn path=/head/; revision=247005
2011-12-17kern cons: introduce infrastructure for console grabbing by kernelAndriy Gapon
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
2011-11-07Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.Ed Schouten
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. Notes: svn path=/head/; revision=227309
2011-08-27Follow up to r225203 refining break-to-debugger run-time configurationRobert Watson
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
2011-08-26Attempt to make break-to-debugger and alternative break-to-debugger moreRobert Watson
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
2009-05-29Last minute TTY API change: remove mutex argument from tty_alloc().Ed Schouten
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
2009-04-06Reduce the dcons polling frequency to 25 Hz.Ed Schouten
It makes little sense to use 100 Hz polling in dcons. We cannot live without polling, because that's just how dcons works. It polls the buffer filled by the firewire hardware. 25 Hz is probably enough for most use cases. Discussed with: rwatson Tested by: kan Notes: svn path=/head/; revision=190771
2009-04-06Fix logic in MOD_LOAD handler to call dcons_attach after all successfulAlexander Kabaev
dcons_drv_init invocations. Testing return value for 0 does not work for cases where dcons_drv_init was called already as part of low level console initialization. Notes: svn path=/head/; revision=190756
2009-03-13We need to initialize the console for dcons to work.Warner Losh
Submitted by: nork@ Notes: svn path=/head/; revision=189752
2009-01-07Check the return values of contigmalloc(9) as well as bus_dma(9)Marius Strobl
functions and stop attaching of dcons(4) and dcons_crom(4) if they indicate failure. This fixes a panic seen on sparc64 machines with no free physical memory in the requested 32-bit region but still doesn't make dcons(4)/dcons_crom(4) these work. I think the latter can be fixed by simply specifying ~0UL as the upper limit for contigmalloc(9) and letting the bounce pages and the IOMMU respectively handle limitations of the DMA engine. I didn't want to change that without the consensus of simokawa@ though, who unfortunately didn't reply so far. MFC after: 1 week Notes: svn path=/head/; revision=186876
2008-11-19Given that the buffer dcons_crom(4) exposes is used for both inputMarius Strobl
and output, set BUS_DMA_COHERENT when creating the DMA map used for loading the buffer. As a side-effect this solves locking issues on sparc64 when dcons(4) calls bus_dmamap_sync(9) while in an interrupt filter, which are executed in a critical section, and iommu(4) has to use a sleep lock when taking advantage of the streaming buffer. Reported and tested by: kensmith Approved by: simokawa Notes: svn path=/head/; revision=185108
2008-11-19Also make dcons(4) use MPSAFE callouts.Ed Schouten
The callout locks the TTY layer the way it should, so there is no reason why its callout shouldn't set this flag. Notes: svn path=/head/; revision=185107
2008-08-20Integrate the new MPSAFE TTY layer to the FreeBSD operating system.Ed Schouten
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
2008-05-05Spell KDB_REQ_REBOOT correctly.Peter Wemm
Notes: svn path=/head/; revision=178771
2008-05-04Expand kdb_alt_break a little, most commonly used with the optionPeter Wemm
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
2007-12-25Add a new 'why' argument to kdb_enter(), and a set of constants to useRobert Watson
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
2007-08-17We don't need to call dcons_poll event handlers if KDB is not active.Hidetoshi Shimokawa
Approved by: re (kensmith) Notes: svn path=/head/; revision=171867
2007-06-11- Don't force to be the GDB port since dcons(4) is in GENERIC now.Hidetoshi Shimokawa
To enable the GDB port of dcons(4), you need to put dcons_gdb=1 in /boot/loader.conf. Notes: svn path=/head/; revision=170537
2007-06-08Don't invalidate dcons buffer on shutdown.Hidetoshi Shimokawa
We would like to keep connection after halt. Notes: svn path=/head/; revision=170426
2007-06-08Add the address of IDT in the configuration ROM. (i386/amd64 only)Hidetoshi Shimokawa
A change to dconschat(8) will follow so that it can bomb this address over FireWire to reset a wedged system. Though this method is just a hack and far from perfection, it should be useful if you don't want to go machine room just to reset or to power-cycle a machine without remote-managed power supply. And much better than doing: # fwcontrol -m target-eui64 # dd if=/dev/zero of=/dev/fwmem0.2 bs=1m Notes: svn path=/head/; revision=170420
2007-06-08Replace breakpoint() with kdb_enter().Hidetoshi Shimokawa
Notes: svn path=/head/; revision=170418
2007-06-08Poll bus resets on FireWire while kdb/gdb is active.Hidetoshi Shimokawa
Now, it's safe to call the fwohci interrupt(polling) routine while ddb/gdb is active. After this change, a dcons connnection over FireWire can survive bus resets even in kernel debugger. This means that it is not too late to plug a FireWire cable after a panic to investigate the problem. Actually there is a small window(between a jump to kernel from loader and initialization of dcons_crom) in which no one can take care of a bus reset. Except that window, firewire console should keep working from loader to reboot even with a panic and a bus reset. (as far as you enable LOADER_FIREWIRE_SUPPORT) Notes: svn path=/head/; revision=170408
2007-05-28We should better ignore a break on gdb port if gdb is not enabled.Hidetoshi Shimokawa
Notes: svn path=/head/; revision=170043
2007-05-27Change default value of hw.firewire.dcons_crom.force_console to 0Hidetoshi Shimokawa
for least astonishment. MFC after: 3 days Notes: svn path=/head/; revision=170018
2007-05-27Make compile without GDB option.Hidetoshi Shimokawa
MFC after: 3 days Notes: svn path=/head/; revision=170017
2007-05-25Include stand.h for loader.Hidetoshi Shimokawa
MFC after: 3 days Notes: svn path=/head/; revision=169972
2006-11-06Sweep kernel replacing suser(9) calls with priv(9) calls, assigningRobert Watson
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
2006-05-26Convert to new console interface.Poul-Henning Kamp
Notes: svn path=/head/; revision=158959
2006-05-26Eliminate gdb_checkc member from GDB_DBGPORT(), it is never used.Poul-Henning Kamp
Use polling behaviour for gdb_getc() where convenient, this edges us closer to the console code. Notes: svn path=/head/; revision=158950
2006-01-04Use ttyalloc() instead of ttymalloc()Poul-Henning Kamp
Notes: svn path=/head/; revision=154016
2005-12-05Fix -Wundef warnings found when compiling i386 LINT, GENERIC andRuslan Ermilov
custom kernels. Notes: svn path=/head/; revision=153110
2005-10-16Make ttyconsolemode() call ttsetwater() so that drivers don't have to.Poul-Henning Kamp
Notes: svn path=/head/; revision=151388
2005-01-06Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh
Notes: svn path=/head/; revision=139749
2004-10-28Use dcons buffer passed by loader on amd64.Hidetoshi Shimokawa
Notes: svn path=/head/; revision=137013
2004-10-24- Use quad_t for dcons buffer address and size.Hidetoshi Shimokawa
- Allow read/write access to dcons buffer passed by loader(8). Notes: svn path=/head/; revision=136898
2004-10-22Check _BOOT flag.Hidetoshi Shimokawa
Notes: svn path=/head/; revision=136781
2004-10-18Add new function ttyinitmode() which sets our systemwide defaultPoul-Henning Kamp
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