sio_cbus.c revision 86912
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 86912 2001-11-26 12:29:53Z 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 __P((device_t dev)); 4692793Skatostatic int sio_isa_probe __P((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), 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"}, 6486912Snyan {0} 6586912Snyan}; 6686912Snyan 6786912Snyanstatic int 6886912Snyansio_isa_probe(dev) 6986912Snyan device_t dev; 7086912Snyan{ 7186912Snyan#ifdef PC98 7286912Snyan int logical_id; 7386912Snyan#endif 7486912Snyan /* Check isapnp ids */ 7586912Snyan if (ISA_PNP_PROBE(device_get_parent(dev), dev, sio_ids) == ENXIO) 7686912Snyan return (ENXIO); 7786912Snyan#ifdef PC98 7886912Snyan logical_id = isa_get_logicalid(dev); 7986912Snyan switch (logical_id) { 8086912Snyan case 0x0100e4a5: /* RSA-98III */ 8186912Snyan SET_FLAG(dev, SET_IFTYPE(COM_IF_RSA98III)); 8286912Snyan break; 8386912Snyan } 8486912Snyan#endif 8590011Snyan return (sioprobe(dev, 0, 0)); 8686912Snyan} 8786912Snyan 8886912Snyanstatic int 8986912Snyansio_isa_attach(dev) 9086912Snyan device_t dev; 9186912Snyan{ 9290011Snyan return (sioattach(dev, 0)); 9386912Snyan} 9486912Snyan 9586912SnyanDRIVER_MODULE(sio, isa, sio_isa_driver, sio_devclass, 0, 0); 96