summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart
Commit message (Collapse)AuthorAgeFilesLines
* - Add a uart_rxready() and corresponding device-specific implementationsmarius2007-01-185-35/+35
| | | | | | | | | | | | | | | that can be used to check whether receive data is ready, i.e. whether the subsequent call of uart_poll() should return a char, and unlike uart_poll() doesn't actually receive data. - Remove the device-specific implementations of uart_poll() and implement uart_poll() in terms of uart_getc() and the newly added uart_rxready() in order to minimize code duplication. - In sunkbd(4) take advantage of uart_rxready() and use it to implement the polled mode part of sunkbd_check() so we don't need to buffer a potentially read char in the softc. - Fix some mis-indentation in sunkbd_read_char(). Discussed with: marcel
* - In sunkbd_probe_keyboard() don't bother to determine the keyboard layoutmarius2006-11-022-85/+382
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | as we have no use for that info. Instead let this function return the keyboard ID and verify at its invocation in sunkbd_configure() that we're talking to a Sun type 4/5/6 keyboard, i.e. a keyboard supported by this driver. - Add an option SUNKBD_EMULATE_ATKBD whose code is based on the respective code in ukbd(4) and like UKBD_EMULATE_ATSCANCODE causes this driver to emit AT keyboard/KB_101 compatible scan codes in K_RAW mode as assumed by kbdmux(4). Unlike UKBD_EMULATE_ATSCANCODE, SUNKBD_EMULATE_ATKBD also triggers the use of AT keyboard maps and thus allows to use the map files in share/syscons/keymaps with this driver at the cost of an additional translation (in ukbd(4) this just is the way of operation). - Implement an option SUNKBD_DFLT_KEYMAP, which like the equivalent options of the other keyboard drivers allows to specify the default in-kernel keyboard map. For obvious reasons this made to only work when also using SUNKBD_EMULATE_ATKBD. - Implement sunkbd_check(), sunkbd_check_char() and sunkbd_clear_state(), which are also required for interoperability with kbdmux(4). - Implement K_CODE mode and FreeBSD keypad compose. - As a minor hack define KBD_DFLT_KEYMAP also in the !SUNKBD_EMULATE_ATKBD case so we can obtain fkey_tab from <dev/kbd/kbdtables.h> rather than having to duplicate it and #ifdef some more code. - Don't use the TX-buffer for writing the two command bytes for setting the keyboard LEDs as this consequently requires a hardware FIFO that is at least two bytes in depth, which the NMOS-variant of the Zilog SCCs doesn't have. Thus use an inlined version of uart_putc() to consecutively write the command bytes (a cleaner approach would be to do this via the soft interrupt handler but that variant wouldn't work while in ddb(4)). [1] - Fix some minor style(9) bugs. PR: 90316 [1] Reviewed by: marcel [1]
* Fix our ioctl(2) implementation when the argument is "int". Newru2006-09-271-1/+24
| | | | | | | | | | | | | ioctls passing integer arguments should use the _IOWINT() macro. This fixes a lot of ioctl's not working on sparc64, most notable being keyboard/syscons ioctls. Full ABI compatibility is provided, with the bonus of fixing the handling of old ioctls on sparc64. Reviewed by: bde (with contributions) Tested by: emax, marius MFC after: 1 week
* Do not try to call keyboard callback unless keyboard is active and busy.emax2006-09-181-4/+6
| | | | | | | This should fix 'kbdcontrol -K < /dev/console' panic on sparc64 with sunkbd(4). PR: sparc64/96798 MFC after: 1 week
* Properly propagate overrun conditions to the TTY layer.marcel2006-07-271-0/+2
| | | | MFC after: 3 days
* On PowerPC the clock for the BRG comes from RTxC, not PCLK. Add amarcel2006-07-261-3/+10
| | | | | quick hack to deal with this. We may need to formalize this better and have this information come from the bus attachments.
* Implement UART_IOCTL_BAUD for the Z8530. This allows a serial consolemarcel2006-07-261-1/+7
| | | | | on PowerPC use the current setting of the hardware and not second guess what the OFW does on various machines.
* Implement uart_cpu_eqres() and uart_cpu_getdev(). This allowsmarcel2006-07-261-3/+56
| | | | FreeBSD to use a serial console, as per the OFW settings.
* Convert to new console apiphk2006-05-261-11/+2
|
* Eliminate gdb_checkc member from GDB_DBGPORT(), it is never used.phk2006-05-261-10/+2
| | | | | Use polling behaviour for gdb_getc() where convenient, this edges us closer to the console code.
* Remove definitions of uart_[gs]etdreg. They are not used anymore andmarcel2006-05-231-6/+0
| | | | were in fact wrong.
* The lcr variable in ns8250_probe is now unused. Remove it.benno2006-05-231-1/+1
| | | | Missed by: benno
* Allow uart(4)'s ns8250 driver to work with devices whose regshift is > 0.benno2006-05-231-24/+16
| | | | | | | | | | | | | - Rename REG_DL to REG_DLL and REG_DLH. - Always treat DLL and DLH as two separate 8-bit registers instead of one 16-bit register. Additionally, remove the probe for the high 4 bits of IER being 0 and don't assume we can always read/write 0 to/from those bits. These changes allow uart(4) to drive the UARTs on the Intel XScale PXA255. Reviewed by: marcel
* o A divisor of 0 is perfectly valid. Reserve -1 for an invalidmarcel2006-05-121-7/+15
| | | | | | | divisor. This allows us to set the line speed to the maximum of 1/4 of the device clock. o Disable the baudrate generator before programming the line settings, including baudrate, and enable it afterwards.
* First pass at removing Alpha kernel support.jhb2006-05-111-143/+0
|
* Rewrite of puc(4). Significant changes are:marcel2006-04-281-25/+13
| | | | | | | | | | | | | | | | | | | | o Properly use rman(9) to manage resources. This eliminates the need to puc-specific hacks to rman. It also allows devinfo(8) to be used to find out the specific assignment of resources to serial/parallel ports. o Compress the PCI device "database" by optimizing for the common case and to use a procedural interface to handle the exceptions. The procedural interface also generalizes the need to setup the hardware (program chipsets, program clock frequencies). o Eliminate the need for PUC_FASTINTR. Serdev devices are fast by default and non-serdev devices are handled by the bus. o Use the serdev I/F to collect interrupt status and to handle interrupts across ports in priority order. o Sync the PCI device configuration to include devices found in NetBSD and not yet merged to FreeBSD. o Add support for Quatech 2, 4 and 8 port UARTs. o Add support for a couple dozen Timedia serial cards as found in Linux.
* Implement the ipend() method of the serdev I/F.marcel2006-04-282-0/+10
|
* o Add 5 Timedia single port serial cards.marcel2006-04-271-8/+25
| | | | o While here, break long lines.
* Use 115200 and not 9600 as the initial baudrate. This speeds upmarcel2006-04-271-1/+1
| | | | detection of the FIFO size. Especially for large FIFOs.
* o Add 2 HP Diva single port UARTs.marcel2006-04-271-0/+2
|
* o Add 2 NEC cardsmarcel2006-04-261-29/+47
| | | | | | | o Add 2 Dell cards o Add Quatech card o Add support for non-standard rclk values. o Update descriptions to match PCI id database.
* MFp4: Calculate the divisor before setting the DLAB bit. Thismarcel2006-04-231-2/+2
| | | | | prevents that there's a control flow that leaves the DLAB bit set.
* In z8530_divisor() return 0 if the calculated divisor is less than 0.marcel2006-04-041-1/+1
| | | | This happens when the baudrate is too high for the given RCLK.
* Remove unused variable 'error'. Forgotten in previous commit.marcel2006-04-021-1/+0
|
* Don't claim a SAB82532. We have scc(4) for that.marcel2006-04-021-5/+0
|
* Eliminate the sc_hasfifo flag from the softc. It was only used bymarcel2006-04-022-4/+3
| | | | | | | the NS8250 class driver. The UART has FIFOs if sc_rxfifosz>1, so test for that instead. While here properly initialize sc_rxfifosz and sc_txfifosz in the case the UART doesn't have FIFOs.
* Don't hold the hardware mutex across getc(). It can wait indefinitelymarcel2006-04-014-20/+45
| | | | | for a character to be received. Instead let getc() do any necesary locking.
* Allow uart(4) to be built on PowerPC.marcel2006-03-311-0/+54
|
* Add support for scc(4).marcel2006-03-306-82/+191
|
* Add scc(4), a driver for serial communications controllers. Thesemarcel2006-03-301-0/+115
| | | | | | | | | controllers typically have multiple channels and support a number of serial communications protocols. The scc(4) driver is itself an umbrella driver that delegates the control over each channel and mode to a subordinate driver (like uart(4)). The scc(4) driver supports the Siemens SAB 82532 and the Zilog Z8530 and replaces puc(4) for these devices.
* Don't open if we're going away.marcel2006-03-301-0/+4
|
* Replace our local UART_SIGMASK_* with the global SER_MASK_*.marcel2006-02-245-10/+5
|
* When we probe a SAB82532, return BUS_PROBE_GENERIC. This allows puc(4)marcel2006-02-241-1/+3
| | | | | or scc(4) to grab the device by default. In fact, we probably shouldn't even claim the device at all...
* MFp4:marcel2006-02-247-52/+37
| | | | | Stop using our local UART_IPEND_* and instead use the global SER_INT_* as defined in <sys/serial.h>.
* - Use bus_setup_intr() and bus_teardown_intr() to register device driverjhb2006-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.
* - Add support for using LOM (Lights Out Management) and RSC (Remote Systemmarius2006-02-042-13/+33
| | | | | | | | | | | | | | | | | | | | | | | Control) devices as console. These are microcontrollers which are either on-board or part of an add-on card and provide terminal server, remote power switch and monitoring functionality. For console usage these are connected to the rest of the system via a SCC or an UART. This commit adds support for the following variants (corresponds to what 'input-device' and 'output-device' have to be set to): rsc found on-board in E250 and supposedly some Netra, connected via a SAB82532, com. parameters can be determined via OFW rsc-console RSC card found in E280R, Fire V4x0, Fire V8x0, connected via a NS16550, hardwired to 115200 8N1 lom-console LOMlite2 card found in Netra 20/T4, connected via a NS16550, hardwired to 9600 8N1 - Add my copyright to uart_cpu_sparc64.c as I've rewritten about one third of that file over time. Tested on: E250, E280R Thanks to: dwhite@ for providing access to an E280R OK'ed by: marcel MFC after: 1 week
* Make uart_getenv() not be ns8250 dependent. This will allow, in the future,imp2005-12-126-1/+5
| | | | | | compilation of kernels without ns8250 support but using the uart framework. These kernels will be for machines where size matters more, so including code that can never be executed is undesriable...
* In uart_bus_probe() return BUS_PROBE_DEFAULT when the probe ismarcel2005-10-281-1/+1
| | | | successful.
* o Style(9) nitsmarcel2005-10-281-10/+9
| | | | | | | | | o Fix typo in comment o s/-100/BUS_PROBE_GENERIC/ o s/err/error/ for consistency o Remove non-applicable comment o Allow uart_bus_probe() to return the predefined BUS_PROBE_* contants. In this case: explicitly test for error > 0.
* Allow uart_bus_probe() to return the predefined BUS_PROBE_*marcel2005-10-281-3/+1
| | | | | constants. In this case: just return what uart_bus_probe() returns.
* - Use swi_remove() to teardown swi handlers rather thanjhb2005-10-261-1/+1
| | | | | intr_event_remove_handler(). - Remove tty: prefix from a couple of swi handler names.
* Remove PCI IDs for multiport cards:marcel2005-10-261-10/+15
| | | | | | | | | | | o Oxford Semiconductor PCI Dual Port Serial o Netmos Nm9845 PCI Bridge with Dual UART Add PCI IDs for single-port cards: o Various SIIG Cyber Serial o Oxford Semiconductor OXCB950 UART Update description as per puc(4).
* Reorganize the interrupt handling code a bit to make a few things cleanerjhb2005-10-252-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and increase flexibility to allow various different approaches to be tried in the future. - Split struct ithd up into two pieces. struct intr_event holds the list of interrupt handlers associated with interrupt sources. struct intr_thread contains the data relative to an interrupt thread. Currently we still provide a 1:1 relationship of events to threads with the exception that events only have an associated thread if there is at least one threaded interrupt handler attached to the event. This means that on x86 we no longer have 4 bazillion interrupt threads with no handlers. It also means that interrupt events with only INTR_FAST handlers no longer have an associated thread either. - Renamed struct intrhand to struct intr_handler to follow the struct intr_foo naming convention. This did require renaming the powerpc MD struct intr_handler to struct ppc_intr_handler. - INTR_FAST no longer implies INTR_EXCL on all architectures except for powerpc. This means that multiple INTR_FAST handlers can attach to the same interrupt and that INTR_FAST and non-INTR_FAST handlers can attach to the same interrupt. Sharing INTR_FAST handlers may not always be desirable, but having sio(4) and uhci(4) fight over an IRQ isn't fun either. Drivers can always still use INTR_EXCL to ask for an interrupt exclusively. The way this sharing works is that when an interrupt comes in, all the INTR_FAST handlers are executed first, and if any threaded handlers exist, the interrupt thread is scheduled afterwards. This type of layout also makes it possible to investigate using interrupt filters ala OS X where the filter determines whether or not its companion threaded handler should run. - Aside from the INTR_FAST changes above, the impact on MD interrupt code is mostly just 's/ithread/intr_event/'. - A new MI ddb command 'show intrs' walks the list of interrupt events dumping their state. It also has a '/v' verbose switch which dumps info about all of the handlers attached to each event. - We currently don't destroy an interrupt thread when the last threaded handler is removed because it would suck for things like ppbus(8)'s braindead behavior. The code is present, though, it is just under #if 0 for now. - Move the code to actually execute the threaded handlers for an interrrupt event into a separate function so that ithread_loop() becomes more readable. Previously this code was all in the middle of ithread_loop() and indented halfway across the screen. - Made struct intr_thread private to kern_intr.c and replaced td_ithd with a thread private flag TDP_ITHREAD. - In statclock, check curthread against idlethread directly rather than curthread's proc against idlethread's proc. (Not really related to intr changes) Tested on: alpha, amd64, i386, sparc64 Tested on: arm, ia64 (older version of patch by cognet and marcel)
* Eliminate two unused arguments to ttycreate().phk2005-10-161-1/+1
|
* Remove OLDCARD shimsimp2005-09-211-13/+12
|
* - Change the code that determines whether to use a serial console andmarius2005-08-151-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which serial device to use in that case respectively to not rely on the OFW names of the input/output and stdin/stdout devices. Instead check whether input and output refers to the same device and is of type serial (uart(4) was already doing this) and for the fallback to a serial console in case a keyboard is the selected input device but unplugged do the same for stdin and stdout in case the input device is nonexistent (PS/2 and USB keyboards) or has a 'keyboard' property (RS232 keyboards). Additionally also check whether the OFW did a fallback to a serial console in the same way in case the output device is nonexistent. While at it save on some variables and for sys/boot/sparc64/loader/metadata.c move the code in question to a new function md_bootserial() so it can be kept in sync with uart_cpu_getdev_console() more easily. This fixes selecting a serial console and the appropriate device when using a device path for the 'input-device' and 'output-device' OFW environment variables instead of an alias for the serial device to use or when using a screen alias that additionally denotes a video mode (like e.g. 'screen:r1024x768x60') but no keyboard is plugged in (amongst others). It also makes the code select a serial console in case the OFW did the same due to a misconfiguration like both 'input-device' and 'output-device' set to 'keyboard' or to a nonexisting device (whether the OFW does a fallback to a serial console in case of a misconfiguration or one ends up with just no console at all highly depends on the OBP version however). - Reduce the size of buffers that only ever need to hold the string 'serial' accordingly. Double the size of buffers that may need to hold a device path as e.g. '/pci@8,700000/ebus@5/serial@1,400000:a' exceeds 32 chars. - Remove the package handle of the '/options' node from the argument list of uart_cpu_getdev_dbgport() as it's unused there and future use is also unlikely. MFC after: 1 week
* Recognize the SAB82532 in USIII machines.marius2005-08-072-2/+2
|
* Some chipset drivers redefine the busspace_isa_{io|mem} tags. Thismarcel2005-06-161-3/+20
| | | | | | | | | | | | | | | | | | | | not only means that it's possible (though unlikely) that we hand out differing tags for the same bus space, it also means that the tags we handed out are not used during bus enumeration. Both affect our ability to compare tags. Fix the first by initializing our tags only once. Fix the second by testing if one of the tags to compare is our tag and the other is a busspace_isa_{io|mem} tag and declare them equal if so. This fixes using uart(4) as the serial console on a ds10. That is, the low-level console worked, but we could not match the resources to one of the UARTs found during bus enumeration, which prevented uart(4) from becoming the console in single- or multi-user mode. Approved by: re (kensmith) MFC after: 2 days Thanks to: all involved in getting a ds10 to me; directly or indirectly. Special thanks to: Dave Knight, ISC (for not scratching my Porsche :-)
* Replace the band-aid for allowing to call sunkbd_configure() multiplemarius2005-06-041-14/+19
| | | | | | | | | | | times which was added in the last revision with what should be a proper solution as long as keyboards that were pluggged in after the kernel has fully booted aren't supported. I.e. when sunkbd_configure() is called for the high-level console probe make sure that the keyboard is both successfully configured (i.e. also probed) and attached. The band- aid left the possibility to attach the keyboard device to the high-level console without attaching the keyboard device itself when the keyboard is plugged in after uart(4) attached but before syscons(4) does.
* On AXi and AXmp boards the NS16550 (used to connect keyboard and mouse)marius2005-06-041-0/+20
| | | | | | | | | | | | share their IRQ lines with the i8042. Any IRQ activity (typically during attach) on the NS16550 used to connect the keyboard when actually the PS/2 keyboard is selected in OFW causes interaction with the OBP i8042 driver resulting in a hang (and vice versa). As RS232 keyboards and mice obviously aren't meant to be used in parallel with PS/2 ones on these boards don't attach to these NS16550 in case the RS232 keyboard isn't selected in order to prevent such hangs. Ok'ed by: marcel
OpenPOWER on IntegriCloud