Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sdmmc Avoid the 16-bit read in sdhc_host_found for 3...
details: https://anonhg.NetBSD.org/src/rev/59d928c9a5f3
branches: trunk
changeset: 783241:59d928c9a5f3
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Dec 12 06:24:01 2012 +0000
description:
Avoid the 16-bit read in sdhc_host_found for 32-bit-only devices.
This change makes sdhc_host_found allocate hp up front before showing
the identification, in order to avoid having to open-code a copy of
HREAD2 before hp is available.
diffstat:
sys/dev/sdmmc/sdhc.c | 46 +++++++++++++++++++++++-----------------------
1 files changed, 23 insertions(+), 23 deletions(-)
diffs (75 lines):
diff -r 6ab4fe037d7b -r 59d928c9a5f3 sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c Wed Dec 12 02:42:25 2012 +0000
+++ b/sys/dev/sdmmc/sdhc.c Wed Dec 12 06:24:01 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhc.c,v 1.32 2012/10/29 13:30:25 kiyohara Exp $ */
+/* $NetBSD: sdhc.c,v 1.33 2012/12/12 06:24:01 riastradh 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.32 2012/10/29 13:30:25 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.33 2012/12/12 06:24:01 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -244,8 +244,28 @@
uint32_t caps;
uint16_t sdhcver;
- sdhcver = bus_space_read_2(iot, ioh, SDHC_HOST_CTL_VERSION);
+ /* Allocate one more host structure. */
+ hp = malloc(sizeof(struct sdhc_host), M_DEVBUF, M_WAITOK|M_ZERO);
+ if (hp == NULL) {
+ aprint_error_dev(sc->sc_dev,
+ "couldn't alloc memory (sdhc host)\n");
+ goto err1;
+ }
+ sc->sc_host[sc->sc_nhosts++] = hp;
+
+ /* Fill in the new host structure. */
+ hp->sc = sc;
+ hp->iot = iot;
+ hp->ioh = ioh;
+ hp->dmat = sc->sc_dmat;
+
+ mutex_init(&hp->host_mtx, MUTEX_DEFAULT, IPL_SDMMC);
+ mutex_init(&hp->intr_mtx, MUTEX_DEFAULT, IPL_SDMMC);
+ cv_init(&hp->intr_cv, "sdhcintr");
+
+ sdhcver = HREAD2(hp, SDHC_HOST_CTL_VERSION);
aprint_normal_dev(sc->sc_dev, "SD Host Specification ");
+ hp->specver = SDHC_SPEC_VERSION(sdhcver);
switch (SDHC_SPEC_VERSION(sdhcver)) {
case SDHC_SPEC_VERS_100:
aprint_normal("1.0");
@@ -266,26 +286,6 @@
}
aprint_normal(", rev.%u\n", SDHC_VENDOR_VERSION(sdhcver));
- /* Allocate one more host structure. */
- hp = malloc(sizeof(struct sdhc_host), M_DEVBUF, M_WAITOK|M_ZERO);
- if (hp == NULL) {
- aprint_error_dev(sc->sc_dev,
- "couldn't alloc memory (sdhc host)\n");
- goto err1;
- }
- sc->sc_host[sc->sc_nhosts++] = hp;
-
- /* Fill in the new host structure. */
- hp->sc = sc;
- hp->iot = iot;
- hp->ioh = ioh;
- hp->dmat = sc->sc_dmat;
- hp->specver = SDHC_SPEC_VERSION(sdhcver);
-
- mutex_init(&hp->host_mtx, MUTEX_DEFAULT, IPL_SDMMC);
- mutex_init(&hp->intr_mtx, MUTEX_DEFAULT, IPL_SDMMC);
- cv_init(&hp->intr_cv, "sdhcintr");
-
/*
* Reset the host controller and enable interrupts.
*/
Home |
Main Index |
Thread Index |
Old Index