Commit Graph

223 Commits

Author SHA1 Message Date
thorpej cb450cc444 Use device_lookup(). 2000-07-06 01:47:34 +00:00
thorpej b29178acf3 Remove unnecessary junk on #undef line that some C preprocessors
get cranky about.
2000-05-03 19:19:04 +00:00
simonb 9e370d4402 Delete redundant decl of com_attach_subr(), it's in comvar.h. 2000-03-30 02:04:30 +00:00
thorpej fc96443d15 New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
  resource allocation.
- Insertion and removal of callouts is constant time, important as
  this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
2000-03-23 07:01:25 +00:00
thorpej a183d34f04 - Implement cnbell() -- ring the console bell. The cn_bell entrypoint
is optional.
- Add cn_bell to statically allocated consdevs as appropriate.
2000-03-06 21:36:05 +00:00
jonathan e9a4467c58 Fix thinko in previous revision: it wouldn't catch deassert.
Revert the code inside the new test to the previous-but-one revision.
2000-02-07 02:17:18 +00:00
jonathan 2da22cf2c5 Check for DCD status change interrupts which signal PPS events, even
if the line discipline is ignoring carrier (e.g., via comparam()'s
setting of sc->sc_msr_mask).  Move PPS timestamp outside the normal
status-change processing, and ignore sc_msr_mask when testing
for PPS events.
2000-02-06 23:23:37 +00:00
soda 3d14a7c591 kluge to make this work with NEC M403 (arc/magnum). 2000-01-23 21:06:01 +00:00
drochner b95651b752 set carrier early if used as console or kgdb line, fixes PR kern/6547
by Andreas Gustafsson, gson@iengines.com
1999-12-21 11:04:36 +00:00
sommerfeld 17d170b1ca defopt COM_DEBUG, COM_HAYESP, and COM16650 1999-11-22 03:53:38 +00:00
jonathan 0588cdfc88 Update user-level PPS-API to match -05 draft.
Change PPS_<xxx> ioctls to PPS_IOC_<xxx>.
1999-11-04 05:33:58 +00:00
jonathan b31080319e Fix nanosecond/microsecond botch in PPSAPI:
remove bogus TIMESPEC_TO_TIMEVAL() after applying any {assert,clear} offset.
1999-10-15 06:16:15 +00:00
ross 4b0326d939 Get rid of delay() in com_common_putc() because the Shark delay() is borked
and can't be called until after the timers are setup. (It should not use
a timer, or it should have a fallback algorithm.)
1999-04-19 19:27:31 +00:00
thorpej 552465011e Revert revision 1.159. The correct answer was not to re-break the
serial console support, but rather to fix the Shark delay().
1999-04-18 22:02:47 +00:00
mrg 833fb0ac7f back date this file to version 1.155 which works on the shark. 1999-03-31 12:44:04 +00:00
mycroft f487bc59aa Nuke bogus extra variable, too. 1999-03-29 13:40:41 +00:00
mycroft 85ad0d175c Fix bogons in previous change:
* The fact that IIR_NOPEND was not set on entry does *not* mean that no
  transmission was in progress.  Besides, we don't want to throw away receive
  interrupts either.
