public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Question about UfsPassThruDxe driver
@ 2018-12-21 22:43 Mike M
  2018-12-24  2:03 ` Mike M
  0 siblings, 1 reply; 3+ messages in thread
From: Mike M @ 2018-12-21 22:43 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni, Jian J Wang, Hao Wu

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?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about UfsPassThruDxe driver
  2018-12-21 22:43 Question about UfsPassThruDxe driver Mike M
@ 2018-12-24  2:03 ` Mike M
  2018-12-24  3:54   ` Wu, Hao A
  0 siblings, 1 reply; 3+ messages in thread
From: Mike M @ 2018-12-24  2:03 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni, Jian J Wang, Hao Wu

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 <mike.maslenkin@gmail.com> 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?
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about UfsPassThruDxe driver
  2018-12-24  2:03 ` Mike M
@ 2018-12-24  3:54   ` Wu, Hao A
  0 siblings, 0 replies; 3+ messages in thread
From: Wu, Hao A @ 2018-12-24  3:54 UTC (permalink / raw)
  To: Mike M, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu, Wang, Jian J

Hi,

Yes, the understanding in your latest reply is correct.

Best Regards,
Hao Wu

From: Mike M [mailto:mike.maslenkin@gmail.com]
Sent: Monday, December 24, 2018 10:04 AM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu; Wang, Jian J; Wu, Hao A
Subject: Re: Question about UfsPassThruDxe driver

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 <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>> 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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-24  3:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-21 22:43 Question about UfsPassThruDxe driver Mike M
2018-12-24  2:03 ` Mike M
2018-12-24  3:54   ` Wu, Hao A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox