From patchwork Sat Apr 28 05:24:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 134641 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1507322lji; Fri, 27 Apr 2018 22:24:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrPdjQ6oo+As9oygjq/IwvZEkgZA51msYsvCrsjChHoh0SX6Crq2tul7Wnltn+KhQUludBe X-Received: by 2002:a65:4c4d:: with SMTP id l13-v6mr4311859pgr.46.1524893055393; Fri, 27 Apr 2018 22:24:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524893055; cv=none; d=google.com; s=arc-20160816; b=qYQAaraNUpPTjaeV+27RLADXwBikNhQKTjjgNENan76NLqHNMca61TJpXmRQ4NvhGi LGZnDVA3h7ZBpDNdTdGaaYS069JVOvC2jzaErkMRhl3hftvdnbkcfPRyk/Q/hcg4uVbv OXlLkMyp2lXQmZ99XHESFYZ4RNrkH9GnvdyaiOzKX+xf1qLMg2grvCujE0ObUy9BmwNK 8liJhVZw3sByqWh6bTBIIbG29RBQUXtdmHfD3dX2Lxpb0zYKyqvYeSlC8DBRl2Xdx1Za wK4G8Hyj7xNNfpZTPBdh3Eoo3tZtwTIa1TY5Al06+yInqApbwa6HryLDi5pufUKvjNlD glFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=VNxcalhRgD4VQgEXbgzB+rPWMUKSDQ/h0BshFE4r2qA=; b=Fz5U79AgIF7TzcH85uyJzLvCZAG9Qmn7EyNqlHjDR+2rk3E+O1S/UcZUI4BXluX0Ok JGU9OrKm0G8IOkBPnSfA8gLvya0u00GHxlcLb+yr0p+SSDbtF4Hbilo6wBsc3tKD1wpE NLvGPuP6YluCZVN/twXPnH4yARbH2cAArMfIr+iGE8yvTOgNAW0p8iW6qSCnTHuWGkHE lyZY+DwaSkegwTMnOLCMxzdmdhIsqtv88gWnskA2gb3U+XnWcp9gWKlRx03l3qLHKel0 FwFWqTg5WMtdPC6Rh0omqHrrgjsE3rqFv1zUfYDZeTS3yt7auJmB9jv5AD9O1ApfjjDV WmDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OTzpol5K; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id t16si2759142pfe.225.2018.04.27.22.24.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Apr 2018 22:24:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OTzpol5K; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 096C92034C8A7; Fri, 27 Apr 2018 22:24:15 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c00::244; helo=mail-pf0-x244.google.com; envelope-from=haojian.zhuang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EB564207DF47A for ; Fri, 27 Apr 2018 22:24:13 -0700 (PDT) Received: by mail-pf0-x244.google.com with SMTP id p12so2940618pff.13 for ; Fri, 27 Apr 2018 22:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=f6HgwyoVHH3HbvtrK7ncJrlt3ddqtePr7d8SexCdDeo=; b=OTzpol5K30i2NCn27dUWxJ5f0kACzQAjTOH9kMe37A2A6I2fgRYUXNDsFI06WBne3r uUACWuOzvhEKlLLQ6m746FK9VCNnaIoFgx8KIfDyYqQsVnNCSk54eYSoy+Zk/C+2gE7i XOahq2SMaj7Vrr1QG1wzEl+oiqzkp0J3jFSvY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=f6HgwyoVHH3HbvtrK7ncJrlt3ddqtePr7d8SexCdDeo=; b=KrGy01Izxt2b7mAS0Pzs7uK/pa2XDrSSngMJPhddU9zVNDx1qb0FTkhgCHFSEOsLrj HwvO7SP0bBqZiYSlsTKFe25auEV+5loC9XRGNCIcqY4U9lIUpggGAzjiKuGRbQIzzPqK pz0kdgUjQ+DHSjshY8AImvQTb3fbTmJmU4+s/aAo9WimhI7O5bk0F3/XtwjPq9lKwR0r zUoXSnB20RB3SPgGv8CjXE14JMLyZXXfaXlrXp5nzbJ8ryH4JWAUHgfIJ/4bpaz9s0nq GKhfV3js3sf04GuOp9Kwpby/gFQu0DLqG4ExCLfBCJyYA52L6gbZ35vJ8LqCYCv870wv IndA== X-Gm-Message-State: ALQs6tBIeJA944LQQynQVg9EkdwM12K2Wl9CPwNUcMJRyR0xE0RMp92o ZNUEgQ9hbGeq4yVymxkvbAtf6IyOkCY= X-Received: by 2002:a65:57c9:: with SMTP id q9-v6mr4320368pgr.215.1524893053299; Fri, 27 Apr 2018 22:24:13 -0700 (PDT) Received: from localhost.localdomain ([64.64.108.61]) by smtp.gmail.com with ESMTPSA id m3sm5120756pff.150.2018.04.27.22.24.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Apr 2018 22:24:12 -0700 (PDT) From: Haojian Zhuang To: edk2-devel@lists.01.org Date: Sat, 28 Apr 2018 13:24:05 +0800 Message-Id: <1524893045-2958-1-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH 1/1] MdeModulePkg/Sd: append CMD12 for multiple blocks X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Eric Dong , Ard Biesheuvel , Leif Lindholm , Haojian Zhuang , Star Zeng MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Send CMD12 to stop transimission for accessing multiple blocks. It's required by SD Card protocol. Cc: Star Zeng Cc: Eric Dong Cc: Ruiyu Ni Cc: Leif Lindholm Cc: Ard Biesheuvel Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Haojian Zhuang --- MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c index 516c3e704288..64259f99f9bc 100644 --- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c +++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c @@ -426,6 +426,36 @@ Error: return Status; } +EFI_STATUS +SdStopTrans ( + IN SD_DEVICE *Device + ) +{ + EFI_STATUS Status; + EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru; + EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk; + EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk; + EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet; + + PassThru = Device->Private->PassThru; + + ZeroMem (&SdMmcCmdBlk, sizeof (SdMmcCmdBlk)); + ZeroMem (&SdMmcStatusBlk, sizeof (SdMmcStatusBlk)); + ZeroMem (&Packet, sizeof (Packet)); + + Packet.SdMmcCmdBlk = &SdMmcCmdBlk; + Packet.SdMmcStatusBlk = &SdMmcStatusBlk; + Packet.Timeout = SD_GENERIC_TIMEOUT; + + SdMmcCmdBlk.CommandIndex = SD_STOP_TRANSMISSION; + SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc; + SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1b; + SdMmcCmdBlk.CommandArgument = 0; + + Status = PassThru->PassThru (PassThru, Device->Slot, &Packet, NULL); + return Status; +} + /** Read/write multiple blocks through sync or async I/O request. @@ -555,6 +585,11 @@ Error: } } + if (EFI_ERROR (Status)) { + return Status; + } + + Status = SdStopTrans (Device); return Status; }