summaryrefslogtreecommitdiffstats
path: root/sys/dev/sio/sio.c
Commit message (Collapse)AuthorAgeFilesLines
* Since we have removed com.c and renamed comreg.h to sioreg.h I need torgrimes1994-05-261-1/+1
| | | | fix sio.c to #include sioreg.h.
* The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.rgrimes1994-05-251-40/+41
| | | | | Reviewed by: Rodney W. Grimes Submitted by: John Dyson and David Greenman
* Added support for the 16 port Boca via a flag to specify that there isdg1994-04-231-4/+9
| | | | no master port.
* Add declaration missing from previous bde's versionache1994-04-031-1/+2
|
* CHANGES from Bruce:ache1994-04-031-196/+307
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- This list of changes is in approximately chronological order (oldest first). o Many cosmetic changes - renamed comintr1 -> siointr1, moved things around and fixed whitespace. o Reduced SLIP latency (FRAME_END hack) from 20-30 ms to 16 ms at 115200 bps (you won't notice the average 10 ms improvement on slow lines). ppp seems to use only counted transfers so there's no similar hack available. It's too hard for the driver to know the count. o Temporary #ifdefs for new and old interrupt handling (OLD_INTERRUPT_HANDLING decided by setsofttty() not being externally defined. o Don't test for the IIR_NOPEND bit being set - test for the non-fifo part of the iir equalling it like the docs say to. States with other IIR_NOPEND set in combination with the other iir bits are undefined. The docs may be stupid - the old test would not have broken when the fifo bits were introduced. o Noted more problems with DTR wait. o Rewrote console stuff. Still some initialization and state preservation problems. Same for kgdb stuff. The driver doesn't do anything about the console close bug. It needs to be fixed entirely in i386/cons.c. I like chmr's version where the the console driver revectors the device open and close routines. o Temporary (?) #ifdefs for references to tty buffers. o Noted further things to do in (2 comments about 3 places) for phk's change to not touch RTS unless it is being used for flow control. o Temporary #ifdefs for timestamp handling. It needs fixing. The microtime() call breaks the first rule of writing fast interrupt handlers: NO calls to functions that might do slow and bad things. microtime() enables interrupts. This turns out to be only moderately harmful. Also, I want the timestamp copy outside of the normal interrupt handler. o Don't init com->tp early for the !DONT_MALLOC_TTYS case - both sides are NULL. o Worry about com->tp == NULL in siopoll. I don't see how you survived the (incc <= 0 || !(tp->state & TS_ISOPEN)) test. Perhaps early sttys or comcontrols set up the tp's for _all_ the ports before this code is reached.
* New interrupt code from Bruce Evans. In additional to Bruce's attacheddg1994-04-021-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | list of changes, I've made the following additional changes: 1) i386/include/ipl.h renamed to spl.h as the name conflicts with the file of the same name in i386/isa/ipl.h. 2) changed all use of *mask (i.e. netmask, biomask, ttymask, etc) to *_imask (net_imask, etc). 3) changed vestige of splnet use in if_is to splimp. 4) got rid of "impmask" completely (Bruce had gotten rid of netmask), and are now using net_imask instead. 5) dozens of minor cruft to glue in Bruce's changes. These require changes I made to config(8) as well, and thus it must be rebuilt. -DG from Bruce Evans: sio: o No diff is supplied. Remove the define of setsofttty(). I hope that is enough. *.s: o i386/isa/debug.h no longer exists. The event counters became too much trouble to maintain. All function call entry and exception entry counters can be recovered by using profiling kernel (the new profiling supports all entry points; however, it is too slow to leave enabled all the time; it also). Only BDBTRAP() from debug.h is now used. That is moved to exception.s. It might be worth preserving SHOW_BITS() and calling it from _mcount() (if enabled). o T_ASTFLT is now only set just before calling trap(). o All exception handlers set SWI_AST_MASK in cpl as soon as possible after entry and arrange for _doreti to restore it atomically with exiting. It is not possible to set it atomically with entering the kernel, so it must be checked against the user mode bits in the trap frame before committing to using it. There is no place to store the old value of cpl for syscalls or traps, so there are some complications restoring it. Profiling stuff (mostly in *.s): o Changes to kern/subr_mcount.c, gcc and gprof are not supplied yet. o All interesting labels `foo' are renamed `_foo' and all uninteresting labels `_bar' are renamed `bar'. A small change to gprof allows ignoring labels not starting with underscores. o MCOUNT_LABEL() is to provide names for counters for times spent in exception handlers. o FAKE_MCOUNT() is a version of MCOUNT() suitable for exception handlers. Its arg is the pc where the exception occurred. The new mcount() pretends that this was a call from that pc to a suitable MCOUNT_LABEL(). o MEXITCOUNT is to turn off any timer started by MCOUNT(). /usr/src/sys/i386/i386/exception.s: o The non-BDB BPTTRAP() macros were doing a sti even when interrupts were disabled when the trap occurred. The sti (fixed) sti is actually a no-op unless you have my changes to machdep.c that make the debugger trap gates interrupt gates, but fixing that would make the ifdefs messier. ddb seems to be unharmed by both interrupts always disabled and always enabled (I had the branch in the fix back to front for some time :-(). o There is no known pushal bug. o tf_err can be left as garbage for syscalls. /usr/src/sys/i386/i386/locore.s: o Fix and update BDE_DEBUGGER support. o ENTRY(btext) before initialization was dangerous. o Warm boot shot was longer than intended. /usr/src/sys/i386/i386/machdep.c: o DON'T APPLY ALL OF THIS DIFF. It's what I'm using, but may require other changes. Use the following: o Remove aston() and setsoftclock(). Maybe use the following: o No netisr.h. o Spelling fix. o Delay to read the Rebooting message. o Fix for vm system unmapping a reduced area of memory after bounds_check_with_label() reduces the size of a physical i/o for a partition boundary. A similar fix is required in kern_physio.c. o Correct use of __CONCAT. It never worked here for non- ANSI cpp's. Is it time to drop support for non-ANSI? o gdt_segs init. 0xffffffffUL is bogus because ssd_limit is not 32 bits. The replacement may have the same value :-), but is more natural. o physmem was one page too low. Confusing variable names. Don't use the following: o Better numbers of buffers. Each 8K page requires up to 16 buffer headers. On my system, this results in 5576 buffers containing [up to] 2854912 bytes of memory. The usual allocation of about 384 buffers only holds 192K of disk if you use it on an fs with a block size of 512. o gdt changes for bdb. o *TGT -> *IDT changes for bdb. o #ifdefed changes for bdb. /usr/src/sys/i386/i386/microtime.s: o Use the correct asm macros. I think asm.h was copied from Mach just for microtime and isn't used now. It certainly doesn't belong in <sys>. Various macros are also duplicated in sys/i386/boot.h and libc/i386/*.h. o Don't switch to and from the IRR; it is guaranteed to be selected (default after ICU init and explicitly selected in isa.c too, and never changed until the old microtime clobbered it). /usr/src/sys/i386/i386/support.s: o Non-essential changes (none related to spls or profiling). o Removed slow loads of %gs again. The LDT support may require not relying on %gs, but loading it is not the way to fix it! Some places (copyin ...) forgot to load it. Loading it clobbers the user %gs. trap() still loads it after certain types of faults so that fuword() etc can rely on it without loading it explicitly. Exception handlers don't restore it. If we want to preserve the user %gs, then the fastest method is to not touch it except for context switches. Comparing with VM_MAXUSER_ADDRESS and branching takes only 2 or 4 cycles on a 486, while loading %gs takes 9 cycles and using it takes another. o Fixed a signed branch to unsigned. /usr/src/sys/i386/i386/swtch.s: o Move spl0() outside of idle loop. o Remove cli/sti from idle loop. sw1 does a cli, and in the unlikely event of an interrupt occurring and whichqs becoming zero, sw1 will just jump back to _idle. o There's no spl0() function in asm any more, so use splz(). o swtch() doesn't need to be superaligned, at least with the new mcounting. o Fixed a signed branch to unsigned. o Removed astoff(). /usr/src/sys/i386/i386/trap.c: o The decentralized extern decls were inconsistent, of course. o Fixed typo MATH_EMULTATE in comments. */ o Removed unused variables. o Old netmask is now impmask; print it instead. Perhaps we should print some of the new masks. o BTW, trap() should not print anything for normal debugger traps. /usr/src/sys/i386/include/asmacros.h: o DON'T APPLY ALL OF THIS DIFF. Just use some of the null macros as necessary. /usr/src/sys/i386/include/cpu.h: o CLKF_BASEPRI() changes since cpl == SWI_AST_MASK is now normal while the kernel is running. o Don't use var++ to set boolean variables. It fails after a mere 4G times :-) and is slower than storing a constant on [3-4]86s. /usr/src/sys/i386/include/cpufunc.h: o DON'T APPLY ALL OF THIS DIFF. You need mainly the include of <machine/ipl.h>. Unfortunately, <machine/ipl.h> is needed by almost everything for the inlines. /usr/src/sys/i386/include/ipl.h: o New file. Defines spl inlines and SWI macros and declares most variables related to hard and soft interrupt masks. /usr/src/sys/i386/isa/icu.h: o Moved definitions to <machine/ipl.h> /usr/src/sys/i386/isa/icu.s: o Software interrupts (SWIs) and delayed hardware interrupts (HWIs) are now handled uniformally, and dispatching them from splx() is more like dispatching them from _doreti. The dispatcher is essentially *(handler[ffs(ipending & ~cpl)](). o More care (not quite enough) is taken to avoid unbounded nesting of interrupts. o The interface to softclock() is changed so that a trap frame is not required. o Fast interrupt handlers are now handled more uniformally. Configuration is still too early (new handlers would require bits in <machine/ipl.h> and functions to vector.s). o splnnn() and splx() are no longer here; they are inline functions (could be macros for other compilers). splz() is the nontrivial part of the old splx(). /usr/src/sys/i386/isa/ipl.h o New file. Supposed to have only bus-dependent stuff. Perhaps the h/w masks should be declared here. /usr/src/sys/i386/isa/isa.c: o DON'T APPLY ALL OF THIS DIFF. You need only things involving *mask and *MASK and comments about them. netmask is now a pure software mask. It works like the softclock mask. /usr/src/sys/i386/isa/vector.s: o Reorganize AUTO_EOI* macros. o Option FAST_INTR_HANDLER_USERS_ES for people who don't trust fastintr handlers. o fastintr handlers need to metamorphose into ordinary interrupt handlers if their SWI bit has become set. Previously, sio had unintended latency for handling output completions and input of SLIP framing characters because this was not done. /usr/src/sys/net/netisr.h: o The machine-dependent stuff is now imported from <machine/ipl.h>. /usr/src/sys/sys/systm.h o DON'T APPLY ALL OF THIS DIFF. You need mainly the different splx() prototype. The spl*() prototypes are duplicated as inlines in <machine/ipl.h> but they need to be duplicated here in case there are no inlines. I sent systm.h and cpufunc.h to Garrett. We agree that spl0 should be replaced by splnone and not the other way around like I've done. /usr/src/sys/kern/kern_clock.c o splsoftclock() now lowers cpl so the direct call to softclock() works as intended. o softclock() interface changed to avoid passing the whole frame (some machines may need another change for profile_tick()). o profiling renamed _profiling to avoid ANSI namespace pollution. (I had to improve the mcount() interface and may as well fix it.) The GUPROF variant doesn't actually reference profiling here, but the 'U' in GUPROF should mean to select the microtimer mcount() and not change the interface.
* Change got_status/modem_status assignment per Bruce suggestion,ache1994-04-011-4/+4
| | | | because inb clears modem status port.
* 1) Better fix for false carrier detect on bidir portache1994-03-261-8/+16
| | | | | 2) ttyclose moved after comhardclose, because clears t_state 3) slpx(s) moved after l_open to prevent undetected carrier down
* Fix false carrier detection on incoming bidir port.ache1994-03-251-1/+3
|
* 1) Change dtrwait 300 to 3 * hz (to be more kosher)ache1994-03-231-2/+4
| | | | 2) Protect sioclose by spltty()
* Add siostop to sioclose, because ttyflush called fromache1994-03-211-1/+2
| | | | wrong places removed now.
* Increase default DTR wait time up to 3 secs.ache1994-03-211-2/+2
| | | | | Also hardw. specs says 2.5 secs is enough, many modems needs at least 3 secs.
* Remove ttyfree from siocloseache1994-03-181-6/+1
| | | | | | | | | Example: Application use port cua01 Getty open ttyd1 (allocates rawq,outq,etc) and waits while application done Application quits, sioclose issued, ttyfree issued (getty calls revoke) Getty awakes and goes to panic into initrb (NULL rawq)
* Checking l_close in unneeded (one of my previous fixes),ache1994-03-141-3/+2
| | | | so back it out.
* Don't call ttyclose twice into sioclose and move ttycloseache1994-03-101-2/+3
| | | | before comhardclose
* First open:ache1994-03-081-4/+11
| | | | | | | | | now HUPCL set only in bidir case for callin lines (this prevents set HUPCL on mouse) comhardclose: in addition to HUPCL case now DTR dropped for bidir case if line was active in and no carrier present now. (this prevents DTR sleep on mouse)
* Ttys structures are now allocated dynamically via ttymalloc/ttyfree.guido1994-03-021-14/+21
| | | | | | | | | | | | | | | | This inetrface should be used from now on. pseudo device pty xx still keeps its meaning: a maximum of xx ptys is allowed. A ringbuffer is now 2040 bytes long, per Garrett Wollman's request. The changes are inspired by the way NetBSD did it (thanks for that!), though I made it slihghtly different, including the interface so at least 75% of the allocated space is deallocated when the tty is closed. Note further that it is easy to modify the ringbuffer length runtime. This will have to wait untill some later date... -Guido
* RTS shouldn't be touched unless CS_RTS_IFLOW is set.phk1994-02-261-2/+3
|
* TIOCTIMESTAMP capability. The port in question must be configured withphk1994-02-241-1/+20
| | | | "vector siointrts". Thus only a compare is added for the other ports.
* Change all siointr (expect in Vsio, of course) to comintr1ache1994-02-071-16/+9
| | | | | | This saves two commands per each direct comintr1 call, allows some strict check in siointr and also fix bug with suspended output on multiport cards
* 1) Proper fix for suspended output in multiport caseache1994-02-061-6/+8
| | | | 2) IIR_NOPEND is really *one* bit, we don't need to check whole MASK
* Fix error in multiport part:ache1994-02-021-5/+4
| | | | while input char not entered, output was suspended
* Remove CALLOUTMASK, if non-bidir case.ache1994-01-311-1/+5
|
* 1) Set ipending back to 4, because (16 + 4) bit not inache1994-01-311-151/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | netmask or impmask. 2) Fixes from Bruce: o Changed name of schedsoftcom() to setsofttty() to match setsoftclock() o Bool_t isn't used. o tx_fifo_size is 1 for chips without fifos, 16 for 16550's, to help to output more efficiently for 16550's (LSR_TXRDY means that the fifo is empty, not that it has space for one char). o Changed name of softsio1() to siopoll() and merged compoll() into siopoll(). o The probe forgot to clear com_mcr after it failed. This is harmful for 4 single serial ports on 2 interrupts. It makes partial misconfigurations worse. o Don't bother initializing static variables that are 0 (bidir stuff). o Only initialize t_oflag to TTYDEF_OFLAG if unit == COMCONSOLE, not if COMCONSOLE is defined. o Don't call siointr() from comparam() if there is no output in progress. For the call from sioopen(), there's no output in progress, and siointr() often saw silo overflows for stale input because it was called before sioopen() discarded the input. o Let ttselect() do the work for select(), so that the fixes for ttselect() don't have to be duplicated in zillions of drivers.
* Patch from Brian Smith (modified a little by me) to allow kernel configdg1994-01-311-2/+7
| | | | | | | | | | | | | | | | file override to disable fifo on 16550s: I bought a board with two 16550's, but one of those ports has a mouse on it. The sio driver always enables the fifo, which is a bad thing for mice and X. The mouse is jerky and hard to use. The simple thing is be to treat one of the ports as a non-fifo'ed UART, and I use the flags option in my config file. So, my config file has: device sio0 at isa? port "IO_COM1" tty irq 4 flags 0x2 vector siointr device sio1 at isa? port "IO_COM2" tty irq 3 vector siointr (patch deleted)
* From ache:ache1994-01-111-139/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | Choose older MULTIPORT version, because lastest bde version not worked. Don't force HUPCL for bidirectional case. From bde: Use bit (1 << (16 + 4)) in schedsoftcom() to avoid clash with non-serial h/w on IRQ4. Allow FIFO_TRIGGER in config. Clear com->mcr_image when clearing mcr for init of 4port. The usual value MCR_IENABLE should have broken 4ports unless something happened to clear it later. Turn off interrupts as well as DTR after an error waiting for carrier (bidir dialin case). Drain fifo more carefully. Don't hang up if debugging. Rearrange siointr() -> siointr1() for multiport case for speed, lower latency and clarity. Use suser() to check perms. Provide missing splx() after failed perms checks. c_ispeed == 0 means c_ispeed = c_ospeed (POSIX). Set parameters (except speed) for c_ospeed == 0 as well as hanging up. Better initialization for console (fifo stuff...). Misc. cleanups. Fix dead hang if modem power is off.
* Temporary plug CLOCAL security hole, while sticky bitsache1994-01-021-1/+11
| | | | yet not implemented. Only for bidirectional case.
* Change default dtrwait value to 2 seconds.ache1993-12-161-3/+3
| | | | Change C-style into static initializer per Bruce request.
* set output flags to ttydefault if COMCONSOLE is defined.dg1993-12-131-1/+5
|
* Force HUPCL in bidirectional port open.ache1993-12-111-2/+4
| | | | This don't allow it hangs forever.
* 1) Fix error with port recognition, speed initialization codeache1993-12-091-2/+13
| | | | | | | added to probe. 2) Force CLOCAL=on for outgoing ports and CLOCAL=off for incoming ports into open in bidirectional case. 3) Add DELAY after writing to com_ier for fifo drain into probe.
* Make the LINT kernel compile with -W -Wreturn-type -Wcomment -Werror, andwollman1993-11-251-29/+10
| | | | add same (sans -Werror) to Makefile for future compilations.
* Fix attach message, make separate line for itache1993-11-171-1/+3
| | | | (old version assumed that line is probe line)
* New sio driver from Bruce.ache1993-11-141-195/+211
|
* Add missing read flush code to siostopache1993-11-081-1/+5
|
* Removed all patch kit headers, sccsid and rcsid strings, put $Id$ in, somergrimes1993-10-161-11/+2
| | | | minor cleanup. Added $Id$ to files that did not have any version info, etc
* Disassociate DTR and RTS. They were coupled together and shouldn't havedg1993-10-141-7/+7
| | | | | been. This was necessary to work around problems with some equipment that don't respond favorably to having these both dropped simultaneously.
* incorporated patches from Marc Frajola (marc@escargot.rain.com) todg1993-10-121-2/+4
| | | | unset TS_TBLOCK when the RBLEN falls below the low water mark.
* Change to sio for recognising the last serial port on a multiportjkh1993-09-281-1/+5
| | | | | | | card correctly. Updated syscons to 0.2e, added features for upcoming XFree86 2.0, fixed crashbug.
* From guido@gvr.win.tue.nl Wed Sep 8 13:34:16 1993rgrimes1993-09-101-6/+28
| | | | | | | | | | | | That is because TIOCMGET was broken. Yes...this is known for some time and no, we (Bruce and me) never posted it. Why? Simply because we choose to post fixes when we fixed most of the bugs. Anyway..now that the slip problems are coming, here is a fix for correct TIOCMGET behaviour. -Guido Note: this should be tested first (Rich?). Tested by rgrimes
* From michaele@vice.ico.tek.com Wed Sep 8 09:50:45 1993rgrimes1993-09-081-2/+2
| | | | | | | | | Subject: Re: Some small errors in GAMMA 4. Move printf("\n"); at line 491 in "/sys/i386/isa/sio.c" to after COM_MULTIPORT block at line 512. From rgrimes: The above would cause the word (multiport) with out a new line to appear after the uart type message if you had COM_MULTIPORT enabled.
* xxxprobe now returns the correct number of I/O registers used so thatrgrimes1993-08-281-2/+2
| | | | | the probe output during boot gives the I/O range instead of just the starting address
* Applied Andrew's patch to fix loop-on-logout problem.jkh1993-07-201-5/+3
|
* Removed check for interrupting board before interrupts were enabled.jkh1993-07-201-2/+1
| | | | This should result in more AST clones getting seen.
* Fixed sccs id to be From:\n com.c xxxx. The sccs id was changed by thergrimes1993-07-181-2/+3
| | | | patch kit and it should not have been.
* Modified attach printf's so that the output is compatible with the "new"dg1993-07-151-1/+3
| | | | | | | way of doing things. There still remain several drivers that need to be updated. Also added a compile-time option to pccons to switch the control and caps-lock keys (REVERSE_CAPS_CTRL) - added for my personal sanity.
* Initial import, 0.1 + pk 0.2.4-B1rgrimes1993-06-121-0/+1721
OpenPOWER on IntegriCloud