Annotation of sys/dev/isa/if_ep_isapnp.c, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: if_ep_isapnp.c,v 1.10 2006/06/17 17:57:00 brad Exp $ */
! 2: /* $NetBSD: if_ep_isapnp.c,v 1.5 1996/05/12 23:52:36 mycroft Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1996 Jason R. Thorpe <thorpej@beer.org>
! 6: * Copyright (c) 1994 Herb Peyerl <hpeyerl@beer.org>
! 7: * All rights reserved.
! 8: *
! 9: * Redistribution and use in source and binary forms, with or without
! 10: * modification, are permitted provided that the following conditions
! 11: * are met:
! 12: * 1. Redistributions of source code must retain the above copyright
! 13: * notice, this list of conditions and the following disclaimer.
! 14: * 2. Redistributions in binary form must reproduce the above copyright
! 15: * notice, this list of conditions and the following disclaimer in the
! 16: * documentation and/or other materials provided with the distribution.
! 17: * 3. All advertising materials mentioning features or use of this software
! 18: * must display the following acknowledgement:
! 19: * This product includes software developed by Herb Peyerl.
! 20: * 4. The name of Herb Peyerl may not be used to endorse or promote products
! 21: * derived from this software without specific prior written permission.
! 22: *
! 23: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
! 24: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! 25: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
! 26: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
! 27: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
! 28: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
! 29: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
! 30: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! 31: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
! 32: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! 33: *
! 34: * Note: Most of the code here was written by Theo de Raadt originally,
! 35: * ie. all the mechanics of probing for all cards on first call and then
! 36: * searching for matching devices on subsequent calls.
! 37: */
! 38:
! 39: #include "bpfilter.h"
! 40:
! 41: #include <sys/param.h>
! 42: #include <sys/systm.h>
! 43: #include <sys/mbuf.h>
! 44: #include <sys/socket.h>
! 45: #include <sys/ioctl.h>
! 46: #include <sys/errno.h>
! 47: #include <sys/syslog.h>
! 48: #include <sys/selinfo.h>
! 49: #include <sys/device.h>
! 50: #include <sys/timeout.h>
! 51: #include <sys/queue.h>
! 52:
! 53: #include <net/if.h>
! 54: #include <net/if_dl.h>
! 55: #include <net/if_types.h>
! 56: #include <net/netisr.h>
! 57: #include <net/if_media.h>
! 58:
! 59: #ifdef INET
! 60: #include <netinet/in.h>
! 61: #include <netinet/in_systm.h>
! 62: #include <netinet/in_var.h>
! 63: #include <netinet/ip.h>
! 64: #include <netinet/if_ether.h>
! 65: #endif
! 66:
! 67: #if NBPFILTER > 0
! 68: #include <net/bpf.h>
! 69: #endif
! 70:
! 71: #include <machine/cpu.h>
! 72: #include <machine/bus.h>
! 73: #include <machine/intr.h>
! 74:
! 75: #include <dev/mii/mii.h>
! 76: #include <dev/mii/miivar.h>
! 77:
! 78: #include <dev/ic/elink3var.h>
! 79: #include <dev/ic/elink3reg.h>
! 80:
! 81: #include <dev/isa/isavar.h>
! 82: #include <dev/isa/elink.h>
! 83:
! 84: int ep_isapnp_match(struct device *, void *, void *);
! 85: void ep_isapnp_attach(struct device *, struct device *, void *);
! 86:
! 87: struct cfattach ep_isapnp_ca = {
! 88: sizeof(struct ep_softc), ep_isapnp_match, ep_isapnp_attach
! 89: };
! 90:
! 91: /*
! 92: * 3c509 cards on the ISA bus are probed in ethernet address order.
! 93: * The probe sequence requires careful orchestration, and we'd like
! 94: * like to allow the irq and base address to be wildcarded. So, we
! 95: * probe all the cards the first time epprobe() is called. On subsequent
! 96: * calls we look for matching cards.
! 97: */
! 98: int
! 99: ep_isapnp_match(parent, match, aux)
! 100: struct device *parent;
! 101: void *match, *aux;
! 102: {
! 103: /* XXX This should be more intelligent */
! 104: return 1;
! 105: }
! 106:
! 107: void
! 108: ep_isapnp_attach(parent, self, aux)
! 109: struct device *parent, *self;
! 110: void *aux;
! 111: {
! 112: struct ep_softc *sc = (void *)self;
! 113: struct isa_attach_args *ia = aux;
! 114: bus_space_tag_t iot = ia->ia_iot;
! 115: bus_space_handle_t ioh;
! 116:
! 117: sc->sc_iot = iot = ia->ia_iot;
! 118: sc->sc_ioh = ioh = ia->ipa_io[0].h;
! 119: sc->bustype = EP_BUS_ISA;
! 120:
! 121: printf(":");
! 122:
! 123: /* Should look at ia->ia_devident... */
! 124: epconfig(sc, EP_CHIPSET_3C509, NULL);
! 125:
! 126: sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
! 127: IPL_NET, epintr, sc, sc->sc_dev.dv_xname);
! 128: }
CVSweb