sio_cbus.c revision 123934
1/* 2 * Copyright (c) 2001 Yoshihiro TAKAHASHI. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * 24 * $FreeBSD: head/sys/pc98/cbus/sio_cbus.c 123934 2003-12-28 12:25:49Z nyan $ 25 */ 26 27#include <sys/param.h> 28#include <sys/systm.h> 29#include <sys/bus.h> 30#include <sys/conf.h> 31#include <sys/kernel.h> 32#include <sys/lock.h> 33#include <sys/malloc.h> 34#include <sys/mutex.h> 35#include <sys/module.h> 36#include <sys/tty.h> 37#include <machine/bus_pio.h> 38#include <machine/bus.h> 39#include <sys/timepps.h> 40 41#include <dev/sio/siovar.h> 42 43#include <isa/isavar.h> 44 45static int sio_isa_attach(device_t dev); 46static int sio_isa_probe(device_t dev); 47 48static device_method_t sio_isa_methods[] = { 49 /* Device interface */ 50 DEVMETHOD(device_probe, sio_isa_probe), 51 DEVMETHOD(device_attach, sio_isa_attach), 52 DEVMETHOD(device_detach, siodetach), 53 54 { 0, 0 } 55}; 56 57static driver_t sio_isa_driver = { 58 sio_driver_name, 59 sio_isa_methods, 60 0, 61}; 62 63static struct isa_pnp_id sio_ids[] = { 64 {0x0100e4a5, "RSA-98III"}, 65 {0x11802fbf, NULL}, /* OYO8011 - PC-9801-12X */ 66 {0x4180a3b8, NULL}, /* NEC8041 - PC-9821CB-B04 */ 67 {0x4182a3b8, NULL}, /* NEC8241 - (Nw150) */ 68 {0x5181a3b8, NULL}, /* NEC8151 - PC-9821CB2-B04 */ 69 {0x5182a3b8, NULL}, /* NEC8251 - PC-9801-12X */ 70 {0x7182a3b8, NULL}, /* NEC8271 - PC-9801-12X */ 71 {0x9181a3b8, NULL}, /* NEC8191 - PC-9801-120 */ 72 {0} 73}; 74 75static int 76sio_isa_probe(dev) 77 device_t dev; 78{ 79 int logical_id; 80 81 /* Check isapnp ids */ 82 if (ISA_PNP_PROBE(device_get_parent(dev), dev, sio_ids) == ENXIO) 83 return (ENXIO); 84 85 logical_id = isa_get_logicalid(dev); 86 switch (logical_id) { 87 case 0x0100e4a5: /* RSA-98III */ 88 SET_FLAG(dev, SET_IFTYPE(COM_IF_RSA98III)); 89 break; 90 case 0x11802fbf: /* PC-9801-12X */ 91 case 0x4180a3b8: /* PC-9821CB-B04 */ 92 case 0x4182a3b8: /* (Nw150) */ 93 case 0x5181a3b8: /* PC-9821CB2-B04 */ 94 case 0x5182a3b8: /* PC-9801-12X */ 95 case 0x7182a3b8: /* PC-9801-12X */ 96 case 0x9181a3b8: /* PC-9801-120 */ 97 SET_FLAG(dev, SET_IFTYPE(COM_IF_NS16550)); 98 break; 99 } 100 101 return (sioprobe(dev, 0, 0UL, 0)); 102} 103 104static int 105sio_isa_attach(dev) 106 device_t dev; 107{ 108 return (sioattach(dev, 0, 0UL)); 109} 110 111DRIVER_MODULE(sio, isa, sio_isa_driver, sio_devclass, 0, 0); 112