1 /* $NetBSD: if_en.c,v 1.26 2009/09/17 16:28:12 tsutsui Exp $ */
5 * Copyright (c) 1996 Charles D. Cranor and Washington University.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Charles D. Cranor and
19 * Washington University.
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
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.
37 * i f _ e n _ s b u s . c
39 * author: Chuck Cranor <chuck@ccrc.wustl.edu>
40 * started: spring, 1996.
42 * SBUS glue for the eni155s card.
45 #include <sys/cdefs.h>
46 __KERNEL_RCSID(0, "$NetBSD: if_en.c,v 1.26 2009/09/17 16:28:12 tsutsui Exp $");
48 #include <sys/param.h>
49 #include <sys/systm.h>
50 #include <sys/device.h>
52 #include <sys/socket.h>
53 #include <sys/socketvar.h>
61 #include <dev/sbus/sbusvar.h>
63 #include <dev/ic/midwayreg.h>
64 #include <dev/ic/midwayvar.h>
70 struct en_sbus_softc
{
71 /* bus independent stuff */
72 struct en_softc sc_en
; /* includes "device" structure */
81 static int en_sbus_match(device_t
, cfdata_t
, void *);
82 static void en_sbus_attach(device_t
, device_t
, void *);
85 * SBus autoconfig attachments
88 CFATTACH_DECL(en_sbus
, sizeof(struct en_sbus_softc
),
89 en_sbus_match
, en_sbus_attach
, NULL
, NULL
);
91 /***********************************************************************/
98 en_sbus_match(device_t parent
, cfdata_t cf
, void *aux
)
100 struct sbus_attach_args
*sa
= aux
;
102 if (strcmp("ENI-155s", sa
->sa_name
) == 0) {
105 printf("%s: sun4m DMA not supported yet\n",
118 en_sbus_attach(device_t parent
, device_t self
, void *aux
)
120 struct sbus_attach_args
*sa
= aux
;
121 struct en_sbus_softc
*ssc
= device_private(self
);
122 struct en_softc
*sc
= &ssc
->sc_en
;
126 if (sbus_bus_map(sa
->sa_bustag
,
130 0, &sc
->en_base
) != 0) {
131 aprint_error_dev(self
, "cannot map registers\n");
135 /* Establish interrupt handler */
136 if (sa
->sa_nintr
!= 0)
137 (void)bus_intr_establish(sa
->sa_bustag
, sa
->sa_pri
,
138 IPL_NET
, en_intr
, sc
);
140 sc
->ipl
= sa
->sa_pri
; /* appropriate? */
143 * done SBUS specific stuff