From owner-svn-src-head@freebsd.org Tue Sep 3 14:06:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6D79DCD43; Tue, 3 Sep 2019 14:06:39 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (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 "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N7zf6Ncmz4Pm3; Tue, 3 Sep 2019 14:06:38 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id 8392D1A97F; Tue, 3 Sep 2019 14:06:13 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id E302A14E80; Wed, 10 Apr 2019 19:49:39 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (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 "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C62C871F3; Wed, 10 Apr 2019 19:49:39 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 1583714E30; Wed, 10 Apr 2019 19:49:39 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 9BEBD14E28 for ; 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 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 Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 3C62C871F3 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_SHORT(-0.97)[-0.973,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] Status: O X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:06:43 -0000 X-Original-Date: Wed, 10 Apr 2019 19:49:35 +0000 (UTC) X-List-Received-Date: Tue, 03 Sep 2019 14:06:43 -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 {