summaryrefslogtreecommitdiffstats
path: root/sys/dev/pccard
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2000-08-19 19:22:04 +0000
committerimp <imp@FreeBSD.org>2000-08-19 19:22:04 +0000
commit5c155c532f5aadbbbd52796b924404ad35fac4e6 (patch)
treece56991f5e70fba0a5220cb1bcd291d534072d88 /sys/dev/pccard
parentb7be66adbf36427ea4323d9b43d4f413abfed6f3 (diff)
downloadFreeBSD-src-5c155c532f5aadbbbd52796b924404ad35fac4e6.zip
FreeBSD-src-5c155c532f5aadbbbd52796b924404ad35fac4e6.tar.gz
o Move to using PCCARD_SOFTC(dev)
o fill in the size of the actual softc, rather than 1 in data structure o minor debugging improvements.
Diffstat (limited to 'sys/dev/pccard')
-rw-r--r--sys/dev/pccard/pccard.c25
-rw-r--r--sys/dev/pccard/pccard_cis.c2
-rw-r--r--sys/dev/pccard/pccard_cis_quirks.c3
-rw-r--r--sys/dev/pccard/pccardvar.h6
4 files changed, 16 insertions, 20 deletions
diff --git a/sys/dev/pccard/pccard.c b/sys/dev/pccard/pccard.c
index fe799b8..bd96857 100644
--- a/sys/dev/pccard/pccard.c
+++ b/sys/dev/pccard/pccard.c
@@ -93,8 +93,7 @@ pccard_ccr_write(pf, ccr, val)
static int
pccard_attach_card(device_t dev)
{
- struct pccard_softc *sc = (struct pccard_softc *)
- device_get_softc(dev);
+ struct pccard_softc *sc = PCCARD_SOFTC(dev);
struct pccard_function *pf;
device_t child;
int attached;
@@ -111,9 +110,6 @@ pccard_attach_card(device_t dev)
DEVPRINTF((dev, "read_cis\n"));
pccard_read_cis(sc);
- 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);
@@ -137,13 +133,16 @@ pccard_attach_card(device_t dev)
if (STAILQ_EMPTY(&pf->cfe_head))
continue;
- printf ("pf %x sc %x\n", pf, sc);
+ printf ("pf %p sc %p\n", pf, sc);
pf->sc = sc;
pf->cfe = NULL;
pf->ih_fct = NULL;
pf->ih_arg = NULL;
}
+ DEVPRINTF((dev, "chip_socket_disable\n"));
+ POWER_DISABLE_SOCKET(device_get_parent(dev), dev);
+
STAILQ_FOREACH(pf, &sc->card.pf_head, pf_list) {
if (STAILQ_EMPTY(&pf->cfe_head))
continue;
@@ -163,7 +162,7 @@ pccard_attach_card(device_t dev)
child = device_add_child(dev, NULL, -1);
pccard_function_init(pf, STAILQ_FIRST(&pf->cfe_head));
pccard_function_enable(pf);
- device_printf(dev, "pf %x pf->sc %x\n", pf, pf->sc);
+ device_printf(dev, "pf %p pf->sc %p\n", pf, pf->sc);
if (device_probe_and_attach(child) == 0) {
attached++;
@@ -183,8 +182,7 @@ pccard_attach_card(device_t dev)
static int
pccard_detach_card(device_t dev, int flags)
{
- struct pccard_softc *sc = (struct pccard_softc *)
- device_get_softc(dev);
+ struct pccard_softc *sc = PCCARD_SOFTC(dev);
struct pccard_function *pf;
/*
@@ -204,8 +202,7 @@ pccard_detach_card(device_t dev, int flags)
static int
pccard_card_gettype(device_t dev, int *type)
{
- struct pccard_softc *sc = (struct pccard_softc *)
- device_get_softc(dev);
+ struct pccard_softc *sc = PCCARD_SOFTC(dev);
struct pccard_function *pf;
/*
@@ -515,11 +512,11 @@ pccard_probe(device_t dev)
static int
pccard_attach(device_t dev)
{
- struct pccard_softc *sc;
+ struct pccard_softc *sc = PCCARD_SOFTC(dev);
- sc = (struct pccard_softc *) device_get_softc(dev);
sc->dev = dev;
sc->sc_enabled_count = 0;
+ DEVPRINTF((dev, "pccard_attach %p\n", dev));
return bus_generic_attach(dev);
}
@@ -684,7 +681,7 @@ static device_method_t pccard_methods[] = {
static driver_t pccard_driver = {
"pccard",
pccard_methods,
- 1, /* no softc */
+ sizeof(struct pccard_softc)
};
devclass_t pccard_devclass;
diff --git a/sys/dev/pccard/pccard_cis.c b/sys/dev/pccard/pccard_cis.c
index 7383db2..dca15db 100644
--- a/sys/dev/pccard/pccard_cis.c
+++ b/sys/dev/pccard/pccard_cis.c
@@ -427,7 +427,7 @@ done:
void
pccard_print_cis(device_t dev)
{
- struct pccard_softc *sc = (struct pccard_softc *) device_get_softc(dev);
+ struct pccard_softc *sc = PCCARD_SOFTC(dev);
struct pccard_card *card = &sc->card;
struct pccard_function *pf;
struct pccard_config_entry *cfe;
diff --git a/sys/dev/pccard/pccard_cis_quirks.c b/sys/dev/pccard/pccard_cis_quirks.c
index 0219383..949a237 100644
--- a/sys/dev/pccard/pccard_cis_quirks.c
+++ b/sys/dev/pccard/pccard_cis_quirks.c
@@ -185,8 +185,7 @@ static int n_pccard_cis_quirks =
void pccard_check_cis_quirks(device_t dev)
{
- struct pccard_softc *sc = (struct pccard_softc *)
- device_get_softc(dev);
+ struct pccard_softc *sc = PCCARD_SOFTC(dev);
int wiped = 0;
int i, j;
struct pccard_function *pf, *pf_next, *pf_last;
diff --git a/sys/dev/pccard/pccardvar.h b/sys/dev/pccard/pccardvar.h
index 065fa33..290e5d6 100644
--- a/sys/dev/pccard/pccardvar.h
+++ b/sys/dev/pccard/pccardvar.h
@@ -241,6 +241,8 @@ void pccard_ccr_write(struct pccard_function *, int, int);
#define pccard_mfc(sc) (STAILQ_FIRST(&(sc)->card.pf_head) && \
STAILQ_NEXT(STAILQ_FIRST(&(sc)->card.pf_head),pf_list))
+/* The following is the vestages of the NetBSD driver api */
+
void pccard_function_init(struct pccard_function *,
struct pccard_config_entry *);
int pccard_function_enable(struct pccard_function *);
@@ -259,14 +261,11 @@ void pccard_io_unmap(struct pccard_function *, int);
#define pccard_mem_alloc(pf, size, pcmhp) \
(pccard_chip_mem_alloc((pf)->sc->pct, (pf)->sc->pch, (size), (pcmhp)))
-
#define pccard_mem_free(pf, pcmhp) \
(pccard_chip_mem_free((pf)->sc->pct, (pf)->sc->pch, (pcmhp)))
-
#define pccard_mem_map(pf, kind, card_addr, size, pcmhp, offsetp, windowp) \
(pccard_chip_mem_map((pf)->sc->pct, (pf)->sc->pch, (kind), \
(card_addr), (size), (pcmhp), (offsetp), (windowp)))
-
#define pccard_mem_unmap(pf, window) \
(pccard_chip_mem_unmap((pf)->sc->pct, (pf)->sc->pch, (window)))
@@ -287,3 +286,4 @@ enum {
PCCARD_A_MEM_ATTR = 0x1
};
+#define PCCARD_SOFTC(d) (struct pccard_softc *) device_get_softc(d)
OpenPOWER on IntegriCloud