* In the !clearirq case, we didn't splx().
1999-03-29 13:21:15 +00:00
ross 6a228da053 Mods to com_common_putc(). When doing kprintf() or kgdb output:
1. don't clear the irq unless it was clear before transmitting
2. also do various bus_space_barrier() ops
Stops console from freezing when kprintf interrupts tty driver output.
1999-03-29 10:01:39 +00:00
explorer 3ebb419571 Update to slightly altered rnd_attach_source() api 1999-02-28 17:08:05 +00:00
drochner 525932e022 make the probe stricter to catch cases where the chipset doesn't pull
the data lines to "high" for not-existant devices
1999-02-12 12:45:48 +00:00
mycroft 0c7afe477d Separate the tiocm code into functions, like the z8530 code, and fix the same
DTR bug.
1999-02-03 23:57:27 +00:00
mycroft 9be96dda95 Fix an inconsistency: PPS was turned off on first open, but the mode may have
still claimed it was enabled.
1999-02-03 23:22:11 +00:00
mycroft 535f59cc81 Slight redux in PPS code. 1999-02-03 23:20:33 +00:00
drochner a7f50b8178 Debugger() -> console_debugger() to honour the ddb_fromconsole sysctl 1999-01-26 17:08:37 +00:00
thorpej 3e086bd63d Add support for detaching "com" instances. 1998-11-18 23:58:52 +00:00
is 95807e512a Garbage collect unused 3rd parameter to comprobe1(). 1998-09-16 21:30:58 +00:00
thorpej d1fba4e7e5 Don't use M_WAITOK to allocate the ring buffer; we could be in interrupt
context.  Reported by Lennart Augustsson.
1998-09-09 05:17:53 +00:00
mycroft d07b3639a4 Assign my copyrights to TNF. 1998-08-15 17:47:15 +00:00
jonathan 466e784ee1 defopt DDB. 1998-07-04 22:18:13 +00:00
jonathan bbc2d1522a PPS support from April, reworked and extended to match the PPS-API
Internet Draft (draft-mogul-pps-api-02.txt).
1998-06-10 12:06:23 +00:00
mycroft 2bb5067e13 Move the code to wait for carrier on a tty into a common function, since it
depends only on device-independent state bits.
Implement SunOS-style `dialout' devices.
1998-03-22 00:55:37 +00:00
mycroft 16566cda09 Remove a bogus initializer. 1998-03-21 04:27:58 +00:00
mycroft 2ada4b4af1 Replace TS_WOPEN with t_wopen, per mail on tech-kern. 1998-03-21 04:02:47 +00:00
ross 081231b1ad Add dummy }} after comsoft() to keep ctags(1) bashing on. 1998-02-25 08:32:35 +00:00
enami e12f85fbc1 Disable the device if we fail to open and nobody else has the device open.
(Thanks Charles and Marc for your advices).
1998-02-22 05:09:58 +00:00
mycroft 11b3fea04a Fix bonehead error in previous change. 1998-02-22 03:24:58 +00:00
mycroft 84a72d6ff4 Remove stray label from last change. 1998-02-19 09:33:33 +00:00
mycroft 06ec9f646f Arrange to call com_break() and com_modem() at splserial().
It's simpler this way.  Really.
1998-02-19 09:23:38 +00:00
thorpej 5fe6759646 Fix serial console support, which was broken by the previous revision:
- In the console getc routine, block until a character becomes ready
  (no, really, we mean it).  This routine should _never_ time out.
- In the console putc routine, if the UART has trouble, do NOT proceed
  to print a diagnostic message, which would recursively invoke the
  console putc routine ad nauseum.
1998-02-09 10:22:45 +00:00
enami 9d13bc6e0e Restore system priority level before return from comopen(). 1998-02-06 03:25:34 +00:00
cgd 9bffcfef75 change #ifdefs keying on "alpha" to key on "__NO_SOFT_SERIAL_INTERRUPT"
instead, and define that on NetBSD/alpha and NetBSD/arm32.
1998-02-02 23:01:02 +00:00
cgd c2f42b2213 Implement a flag to indicate that the driver attached correctly.
This is useful in the case where an attachment's probe routine
verifies that there is indeed hardware present but something goes
"wrong" in the attach causing the device to be unusable.  (Without
keeping track of this, in that case incorrect ports could be
accessed or uninitted pointers could be deferenced on open or at
other times.)
1998-02-02 22:54:55 +00:00
marc 1d4b77e754 split com_attach_subr into attach stuff and per-open initialization stuff
add timeouts to all splserial() while loops so bugs elsewhere don't cause
the com driver to wedge the machine
 add power management support
1998-02-01 23:33:01 +00:00
thorpej 095c4c092d Adjust for config changes. 1998-01-12 09:23:08 +00:00
mycroft f1170022ce Don't do anything in comparam() if the line speed and flags are the same. 1997-12-16 22:52:37 +00:00
mycroft 13e9b38191 Slight optimization in soft input routine. 1997-11-03 08:20:35 +00:00
mycroft 067898abb8 Mostly cosmetic and performance changes:
* Make the ring buffer size and water marks patchable, and allocate the buffer
  separately.
* Do the ttymalloc() at attach time.
* Reorganize the receive buffer so the status and data pair are next to each
  other.  This is slightly faster.
* Make sure we actually do turn off interrupts in comclose() if we have DDB
  configured and it's not the console.  (D'oh!!!!)
* When we exhaust the current transmit run, turn off transmit interrupts in
  comintr(), so we're fairly sure we don't get another one.
* Nuke the silly lsrmap[] idea; it's slower in the normal case.
* Cache the l_rint pointer in the soft interrupt routine.
1997-11-03 06:12:02 +00:00
mycroft 61bf289f3e Slight code rearrangement. 1997-11-02 09:31:49 +00:00
mycroft acb27fb42a Slight code rearrangement. 1997-11-02 09:24:51 +00:00
mycroft 5869b743c7 Rearrange *param() slightly to eliminate a spl.
Also fix another comment regarding DTR.
1997-11-02 09:15:41 +00:00
mycroft 76b7dd52df Add another splserial()/splzs(). 1997-11-02 08:55:52 +00:00
mycroft acd97c6676 Minimize some spl regions slightly. 1997-11-02 08:50:31 +00:00
mycroft 74df2cee60 Correct a comment regarding our behaviour with DTR. 1997-11-01 20:40:36 +00:00
mycroft d0df1f96f4 Add additional splserial()s in comopen() and comclose(). These are not
necessary on the i386 port, but may be on others.
1997-11-01 20:31:57 +00:00
drochner d52df86460 Print probe result after the LCR is restored. Otherwise, bad
things happen if we are the console.
Restore to the prevoius value (not to hardwired 8N1) because this
could be set by the serial console initialization.
Closed PR kern/4373 (Dave Huang)
1997-10-29 18:28:07 +00:00
fvdl 37e4eea4a4 Make 16650 probe optional on COM16650 define. It breaks on some
multiport Startech chips.
1997-10-21 01:25:41 +00:00
mycroft 1bb75c1efa Initialize the IER to 0 in com_attach_subr(). 1997-10-19 20:01:08 +00:00
fvdl 961e39030d Add 16650 hardware flowcontrol support. Basically PR 3844 from
Dave Huang <khym@bga.com>, with added check for broken early versions
of the 16650, taken from the Linux driver.

This should be extended to use, for example, higher trigger levels for
the bigger 16650 FIFO, and its capability for using a smaller divisor
and thus higher speeds. But this patch is very useful for 16650 users
already.
1997-10-19 14:26:16 +00:00
explorer ebf03fd00c Add hooks for entropy collection. Right now, you must place
options RND_COM
in your kernel config file (along with the
	pseudo-device rnd
line) to enable this.  If results are positive, I will make this enabled
by default.
1997-10-19 11:45:33 +00:00
is 1083b2ab71 Use long long in bitrate tolerance computation, else we'll overflow for
higher than standard-pc chip clocks.
1997-10-18 23:11:45 +00:00
thorpej 1ccf0984c2 "com" driver files copied by repository copy magick to sys/dev/ic, and
adjusted for their new home.
1997-10-16 00:01:00 +00:00
mikel 20cf0e1cc1 fix missing com_kgdb_attached() argdecl, from Michael C. Richardson in PR 4196 1997-10-03 06:11:35 +00:00
christos a2512e8ec5 Add TIOCM{BI{C,S},{S,G}ET} from revision 1.98. As Charles says these
interfaces are slightly broken and should be obsoleted, but some programs
are using them and also they are useful for debugging.
1997-09-30 21:51:43 +00:00
enami 82625dc61e Cosmetic Changes; make coding style closer to other part of this file.
(This version is identical with version 1.109 except whitespace changes.)
1997-09-19 01:17:37 +00:00
is 718fb97e11 Support for the upcoming NetBSD/Amiga Hypercom driver family:
* support chip clocks != COM_FREQ, by introducing sc_frequency (for the
  mainline code) and adding a frequency parameter right after the rate
  parameter to comcnattach() and com_kgdb_attach().
- Make com_isa and com_multi initialize sc_frequency to COM_FREQ.
- Make i386/machdep.c and alpha/dec_xxx.c call com*attach() with the freq.
  parameter.
* supio_attach_args get two more fields: a sc_ipl and a sc_arg, both ints.
- com_supio uses the first for interupt establishment (all childs will, as
  soon as they exist) and the 2nd for sc_frequency.
- drsupio passes sc_ipl alway as 5, and for the "com"s, sc_arg as 16*115200
- hyper will pass sc_ipl as 6, and sc_arg as 16 * 460800
1997-09-16 20:34:23 +00:00
is 25c05417ed Make this work with __GENERIC_SOFT_INTERRUPTS. 1997-08-27 18:00:13 +00:00
drochner 8188be767e Check for KGDB port == console port in a consistent way. 1997-08-24 09:40:16 +00:00
drochner d36e668737 clean up the serial console / KGDB attachment:
-put all early console / KGDB initialization into 1 exported function
  (com_*_attach()) each, dont use global variables anymore
-use the passed tcflag_t for port settings instead of hardwiring 8N1
-at autoconfiguration attach time, decide if the attaching device is
  already console / KGDB by comparing bus tag and base addr (cgd's wish)
-export a function "com_is_console()" for use by driver frontends for
  this comparision
-delay setting of cn_tab->cn_dev until autoconfiguration attach
  to get the minor number right
-delete unused comcnprobe() and comcninit()
1997-08-23 14:01:32 +00:00
drochner 570688abef Bring back the "comconsattached" flag. It is necessary for starred
com devices (on non "__BROKEN_INDIRECT_CONFIG" ISA).
1997-08-16 08:33:08 +00:00
drochner b426bd9be3 -Export variables needed for system console initialization.
-Enable line break interrupt for DDB on a serial console.
-Share initialization code between DDB and KGDB.
1997-08-14 16:15:15 +00:00
drochner d5998780c0 KGDB improvements:
-Separate KGDB port initialization and softc related stuff to allow
 KGDB to be attached in early system startup, before autoconfiguration.
-Export the variables needed by md code to hand-craft bus tag/handle.
-Fix initialization to enable interrupt by line break.
-Call DDB/KGDB at line break (move DDB call from the softirq handler
 to the hard handler because it should work without a tty attached too).
1997-08-12 17:25:43 +00:00
thorpej 2252d1317b Add support for remote serial KGDB. 1997-07-05 20:52:40 +00:00
mycroft 09cad93ce8 Implement a better backpressure mechanism so that data is collected
in the driver's buffer if the tty buffer is full.  If the driver's buffer
becomes full, turn off receive interrupts until it drains a bit.
1997-06-15 11:18:59 +00:00
mycroft 6bfd7b7d45 Remove unneeded call to comstop() in commsrint(). This fixes a problem
where the driver would sometimes retransmit bytes.
1997-05-26 14:54:46 +00:00
mycroft 9448a01404 New version of com driver. Uses a different queueing mechanism and a split
hardware/software interrupt mechanism for improved performance.  Many odd
protocols bugs also fixed.
1997-04-04 20:56:34 +00:00
mycroft 232ade1b2b comdefaultrate -> comconsrate
comconsbah -> comconsioh
Only use comconsrate on the console.
1997-04-04 20:49:49 +00:00
cgd f89ffa1fe4 don't clobber IER in cominit(). (suggested by mycroft.) 1997-01-30 19:42:33 +00:00
mycroft be33336052 If attaching the console, reinitialize it immediately. 1996-12-14 10:46:38 +00:00
mycroft 58e4442168 Turn off the baud rate changing optimization. 1996-12-14 08:56:23 +00:00
cgd 197d80c63a update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
1996-12-05 01:25:23 +00:00
cgd b005a8ee10 move cominit() prototype to comvar.h, so that ports which use 'com'
for serial console, but don't use the (i386-specific)
comcninit()/comcnprobe() functions, can do the right thing.
1996-11-13 19:41:35 +00:00
cgd 233251d896 add missing argument to bus_space_map in ESP code 1996-10-22 00:45:25 +00:00
thorpej 769a499800 New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
	  devices.  It's all "bus space" now, and space tags
	  differentiate the space with finer grain than the
	  bus chipset tag.
	- Add memory barrier methods.
	- Implement space alloc/free methods.
	- Implement region read/write methods (like memcpy to/from
	  bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
1996-10-21 22:34:38 +00:00
christos 86373f8cf9 backout kprintf changes 1996-10-13 01:37:04 +00:00
christos 58953408cb printf -> kprintf, sprintf -> ksprintf 1996-10-10 22:04:48 +00:00
mycroft 767522373b If we get a RXRDY interrupt, but RXRDY is not set in the LSR, briefly set IER
to 0.  This fixes a condition where some UARTs send an infinite stream of
RXRDY interrupts.
1996-10-06 01:52:26 +00:00
mycroft d1f08e3e87 Serial console changes:
* Enable FIFO with trigger level 1.
* Set DTR and RTS so terminals are happy.
1996-10-06 01:46:04 +00:00
mycroft 82f0b829e8 compoll() -> comsoft() 1996-09-05 16:42:32 +00:00
mycroft b3eac79b64 tty stop functions really should return void, not int, and certainly not both. 1996-09-02 06:43:16 +00:00
cgd bc2f07f331 move DDB-only label inside an #ifdef, so that -Wall works 1996-07-10 18:14:04 +00:00
cgd 08d585e924 add tty_attach() where appropriate. 1996-05-30 18:24:09 +00:00
mycroft cec36bf8d5 Use intr.h. 1996-05-12 23:51:23 +00:00
christos d53d6cd545 Move comintr() prototype to comvar.h; needed by the multi-port cards. 1996-05-05 19:50:44 +00:00
christos e8a8a6298c - prototype fixes 1996-04-29 20:02:32 +00:00
cgd b6549d493d define and export the global variable "comconscflag", the default tty
'cflag' for the console.  Normally set to TTYDEF_CFLAG, may be
overridden by machine-dependent console attachment code, as necessary.
(Alpha uses it to set cs8 -parenb.)  Files including comvar.h now
need to include <sys/termios.h>, because comconscflag is of type
tcflag_t.
1996-04-15 18:54:31 +00:00
cgd 51e85d07b9 update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
1996-04-11 22:27:59 +00:00
cgd 179f65d15e Add #ifdef's at the right places, on NCOM_ISA and NCOM_COMMULTI, to
only include the relevant code in the probe & attach functions.  Still
one probe and one attach function, with #ifdefs, but this is a step
in the right direction and saves a few hundred bytes (ooh, ahh!).
1996-03-17 13:38:14 +00:00
thorpej 6d9ea4cf59 New device attachment scheme:
- split softc size and match/attach out from cfdriver into
	  a new struct cfattach.

	- new "attach" directive for files.*.  May specify the name of
	  the cfattach structure, so that devices may be easily attached
	  to parents with different autoconfiguration semantics.
1996-03-17 00:43:52 +00:00
cgd 85286bff2f convert these to use new <machine/bus.h> interfaces. This involved
substantial reworking of the multi-port drivers, as they need to frob
bits in the io-port spaces of their children.  As a result, the
commulti->com attachment interface is substantially more complex.
(This may be fixable in the future by making some of the code common,
but as long as io-port allocation checking is planned, it's necessary.)
1996-03-10 09:01:20 +00:00
cgd a7c6dfe1cd include comvar.h for comprobe1() prototype 1996-03-09 01:02:08 +00:00