- 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:
parent
e7e437dbfa
commit
8bb7a8fc95
@ -191,17 +191,15 @@ static u_long ds_crc(u_char *ep);
|
|||||||
/*
|
/*
|
||||||
* PC-Card (PCMCIA) specific code.
|
* 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 void edunload(struct pccard_devinfo *); /* Disable driver */
|
||||||
static int card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
static int card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
||||||
static void edsuspend(struct pccard_devinfo *); /* Suspend driver */
|
|
||||||
|
|
||||||
static struct pccard_device ed_info = {
|
static struct pccard_device ed_info = {
|
||||||
"ed",
|
"ed",
|
||||||
edinit,
|
edinit,
|
||||||
edunload,
|
edunload,
|
||||||
card_intr,
|
card_intr,
|
||||||
edsuspend,
|
|
||||||
0, /* Attributes - presently unused */
|
0, /* Attributes - presently unused */
|
||||||
&net_imask /* Interrupt mask for device */
|
&net_imask /* Interrupt mask for device */
|
||||||
/* XXX - Should this also include net_imask? */
|
/* XXX - Should this also include net_imask? */
|
||||||
@ -209,39 +207,25 @@ static struct pccard_device ed_info = {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the device - called from Slot manager.
|
* 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
|
static int
|
||||||
edinit(struct pccard_devinfo *devi, int first)
|
edinit(struct pccard_devinfo *devi)
|
||||||
{
|
{
|
||||||
struct ed_softc *sc = &ed_softc[devi->isahd.id_unit];
|
struct ed_softc *sc = &ed_softc[devi->isahd.id_unit];
|
||||||
|
|
||||||
/* validate unit number. */
|
/* validate unit number. */
|
||||||
if (first) {
|
if (devi->isahd.id_unit >= NED)
|
||||||
if (devi->isahd.id_unit >= NED)
|
return(ENODEV);
|
||||||
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 */
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* XXX TODO:
|
* Probe the device. If a value is returned, the
|
||||||
* If it was initialized before, the device structure
|
* device was found at the location.
|
||||||
* should also be initialized. We should
|
|
||||||
* reset (and possibly restart) the hardware, but
|
|
||||||
* I am not sure of the best way to do this...
|
|
||||||
*/
|
*/
|
||||||
|
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);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,29 +264,6 @@ card_intr(struct pccard_devinfo *devi)
|
|||||||
edintr_sc(&ed_softc[devi->isahd.id_unit]);
|
edintr_sc(&ed_softc[devi->isahd.id_unit]);
|
||||||
return(1);
|
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 */
|
#endif /* NCARD > 0 */
|
||||||
|
|
||||||
struct isa_driver eddriver = {
|
struct isa_driver eddriver = {
|
||||||
|
@ -153,18 +153,16 @@ struct isa_driver epdriver = {
|
|||||||
/*
|
/*
|
||||||
* PC-Card (PCMCIA) specific code.
|
* 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 int ep_pccard_attach __P((struct pccard_devinfo *));
|
||||||
static void ep_unload __P((struct pccard_devinfo *));
|
static void ep_unload __P((struct pccard_devinfo *));
|
||||||
static int card_intr __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 = {
|
static struct pccard_device ep_info = {
|
||||||
"ep",
|
"ep",
|
||||||
ep_pccard_init,
|
ep_pccard_init,
|
||||||
ep_unload,
|
ep_unload,
|
||||||
card_intr,
|
card_intr,
|
||||||
ep_suspend,
|
|
||||||
0, /* Attributes - presently unused */
|
0, /* Attributes - presently unused */
|
||||||
&net_imask
|
&net_imask
|
||||||
};
|
};
|
||||||
@ -173,9 +171,8 @@ static struct pccard_device ep_info = {
|
|||||||
* Initialize the device - called from Slot manager.
|
* Initialize the device - called from Slot manager.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ep_pccard_init(devi, first)
|
ep_pccard_init(devi)
|
||||||
struct pccard_devinfo *devi;
|
struct pccard_devinfo *devi;
|
||||||
int first;
|
|
||||||
{
|
{
|
||||||
struct isa_device *is = &devi->isahd;
|
struct isa_device *is = &devi->isahd;
|
||||||
struct ep_softc *sc = ep_softc[is->id_unit];
|
struct ep_softc *sc = ep_softc[is->id_unit];
|
||||||
@ -201,10 +198,7 @@ ep_pccard_init(devi, first)
|
|||||||
|
|
||||||
/* 3C589's product id? */
|
/* 3C589's product id? */
|
||||||
if (epb->prod_id != 0x9058) {
|
if (epb->prod_id != 0x9058) {
|
||||||
if (first)
|
printf("ep%d: failed to come ready.\n", is->id_unit);
|
||||||
printf("ep%d: failed to come ready.\n", is->id_unit);
|
|
||||||
else
|
|
||||||
printf("ep%d: failed to resume.\n", is->id_unit);
|
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,15 +206,10 @@ ep_pccard_init(devi, first)
|
|||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
sc->epb->eth_addr[i] = get_e(sc, EEPROM_NODE_ADDR_0 + i);
|
sc->epb->eth_addr[i] = get_e(sc, EEPROM_NODE_ADDR_0 + i);
|
||||||
|
|
||||||
if (first) {
|
if (ep_pccard_attach(devi) == 0)
|
||||||
if (ep_pccard_attach(devi) == 0)
|
return (ENXIO);
|
||||||
return (ENXIO);
|
|
||||||
sc->arpcom.ac_if.if_snd.ifq_maxlen = ifqmaxlen;
|
sc->arpcom.ac_if.if_snd.ifq_maxlen = ifqmaxlen;
|
||||||
} else {
|
|
||||||
sc->gone = 0;
|
|
||||||
printf("ep%d: resumed.\n", is->id_unit);
|
|
||||||
epinit(sc);
|
|
||||||
}
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,17 +273,6 @@ card_intr(devi)
|
|||||||
epintr(devi->isahd.id_unit);
|
epintr(devi->isahd.id_unit);
|
||||||
return(1);
|
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 */
|
#endif /* NCARD > 0 */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -322,17 +322,15 @@ outblk ( struct fe_softc * sc, int offs, u_char const * mem, int len )
|
|||||||
/*
|
/*
|
||||||
* PC-Card (PCMCIA) specific code.
|
* 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 void feunload(struct pccard_devinfo *); /* Disable driver */
|
||||||
static int fe_card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
static int fe_card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
||||||
static void fesuspend(struct pccard_devinfo *); /* Suspend driver */
|
|
||||||
|
|
||||||
static struct pccard_device fe_info = {
|
static struct pccard_device fe_info = {
|
||||||
"fe",
|
"fe",
|
||||||
feinit,
|
feinit,
|
||||||
feunload,
|
feunload,
|
||||||
fe_card_intr,
|
fe_card_intr,
|
||||||
fesuspend,
|
|
||||||
0, /* Attributes - presently unused */
|
0, /* Attributes - presently unused */
|
||||||
&net_imask /* Interrupt mask for device */
|
&net_imask /* Interrupt mask for device */
|
||||||
/* XXX - Should this also include net_imask? */
|
/* XXX - Should this also include net_imask? */
|
||||||
@ -340,59 +338,47 @@ static struct pccard_device fe_info = {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* 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
|
static int
|
||||||
feinit(struct pccard_devinfo *devi, int first)
|
feinit(struct pccard_devinfo *devi)
|
||||||
{
|
{
|
||||||
struct fe_softc *sc;
|
struct fe_softc *sc;
|
||||||
|
|
||||||
/* validate unit number. */
|
/* validate unit number. */
|
||||||
if (first) {
|
if (devi->isahd.id_unit >= NFE)
|
||||||
if (devi->isahd.id_unit >= NFE)
|
return (ENODEV);
|
||||||
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);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* XXX TODO:
|
* Probe the device. If a value is returned,
|
||||||
* If it was initialized before, the device structure
|
* the device was found at the location.
|
||||||
* should also be initialized. We should
|
|
||||||
* reset (and possibly restart) the hardware, but
|
|
||||||
* I am not sure of the best way to do this...
|
|
||||||
*/
|
*/
|
||||||
|
#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);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,19 +409,6 @@ fe_card_intr(struct pccard_devinfo *devi)
|
|||||||
feintr(devi->isahd.id_unit);
|
feintr(devi->isahd.id_unit);
|
||||||
return (1);
|
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 */
|
#endif /* NCARD > 0 */
|
||||||
|
|
||||||
|
|
||||||
|
@ -474,17 +474,15 @@ SYSCTL_PROC(_machdep, OID_AUTO, conspeed, CTLTYPE_INT | CTLFLAG_RW,
|
|||||||
/*
|
/*
|
||||||
* PC-Card (PCMCIA) specific code.
|
* 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 void siounload(struct pccard_devinfo *); /* Disable driver */
|
||||||
static int card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
static int card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
||||||
static void siosuspend(struct pccard_devinfo *); /* Suspend driver */
|
|
||||||
|
|
||||||
static struct pccard_device sio_info = {
|
static struct pccard_device sio_info = {
|
||||||
driver_name,
|
driver_name,
|
||||||
sioinit,
|
sioinit,
|
||||||
siounload,
|
siounload,
|
||||||
card_intr,
|
card_intr,
|
||||||
siosuspend,
|
|
||||||
0, /* Attributes - presently unused */
|
0, /* Attributes - presently unused */
|
||||||
&tty_imask /* Interrupt mask for device */
|
&tty_imask /* Interrupt mask for device */
|
||||||
/* XXX - Should this also include net_imask? */
|
/* XXX - Should this also include net_imask? */
|
||||||
@ -492,37 +490,26 @@ static struct pccard_device sio_info = {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the device - called from Slot manager.
|
* 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
|
int
|
||||||
sioinit(struct pccard_devinfo *devi, int first)
|
sioinit(struct pccard_devinfo *devi)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* validate unit number. */
|
/* validate unit number. */
|
||||||
if (first) {
|
if (devi->isahd.id_unit >= (NSIOTOT))
|
||||||
if (devi->isahd.id_unit >= (NSIOTOT))
|
return(ENODEV);
|
||||||
return(ENODEV);
|
/* Make sure it isn't already probed. */
|
||||||
/* Make sure it isn't already probed. */
|
if (com_addr(devi->isahd.id_unit))
|
||||||
if (com_addr(devi->isahd.id_unit))
|
return(EBUSY);
|
||||||
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);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* XXX TODO:
|
* Probe the device. If a value is returned, the
|
||||||
* If it was initialized before, the device structure
|
* device was found at the location.
|
||||||
* should also be initialized. We should
|
|
||||||
* reset (and possibly restart) the hardware, but
|
|
||||||
* I am not sure of the best way to do this...
|
|
||||||
*/
|
*/
|
||||||
|
if (sioprobe(&devi->isahd) == 0)
|
||||||
|
return(ENXIO);
|
||||||
|
if (sioattach(&devi->isahd) == 0)
|
||||||
|
return(ENXIO);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -575,19 +562,6 @@ card_intr(struct pccard_devinfo *devi)
|
|||||||
COM_UNLOCK();
|
COM_UNLOCK();
|
||||||
return(1);
|
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 */
|
#endif /* NCARD > 0 */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -705,60 +705,45 @@ static struct scsi_device aic_dev = {
|
|||||||
#include <pccard/driver.h>
|
#include <pccard/driver.h>
|
||||||
#include <pccard/slot.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 */
|
void aicunload(struct pccard_devinfo *); /* Disable driver */
|
||||||
static int aic_card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
static int aic_card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
||||||
void aicsuspend(struct pccard_devinfo *); /* Suspend driver */
|
|
||||||
|
|
||||||
static struct pccard_device aic_info = {
|
static struct pccard_device aic_info = {
|
||||||
"aic",
|
"aic",
|
||||||
aicinit,
|
aicinit,
|
||||||
aicunload,
|
aicunload,
|
||||||
aic_card_intr,
|
aic_card_intr,
|
||||||
aicsuspend,
|
|
||||||
0, /* Attributes - presently unused */
|
0, /* Attributes - presently unused */
|
||||||
&bio_imask /* Interrupt mask for device */
|
&bio_imask /* Interrupt mask for device */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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 initialising it.
|
|
||||||
* Once initialised, the device table may be set up.
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
aicinit(struct pccard_devinfo *devi, int first)
|
aicinit(struct pccard_devinfo *devi)
|
||||||
{
|
{
|
||||||
static int already_aicinit[NAIC];
|
static int already_aicinit[NAIC];
|
||||||
|
|
||||||
/* validate unit number */
|
/* validate unit number */
|
||||||
if (first) {
|
if (devi->isahd.id_unit >= NAIC)
|
||||||
if (devi->isahd.id_unit >= NAIC)
|
return(ENODEV);
|
||||||
return(ENODEV);
|
/* Make sure it isn't already initialised */
|
||||||
/* Make sure it isn't already initialised */
|
if (already_aicinit[devi->isahd.id_unit] == 1) {
|
||||||
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 (aicattach(&devi->isahd) == 0)
|
if (aicattach(&devi->isahd) == 0)
|
||||||
return(ENXIO);
|
return(ENXIO);
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* XXX TODO:
|
* Probe the device. If a value is returned, the
|
||||||
* If it was already inited before, the device structure
|
* device was found at the location.
|
||||||
* 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...
|
|
||||||
*/
|
*/
|
||||||
|
if (aicprobe(&devi->isahd) == 0)
|
||||||
|
return(ENXIO);
|
||||||
|
|
||||||
|
if (aicattach(&devi->isahd) == 0)
|
||||||
|
return(ENXIO);
|
||||||
already_aicinit[devi->isahd.id_unit] = 1;
|
already_aicinit[devi->isahd.id_unit] = 1;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -793,19 +778,6 @@ aic_card_intr(struct pccard_devinfo *devi)
|
|||||||
aicintr(devi->isahd.id_unit);
|
aicintr(devi->isahd.id_unit);
|
||||||
return(1);
|
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 */
|
#endif /* NCARD > 0 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -191,17 +191,15 @@ static u_long ds_crc(u_char *ep);
|
|||||||
/*
|
/*
|
||||||
* PC-Card (PCMCIA) specific code.
|
* 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 void edunload(struct pccard_devinfo *); /* Disable driver */
|
||||||
static int card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
static int card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
||||||
static void edsuspend(struct pccard_devinfo *); /* Suspend driver */
|
|
||||||
|
|
||||||
static struct pccard_device ed_info = {
|
static struct pccard_device ed_info = {
|
||||||
"ed",
|
"ed",
|
||||||
edinit,
|
edinit,
|
||||||
edunload,
|
edunload,
|
||||||
card_intr,
|
card_intr,
|
||||||
edsuspend,
|
|
||||||
0, /* Attributes - presently unused */
|
0, /* Attributes - presently unused */
|
||||||
&net_imask /* Interrupt mask for device */
|
&net_imask /* Interrupt mask for device */
|
||||||
/* XXX - Should this also include net_imask? */
|
/* XXX - Should this also include net_imask? */
|
||||||
@ -209,39 +207,25 @@ static struct pccard_device ed_info = {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the device - called from Slot manager.
|
* 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
|
static int
|
||||||
edinit(struct pccard_devinfo *devi, int first)
|
edinit(struct pccard_devinfo *devi)
|
||||||
{
|
{
|
||||||
struct ed_softc *sc = &ed_softc[devi->isahd.id_unit];
|
struct ed_softc *sc = &ed_softc[devi->isahd.id_unit];
|
||||||
|
|
||||||
/* validate unit number. */
|
/* validate unit number. */
|
||||||
if (first) {
|
if (devi->isahd.id_unit >= NED)
|
||||||
if (devi->isahd.id_unit >= NED)
|
return(ENODEV);
|
||||||
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 */
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* XXX TODO:
|
* Probe the device. If a value is returned, the
|
||||||
* If it was initialized before, the device structure
|
* device was found at the location.
|
||||||
* should also be initialized. We should
|
|
||||||
* reset (and possibly restart) the hardware, but
|
|
||||||
* I am not sure of the best way to do this...
|
|
||||||
*/
|
*/
|
||||||
|
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);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,29 +264,6 @@ card_intr(struct pccard_devinfo *devi)
|
|||||||
edintr_sc(&ed_softc[devi->isahd.id_unit]);
|
edintr_sc(&ed_softc[devi->isahd.id_unit]);
|
||||||
return(1);
|
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 */
|
#endif /* NCARD > 0 */
|
||||||
|
|
||||||
struct isa_driver eddriver = {
|
struct isa_driver eddriver = {
|
||||||
|
@ -153,18 +153,16 @@ struct isa_driver epdriver = {
|
|||||||
/*
|
/*
|
||||||
* PC-Card (PCMCIA) specific code.
|
* 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 int ep_pccard_attach __P((struct pccard_devinfo *));
|
||||||
static void ep_unload __P((struct pccard_devinfo *));
|
static void ep_unload __P((struct pccard_devinfo *));
|
||||||
static int card_intr __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 = {
|
static struct pccard_device ep_info = {
|
||||||
"ep",
|
"ep",
|
||||||
ep_pccard_init,
|
ep_pccard_init,
|
||||||
ep_unload,
|
ep_unload,
|
||||||
card_intr,
|
card_intr,
|
||||||
ep_suspend,
|
|
||||||
0, /* Attributes - presently unused */
|
0, /* Attributes - presently unused */
|
||||||
&net_imask
|
&net_imask
|
||||||
};
|
};
|
||||||
@ -173,9 +171,8 @@ static struct pccard_device ep_info = {
|
|||||||
* Initialize the device - called from Slot manager.
|
* Initialize the device - called from Slot manager.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ep_pccard_init(devi, first)
|
ep_pccard_init(devi)
|
||||||
struct pccard_devinfo *devi;
|
struct pccard_devinfo *devi;
|
||||||
int first;
|
|
||||||
{
|
{
|
||||||
struct isa_device *is = &devi->isahd;
|
struct isa_device *is = &devi->isahd;
|
||||||
struct ep_softc *sc = ep_softc[is->id_unit];
|
struct ep_softc *sc = ep_softc[is->id_unit];
|
||||||
@ -201,10 +198,7 @@ ep_pccard_init(devi, first)
|
|||||||
|
|
||||||
/* 3C589's product id? */
|
/* 3C589's product id? */
|
||||||
if (epb->prod_id != 0x9058) {
|
if (epb->prod_id != 0x9058) {
|
||||||
if (first)
|
printf("ep%d: failed to come ready.\n", is->id_unit);
|
||||||
printf("ep%d: failed to come ready.\n", is->id_unit);
|
|
||||||
else
|
|
||||||
printf("ep%d: failed to resume.\n", is->id_unit);
|
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,15 +206,10 @@ ep_pccard_init(devi, first)
|
|||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
sc->epb->eth_addr[i] = get_e(sc, EEPROM_NODE_ADDR_0 + i);
|
sc->epb->eth_addr[i] = get_e(sc, EEPROM_NODE_ADDR_0 + i);
|
||||||
|
|
||||||
if (first) {
|
if (ep_pccard_attach(devi) == 0)
|
||||||
if (ep_pccard_attach(devi) == 0)
|
return (ENXIO);
|
||||||
return (ENXIO);
|
|
||||||
sc->arpcom.ac_if.if_snd.ifq_maxlen = ifqmaxlen;
|
sc->arpcom.ac_if.if_snd.ifq_maxlen = ifqmaxlen;
|
||||||
} else {
|
|
||||||
sc->gone = 0;
|
|
||||||
printf("ep%d: resumed.\n", is->id_unit);
|
|
||||||
epinit(sc);
|
|
||||||
}
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,17 +273,6 @@ card_intr(devi)
|
|||||||
epintr(devi->isahd.id_unit);
|
epintr(devi->isahd.id_unit);
|
||||||
return(1);
|
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 */
|
#endif /* NCARD > 0 */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -322,17 +322,15 @@ outblk ( struct fe_softc * sc, int offs, u_char const * mem, int len )
|
|||||||
/*
|
/*
|
||||||
* PC-Card (PCMCIA) specific code.
|
* 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 void feunload(struct pccard_devinfo *); /* Disable driver */
|
||||||
static int fe_card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
static int fe_card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
||||||
static void fesuspend(struct pccard_devinfo *); /* Suspend driver */
|
|
||||||
|
|
||||||
static struct pccard_device fe_info = {
|
static struct pccard_device fe_info = {
|
||||||
"fe",
|
"fe",
|
||||||
feinit,
|
feinit,
|
||||||
feunload,
|
feunload,
|
||||||
fe_card_intr,
|
fe_card_intr,
|
||||||
fesuspend,
|
|
||||||
0, /* Attributes - presently unused */
|
0, /* Attributes - presently unused */
|
||||||
&net_imask /* Interrupt mask for device */
|
&net_imask /* Interrupt mask for device */
|
||||||
/* XXX - Should this also include net_imask? */
|
/* XXX - Should this also include net_imask? */
|
||||||
@ -340,59 +338,47 @@ static struct pccard_device fe_info = {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* 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
|
static int
|
||||||
feinit(struct pccard_devinfo *devi, int first)
|
feinit(struct pccard_devinfo *devi)
|
||||||
{
|
{
|
||||||
struct fe_softc *sc;
|
struct fe_softc *sc;
|
||||||
|
|
||||||
/* validate unit number. */
|
/* validate unit number. */
|
||||||
if (first) {
|
if (devi->isahd.id_unit >= NFE)
|
||||||
if (devi->isahd.id_unit >= NFE)
|
return (ENODEV);
|
||||||
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);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* XXX TODO:
|
* Probe the device. If a value is returned,
|
||||||
* If it was initialized before, the device structure
|
* the device was found at the location.
|
||||||
* should also be initialized. We should
|
|
||||||
* reset (and possibly restart) the hardware, but
|
|
||||||
* I am not sure of the best way to do this...
|
|
||||||
*/
|
*/
|
||||||
|
#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);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,19 +409,6 @@ fe_card_intr(struct pccard_devinfo *devi)
|
|||||||
feintr(devi->isahd.id_unit);
|
feintr(devi->isahd.id_unit);
|
||||||
return (1);
|
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 */
|
#endif /* NCARD > 0 */
|
||||||
|
|
||||||
|
|
||||||
|
@ -474,17 +474,15 @@ SYSCTL_PROC(_machdep, OID_AUTO, conspeed, CTLTYPE_INT | CTLFLAG_RW,
|
|||||||
/*
|
/*
|
||||||
* PC-Card (PCMCIA) specific code.
|
* 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 void siounload(struct pccard_devinfo *); /* Disable driver */
|
||||||
static int card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
static int card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
||||||
static void siosuspend(struct pccard_devinfo *); /* Suspend driver */
|
|
||||||
|
|
||||||
static struct pccard_device sio_info = {
|
static struct pccard_device sio_info = {
|
||||||
driver_name,
|
driver_name,
|
||||||
sioinit,
|
sioinit,
|
||||||
siounload,
|
siounload,
|
||||||
card_intr,
|
card_intr,
|
||||||
siosuspend,
|
|
||||||
0, /* Attributes - presently unused */
|
0, /* Attributes - presently unused */
|
||||||
&tty_imask /* Interrupt mask for device */
|
&tty_imask /* Interrupt mask for device */
|
||||||
/* XXX - Should this also include net_imask? */
|
/* XXX - Should this also include net_imask? */
|
||||||
@ -492,37 +490,26 @@ static struct pccard_device sio_info = {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the device - called from Slot manager.
|
* 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
|
int
|
||||||
sioinit(struct pccard_devinfo *devi, int first)
|
sioinit(struct pccard_devinfo *devi)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* validate unit number. */
|
/* validate unit number. */
|
||||||
if (first) {
|
if (devi->isahd.id_unit >= (NSIOTOT))
|
||||||
if (devi->isahd.id_unit >= (NSIOTOT))
|
return(ENODEV);
|
||||||
return(ENODEV);
|
/* Make sure it isn't already probed. */
|
||||||
/* Make sure it isn't already probed. */
|
if (com_addr(devi->isahd.id_unit))
|
||||||
if (com_addr(devi->isahd.id_unit))
|
return(EBUSY);
|
||||||
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);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* XXX TODO:
|
* Probe the device. If a value is returned, the
|
||||||
* If it was initialized before, the device structure
|
* device was found at the location.
|
||||||
* should also be initialized. We should
|
|
||||||
* reset (and possibly restart) the hardware, but
|
|
||||||
* I am not sure of the best way to do this...
|
|
||||||
*/
|
*/
|
||||||
|
if (sioprobe(&devi->isahd) == 0)
|
||||||
|
return(ENXIO);
|
||||||
|
if (sioattach(&devi->isahd) == 0)
|
||||||
|
return(ENXIO);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -575,19 +562,6 @@ card_intr(struct pccard_devinfo *devi)
|
|||||||
COM_UNLOCK();
|
COM_UNLOCK();
|
||||||
return(1);
|
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 */
|
#endif /* NCARD > 0 */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -474,17 +474,15 @@ SYSCTL_PROC(_machdep, OID_AUTO, conspeed, CTLTYPE_INT | CTLFLAG_RW,
|
|||||||
/*
|
/*
|
||||||
* PC-Card (PCMCIA) specific code.
|
* 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 void siounload(struct pccard_devinfo *); /* Disable driver */
|
||||||
static int card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
static int card_intr(struct pccard_devinfo *); /* Interrupt handler */
|
||||||
static void siosuspend(struct pccard_devinfo *); /* Suspend driver */
|
|
||||||
|
|
||||||
static struct pccard_device sio_info = {
|
static struct pccard_device sio_info = {
|
||||||
driver_name,
|
driver_name,
|
||||||
sioinit,
|
sioinit,
|
||||||
siounload,
|
siounload,
|
||||||
card_intr,
|
card_intr,
|
||||||
siosuspend,
|
|
||||||
0, /* Attributes - presently unused */
|
0, /* Attributes - presently unused */
|
||||||
&tty_imask /* Interrupt mask for device */
|
&tty_imask /* Interrupt mask for device */
|
||||||
/* XXX - Should this also include net_imask? */
|
/* XXX - Should this also include net_imask? */
|
||||||
@ -492,37 +490,26 @@ static struct pccard_device sio_info = {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the device - called from Slot manager.
|
* 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
|
int
|
||||||
sioinit(struct pccard_devinfo *devi, int first)
|
sioinit(struct pccard_devinfo *devi)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* validate unit number. */
|
/* validate unit number. */
|
||||||
if (first) {
|
if (devi->isahd.id_unit >= (NSIOTOT))
|
||||||
if (devi->isahd.id_unit >= (NSIOTOT))
|
return(ENODEV);
|
||||||
return(ENODEV);
|
/* Make sure it isn't already probed. */
|
||||||
/* Make sure it isn't already probed. */
|
if (com_addr(devi->isahd.id_unit))
|
||||||
if (com_addr(devi->isahd.id_unit))
|
return(EBUSY);
|
||||||
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);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* XXX TODO:
|
* Probe the device. If a value is returned, the
|
||||||
* If it was initialized before, the device structure
|
* device was found at the location.
|
||||||
* should also be initialized. We should
|
|
||||||
* reset (and possibly restart) the hardware, but
|
|
||||||
* I am not sure of the best way to do this...
|
|
||||||
*/
|
*/
|
||||||
|
if (sioprobe(&devi->isahd) == 0)
|
||||||
|
return(ENXIO);
|
||||||
|
if (sioattach(&devi->isahd) == 0)
|
||||||
|
return(ENXIO);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -575,19 +562,6 @@ card_intr(struct pccard_devinfo *devi)
|
|||||||
COM_UNLOCK();
|
COM_UNLOCK();
|
||||||
return(1);
|
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 */
|
#endif /* NCARD > 0 */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -77,16 +77,6 @@ static int pcic_resume_reset =
|
|||||||
SYSCTL_INT(_machdep_pccard, OID_AUTO, pcic_resume_reset, CTLFLAG_RW,
|
SYSCTL_INT(_machdep_pccard, OID_AUTO, pcic_resume_reset, CTLFLAG_RW,
|
||||||
&pcic_resume_reset, 0, "");
|
&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 PCCARD_MEMSIZE (4*1024)
|
||||||
|
|
||||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||||
@ -374,12 +364,7 @@ static int
|
|||||||
slot_suspend(void *arg)
|
slot_suspend(void *arg)
|
||||||
{
|
{
|
||||||
struct slot *slt = 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);
|
slt->ctrl->disable(slt);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -391,30 +376,18 @@ slot_resume(void *arg)
|
|||||||
|
|
||||||
if (pcic_resume_reset)
|
if (pcic_resume_reset)
|
||||||
slt->ctrl->resume(slt);
|
slt->ctrl->resume(slt);
|
||||||
if (apm_pccard_resume) {
|
/* Fake card removal/insertion events */
|
||||||
/* Fake card removal/insertion events */
|
if (slt->state == filled) {
|
||||||
if (slt->state == filled) {
|
int s;
|
||||||
int s;
|
|
||||||
|
|
||||||
s = splhigh();
|
s = splhigh();
|
||||||
disable_slot(slt);
|
disable_slot(slt);
|
||||||
slt->state = empty;
|
slt->state = empty;
|
||||||
splx(s);
|
splx(s);
|
||||||
slt->insert_seq = 1;
|
slt->insert_seq = 1;
|
||||||
slt->insert_ch = timeout(inserted, (void *)slt, hz);
|
slt->insert_ch = timeout(inserted, (void *)slt, hz);
|
||||||
selwakeup(&slt->selp);
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
#endif /* NAPM > 0 */
|
#endif /* NAPM > 0 */
|
||||||
@ -601,7 +574,7 @@ allocate_driver(struct slot *slt, struct dev_desc *desc)
|
|||||||
devi->next = slt->devices;
|
devi->next = slt->devices;
|
||||||
slt->devices = devi;
|
slt->devices = devi;
|
||||||
s = splhigh();
|
s = splhigh();
|
||||||
err = drv->enable(devi, 1);
|
err = drv->enable(devi);
|
||||||
splx(s);
|
splx(s);
|
||||||
/*
|
/*
|
||||||
* If the enable functions returns no error, then the
|
* If the enable functions returns no error, then the
|
||||||
|
@ -77,10 +77,9 @@ struct pccard_devinfo;
|
|||||||
|
|
||||||
struct pccard_device {
|
struct pccard_device {
|
||||||
char *name; /* Driver name */
|
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 */
|
void (*disable)(struct pccard_devinfo *); /* disable driver */
|
||||||
int (*handler)(struct pccard_devinfo *); /* interrupt handler */
|
int (*handler)(struct pccard_devinfo *); /* interrupt handler */
|
||||||
void (*suspend)(struct pccard_devinfo *); /* Suspend driver */
|
|
||||||
int attr; /* driver attributes */
|
int attr; /* driver attributes */
|
||||||
unsigned int *imask; /* Interrupt mask ptr */
|
unsigned int *imask; /* Interrupt mask ptr */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user