Deleted Added
full compact
if_hme_sbus.c (133599) if_hme_sbus.c (137982)
1/*-
2 * Copyright (c) 1999 The NetBSD Foundation, Inc.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by Paul Kranenburg.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 23 unchanged lines hidden (view full) ---

32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 *
36 * from: NetBSD: if_hme_sbus.c,v 1.19 2004/03/17 17:04:58 pk Exp
37 */
38
39#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1999 The NetBSD Foundation, Inc.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by Paul Kranenburg.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 23 unchanged lines hidden (view full) ---

32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 *
36 * from: NetBSD: if_hme_sbus.c,v 1.19 2004/03/17 17:04:58 pk Exp
37 */
38
39#include <sys/cdefs.h>
40__FBSDID("$FreeBSD: head/sys/dev/hme/if_hme_sbus.c 133599 2004-08-12 20:37:02Z marius $");
40__FBSDID("$FreeBSD: head/sys/dev/hme/if_hme_sbus.c 137982 2004-11-22 06:46:30Z yongari $");
41
42/*
43 * SBus front-end device driver for the HME ethernet device.
44 */
45
46#include <sys/param.h>
47#include <sys/systm.h>
48#include <sys/bus.h>

--- 98 unchanged lines hidden (view full) ---

147hme_sbus_attach(device_t dev)
148{
149 struct hme_sbus_softc *hsc = device_get_softc(dev);
150 struct hme_softc *sc = &hsc->hsc_hme;
151 u_int32_t burst;
152 u_long start, count;
153 int error = 0;
154
41
42/*
43 * SBus front-end device driver for the HME ethernet device.
44 */
45
46#include <sys/param.h>
47#include <sys/systm.h>
48#include <sys/bus.h>

--- 98 unchanged lines hidden (view full) ---

147hme_sbus_attach(device_t dev)
148{
149 struct hme_sbus_softc *hsc = device_get_softc(dev);
150 struct hme_softc *sc = &hsc->hsc_hme;
151 u_int32_t burst;
152 u_long start, count;
153 int error = 0;
154
155 mtx_init(&sc->sc_lock, device_get_nameunit(dev), MTX_NETWORK_LOCK,
156 MTX_DEF);
155 /*
156 * Map five register banks:
157 *
158 * bank 0: HME SEB registers
159 * bank 1: HME ETX registers
160 * bank 2: HME ERX registers
161 * bank 3: HME MAC registers
162 * bank 4: HME MIF registers
163 *
164 */
165 hsc->hsc_seb_rid = 0;
166 hsc->hsc_seb_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
167 &hsc->hsc_seb_rid, RF_ACTIVE);
168 if (hsc->hsc_seb_res == NULL) {
169 device_printf(dev, "cannot map SEB registers\n");
157 /*
158 * Map five register banks:
159 *
160 * bank 0: HME SEB registers
161 * bank 1: HME ETX registers
162 * bank 2: HME ERX registers
163 * bank 3: HME MAC registers
164 * bank 4: HME MIF registers
165 *
166 */
167 hsc->hsc_seb_rid = 0;
168 hsc->hsc_seb_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
169 &hsc->hsc_seb_rid, RF_ACTIVE);
170 if (hsc->hsc_seb_res == NULL) {
171 device_printf(dev, "cannot map SEB registers\n");
170 return (ENXIO);
172 error = ENXIO;
173 goto fail_mtx_res;
171 }
172 sc->sc_sebt = rman_get_bustag(hsc->hsc_seb_res);
173 sc->sc_sebh = rman_get_bushandle(hsc->hsc_seb_res);
174
175 hsc->hsc_etx_rid = 1;
176 hsc->hsc_etx_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
177 &hsc->hsc_etx_rid, RF_ACTIVE);
178 if (hsc->hsc_etx_res == NULL) {

--- 81 unchanged lines hidden (view full) ---

260 sc->sc_pci = 0; /* XXX: should all be done in bus_dma. */
261 sc->sc_dev = dev;
262
263 if ((error = hme_config(sc)) != 0) {
264 device_printf(dev, "could not be configured\n");
265 goto fail_ires;
266 }
267
174 }
175 sc->sc_sebt = rman_get_bustag(hsc->hsc_seb_res);
176 sc->sc_sebh = rman_get_bushandle(hsc->hsc_seb_res);
177
178 hsc->hsc_etx_rid = 1;
179 hsc->hsc_etx_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
180 &hsc->hsc_etx_rid, RF_ACTIVE);
181 if (hsc->hsc_etx_res == NULL) {

--- 81 unchanged lines hidden (view full) ---

263 sc->sc_pci = 0; /* XXX: should all be done in bus_dma. */
264 sc->sc_dev = dev;
265
266 if ((error = hme_config(sc)) != 0) {
267 device_printf(dev, "could not be configured\n");
268 goto fail_ires;
269 }
270
268 if ((error = bus_setup_intr(dev, hsc->hsc_ires, INTR_TYPE_NET, hme_intr,
269 sc, &hsc->hsc_ih)) != 0) {
271 if ((error = bus_setup_intr(dev, hsc->hsc_ires, INTR_TYPE_NET |
272 INTR_MPSAFE, hme_intr, sc, &hsc->hsc_ih)) != 0) {
270 device_printf(dev, "couldn't establish interrupt\n");
271 hme_detach(sc);
272 goto fail_ires;
273 }
274 return (0);
275
276fail_ires:
277 bus_release_resource(dev, SYS_RES_IRQ, hsc->hsc_irid, hsc->hsc_ires);

--- 9 unchanged lines hidden (view full) ---

287 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_erx_rid,
288 hsc->hsc_erx_res);
289fail_etx_res:
290 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_etx_rid,
291 hsc->hsc_etx_res);
292fail_seb_res:
293 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_seb_rid,
294 hsc->hsc_seb_res);
273 device_printf(dev, "couldn't establish interrupt\n");
274 hme_detach(sc);
275 goto fail_ires;
276 }
277 return (0);
278
279fail_ires:
280 bus_release_resource(dev, SYS_RES_IRQ, hsc->hsc_irid, hsc->hsc_ires);

