From owner-svn-src-all@freebsd.org Wed Apr 10 19:49:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D267D156A7F1; Wed, 10 Apr 2019 19:49:36 +0000 (UTC) (envelope-from kibab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BBD5871E9; Wed, 10 Apr 2019 19:49:36 +0000 (UTC) (envelope-from kibab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 400CA273DC; Wed, 10 Apr 2019 19:49:36 +0000 (UTC) (envelope-from kibab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x3AJnaP8024095; Wed, 10 Apr 2019 19:49:36 GMT (envelope-from kibab@FreeBSD.org) Received: (from kibab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3AJnZ1R024092; Wed, 10 Apr 2019 19:49:35 GMT (envelope-from kibab@FreeBSD.org) Message-Id: <201904101949.x3AJnZ1R024092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kibab set sender to kibab@FreeBSD.org using -f From: Ilya Bakulin Date: Wed, 10 Apr 2019 19:49:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r346097 - in head: sbin/camcontrol sys/cam/mmc sys/dev/mmc X-SVN-Group: head X-SVN-Commit-Author: kibab X-SVN-Commit-Paths: in head: sbin/camcontrol sys/cam/mmc sys/dev/mmc X-SVN-Commit-Revision: 346097 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6BBD5871E9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Apr 2019 19:49:37 -0000 Author: kibab Date: Wed Apr 10 19:49:35 2019 New Revision: 346097 URL: https://svnweb.freebsd.org/changeset/base/346097 Log: Add new fields to mmc_data in preparation to SDIO CMD53 block mode support SDIO command CMD53 (IO_RW_EXTENDED) allows data transfers using blocks of 1-2048 bytes, with a maximum of 511 blocks per request. Extend mmc_data structure to properly describe such requests, and initialize the new fields in kernel and userland consumers. No actual driver changes happen yet, these will follow in the separate changes. Reviewed by: bz Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D19779 Modified: head/sbin/camcontrol/camcontrol.c head/sys/cam/mmc/mmc_da.c head/sys/dev/mmc/mmcreg.h Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Wed Apr 10 19:27:14 2019 (r346096) +++ head/sbin/camcontrol/camcontrol.c Wed Apr 10 19:49:35 2019 (r346097) @@ -7788,6 +7788,7 @@ mmcsdcmd(struct cam_device *device, int argc, char **a flags |= CAM_DIR_IN; mmc_data = malloc(mmc_data_len); memset(mmc_data, 0, mmc_data_len); + memset(&mmc_d, 0, sizeof(mmc_d)); mmc_d.len = mmc_data_len; mmc_d.data = mmc_data; mmc_d.flags = MMC_DATA_READ; Modified: head/sys/cam/mmc/mmc_da.c ============================================================================== --- head/sys/cam/mmc/mmc_da.c Wed Apr 10 19:27:14 2019 (r346096) +++ head/sys/cam/mmc/mmc_da.c Wed Apr 10 19:49:35 2019 (r346097) @@ -791,6 +791,11 @@ sddaregister(struct cam_periph *periph, void *arg) softc->state = SDDA_STATE_INIT; softc->mmcdata = (struct mmc_data *)malloc(sizeof(struct mmc_data), M_DEVBUF, M_NOWAIT|M_ZERO); + if (softc->mmcdata == NULL) { + printf("sddaregister: Unable to probe new device. " + "Unable to allocate mmcdata\n"); + return (CAM_REQ_CMP_ERR); + } periph->softc = softc; softc->periph = periph; @@ -889,6 +894,7 @@ mmc_send_ext_csd(struct cam_periph *periph, union ccb struct mmc_data d; KASSERT(buf_len == 512, ("Buffer for ext csd must be 512 bytes")); + memset(&d, 0, sizeof(d)); d.data = rawextcsd; d.len = buf_len; d.flags = MMC_DATA_READ; @@ -1013,6 +1019,7 @@ mmc_sd_switch(struct cam_periph *periph, union ccb *cc int err; memset(res, 0, 64); + memset(&mmc_d, 0, sizeof(mmc_d)); mmc_d.len = 64; mmc_d.data = res; mmc_d.flags = MMC_DATA_READ; @@ -1804,6 +1811,7 @@ sddastart(struct cam_periph *periph, union ccb *start_ mmcio->cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC; mmcio->cmd.data = softc->mmcdata; + memset(mmcio->cmd.data, 0, sizeof(struct mmc_data)); mmcio->cmd.data->data = bp->bio_data; mmcio->cmd.data->len = 512 * count; mmcio->cmd.data->flags = (bp->bio_cmd == BIO_READ ? MMC_DATA_READ : MMC_DATA_WRITE); Modified: head/sys/dev/mmc/mmcreg.h ============================================================================== --- head/sys/dev/mmc/mmcreg.h Wed Apr 10 19:27:14 2019 (r346096) +++ head/sys/dev/mmc/mmcreg.h Wed Apr 10 19:49:35 2019 (r346097) @@ -197,7 +197,10 @@ struct mmc_data { #define MMC_DATA_READ (1UL << 1) #define MMC_DATA_STREAM (1UL << 2) #define MMC_DATA_MULTI (1UL << 3) +#define MMC_DATA_BLOCK_SIZE (1UL << 4) struct mmc_request *mrq; + size_t block_size; /* block size for CMD53 */ + size_t block_count; /* block count for CMD53 */ }; struct mmc_request {