Deleted Added
full compact
if_fxp.c (114195) if_fxp.c (114269)
1/*-
2 * Copyright (c) 1995, David Greenman
3 * Copyright (c) 2001 Jonathan Lemon <jlemon@freebsd.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

27 *
28 */
29
30/*
31 * Intel EtherExpress Pro/100B PCI Fast Ethernet driver
32 */
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1995, David Greenman
3 * Copyright (c) 2001 Jonathan Lemon <jlemon@freebsd.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

27 *
28 */
29
30/*
31 * Intel EtherExpress Pro/100B PCI Fast Ethernet driver
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/dev/fxp/if_fxp.c 114195 2003-04-29 05:47:14Z imp $");
35__FBSDID("$FreeBSD: head/sys/dev/fxp/if_fxp.c 114269 2003-04-30 01:54:38Z imp $");
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/endian.h>
40#include <sys/mbuf.h>
41 /* #include <sys/mutex.h> */
42#include <sys/kernel.h>
43#include <sys/socket.h>

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

876fxp_detach(device_t dev)
877{
878 struct fxp_softc *sc = device_get_softc(dev);
879 int s;
880
881 FXP_LOCK(sc);
882 s = splimp();
883
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/endian.h>
40#include <sys/mbuf.h>
41 /* #include <sys/mutex.h> */
42#include <sys/kernel.h>
43#include <sys/socket.h>

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

876fxp_detach(device_t dev)
877{
878 struct fxp_softc *sc = device_get_softc(dev);
879 int s;
880
881 FXP_LOCK(sc);
882 s = splimp();
883
884 sc->gone = 1;
884 sc->suspend = 1; /* Do same thing as we do for suspend */
885 /*
886 * Close down routes etc.
887 */
888 ether_ifdetach(&sc->arpcom.ac_if);
889
890 /*
891 * Stop DMA and drop transmit queue, but disable interrupts first.
892 */

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

1494 */
1495static void
1496fxp_intr(void *xsc)
1497{
1498 struct fxp_softc *sc = xsc;
1499 struct ifnet *ifp = &sc->sc_if;
1500 u_int8_t statack;
1501
885 /*
886 * Close down routes etc.
887 */
888 ether_ifdetach(&sc->arpcom.ac_if);
889
890 /*
891 * Stop DMA and drop transmit queue, but disable interrupts first.
892 */

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

1494 */
1495static void
1496fxp_intr(void *xsc)
1497{
1498 struct fxp_softc *sc = xsc;
1499 struct ifnet *ifp = &sc->sc_if;
1500 u_int8_t statack;
1501
1502 if (sc->gone)
1502 FXP_LOCK(sc);
1503 if (sc->suspended) {
1504 FXP_UNLOCK(sc);
1503 return;
1505 return;
1506 }
1504
1507
1505 FXP_LOCK(sc);
1506#ifdef DEVICE_POLLING
1507 if (ifp->if_flags & IFF_POLLING) {
1508 FXP_UNLOCK(sc);
1509 return;
1510 }
1511 if (ether_poll_register(fxp_poll, ifp)) {
1512 /* disable interrupts */
1513 CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE);
1514 fxp_poll(ifp, 0, 1);
1515 FXP_UNLOCK(sc);
1516 return;
1517 }
1518#endif
1508#ifdef DEVICE_POLLING
1509 if (ifp->if_flags & IFF_POLLING) {
1510 FXP_UNLOCK(sc);
1511 return;
1512 }
1513 if (ether_poll_register(fxp_poll, ifp)) {
1514 /* disable interrupts */
1515 CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE);
1516 fxp_poll(ifp, 0, 1);
1517 FXP_UNLOCK(sc);
1518 return;
1519 }
1520#endif
1519
1520 if (sc->suspended) {
1521 FXP_UNLOCK(sc);
1522 return;
1523 }
1524
1525 while ((statack = CSR_READ_1(sc, FXP_CSR_SCB_STATACK)) != 0) {
1526 /*
1527 * It should not be possible to have all bits set; the
1528 * FXP_SCB_INTR_SWI bit always returns 0 on a read. If
1529 * all bits are set, this may indicate that the card has
1530 * been physically ejected, so ignore it.
1531 */
1532 if (statack == 0xff) {

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

2357static int
2358fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
2359{
2360 struct fxp_softc *sc = ifp->if_softc;
2361 struct ifreq *ifr = (struct ifreq *)data;
2362 struct mii_data *mii;
2363 int s, error = 0;
2364
1521 while ((statack = CSR_READ_1(sc, FXP_CSR_SCB_STATACK)) != 0) {
1522 /*
1523 * It should not be possible to have all bits set; the
1524 * FXP_SCB_INTR_SWI bit always returns 0 on a read. If
1525 * all bits are set, this may indicate that the card has
1526 * been physically ejected, so ignore it.
1527 */
1528 if (statack == 0xff) {

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

2353static int
2354fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
2355{
2356 struct fxp_softc *sc = ifp->if_softc;
2357 struct ifreq *ifr = (struct ifreq *)data;
2358 struct mii_data *mii;
2359 int s, error = 0;
2360
2365 if (sc->gone)
2366 return (ENODEV);
2361 /*
2362 * Detaching causes us to call ioctl with the mutex owned. Preclude
2363 * that by saying we're busy if the lock is already held.
2364 */
2365 if (mtx_owned(&sc->sc_mtx))
2366 return (EBUSY);
2367
2368 FXP_LOCK(sc);
2369 s = splimp();
2370
2371 switch (command) {
2372 case SIOCSIFFLAGS:
2373 if (ifp->if_flags & IFF_ALLMULTI)
2374 sc->flags |= FXP_FLAG_ALL_MCAST;

--- 305 unchanged lines hidden ---
2367
2368 FXP_LOCK(sc);
2369 s = splimp();
2370
2371 switch (command) {
2372 case SIOCSIFFLAGS:
2373 if (ifp->if_flags & IFF_ALLMULTI)
2374 sc->flags |= FXP_FLAG_ALL_MCAST;

--- 305 unchanged lines hidden ---