1 /*- 2 * Copyright (c) 2008 TAKAHASHI Yoshihiro 3 * Copyright (c) 2008 Marcel Moolenaar 4 * Copyright (c) 2001 M. Warner Losh 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 #include <sys/cdefs.h> 29 __FBSDID("$FreeBSD$"); 30 31 #include <sys/param.h> 32 #include <sys/systm.h> 33 #include <sys/bus.h> 34 #include <sys/conf.h> 35 #include <sys/kernel.h> 36 #include <sys/module.h> 37 #include <machine/bus.h> 38 #include <sys/rman.h> 39 #include <machine/resource.h> 40 41 #include <isa/isavar.h> 42 43 #include <dev/uart/uart.h> 44 #include <dev/uart/uart_bus.h> 45 46 static int uart_isa_probe(device_t dev); 47 48 static device_method_t uart_isa_methods[] = { 49 /* Device interface */ 50 DEVMETHOD(device_probe, uart_isa_probe), 51 DEVMETHOD(device_attach, uart_bus_attach), 52 DEVMETHOD(device_detach, uart_bus_detach), 53 { 0, 0 } 54 }; 55 56 static driver_t uart_isa_driver = { 57 uart_driver_name, 58 uart_isa_methods, 59 sizeof(struct uart_softc), 60 }; 61 62 static struct isa_pnp_id isa_ns8250_ids[] = { 63 {0x0005d041, "Standard PC COM port"}, /* PNP0500 */ 64 {0x0105d041, "16550A-compatible COM port"}, /* PNP0501 */ 65 {0x0205d041, "Multiport serial device (non-intelligent 16550)"}, /* PNP0502 */ 66 {0x1005d041, "Generic IRDA-compatible device"}, /* PNP0510 */ 67 {0x1105d041, "Generic IRDA-compatible device"}, /* PNP0511 */ 68 /* Devices that do not have a compatid */ 69 {0x12206804, NULL}, /* ACH2012 - 5634BTS 56K Video Ready Modem */ 70 {0x7602a904, NULL}, /* AEI0276 - 56K v.90 Fax Modem (LKT) */ 71 {0x00007905, NULL}, /* AKY0000 - 56K Plug&Play Modem */ 72 {0x21107905, NULL}, /* AKY1021 - 56K Plug&Play Modem */ 73 {0x01405407, NULL}, /* AZT4001 - AZT3000 PnP SOUND DEVICE, MODEM */ 74 {0x56039008, NULL}, /* BDP0356 - Best Data 56x2 */ 75 {0x56159008, NULL}, /* BDP1556 - B.D. Smart One 56SPS,Voice Modem*/ 76 {0x36339008, NULL}, /* BDP3336 - Best Data Prods. 336F */ 77 {0x0014490a, NULL}, /* BRI1400 - Boca 33.6 PnP */ 78 {0x0015490a, NULL}, /* BRI1500 - Internal Fax Data */ 79 {0x0034490a, NULL}, /* BRI3400 - Internal ACF Modem */ 80 {0x0094490a, NULL}, /* BRI9400 - Boca K56Flex PnP */ 81 {0x00b4490a, NULL}, /* BRIB400 - Boca 56k PnP */ 82 {0x0010320d, NULL}, /* CIR1000 - Cirrus Logic V34 */ 83 {0x0030320d, NULL}, /* CIR3000 - Cirrus Logic V43 */ 84 {0x0100440e, NULL}, /* CRD0001 - Cardinal MVP288IV ? */ 85 {0x01308c0e, NULL}, /* CTL3001 - Creative Labs Phoneblaster */ 86 {0x36033610, NULL}, /* DAV0336 - DAVICOM 336PNP MODEM */ 87 {0x01009416, NULL}, /* ETT0001 - E-Tech Bullet 33k6 PnP */ 88 {0x0000aa1a, NULL}, /* FUJ0000 - FUJITSU Modem 33600 PNP/I2 */ 89 {0x1200c31e, NULL}, /* GVC0012 - VF1128HV-R9 (win modem?) */ 90 {0x0303c31e, NULL}, /* GVC0303 - MaxTech 33.6 PnP D/F/V */ 91 {0x0505c31e, NULL}, /* GVC0505 - GVC 56k Faxmodem */ 92 {0x0116c31e, NULL}, /* GVC1601 - Rockwell V.34 Plug & Play Modem */ 93 {0x0050c31e, NULL}, /* GVC5000 - some GVC modem */ 94 {0x3800f91e, NULL}, /* GWY0038 - Telepath with v.90 */ 95 {0x9062f91e, NULL}, /* GWY6290 - Telepath with x2 Technology */ 96 {0x8100e425, NULL}, /* IOD0081 - I-O DATA DEVICE,INC. IFML-560 */ 97 {0x71004d24, NULL}, /* IBM0071 - IBM ThinkPad 240 IrDA controller*/ 98 {0x21002534, NULL}, /* MAE0021 - Jetstream Int V.90 56k Voice Series 2*/ 99 {0x0000f435, NULL}, /* MOT0000 - Motorola ModemSURFR 33.6 Intern */ 100 {0x5015f435, NULL}, /* MOT1550 - Motorola ModemSURFR 56K Modem */ 101 {0xf015f435, NULL}, /* MOT15F0 - Motorola VoiceSURFR 56K Modem */ 102 {0x6045f435, NULL}, /* MOT4560 - Motorola ? */ 103 {0x61e7a338, NULL}, /* NECE761 - 33.6Modem */ 104 {0x0160633a, NULL}, /* NSC6001 - National Semi's IrDA Controller*/ 105 {0x08804f3f, NULL}, /* OZO8008 - Zoom (33.6k Modem) */ 106 {0x0f804f3f, NULL}, /* OZO800f - Zoom 2812 (56k Modem) */ 107 {0x39804f3f, NULL}, /* OZO8039 - Zoom 56k flex */ 108 {0x00914f3f, NULL}, /* OZO9100 - Zoom 2919 (K56 Faxmodem) */ 109 {0x3024a341, NULL}, /* PMC2430 - Pace 56 Voice Internal Modem */ 110 {0x1000eb49, NULL}, /* ROK0010 - Rockwell ? */ 111 {0x1200b23d, NULL}, /* RSS0012 - OMRON ME5614ISA */ 112 {0x5002734a, NULL}, /* RSS0250 - 5614Jx3(G) Internal Modem */ 113 {0x6202734a, NULL}, /* RSS0262 - 5614Jx3[G] V90+K56Flex Modem */ 114 {0x1010104d, NULL}, /* SHP1010 - Rockwell 33600bps Modem */ 115 {0x10f0a34d, NULL}, /* SMCF010 - SMC IrCC*/ 116 {0xc100ad4d, NULL}, /* SMM00C1 - Leopard 56k PnP */ 117 {0x9012b04e, NULL}, /* SUP1290 - Supra ? */ 118 {0x1013b04e, NULL}, /* SUP1310 - SupraExpress 336i PnP */ 119 {0x8013b04e, NULL}, /* SUP1380 - SupraExpress 288i PnP Voice */ 120 {0x8113b04e, NULL}, /* SUP1381 - SupraExpress 336i PnP Voice */ 121 {0x5016b04e, NULL}, /* SUP1650 - Supra 336i Sp Intl */ 122 {0x7016b04e, NULL}, /* SUP1670 - Supra 336i V+ Intl */ 123 {0x7420b04e, NULL}, /* SUP2070 - Supra ? */ 124 {0x8020b04e, NULL}, /* SUP2080 - Supra ? */ 125 {0x8420b04e, NULL}, /* SUP2084 - SupraExpress 56i PnP */ 126 {0x7121b04e, NULL}, /* SUP2171 - SupraExpress 56i Sp? */ 127 {0x8024b04e, NULL}, /* SUP2480 - Supra ? */ 128 {0x01007256, NULL}, /* USR0001 - U.S. Robotics Inc., Sportster W */ 129 {0x02007256, NULL}, /* USR0002 - U.S. Robotics Inc. Sportster 33. */ 130 {0x04007256, NULL}, /* USR0004 - USR Sportster 14.4k */ 131 {0x06007256, NULL}, /* USR0006 - USR Sportster 33.6k */ 132 {0x11007256, NULL}, /* USR0011 - USR ? */ 133 {0x01017256, NULL}, /* USR0101 - USR ? */ 134 {0x30207256, NULL}, /* USR2030 - U.S.Robotics Inc. Sportster 560 */ 135 {0x50207256, NULL}, /* USR2050 - U.S.Robotics Inc. Sportster 33. */ 136 {0x70207256, NULL}, /* USR2070 - U.S.Robotics Inc. Sportster 560 */ 137 {0x30307256, NULL}, /* USR3030 - U.S. Robotics 56K FAX INT */ 138 {0x31307256, NULL}, /* USR3031 - U.S. Robotics 56K FAX INT */ 139 {0x50307256, NULL}, /* USR3050 - U.S. Robotics 56K FAX INT */ 140 {0x70307256, NULL}, /* USR3070 - U.S. Robotics 56K Voice INT */ 141 {0x90307256, NULL}, /* USR3090 - USR ? */ 142 {0x70917256, NULL}, /* USR9170 - U.S. Robotics 56K FAX INT */ 143 {0x90917256, NULL}, /* USR9190 - USR 56k Voice INT */ 144 {0x04f0235c, NULL}, /* WACF004 - Wacom Tablet PC Screen*/ 145 {0x0300695c, NULL}, /* WCI0003 - Fax/Voice/Modem/Speakphone/Asvd */ 146 {0x01a0896a, NULL}, /* ZTIA001 - Zoom Internal V90 Faxmodem */ 147 {0x61f7896a, NULL}, /* ZTIF761 - Zoom ComStar 33.6 */ 148 /* The following are found in PC98 hardware. */ 149 {0x4180a3b8, NULL}, /* NEC8041 - PC-9821CB-B04 */ 150 {0x0181a3b8, NULL}, /* NEC8101 - PC-9821CB2-B04 */ 151 {0x5181a3b8, NULL}, /* NEC8151 - Internal FAX/Modem for Cx3, Cb3 */ 152 {0x9181a3b8, NULL}, /* NEC8191 - PC-9801-120 */ 153 {0xe181a3b8, NULL}, /* NEC81E1 - Internal FAX/Modem */ 154 {0x1182a3b8, NULL}, /* NEC8211 - PC-9801-123 */ 155 {0x3182a3b8, NULL}, /* NEC8231 - Internal FAX/Modem (Voice) */ 156 {0x4182a3b8, NULL}, /* NEC8241 - PC-9821NR-B05 */ 157 {0x5182a3b8, NULL}, /* NEC8251 - Internel FAX/Modem */ 158 {0x7182a3b8, NULL}, /* NEC8271 - PC-9801-125 */ 159 {0x11802fbf, NULL}, /* OYO8011 - Internal FAX/Modem (Ring) */ 160 {0} 161 }; 162 163 static int 164 uart_isa_probe(device_t dev) 165 { 166 struct uart_softc *sc; 167 device_t parent; 168 169 parent = device_get_parent(dev); 170 sc = device_get_softc(dev); 171 172 /* Check PnP IDs */ 173 if (ISA_PNP_PROBE(parent, dev, isa_ns8250_ids) == ENXIO) 174 return (ENXIO); 175 176 /* Probe PnP _and_ non-PnP ns8250 here. */ 177 #ifdef PC98 178 if (isa_get_logicalid(dev)) 179 sc->sc_class = &uart_ns8250_class; 180 else 181 sc->sc_class = uart_pc98_getdev(bus_get_resource_start(dev, 182 SYS_RES_IOPORT, 0)); 183 #else 184 sc->sc_class = &uart_ns8250_class; 185 #endif 186 return (uart_bus_probe(dev, 0, 0, 0, 0)); 187 } 188 189 DRIVER_MODULE(uart, isa, uart_isa_driver, uart_devclass, 0, 0); 190