summaryrefslogtreecommitdiff
path: root/sys/dev/sio/sio.c
Commit message (Collapse)AuthorAgeFilesLines
* Convert callers to the new bus_alloc_resource_any(9) API.Nate Lawson2004-03-171-7/+18
| | | | | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde Notes: svn path=/head/; revision=127135
* Device megapatch 4/6:Poul-Henning Kamp2004-02-211-1/+2
| | | | | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags. Notes: svn path=/head/; revision=126080
* Device megapatch 3/6:Poul-Henning Kamp2004-02-211-2/+0
| | | | | | | | | | | | | | | Add missing D_TTY flags to various drivers. Complete asserts that dev_t's passed to ttyread(), ttywrite(), ttypoll() and ttykqwrite() have (d_flags & D_TTY) and a struct tty pointer. Make ttyread(), ttywrite(), ttypoll() and ttykqwrite() the default cdevsw methods for D_TTY drivers and remove the explicit initializations in various drivers cdevsw structures. Notes: svn path=/head/; revision=126078
* Device megapatch 1/6:Poul-Henning Kamp2004-02-211-2/+0
| | | | | | | | | | Free approx 86 major numbers with a mostly automatically generated patch. A number of strategic drivers have been left behind by caution, and a few because they still (ab)use their major number. Notes: svn path=/head/; revision=126076
* Fixed a memory leak.Ruslan Ermilov2004-01-181-1/+3
| | | | | | | Submitted by: Stanford Metacompilation research group Notes: svn path=/head/; revision=124669
* Fixed breakage of a check for boolean true by misusing NULL in rev.1.407.Bruce Evans2003-12-241-2/+2
| | | | | | | This became fatal when the type of NULL was changed recently. Notes: svn path=/head/; revision=123796
* Tweaked the siointr1() so that it works better at 921600 bps, especiallyBruce Evans2003-11-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | with multiple ports on a shared interrupt demultiplexed by the puc_intr() handler. siointr1() first read as much input as possible and then checked all possibly-relevant status registers, partly for robustness and partly for historical reasons. This is very bad if it is called for every port sharing an interrupt like puc_intr() does. It can spend too long reading all the input for some ports when the interrupt is for a more urgent event on another, or just too long checking all the status registers when there are lots of ports. The inter-character time is too long for reading all the input even when the interrupt is for a transmitter interrupt on the same port, and at 921600 bps the inter-char time is 10.85 usec and was often exceeded with just 2 ports, leaving the transmitters idle for about 6% of the time. The tweak is to break out of the read loop after reading 1 char if output can be done. This avoids most of the idle transmitter time for 2 active ports at 921600 bps bidirectional on the test system. It also reduces overhead by about 20%. More complete fixes use the programmable tx low watermark on 16950's and reduce overhead by another 65%. Notes: svn path=/head/; revision=122844
* Don't waste so much space for the latency debugging buffer. Its sizeBruce Evans2003-11-161-10/+8
| | | | | | | | | | | | | | | will now need editing except for spot checks. Changed this buffer from a circular one to a linear one. This is more useful for some cases and the sysctl that prints it doesn't support circular buffers. Fixed (output) formatting bugs in this sysctl. An off by 1 error caused a garbage byte to be returned after annotation of large deltas, and a race with the writer sometimes caused premature string termination. Notes: svn path=/head/; revision=122819
* Removed some nearly dead code in comparam(). We don't need to recoverBruce Evans2003-09-281-9/+0
| | | | | | | | | from fiddling with CS_TTGO since fiddling with CS_TTGO was removed in rev.1.218 of the i386/isa version (which was merged with loss of history in rev.1.223 of this version). Notes: svn path=/head/; revision=120553
* Cleaned up and fixed setting of speeds in comparam():Bruce Evans2003-09-271-31/+20
| | | | | | | | | | | | | | | | | | | | - Removed conversion of a zero input speed to the output speed. This has been done better in ttioctl() since rev.1.108 of kern/tty.c almost 5 years ago. comparam() did the conversion incompletely for the case where the output speed is also zero. It had complications to avoid using zero speeds, but would still have used a zero input speed for setting watermarks if kern/tty.c had passed one. - Never permit the input speed to be different from the output speed. There was no validity check on the input speed for the case of a zero output speed. Then we didn't change the physical speeds, but we used the unvalidated input speed for setting watermarks and didn't return an error, so ttioctl() stored the unvalidated input speed in the tty struct where it could cause problems later. - Removed complications that were to avoid using a divisor of 0. The divisor is now always valid if the speed is accepted. Notes: svn path=/head/; revision=120505
* Fix compilation on alpha.Poul-Henning Kamp2003-09-261-1/+1
| | | | Notes: svn path=/head/; revision=120495
* Use the correct speed in the delay for the transmission of a characterBruce Evans2003-09-261-1/+4
| | | | | | | | | | in the loopback test in the probe. The delay was too short for consoles at speeds lower than about 3200 bps. This shouldn't have caused many problems, since such low speeds are rare and the probe is forced to succeed for consoles. Notes: svn path=/head/; revision=120468
* Adhere to the new console API:Poul-Henning Kamp2003-09-261-15/+21
| | | | | | | | | Initialize cn_name Use cn_unit for internal housekeeping. Forget about cn_dev. Notes: svn path=/head/; revision=120457
* Fixed most of the remaining style bugs in rev.1.194. Mainly betterBruce Evans2003-09-181-30/+32
| | | | | | | wording in comments. Notes: svn path=/head/; revision=120189
* Miscellaneous minor style fixes (mainly for unsorting of the flags accessBruce Evans2003-09-171-13/+10
| | | | | | | macros). Notes: svn path=/head/; revision=120175
* Fixed bitrot in the probe in revs.1.127, 1.165 and 1.169. TheBruce Evans2003-09-171-23/+23
| | | | | | | | | | | | | | | COM_NOFIFO() and COM_ESP cases are supposed to be a subsets of the plain 16550A case, but 16650-related changes made the former fall into the latter and then both fall into general code for printing the tx fifo size. This mainly caused hard to parse boot messages like: "sio0: type 16550A fifo disabled lookalike with 1 bytes FIFO". COM_NOFIFO() on an ESP port gave a larger mess whose extent is not clear. Fixed some nearby style bugs. Notes: svn path=/head/; revision=120173
* Cleaned up initialization of hardware flow control for 16650As. UseBruce Evans2003-09-171-25/+11
| | | | | | | | | | | | | | | | | defined values instead of hard-coded values. Don't repeat the register access part of the code 4 times times or triple-space statements. This fixes half of the style bugs in rev.1.172. Hardware flow control of 16650As is still officially unsupported. I was mistaken about it being broken. It is broken in 16650s but is fixed in 16650As except for the maximum trigger level (which is no longer used). Testing of the 16650's broken hardware flow control watermarks by programming them on 16950s showed that their effects are not too bad if the fifo size and trigger level are reasonably large (16 is much better than 8). Notes: svn path=/head/; revision=120159
* Quick fix for a pessimization in rev.1.194. An extra i/o instructionBruce Evans2003-09-151-2/+7
| | | | | | | | | | | | was added to the fast path to support the COM_IIR_RXRDYBUG() case even when that case is not configured. This increased the relative overhead of sio input by almost 25% in the worst case and by 2-3% in the usual case (usually only about 0.2% absolute per port at 115200 bps). The quick fix is to significantly pessimize only the COM_IIR_RXRDYBUG() case. Notes: svn path=/head/; revision=120091
* Remove a duplicate comment.Nate Lawson2003-08-281-6/+0
| | | | | | | Pointed out by: bde Notes: svn path=/head/; revision=119517
* Use the db_alt_break() state machine instead of rolling our own. ThisNate Lawson2003-08-261-32/+14
| | | | | | | brings sio(4) in-line with zs(4) et al. Notes: svn path=/head/; revision=119485
* Use __FBSDID().David E. O'Brien2003-08-241-1/+3
| | | | | | | Also some minor style cleanups. Notes: svn path=/head/; revision=119419
* - Use the new resource_disabled() helper function to see if devices areJohn Baldwin2003-07-021-5/+3
| | | | | | | | | | | | | | | disabled. - Change the apm driver to match the acpi driver's behavior by checking to see if the device is disabled in the identify routine instead of in the probe routine. This way if the device is disabled it is never created. Note that a few places (ips(4), Alpha SMP) used "disable" instead of "disabled" for their hint names, and these hints must be changed to "disabled". If this is a big problem, resource_disabled() can always be changed to honor both names. Notes: svn path=/head/; revision=117167
* Track the resource id of the memory port instead of just assuming thatScott Long2003-06-091-3/+6
| | | | | | | | it is 0x0. Cardbus-based sio/modem cards can now be ejected without panic'ing. Notes: svn path=/head/; revision=116120
* Remove extra unused variable.Poul-Henning Kamp2003-05-311-2/+0
| | | | | | | Found by: FlexeLint Notes: svn path=/head/; revision=115481
* Revert rev 1.396 -- it broke the Alpha kernel build.David E. O'Brien2003-05-051-1/+1
| | | | Notes: svn path=/head/; revision=114722
* Eliminate a compiler warning with gcc3.3 on AMD64, where speed isPeter Wemm2003-04-301-1/+5
| | | | | | | | a 32 bit int which can never be > ULONG_MAX / 8. Its an 'always true' warning. Notes: svn path=/head/; revision=114334
* Fix some easy, global, lint warnings. In most cases, this meansMark Murray2003-04-301-1/+1
| | | | | | | | making some local variables static. In a couple of cases, this means removing an unused variable. Notes: svn path=/head/; revision=114293
* Deprecate machine/limits.h in favor of new sys/limits.h.Alexander Kabaev2003-04-291-1/+1
| | | | | | | | | | Change all in-tree consumers to include <sys/limits.h> Discussed on: standards@ Partially submitted by: Craig Rodrigues <rodrigc@attbi.com> Notes: svn path=/head/; revision=114216
* Brucify.Maxim Sobolev2003-03-181-23/+19
| | | | | | | | Requested and reviewed by: bde MFC after: 2 weeks Notes: svn path=/head/; revision=112384
* Remove duplicate line introduced in the previous commit.Maxim Sobolev2003-03-151-1/+0
| | | | | | | | Submitted by: bde MFC after: 2 weeks Notes: svn path=/head/; revision=112275
* - Add minimal support for TI16754 4xUART chip into sio(4) driver and removeMaxim Sobolev2003-03-151-1/+33
| | | | | | | | | | | | | | | now unnecessary hack from the previous commit; - Add support for Interrupt Latch Register (ILR) into puc(4). So far only ILRs compatible with specifications from Digi International are supported. Support for other types of ILRs could be easily added later; - Correct clock frequency for IC Book Labs Dreadnought x16 Lite board; - Enable ILR detection/usage for IC Book Labs Dreadnought x16 boards. Sponsored by: IC Book Labs MFC after: 2 weeks Notes: svn path=/head/; revision=112270
* Add initial support for IC Book Labs Dreadnought x16 Pro 16-ports card. SinceMaxim Sobolev2003-03-121-1/+1
| | | | | | | | | | | | | this card is based on 16750 UART, modify sio(4) a bit to ignore 16750-specific 7th bit of MCR when probing card. This allows card to be detected and attached as 16550A-compatible device. More work needs to be done in order to enable nice 16750-specific features such as larger fifo buffer and higher speeds. Sponsored by: IC Book Labs MFC after: 2 weeks Notes: svn path=/head/; revision=112154
* Make nokqfilter() return the correct return value.Poul-Henning Kamp2003-03-031-1/+1
| | | | | | | Ditch the D_KQFILTER flag which was used to prevent calling NULL pointers. Notes: svn path=/head/; revision=111821
* Gigacommit to improve device-driver source compatibility betweenPoul-Henning Kamp2003-03-031-14/+10
| | | | | | | | | | | | | | | | branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl) Notes: svn path=/head/; revision=111815
* Typo, I must have hit xZZ in vi(1).Poul-Henning Kamp2003-02-271-1/+1
| | | | Notes: svn path=/head/; revision=111616
* Make flags bit 0x10000 mean that PPS timestamping should use thePoul-Henning Kamp2003-02-271-2/+11
| | | | | | | CTS instead of the DCD pin. Notes: svn path=/head/; revision=111613
* Change the console interface to pass a "struct consdev *" instead of aPoul-Henning Kamp2003-02-201-11/+18
| | | | | | | | | | | | dev_t to the method functions. The dev_t can still be found at struct consdev *->cn_dev. Add a void *cn_arg element to struct consdev which the drivers can use for retrieving their softc. Notes: svn path=/head/; revision=111194
* Change "dev_t gdbdev" to "void *gdb_arg", some possible paths for GDBPoul-Henning Kamp2003-02-161-4/+4
| | | | | | | will not have a dev_t. Notes: svn path=/head/; revision=111017
* Remove #include <sys/dkstat.h>Poul-Henning Kamp2003-02-161-1/+0
| | | | Notes: svn path=/head/; revision=111002
* Set si_drv1 to our softc for all the six dev_t's we create for a serial port.Poul-Henning Kamp2003-02-021-0/+2
| | | | Notes: svn path=/head/; revision=110249
* s/modunload/kldunloadWarner Losh2002-10-111-1/+1
| | | | Notes: svn path=/head/; revision=104933
* Be consistent about "static" functions: if the function is markedPoul-Henning Kamp2002-09-281-3/+3
| | | | | | | | | static in its prototype, mark it static at the definition too. Inspired by: FlexeLint warning #512 Notes: svn path=/head/; revision=104094
* Add yet a quick flag to sio: 0x100000 "Scratch pad register missing".Poul-Henning Kamp2002-09-271-6/+5
| | | | | | | | | | The advanced stage of computer assisted hardware design and verification is aptly illustrated by the fact that this is necessary because only the first ports in a single-chip, dual-port async PC-Card product lacks this register. Notes: svn path=/head/; revision=104067
* Move the com_scr register address definition over with the other seven.Poul-Henning Kamp2002-09-221-2/+0
| | | | | | | Approved by: bde Notes: svn path=/head/; revision=103795
* Only try to flush the FIFO of 500 characters, return EIO if that fails.Poul-Henning Kamp2002-08-281-1/+6
| | | | | | | | This at least prevents the total hang of the machine when I open a PCCARD sio device on -current, but it does not solve the problem. Notes: svn path=/head/; revision=102542
* set siocnunit to the correct value. This fixes the freeze on boot forNick Hibma2002-06-231-2/+4
| | | | | | | | | alphas. Submitted by: Bernd Walter <ticso@cicely5.cicely.de> Notes: svn path=/head/; revision=98691
* Make this compile on Alpha.Nick Hibma2002-06-221-2/+2
| | | | Notes: svn path=/head/; revision=98619
* Make the speed used by gdb over serial settable in the kernel configuration.Nick Hibma2002-06-181-21/+49
| | | | | | | | | This facilitates the use in circumstances where you are using a serial console as well. GDB doesn't support anything higher than 9600 baud (19k2 if you are lucky), but the console does. Notes: svn path=/head/; revision=98401
* Simplify the RFC2783 and PPS_SYNC timestamp collection API.Poul-Henning Kamp2002-04-261-7/+2
| | | | Notes: svn path=/head/; revision=95523
* Change callers of mtx_init() to pass in an appropriate lock type name. InJohn Baldwin2002-04-041-1/+2
| | | | | | | | | | most cases NULL is passed, but in some cases such as network driver locks (which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used. Tested on: i386, alpha, sparc64 Notes: svn path=/head/; revision=93818