From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::243; helo=mail-lj1-x243.google.com; envelope-from=mike.maslenkin@gmail.com; receiver=edk2-devel@lists.01.org Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) (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 95F7B21198CB3 for ; Sun, 23 Dec 2018 18:04:38 -0800 (PST) Received: by mail-lj1-x243.google.com with SMTP id t9-v6so9336857ljh.6 for ; Sun, 23 Dec 2018 18:04:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uCfKjbJS0igmYRb+JSF7EYZ4tEAnajZvJeVO3hJ8JaU=; b=DHF3bcjtBA/MixK/66sQe/z9sgdtyODtfWmEExV/7QdW1+klli9joQATdleFW/VLgy KQznyjREcBQKe5Ze2pCJSY9ochOTU279799LMtL8k4wKM5gH1y6dXVSUsDOHSyTggSEj bHCGbSg5qywG8VdkYvs23agOpK21S/gtS8sH3vZ8O/t4kw9Ef7TTvCTVPYP8fSL+/syQ Ab06ujyXsI3hRVwGFbYhlttzPsXngxFcbuZpKke9dwklF3uygIroUylzJ8GgLLNVtljU LxwAvSw6Ev71PfXwwUcGgAqKl4+xlfZZqgq5YbQ2TIONIWRLlvOT/Scz2OtkGrFrU4jz y4cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uCfKjbJS0igmYRb+JSF7EYZ4tEAnajZvJeVO3hJ8JaU=; b=ovL4hr/RI4f53j42mnGIxcG4gU0dP6szYXWdw7GUSyUOq7Xri3E9qDb31TMCK9QrXE 77kWtfOEiz0xh51Zwn1LP9KshEy5EPtUDB0NUHggkwPsaDP97xKjsgytwu45wqYlC68e CEpDUpSRCVmT3pi75+9ZTKVUoKDBSjR6a/0iNJBUyZAQl90RVAnxUrgWeiOqpErUjsx7 gPE2RFO+reshP3yS47RqhYQJOV55giI2Rm3asycYpteq0CugXwebT14hL8nS5GGDtRu+ RBtV8WpC8CQcaCi6Vo3lXD5UJwsqEr7tcyhCmOVe02mG4xLKwwfyMPK3cm+5ciX/wgnh MYug== X-Gm-Message-State: AJcUukfEmuydct0nqDgHpzogy+1Wa6UEvvLkGisS/GclpDZaFJNxTlle jMP0Yh4EXgv1YcKSk/PPlugWRAcHOl50D70fyL/ohR8g X-Google-Smtp-Source: ALg8bN7d9gX3pn3g81C5PeExwx29j9Ec/bnYsi3JXH9jM9NUupoZ5nsQpAIcsGdNyY9ZE7K6UyF1I9WpddS4SmXlsnc= X-Received: by 2002:a2e:8605:: with SMTP id a5-v6mr4113691lji.145.1545617075858; Sun, 23 Dec 2018 18:04:35 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Mike M Date: Mon, 24 Dec 2018 05:03:59 +0300 Message-ID: To: edk2-devel@lists.01.org Cc: Ruiyu Ni , Jian J Wang , Hao Wu X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: Question about UfsPassThruDxe driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Dec 2018 02:04:38 -0000 Content-Type: text/plain; charset="UTF-8" Sorry for the noise. Once I sent this question I understood this code. I overlooked UTP_TRD and UTP_TR_PRD declarations where lower 32-bit of a physical address declared as a bitfield... There are no shifts when HCI programmed via MMIO. On Sat, Dec 22, 2018 at 1:43 AM Mike M wrote: > Dear MdeModulePkg maintainers, I'm a bit baffled about a way > physical addresses passed to UFS HCI at UfsPassThruDxe driver. > For example, UFS HCI V.2.1 declares Data Base Address in PRDT structure as > two 32 bit words, > where bits 0 and 1 of a physical address are reserved. > As well UTP Command Descriptor Base Address (UCDBA) shall be aligned to > 128-byte address, > i.e. bits [06:00] are reserved. > In common such reserved bits are being cleared by AND operation > with appropriate mask, while in UfsPassThruDxe right shift operator is > used as below: > Prdt[PrdtIndex].DbAddr = (UINT32)RShiftU64 ((UINT64)(UINTN)Remaining, > 2); > Prdt[PrdtIndex].DbAddrU = (UINT32)RShiftU64 ((UINT64)(UINTN)Remaining, > 32); > and > Trd->UcdBa = (UINT32)RShiftU64 ((UINT64)CmdDescPhyAddr, 7); > Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)CmdDescPhyAddr, 32); > > How does UFS HCI deal with such values? This doesn't look correct. > Would you like I prepare a patch replacing RShiftU64 operator with bitwise > AND operator > for lower 32-bit of a physical address value? >