- Functional changes to PCCARD support.

* Kill individual drivers 'suspend' routines, since there's no simple/safe
   way to suspend/resume a card w/out going through the complete probe
   at initialization time.
 * Default to using the apm_pccard_resume sysctl code, which basically
   pretends the card was removed, and then re-inserted.  Suspend/resume
   is now 'emulated' with a fake insert/removal.  (Hence we no longer
   need the driver-specific suspend routines.)
This commit is contained in:
nate 1997-10-26 04:54:16 +00:00
parent c68183d0b8
commit 2f55d3018b
12 changed files with 178 additions and 488 deletions

View File

@ -191,17 +191,15 @@ static u_long ds_crc(u_char *ep);
/*
* PC-Card (PCMCIA) specific code.
*/
static int edinit(struct pccard_devinfo *, int); /* init device */
static int edinit(struct pccard_devinfo *); /* 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_device ed_info = {
"ed",
edinit,
edunload,
card_intr,
edsuspend,
0, /* Attributes - presently unused */
&net_imask /* Interrupt mask for device */
/* XXX - Should this also include net_imask? */
@ -209,39 +207,25 @@ static struct pccard_device ed_info = {
/*
* 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_devinfo *devi, int first)
edinit(struct pccard_devinfo *devi)
{
struct ed_softc *sc = &ed_softc[devi->isahd.id_unit];
/* validate unit number. */
if (first) {
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(&devi->isahd, devi->misc) == 0)
return(ENXIO);
if (ed_attach_isa(&devi->isahd) == 0)
return(ENXIO);
} else {
sc->gone = 0; /* reenable after a suspend */
}
if (devi->isahd.id_unit >= NED)
return(ENODEV);
/*
* XXX TODO:
* If it was initialized before, the device structure
* should also be initialized. We should
* reset (and possibly restart) the hardware, but
* I am not sure of the best way to do this...
* Probe the device. If a value is returned, the
* device was found at the location.
*/
sc->gone = 0;
if (ed_probe_pccard(&devi->isahd, devi->misc) == 0)
return(ENXIO);
if (ed_attach_isa(&devi->isahd) == 0)
return(ENXIO);
return(0);
}
@ -280,29 +264,6 @@ card_intr(struct pccard_devinfo *devi)
edintr_sc(&ed_softc[devi->isahd.id_unit]);
return(1);
}
/*
* 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 = {

View File

@ -153,18 +153,16 @@ struct isa_driver epdriver = {
/*
* PC-Card (PCMCIA) specific code.
*/
static int ep_pccard_init __P((struct pccard_devinfo *, int));
static int ep_pccard_init __P((struct pccard_devinfo *));
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_device ep_info = {
"ep",
ep_pccard_init,
ep_unload,
card_intr,
ep_suspend,
0, /* Attributes - presently unused */
&net_imask
};
@ -173,9 +171,8 @@ static struct pccard_device ep_info = {
* Initialize the device - called from Slot manager.
*/
static int
ep_pccard_init(devi, first)
ep_pccard_init(devi)
struct pccard_devinfo *devi;
int first;
{
struct isa_device *is = &devi->isahd;
struct ep_softc *sc = ep_softc[is->id_unit];
@ -201,10 +198,7 @@ ep_pccard_init(devi, first)
/* 3C589's product id? */
if (epb->prod_id != 0x9058) {
if (first)
printf("ep%d: failed to come ready.\n", is->id_unit);
else
printf("ep%d: failed to resume.\n", is->id_unit);
printf("ep%d: failed to come ready.\n", is->id_unit);
return (ENXIO);
}
@ -212,15 +206,10 @@ ep_pccard_init(devi, first)
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(devi) == 0)
return (ENXIO);
sc->arpcom.ac_if.if_snd.ifq_maxlen = ifqmaxlen;
} else {
sc->gone = 0;
printf("ep%d: resumed.\n", is->id_unit);
epinit(sc);
}
if (ep_pccard_attach(devi) == 0)
return (ENXIO);
sc->arpcom.ac_if.if_snd.ifq_maxlen = ifqmaxlen;
return (0);
}
@ -284,17 +273,6 @@ card_intr(devi)
epintr(devi->isahd.id_unit);
return(1);
}
/* 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

View File

@ -322,17 +322,15 @@ outblk ( struct fe_softc * sc, int offs, u_char const * mem, int len )
/*
* PC-Card (PCMCIA) specific code.
*/
static int feinit(struct pccard_devinfo *, int); /* init device */
static int feinit(struct pccard_devinfo *); /* 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_device fe_info = {
"fe",
feinit,
feunload,
fe_card_intr,
fesuspend,
0, /* Attributes - presently unused */
&net_imask /* Interrupt mask for device */
/* XXX - Should this also include net_imask? */
@ -340,59 +338,47 @@ static struct pccard_device fe_info = {
/*
* 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_devinfo *devi, int first)
feinit(struct pccard_devinfo *devi)
{
struct fe_softc *sc;
/* validate unit number. */
if (first) {
if (devi->isahd.id_unit >= NFE)
return (ENODEV);
/*
* Probe the device. If a value is returned,
* the device was found at the location.
*/
#if FE_DEBUG >= 2
printf("Start Probe\n");
#endif
/* Initialize "minimum" parts of our softc. */
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 ((devi->misc[0] & 0x03) == 0x00
&& (devi->misc[0] | devi->misc[1] | devi->misc[2]) != 0) {
/* Yes, it looks like a valid Ether address. */
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(&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(&devi->isahd) == 0)
return (ENXIO);
}
if (devi->isahd.id_unit >= NFE)
return (ENODEV);
/*
* XXX TODO:
* If it was initialized before, the device structure
* should also be initialized. We should
* reset (and possibly restart) the hardware, but
* I am not sure of the best way to do this...
* Probe the device. If a value is returned,
* the device was found at the location.
*/
#if FE_DEBUG >= 2
printf("Start Probe\n");
#endif
/* Initialize "minimum" parts of our softc. */
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 ((devi->misc[0] & 0x03) == 0x00
&& (devi->misc[0] | devi->misc[1] | devi->misc[2]) != 0) {
/* Yes, it looks like a valid Ether address. */
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(&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(&devi->isahd) == 0)
return (ENXIO);
return (0);
}
@ -423,19 +409,6 @@ fe_card_intr(struct pccard_devinfo *devi)
feintr(devi->isahd.id_unit);
return (1);
}
/*
* 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 */

View File

@ -474,17 +474,15 @@ SYSCTL_PROC(_machdep, OID_AUTO, conspeed, CTLTYPE_INT | CTLFLAG_RW,
/*
* PC-Card (PCMCIA) specific code.
*/
static int sioinit(struct pccard_devinfo *, int); /* init device */
static int sioinit(struct pccard_devinfo *); /* 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_device sio_info = {
driver_name,
sioinit,
siounload,
card_intr,
siosuspend,
0, /* Attributes - presently unused */
&tty_imask /* Interrupt mask for device */
/* XXX - Should this also include net_imask? */
@ -492,37 +490,26 @@ static struct pccard_device sio_info = {
/*
* 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_devinfo *devi, int first)
sioinit(struct pccard_devinfo *devi)
{
/* validate unit number. */
if (first) {
if (devi->isahd.id_unit >= (NSIOTOT))
return(ENODEV);
/* Make sure it isn't already probed. */
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(&devi->isahd) == 0)
return(ENXIO);
if (sioattach(&devi->isahd) == 0)
return(ENXIO);
}
if (devi->isahd.id_unit >= (NSIOTOT))
return(ENODEV);
/* Make sure it isn't already probed. */
if (com_addr(devi->isahd.id_unit))
return(EBUSY);
/*
* XXX TODO:
* If it was initialized before, the device structure
* should also be initialized. We should
* reset (and possibly restart) the hardware, but
* I am not sure of the best way to do this...
* Probe the device. If a value is returned, the
* device was found at the location.
*/
if (sioprobe(&devi->isahd) == 0)
return(ENXIO);
if (sioattach(&devi->isahd) == 0)
return(ENXIO);
return(0);
}
@ -575,19 +562,6 @@ card_intr(struct pccard_devinfo *devi)
COM_UNLOCK();
return(1);
}
/*
* 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

View File

@ -705,60 +705,45 @@ static struct scsi_device aic_dev = {
#include <pccard/driver.h>
#include <pccard/slot.h>
static int aicinit(struct pccard_devinfo *, int); /* init device */
static int aicinit(struct pccard_devinfo *); /* init device */
void aicunload(struct pccard_devinfo *); /* Disable driver */
static int aic_card_intr(struct pccard_devinfo *); /* Interrupt handler */
void aicsuspend(struct pccard_devinfo *); /* Suspend driver */
static struct pccard_device aic_info = {
"aic",
aicinit,
aicunload,
aic_card_intr,
aicsuspend,
0, /* Attributes - presently unused */
&bio_imask /* Interrupt mask for device */
};
/*
* Initialize the device - called from Slot manager.
*
* if first is set, then initially check for
* the device's existence before initialising it.
* Once initialised, the device table may be set up.
*/
int
aicinit(struct pccard_devinfo *devi, int first)
aicinit(struct pccard_devinfo *devi)
{
static int already_aicinit[NAIC];
/* validate unit number */
if (first) {
if (devi->isahd.id_unit >= NAIC)
return(ENODEV);
/* Make sure it isn't already initialised */
if (already_aicinit[devi->isahd.id_unit] == 1) {
if (aicattach(&devi->isahd) == 0)
return(ENXIO);
return(0);
}
/*
* Probe the device. If a value is returned, the
* device was found at the location.
*/
if (aicprobe(&devi->isahd) == 0)
return(ENXIO);
if (devi->isahd.id_unit >= NAIC)
return(ENODEV);
/* Make sure it isn't already initialised */
if (already_aicinit[devi->isahd.id_unit] == 1) {
if (aicattach(&devi->isahd) == 0)
return(ENXIO);
return(0);
}
/*
* XXX TODO:
* If it was already inited before, the device structure
* should be already initialised. Here we should
* reset (and possibly restart) the hardware, but
* I am not sure of the best way to do this...
* Probe the device. If a value is returned, the
* device was found at the location.
*/
if (aicprobe(&devi->isahd) == 0)
return(ENXIO);
if (aicattach(&devi->isahd) == 0)
return(ENXIO);
already_aicinit[devi->isahd.id_unit] = 1;
return(0);
}
@ -793,19 +778,6 @@ aic_card_intr(struct pccard_devinfo *devi)
aicintr(devi->isahd.id_unit);
return(1);
}
/*
* Called when a power down is wanted. 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.
*/
void
aicsuspend(struct pccard_devinfo *devi)
{
printf("aic%d: suspending\n", devi->isahd.id_unit);
}
#endif /* NCARD > 0 */
/*

View File

@ -191,17 +191,15 @@ static u_long ds_crc(u_char *ep);
/*
* PC-Card (PCMCIA) specific code.
*/
static int edinit(struct pccard_devinfo *, int); /* init device */
static int edinit(struct pccard_devinfo *); /* 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_device ed_info = {
"ed",
edinit,
edunload,
card_intr,
edsuspend,
0, /* Attributes - presently unused */
&net_imask /* Interrupt mask for device */
/* XXX - Should this also include net_imask? */
@ -209,39 +207,25 @@ static struct pccard_device ed_info = {
/*
* 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_devinfo *devi, int first)
edinit(struct pccard_devinfo *devi)
{
struct ed_softc *sc = &ed_softc[devi->isahd.id_unit];
/* validate unit number. */
if (first) {
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(&devi->isahd, devi->misc) == 0)
return(ENXIO);
if (ed_attach_isa(&devi->isahd) == 0)
return(ENXIO);
} else {
sc->gone = 0; /* reenable after a suspend */
}
if (devi->isahd.id_unit >= NED)
return(ENODEV);
/*
* XXX TODO:
* If it was initialized before, the device structure
* should also be initialized. We should
* reset (and possibly restart) the hardware, but
* I am not sure of the best way to do this...
* Probe the device. If a value is returned, the
* device was found at the location.
*/
sc->gone = 0;
if (ed_probe_pccard(&devi->isahd, devi->misc) == 0)
return(ENXIO);
if (ed_attach_isa(&devi->isahd) == 0)
return(ENXIO);
return(0);
}
@ -280,29 +264,6 @@ card_intr(struct pccard_devinfo *devi)
edintr_sc(&ed_softc[devi->isahd.id_unit]);
return(1);
}
/*
* 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 = {

View File

@ -153,18 +153,16 @@ struct isa_driver epdriver = {
/*
* PC-Card (PCMCIA) specific code.
*/
static int ep_pccard_init __P((struct pccard_devinfo *, int));
static int ep_pccard_init __P((struct pccard_devinfo *));
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_device ep_info = {
"ep",
ep_pccard_init,
ep_unload,
card_intr,
ep_suspend,
0, /* Attributes - presently unused */
&net_imask
};
@ -173,9 +171,8 @@ static struct pccard_device ep_info = {
* Initialize the device - called from Slot manager.
*/
static int
ep_pccard_init(devi, first)
ep_pccard_init(devi)
struct pccard_devinfo *devi;
int first;
{
struct isa_device *is = &devi->isahd;
struct ep_softc *sc = ep_softc[is->id_unit];
@ -201,10 +198,7 @@ ep_pccard_init(devi, first)
/* 3C589's product id? */
if (epb->prod_id != 0x9058) {
if (first)
printf("ep%d: failed to come ready.\n", is->id_unit);
else
printf("ep%d: failed to resume.\n", is->id_unit);
printf("ep%d: failed to come ready.\n", is->id_unit);
return (ENXIO);
}
@ -212,15 +206,10 @@ ep_pccard_init(devi, first)
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(devi) == 0)
return (ENXIO);
sc->arpcom.ac_if.if_snd.ifq_maxlen = ifqmaxlen;
} else {
sc->gone = 0;
printf("ep%d: resumed.\n", is->id_unit);
epinit(sc);
}
if (ep_pccard_attach(devi) == 0)
return (ENXIO);
sc->arpcom.ac_if.if_snd.ifq_maxlen = ifqmaxlen;
return (0);
}
@ -284,17 +273,6 @@ card_intr(devi)
epintr(devi->isahd.id_unit);
return(1);
}
/* 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

View File

@ -322,17 +322,15 @@ outblk ( struct fe_softc * sc, int offs, u_char const * mem, int len )
/*
* PC-Card (PCMCIA) specific code.
*/
static int feinit(struct pccard_devinfo *, int); /* init device */
static int feinit(struct pccard_devinfo *); /* 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_device fe_info = {
"fe",
feinit,
feunload,
fe_card_intr,
fesuspend,
0, /* Attributes - presently unused */
&net_imask /* Interrupt mask for device */
/* XXX - Should this also include net_imask? */
@ -340,59 +338,47 @@ static struct pccard_device fe_info = {
/*
* 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_devinfo *devi, int first)
feinit(struct pccard_devinfo *devi)
{
struct fe_softc *sc;
/* validate unit number. */
if (first) {
if (devi->isahd.id_unit >= NFE)
return (ENODEV);
/*
* Probe the device. If a value is returned,
* the device was found at the location.
*/
#if FE_DEBUG >= 2
printf("Start Probe\n");
#endif
/* Initialize "minimum" parts of our softc. */
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 ((devi->misc[0] & 0x03) == 0x00
&& (devi->misc[0] | devi->misc[1] | devi->misc[2]) != 0) {
/* Yes, it looks like a valid Ether address. */
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(&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(&devi->isahd) == 0)
return (ENXIO);
}
if (devi->isahd.id_unit >= NFE)
return (ENODEV);
/*
* XXX TODO:
* If it was initialized before, the device structure
* should also be initialized. We should
* reset (and possibly restart) the hardware, but
* I am not sure of the best way to do this...
* Probe the device. If a value is returned,
* the device was found at the location.
*/
#if FE_DEBUG >= 2
printf("Start Probe\n");
#endif
/* Initialize "minimum" parts of our softc. */
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 ((devi->misc[0] & 0x03) == 0x00
&& (devi->misc[0] | devi->misc[1] | devi->misc[2]) != 0) {
/* Yes, it looks like a valid Ether address. */
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(&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(&devi->isahd) == 0)
return (ENXIO);
return (0);
}
@ -423,19 +409,6 @@ fe_card_intr(struct pccard_devinfo *devi)
feintr(devi->isahd.id_unit);
return (1);
}
/*
* 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 */

View File

@ -474,17 +474,15 @@ SYSCTL_PROC(_machdep, OID_AUTO, conspeed, CTLTYPE_INT | CTLFLAG_RW,
/*
* PC-Card (PCMCIA) specific code.
*/
static int sioinit(struct pccard_devinfo *, int); /* init device */
static int sioinit(struct pccard_devinfo *); /* 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_device sio_info = {
driver_name,
sioinit,
siounload,
card_intr,
siosuspend,
0, /* Attributes - presently unused */
&tty_imask /* Interrupt mask for device */
/* XXX - Should this also include net_imask? */
@ -492,37 +490,26 @@ static struct pccard_device sio_info = {
/*
* 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_devinfo *devi, int first)
sioinit(struct pccard_devinfo *devi)
{
/* validate unit number. */
if (first) {
if (devi->isahd.id_unit >= (NSIOTOT))
return(ENODEV);
/* Make sure it isn't already probed. */
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(&devi->isahd) == 0)
return(ENXIO);
if (sioattach(&devi->isahd) == 0)
return(ENXIO);
}
if (devi->isahd.id_unit >= (NSIOTOT))
return(ENODEV);
/* Make sure it isn't already probed. */
if (com_addr(devi->isahd.id_unit))
return(EBUSY);
/*
* XXX TODO:
* If it was initialized before, the device structure
* should also be initialized. We should
* reset (and possibly restart) the hardware, but
* I am not sure of the best way to do this...
* Probe the device. If a value is returned, the
* device was found at the location.
*/
if (sioprobe(&devi->isahd) == 0)
return(ENXIO);
if (sioattach(&devi->isahd) == 0)
return(ENXIO);
return(0);
}
@ -575,19 +562,6 @@ card_intr(struct pccard_devinfo *devi)
COM_UNLOCK();
return(1);
}
/*
* 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

View File

@ -474,17 +474,15 @@ SYSCTL_PROC(_machdep, OID_AUTO, conspeed, CTLTYPE_INT | CTLFLAG_RW,
/*
* PC-Card (PCMCIA) specific code.
*/
static int sioinit(struct pccard_devinfo *, int); /* init device */
static int sioinit(struct pccard_devinfo *); /* 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_device sio_info = {
driver_name,
sioinit,
siounload,
card_intr,
siosuspend,
0, /* Attributes - presently unused */
&tty_imask /* Interrupt mask for device */
/* XXX - Should this also include net_imask? */
@ -492,37 +490,26 @@ static struct pccard_device sio_info = {
/*
* 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_devinfo *devi, int first)
sioinit(struct pccard_devinfo *devi)
{
/* validate unit number. */
if (first) {
if (devi->isahd.id_unit >= (NSIOTOT))
return(ENODEV);
/* Make sure it isn't already probed. */
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(&devi->isahd) == 0)
return(ENXIO);
if (sioattach(&devi->isahd) == 0)
return(ENXIO);
}
if (devi->isahd.id_unit >= (NSIOTOT))
return(ENODEV);
/* Make sure it isn't already probed. */
if (com_addr(devi->isahd.id_unit))
return(EBUSY);
/*
* XXX TODO:
* If it was initialized before, the device structure
* should also be initialized. We should
* reset (and possibly restart) the hardware, but
* I am not sure of the best way to do this...
* Probe the device. If a value is returned, the
* device was found at the location.
*/
if (sioprobe(&devi->isahd) == 0)
return(ENXIO);
if (sioattach(&devi->isahd) == 0)
return(ENXIO);
return(0);
}
@ -575,19 +562,6 @@ card_intr(struct pccard_devinfo *devi)
COM_UNLOCK();
return(1);
}
/*
* 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

View File

@ -77,16 +77,6 @@ static int pcic_resume_reset =
SYSCTL_INT(_machdep_pccard, OID_AUTO, pcic_resume_reset, CTLFLAG_RW,
&pcic_resume_reset, 0, "");
static int apm_pccard_resume =
#ifdef APM_PCCARD_RESUME
1;
#else
0;
#endif
SYSCTL_INT(_machdep_pccard, OID_AUTO, apm_pccard_resume, CTLFLAG_RW,
&apm_pccard_resume, 0, "");
#define PCCARD_MEMSIZE (4*1024)
#define MIN(a,b) ((a)<(b)?(a):(b))
@ -374,12 +364,7 @@ static int
slot_suspend(void *arg)
{
struct slot *slt = arg;
struct pccard_devinfo *devi;
if (slt->state == filled) {
for (devi = slt->devices; devi; devi = devi->next)
(void)devi->drv->suspend(devi);
}
slt->ctrl->disable(slt);
return (0);
}
@ -391,30 +376,18 @@ slot_resume(void *arg)
if (pcic_resume_reset)
slt->ctrl->resume(slt);
if (apm_pccard_resume) {
/* Fake card removal/insertion events */
if (slt->state == filled) {
int s;
/* Fake card removal/insertion events */
if (slt->state == filled) {
int s;
s = splhigh();
disable_slot(slt);
slt->state = empty;
splx(s);
slt->insert_seq = 1;
slt->insert_ch = timeout(inserted, (void *)slt, hz);
selwakeup(&slt->selp);
}
} else {
struct pccard_devinfo *devi;
slt->ctrl->power(slt);
if (slt->irq)
slt->ctrl->mapirq(slt, slt->irq);
if (slt->state == filled) {
for (devi = slt->devices; devi; devi = devi->next)
(void)devi->drv->enable(devi, 0);
}
}
s = splhigh();
disable_slot(slt);
slt->state = empty;
splx(s);
slt->insert_seq = 1;
slt->insert_ch = timeout(inserted, (void *)slt, hz);
selwakeup(&slt->selp);
}
return (0);
}
#endif /* NAPM > 0 */
@ -601,7 +574,7 @@ allocate_driver(struct slot *slt, struct dev_desc *desc)
devi->next = slt->devices;
slt->devices = devi;
s = splhigh();
err = drv->enable(devi, 1);
err = drv->enable(devi);
splx(s);
/*
* If the enable functions returns no error, then the

View File

@ -77,10 +77,9 @@ struct pccard_devinfo;
struct pccard_device {
char *name; /* Driver name */
int (*enable)(struct pccard_devinfo *, int); /* init/enable driver */
int (*enable)(struct pccard_devinfo *); /* init/enable driver */
void (*disable)(struct pccard_devinfo *); /* disable driver */
int (*handler)(struct pccard_devinfo *); /* interrupt handler */
void (*suspend)(struct pccard_devinfo *); /* Suspend driver */
int attr; /* driver attributes */
unsigned int *imask; /* Interrupt mask ptr */