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::130; helo=mail-lf1-x130.google.com; envelope-from=mike.maslenkin@gmail.com; receiver=edk2-devel@lists.01.org Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) (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 E0F9F211958F9 for ; Fri, 21 Dec 2018 14:43:59 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id z13so4937424lfe.11 for ; Fri, 21 Dec 2018 14:43:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=+ZI4Z0hUf6LOwcUf5+0ezCXjctbQiYJEUa+jqfnCcZE=; b=iTtxy4hznxwinN69Y+xo8Sr/HIfcFQaI+Ybup9jRhcPPYaKVs7rTQyGN0tij20AmCA 7L2Jh4yhELg+Ch4B9y9y01hQ5zxhl2/Mn+4mfqTZAqz9MNu8CSh7RR31AMGrj3wSVXNF 807tSlKwPoTMjq/lK1bHR2o3TUrTJS3f+jYU7Dk1syNb8NNfli8klEuovAFRwKOzpelD dajCpjWM3evZjjzFC/kDR1RgLj/J1OoOZRv/1mPU43FR1dp0EQ/tuw+FZzjtDHefG8pV 4nGQwmCMZvaOqs6VqJTozmhMRNKl0DENZqmiGcWm+0iyXrZYewVCiyFEIHMTmZnyKEe2 ns+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=+ZI4Z0hUf6LOwcUf5+0ezCXjctbQiYJEUa+jqfnCcZE=; b=aU4CvEhxlgRmWsnNHPTA21qJIFWaeqFi2f4vFmxs7C14RUF5Lwdv6QfVP2o5ANuiM7 P/UQBctfx6W+789iFuqhTDvcXRSgDJOEiTHH3dU2Bg5BsUNKd8rfUgFx/Yg8/QJKWyQW rSsCvTCb1Ri56OykchkoyNpsFhmUsO+RJgGxrcIk1Wu2HQeNdFk8h23SvEMBGdh1LXc3 WtKLWpqjju/XGXJ1FJ64HW2rhoK7qyA86XL+FpkjkFXCLEQemjF92IKi5akXNZdtypFk +CcB0HEa+s5W3mRhnKYinVv8zuG9E9nwsYMIqI7KqLEkWWOhY5fpk2CmKeDz9ocn/ofb h18g== X-Gm-Message-State: AA+aEWaeA/LOwRgcbc+JfomkbRAgOEeGVTYruXXYMB3FqDuGCXl9WEt3 PgwYtGBrW2RjrUvgV0P/8kiKR0k3sVN0XRqSHa9tSGk2 X-Google-Smtp-Source: AFSGD/XW8+fsaerkaqdIfDUtTdOSoz0RMKdP7Ab7zGVpt5ykjfpPdpOFNnmi0XbVndpZQxj4m6pZmp7UYfHxsUH/K28= X-Received: by 2002:a19:789:: with SMTP id 131mr2514468lfh.11.1545432237572; Fri, 21 Dec 2018 14:43:57 -0800 (PST) MIME-Version: 1.0 From: Mike M Date: Sat, 22 Dec 2018 01:43:21 +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: 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: Fri, 21 Dec 2018 22:44:00 -0000 Content-Type: text/plain; charset="UTF-8" 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?