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