freebsd-skq/sys/dev/uart/uart_bus_isa.c

168 lines
7.4 KiB
C
Raw Normal View History

The uart(4) driver is an universal driver for various UART hardware. 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.
2003-09-06 23:13:47 +00:00
/*
* Copyright (c) 2001 M. Warner Losh. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h>
#include <isa/isavar.h>
#include <dev/uart/uart.h>
#include <dev/uart/uart_bus.h>
static int uart_isa_probe(device_t dev);
static device_method_t uart_isa_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, uart_isa_probe),
DEVMETHOD(device_attach, uart_bus_attach),
DEVMETHOD(device_detach, uart_bus_detach),
{ 0, 0 }
};
static driver_t uart_isa_driver = {
uart_driver_name,
uart_isa_methods,
sizeof(struct uart_softc),
};
static struct isa_pnp_id isa_ns8250_ids[] = {
{0x0005d041, "Standard PC COM port"}, /* PNP0500 */
{0x0105d041, "16550A-compatible COM port"}, /* PNP0501 */
{0x0205d041, "Multiport serial device (non-intelligent 16550)"}, /* PNP0502 */
{0x1005d041, "Generic IRDA-compatible device"}, /* PNP0510 */
{0x1105d041, "Generic IRDA-compatible device"}, /* PNP0511 */
/* Devices that do not have a compatid */
{0x12206804, NULL}, /* ACH2012 - 5634BTS 56K Video Ready Modem */
{0x7602a904, NULL}, /* AEI0276 - 56K v.90 Fax Modem (LKT) */
{0x00007905, NULL}, /* AKY0000 - 56K Plug&Play Modem */
{0x21107905, NULL}, /* AKY1021 - 56K Plug&Play Modem */
{0x01405407, NULL}, /* AZT4001 - AZT3000 PnP SOUND DEVICE, MODEM */
{0x56039008, NULL}, /* BDP0356 - Best Data 56x2 */
{0x56159008, NULL}, /* BDP1556 - B.D. Smart One 56SPS,Voice Modem*/
{0x36339008, NULL}, /* BDP3336 - Best Data Prods. 336F */
{0x0014490a, NULL}, /* BRI1400 - Boca 33.6 PnP */
{0x0015490a, NULL}, /* BRI1500 - Internal Fax Data */
{0x0034490a, NULL}, /* BRI3400 - Internal ACF Modem */
{0x0094490a, NULL}, /* BRI9400 - Boca K56Flex PnP */
{0x00b4490a, NULL}, /* BRIB400 - Boca 56k PnP */
{0x0030320d, NULL}, /* CIR3000 - Cirrus Logic V43 */
{0x0100440e, NULL}, /* CRD0001 - Cardinal MVP288IV ? */
{0x01308c0e, NULL}, /* CTL3001 - Creative Labs Phoneblaster */
{0x36033610, NULL}, /* DAV0336 - DAVICOM 336PNP MODEM */
{0x01009416, NULL}, /* ETT0001 - E-Tech Bullet 33k6 PnP */
{0x0000aa1a, NULL}, /* FUJ0000 - FUJITSU Modem 33600 PNP/I2 */
{0x1200c31e, NULL}, /* GVC0012 - VF1128HV-R9 (win modem?) */
{0x0303c31e, NULL}, /* GVC0303 - MaxTech 33.6 PnP D/F/V */
{0x0505c31e, NULL}, /* GVC0505 - GVC 56k Faxmodem */
{0x0116c31e, NULL}, /* GVC1601 - Rockwell V.34 Plug & Play Modem */
{0x0050c31e, NULL}, /* GVC5000 - some GVC modem */
{0x3800f91e, NULL}, /* GWY0038 - Telepath with v.90 */
{0x9062f91e, NULL}, /* GWY6290 - Telepath with x2 Technology */
{0x8100e425, NULL}, /* IOD0081 - I-O DATA DEVICE,INC. IFML-560 */
{0x71004d24, NULL}, /* IBM0071 - IBM ThinkPad 240 IrDA controller*/
{0x21002534, NULL}, /* MAE0021 - Jetstream Int V.90 56k Voice Series 2*/
{0x0000f435, NULL}, /* MOT0000 - Motorola ModemSURFR 33.6 Intern */
{0x5015f435, NULL}, /* MOT1550 - Motorola ModemSURFR 56K Modem */
{0xf015f435, NULL}, /* MOT15F0 - Motorola VoiceSURFR 56K Modem */
{0x6045f435, NULL}, /* MOT4560 - Motorola ? */
{0x61e7a338, NULL}, /* NECE761 - 33.6Modem */
{0x0160633a, NULL}, /* NSC6001 - National Semi's IrDA Controller*/
{0x08804f3f, NULL}, /* OZO8008 - Zoom (33.6k Modem) */
{0x0f804f3f, NULL}, /* OZO800f - Zoom 2812 (56k Modem) */
{0x39804f3f, NULL}, /* OZO8039 - Zoom 56k flex */
{0x00914f3f, NULL}, /* OZO9100 - Zoom 2919 (K56 Faxmodem) */
{0x3024a341, NULL}, /* PMC2430 - Pace 56 Voice Internal Modem */
{0x1000eb49, NULL}, /* ROK0010 - Rockwell ? */
{0x1200b23d, NULL}, /* RSS0012 - OMRON ME5614ISA */
{0x5002734a, NULL}, /* RSS0250 - 5614Jx3(G) Internal Modem */
{0x6202734a, NULL}, /* RSS0262 - 5614Jx3[G] V90+K56Flex Modem */
{0x1010104d, NULL}, /* SHP1010 - Rockwell 33600bps Modem */
{0x10f0a34d, NULL}, /* SMCF010 - SMC IrCC*/
{0xc100ad4d, NULL}, /* SMM00C1 - Leopard 56k PnP */
{0x9012b04e, NULL}, /* SUP1290 - Supra ? */
{0x1013b04e, NULL}, /* SUP1310 - SupraExpress 336i PnP */
{0x8013b04e, NULL}, /* SUP1380 - SupraExpress 288i PnP Voice */
{0x8113b04e, NULL}, /* SUP1381 - SupraExpress 336i PnP Voice */
{0x5016b04e, NULL}, /* SUP1650 - Supra 336i Sp Intl */
{0x7016b04e, NULL}, /* SUP1670 - Supra 336i V+ Intl */
{0x7420b04e, NULL}, /* SUP2070 - Supra ? */
{0x8020b04e, NULL}, /* SUP2080 - Supra ? */
{0x8420b04e, NULL}, /* SUP2084 - SupraExpress 56i PnP */
{0x7121b04e, NULL}, /* SUP2171 - SupraExpress 56i Sp? */
{0x8024b04e, NULL}, /* SUP2480 - Supra ? */
{0x01007256, NULL}, /* USR0001 - U.S. Robotics Inc., Sportster W */
{0x02007256, NULL}, /* USR0002 - U.S. Robotics Inc. Sportster 33. */
{0x04007256, NULL}, /* USR0004 - USR Sportster 14.4k */
{0x06007256, NULL}, /* USR0006 - USR Sportster 33.6k */
{0x11007256, NULL}, /* USR0011 - USR ? */
{0x01017256, NULL}, /* USR0101 - USR ? */
{0x30207256, NULL}, /* USR2030 - U.S.Robotics Inc. Sportster 560 */
{0x50207256, NULL}, /* USR2050 - U.S.Robotics Inc. Sportster 33. */
{0x70207256, NULL}, /* USR2070 - U.S.Robotics Inc. Sportster 560 */
{0x30307256, NULL}, /* USR3030 - U.S. Robotics 56K FAX INT */
{0x31307256, NULL}, /* USR3031 - U.S. Robotics 56K FAX INT */
{0x50307256, NULL}, /* USR3050 - U.S. Robotics 56K FAX INT */
{0x70307256, NULL}, /* USR3070 - U.S. Robotics 56K Voice INT */
{0x90307256, NULL}, /* USR3090 - USR ? */
{0x70917256, NULL}, /* USR9170 - U.S. Robotics 56K FAX INT */
{0x90917256, NULL}, /* USR9190 - USR 56k Voice INT */
{0x04f0235c, NULL}, /* WACF004 - Wacom Tablet PC Screen*/
{0x0300695c, NULL}, /* WCI0003 - Fax/Voice/Modem/Speakphone/Asvd */
{0x01a0896a, NULL}, /* ZTIA001 - Zoom Internal V90 Faxmodem */
{0x61f7896a, NULL}, /* ZTIF761 - Zoom ComStar 33.6 */
{0}
};
static int
uart_isa_probe(device_t dev)
{
struct uart_softc *sc;
device_t parent;
parent = device_get_parent(dev);
sc = device_get_softc(dev);
if (!ISA_PNP_PROBE(parent, dev, isa_ns8250_ids)) {
sc->sc_class = &uart_ns8250_class;
return (uart_bus_probe(dev, 0, 0, 0, 0));
The uart(4) driver is an universal driver for various UART hardware. 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.
2003-09-06 23:13:47 +00:00
}
/* Add checks for non-ns8250 IDs here. */
sc->sc_class = &uart_ns8250_class;
return (uart_bus_probe(dev, 0, 0, 0, 0));
The uart(4) driver is an universal driver for various UART hardware. 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.
2003-09-06 23:13:47 +00:00
}
DRIVER_MODULE(uart, isa, uart_isa_driver, uart_devclass, 0, 0);