Checkpoint of today's changes. We now get to the point where the pccard
layer is trying to access the now unexistant chip functions. o Added DEVPRINTF which is like DPRINTF only calls device_printf. o Made it possible to define PCICDEBUG o Remove ph_parent and use the softc pointer sc instead in pcic_handle. o Remove all references to dv_xname o Add some debug messages. o enable MI attach/detach calling for pccard. o convert pcic_chip_socket_{en,dis}able to pcic_{dis,en}able_socket and connect them to the power_{enable,disbale}_socket. o Remove pccard pointer from pcic_softc. o GC some unused pccard functions. o Convert pccard_chip_socket* to POWER_ENABLE_SOCKET o kill pccard_attach_args. o power_if.m updates. More to come.
This commit is contained in:
parent
51055f2ce0
commit
e62d9f4df5
@ -47,15 +47,21 @@
|
||||
#include <dev/pccard/pccardchip.h>
|
||||
#include <dev/pccard/pccardvar.h>
|
||||
|
||||
#include "power_if.h"
|
||||
|
||||
#define PCCARDDEBUG
|
||||
|
||||
#ifdef PCCARDDEBUG
|
||||
int pccard_debug = 0;
|
||||
int pccard_debug = 1;
|
||||
#define DPRINTF(arg) if (pccard_debug) printf arg
|
||||
#define DEVPRINTF(arg) if (pccard_debug) device_printf arg
|
||||
int pccardintr_debug = 0;
|
||||
/* this is done this way to avoid doing lots of conditionals
|
||||
at interrupt level. */
|
||||
#define PCCARD_CARD_INTR (pccardintr_debug?pccard_card_intrdebug:pccard_card_intr)
|
||||
#else
|
||||
#define DPRINTF(arg)
|
||||
#define DEVPRINTF(arg)
|
||||
#define PCCARD_CARD_INTR (pccard_card_intr)
|
||||
#endif
|
||||
|
||||
@ -67,11 +73,6 @@ int pccard_verbose = 0;
|
||||
|
||||
int pccard_print(void *, const char *);
|
||||
|
||||
static __inline void pccard_socket_enable(pccard_chipset_tag_t,
|
||||
pccard_chipset_handle_t *);
|
||||
static __inline void pccard_socket_disable(pccard_chipset_tag_t,
|
||||
pccard_chipset_handle_t *);
|
||||
|
||||
int pccard_card_intr(void *);
|
||||
#ifdef PCCARDDEBUG
|
||||
int pccard_card_intrdebug(void *);
|
||||
@ -107,20 +108,24 @@ pccard_card_attach(device_t dev)
|
||||
struct pccard_softc *sc = (struct pccard_softc *)
|
||||
device_get_softc(dev);
|
||||
struct pccard_function *pf;
|
||||
struct pccard_attach_args paa;
|
||||
int attached;
|
||||
|
||||
DEVPRINTF((dev, "pccard_card_attach\n"));
|
||||
/*
|
||||
* this is here so that when socket_enable calls gettype, trt happens
|
||||
*/
|
||||
STAILQ_INIT(&sc->card.pf_head);
|
||||
|
||||
pccard_chip_socket_enable(sc->pct, sc->pch);
|
||||
DEVPRINTF((dev, "chip_socket_enable\n"));
|
||||
POWER_ENABLE_SOCKET(device_get_parent(dev), dev);
|
||||
|
||||
DEVPRINTF((dev, "read_cis\n"));
|
||||
pccard_read_cis(sc);
|
||||
|
||||
pccard_chip_socket_disable(sc->pct, sc->pch);
|
||||
DEVPRINTF((dev, "chip_socket_disable\n"));
|
||||
POWER_DISABLE_SOCKET(device_get_parent(dev), dev);
|
||||
|
||||
DEVPRINTF((dev, "check_cis_quirks\n"));
|
||||
pccard_check_cis_quirks(dev);
|
||||
|
||||
/*
|
||||
@ -138,15 +143,16 @@ pccard_card_attach(device_t dev)
|
||||
|
||||
attached = 0;
|
||||
|
||||
DEVPRINTF((dev, "functions scanning\n"));
|
||||
STAILQ_FOREACH(pf, &sc->card.pf_head, pf_list) {
|
||||
if (STAILQ_EMPTY(&pf->cfe_head))
|
||||
continue;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (pf->child != NULL) {
|
||||
printf("%s: %s still attached to function %d!\n",
|
||||
sc->dev.dv_xname, pf->child->dv_xname,
|
||||
pf->number);
|
||||
device_printf(sc->dev,
|
||||
"%s still attached to function %d!\n",
|
||||
device_get_name(pf->child), pf->number);
|
||||
panic("pccard_card_attach");
|
||||
}
|
||||
#endif
|
||||
@ -161,19 +167,13 @@ pccard_card_attach(device_t dev)
|
||||
if (STAILQ_EMPTY(&pf->cfe_head))
|
||||
continue;
|
||||
|
||||
paa.manufacturer = sc->card.manufacturer;
|
||||
paa.product = sc->card.product;
|
||||
paa.card = &sc->card;
|
||||
paa.pf = pf;
|
||||
|
||||
#if XXX
|
||||
if (attach_child()) {
|
||||
attached++;
|
||||
|
||||
DPRINTF(("%s: function %d CCR at %d "
|
||||
DEVPRINTF((sc->dev, "function %d CCR at %d "
|
||||
"offset %lx: %x %x %x %x, %x %x %x %x, %x\n",
|
||||
sc->dev.dv_xname, pf->number,
|
||||
pf->pf_ccr_window, pf->pf_ccr_offset,
|
||||
pf->number, pf->pf_ccr_window, pf->pf_ccr_offset,
|
||||
pccard_ccr_read(pf, 0x00),
|
||||
pccard_ccr_read(pf, 0x02), pccard_ccr_read(pf, 0x04),
|
||||
pccard_ccr_read(pf, 0x06), pccard_ccr_read(pf, 0x0A),
|
||||
@ -205,13 +205,13 @@ pccard_card_detach(device_t dev, int flags)
|
||||
continue;
|
||||
if (pf->child == NULL)
|
||||
continue;
|
||||
DPRINTF(("%s: detaching %s (function %d)\n",
|
||||
sc->dev.dv_xname, pf->child->dv_xname, pf->number));
|
||||
DEVPRINTF((sc->dev, "detaching %s (function %d)\n",
|
||||
device_get_name(pf->child), pf->number));
|
||||
#if XXX
|
||||
if ((error = config_detach(pf->child, flags)) != 0) {
|
||||
printf("%s: error %d detaching %s (function %d)\n",
|
||||
sc->dev.dv_xname, error, pf->child->dv_xname,
|
||||
pf->number);
|
||||
device_printf(sc->dev,
|
||||
"error %d detaching %s (function %d)\n",
|
||||
error, device_get_name(pf->child), pf->number);
|
||||
} else
|
||||
pf->child = NULL;
|
||||
#endif
|
||||
@ -235,8 +235,8 @@ pccard_card_deactivate(device_t dev)
|
||||
continue;
|
||||
if (pf->child == NULL)
|
||||
continue;
|
||||
DPRINTF(("%s: deactivating %s (function %d)\n",
|
||||
sc->dev.dv_xname, pf->child->dv_xname, pf->number));
|
||||
DEVPRINTF((sc->dev, "deactivating %s (function %d)\n",
|
||||
device_get_name(pf->child), pf->number));
|
||||
#if XXX
|
||||
config_deactivate(pf->child);
|
||||
#endif
|
||||
@ -280,20 +280,6 @@ pccard_function_init(pf, cfe)
|
||||
pf->cfe = cfe;
|
||||
}
|
||||
|
||||
static __inline void pccard_socket_enable(pct, pch)
|
||||
pccard_chipset_tag_t pct;
|
||||
pccard_chipset_handle_t *pch;
|
||||
{
|
||||
pccard_chip_socket_enable(pct, pch);
|
||||
}
|
||||
|
||||
static __inline void pccard_socket_disable(pct, pch)
|
||||
pccard_chipset_tag_t pct;
|
||||
pccard_chipset_handle_t *pch;
|
||||
{
|
||||
pccard_chip_socket_disable(pct, pch);
|
||||
}
|
||||
|
||||
/* Enable a PCCARD function */
|
||||
int
|
||||
pccard_function_enable(pf)
|
||||
@ -310,9 +296,10 @@ pccard_function_enable(pf)
|
||||
* necessary.
|
||||
*/
|
||||
if (pf->sc->sc_enabled_count++ == 0)
|
||||
pccard_chip_socket_enable(pf->sc->pct, pf->sc->pch);
|
||||
DPRINTF(("%s: ++enabled_count = %d\n", pf->sc->dev.dv_xname,
|
||||
pf->sc->sc_enabled_count));
|
||||
POWER_ENABLE_SOCKET(device_get_parent(pf->sc->dev),
|
||||
pf->sc->dev);
|
||||
DEVPRINTF((pf->sc->dev, "++enabled_count = %d\n",
|
||||
pf->sc->sc_enabled_count));
|
||||
|
||||
if (pf->pf_flags & PFF_ENABLED) {
|
||||
/*
|
||||
@ -403,21 +390,20 @@ pccard_function_enable(pf)
|
||||
#ifdef PCCARDDEBUG
|
||||
if (pccard_debug) {
|
||||
STAILQ_FOREACH(tmp, &pf->sc->card.pf_head, pf_list) {
|
||||
printf("%s: function %d CCR at %d offset %lx: "
|
||||
"%x %x %x %x, %x %x %x %x, %x\n",
|
||||
tmp->sc->dev.dv_xname, tmp->number,
|
||||
tmp->pf_ccr_window, tmp->pf_ccr_offset,
|
||||
pccard_ccr_read(tmp, 0x00),
|
||||
pccard_ccr_read(tmp, 0x02),
|
||||
pccard_ccr_read(tmp, 0x04),
|
||||
pccard_ccr_read(tmp, 0x06),
|
||||
|
||||
pccard_ccr_read(tmp, 0x0A),
|
||||
pccard_ccr_read(tmp, 0x0C),
|
||||
pccard_ccr_read(tmp, 0x0E),
|
||||
pccard_ccr_read(tmp, 0x10),
|
||||
|
||||
pccard_ccr_read(tmp, 0x12));
|
||||
device_printf(tmp->sc->dev,
|
||||
"function %d CCR at %d offset %x: "
|
||||
"%x %x %x %x, %x %x %x %x, %x\n",
|
||||
tmp->number, tmp->pf_ccr_window,
|
||||
tmp->pf_ccr_offset,
|
||||
pccard_ccr_read(tmp, 0x00),
|
||||
pccard_ccr_read(tmp, 0x02),
|
||||
pccard_ccr_read(tmp, 0x04),
|
||||
pccard_ccr_read(tmp, 0x06),
|
||||
pccard_ccr_read(tmp, 0x0A),
|
||||
pccard_ccr_read(tmp, 0x0C),
|
||||
pccard_ccr_read(tmp, 0x0E),
|
||||
pccard_ccr_read(tmp, 0x10),
|
||||
pccard_ccr_read(tmp, 0x12));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -431,8 +417,9 @@ pccard_function_enable(pf)
|
||||
* necessary.
|
||||
*/
|
||||
if (--pf->sc->sc_enabled_count == 0)
|
||||
pccard_chip_socket_disable(pf->sc->pct, pf->sc->pch);
|
||||
DPRINTF(("%s: --enabled_count = %d\n", pf->sc->dev.dv_xname,
|
||||
POWER_DISABLE_SOCKET(device_get_parent(pf->sc->dev),
|
||||
pf->sc->dev);
|
||||
DEVPRINTF((pf->sc->dev, "--enabled_count = %d\n",
|
||||
pf->sc->sc_enabled_count));
|
||||
|
||||
return (1);
|
||||
@ -481,9 +468,10 @@ pccard_function_disable(pf)
|
||||
* necessary.
|
||||
*/
|
||||
if (--pf->sc->sc_enabled_count == 0)
|
||||
pccard_chip_socket_disable(pf->sc->pct, pf->sc->pch);
|
||||
DPRINTF(("%s: --enabled_count = %d\n", pf->sc->dev.dv_xname,
|
||||
pf->sc->sc_enabled_count));
|
||||
POWER_DISABLE_SOCKET(device_get_parent(pf->sc->dev),
|
||||
pf->sc->dev);
|
||||
DEVPRINTF((pf->sc->dev, "--enabled_count = %d\n",
|
||||
pf->sc->sc_enabled_count));
|
||||
}
|
||||
|
||||
int
|
||||
@ -582,9 +570,9 @@ pccard_intr_establish(pf, ipl, ih_fct, ih_arg)
|
||||
|
||||
STAILQ_FOREACH(pf2, &pf->sc->card.pf_head, pf_list) {
|
||||
if (pf2->ih_fct) {
|
||||
DPRINTF(("%s: function %d has ih_fct %p\n",
|
||||
pf->sc->dev.dv_xname, pf2->number,
|
||||
pf2->ih_fct));
|
||||
DEVPRINTF((pf2->sc->dev,
|
||||
"function %d has ih_fct %p\n",
|
||||
pf2->number, pf2->ih_fct));
|
||||
|
||||
if (ihcnt == 0) {
|
||||
hiipl = pf2->ih_ipl;
|
||||
@ -806,11 +794,12 @@ pccard_card_intrdebug(arg)
|
||||
ret = 0;
|
||||
|
||||
STAILQ_FOREACH(pf, &sc->card.pf_head, pf_list) {
|
||||
printf("%s: intr flags=%x fct=%d cor=%02x csr=%02x pin=%02x",
|
||||
sc->dev.dv_xname, pf->pf_flags, pf->number,
|
||||
pccard_ccr_read(pf, PCCARD_CCR_OPTION),
|
||||
pccard_ccr_read(pf, PCCARD_CCR_STATUS),
|
||||
pccard_ccr_read(pf, PCCARD_CCR_PIN));
|
||||
device_printf(sc->dev,
|
||||
"intr flags=%x fct=%d cor=%02x csr=%02x pin=%02x",
|
||||
pf->pf_flags, pf->number,
|
||||
pccard_ccr_read(pf, PCCARD_CCR_OPTION),
|
||||
pccard_ccr_read(pf, PCCARD_CCR_STATUS),
|
||||
pccard_ccr_read(pf, PCCARD_CCR_PIN));
|
||||
if (pf->ih_fct != NULL &&
|
||||
(pf->ccr_mask & (1 << (PCCARD_CCR_STATUS / 2)))) {
|
||||
reg = pccard_ccr_read(pf, PCCARD_CCR_STATUS);
|
||||
|
@ -126,11 +126,13 @@ struct pccard_chip_functions {
|
||||
#define pccard_chip_intr_disestablish(tag, handle, ih) \
|
||||
((*(tag)->intr_disestablish)((handle), (ih)))
|
||||
|
||||
#if 0
|
||||
/* Socket functions. */
|
||||
#define pccard_chip_socket_enable(tag, handle) \
|
||||
((*(tag)->socket_enable)((handle)))
|
||||
#define pccard_chip_socket_disable(tag, handle) \
|
||||
((*(tag)->socket_disable)((handle)))
|
||||
#endif /* 0 */
|
||||
|
||||
struct pccardbus_attach_args {
|
||||
char *paa_busname; /* Bus name */
|
||||
|
@ -172,11 +172,12 @@ struct pccard_softc {
|
||||
pccard_chipset_tag_t pct;
|
||||
pccard_chipset_handle_t pch;
|
||||
|
||||
device_t dev;
|
||||
|
||||
/* this stuff is for the card */
|
||||
struct pccard_card card;
|
||||
void *ih;
|
||||
int sc_enabled_count; /* how many functions are
|
||||
enabled */
|
||||
int sc_enabled_count; /* num functions enabled */
|
||||
|
||||
/*
|
||||
* These are passed down from the PCCARD chip, and exist only
|
||||
@ -198,13 +199,6 @@ struct pccard_cis_quirk {
|
||||
struct pccard_config_entry *cfe;
|
||||
};
|
||||
|
||||
struct pccard_attach_args {
|
||||
int32_t manufacturer;
|
||||
int32_t product;
|
||||
struct pccard_card *card;
|
||||
struct pccard_function *pf;
|
||||
};
|
||||
|
||||
struct pccard_tuple {
|
||||
unsigned int code;
|
||||
unsigned int length;
|
||||
|
@ -33,21 +33,12 @@ INTERFACE power;
|
||||
# generic enough to be used for other systems in addition to the pccard
|
||||
# <-> pcic interface that it was originally written for.
|
||||
#
|
||||
METHOD int set_slot {
|
||||
METHOD int enable_socket {
|
||||
device_t dev;
|
||||
device_t child;
|
||||
int slot;
|
||||
int vpp;
|
||||
int vcc;
|
||||
};
|
||||
|
||||
#
|
||||
# Gets the current power requirements of the card.
|
||||
#
|
||||
METHOD int get_slot {
|
||||
METHOD int disable_socket {
|
||||
device_t dev;
|
||||
device_t child;
|
||||
int slot;
|
||||
int *vpp;
|
||||
int *vcc;
|
||||
};
|
||||
|
@ -56,14 +56,16 @@
|
||||
#include <dev/pcic/i82365reg.h>
|
||||
#include <dev/pcic/i82365var.h>
|
||||
|
||||
#define PCICDEBUG
|
||||
|
||||
#ifdef PCICDEBUG
|
||||
int pcic_debug = 0;
|
||||
int pcic_debug = 1;
|
||||
#define DPRINTF(arg) if (pcic_debug) printf arg;
|
||||
#define DEVPRINTF(arg) if (pcic_debug) device_printf arg;
|
||||
#else
|
||||
#define DPRINTF(arg)
|
||||
#define DEVPRINTF(arg)
|
||||
#endif
|
||||
/* To later turn into debug */
|
||||
#define DEVPRINTF(arg) device_printf arg;
|
||||
|
||||
#define DETACH_FORCE 0x1
|
||||
|
||||
@ -282,7 +284,7 @@ pcic_attach(device_t dev)
|
||||
|
||||
DPRINTF(("pcic ident regs:"));
|
||||
|
||||
sc->handle[0].ph_parent = (struct device *)sc;
|
||||
sc->handle[0].sc = sc;
|
||||
sc->handle[0].sock = C0SA;
|
||||
/* initialise pcic_read and pcic_write functions */
|
||||
sc->handle[0].ph_read = st_pcic_read;
|
||||
@ -299,7 +301,7 @@ pcic_attach(device_t dev)
|
||||
|
||||
DPRINTF((" 0x%02x", reg));
|
||||
|
||||
sc->handle[1].ph_parent = (struct device *)sc;
|
||||
sc->handle[1].sc = sc;
|
||||
sc->handle[1].sock = C0SB;
|
||||
/* initialise pcic_read and pcic_write functions */
|
||||
sc->handle[1].ph_read = st_pcic_read;
|
||||
@ -321,7 +323,7 @@ pcic_attach(device_t dev)
|
||||
* if you try to read from the second one. Maybe pcic_ident_ok
|
||||
* shouldn't accept 0?
|
||||
*/
|
||||
sc->handle[2].ph_parent = (struct device *)sc;
|
||||
sc->handle[2].sc = sc;
|
||||
sc->handle[2].sock = C1SA;
|
||||
/* initialise pcic_read and pcic_write functions */
|
||||
sc->handle[2].ph_read = st_pcic_read;
|
||||
@ -341,7 +343,7 @@ pcic_attach(device_t dev)
|
||||
|
||||
DPRINTF((" 0x%02x", reg));
|
||||
|
||||
sc->handle[3].ph_parent = (struct device *)sc;
|
||||
sc->handle[3].sc = sc;
|
||||
sc->handle[3].sock = C1SB;
|
||||
/* initialise pcic_read and pcic_write functions */
|
||||
sc->handle[3].ph_read = st_pcic_read;
|
||||
@ -485,7 +487,7 @@ pcic_event_thread(void *arg)
|
||||
struct pcic_handle *h = arg;
|
||||
struct pcic_event *pe;
|
||||
int s;
|
||||
struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
|
||||
struct pcic_softc *sc = h->sc;
|
||||
|
||||
while (h->shutdown == 0) {
|
||||
s = splhigh();
|
||||
@ -523,7 +525,7 @@ pcic_event_thread(void *arg)
|
||||
}
|
||||
splx(s);
|
||||
|
||||
DPRINTF(("%s: insertion event\n", h->ph_parent->dv_xname));
|
||||
DEVPRINTF((h->dev, "insertion event\n"));
|
||||
pcic_attach_card(h);
|
||||
break;
|
||||
|
||||
@ -547,7 +549,7 @@ pcic_event_thread(void *arg)
|
||||
}
|
||||
splx(s);
|
||||
|
||||
DPRINTF(("%s: removal event\n", h->ph_parent->dv_xname));
|
||||
DEVPRINTF((h->dev, "removal event\n"));
|
||||
pcic_detach_card(h, DETACH_FORCE);
|
||||
break;
|
||||
|
||||
@ -570,7 +572,7 @@ void
|
||||
pcic_init_socket(struct pcic_handle *h)
|
||||
{
|
||||
int reg;
|
||||
struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
|
||||
struct pcic_softc *sc = h->sc;
|
||||
|
||||
/*
|
||||
* queue creation of a kernel thread to handle insert/removal events.
|
||||
@ -590,8 +592,8 @@ pcic_init_socket(struct pcic_handle *h)
|
||||
(h->vendor == PCIC_VENDOR_CIRRUS_PD672X)) {
|
||||
reg = pcic_read(h, PCIC_CIRRUS_MISC_CTL_2);
|
||||
if (reg & PCIC_CIRRUS_MISC_CTL_2_SUSPEND) {
|
||||
DPRINTF(("%s: socket %02x was suspended\n",
|
||||
sc->dev.dv_xname, h->sock));
|
||||
DEVPRINTF((sc->dev, "socket %02x was suspended\n",
|
||||
h->sock));
|
||||
reg &= ~PCIC_CIRRUS_MISC_CTL_2_SUSPEND;
|
||||
pcic_write(h, PCIC_CIRRUS_MISC_CTL_2, reg);
|
||||
}
|
||||
@ -633,33 +635,31 @@ pcic_intr_socket(struct pcic_handle *h)
|
||||
PCIC_CSC_BATTWARN | PCIC_CSC_BATTDEAD);
|
||||
|
||||
if (cscreg & PCIC_CSC_GPI) {
|
||||
DPRINTF(("%s: %02x GPI\n", h->ph_parent->dv_xname, h->sock));
|
||||
DEVPRINTF((h->dev, "%02x GPI\n", h->sock));
|
||||
}
|
||||
if (cscreg & PCIC_CSC_CD) {
|
||||
int statreg;
|
||||
|
||||
statreg = pcic_read(h, PCIC_IF_STATUS);
|
||||
|
||||
DPRINTF(("%s: %02x CD %x\n", h->ph_parent->dv_xname, h->sock,
|
||||
statreg));
|
||||
DEVPRINTF((h->dev, "%02x CD %x\n", h->sock, statreg));
|
||||
|
||||
if ((statreg & PCIC_IF_STATUS_CARDDETECT_MASK) ==
|
||||
PCIC_IF_STATUS_CARDDETECT_PRESENT) {
|
||||
if (h->laststate != PCIC_LASTSTATE_PRESENT) {
|
||||
DPRINTF(("%s: enqueing INSERTION event\n",
|
||||
h->ph_parent->dv_xname));
|
||||
DEVPRINTF((h->dev,
|
||||
"enqueing INSERTION event\n"));
|
||||
pcic_queue_event(h, PCIC_EVENT_INSERTION);
|
||||
}
|
||||
h->laststate = PCIC_LASTSTATE_PRESENT;
|
||||
} else {
|
||||
if (h->laststate == PCIC_LASTSTATE_PRESENT) {
|
||||
/* Deactivate the card now. */
|
||||
DPRINTF(("%s: deactivating card\n",
|
||||
h->ph_parent->dv_xname));
|
||||
DEVPRINTF((h->dev, "deactivating card\n"));
|
||||
pcic_deactivate_card(h);
|
||||
|
||||
DPRINTF(("%s: enqueing REMOVAL event\n",
|
||||
h->ph_parent->dv_xname));
|
||||
DEVPRINTF((h->dev,
|
||||
"enqueing REMOVAL event\n"));
|
||||
pcic_queue_event(h, PCIC_EVENT_REMOVAL);
|
||||
}
|
||||
h->laststate = ((statreg & PCIC_IF_STATUS_CARDDETECT_MASK) == 0)
|
||||
@ -667,14 +667,14 @@ pcic_intr_socket(struct pcic_handle *h)
|
||||
}
|
||||
}
|
||||
if (cscreg & PCIC_CSC_READY) {
|
||||
DPRINTF(("%s: %02x READY\n", h->ph_parent->dv_xname, h->sock));
|
||||
DEVPRINTF((h->dev, "%02x READY\n", h->sock));
|
||||
/* shouldn't happen */
|
||||
}
|
||||
if (cscreg & PCIC_CSC_BATTWARN) {
|
||||
DPRINTF(("%s: %02x BATTWARN\n", h->ph_parent->dv_xname, h->sock));
|
||||
DEVPRINTF((h->dev, "%02x BATTWARN\n", h->sock));
|
||||
}
|
||||
if (cscreg & PCIC_CSC_BATTDEAD) {
|
||||
DPRINTF(("%s: %02x BATTDEAD\n", h->ph_parent->dv_xname, h->sock));
|
||||
DEVPRINTF((h->dev, "%02x BATTDEAD\n", h->sock));
|
||||
}
|
||||
}
|
||||
|
||||
@ -698,10 +698,10 @@ pcic_queue_event(struct pcic_handle *h, int event)
|
||||
void
|
||||
pcic_attach_card(struct pcic_handle *h)
|
||||
{
|
||||
|
||||
DPRINTF(("pcic_attach_card h %p h->dev %p\n", h, h->dev));
|
||||
if (!(h->flags & PCIC_FLAG_CARDP)) {
|
||||
/* call the MI attach function */
|
||||
/* XXX pccard_card_attach(h->pccard); */
|
||||
pccard_card_attach(h->dev);
|
||||
|
||||
h->flags |= PCIC_FLAG_CARDP;
|
||||
} else {
|
||||
@ -717,7 +717,7 @@ pcic_detach_card(struct pcic_handle *h, int flags)
|
||||
h->flags &= ~PCIC_FLAG_CARDP;
|
||||
|
||||
/* call the MI detach function */
|
||||
/* XXX pccard_card_detach(h->pccard, flags); */
|
||||
pccard_card_detach(h->dev, flags);
|
||||
} else {
|
||||
DPRINTF(("pcic_detach_card: already detached"));
|
||||
}
|
||||
@ -728,7 +728,7 @@ pcic_deactivate_card(struct pcic_handle *h)
|
||||
{
|
||||
|
||||
/* call the MI deactivate function */
|
||||
pccard_card_deactivate(h->pccard);
|
||||
pccard_card_deactivate(h->dev);
|
||||
|
||||
/* power down the socket */
|
||||
pcic_write(h, PCIC_PWRCTL, 0);
|
||||
@ -745,7 +745,7 @@ pcic_chip_mem_alloc(struct pcic_handle *h, bus_size_t size,
|
||||
bus_addr_t addr;
|
||||
bus_size_t sizepg;
|
||||
int i, mask, mhandle;
|
||||
struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
|
||||
struct pcic_softc *sc = h->sc;
|
||||
|
||||
/* out of sc->memh, allocate as many pages as necessary */
|
||||
|
||||
@ -781,7 +781,7 @@ pcic_chip_mem_alloc(struct pcic_handle *h, bus_size_t size,
|
||||
static void
|
||||
pcic_chip_mem_free(struct pcic_handle *h, struct pccard_mem_handle *pcmhp)
|
||||
{
|
||||
struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
|
||||
struct pcic_softc *sc = h->sc;
|
||||
|
||||
sc->subregionmask |= pcmhp->mhandle;
|
||||
}
|
||||
@ -906,7 +906,7 @@ pcic_chip_mem_map(struct pcic_handle *h, int kind, bus_addr_t card_addr,
|
||||
bus_addr_t busaddr;
|
||||
long card_offset;
|
||||
int i, win;
|
||||
struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
|
||||
struct pcic_softc *sc = h->sc;
|
||||
|
||||
win = -1;
|
||||
for (i = 0; i < (sizeof(mem_map_index) / sizeof(mem_map_index[0]));
|
||||
@ -985,7 +985,7 @@ pcic_chip_io_alloc(struct pcic_handle *h, bus_addr_t start, bus_size_t size,
|
||||
bus_space_handle_t ioh;
|
||||
bus_addr_t ioaddr;
|
||||
int flags = 0;
|
||||
struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
|
||||
struct pcic_softc *sc = h->sc;
|
||||
|
||||
/*
|
||||
* Allocate some arbitrary I/O space.
|
||||
@ -1100,7 +1100,7 @@ pcic_chip_io_map(struct pcic_handle *h, int width, bus_addr_t offset,
|
||||
#ifdef PCICDEBUG
|
||||
static char *width_names[] = { "auto", "io8", "io16" };
|
||||
#endif
|
||||
struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
|
||||
struct pcic_softc *sc = h->sc;
|
||||
|
||||
/* XXX Sanity check offset/size. */
|
||||
|
||||
@ -1179,9 +1179,10 @@ pcic_wait_ready(struct pcic_handle *h)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
pcic_chip_socket_enable(struct pcic_handle *h)
|
||||
int
|
||||
pcic_enable_socket(device_t dev, device_t child)
|
||||
{
|
||||
struct pcic_handle *h = NULL; /* XXXIMPXXX */
|
||||
int cardtype, reg, win;
|
||||
|
||||
/* this bit is mostly stolen from pcic_attach_card */
|
||||
@ -1254,7 +1255,7 @@ pcic_chip_socket_enable(struct pcic_handle *h)
|
||||
|
||||
/* set the card type */
|
||||
|
||||
cardtype = pccard_card_gettype(h->pccard);
|
||||
cardtype = pccard_card_gettype(h->dev);
|
||||
|
||||
reg = pcic_read(h, PCIC_INTR);
|
||||
reg &= ~(PCIC_INTR_CARDTYPE_MASK | PCIC_INTR_IRQ_MASK | PCIC_INTR_ENABLE);
|
||||
@ -1264,8 +1265,7 @@ pcic_chip_socket_enable(struct pcic_handle *h)
|
||||
reg |= h->ih_irq;
|
||||
pcic_write(h, PCIC_INTR, reg);
|
||||
|
||||
DPRINTF(("%s: pcic_chip_socket_enable %02x cardtype %s %02x\n",
|
||||
h->ph_parent->dv_xname, h->sock,
|
||||
DEVPRINTF((h->dev, "pcic_chip_socket_enable cardtype %s %02x\n",
|
||||
((cardtype == PCCARD_IFTYPE_IO) ? "io" : "mem"), reg));
|
||||
|
||||
/* reinstall all the memory and io mappings */
|
||||
@ -1277,11 +1277,14 @@ pcic_chip_socket_enable(struct pcic_handle *h)
|
||||
for (win = 0; win < PCIC_IO_WINS; win++)
|
||||
if (h->ioalloc & (1 << win))
|
||||
pcic_chip_do_io_map(h, win);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
pcic_chip_socket_disable(struct pcic_handle *h)
|
||||
int
|
||||
pcic_disable_socket(device_t dev, device_t child)
|
||||
{
|
||||
struct pcic_handle *h = NULL; /* XXXIMPXXX */
|
||||
DPRINTF(("pcic_chip_socket_disable\n"));
|
||||
|
||||
/* power down the socket */
|
||||
@ -1292,6 +1295,8 @@ pcic_chip_socket_disable(struct pcic_handle *h)
|
||||
* wait 300ms until power fails (Tpf).
|
||||
*/
|
||||
DELAY(300 * 1000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u_int8_t
|
||||
|
@ -54,6 +54,8 @@
|
||||
#include <dev/pcic/i82365reg.h>
|
||||
#include <dev/pcic/i82365var.h>
|
||||
|
||||
#include "power_if.h"
|
||||
|
||||
/*****************************************************************************
|
||||
* Configurable parameters.
|
||||
*****************************************************************************/
|
||||
@ -359,10 +361,11 @@ static device_method_t pcic_isa_methods[] = {
|
||||
/* pccard/cardbus interface */
|
||||
DEVMETHOD(card_set_resource_attribute, pcic_set_resource_attribute),
|
||||
DEVMETHOD(card_get_resource_attribute, pcic_get_resource_attribute),
|
||||
#endif
|
||||
|
||||
/* Power Interface */
|
||||
/* Not yet */
|
||||
#endif
|
||||
DEVMETHOD(power_enable_socket, pcic_enable_socket),
|
||||
DEVMETHOD(power_disable_socket, pcic_disable_socket),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
@ -48,7 +48,6 @@ struct pcic_event {
|
||||
|
||||
struct pcic_handle {
|
||||
struct pcic_softc *sc;
|
||||
struct device *ph_parent;
|
||||
device_t dev;
|
||||
bus_space_tag_t ph_bus_t; /* I/O or MEM? I don't mind */
|
||||
bus_space_handle_t ph_bus_h;
|
||||
@ -64,7 +63,6 @@ struct pcic_handle {
|
||||
int ioalloc;
|
||||
struct pccard_io_handle io[PCIC_IO_WINS];
|
||||
int ih_irq;
|
||||
struct device *pccard;
|
||||
|
||||
int shutdown;
|
||||
struct proc *event_thread;
|
||||
@ -191,3 +189,5 @@ int pcic_teardown_intr(device_t dev, device_t child, struct resource *irq,
|
||||
void *cookiep);
|
||||
int pcic_suspend(device_t dev);
|
||||
int pcic_resume(device_t dev);
|
||||
int pcic_enable_socket(device_t dev, device_t child);
|
||||
int pcic_disable_socket(device_t dev, device_t child);
|
||||
|
Loading…
Reference in New Issue
Block a user