summaryrefslogtreecommitdiffstats
path: root/sys/dev/fe
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1997-10-26 04:36:24 +0000
committernate <nate@FreeBSD.org>1997-10-26 04:36:24 +0000
commitc68183d0b8cb8cb595c0fac05b6d989132543595 (patch)
tree3e3880b90341465871c326ce768b275780757e2d /sys/dev/fe
parentbc21da1f3f59930a96cd6829bfaf0147d28b7754 (diff)
downloadFreeBSD-src-c68183d0b8cb8cb595c0fac05b6d989132543595.zip
FreeBSD-src-c68183d0b8cb8cb595c0fac05b6d989132543595.tar.gz
- Do a bunch of gratuitous changes intended to make the code easier to
follow. * Rename/reorder all of the pccard structures, change many of the member names to be descriptive, and follow more closely other 'bus' drivers naming schemes. * Rename a bunch of parameter and local variable names to be more consistant in the code. * Renamed the PCCARD 'crd' device to be the 'card' device * KNF and make the code consistant where it was obvious. * ifdef'd out some unused code
Diffstat (limited to 'sys/dev/fe')
-rw-r--r--sys/dev/fe/if_fe.c111
1 files changed, 55 insertions, 56 deletions
diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c
index b53bfe7..00c1b70 100644
--- a/sys/dev/fe/if_fe.c
+++ b/sys/dev/fe/if_fe.c
@@ -21,7 +21,7 @@
*/
/*
- * $Id: if_fe.c,v 1.28 1997/03/24 11:32:49 bde Exp $
+ * $Id: if_fe.c,v 1.29 1997/07/20 14:09:59 bde Exp $
*
* Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards.
* To be used with FreeBSD 2.x
@@ -71,7 +71,6 @@
*/
#include "fe.h"
-#include "crd.h"
#include "bpfilter.h"
#include <sys/param.h>
@@ -120,7 +119,8 @@
#include <i386/isa/icu.h>
/* PCCARD suport */
-#if NCRD > 0
+#include "card.h"
+#if NCARD > 0
#include <sys/select.h>
#include <pccard/card.h>
#include <pccard/slot.h>
@@ -247,7 +247,7 @@ static int fe_probe_fmv ( DEVICE *, struct fe_softc * );
static int fe_probe_ati ( DEVICE *, struct fe_softc * );
static void fe_init_ati ( struct fe_softc * );
static int fe_probe_gwy ( DEVICE *, struct fe_softc * );
-#if NCRD > 0
+#if NCARD > 0
static int fe_probe_mbh ( DEVICE *, struct fe_softc * );
static void fe_init_mbh ( struct fe_softc * );
static int fe_probe_tdk ( DEVICE *, struct fe_softc * );
@@ -318,52 +318,41 @@ outblk ( struct fe_softc * sc, int offs, u_char const * mem, int len )
}
/* PCCARD Support */
-#if NCRD > 0
+#if NCARD > 0
/*
* PC-Card (PCMCIA) specific code.
*/
-static int fe_card_intr(struct pccard_dev *); /* Interrupt handler */
-static void feunload(struct pccard_dev *); /* Disable driver */
-static void fesuspend(struct pccard_dev *); /* Suspend driver */
-static int feinit(struct pccard_dev *, int); /* init device */
+static int feinit(struct pccard_devinfo *, int); /* init device */
+static void feunload(struct pccard_devinfo *); /* Disable driver */
+static int fe_card_intr(struct pccard_devinfo *); /* Interrupt handler */
+static void fesuspend(struct pccard_devinfo *); /* Suspend driver */
-static struct pccard_drv fe_info = {
+static struct pccard_device fe_info = {
"fe",
- fe_card_intr,
+ feinit,
feunload,
+ fe_card_intr,
fesuspend,
- feinit,
0, /* Attributes - presently unused */
&net_imask /* Interrupt mask for device */
/* XXX - Should this also include net_imask? */
};
/*
- * Called when a power down is requested. Shuts down the
- * device and configures the device as unavailable (but
- * still loaded...). A resume is done by calling
- * feinit with first=0. This is called when the user suspends
- * the system, or the APM code suspends the system.
- */
-static void
-fesuspend(struct pccard_dev *dp)
-{
- printf("fe%d: suspending\n", dp->isahd.id_unit);
-}
-
-/*
- * Initialize the device - called from Slot manager.
+ * Initialize the device - called from Slot manager.
+ *
* if first is set, then initially check for
* the device's existence before initializing it.
* Once initialized, the device table may be set up.
*/
static int
-feinit(struct pccard_dev *dp, int first)
+feinit(struct pccard_devinfo *devi, int first)
{
- /* validate unit number. */
struct fe_softc *sc;
+
+ /* validate unit number. */
if (first) {
- if (dp->isahd.id_unit >= NFE)
+ if (devi->isahd.id_unit >= NFE)
return (ENODEV);
/*
* Probe the device. If a value is returned,
@@ -373,28 +362,28 @@ feinit(struct pccard_dev *dp, int first)
printf("Start Probe\n");
#endif
/* Initialize "minimum" parts of our softc. */
- sc = &fe_softc[dp->isahd.id_unit];
- sc->sc_unit = dp->isahd.id_unit;
- sc->iobase = dp->isahd.id_iobase;
+ sc = &fe_softc[devi->isahd.id_unit];
+ sc->sc_unit = devi->isahd.id_unit;
+ sc->iobase = devi->isahd.id_iobase;
/* Use Ethernet address got from CIS, if one is available. */
- if ((dp->misc[0] & 0x03) == 0x00
- && (dp->misc[0] | dp->misc[1] | dp->misc[2]) != 0) {
+ if ((devi->misc[0] & 0x03) == 0x00
+ && (devi->misc[0] | devi->misc[1] | devi->misc[2]) != 0) {
/* Yes, it looks like a valid Ether address. */
- bcopy(dp->misc, sc->sc_enaddr, ETHER_ADDR_LEN);
+ bcopy(devi->misc, sc->sc_enaddr, ETHER_ADDR_LEN);
} else {
/* Indicate we have no Ether address in CIS. */
bzero(sc->sc_enaddr, ETHER_ADDR_LEN);
}
/* Probe supported PC card models. */
- if (fe_probe_tdk(&dp->isahd, sc) == 0
- && fe_probe_mbh(&dp->isahd, sc) == 0)
+ if (fe_probe_tdk(&devi->isahd, sc) == 0 &&
+ fe_probe_mbh(&devi->isahd, sc) == 0)
return (ENXIO);
#if FE_DEBUG >= 2
printf("Start attach\n");
#endif
- if (fe_attach(&dp->isahd) == 0)
+ if (fe_attach(&devi->isahd) == 0)
return (ENXIO);
}
/*
@@ -417,11 +406,11 @@ feinit(struct pccard_dev *dp, int first)
* read and write do not hang.
*/
static void
-feunload(struct pccard_dev *dp)
+feunload(struct pccard_devinfo *devi)
{
- struct fe_softc *sc = &fe_softc[dp->isahd.id_unit];
- printf("fe%d: unload\n", dp->isahd.id_unit);
- fe_stop(dp->isahd.id_unit);
+ struct fe_softc *sc = &fe_softc[devi->isahd.id_unit];
+ printf("fe%d: unload\n", devi->isahd.id_unit);
+ fe_stop(devi->isahd.id_unit);
}
/*
@@ -429,12 +418,25 @@ feunload(struct pccard_dev *dp)
* front end of PC-Card handler.
*/
static int
-fe_card_intr(struct pccard_dev *dp)
+fe_card_intr(struct pccard_devinfo *devi)
{
- feintr(dp->isahd.id_unit);
+ feintr(devi->isahd.id_unit);
return (1);
}
-#endif /* NCRD > 0 */
+
+/*
+ * Called when a power down is requested. Shuts down the
+ * device and configures the device as unavailable (but
+ * still loaded...). A resume is done by calling
+ * feinit with first=0. This is called when the user suspends
+ * the system, or the APM code suspends the system.
+ */
+static void
+fesuspend(struct pccard_devinfo *devi)
+{
+ printf("fe%d: suspending\n", devi->isahd.id_unit);
+}
+#endif /* NCARD > 0 */
/*
@@ -476,7 +478,7 @@ static struct fe_probe_list const fe_probe_list [] =
static int
fe_probe ( DEVICE * dev )
{
-#if NCRD > 0
+#if NCARD > 0
static int fe_already_init;
#endif
struct fe_softc * sc;
@@ -490,7 +492,7 @@ fe_probe ( DEVICE * dev )
sc = &fe_softc[ dev->id_unit ];
sc->sc_unit = dev->id_unit;
-#if NCRD > 0
+#if NCARD > 0
/*
* If PC-Card probe required, then register driver with
* slot manager.
@@ -499,7 +501,7 @@ fe_probe ( DEVICE * dev )
pccard_add_driver(&fe_info);
fe_already_init = 1;
}
-#endif /* NCRD > 0 */
+#endif
/* Probe each possibility, one at a time. */
for ( list = fe_probe_list; list->probe != NULL; list++ ) {
@@ -1239,7 +1241,7 @@ fe_probe_gwy ( DEVICE * dev, struct fe_softc * sc )
return 32;
}
-#if NCRD > 0
+#if NCARD > 0
/*
* Probe and initialization for Fujitsu MBH10302 PCMCIA Ethernet interface.
* Note that this is for 10302 only; MBH10304 is handled by fe_probe_tdk().
@@ -1371,9 +1373,6 @@ fe_init_mbh ( struct fe_softc * sc )
outb( sc->ioaddr[ FE_MBH0 ], FE_MBH0_MAGIC | FE_MBH0_INTR_ENABLE );
}
-#endif /* NCRD > 0 */
-
-#if NCRD > 0
/*
* Probe and initialization for TDK/CONTEC PCMCIA Ethernet interface.
* by MASUI Kenji <masui@cs.titech.ac.jp>
@@ -1476,7 +1475,7 @@ fe_probe_tdk ( DEVICE * dev, struct fe_softc * sc )
*/
return 16;
}
-#endif
+#endif /* NCARD > 0 */
/*
* Install interface into kernel networking data structures
@@ -1484,7 +1483,7 @@ fe_probe_tdk ( DEVICE * dev, struct fe_softc * sc )
static int
fe_attach ( DEVICE * dev )
{
-#if NCRD > 0
+#if NCARD > 0
static int already_ifattach[NFE];
#endif
struct fe_softc *sc = &fe_softc[dev->id_unit];
@@ -1552,14 +1551,14 @@ fe_attach ( DEVICE * dev )
}
/* Attach and stop the interface. */
-#if NCRD > 0
+#if NCARD > 0
if (already_ifattach[dev->id_unit] != 1) {
if_attach(&sc->sc_if);
already_ifattach[dev->id_unit] = 1;
}
#else
if_attach(&sc->sc_if);
-#endif /* NCRD > 0 */
+#endif
fe_stop(sc->sc_unit); /* This changes the state to IDLE. */
ether_ifattach(&sc->sc_if);
OpenPOWER on IntegriCloud