aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sio/sio.c
Commit message (Collapse)AuthorAgeFilesLines
* Copy releng/8.2 to release/8.2.0 for 8.2-RELEASE.release/8.2.0_cvsKen Smith2011-02-161-1/+1
| | | | | | Approved by: re (implicit) This commit was manufactured to restore the state of the 8.2-RELEASE image.
* Add a note about a bug in how sio manages its softc. This wasWarner Losh2008-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... Notes: svn path=/head/; revision=183692
* Expand kdb_alt_break a little, most commonly used with the optionPeter Wemm2008-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. Notes: svn path=/head/; revision=178766
* Add a new 'why' argument to kdb_enter(), and a set of constants to useRobert Watson2007-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. Notes: svn path=/head/; revision=174898
* Stop serial console and gdb serial port from getting all screwed up.Julian Elischer2007-12-051-1/+1
| | | | | | | | | PR: 65278 MFC in: 3 days Submitted by: ups@ Notes: svn path=/head/; revision=174283
* Spelling fix for interupt -> interruptKevin Lo2007-10-121-1/+1
| | | | Notes: svn path=/head/; revision=172568
* o break newbus api: add a new argument of type driver_filter_t toPaolo Pisati2007-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@ Notes: svn path=/head/; revision=166901
* Restore the status quo before my last commit. Prior to it, sio tookWarner Losh2006-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. Notes: svn path=/head/; revision=160420
* Have sio return BIS_PROBE_DEFAULT like all the other drivers in theWarner Losh2006-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 Notes: svn path=/head/; revision=160046
* Eliminate gdb_checkc member from GDB_DBGPORT(), it is never used.Poul-Henning Kamp2006-05-261-8/+2
| | | | | | | | Use polling behaviour for gdb_getc() where convenient, this edges us closer to the console code. Notes: svn path=/head/; revision=158950
* Convert to use CONSOLE_DRIVER() macro:Poul-Henning Kamp2006-05-261-43/+9
| | | | | | | Remove cngetc, rename cncheckc to cngetc (fix GDB console accordingly) Notes: svn path=/head/; revision=158947
* Insert a '_' in the console function names to be more consistent withPoul-Henning Kamp2006-05-261-17/+17
| | | | | | | the future. Notes: svn path=/head/; revision=158943
* - Use bus_setup_intr() and bus_teardown_intr() to register device driverJohn Baldwin2006-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. Notes: svn path=/head/; revision=155921
* Use __DEVOLATILE to cast conspeed.Warner Losh2005-12-071-1/+1
| | | | Notes: svn path=/head/; revision=153195
* Reorganize the interrupt handling code a bit to make a few things cleanerJohn Baldwin2005-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) Notes: svn path=/head/; revision=151658
* Eliminate two unused arguments to ttycreate().Poul-Henning Kamp2005-10-161-1/+1
| | | | Notes: svn path=/head/; revision=151383
* 'PC Card' instead of other variantsWarner Losh2005-09-221-2/+2
| | | | Notes: svn path=/head/; revision=150460
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386Yoshihiro Takahashi2005-05-291-1/+0
| | | | | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr) Notes: svn path=/head/; revision=146734
* Simplify the "and if we're in the debugger, don't use locks" logic,Robert Watson2005-02-081-9/+5
| | | | | | | | | correcting some misthinking. Discussed with (really this time): bde Notes: svn path=/head/; revision=141530
* When entering siocnputc() with (kdb_active), don't acquire (orRobert Watson2005-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 Notes: svn path=/head/; revision=141186
* Use generic tty code instead of local stuff.Poul-Henning Kamp2004-10-131-521/+79
| | | | | | | NB: device names are now consistent: {cua,tty}d$(port)[.lock,.init] Notes: svn path=/head/; revision=136478
* Use ttyconsolemode() to set the console tty modes.Poul-Henning Kamp2004-10-121-8/+1
| | | | Notes: svn path=/head/; revision=136450
* MFpc98: Check a pointer is NULL, remove unused variable.Yoshihiro Takahashi2004-09-201-3/+4
| | | | Notes: svn path=/head/; revision=135516
* Fix an issue with ng_tty which (ab)used the tty->t_sc field which isPoul-Henning Kamp2004-09-171-4/+6
| | | | | | | | | reserved for the device drivers: Add a t_lsc field for line discipline private use. Notes: svn path=/head/; revision=135406
* Use ttyalloc() instead of ttymalloc(NULL)Poul-Henning Kamp2004-09-171-1/+1
| | | | Notes: svn path=/head/; revision=135367
* Allocate tty at attach time rather than open time.Poul-Henning Kamp2004-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 Notes: svn path=/head/; revision=135329
* If you insert a pccard modem and then eject it, you get a panic. ThisWarner Losh2004-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. Notes: svn path=/head/; revision=132561
* Preparation commit for the tty cleanups that will follow in the nearPoul-Henning Kamp2004-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. Notes: svn path=/head/; revision=132226
* Introduce ttygone() which indicates that the hardware is detached.Poul-Henning Kamp2004-07-111-38/+5
| | | | | | | Move dtrwait logic to the generic TTY level. Notes: svn path=/head/; revision=131981
* Update for the KDB framework. Sanitize the alpha console code now thatMarcel Moolenaar2004-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. Notes: svn path=/head/; revision=131939
* Define the tty methods as typedefs.Poul-Henning Kamp2004-06-301-3/+2
| | | | | | | | | Change the return type for t_break to void. Add t_ioctl (more about this later). Notes: svn path=/head/; revision=131373
* - Shorten the names for the TTY related swi interrupt handlers as theJohn Baldwin2004-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) Notes: svn path=/head/; revision=131242
* Guard against us having no tty pointer.Poul-Henning Kamp2004-06-271-1/+2
| | | | Notes: svn path=/head/; revision=131185
* Pick the hotchar out of the tty structure instead of caching privatePoul-Henning Kamp2004-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. Notes: svn path=/head/; revision=131134
* Use generic support for modemcontrol and BREAK ioctls.Poul-Henning Kamp2004-06-251-79/+64
| | | | Notes: svn path=/head/; revision=131094
* Remove the TIOCDCDTIMESTAMP option.Poul-Henning Kamp2004-06-221-12/+0
| | | | | | | | The RFC-2783 PPS-API (<sys/timepps.h>) provides better and more configurable service. Notes: svn path=/head/; revision=130938
* Put the pre FreeBSD-2.x tty compat code under BURN_BRIDGES.Poul-Henning Kamp2004-06-211-0/+4
| | | | Notes: svn path=/head/; revision=130892
* Give control devices their own cdevsw{} so that we can eliminate themPoul-Henning Kamp2004-06-211-51/+111
| | | | | | | | | from the trafic functions. Do not use com_addr() when we don't need it. Notes: svn path=/head/; revision=130872
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-161-6/+6
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Deorbit COMPAT_SUNOS.Poul-Henning Kamp2004-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. Notes: svn path=/head/; revision=130344
* Centralize the line discipline optimization determination in a functionPoul-Henning Kamp2004-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. Notes: svn path=/head/; revision=130096
* Manual edits to change linesw[]-frobbing to ttyld_*() calls.Poul-Henning Kamp2004-06-041-2/+2
| | | | Notes: svn path=/head/; revision=130095
* Machine generated patch which changes linedisc calls from accessingPoul-Henning Kamp2004-06-041-8/+8
| | | | | | | | | linesw[] directly to using the ttyld...() functions The ttyld...() functions ar inline so there is no performance hit. Notes: svn path=/head/; revision=130077
* Make the remaining serial drivers call ttyioctl() rather than callingPoul-Henning Kamp2004-06-041-8/+3
| | | | | | | the linedisc directly. Notes: svn path=/head/; revision=130057
* There is no need to explicitly call the stop function. In all likelyhoodPoul-Henning Kamp2004-06-011-1/+0
| | | | | | | ->l_close() did it and ttyclose certainly will. Notes: svn path=/head/; revision=129939
* There is no need to explicitly call ttwakeup() and ttwwakeup() afterPoul-Henning Kamp2004-06-011-2/+0
| | | | | | | | ttyclose() has been called. It's already been done once by ttyclose, and probably once by the line-discipline too. Notes: svn path=/head/; revision=129937
* ttyclose() increments t_gen. Remove redundant increments in drivers.Poul-Henning Kamp2004-06-011-1/+0
| | | | Notes: svn path=/head/; revision=129934
* Remove new options and my prevention of system freeze when the sio probeDoug Ambrisko2004-05-031-76/+49
| | | | | | | | | | returns okay when HW probe fails. This happens when comconsole flag is set but VGA console is used instead. Back out requested by: bde (He will be looking at other solutions from scratch) Notes: svn path=/head/; revision=128899
* Some enhancements and bug fix.Doug Ambrisko2004-04-301-49/+76
| | | | | | | | | | | | | | | | | | | | | - Define option FORCECONSPEED to force the serial console to be CONSPEED. I've run into a lot of boards in which the detect for prior speed doesn't work and ends up with broken console since it is at the wrong speed. - If a serial port is marked as a console, but console=vidconsole and if the serial ports doesn't exist it will be probed and attached at a 8250 chip. Then writes to that will freeze the system. - Add an option flags 0x400000 to mark this as a potential comconsole in-case the one flaged with 0x10 does not exist in the system. This makes it easier to deploy on systems with one or two serial ports. Obtained from: IronPort Notes: svn path=/head/; revision=128781
* Back out last bad commit (again!)Warner Losh2004-04-071-12/+1
| | | | Notes: svn path=/head/; revision=128020