summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorjakllsch <jakllsch@NetBSD.org>2012-07-12 16:58:50 +0000
committerjakllsch <jakllsch@NetBSD.org>2012-07-12 16:58:50 +0000
commit0ed1f86719ce99e2d606a4aac48efd0d7ca0e25c (patch)
treecfaa0c7e09a6d7ed8092184d1e6b51728ee801f9 /sys/dev
parent53efcfeae5a53ed39da53aa0bfb12eb51c3635d8 (diff)
SDHC can have multiple slots, note which slot a specific sdmmc(4) attaches to.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/sdmmc/sdhc.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/sys/dev/sdmmc/sdhc.c b/sys/dev/sdmmc/sdhc.c
index 0c3ef5477a5..5d9103465cd 100644
--- a/sys/dev/sdmmc/sdhc.c
+++ b/sys/dev/sdmmc/sdhc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhc.c,v 1.16 2012/07/12 16:46:48 jakllsch Exp $ */
+/* $NetBSD: sdhc.c,v 1.17 2012/07/12 16:58:50 jakllsch Exp $ */
/* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */
/*
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.16 2012/07/12 16:46:48 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.17 2012/07/12 16:58:50 jakllsch Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -88,6 +88,7 @@ struct sdhc_host {
};
#define HDEVNAME(hp) (device_xname((hp)->sc->sc_dev))
+#define HDEVINST(hp) ((int)(((hp)-(hp)->sc->sc_host[0])/sizeof(*(hp))))
static uint8_t
hread1(struct sdhc_host *hp, bus_size_t reg)
@@ -216,6 +217,20 @@ static struct sdmmc_chip_functions sdhc_functions = {
sdhc_card_intr_ack
};
+static int
+sdhc_cfprint(void *aux, const char *pnp)
+{
+ const struct sdmmcbus_attach_args const * saa = aux;
+ const struct sdhc_host * const hp = saa->saa_sch;
+
+ if (pnp) {
+ aprint_normal("sdmmc at %s", pnp);
+ }
+ aprint_normal(" slot %d", HDEVINST(hp));
+
+ return UNCONF;
+}
+
/*
* Called by attachment driver. For each SD card slot there is one SD
* host controller standard register set. (1.3)
@@ -390,7 +405,7 @@ sdhc_host_found(struct sdhc_softc *sc, bus_space_tag_t iot,
if (ISSET(hp->flags, SHF_USE_DMA))
saa.saa_caps |= SMC_CAPS_DMA;
#endif
- hp->sdmmc = config_found(sc->sc_dev, &saa, NULL);
+ hp->sdmmc = config_found(sc->sc_dev, &saa, sdhc_cfprint);
return 0;