1139749Simp/*- 254994Simp * Copyright (c) 1999 M. Warner Losh 354994Simp * All rights reserved. 454994Simp * 554994Simp * Redistribution and use in source and binary forms, with or without 654994Simp * modification, are permitted provided that the following conditions 754994Simp * are met: 854994Simp * 1. Redistributions of source code must retain the above copyright 954994Simp * notice, this list of conditions and the following disclaimer. 1054994Simp * 2. Redistributions in binary form must reproduce the above copyright 1154994Simp * notice, this list of conditions and the following disclaimer in the 1254994Simp * documentation and/or other materials provided with the distribution. 1354994Simp * 1454994Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1554994Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1654994Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1754994Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1854994Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 1954994Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2054994Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2154994Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2254994Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2354994Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2454994Simp * 2554994Simp */ 2654994Simp 27119419Sobrien#include <sys/cdefs.h> 28119419Sobrien__FBSDID("$FreeBSD$"); 29119419Sobrien 3054994Simp#include <sys/param.h> 31257179Sglebius#include <sys/systm.h> 3254994Simp#include <sys/kernel.h> 3354994Simp#include <sys/socket.h> 3454994Simp 3554994Simp#include <sys/module.h> 3654994Simp#include <sys/bus.h> 3754994Simp 3854994Simp#include <machine/bus.h> 3954994Simp#include <machine/resource.h> 4054994Simp 4169955Simp#include <net/ethernet.h> 4254994Simp#include <net/if.h> 4354994Simp#include <net/if_arp.h> 4454994Simp 4554994Simp#include <isa/isavar.h> 4654994Simp 4754994Simp#include <dev/sn/if_snvar.h> 4854994Simp 49147797Simpstatic int sn_isa_probe(device_t); 50147797Simpstatic int sn_isa_attach(device_t); 5154994Simp 5254994Simpstatic int 5354994Simpsn_isa_probe (device_t dev) 5454994Simp{ 5559099Simp if (isa_get_logicalid(dev)) /* skip PnP probes */ 5659099Simp return (ENXIO); 57147797Simp if (sn_probe(dev) != 0) 5860173Simp return (ENXIO); 5960173Simp return (0); 6054994Simp} 6154994Simp 6254994Simpstatic int 6354994Simpsn_isa_attach (device_t dev) 6454994Simp{ 6569955Simp struct sn_softc *sc = device_get_softc(dev); 66147797Simp int err; 6756397Shosokawa 68147797Simp sc->dev = dev; 69147797Simp err = sn_activate(dev); 70147797Simp if (err) { 71147797Simp sn_deactivate(dev); 72147797Simp return (err); 73147797Simp } 74147797Simp err = sn_attach(dev); 75147797Simp if (err) 76147797Simp sn_deactivate(dev); 77147797Simp return (err); 7854994Simp} 7954994Simp 8054994Simpstatic device_method_t sn_isa_methods[] = { 8154994Simp /* Device interface */ 8254994Simp DEVMETHOD(device_probe, sn_isa_probe), 8354994Simp DEVMETHOD(device_attach, sn_isa_attach), 8469955Simp DEVMETHOD(device_detach, sn_detach), 8554994Simp 8654994Simp { 0, 0 } 8754994Simp}; 8854994Simp 8954994Simpstatic driver_t sn_isa_driver = { 9054994Simp "sn", 9154994Simp sn_isa_methods, 9254994Simp sizeof(struct sn_softc), 9354994Simp}; 9454994Simp 9554994Simpextern devclass_t sn_devclass; 9654994Simp 97113506SmdoddDRIVER_MODULE(sn, isa, sn_isa_driver, sn_devclass, 0, 0); 98113506SmdoddMODULE_DEPEND(sn, isa, 1, 1, 1); 99113506SmdoddMODULE_DEPEND(sn, ether, 1, 1, 1); 100