summaryrefslogtreecommitdiff
path: root/sys/dev/uart/uart_core.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge amd64/machdep.c:1.680, amd64/mp_watchdog.c:1.6,Robert Watson2008-03-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | uart_dev_at91usart.c:1.13, scsi_low.h:1.9, subr_ntoskrnl.c:1.94, OsdDebug.c:1.14, dcons_os.c:1.20, ofw_consle.c:1.37, dev/sio.c:1.473, syscons.c:1.454, uart_core.c:1.23, union_subr.c:1.96, i386/machdep.c:1.664, i386/mp_watchdog.c:1.6, ia64/machdep.c:1.228, kern_clock.c:1.206, kern_shutdown.c:1.186, subr_kdb.c:1.25, subr_witness.c:1.239, vfs_subr.c:1.711, ng_base.c:1.140, cbus/sio.c:1.247, pc98/machdep.c:1.399, aim/machdep.c:1.107, pswitch.c:1.7, mac_test.c:19.3, psycho.c:1.73, sparc64/machdep.c:1.140, sparc64/trap.c:1.89, hvcons.c:1.7, sun4v/machdep.c:1.17, sun4v/trap.c:1.17, kdb.h:1.6 from HEAD to RELENG_7: Add a new 'why' argument to kdb_enter(), and a set of constants to use 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. For ABI/KPI reasons, the MFC creates a new function, kdb_enter_why(), with the new argument, updating existing consumers to use that, preserving kdb_enter() with the current argument, and wrapping it around kdb_enter_why(). Notes: svn path=/stable/7/; revision=177734
* Don't expose the uart_ops structure directly, but instead haveMarcel Moolenaar2007-04-021-5/+32
| | | | | | | | | | | | | | | it obtained through the uart_class structure. This allows us to declare the uart_class structure as weak and as such allows us to reference it even when it's not compiled-in. It also allows is to get the uart_ops structure by name, which makes it possible to implement the dt tag handling in uart_getenv(). The side-effect of all this is that we're using the uart_class structure more consistently which means that we now also have access to the size of the bus space block needed by the hardware when we map the bus space, eliminating any hardcoding. Notes: svn path=/head/; revision=168281
* When we match UARTs found during bus-enumeration with UARTs used forMarcel Moolenaar2007-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | system devices (i.e. console, debug port or keyboard), don't stop after the first match. Find them all and keep track of the last. The reason for this change is that the low-level console is always added to the list of system devices first, with other devices added later. Since new devices are added to the list at the head, we have the console always at the end. When a debug port is using the same UART as the console, we would previously mark the "newbus" UART as a debug port instead of as a console. This would later result in a panic because no "newbus" device was associated with the console. By matching all possible system devices we would mark the "newbus" UART as a console and not as a debug port. While it is arguably better to be able to mark a "newbus" UART as both console and debug port, this fix is lightweight and allows a single UART to be used as the console as well as a debug port with only the aesthetic bug of not telling the user about it also being a debug port. Now that we match all possible system devices, update the rclk of the system devices with the rclk that was obtained through the bus attachment. It is generally true that clock information is more reliable when obtained from the parent bus than by means of some hardcoded or assumed value used early in the boot. This by virtue of having more context information. MFC after: 1 month Notes: svn path=/head/; revision=167999
* o break newbus api: add a new argument of type driver_filter_t toPaolo Pisati2007-02-231-6/+8
| | | | | | | | | | | | | | | | 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
* Implement the ipend() method of the serdev I/F.Marcel Moolenaar2006-04-281-0/+9
| | | | Notes: svn path=/head/; revision=158119
* Add support for scc(4).Marcel Moolenaar2006-03-301-30/+95
| | | | Notes: svn path=/head/; revision=157300
* Replace our local UART_SIGMASK_* with the global SER_MASK_*.Marcel Moolenaar2006-02-241-1/+1
| | | | Notes: svn path=/head/; revision=155973
* MFp4:Marcel Moolenaar2006-02-241-11/+11
| | | | | | | | Stop using our local UART_IPEND_* and instead use the global SER_INT_* as defined in <sys/serial.h>. Notes: svn path=/head/; revision=155971
* - 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
* In uart_bus_probe() return BUS_PROBE_DEFAULT when the probe isMarcel Moolenaar2005-10-281-1/+1
| | | | | | | successful. Notes: svn path=/head/; revision=151792
* - Allocate the interrupt resource as RF_SHAREABLE allowing uart(4) to workMarius Strobl2005-03-021-2/+8
| | | | | | | | | | | | | with shared IRQs in case the bus code, MD interrupt code, etc. permits. Together with sys/sparc64/sparc64/intr_machdep.c rev. 1.21 this fixes an endless loop in uart_intr() when using the second NS16550 on the ISA bus of sparc64 machines. - Destroy the hardware mutex on detach and in case attaching fails. Approved by: marcel Notes: svn path=/head/; revision=143025
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* Add UART_IOCTL_BAUD to allow us to query the hardware about theMarcel Moolenaar2004-11-141-0/+5
| | | | | | | | | | | | current baudrate setting. Use this ioctl() when we don't know the baudrate of the sysdev (as represented by a 0 value). When the ioctl() fails, e.g. when the backend hasn't implemented it or the hardware doesn't provide the means to determine its current baudrate setting, we invalidate the baudrate setting by setting it to -1. None of the backends currently implement the new ioctl(). Notes: svn path=/head/; revision=137706
* Update for the KDB framework:Marcel Moolenaar2004-07-101-8/+6
| | | | | | | | | o Call kdb_enter() instead of breakpoint(). o Call kdb_alt_break() instead of db_alt_break(). o Make debugging code conditional upon KDB instead of DDB. Notes: svn path=/head/; revision=131921
* When the interrupt cannot be INTR_FAST, it still is INTR_MPSAFE.Marcel Moolenaar2004-05-041-2/+2
| | | | | | | Mark it as such. Notes: svn path=/head/; revision=128909
* Convert callers to the new bus_alloc_resource_any(9) API.Nate Lawson2004-03-171-2/+2
| | | | | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde Notes: svn path=/head/; revision=127135
* Revert the introduction of iobase in struct uart_bas. Both the SAB82532Marcel Moolenaar2003-09-261-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and the Z8530 drivers used the I/O address as a quick and dirty way to determine which channel they operated on, but formalizing this by introducing iobase is not a solution. How for example would a driver know which channel it controls for a multi-channel UART that only has a single I/O range? Instead, add an explicit field, called chan, to struct uart_bas that holds the channel within a device, or 0 otherwise. The chan field is initialized both by the system device probing (i.e. a system console) or it is passed down to uart_bus_probe() by any of the bus front-ends. As such, it impacts all platforms and bus drivers and makes it a rather large commit. Remove the use of iobase in uart_cpu_eqres() for pc98. It is expected that platforms have the capability to compare tag and handle pairs for equality; as to determine whether two pairs access the same device or not. The use of iobase for pc98 makes it impossible to formalize this and turn it into a real newbus function later. This commit reverts uart_cpu_eqres() for pc98 to an unimplemented function. It has to be reimplemented using only the tag and handle fields in struct uart_bas. Rewrite the SAB82532 and Z8530 drivers to use the chan field in struct uart_bas. Remove the IS_CHANNEL_A and IS_CHANNEL_B macros. We don't need to abstract anything anymore. Discussed with: nyan Tested on: i386, ia64, sparc64 Notes: svn path=/head/; revision=120452
* Initialize iobase, bsh and bst.Yoshihiro Takahashi2003-09-231-0/+4
| | | | Notes: svn path=/head/; revision=120380
* - Keep the base address in struct uart_bas for sab82532 and z8530 modules.Yoshihiro Takahashi2003-09-231-0/+1
| | | | | | | - Remove buggy uart_cpu_busaddr() function. Notes: svn path=/head/; revision=120378
* In uart_intr() loop until all interrupts have been handled. PreviouslyMarcel Moolenaar2003-09-171-11/+15
| | | | | | | | | | | | | | | | | an UART interface could get stuck when a new interrupt condition arose while servicing a previous interrupt. Since an interrupt was already pending, no new interrupt would be triggered. Avoid infinite recursion by flushing the Rx FIFO and marking an overrun condition when we could not move the data from the Rx FIFO to the receive buffer in toto. Failure to flush the Rx FIFO would leave the Rx ready condition pending. Note that the SAB 82532 already did this due to the nature of the chip. Notes: svn path=/head/; revision=120146
* Add locking to the hardware drivers. I intended to figure out moreMarcel Moolenaar2003-09-171-0/+2
| | | | | | | | | | | | | precisely where locking would be needed before adding it, but it seems uart(4) draws slightly too much attention to have it without locking for too long. The lock added is a spinlock that protects access to the underlying hardware. As a first and obvious stab at this, each method of the hardware interface grabs the lock. Roughly speaking this serializes the methods. Exceptions are the probe, attach and detach methods. Notes: svn path=/head/; revision=120143
* Add support for using uart(4) for pulse capturing for the Pulse PerMarcel Moolenaar2003-09-111-0/+12
| | | | | | | | | | | | | | | Second (PPS) timing interface. The support is non-optional and by default uses the DCD line signal as the pulse input. A compile-time option (UART_PPS_ON_CTS) can be used to have uart(4) use the CTS line signal. Include <sys/timepps.h> in uart_bus.h to avoid having to add the inclusion of that header in all source files. Reviewed by: phk Notes: svn path=/head/; revision=119996
* The uart(4) driver is an universal driver for various UART hardware.Marcel Moolenaar2003-09-061-0/+452
It improves on sio(4) in the following areas: o Fully newbusified to allow for memory mapped I/O. This is a must for ia64 and sparc64, o Machine dependent code to take full advantage of machine and firm- ware specific ways to define serial consoles and/or debug ports. o Hardware abstraction layer to allow the driver to be used with various UARTs, such as the well-known ns8250 family of UARTs, the Siemens sab82532 or the Zilog Z8530. This is especially important for pc98 and sparc64 where it's common to have different UARTs, o The notion of system devices to unkludge low-level consoles and remote gdb ports and provides the mechanics necessary to support the keyboard on sparc64 (which is UART based). o The notion of a kernel interface so that a UART can be tied to something other than the well-known TTY interface. This is needed on sparc64 to present the user with a device and ioctl handling suitable for a keyboard, but also allows us to cleanly hide an UART when used as a debug port. Following is a list of features and bugs/flaws specific to the ns8250 family of UARTs as compared to their support in sio(4): o The uart(4) driver determines the FIFO size and automaticly takes advantages of larger FIFOs and/or additional features. Note that since I don't have sufficient access to 16[679]5x UARTs, hardware flow control has not been enabled. This is almost trivial to do, provided one can test. The downside of this is that broken UARTs are more likely to not work correctly with uart(4). The need for tunables or knobs may be large enough to warrant their creation. o The uart(4) driver does not share the same bumpy history as sio(4) and will therefore not provide the necessary hooks, tweaks, quirks or work-arounds to deal with once common hardware. To that extend, uart(4) supports a subset of the UARTs that sio(4) supports. The question before us is whether the subset is sufficient for current hardware. o There is no support for multiport UARTs in uart(4). The decision behind this is that uart(4) deals with one EIA RS232-C interface. Packaging of multiple interfaces in a single chip or on a single expansion board is beyond the scope of uart(4) and is now mostly left for puc(4) to deal with. Lack of hardware made it impossible to actually implement such a dependency other than is present for the dual channel SAB82532 and Z8350 SCCs. The current list of missing features is: o No configuration capabilities. A set of tunables and sysctls is being worked out. There are likely not going to be any or much compile-time knobs. Such configuration does not fit well with current hardware. o No support for the PPS API. This is partly dependent on the ability to configure uart(4) and partly dependent on having sufficient information to implement it properly. As usual, the manpage is present but lacks the attention the software has gotten. Notes: svn path=/head/; revision=119815