--- 9 unchanged lines hidden (view full) ---

290 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_erx_rid,
291 hsc->hsc_erx_res);
292fail_etx_res:
293 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_etx_rid,
294 hsc->hsc_etx_res);
295fail_seb_res:
296 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_seb_rid,
297 hsc->hsc_seb_res);
298fail_mtx_res:
299 mtx_destroy(&sc->sc_lock);
295 return (error);
296}
297
298static int
299hme_sbus_detach(device_t dev)
300{
301 struct hme_sbus_softc *hsc = device_get_softc(dev);
302 struct hme_softc *sc = &hsc->hsc_hme;
303
300 return (error);
301}
302
303static int
304hme_sbus_detach(device_t dev)
305{
306 struct hme_sbus_softc *hsc = device_get_softc(dev);
307 struct hme_softc *sc = &hsc->hsc_hme;
308
304 hme_detach(sc);
305
306 bus_teardown_intr(dev, hsc->hsc_ires, hsc->hsc_ih);
309 bus_teardown_intr(dev, hsc->hsc_ires, hsc->hsc_ih);
310 hme_detach(sc);
307 if (hsc->hsc_mif_res != NULL) {
308 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_mif_rid,
309 hsc->hsc_mif_res);
310 }
311 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_mac_rid,
312 hsc->hsc_mac_res);
313 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_erx_rid,
314 hsc->hsc_erx_res);
315 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_etx_rid,
316 hsc->hsc_etx_res);
317 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_seb_rid,
318 hsc->hsc_seb_res);
311 if (hsc->hsc_mif_res != NULL) {
312 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_mif_rid,
313 hsc->hsc_mif_res);
314 }
315 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_mac_rid,
316 hsc->hsc_mac_res);
317 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_erx_rid,
318 hsc->hsc_erx_res);
319 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_etx_rid,
320 hsc->hsc_etx_res);
321 bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_seb_rid,
322 hsc->hsc_seb_res);
323 mtx_destroy(&sc->sc_lock);
319 return (0);
320}
321
322static int
323hme_sbus_suspend(device_t dev)
324{
325 struct hme_sbus_softc *hsc = device_get_softc(dev);
326 struct hme_softc *sc = &hsc->hsc_hme;

--- 14 unchanged lines hidden ---
324 return (0);
325}
326
327static int
328hme_sbus_suspend(device_t dev)
329{
330 struct hme_sbus_softc *hsc = device_get_softc(dev);
331 struct hme_softc *sc = &hsc->hsc_hme;

--- 14 unchanged lines hidden ---