if_snc_cbus.c (166901) | if_snc_cbus.c (181298) |
---|---|
1/*- 2 * Copyright (c) 1995, David Greenman 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1995, David Greenman 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/dev/snc/if_snc_cbus.c 166901 2007-02-23 12:19:07Z piso $"); | 30__FBSDID("$FreeBSD: head/sys/dev/snc/if_snc_cbus.c 181298 2008-08-04 19:19:18Z jhb $"); |
31 32/* 33 * National Semiconductor DP8393X SONIC Driver 34 * 35 * This is the C-bus specific attachment on FreeBSD 36 * written by Motomichi Matsuzaki <mzaki@e-mail.ne.jp> 37 */ 38 --- 106 unchanged lines hidden (view full) --- 145 int port; 146 int rid = 0; 147 struct resource *res = NULL; 148 149 for (port = 0x0888; port <= 0x3888; port += 0x1000) { 150 bus_set_resource(dev, SYS_RES_IOPORT, rid, 151 port, SNEC_NREGS); 152 res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, | 31 32/* 33 * National Semiconductor DP8393X SONIC Driver 34 * 35 * This is the C-bus specific attachment on FreeBSD 36 * written by Motomichi Matsuzaki <mzaki@e-mail.ne.jp> 37 */ 38 --- 106 unchanged lines hidden (view full) --- 145 int port; 146 int rid = 0; 147 struct resource *res = NULL; 148 149 for (port = 0x0888; port <= 0x3888; port += 0x1000) { 150 bus_set_resource(dev, SYS_RES_IOPORT, rid, 151 port, SNEC_NREGS); 152 res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, |
153 0, ~0, SNEC_NREGS, | 153 0ul, ~0ul, SNEC_NREGS, |
154 0 /* !RF_ACTIVE */); 155 if (res) break; 156 } 157 158 printf("snc_isa_probe: broken PnP resource, "); 159 if (res) { 160 printf("use port 0x%x\n", port); 161 bus_release_resource(dev, SYS_RES_IOPORT, rid, res); --- 14 unchanged lines hidden (view full) --- 176 return (error); 177} 178 179static int 180snc_isa_attach(dev) 181 device_t dev; 182{ 183 struct snc_softc *sc = device_get_softc(dev); | 154 0 /* !RF_ACTIVE */); 155 if (res) break; 156 } 157 158 printf("snc_isa_probe: broken PnP resource, "); 159 if (res) { 160 printf("use port 0x%x\n", port); 161 bus_release_resource(dev, SYS_RES_IOPORT, rid, res); --- 14 unchanged lines hidden (view full) --- 176 return (error); 177} 178 179static int 180snc_isa_attach(dev) 181 device_t dev; 182{ 183 struct snc_softc *sc = device_get_softc(dev); |
184 int error; | |
185 186 bzero(sc, sizeof(struct snc_softc)); 187 188 snc_alloc_port(dev, 0); 189 snc_alloc_memory(dev, 0); 190 snc_alloc_irq(dev, 0, 0); 191 | 184 185 bzero(sc, sizeof(struct snc_softc)); 186 187 snc_alloc_port(dev, 0); 188 snc_alloc_memory(dev, 0); 189 snc_alloc_irq(dev, 0, 0); 190 |
192 error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET, 193 NULL, sncintr, sc, &sc->irq_handle); 194 if (error) { 195 printf("snc_isa_attach: bus_setup_intr() failed\n"); 196 snc_release_resources(dev); 197 return (error); 198 } 199 | |
200 /* This interface is always enabled. */ 201 sc->sc_enabled = 1; 202 203 return snc_attach(dev); 204} 205 206static device_method_t snc_isa_methods[] = { 207 /* Device interface */ --- 16 unchanged lines hidden --- | 191 /* This interface is always enabled. */ 192 sc->sc_enabled = 1; 193 194 return snc_attach(dev); 195} 196 197static device_method_t snc_isa_methods[] = { 198 /* Device interface */ --- 16 unchanged lines hidden --- |