Commit Graph

244 Commits

Author SHA1 Message Date
kardel de4337ab21 merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
  time.tv_sec -> time_second
- struct timeval mono_time is gone
  mono_time.tv_sec -> time_uptime
- access to time via
	{get,}{micro,nano,bin}time()
	get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
  Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
  NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
2006-06-07 22:33:33 +00:00
elad 2867b68bc3 integrate kauth. 2006-05-14 21:42:26 +00:00
thorpej 39cd836ee1 Use device_unit(). 2006-03-28 17:38:24 +00:00
thorpej 3ddf26777f Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.
2006-02-20 16:50:36 +00:00
dsl a6d7f81261 Save console baud rate as both the input and output rates.
This is what I thought I'd done in rev 1.237
2006-01-08 22:19:59 +00:00
chs 33d70de438 remove the COM_MPLOCK option. always include the spinlock in the softc
and always call the simple_* locking functions.  the locking functions
are compiled out if they are not needed anyway, so a separate option
for this doesn't gain anything.

this also fixes the serial console on my alpha ES40 (which doesn't make much
sense since the com driver should still be under the big lock on alpha,
but whatever).
2005-12-27 00:46:38 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
dsl 80c644a6b9 Explicitly default the input baud rate (c_ispeed) to the output baud rate (c_ospeed)
instead of setting it to zero.  Otherwise nothing ever sets it unless some code
explicitly changes the baud rate.  For a serial console (in particular) we want
to use the baud rate set by the bios (or whatever) and used by theboot code.
This is the way it was before a 'new version of com driver' was added in 1997 (rev 1.99)
2005-11-06 21:34:37 +00:00
kleink aece7a90fd Change the driver open function's conditional for overriding exclusive tty
use from checking the proc's uid to suser(9), and account for the use of
privileges.  Noted by David Holland in PR kern/31126.
2005-09-06 21:40:37 +00:00
kleink 95ca674ab9 Make COM_DEBUG compile again in the wake of -Wwrite-strings;
from Nicolas Joly in PR kern/31141.
2005-09-04 09:48:53 +00:00
ws 9d78e0cf36 PR-30566: Poll must not return <sys/errno.h> values.
Start with those places I can easily test.
2005-06-21 14:01:11 +00:00
tls 4a43d21777 Revert the part of revision 1.228 that made HW_NO_TXPRELOAD the default:
it appears to break output on the Soekris net4501, which is a rather
popular platform.

This should fix PR kern/29612 -- if not, I will probably revert it again.
2005-06-12 21:10:47 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
mycroft 9a46d5ed7d Do an extra read of the IIR during initialization, just to ack any pending
interrupt.
2004-08-09 16:57:14 +00:00
mycroft 94e2ec5a8b Back off the trigger level a little. Testing shows that it's not terribly
reliable at 14.
2004-07-04 09:46:44 +00:00
mycroft 35186738e8 Minor simplification. 2004-07-04 09:28:05 +00:00
mycroft df4e7d03fc Incorporate 4 changes that have been suggested:
* At high speed, set the FIFO trigger to the maximum value to reduce interrupt
  load.  PR 15448.
* Handler the case of IIR=RXRDY and LSR=!LSR_RCV_MASK differently, to avoid a
  hang with some chips.  PR 21184, and possibly PR 10974 and PR 8248.
* Remove the extra wait at the end of com_common_putc(), after writing a
  character out, so that we get another TXRDY interrupt.  This prevents stalls
  when normal output and kernel output are mixed.  PR 4263.
* Do not "preload" the TX FIFO; wait for a TXRDY interrupt to come in after
  enabling it.
