aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorNate Williams <nate@FreeBSD.org>1997-10-26 04:36:24 +0000
committerNate Williams <nate@FreeBSD.org>1997-10-26 04:36:24 +0000
commite7e437dbfa04db08906b0d7ae1c4b394ce5151a7 (patch)
tree65372dc70bbd634789726a2fbf26d1cb1b084936 /sys/dev
parent6d9fc55f8db0f1b4c7b0ec45b49f2f447e9daca7 (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ed/if_ed.c100
-rw-r--r--sys/dev/ep/if_ep.c103
-rw-r--r--sys/dev/fe/if_fe.c111
-rw-r--r--sys/dev/sio/sio.c82
4 files changed, 195 insertions, 201 deletions
diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c
index 7b632b7e35012..d839ebad09e7a 100644
--- a/sys/dev/ed/if_ed.c
+++ b/sys/dev/ed/if_ed.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_ed.c,v 1.121 1997/09/10 00:17:39 davidg Exp $
+ * $Id: if_ed.c,v 1.122 1997/10/03 16:26:15 davidg Exp $
*/
/*
@@ -151,8 +151,8 @@ static int ed_probe_HP_pclanp __P((struct isa_device *));
void *ed_attach_NE2000_pci __P((int, int));
#endif
-#include "crd.h"
-#if NCRD > 0
+#include "card.h"
+#if NCARD > 0
static int ed_probe_pccard __P((struct isa_device *, u_char *));
#endif
@@ -182,7 +182,7 @@ static void ed_setrcr(struct ed_softc *);
static u_long ds_crc(u_char *ep);
-#if NCRD > 0
+#if NCARD > 0
#include <sys/select.h>
#include <pccard/card.h>
#include <pccard/driver.h>
@@ -191,68 +191,46 @@ static u_long ds_crc(u_char *ep);
/*
* PC-Card (PCMCIA) specific code.
*/
-static int card_intr(struct pccard_dev *); /* Interrupt handler */
-static void edunload(struct pccard_dev *); /* Disable driver */
-static void edsuspend(struct pccard_dev *); /* Suspend driver */
-static int edinit(struct pccard_dev *, int); /* init device */
+static int edinit(struct pccard_devinfo *, int); /* init device */
+static void edunload(struct pccard_devinfo *); /* Disable driver */
+static int card_intr(struct pccard_devinfo *); /* Interrupt handler */
+static void edsuspend(struct pccard_devinfo *); /* Suspend driver */
-static struct pccard_drv ed_info = {
+static struct pccard_device ed_info = {
"ed",
- card_intr,
+ edinit,
edunload,
+ card_intr,
edsuspend,
- edinit,
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
- * edinit with first=0. This is called when the user suspends
- * the system, or the APM code suspends the system.
- */
-static void
-edsuspend(struct pccard_dev *dp)
-{
- struct ed_softc *sc = &ed_softc[dp->isahd.id_unit];
- /*
- * Some 'ed' cards will generate a interrupt as they go away,
- * and by the time the interrupt handler gets to the card,
- * the interrupt can't be cleared.
- * By setting gone here, we tell the handler to ignore the
- * interrupt when it happens.
- */
- sc->gone = 1; /* avoid spinning endlessly in interrupt handler */
-
- printf("ed%d: suspending\n", dp->isahd.id_unit);
-}
-
-/*
* Initialize the device - called from Slot manager.
+ *
* If first is set, then check for the device's existence
* before initializing it. Once initialized, the device table may
* be set up.
*/
static int
-edinit(struct pccard_dev *dp, int first)
+edinit(struct pccard_devinfo *devi, int first)
{
- struct ed_softc *sc = &ed_softc[dp->isahd.id_unit];
+ struct ed_softc *sc = &ed_softc[devi->isahd.id_unit];
/* validate unit number. */
if (first) {
- if (dp->isahd.id_unit >= NED)
+ if (devi->isahd.id_unit >= NED)
return(ENODEV);
/*
* Probe the device. If a value is returned, the
* device was found at the location.
*/
sc->gone = 0;
- if (ed_probe_pccard(&dp->isahd,dp->misc)==0)
+ if (ed_probe_pccard(&devi->isahd, devi->misc) == 0)
return(ENXIO);
- if (ed_attach_isa(&dp->isahd)==0)
+ if (ed_attach_isa(&devi->isahd) == 0)
return(ENXIO);
} else {
sc->gone = 0; /* reenable after a suspend */
@@ -277,19 +255,19 @@ edinit(struct pccard_dev *dp, int first)
* read and write do not hang.
*/
static void
-edunload(struct pccard_dev *dp)
+edunload(struct pccard_devinfo *devi)
{
- struct ed_softc *sc = &ed_softc[dp->isahd.id_unit];
+ struct ed_softc *sc = &ed_softc[devi->isahd.id_unit];
struct ifnet *ifp = &sc->arpcom.ac_if;
if (sc->gone) {
- printf("ed%d: already unloaded\n", dp->isahd.id_unit);
+ printf("ed%d: already unloaded\n", devi->isahd.id_unit);
return;
}
ifp->if_flags &= ~IFF_RUNNING;
if_down(ifp);
sc->gone = 1;
- printf("ed%d: unload\n", dp->isahd.id_unit);
+ printf("ed%d: unload\n", devi->isahd.id_unit);
}
/*
@@ -297,12 +275,35 @@ edunload(struct pccard_dev *dp)
* front end of PC-Card handler.
*/
static int
-card_intr(struct pccard_dev *dp)
+card_intr(struct pccard_devinfo *devi)
{
- edintr_sc(&ed_softc[dp->isahd.id_unit]);
+ edintr_sc(&ed_softc[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
+ * edinit with first = 0. This is called when the user suspends
+ * the system, or the APM code suspends the system.
+ */
+static void
+edsuspend(struct pccard_devinfo *devi)
+{
+ struct ed_softc *sc = &ed_softc[devi->isahd.id_unit];
+ /*
+ * Some 'ed' cards will generate a interrupt as they go away,
+ * and by the time the interrupt handler gets to the card,
+ * the interrupt can't be cleared.
+ * By setting gone here, we tell the handler to ignore the
+ * interrupt when it happens.
+ */
+ sc->gone = 1; /* avoid spinning endlessly in interrupt handler */
+
+ printf("ed%d: suspending\n", devi->isahd.id_unit);
+}
+#endif /* NCARD > 0 */
struct isa_driver eddriver = {
ed_probe,
@@ -378,7 +379,7 @@ ed_probe(isa_dev)
{
int nports;
-#if NCRD > 0
+#if NCARD > 0
/*
* If PC-Card probe required, then register driver with
* slot manager.
@@ -1321,8 +1322,7 @@ ed_probe_Novell(isa_dev)
isa_dev->id_unit, isa_dev->id_flags);
}
-#if NCRD > 0
-
+#if NCARD > 0
/*
* Probe framework for pccards. Replicates the standard framework,
* minus the pccard driver registration and ignores the ether address
@@ -1346,7 +1346,7 @@ ed_probe_pccard(isa_dev, ether)
return (0);
}
-#endif /* NCRD > 0 */
+#endif /* NCARD > 0 */
#define ED_HPP_TEST_SIZE 16
diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c
index 992fac3e6361b..84d578ec7d960 100644
--- a/sys/dev/ep/if_ep.c
+++ b/sys/dev/ep/if_ep.c
@@ -38,7 +38,7 @@
*/
/*
- * $Id: if_ep.c,v 1.60 1997/09/02 01:18:13 bde Exp $
+ * $Id: if_ep.c,v 1.61 1997/10/14 06:56:08 itojun Exp $
*
* Promiscuous mode added and interrupt logic slightly changed
* to reduce the number of adapter failures. Transceiver select
@@ -142,9 +142,9 @@ struct isa_driver epdriver = {
0
};
-#include "crd.h"
+#include "card.h"
-#if NCRD > 0
+#if NCARD > 0
#include <sys/select.h>
#include <pccard/card.h>
#include <pccard/driver.h>
@@ -153,42 +153,31 @@ struct isa_driver epdriver = {
/*
* PC-Card (PCMCIA) specific code.
*/
-static int card_intr __P((struct pccard_dev *));
-static void ep_unload __P((struct pccard_dev *));
-static void ep_suspend __P((struct pccard_dev *));
-static int ep_pccard_init __P((struct pccard_dev *, int));
-static int ep_pccard_attach __P((struct pccard_dev *));
+static int ep_pccard_init __P((struct pccard_devinfo *, int));
+static int ep_pccard_attach __P((struct pccard_devinfo *));
+static void ep_unload __P((struct pccard_devinfo *));
+static int card_intr __P((struct pccard_devinfo *));
+static void ep_suspend __P((struct pccard_devinfo *));
-static struct pccard_drv ep_info = {
+static struct pccard_device ep_info = {
"ep",
- card_intr,
+ ep_pccard_init,
ep_unload,
+ card_intr,
ep_suspend,
- ep_pccard_init,
0, /* Attributes - presently unused */
&net_imask
};
-/* Resume is done by executing ep_pccard_init(dp, 0). */
-static void
-ep_suspend(dp)
- struct pccard_dev *dp;
-{
- struct ep_softc *sc = ep_softc[dp->isahd.id_unit];
-
- printf("ep%d: suspending\n", dp->isahd.id_unit);
- sc->gone = 1;
-}
-
/*
- *
+ * Initialize the device - called from Slot manager.
*/
static int
-ep_pccard_init(dp, first)
- struct pccard_dev *dp;
+ep_pccard_init(devi, first)
+ struct pccard_devinfo *devi;
int first;
{
- struct isa_device *is = &dp->isahd;
+ struct isa_device *is = &devi->isahd;
struct ep_softc *sc = ep_softc[is->id_unit];
struct ep_board *epb;
int i;
@@ -210,41 +199,36 @@ ep_pccard_init(dp, first)
epb->epb_used = 1;
epb->prod_id = get_e(sc, EEPROM_PROD_ID);
- if (epb->prod_id != 0x9058) { /* 3C589's product id */
- if (first) {
+ /* 3C589's product id? */
+ if (epb->prod_id != 0x9058) {
+ if (first)
printf("ep%d: failed to come ready.\n", is->id_unit);
- } else {
+ else
printf("ep%d: failed to resume.\n", is->id_unit);
- }
return (ENXIO);
}
epb->res_cfg = get_e(sc, EEPROM_RESOURCE_CFG);
- for (i = 0; i < 3; i++) {
- sc->epb->eth_addr[i] = get_e(sc, EEPROM_NODE_ADDR_0 + i);
- }
+ for (i = 0; i < 3; i++)
+ sc->epb->eth_addr[i] = get_e(sc, EEPROM_NODE_ADDR_0 + i);
if (first) {
- if (ep_pccard_attach(dp) == 0) {
+ if (ep_pccard_attach(devi) == 0)
return (ENXIO);
- }
sc->arpcom.ac_if.if_snd.ifq_maxlen = ifqmaxlen;
- }
-
- if (!first) {
+ } else {
sc->gone = 0;
printf("ep%d: resumed.\n", is->id_unit);
epinit(sc);
}
-
return (0);
}
static int
-ep_pccard_attach(dp)
- struct pccard_dev *dp;
+ep_pccard_attach(devi)
+ struct pccard_devinfo *devi;
{
- struct isa_device *is = &dp->isahd;
+ struct isa_device *is = &devi->isahd;
struct ep_softc *sc = ep_softc[is->id_unit];
u_short config;
@@ -275,18 +259,18 @@ ep_pccard_attach(dp)
}
static void
-ep_unload(dp)
- struct pccard_dev *dp;
+ep_unload(devi)
+ struct pccard_devinfo *devi;
{
- struct ep_softc *sc = ep_softc[dp->isahd.id_unit];
+ struct ep_softc *sc = ep_softc[devi->isahd.id_unit];
if (sc->gone) {
- printf("ep%d: already unloaded\n", dp->isahd.id_unit);
+ printf("ep%d: already unloaded\n", devi->isahd.id_unit);
return;
}
sc->arpcom.ac_if.if_flags &= ~IFF_RUNNING;
sc->gone = 1;
- printf("ep%d: unload\n", dp->isahd.id_unit);
+ printf("ep%d: unload\n", devi->isahd.id_unit);
}
/*
@@ -294,14 +278,24 @@ ep_unload(dp)
* front end of PC-Card handler.
*/
static int
-card_intr(dp)
- struct pccard_dev *dp;
+card_intr(devi)
+ struct pccard_devinfo *devi;
{
- epintr(dp->isahd.id_unit);
+ epintr(devi->isahd.id_unit);
return(1);
}
-#endif /* NCRD > 0 */
+/* Resume is done by executing ep_pccard_init(devi, 0). */
+static void
+ep_suspend(devi)
+ struct pccard_devinfo *devi;
+{
+ struct ep_softc *sc = ep_softc[devi->isahd.id_unit];
+
+ printf("ep%d: suspending\n", devi->isahd.id_unit);
+ sc->gone = 1;
+}
+#endif /* NCARD > 0 */
static int
eeprom_rdy(sc)
@@ -309,7 +303,8 @@ eeprom_rdy(sc)
{
int i;
- for (i = 0; is_eeprom_busy(BASE) && i < MAX_EEPROMBUSY; i++);
+ for (i = 0; is_eeprom_busy(BASE) && i < MAX_EEPROMBUSY; i++)
+ continue;
if (i >= MAX_EEPROMBUSY) {
printf("ep%d: eeprom failed to come ready.\n", sc->unit);
return (0);
@@ -500,9 +495,9 @@ ep_isa_probe(is)
struct ep_board *epb;
u_short k;
-#if NCRD > 0
+#if NCARD > 0
pccard_add_driver(&ep_info);
-#endif /* NCRD > 0 */
+#endif
if ((epb = ep_look_for_board_at(is)) == 0)
return (0);
diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c
index b53bfe7fa4efa..00c1b70948ef7 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);
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index 39c6470325589..9697556c59d61 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
- * $Id: sio.c,v 1.183 1997/09/21 21:41:40 gibbs Exp $
+ * $Id: sio.c,v 1.184 1997/10/12 20:23:30 phk Exp $
*/
#include "opt_comconsole.h"
@@ -87,8 +87,8 @@
#endif
#include <i386/isa/ic/ns16550.h>
-#include "crd.h"
-#if NCRD > 0
+#include "card.h"
+#if NCARD > 0
#include <pccard/card.h>
#include <pccard/driver.h>
#include <pccard/slot.h>
@@ -470,63 +470,50 @@ sysctl_machdep_comdefaultrate SYSCTL_HANDLER_ARGS
SYSCTL_PROC(_machdep, OID_AUTO, conspeed, CTLTYPE_INT | CTLFLAG_RW,
0, 0, sysctl_machdep_comdefaultrate, "I", "");
-#if NCRD > 0
+#if NCARD > 0
/*
* PC-Card (PCMCIA) specific code.
*/
-static int card_intr(struct pccard_dev *); /* Interrupt handler */
-static void siounload(struct pccard_dev *); /* Disable driver */
-static void siosuspend(struct pccard_dev *); /* Suspend driver */
-static int sioinit(struct pccard_dev *, int); /* init device */
+static int sioinit(struct pccard_devinfo *, int); /* init device */
+static void siounload(struct pccard_devinfo *); /* Disable driver */
+static int card_intr(struct pccard_devinfo *); /* Interrupt handler */
+static void siosuspend(struct pccard_devinfo *); /* Suspend driver */
-static struct pccard_drv sio_info = {
+static struct pccard_device sio_info = {
driver_name,
- card_intr,
+ sioinit,
siounload,
+ card_intr,
siosuspend,
- sioinit,
0, /* Attributes - presently unused */
&tty_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
- * sioinit with first=0. This is called when the user suspends
- * the system, or the APM code suspends the system.
- */
-static void
-siosuspend(struct pccard_dev *dp)
-{
- printf("sio%d: suspending\n", dp->isahd.id_unit);
-}
-
-/*
* Initialize the device - called from Slot manager.
+ *
* If first is set, then check for the device's existence
* before initializing it. Once initialized, the device table may
* be set up.
*/
int
-sioinit(struct pccard_dev *dp, int first)
+sioinit(struct pccard_devinfo *devi, int first)
{
-
/* validate unit number. */
if (first) {
- if (dp->isahd.id_unit >= (NSIOTOT))
+ if (devi->isahd.id_unit >= (NSIOTOT))
return(ENODEV);
/* Make sure it isn't already probed. */
- if (com_addr(dp->isahd.id_unit))
+ if (com_addr(devi->isahd.id_unit))
return(EBUSY);
/*
* Probe the device. If a value is returned, the
* device was found at the location.
*/
- if (sioprobe(&dp->isahd)==0)
+ if (sioprobe(&devi->isahd) == 0)
return(ENXIO);
- if (sioattach(&dp->isahd)==0)
+ if (sioattach(&devi->isahd) == 0)
return(ENXIO);
}
/*
@@ -549,18 +536,18 @@ sioinit(struct pccard_dev *dp, int first)
* read and write do not hang.
*/
static void
-siounload(struct pccard_dev *dp)
+siounload(struct pccard_devinfo *devi)
{
struct com_s *com;
- com = com_addr(dp->isahd.id_unit);
+ com = com_addr(devi->isahd.id_unit);
if (!com->iobase) {
- printf("sio%d already unloaded!\n",dp->isahd.id_unit);
+ printf("sio%d already unloaded!\n",devi->isahd.id_unit);
return;
}
if (com->tp && (com->tp->t_state & TS_ISOPEN)) {
com->gone = 1;
- printf("sio%d: unload\n", dp->isahd.id_unit);
+ printf("sio%d: unload\n", devi->isahd.id_unit);
com->tp->t_gen++;
ttyclose(com->tp);
ttwakeup(com->tp);
@@ -569,7 +556,7 @@ siounload(struct pccard_dev *dp)
com_addr(com->unit) = NULL;
bzero(com, sizeof *com);
free(com,M_TTYS);
- printf("sio%d: unload,gone\n", dp->isahd.id_unit);
+ printf("sio%d: unload,gone\n", devi->isahd.id_unit);
}
}
@@ -578,17 +565,30 @@ siounload(struct pccard_dev *dp)
* front end of PC-Card handler.
*/
static int
-card_intr(struct pccard_dev *dp)
+card_intr(struct pccard_devinfo *devi)
{
struct com_s *com;
COM_LOCK();
- com = com_addr(dp->isahd.id_unit);
- if (com && !com_addr(dp->isahd.id_unit)->gone)
- siointr1(com_addr(dp->isahd.id_unit));
+ com = com_addr(devi->isahd.id_unit);
+ if (com && !com_addr(devi->isahd.id_unit)->gone)
+ siointr1(com_addr(devi->isahd.id_unit));
COM_UNLOCK();
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
+ * sioinit with first=0. This is called when the user suspends
+ * the system, or the APM code suspends the system.
+ */
+static void
+siosuspend(struct pccard_devinfo *devi)
+{
+ printf("sio%d: suspending\n", devi->isahd.id_unit);
+}
+#endif /* NCARD > 0 */
static int
sioprobe(dev)
@@ -613,7 +613,7 @@ sioprobe(dev)
for (xdev = isa_devtab_tty; xdev->id_driver != NULL; xdev++)
if (xdev->id_driver == &siodriver && xdev->id_enabled)
outb(xdev->id_iobase + com_mcr, 0);
-#if NCRD > 0
+#if NCARD > 0
/*
* If PC-Card probe required, then register driver with
* slot manager.