From patchwork Fri Jan 6 09:05:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 90303 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp394682qgi; Sun, 8 Jan 2017 01:25:09 -0800 (PST) X-Received: by 10.98.198.85 with SMTP id m82mr78022494pfg.69.1483867509677; Sun, 08 Jan 2017 01:25:09 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id h5si85232927pgg.22.2017.01.08.01.25.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Jan 2017 01:25:09 -0800 (PST) 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; 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 dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 55F3F818D1; Sun, 8 Jan 2017 01:25:08 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pg0-x235.google.com (mail-pg0-x235.google.com [IPv6:2607:f8b0:400e:c05::235]) (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 EFA30818D0 for ; Sun, 8 Jan 2017 01:25:07 -0800 (PST) Received: by mail-pg0-x235.google.com with SMTP id 204so12398448pge.0 for ; Sun, 08 Jan 2017 01:25:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:thread-topic:thread-index:date:message-id :references:in-reply-to:content-language:mime-version; bh=Q0jXJ0dYeL6yDYtFjauw91ly9G2FZYLjr3LxmnCL730=; b=E3xrEHcpFIP2qIXZt7Zqvct/1NqQeNhaHXHlII8O6ofxKf9YbZ8dnPk6ESbwXni5Lm /ZPjNJZlw920PtRI1bGCHWysCLxXpf+f4pv7f21OO89p2CjE0GsKQYNapS7jn5xv1Vqn 2fYkipnRr6T6cmcmYkKKO4ov/jbnaB4vj8t6w= 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:thread-topic:thread-index :date:message-id:references:in-reply-to:content-language :mime-version; bh=Q0jXJ0dYeL6yDYtFjauw91ly9G2FZYLjr3LxmnCL730=; b=sTRwM3ufD+d4IsTkTE1faeDhvU7/ljZ2hFSxL0dyiajU2bYTcSvAWxu65JHVjjPZYT 5oE2/NmkUDYedetz7q0NS0ptVfn+fi/O0Q4o3h7H56DuaLyKifk+TTyR4eQGOji+ltqX bj1ZTHZBCMQhQD0pPnMm1/YGAKr5YYqUtxBdUzUmMGG9LhTYskjAhwOe3T3NMN9f+7dd JlRAR8yTPXjbPcO93Qae90tiSYREsk/uO0kPEteWMkIJ8m05YlT7SL0Q4Xo5WajMKZdO LTqN2kZDmdEo/2CmF0jDNvv+jBVZj6BGdUxDyh7z4WA7NXhus2UJVXOqb4SRiYDib1yS 8qtQ== X-Gm-Message-State: AIkVDXLgLkQFcETi/4eBvA+mvfPetgjj5OHHGD+Qqyyc+4/3cbcY9lBGTNLLnYaCwwpgjqAe X-Received: by 10.99.178.89 with SMTP id t25mr7337779pgo.183.1483867507638; Sun, 08 Jan 2017 01:25:07 -0800 (PST) Received: from BL2PR08MB356.namprd08.prod.outlook.com ([132.245.11.164]) by smtp.gmail.com with ESMTPSA id k67sm170523991pfk.69.2017.01.08.01.25.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Jan 2017 01:25:06 -0800 (PST) From: Haojian Zhuang To: "Tian, Feng" , "leif.lindholm@linaro.org" , "ard.biesheuvel@linaro.org" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH 4/9] Ufs: fix to set UTRLBA and UTRLBAU register Thread-Index: AQHSZ+l5PHezgxbljECMBoss2xmzAqErICEAgAAIOjc= Date: Fri, 6 Jan 2017 09:05:57 +0000 Message-ID: References: <1483685538-11058-1-git-send-email-haojian.zhuang@linaro.org> <1483685538-11058-5-git-send-email-haojian.zhuang@linaro.org>, <7F1BAD85ADEA444D97065A60D2E97EE5699A60C7@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <7F1BAD85ADEA444D97065A60D2E97EE5699A60C7@SHSMSX101.ccr.corp.intel.com> Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: [edk2] [PATCH 4/9] Ufs: fix to set UTRLBA and UTRLBAU register X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Tian, Feng" Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Hi Feng, I don’t understand why doorbell location should be updated too. If we don’t update UTRLBA & UTRLBAU for sending each UPIU packet, we have to extend the size of UTRD packet. Then we could avoid to create a new command buffer. Best Regards Haojian From: Tian, Feng Sent: 2017年1月6日 16:36 To: Haojian Zhuang; leif.lindholm@linaro.org; ard.biesheuvel@linaro.org; edk2-devel@lists.01.org Cc: Tian, Feng Subject: RE: [PATCH 4/9] Ufs: fix to set UTRLBA and UTRLBAU register Hi, Haojian If the UTRLBA & UTRLBAU gets changed like below, the doorbell location also should be updated. So I don't suggest to update them. Thanks Feng -----Original Message----- From: Haojian Zhuang [mailto:haojian.zhuang@linaro.org] Sent: Friday, January 6, 2017 2:52 PM To: Tian, Feng ; leif.lindholm@linaro.org; ard.biesheuvel@linaro.org; edk2-devel@lists.01.org Cc: Haojian Zhuang Subject: [PATCH 4/9] Ufs: fix to set UTRLBA and UTRLBAU register Although UfsInitTransferRequestList () assigns UTRLBA && UTRLBAU registers, UfsCreateScsiCommandDesc () creates a page of command buffer. It means that UTRLBA && UTRLBAU registers should be updated. Always set UTRLBA && UTRLBAU registers before sending UPIU packet. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Haojian Zhuang --- MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.7.4 diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c index e556b62..5c256a9 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c @@ -937,6 +937,8 @@ UfsRwDeviceDesc ( if (EFI_ERROR (Status)) { return Status; } + UfsMmioWrite32 (Private, UFS_HC_UTRLBA_OFFSET, (UINTN)Trd & + 0xffffffff); + UfsMmioWrite32 (Private, UFS_HC_UTRLBAU_OFFSET, ((UINTN)Trd >> 32) & + 0xffffffff); // // Check the transfer request result. @@ -1060,6 +1062,8 @@ UfsRwAttributes ( if (EFI_ERROR (Status)) { return Status; } + UfsMmioWrite32 (Private, UFS_HC_UTRLBA_OFFSET, (UINTN)Trd & + 0xffffffff); + UfsMmioWrite32 (Private, UFS_HC_UTRLBAU_OFFSET, ((UINTN)Trd >> 32) & + 0xffffffff); // // Check the transfer request result. @@ -1184,6 +1188,8 @@ UfsRwFlags ( if (EFI_ERROR (Status)) { return Status; } + UfsMmioWrite32 (Private, UFS_HC_UTRLBA_OFFSET, (UINTN)Trd & + 0xffffffff); + UfsMmioWrite32 (Private, UFS_HC_UTRLBAU_OFFSET, ((UINTN)Trd >> 32) & + 0xffffffff); // // Check the transfer request result. @@ -1351,6 +1357,8 @@ UfsExecNopCmds ( if (EFI_ERROR (Status)) { return Status; } + UfsMmioWrite32 (Private, UFS_HC_UTRLBA_OFFSET, (UINTN)Trd & + 0xffffffff); + UfsMmioWrite32 (Private, UFS_HC_UTRLBAU_OFFSET, ((UINTN)Trd >> 32) & + 0xffffffff); // // Check the transfer request result. @@ -1473,6 +1481,8 @@ UfsExecScsiCmds ( if (EFI_ERROR (Status)) { return Status; } + UfsMmioWrite32 (Private, UFS_HC_UTRLBA_OFFSET, (UINTN)TransReq->Trd & + 0xffffffff); + UfsMmioWrite32 (Private, UFS_HC_UTRLBAU_OFFSET, ((UINTN)TransReq->Trd + >> 32) & 0xffffffff); TransReq->CmdDescSize = TransReq->Trd->PrdtO * sizeof (UINT32) + TransReq->Trd->PrdtL * sizeof (UTP_TR_PRD);