sio_cbus.c revision 123934
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 123934 2003-12-28 12:25:49Z 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_pio.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 {0x11802fbf, NULL}, /* OYO8011 - PC-9801-12X */ 66104142Snyan {0x4180a3b8, NULL}, /* NEC8041 - PC-9821CB-B04 */ 67104142Snyan {0x4182a3b8, NULL}, /* NEC8241 - (Nw150) */ 68104142Snyan {0x5181a3b8, NULL}, /* NEC8151 - PC-9821CB2-B04 */ 69104142Snyan {0x5182a3b8, NULL}, /* NEC8251 - PC-9801-12X */ 70104142Snyan {0x7182a3b8, NULL}, /* NEC8271 - PC-9801-12X */ 71104142Snyan {0x9181a3b8, NULL}, /* NEC8191 - PC-9801-120 */ 7286912Snyan {0} 7386912Snyan}; 7486912Snyan 7586912Snyanstatic int 7686912Snyansio_isa_probe(dev) 7786912Snyan device_t dev; 7886912Snyan{ 7986912Snyan int logical_id; 80104142Snyan 8186912Snyan /* Check isapnp ids */ 8286912Snyan if (ISA_PNP_PROBE(device_get_parent(dev), dev, sio_ids) == ENXIO) 8386912Snyan return (ENXIO); 84104142Snyan 8586912Snyan logical_id = isa_get_logicalid(dev); 8686912Snyan switch (logical_id) { 8786912Snyan case 0x0100e4a5: /* RSA-98III */ 8886912Snyan SET_FLAG(dev, SET_IFTYPE(COM_IF_RSA98III)); 8986912Snyan break; 90104142Snyan case 0x11802fbf: /* PC-9801-12X */ 91104142Snyan case 0x4180a3b8: /* PC-9821CB-B04 */ 92104142Snyan case 0x4182a3b8: /* (Nw150) */ 93104142Snyan case 0x5181a3b8: /* PC-9821CB2-B04 */ 94104142Snyan case 0x5182a3b8: /* PC-9801-12X */ 95104142Snyan case 0x7182a3b8: /* PC-9801-12X */ 96104142Snyan case 0x9181a3b8: /* PC-9801-120 */ 97104142Snyan SET_FLAG(dev, SET_IFTYPE(COM_IF_NS16550)); 98104142Snyan break; 9986912Snyan } 100104142Snyan 10190011Snyan return (sioprobe(dev, 0, 0UL, 0)); 10286912Snyan} 10386912Snyan 10486912Snyanstatic int 10586912Snyansio_isa_attach(dev) 10686912Snyan device_t dev; 10786912Snyan{ 10890011Snyan return (sioattach(dev, 0, 0UL)); 10986912Snyan} 11086912Snyan 11186912SnyanDRIVER_MODULE(sio, isa, sio_isa_driver, sio_devclass, 0, 0); 112