Home | History | Annotate | Line # | Download | only in dev
xsh.c revision 1.2.2.2
      1  1.2.2.2  rmind /*	$NetBSD: xsh.c,v 1.2.2.2 2013/08/28 23:59:10 rmind Exp $ */
      2  1.2.2.2  rmind 
      3  1.2.2.2  rmind /*-
      4  1.2.2.2  rmind  * Copyright (c) 2013 The NetBSD Foundation, Inc.
      5  1.2.2.2  rmind  * All rights reserved.
      6  1.2.2.2  rmind  *
      7  1.2.2.2  rmind  * This code is derived from software contributed to The NetBSD Foundation
      8  1.2.2.2  rmind  * by Radoslaw Kujawa.
      9  1.2.2.2  rmind  *
     10  1.2.2.2  rmind  * Redistribution and use in source and binary forms, with or without
     11  1.2.2.2  rmind  * modification, are permitted provided that the following conditions
     12  1.2.2.2  rmind  * are met:
     13  1.2.2.2  rmind  * 1. Redistributions of source code must retain the above copyright
     14  1.2.2.2  rmind  *    notice, this list of conditions and the following disclaimer.
     15  1.2.2.2  rmind  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.2.2.2  rmind  *    notice, this list of conditions and the following disclaimer in the
     17  1.2.2.2  rmind  *    documentation and/or other materials provided with the distribution.
     18  1.2.2.2  rmind  *
     19  1.2.2.2  rmind  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  1.2.2.2  rmind  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.2.2.2  rmind  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.2.2.2  rmind  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  1.2.2.2  rmind  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.2.2.2  rmind  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.2.2.2  rmind  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.2.2.2  rmind  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.2.2.2  rmind  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.2.2.2  rmind  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.2.2.2  rmind  * POSSIBILITY OF SUCH DAMAGE.
     30  1.2.2.2  rmind  */
     31  1.2.2.2  rmind 
     32  1.2.2.2  rmind #include <sys/cdefs.h>
     33  1.2.2.2  rmind __KERNEL_RCSID(0, "$NetBSD: xsh.c,v 1.2.2.2 2013/08/28 23:59:10 rmind Exp $");
     34  1.2.2.2  rmind 
     35  1.2.2.2  rmind /*
     36  1.2.2.2  rmind  * X-Surf 100 driver.
     37  1.2.2.2  rmind  */
     38  1.2.2.2  rmind 
     39  1.2.2.2  rmind #include <sys/param.h>
     40  1.2.2.2  rmind #include <sys/device.h>
     41  1.2.2.2  rmind #include <sys/malloc.h>
     42  1.2.2.2  rmind #include <sys/socket.h>
     43  1.2.2.2  rmind #include <sys/systm.h>
     44  1.2.2.2  rmind #include <sys/bus.h>
     45  1.2.2.2  rmind 
     46  1.2.2.2  rmind #include <amiga/amiga/device.h>
     47  1.2.2.2  rmind #include <amiga/amiga/isr.h>
     48  1.2.2.2  rmind 
     49  1.2.2.2  rmind #include <amiga/dev/zbusvar.h>
     50  1.2.2.2  rmind #include <amiga/dev/xshvar.h>
     51  1.2.2.2  rmind 
     52  1.2.2.2  rmind int	xsh_match(device_t, cfdata_t , void *);
     53  1.2.2.2  rmind void	xsh_attach(device_t, device_t, void *);
     54  1.2.2.2  rmind static int xsh_print(void *, const char *);
     55  1.2.2.2  rmind 
     56  1.2.2.2  rmind struct xsh_softc {
     57  1.2.2.2  rmind 	device_t sc_dev;
     58  1.2.2.2  rmind };
     59  1.2.2.2  rmind 
     60  1.2.2.2  rmind CFATTACH_DECL_NEW(xsh, sizeof(struct xsh_softc),
     61  1.2.2.2  rmind     xsh_match, xsh_attach, NULL, NULL);
     62  1.2.2.2  rmind 
     63  1.2.2.2  rmind #define XSURF100_NE_OFFSET		0x0800
     64  1.2.2.2  rmind 
     65  1.2.2.2  rmind int
     66  1.2.2.2  rmind xsh_match(device_t parent, cfdata_t cf, void *aux)
     67  1.2.2.2  rmind {
     68  1.2.2.2  rmind 	struct zbus_args *zap = aux;
     69  1.2.2.2  rmind 
     70  1.2.2.2  rmind 	/* X-surf 100 ethernet card */
     71  1.2.2.2  rmind 	if (zap->manid == 4626 && zap->prodid == 100)
     72  1.2.2.2  rmind 		return (1);
     73  1.2.2.2  rmind 
     74  1.2.2.2  rmind 	return (0);
     75  1.2.2.2  rmind }
     76  1.2.2.2  rmind 
     77  1.2.2.2  rmind void
     78  1.2.2.2  rmind xsh_attach(device_t parent, device_t self, void *aux)
     79  1.2.2.2  rmind {
     80  1.2.2.2  rmind 	struct xsh_softc *sc;
     81  1.2.2.2  rmind 	struct xshbus_attach_args xaa_ne;
     82  1.2.2.2  rmind 
     83  1.2.2.2  rmind 	struct zbus_args *zap = aux;
     84  1.2.2.2  rmind 
     85  1.2.2.2  rmind 	sc = device_private(self);
     86  1.2.2.2  rmind 	sc->sc_dev = self;
     87  1.2.2.2  rmind 
     88  1.2.2.2  rmind 	aprint_normal(": Individual Computers X-Surf 100\n");
     89  1.2.2.2  rmind 
     90  1.2.2.2  rmind 	/* Add ne(4). */
     91  1.2.2.2  rmind 	xaa_ne.xaa_base = (bus_addr_t)zap->va + XSURF100_NE_OFFSET;
     92  1.2.2.2  rmind 	strcpy(xaa_ne.xaa_name, "ne_xsh");
     93  1.2.2.2  rmind 	config_found_ia(sc->sc_dev, "xshbus", &xaa_ne, xsh_print);
     94  1.2.2.2  rmind 
     95  1.2.2.2  rmind 	/* TODO: add USB module... */
     96  1.2.2.2  rmind }
     97  1.2.2.2  rmind 
     98  1.2.2.2  rmind static int
     99  1.2.2.2  rmind xsh_print(void *aux, const char *w)
    100  1.2.2.2  rmind {
    101  1.2.2.2  rmind 	if (w == NULL)
    102  1.2.2.2  rmind 		return 0;
    103  1.2.2.2  rmind 
    104  1.2.2.2  rmind 	return 0;
    105  1.2.2.2  rmind }
    106  1.2.2.2  rmind 
    107