Thu Jul 12 23:07:06 2012 UTC ()
bus_space_*_stream_N() functions are not universally available.
Provite alternate implementation for when they are unavailable.


(jakllsch)
diff -r1.19 -r1.20 src/sys/dev/sdmmc/sdhc.c

cvs diff -r1.19 -r1.20 src/sys/dev/sdmmc/sdhc.c (expand / switch to unified diff)

--- src/sys/dev/sdmmc/sdhc.c 2012/07/12 17:27:42 1.19
+++ src/sys/dev/sdmmc/sdhc.c 2012/07/12 23:07:06 1.20
@@ -1,39 +1,39 @@ @@ -1,39 +1,39 @@
1/* $NetBSD: sdhc.c,v 1.19 2012/07/12 17:27:42 jakllsch Exp $ */ 1/* $NetBSD: sdhc.c,v 1.20 2012/07/12 23:07:06 jakllsch Exp $ */
2/* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ 2/* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> 5 * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
6 * 6 *
7 * Permission to use, copy, modify, and distribute this software for any 7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above 8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies. 9 * copyright notice and this permission notice appear in all copies.
10 * 10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */ 18 */
19 19
20/* 20/*
21 * SD Host Controller driver based on the SD Host Controller Standard 21 * SD Host Controller driver based on the SD Host Controller Standard
22 * Simplified Specification Version 1.00 (www.sdcard.com). 22 * Simplified Specification Version 1.00 (www.sdcard.com).
23 */ 23 */
24 24
25#include <sys/cdefs.h> 25#include <sys/cdefs.h>
26__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.19 2012/07/12 17:27:42 jakllsch Exp $"); 26__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.20 2012/07/12 23:07:06 jakllsch Exp $");
27 27
28#ifdef _KERNEL_OPT 28#ifdef _KERNEL_OPT
29#include "opt_sdmmc.h" 29#include "opt_sdmmc.h"
30#endif 30#endif
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/device.h> 33#include <sys/device.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35#include <sys/kthread.h> 35#include <sys/kthread.h>
36#include <sys/malloc.h> 36#include <sys/malloc.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/mutex.h> 38#include <sys/mutex.h>
39#include <sys/condvar.h> 39#include <sys/condvar.h>
@@ -1006,28 +1006,33 @@ sdhc_exec_command(sdmmc_chipset_handle_t @@ -1006,28 +1006,33 @@ sdhc_exec_command(sdmmc_chipset_handle_t
1006 } 1006 }
1007 1007
1008 /* 1008 /*
1009 * The host controller removes bits [0:7] from the response 1009 * The host controller removes bits [0:7] from the response
1010 * data (CRC) and we pass the data up unchanged to the bus 1010 * data (CRC) and we pass the data up unchanged to the bus
1011 * driver (without padding). 1011 * driver (without padding).
1012 */ 1012 */
1013 mutex_enter(&hp->host_mtx); 1013 mutex_enter(&hp->host_mtx);
1014 if (cmd->c_error == 0 && ISSET(cmd->c_flags, SCF_RSP_PRESENT)) { 1014 if (cmd->c_error == 0 && ISSET(cmd->c_flags, SCF_RSP_PRESENT)) {
1015 uint32_t *p = cmd->c_resp; 1015 uint32_t *p = cmd->c_resp;
1016 int i; 1016 int i;
1017 1017
1018 for (i = 0; i < 4; i++) { 1018 for (i = 0; i < 4; i++) {
 1019#ifdef __BUS_SPACE_HAS_STREAM_METHODS
1019 *p++ = bus_space_read_stream_4(hp->iot, hp->ioh, 1020 *p++ = bus_space_read_stream_4(hp->iot, hp->ioh,
1020 SDHC_RESPONSE + i * 4); 1021 SDHC_RESPONSE + i * 4);
 1022#else
 1023 *p++ = htole32(bus_space_read_4(hp->iot, hp->ioh,
 1024 SDHC_RESPONSE + i * 4));
 1025#endif
1021 if (!ISSET(cmd->c_flags, SCF_RSP_136)) 1026 if (!ISSET(cmd->c_flags, SCF_RSP_136))
1022 break; 1027 break;
1023 } 1028 }
1024 } 1029 }
1025 mutex_exit(&hp->host_mtx); 1030 mutex_exit(&hp->host_mtx);
1026 DPRINTF(1,("%s: resp = %08x\n", HDEVNAME(hp), cmd->c_resp[0])); 1031 DPRINTF(1,("%s: resp = %08x\n", HDEVNAME(hp), cmd->c_resp[0]));
1027 1032
1028 /* 1033 /*
1029 * If the command has data to transfer in any direction, 1034 * If the command has data to transfer in any direction,
1030 * execute the transfer now. 1035 * execute the transfer now.
1031 */ 1036 */
1032 if (cmd->c_error == 0 && cmd->c_data != NULL) 1037 if (cmd->c_error == 0 && cmd->c_data != NULL)
1033 sdhc_transfer_data(hp, cmd); 1038 sdhc_transfer_data(hp, cmd);