public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Re: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: Refactor UFS device presence detection
       [not found] <15AA403F0836067D.28953@groups.io>
@ 2019-06-24 11:32 ` Albecki, Mateusz
  2019-06-25  1:44   ` Wu, Hao A
  0 siblings, 1 reply; 3+ messages in thread
From: Albecki, Mateusz @ 2019-06-24 11:32 UTC (permalink / raw)
  To: devel@edk2.groups.io, Albecki, Mateusz; +Cc: Wu, Hao A

Test info:

Tested device presence detection before and after change on real hardware. No functional change in UFS detection.

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Albecki, Mateusz
> Sent: Friday, June 21, 2019 5:27 PM
> To: devel@edk2.groups.io
> Cc: Albecki, Mateusz <mateusz.albecki@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>
> Subject: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: Refactor
> UFS device presence detection
> 
> In current implementation we are checking for device presence every time
> we execute UIC command. To make UfsExecUicCommands more generic
> checking device presence has been moved to UfsDeviceDetection.
> 
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
> ---
>  .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c        | 50 ++++++++-------------
> -
>  1 file changed, 18 insertions(+), 32 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> index 4b93821f38..633f975e30 100644
> --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> @@ -1534,7 +1534,7 @@ Exit1:
> 
> 
>  /**
> -  Sent UIC DME_LINKSTARTUP command to start the link startup procedure.
> +  Send UIC command.
> 
>    @param[in] Private          The pointer to the
> UFS_PASS_THRU_PRIVATE_DATA data structure.
>    @param[in] UicOpcode        The opcode of the UIC command.
> @@ -1544,7 +1544,6 @@ Exit1:
> 
>    @return EFI_SUCCESS      Successfully execute this UIC command and
> detect attached UFS device.
>    @return EFI_DEVICE_ERROR Fail to execute this UIC command and detect
> attached UFS device.
> -  @return EFI_NOT_FOUND    The presence of the UFS device isn't detected.
> 
>  **/
>  EFI_STATUS
> @@ -1629,24 +1628,6 @@ UfsExecUicCommands (
>      }
>    }
> 
> -  //
> -  // Check value of HCS.DP and make sure that there is a device attached to
> the Link.
> -  //
> -  Status = UfsMmioRead32 (Private, UFS_HC_STATUS_OFFSET, &Data);
> -  if (EFI_ERROR (Status)) {
> -    return Status;
> -  }
> -
> -  if ((Data & UFS_HC_HCS_DP) == 0) {
> -    Status  = UfsWaitMemSet (Private, UFS_HC_IS_OFFSET, UFS_HC_IS_ULSS,
> UFS_HC_IS_ULSS, UFS_TIMEOUT);
> -    if (EFI_ERROR (Status)) {
> -      return EFI_DEVICE_ERROR;
> -    }
> -    return EFI_NOT_FOUND;
> -  }
> -
> -  DEBUG ((DEBUG_INFO, "UfsPassThruDxe: found a attached UFS
> device\n"));
> -
>    return EFI_SUCCESS;
>  }
> 
> @@ -1820,8 +1801,9 @@ UfsDeviceDetection (
>    IN  UFS_PASS_THRU_PRIVATE_DATA     *Private
>    )
>  {
> -  UINTN                  Retry;
> -  EFI_STATUS             Status;
> +  UINTN       Retry;
> +  EFI_STATUS  Status;
> +  UINT32      Data;
> 
>    //
>    // Start UFS device detection.
> @@ -1829,22 +1811,26 @@ UfsDeviceDetection (
>    //
>    for (Retry = 0; Retry < 3; Retry++) {
>      Status = UfsExecUicCommands (Private, UfsUicDmeLinkStartup, 0, 0, 0);
> -    if (!EFI_ERROR (Status)) {
> -      break;
> +    if (EFI_ERROR (Status)) {
> +      return EFI_DEVICE_ERROR;
>      }
> 
> -    if (Status == EFI_NOT_FOUND) {
> -      continue;
> +    Status = UfsMmioRead32 (Private, UFS_HC_STATUS_OFFSET, &Data);
> +    if (EFI_ERROR (Status)) {
> +      return EFI_DEVICE_ERROR;
>      }
> 
> -    return EFI_DEVICE_ERROR;
> -  }
> -
> -  if (Retry == 3) {
> -    return EFI_NOT_FOUND;
> +    if ((Data & UFS_HC_HCS_DP) == 0) {
> +      Status = UfsWaitMemSet (Private, UFS_HC_IS_OFFSET,
> UFS_HC_IS_ULSS, UFS_HC_IS_ULSS, UFS_TIMEOUT);
> +      if (EFI_ERROR (Status)) {
> +        return EFI_DEVICE_ERROR;
> +      }
> +    } else {
> +      return EFI_SUCCESS;
> +    }
>    }
> 
> -  return EFI_SUCCESS;
> +  return EFI_NOT_FOUND;
>  }
> 
>  /**
> --
> 2.14.1.windows.1
> 
> --------------------------------------------------------------------
> 
> Intel Technology Poland sp. z o.o.
> ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII
> Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-
> 07-52-316 | Kapital zakladowy 200.000 PLN.
> 
> Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego
> adresata i moze zawierac informacje poufne. W razie przypadkowego
> otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale
> jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest
> zabronione.
> This e-mail and any attachments may contain confidential material for the
> sole use of the intended recipient(s). If you are not the intended recipient,
> please contact the sender and delete all copies; any review or distribution by
> others is strictly prohibited.
> 
> 
> 

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


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

* Re: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: Refactor UFS device presence detection
  2019-06-24 11:32 ` [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: Refactor UFS device presence detection Albecki, Mateusz
@ 2019-06-25  1:44   ` Wu, Hao A
  2019-06-27  1:11     ` Wu, Hao A
  0 siblings, 1 reply; 3+ messages in thread
From: Wu, Hao A @ 2019-06-25  1:44 UTC (permalink / raw)
  To: Albecki, Mateusz, devel@edk2.groups.io

> -----Original Message-----
> From: Albecki, Mateusz
> Sent: Monday, June 24, 2019 7:33 PM
> To: devel@edk2.groups.io; Albecki, Mateusz
> Cc: Wu, Hao A
> Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe:
> Refactor UFS device presence detection
> 
> Test info:
> 
> Tested device presence detection before and after change on real hardware.
> No functional change in UFS detection.


Thanks for the test information.
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu


> 
> > -----Original Message-----
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> > Albecki, Mateusz
> > Sent: Friday, June 21, 2019 5:27 PM
> > To: devel@edk2.groups.io
> > Cc: Albecki, Mateusz <mateusz.albecki@intel.com>; Wu, Hao A
> > <hao.a.wu@intel.com>
> > Subject: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: Refactor
> > UFS device presence detection
> >
> > In current implementation we are checking for device presence every time
> > we execute UIC command. To make UfsExecUicCommands more generic
> > checking device presence has been moved to UfsDeviceDetection.
> >
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
> > ---
> >  .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c        | 50 ++++++++-----------
> --
> > -
> >  1 file changed, 18 insertions(+), 32 deletions(-)
> >
> > diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> > b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> > index 4b93821f38..633f975e30 100644
> > --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> > +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> > @@ -1534,7 +1534,7 @@ Exit1:
> >
> >
> >  /**
> > -  Sent UIC DME_LINKSTARTUP command to start the link startup
> procedure.
> > +  Send UIC command.
> >
> >    @param[in] Private          The pointer to the
> > UFS_PASS_THRU_PRIVATE_DATA data structure.
> >    @param[in] UicOpcode        The opcode of the UIC command.
> > @@ -1544,7 +1544,6 @@ Exit1:
> >
> >    @return EFI_SUCCESS      Successfully execute this UIC command and
> > detect attached UFS device.
> >    @return EFI_DEVICE_ERROR Fail to execute this UIC command and detect
> > attached UFS device.
> > -  @return EFI_NOT_FOUND    The presence of the UFS device isn't
> detected.
> >
> >  **/
> >  EFI_STATUS
> > @@ -1629,24 +1628,6 @@ UfsExecUicCommands (
> >      }
> >    }
> >
> > -  //
> > -  // Check value of HCS.DP and make sure that there is a device attached to
> > the Link.
> > -  //
> > -  Status = UfsMmioRead32 (Private, UFS_HC_STATUS_OFFSET, &Data);
> > -  if (EFI_ERROR (Status)) {
> > -    return Status;
> > -  }
> > -
> > -  if ((Data & UFS_HC_HCS_DP) == 0) {
> > -    Status  = UfsWaitMemSet (Private, UFS_HC_IS_OFFSET,
> UFS_HC_IS_ULSS,
> > UFS_HC_IS_ULSS, UFS_TIMEOUT);
> > -    if (EFI_ERROR (Status)) {
> > -      return EFI_DEVICE_ERROR;
> > -    }
> > -    return EFI_NOT_FOUND;
> > -  }
> > -
> > -  DEBUG ((DEBUG_INFO, "UfsPassThruDxe: found a attached UFS
> > device\n"));
> > -
> >    return EFI_SUCCESS;
> >  }
> >
> > @@ -1820,8 +1801,9 @@ UfsDeviceDetection (
> >    IN  UFS_PASS_THRU_PRIVATE_DATA     *Private
> >    )
> >  {
> > -  UINTN                  Retry;
> > -  EFI_STATUS             Status;
> > +  UINTN       Retry;
> > +  EFI_STATUS  Status;
> > +  UINT32      Data;
> >
> >    //
> >    // Start UFS device detection.
> > @@ -1829,22 +1811,26 @@ UfsDeviceDetection (
> >    //
> >    for (Retry = 0; Retry < 3; Retry++) {
> >      Status = UfsExecUicCommands (Private, UfsUicDmeLinkStartup, 0, 0, 0);
> > -    if (!EFI_ERROR (Status)) {
> > -      break;
> > +    if (EFI_ERROR (Status)) {
> > +      return EFI_DEVICE_ERROR;
> >      }
> >
> > -    if (Status == EFI_NOT_FOUND) {
> > -      continue;
> > +    Status = UfsMmioRead32 (Private, UFS_HC_STATUS_OFFSET, &Data);
> > +    if (EFI_ERROR (Status)) {
> > +      return EFI_DEVICE_ERROR;
> >      }
> >
> > -    return EFI_DEVICE_ERROR;
> > -  }
> > -
> > -  if (Retry == 3) {
> > -    return EFI_NOT_FOUND;
> > +    if ((Data & UFS_HC_HCS_DP) == 0) {
> > +      Status = UfsWaitMemSet (Private, UFS_HC_IS_OFFSET,
> > UFS_HC_IS_ULSS, UFS_HC_IS_ULSS, UFS_TIMEOUT);
> > +      if (EFI_ERROR (Status)) {
> > +        return EFI_DEVICE_ERROR;
> > +      }
> > +    } else {
> > +      return EFI_SUCCESS;
> > +    }
> >    }
> >
> > -  return EFI_SUCCESS;
> > +  return EFI_NOT_FOUND;
> >  }
> >
> >  /**
> > --
> > 2.14.1.windows.1
> >
> > --------------------------------------------------------------------
> >
> > Intel Technology Poland sp. z o.o.
> > ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII
> > Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP
> 957-
> > 07-52-316 | Kapital zakladowy 200.000 PLN.
> >
> > Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego
> > adresata i moze zawierac informacje poufne. W razie przypadkowego
> > otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale
> > jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest
> > zabronione.
> > This e-mail and any attachments may contain confidential material for the
> > sole use of the intended recipient(s). If you are not the intended recipient,
> > please contact the sender and delete all copies; any review or distribution
> by
> > others is strictly prohibited.
> >
> >
> > 


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

* Re: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: Refactor UFS device presence detection
  2019-06-25  1:44   ` Wu, Hao A
@ 2019-06-27  1:11     ` Wu, Hao A
  0 siblings, 0 replies; 3+ messages in thread
From: Wu, Hao A @ 2019-06-27  1:11 UTC (permalink / raw)
  To: devel@edk2.groups.io, Wu, Hao A, Albecki, Mateusz

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Wu, Hao A
> Sent: Tuesday, June 25, 2019 9:44 AM
> To: Albecki, Mateusz; devel@edk2.groups.io
> Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe:
> Refactor UFS device presence detection
> 
> > -----Original Message-----
> > From: Albecki, Mateusz
> > Sent: Monday, June 24, 2019 7:33 PM
> > To: devel@edk2.groups.io; Albecki, Mateusz
> > Cc: Wu, Hao A
> > Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe:
> > Refactor UFS device presence detection
> >
> > Test info:
> >
> > Tested device presence detection before and after change on real
> hardware.
> > No functional change in UFS detection.
> 
> 
> Thanks for the test information.
> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>


Pushed via commit f426d8744f.

Best Regards,
Hao Wu


> 
> Best Regards,
> Hao Wu
> 
> 
> >
> > > -----Original Message-----
> > > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf
> Of
> > > Albecki, Mateusz
> > > Sent: Friday, June 21, 2019 5:27 PM
> > > To: devel@edk2.groups.io
> > > Cc: Albecki, Mateusz <mateusz.albecki@intel.com>; Wu, Hao A
> > > <hao.a.wu@intel.com>
> > > Subject: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe:
> Refactor
> > > UFS device presence detection
> > >
> > > In current implementation we are checking for device presence every
> time
> > > we execute UIC command. To make UfsExecUicCommands more generic
> > > checking device presence has been moved to UfsDeviceDetection.
> > >
> > > Cc: Hao A Wu <hao.a.wu@intel.com>
> > > Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
> > > ---
> > >  .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c        | 50 ++++++++---------
> --
> > --
> > > -
> > >  1 file changed, 18 insertions(+), 32 deletions(-)
> > >
> > > diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> > > b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> > > index 4b93821f38..633f975e30 100644
> > > --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> > > +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> > > @@ -1534,7 +1534,7 @@ Exit1:
> > >
> > >
> > >  /**
> > > -  Sent UIC DME_LINKSTARTUP command to start the link startup
> > procedure.
> > > +  Send UIC command.
> > >
> > >    @param[in] Private          The pointer to the
> > > UFS_PASS_THRU_PRIVATE_DATA data structure.
> > >    @param[in] UicOpcode        The opcode of the UIC command.
> > > @@ -1544,7 +1544,6 @@ Exit1:
> > >
> > >    @return EFI_SUCCESS      Successfully execute this UIC command and
> > > detect attached UFS device.
> > >    @return EFI_DEVICE_ERROR Fail to execute this UIC command and
> detect
> > > attached UFS device.
> > > -  @return EFI_NOT_FOUND    The presence of the UFS device isn't
> > detected.
> > >
> > >  **/
> > >  EFI_STATUS
> > > @@ -1629,24 +1628,6 @@ UfsExecUicCommands (
> > >      }
> > >    }
> > >
> > > -  //
> > > -  // Check value of HCS.DP and make sure that there is a device attached
> to
> > > the Link.
> > > -  //
> > > -  Status = UfsMmioRead32 (Private, UFS_HC_STATUS_OFFSET, &Data);
> > > -  if (EFI_ERROR (Status)) {
> > > -    return Status;
> > > -  }
> > > -
> > > -  if ((Data & UFS_HC_HCS_DP) == 0) {
> > > -    Status  = UfsWaitMemSet (Private, UFS_HC_IS_OFFSET,
> > UFS_HC_IS_ULSS,
> > > UFS_HC_IS_ULSS, UFS_TIMEOUT);
> > > -    if (EFI_ERROR (Status)) {
> > > -      return EFI_DEVICE_ERROR;
> > > -    }
> > > -    return EFI_NOT_FOUND;
> > > -  }
> > > -
> > > -  DEBUG ((DEBUG_INFO, "UfsPassThruDxe: found a attached UFS
> > > device\n"));
> > > -
> > >    return EFI_SUCCESS;
> > >  }
> > >
> > > @@ -1820,8 +1801,9 @@ UfsDeviceDetection (
> > >    IN  UFS_PASS_THRU_PRIVATE_DATA     *Private
> > >    )
> > >  {
> > > -  UINTN                  Retry;
> > > -  EFI_STATUS             Status;
> > > +  UINTN       Retry;
> > > +  EFI_STATUS  Status;
> > > +  UINT32      Data;
> > >
> > >    //
> > >    // Start UFS device detection.
> > > @@ -1829,22 +1811,26 @@ UfsDeviceDetection (
> > >    //
> > >    for (Retry = 0; Retry < 3; Retry++) {
> > >      Status = UfsExecUicCommands (Private, UfsUicDmeLinkStartup, 0, 0, 0);
> > > -    if (!EFI_ERROR (Status)) {
> > > -      break;
> > > +    if (EFI_ERROR (Status)) {
> > > +      return EFI_DEVICE_ERROR;
> > >      }
> > >
> > > -    if (Status == EFI_NOT_FOUND) {
> > > -      continue;
> > > +    Status = UfsMmioRead32 (Private, UFS_HC_STATUS_OFFSET, &Data);
> > > +    if (EFI_ERROR (Status)) {
> > > +      return EFI_DEVICE_ERROR;
> > >      }
> > >
> > > -    return EFI_DEVICE_ERROR;
> > > -  }
> > > -
> > > -  if (Retry == 3) {
> > > -    return EFI_NOT_FOUND;
> > > +    if ((Data & UFS_HC_HCS_DP) == 0) {
> > > +      Status = UfsWaitMemSet (Private, UFS_HC_IS_OFFSET,
> > > UFS_HC_IS_ULSS, UFS_HC_IS_ULSS, UFS_TIMEOUT);
> > > +      if (EFI_ERROR (Status)) {
> > > +        return EFI_DEVICE_ERROR;
> > > +      }
> > > +    } else {
> > > +      return EFI_SUCCESS;
> > > +    }
> > >    }
> > >
> > > -  return EFI_SUCCESS;
> > > +  return EFI_NOT_FOUND;
> > >  }
> > >
> > >  /**
> > > --
> > > 2.14.1.windows.1
> > >
> > > --------------------------------------------------------------------
> > >
> > > Intel Technology Poland sp. z o.o.
> > > ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII
> > > Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP
> > 957-
> > > 07-52-316 | Kapital zakladowy 200.000 PLN.
> > >
> > > Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego
> > > adresata i moze zawierac informacje poufne. W razie przypadkowego
> > > otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz
> trwale
> > > jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest
> > > zabronione.
> > > This e-mail and any attachments may contain confidential material for the
> > > sole use of the intended recipient(s). If you are not the intended
> recipient,
> > > please contact the sender and delete all copies; any review or distribution
> > by
> > > others is strictly prohibited.
> > >
> > >
> > >
> 
> 
> 


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

end of thread, other threads:[~2019-06-27  1:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <15AA403F0836067D.28953@groups.io>
2019-06-24 11:32 ` [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: Refactor UFS device presence detection Albecki, Mateusz
2019-06-25  1:44   ` Wu, Hao A
2019-06-27  1:11     ` 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