summaryrefslogtreecommitdiffstats
path: root/sys/dev/sio/sio.c
Commit message (Collapse)AuthorAgeFilesLines
* Document some MP assumptions for sio.imp2012-06-281-0/+5
| | | | Submitted by: bde (years ago)
* kern cons: introduce infrastructure for console grabbing by kernelavg2011-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
* Follow up to r225203 refining break-to-debugger run-time configurationrwatson2011-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)
* Attempt to make break-to-debugger and alternative break-to-debugger morerwatson2011-08-261-29/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Based on discussions on the svn-src mailing list, rework r218195:mdf2011-02-081-1/+0
| | | | | | | | | | | | | | | | | | | | | | - entirely eliminate some calls to uio_yeild() as being unnecessary, such as in a sysctl handler. - move should_yield() and maybe_yield() to kern_synch.c and move the prototypes from sys/uio.h to sys/proc.h - add a slightly more generic kern_yield() that can replace the functionality of uio_yield(). - replace source uses of uio_yield() with the functional equivalent, or in some cases do not change the thread priority when switching. - fix a logic inversion bug in vlrureclaim(), pointed out by bde@. - instead of using the per-cpu last switched ticks, use a per thread variable for should_yield(). With PREEMPTION, the only reasonable use of this is to determine if a lock has been held a long time and relinquish it. Without PREEMPTION, this is essentially the same as the per-cpu variable.
* Add a note about a bug in how sio manages its softc. This wasimp2008-10-081-0/+15
| | | | | discovered by Dorr H. Clark. I'm not at all sure how to fix it, but wanted to document it at the very least...
* Expand kdb_alt_break a little, most commonly used with the optionpeter2008-05-041-3/+23
| | | | | | | | | | | | | | | | | | | 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.
* Add a new 'why' argument to kdb_enter(), and a set of constants to userwatson2007-12-251-2/+4
| | | | | | | | | 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.
* Stop serial console and gdb serial port from getting all screwed up.julian2007-12-051-1/+1
| | | | | | PR: 65278 MFC in: 3 days Submitted by: ups@
* Spelling fix for interupt -> interruptkevlo2007-10-121-1/+1
|
* o break newbus api: add a new argument of type driver_filter_t topiso2007-02-231-5/+7
| | | | | | | | | | | | | bus_setup_intr() o add an int return code to all fast handlers o retire INTR_FAST/IH_FAST For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current Reviewed by: many Approved by: re@
* Restore the status quo before my last commit. Prior to it, sio tookimp2006-07-171-2/+2
| | | | | | | | | precedence uart. With my last change, it became a tie, and uart seems to always win on my amd64. This was not my intention, so have sio be just a tiny bit more preferred than uart. Note: I'm not making any judgement on the merits of uart winning. I'm just saying that if we want to change it, we do it on purpose.
* Have sio return BIS_PROBE_DEFAULT like all the other drivers in theimp2006-06-301-2/+2
| | | | | | | | | | | | tree... John Baldwin noted that sio might pass values between probe and attach via softc. It appears that sio does leave the hardware in a known state after probing, so other drivers that try to probe might leave it in a worse state. It doesn't seem to pass any data in softc, however, that I could find... I think we should not be probing for anything but nonPnP isa, but that's a change for another day. Submitted by: Frank Behrens PR: 87845
* Eliminate gdb_checkc member from GDB_DBGPORT(), it is never used.phk2006-05-261-8/+2
| | | | | Use polling behaviour for gdb_getc() where convenient, this edges us closer to the console code.
* Convert to use CONSOLE_DRIVER() macro:phk2006-05-261-43/+9
| | | | Remove cngetc, rename cncheckc to cngetc (fix GDB console accordingly)
* Insert a '_' in the console function names to be more consistent withphk2006-05-261-17/+17
| | | | the future.
* - Use bus_setup_intr() and bus_teardown_intr() to register device driverjhb2006-02-221-2/+2
| | | | | | | | | | interrupt handlers rather than BUS_SETUP_INTR() and BUS_TEARDOWN_INTR(). Uses of the BUS_*() versions in the implementation of foo_intr methods in bus drivers were not changed. Mostly this just means that some drivers might start printing diagnostic messages like [FAST] when appropriate as well as honoring mpsafenet=0. - Fix two more of the ppbus drivers' identify routines to function correctly in the mythical case of a machine with more than one ppbus.
* Use __DEVOLATILE to cast conspeed.imp2005-12-071-1/+1
|
* Reorganize the interrupt handling code a bit to make a few things cleanerjhb2005-10-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and increase flexibility to allow various different approaches to be tried in the future. - Split struct ithd up into two pieces. struct intr_event holds the list of interrupt handlers associated with interrupt sources. struct intr_thread contains the data relative to an interrupt thread. Currently we still provide a 1:1 relationship of events to threads with the exception that events only have an associated thread if there is at least one threaded interrupt handler attached to the event. This means that on x86 we no longer have 4 bazillion interrupt threads with no handlers. It also means that interrupt events with only INTR_FAST handlers no longer have an associated thread either. - Renamed struct intrhand to struct intr_handler to follow the struct intr_foo naming convention. This did require renaming the powerpc MD struct intr_handler to struct ppc_intr_handler. - INTR_FAST no longer implies INTR_EXCL on all architectures except for powerpc. This means that multiple INTR_FAST handlers can attach to the same interrupt and that INTR_FAST and non-INTR_FAST handlers can attach to the same interrupt. Sharing INTR_FAST handlers may not always be desirable, but having sio(4) and uhci(4) fight over an IRQ isn't fun either. Drivers can always still use INTR_EXCL to ask for an interrupt exclusively. The way this sharing works is that when an interrupt comes in, all the INTR_FAST handlers are executed first, and if any threaded handlers exist, the interrupt thread is scheduled afterwards. This type of layout also makes it possible to investigate using interrupt filters ala OS X where the filter determines whether or not its companion threaded handler should run. - Aside from the INTR_FAST changes above, the impact on MD interrupt code is mostly just 's/ithread/intr_event/'. - A new MI ddb command 'show intrs' walks the list of interrupt events dumping their state. It also has a '/v' verbose switch which dumps info about all of the handlers attached to each event. - We currently don't destroy an interrupt thread when the last threaded handler is removed because it would suck for things like ppbus(8)'s braindead behavior. The code is present, though, it is just under #if 0 for now. - Move the code to actually execute the threaded handlers for an interrrupt event into a separate function so that ithread_loop() becomes more readable. Previously this code was all in the middle of ithread_loop() and indented halfway across the screen. - Made struct intr_thread private to kern_intr.c and replaced td_ithd with a thread private flag TDP_ITHREAD. - In statclock, check curthread against idlethread directly rather than curthread's proc against idlethread's proc. (Not really related to intr changes) Tested on: alpha, amd64, i386, sparc64 Tested on: arm, ia64 (older version of patch by cognet and marcel)
* Eliminate two unused arguments to ttycreate().phk2005-10-161-1/+1
|
* 'PC Card' instead of other variantsimp2005-09-221-2/+2
|
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386nyan2005-05-291-1/+0
| | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr)
* Simplify the "and if we're in the debugger, don't use locks" logic,rwatson2005-02-081-9/+5
| | | | | | correcting some misthinking. Discussed with (really this time): bde
* When entering siocnputc() with (kdb_active), don't acquire (orrwatson2005-02-031-5/+9
| | | | | | | | | | | release) the sio spin mutex, as use of synchronization primitives in the debugger can result in substantial problems. With this patch in place entering the debugger via a serial console is made substantially more reliable. MFC after: 1 week Tested by: kris Discussed with: bde
* Use generic tty code instead of local stuff.phk2004-10-131-521/+79
| | | | NB: device names are now consistent: {cua,tty}d$(port)[.lock,.init]
* Use ttyconsolemode() to set the console tty modes.phk2004-10-121-8/+1
|
* MFpc98: Check a pointer is NULL, remove unused variable.nyan2004-09-201-3/+4
|
* Fix an issue with ng_tty which (ab)used the tty->t_sc field which isphk2004-09-171-4/+6
| | | | | | reserved for the device drivers: Add a t_lsc field for line discipline private use.
* Use ttyalloc() instead of ttymalloc(NULL)phk2004-09-171-1/+1
|
* Allocate tty at attach time rather than open time.phk2004-09-161-49/+43
| | | | | | | | Use the init/lock*in/out fields in struct tty and remove them from our softc. Use tty->t_sc to find out softc when convenient. Mostly OK'ed by: bde
* If you insert a pccard modem and then eject it, you get a panic. Thisimp2004-07-221-1/+2
| | | | | | | happens because the sio device was never opened and com->tp is therefore NULL. ttygone can't swallow a NULL, so guard against that possibility. Other places in this function make similar checks, so I believe this is correct.
* Preparation commit for the tty cleanups that will follow in the nearphk2004-07-151-2/+2
| | | | | | | | | 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.
* Introduce ttygone() which indicates that the hardware is detached.phk2004-07-111-38/+5
| | | | Move dtrwait logic to the generic TTY level.
* Update for the KDB framework. Sanitize the alpha console code now thatmarcel2004-07-101-209/+76
| | | | | | | | | | | | | | | | | | 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.
* Define the tty methods as typedefs.phk2004-06-301-3/+2
| | | | | | Change the return type for t_break to void. Add t_ioctl (more about this later).
* - Shorten the names for the TTY related swi interrupt handlers as thejhb2004-06-281-2/+2
| | | | | | | | 'tty:' prefix is largely redundant. - Fix the priority of the low-priority TTY SWIs that are hung off of the softclock thread. Submitted by: bde (2)
* Guard against us having no tty pointer.phk2004-06-271-1/+2
|
* Pick the hotchar out of the tty structure instead of caching privatephk2004-06-261-6/+5
| | | | | | | | copies. No current line disciplines have a dynamically changing hotchar, and expecting to receive anything sensible during a change in ldisc is insane so no locking of the hotchar field is necessary.
* Use generic support for modemcontrol and BREAK ioctls.phk2004-06-251-79/+64
|
* Remove the TIOCDCDTIMESTAMP option.phk2004-06-221-12/+0
| | | | | The RFC-2783 PPS-API (<sys/timepps.h>) provides better and more configurable service.
* Put the pre FreeBSD-2.x tty compat code under BURN_BRIDGES.phk2004-06-211-0/+4
|
* Give control devices their own cdevsw{} so that we can eliminate themphk2004-06-211-51/+111
| | | | | | from the trafic functions. Do not use com_addr() when we don't need it.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-6/+6
| | | | Bump __FreeBSD_version accordingly.
* Deorbit COMPAT_SUNOS.phk2004-06-111-2/+2
| | | | | We inherited this from the sparc32 port of BSD4.4-Lite1. We have neither a sparc32 port nor a SunOS4.x compatibility desire these days.
* Centralize the line discipline optimization determination in a functionphk2004-06-041-24/+4
| | | | | | | | | called ttyldoptim(). Use this function from all the relevant drivers. I belive no drivers finger linesw[] directly anymore, paving the way for locking and refcounting.
* Manual edits to change linesw[]-frobbing to ttyld_*() calls.phk2004-06-041-2/+2
|
* Machine generated patch which changes linedisc calls from accessingphk2004-06-041-8/+8
| | | | | | linesw[] directly to using the ttyld...() functions The ttyld...() functions ar inline so there is no performance hit.
* Make the remaining serial drivers call ttyioctl() rather than callingphk2004-06-041-8/+3
| | | | the linedisc directly.
* There is no need to explicitly call the stop function. In all likelyhoodphk2004-06-011-1/+0
| | | | ->l_close() did it and ttyclose certainly will.
* There is no need to explicitly call ttwakeup() and ttwwakeup() afterphk2004-06-011-2/+0
| | | | | ttyclose() has been called. It's already been done once by ttyclose, and probably once by the line-discipline too.
OpenPOWER on IntegriCloud