sio_cbus.c revision 146216
1211608Srpaulo/*- 2211608Srpaulo * Copyright (c) 2001 TAKAHASHI Yoshihiro 3211608Srpaulo * All rights reserved. 4211608Srpaulo * 5211608Srpaulo * Redistribution and use in source and binary forms, with or without 6211608Srpaulo * modification, are permitted provided that the following conditions 7211608Srpaulo * are met: 8211608Srpaulo * 1. Redistributions of source code must retain the above copyright 9211608Srpaulo * notice, this list of conditions and the following disclaimer. 10211608Srpaulo * 2. Redistributions in binary form must reproduce the above copyright 11211608Srpaulo * notice, this list of conditions and the following disclaimer in the 12211608Srpaulo * documentation and/or other materials provided with the distribution. 13211608Srpaulo * 14211608Srpaulo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15211608Srpaulo * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16211608Srpaulo * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17211608Srpaulo * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18211608Srpaulo * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19211608Srpaulo * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20211608Srpaulo * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21211608Srpaulo * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22211608Srpaulo * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23211608Srpaulo * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24211608Srpaulo * 25211608Srpaulo * $FreeBSD: head/sys/pc98/cbus/sio_cbus.c 146216 2005-05-14 10:51:16Z nyan $ 26211608Srpaulo */ 27211608Srpaulo 28211608Srpaulo#include <sys/param.h> 29211608Srpaulo#include <sys/systm.h> 30211608Srpaulo#include <sys/bus.h> 31211608Srpaulo#include <sys/conf.h> 32211608Srpaulo#include <sys/kernel.h> 33211608Srpaulo#include <sys/lock.h> 34211608Srpaulo#include <sys/malloc.h> 35211608Srpaulo#include <sys/mutex.h> 36211608Srpaulo#include <sys/module.h> 37211608Srpaulo#include <sys/tty.h> 38211608Srpaulo#include <machine/bus.h> 39211608Srpaulo#include <sys/timepps.h> 40211608Srpaulo 41211608Srpaulo#include <dev/sio/siovar.h> 42211608Srpaulo 43211608Srpaulo#include <isa/isavar.h> 44211608Srpaulo 45211608Srpaulostatic int sio_isa_attach(device_t dev); 46211608Srpaulostatic int sio_isa_probe(device_t dev); 47211608Srpaulo 48211608Srpaulostatic device_method_t sio_isa_methods[] = { 49211608Srpaulo /* Device interface */ 50211608Srpaulo DEVMETHOD(device_probe, sio_isa_probe), 51211608Srpaulo DEVMETHOD(device_attach, sio_isa_attach), 52211608Srpaulo DEVMETHOD(device_detach, siodetach), 53211608Srpaulo 54211608Srpaulo { 0, 0 } 55211608Srpaulo}; 56211608Srpaulo 57211608Srpaulostatic driver_t sio_isa_driver = { 58211608Srpaulo sio_driver_name, 59211608Srpaulo sio_isa_methods, 60211608Srpaulo 0, 61211608Srpaulo}; 62211608Srpaulo 63211608Srpaulostatic struct isa_pnp_id sio_ids[] = { 64297077Smav {0x0100e4a5, "RSA-98III"}, 65211608Srpaulo {0x4180a3b8, NULL}, /* NEC8041 - PC-9821CB-B04 */ 66211608Srpaulo {0x0181a3b8, NULL}, /* NEC8101 - PC-9821CB2-B04 */ 67211608Srpaulo {0x5181a3b8, NULL}, /* NEC8151 - Internal FAX/Modem for Cx3, Cb3 */ 68211608Srpaulo {0x9181a3b8, NULL}, /* NEC8191 - NEC PC-9801-120 */ 69211608Srpaulo {0xe181a3b8, NULL}, /* NEC81E1 - Internal FAX/Modem */ 70211608Srpaulo {0x1182a3b8, NULL}, /* NEC8211 - PC-9801-123 */ 71211608Srpaulo {0x3182a3b8, NULL}, /* NEC8231 - Internal FAX/Modem(Voice) */ 72211608Srpaulo {0x4182a3b8, NULL}, /* NEC8241 - NEC PC-9821NR-B05 */ 73211608Srpaulo {0x5182a3b8, NULL}, /* NEC8251 - Internel FAX/Modem */ 74211608Srpaulo {0x7182a3b8, NULL}, /* NEC8271 - NEC PC-9801-125 */ 75211608Srpaulo {0x11802fbf, NULL}, /* OYO8011 - Internal FAX/Modem for ValueStar(Ring) */ 76211608Srpaulo {0} 77211608Srpaulo}; 78211608Srpaulo 79211608Srpaulostatic int 80211608Srpaulosio_isa_probe(dev) 81211608Srpaulo device_t dev; 82211608Srpaulo{ 83211608Srpaulo int logical_id; 84211608Srpaulo 85211608Srpaulo /* Check isapnp ids */ 86211608Srpaulo if (ISA_PNP_PROBE(device_get_parent(dev), dev, sio_ids) == ENXIO) 87211608Srpaulo return (ENXIO); 88211608Srpaulo 89211608Srpaulo logical_id = isa_get_logicalid(dev); 90211608Srpaulo switch (logical_id) { 91211608Srpaulo case 0x0100e4a5: /* RSA-98III */ 92297077Smav SET_FLAG(dev, SET_IFTYPE(COM_IF_RSA98III)); 93265277Smarkj break; 94265277Smarkj case 0x4180a3b8: /* PC-9821CB-B04 */ 95265277Smarkj case 0x0181a3b8: /* PC-9821CB2-B04 */ 96265277Smarkj case 0x5181a3b8: /* for Cx3, Cb3 internal */ 97265277Smarkj case 0x9181a3b8: /* PC-9801-120 */ 98265277Smarkj case 0xe181a3b8: /* Internal FAX/Modem */ 99265277Smarkj case 0x1182a3b8: /* PC-9801-123 */ 100265277Smarkj case 0x3182a3b8: /* FAX/Voice/Modem internal */ 101265277Smarkj case 0x4182a3b8: /* PC-9821NR-B05 */ 102265277Smarkj case 0x5182a3b8: /* FAX/Modem internal */ 103265277Smarkj case 0x7182a3b8: /* PC-9801-125 */ 104265277Smarkj case 0x11802fbf: /* for ValueStar internal */ 105265277Smarkj SET_FLAG(dev, SET_IFTYPE(COM_IF_NS16550)); 106265277Smarkj break; 107265277Smarkj } 108265277Smarkj 109265277Smarkj return (sioprobe(dev, 0, 0UL, 0)); 110265277Smarkj} 111265277Smarkj 112265277Smarkjstatic int 113265277Smarkjsio_isa_attach(dev) 114265277Smarkj device_t dev; 115265277Smarkj{ 116265277Smarkj return (sioattach(dev, 0, 0UL)); 117265277Smarkj} 118265277Smarkj 119297077SmavDRIVER_MODULE(sio, isa, sio_isa_driver, sio_devclass, 0, 0); 120211608Srpaulo