sio_cbus.c revision 136029
186912Snyan/* 286912Snyan * Copyright (c) 2001 Yoshihiro TAKAHASHI. All rights reserved. 386912Snyan * 486912Snyan * Redistribution and use in source and binary forms, with or without 586912Snyan * modification, are permitted provided that the following conditions 686912Snyan * are met: 786912Snyan * 1. Redistributions of source code must retain the above copyright 886912Snyan * notice, this list of conditions and the following disclaimer. 986912Snyan * 2. Redistributions in binary form must reproduce the above copyright 1086912Snyan * notice, this list of conditions and the following disclaimer in the 1186912Snyan * documentation and/or other materials provided with the distribution. 1286912Snyan * 1386912Snyan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1486912Snyan * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1586912Snyan * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1686912Snyan * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1786912Snyan * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 1886912Snyan * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1986912Snyan * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2086912Snyan * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2186912Snyan * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2286912Snyan * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2386912Snyan * 2486912Snyan * $FreeBSD: head/sys/pc98/cbus/sio_cbus.c 136029 2004-10-01 15:58:54Z nyan $ 2586912Snyan */ 2686912Snyan 2786912Snyan#include <sys/param.h> 2886912Snyan#include <sys/systm.h> 2986912Snyan#include <sys/bus.h> 3086912Snyan#include <sys/conf.h> 3186912Snyan#include <sys/kernel.h> 3286912Snyan#include <sys/lock.h> 3386912Snyan#include <sys/malloc.h> 3486912Snyan#include <sys/mutex.h> 3586912Snyan#include <sys/module.h> 3686912Snyan#include <sys/tty.h> 3786912Snyan#include <machine/bus.h> 3886912Snyan#include <sys/timepps.h> 3986912Snyan 4086912Snyan#include <dev/sio/siovar.h> 4186912Snyan 4286912Snyan#include <isa/isavar.h> 4386912Snyan 4492793Skatostatic int sio_isa_attach(device_t dev); 4592793Skatostatic int sio_isa_probe(device_t dev); 4686912Snyan 4786912Snyanstatic device_method_t sio_isa_methods[] = { 4886912Snyan /* Device interface */ 4986912Snyan DEVMETHOD(device_probe, sio_isa_probe), 5086912Snyan DEVMETHOD(device_attach, sio_isa_attach), 51123934Snyan DEVMETHOD(device_detach, siodetach), 5286912Snyan 5386912Snyan { 0, 0 } 5486912Snyan}; 5586912Snyan 5686912Snyanstatic driver_t sio_isa_driver = { 5786912Snyan sio_driver_name, 5886912Snyan sio_isa_methods, 5986912Snyan 0, 6086912Snyan}; 6186912Snyan 6286912Snyanstatic struct isa_pnp_id sio_ids[] = { 6386912Snyan {0x0100e4a5, "RSA-98III"}, 64104142Snyan {0x4180a3b8, NULL}, /* NEC8041 - PC-9821CB-B04 */ 65136029Snyan {0x0181a3b8, NULL}, /* NEC8101 - PC-9821CB2-B04 */ 66136029Snyan {0x5181a3b8, NULL}, /* NEC8151 - Internal FAX/Modem for Cx3, Cb3 */ 67136029Snyan {0x9181a3b8, NULL}, /* NEC8191 - NEC PC-9801-120 */ 68136029Snyan {0xe181a3b8, NULL}, /* NEC81E1 - Internal FAX/Modem */ 69136029Snyan {0x1182a3b8, NULL}, /* NEC8211 - PC-9801-123 */ 70136029Snyan {0x3182a3b8, NULL}, /* NEC8231 - Internal FAX/Modem(Voice) */ 71136029Snyan {0x4182a3b8, NULL}, /* NEC8241 - NEC PC-9821NR-B05 */ 72136029Snyan {0x5182a3b8, NULL}, /* NEC8251 - Internel FAX/Modem */ 73136029Snyan {0x7182a3b8, NULL}, /* NEC8271 - NEC PC-9801-125 */ 74136029Snyan {0x11802fbf, NULL}, /* OYO8011 - Internal FAX/Modem for ValueStar(Ring) */ 7586912Snyan {0} 7686912Snyan}; 7786912Snyan 7886912Snyanstatic int 7986912Snyansio_isa_probe(dev) 8086912Snyan device_t dev; 8186912Snyan{ 8286912Snyan int logical_id; 83104142Snyan 8486912Snyan /* Check isapnp ids */ 8586912Snyan if (ISA_PNP_PROBE(device_get_parent(dev), dev, sio_ids) == ENXIO) 8686912Snyan return (ENXIO); 87104142Snyan 8886912Snyan logical_id = isa_get_logicalid(dev); 8986912Snyan switch (logical_id) { 9086912Snyan case 0x0100e4a5: /* RSA-98III */ 9186912Snyan SET_FLAG(dev, SET_IFTYPE(COM_IF_RSA98III)); 9286912Snyan break; 93104142Snyan case 0x4180a3b8: /* PC-9821CB-B04 */ 94136029Snyan case 0x0181a3b8: /* PC-9821CB2-B04 */ 95136029Snyan case 0x5181a3b8: /* for Cx3, Cb3 internal */ 96104142Snyan case 0x9181a3b8: /* PC-9801-120 */ 97136029Snyan case 0xe181a3b8: /* Internal FAX/Modem */ 98136029Snyan case 0x1182a3b8: /* PC-9801-123 */ 99136029Snyan case 0x3182a3b8: /* FAX/Voice/Modem internal */ 100136029Snyan case 0x4182a3b8: /* PC-9821NR-B05 */ 101136029Snyan case 0x5182a3b8: /* FAX/Modem internal */ 102136029Snyan case 0x7182a3b8: /* PC-9801-125 */ 103136029Snyan case 0x11802fbf: /* for ValueStar internal */ 104104142Snyan SET_FLAG(dev, SET_IFTYPE(COM_IF_NS16550)); 105104142Snyan break; 10686912Snyan } 107104142Snyan 10890011Snyan return (sioprobe(dev, 0, 0UL, 0)); 10986912Snyan} 11086912Snyan 11186912Snyanstatic int 11286912Snyansio_isa_attach(dev) 11386912Snyan device_t dev; 11486912Snyan{ 11590011Snyan return (sioattach(dev, 0, 0UL)); 11686912Snyan} 11786912Snyan 11886912SnyanDRIVER_MODULE(sio, isa, sio_isa_driver, sio_devclass, 0, 0); 119