2004-07-04 08:09:03 +00:00
thorpej cdac01064e Rename the COM16650 option to COM_16650, for consistency with other
com variant options.
2004-05-01 19:03:59 +00:00
thorpej dfc7fe9bbe Wait just a little longer for console output to finish when we're
attaching the console uart.
2004-05-01 06:12:18 +00:00
enami 786727e51f Fix race condition introduced in rev 1.189; after the change, if there is
THRE interrupt occurs between the LSR read and IIR read, we won't see the
LSR_TXRDY bit when testing it in the variable `lsr' and we don't interrupted
again (as the corresponding bit in the IIR is cleared by reading, except
for some broken device).

Tested by Matthias Scheler and me, reviewed by Allen Briggs.
Closes PR#25010.
2004-04-05 22:33:08 +00:00
simonb 2763a4b916 Fix NTP PPSAPI support (enabled with "options PPS_SYNC"):
From PR kern/13702 from Charles Carvalho.  Tested on alpha and
i386 with a Laipac TF10 PPS-capable GPS.  The com.c change was
copied wholesale from Charles' z8530tty.c patch.
2004-01-23 05:01:19 +00:00
simonb bb845a9d67 Use just "type" and not "sc->sc_type" in cominit().
Pointed out by Shoichi Miyake in private mail.
2003-11-12 06:27:59 +00:00
simonb 47299229f4 Make comsoft_callout static; it's not referenced outside this file. 2003-11-08 02:54:47 +00:00
simonb 7b4feff831 Be consistent with other COM_TYPE_PXA2x0 checks. 2003-11-06 23:02:27 +00:00
simonb c26e70ad3c White space nit. 2003-11-06 22:30:09 +00:00
simonb 553d2b901f Add missing semicolon. 2003-09-03 13:05:50 +00:00
christos b7510d87e5 fix debugging printfs 2003-09-01 16:44:03 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
simonb 7aa3dc6d45 Restore parentheses around return value that were removed with the
previous commit.
2003-06-29 14:09:21 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
martin d505b18964 Make sure to include opt_foo.h if a defflag option FOO is used. 2003-06-23 11:00:59 +00:00
bsh 4b87783212 in cominit(), turn on UUE bit in IER register if it is PXA2x0's
built-in UART.
2003-06-18 04:35:23 +00:00
simonb 83619b47f3 Wrap some long lines. 2003-06-15 01:34:34 +00:00
thorpej 0eff671820 Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
2003-06-14 17:01:06 +00:00
thorpej 5ae120da7b Introduce a new "type" field in the softc which is used to indicate
the general UART type.  Currently, we have "normal", "hayesp" and
"pxa2x0" types.  Replace the corresponding hw flags with the new type
values.
2003-06-14 16:25:52 +00:00
scw 5eb709747b Add support, via a kernel config file option, for the 16550-compatible
com ports found on Intel PXA2x0 processors.

Re-arrange the code which detects the FIFO configuration to defer
printing until _after_ com_fifo is cleared. Some supposedly compatible
chips clear the Tx/Rx FIFOs when this happens, resulting in previous
output being lost.
2003-06-05 13:40:38 +00:00
fvdl 385c785fd2 Inialize sc_tty->t_dev early for serial console, so that cn_check_magic
will match in the case of a break before the console was opened for the
first time. Makes BREAKing into DDB work (again) as soon as interrupts
are enabled.
2003-05-18 15:10:08 +00:00
briggs 742c5dbd3a Allow the console to be used for kgdb if both DDB and KGDB are defined. 2003-04-28 02:46:09 +00:00
gson c8da8f2398 Ignore input when the port is not open. This change is functionally
identical to the patch in kern/6502 (which is hereby fixed), but
modelled after the corresponding fix to the 8530 driver in
z8530tty.c revision 1.60 to maintain consistency with that driver.
2003-04-21 03:43:18 +00:00
simonb 1ff45ded4f Fix some white-space niggles. 2003-03-14 02:21:01 +00:00
matt 7109fe9012 Add cn_halt and cn_flush entries to consdevs. (needed for dma-only console
devices).
2003-03-06 00:38:26 +00:00
thorpej 749715f6ee Use aprint_*(). 2003-01-31 00:26:25 +00:00
thorpej 1cba452d86 Fix signed/unsigned comparison warnings. 2002-11-07 08:02:09 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
simonb 21ffe19c1b Don't name parameters in a function declaration. 2002-07-29 05:57:16 +00:00
simonb b8f11b739f ANSIfy, KNF. 2002-07-29 05:54:09 +00:00
christos db29511727 PR/16058: Tero Kivinen: Don't free rbuf or detach tty if rbuf allocation
failed during attach phase.
2002-04-13 17:05:16 +00:00
thorpej ff7306cf44 * Add a new hwflag, COM_HW_NO_TXPRELOAD, which tells comstart() to
not pre-load the chip's Tx buffer, but instead waits for the Tx Ready
  interrupt to transmit the first chunk of data.
* On the IOP310, set COM_HW_NO_TXPRELOAD, rather than COM_HW_TXFIFO_DISABLE.

This solves the "UART hangs" problem on the Npwr in a nicer way (i.e. we
get to use the FIFO, whee).  The COM_HW_NO_TXPRELOAD happens to match the
Linux 16550 driver's Tx algorithm, and the "UART hang" was never observed
on the Npwr running Linux.

Eventually, we might want to eliminate the COM_HW_NO_TXPRELOAD, and simply
always use its algorithm.  But it should be tested on more 16x50 variants
before we do that.

Kudos to Valeriy Ushakov <uwe@netbsd.org> for pointing out this solution
(which also happens to fix the stray UART interrupt issue on the Krups
Javastation), and to Allen Briggs <briggs@netbsd.org> for experimenting
with various methods of fixing this.
2002-04-12 19:32:30 +00:00