public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "Albecki, Mateusz" <mateusz.albecki@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Marcin Wojtas <mw@semihalf.com>,
	"Gao, Zhichao" <zhichao.gao@intel.com>,
	"Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PATCH 1/4] MdeModulePkg/SdMmcPciHcDxe: Enhance driver traces
Date: Wed, 5 Feb 2020 03:16:13 +0000	[thread overview]
Message-ID: <B80AF82E9BFB8E4FBD8C89DA810C6A093C9A419D@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20200203141858.3236-2-mateusz.albecki@intel.com>

Hello Mateusz,

Try to provide some feedbacks before I can test the patch.

Some inline comments below:


> -----Original Message-----
> From: Albecki, Mateusz
> Sent: Monday, February 03, 2020 10:19 PM
> To: devel@edk2.groups.io
> Cc: Albecki, Mateusz; Wu, Hao A; Marcin Wojtas; Gao, Zhichao; Gao, Liming
> Subject: [PATCH 1/4] MdeModulePkg/SdMmcPciHcDxe: Enhance driver
> traces
> 
> To allow for easier debug of failing commands we
> have added a capability to print TRB and command
> packet when we start execution of the TRB(on
> DEBUG_VERBOSE level) and when the TRB failed to
> execute correctly(on DEBUG_ERROR level). Additionally
> we will also print error interrupt status and interrupt
> status register on failed SD command.
> 
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Marcin Wojtas <mw@semihalf.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> 
> Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 87
> ++++++++++++++++++++++++
>  1 file changed, 87 insertions(+)
> 
> diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
> b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
> index b05c818462..959645bf26 100644
> --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
> +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
> @@ -1643,6 +1643,82 @@ BuildAdmaDescTable (
>    return EFI_SUCCESS;
>  }
> 
> +/**
> +  Prints the contents of the command packet to the debug port.
> +
> +  @param[in] DebugLevel  Debug level at which the packet should be
> printed.
> +  @param[in] Packet      Pointer to packet to print.
> +**/
> +VOID
> +SdMmcPrintPacket (
> +  IN UINT32                               DebugLevel,
> +  IN EFI_SD_MMC_PASS_THRU_COMMAND_PACKET  *Packet
> +  )
> +{
> +  if (Packet == NULL) {
> +    return;
> +  }
> +
> +  DEBUG ((DebugLevel, "Printing
> EFI_SD_MMC_PASS_THRU_COMMAND_PACKET\n"));
> +  if (Packet->SdMmcCmdBlk != NULL) {
> +    DEBUG ((DebugLevel, "Command index: %d, argument: %X\n", Packet-
> >SdMmcCmdBlk->CommandIndex, Packet->SdMmcCmdBlk-
> >CommandArgument));
> +    DEBUG ((DebugLevel, "Command type: %d, response type: %d\n",
> Packet->SdMmcCmdBlk->CommandType, Packet->SdMmcCmdBlk-
> >ResponseType));
> +  }
> +  if (Packet->SdMmcStatusBlk != NULL) {
> +    DEBUG ((DebugLevel, "Response 0: %X, 1: %X, 2: %X, 3: %X\n",
> +                           Packet->SdMmcStatusBlk->Resp0,
> +                           Packet->SdMmcStatusBlk->Resp1,
> +                           Packet->SdMmcStatusBlk->Resp2,
> +                           Packet->SdMmcStatusBlk->Resp3
> +                           ));
> +  }
> +  DEBUG ((DebugLevel, "Timeout: %d\n", Packet->Timeout));


Please update to use %ld for UINT64 here.


> +  DEBUG ((DebugLevel, "InDataBuffer: %X\n", Packet->InDataBuffer));
> +  DEBUG ((DebugLevel, "OutDataBuffer: %X\n", Packet->OutDataBuffer));


Please update to use %p for InDataBuffer/OutDataBuffer (VOID *).


> +  DEBUG ((DebugLevel, "InTransferLength: %d\n", Packet-
> >InTransferLength));
> +  DEBUG ((DebugLevel, "OutTransferLength: %d\n", Packet-
> >OutTransferLength));
> +  DEBUG ((DebugLevel, "TransactionStatus: %r\n", Packet-
> >TransactionStatus));
> +}
> +
> +/**
> +  Prints the contents of the TRB to the debug port.
> +
> +  @param[in] DebugLevel  Debug level at which the TRB should be printed.
> +  @param[in] Trb         Pointer to the TRB structure.
> +**/
> +VOID
> +SdMmcPrintTrb (
> +  IN UINT32         DebugLevel,
> +  IN SD_MMC_HC_TRB  *Trb
> +  )
> +{
> +  if (Trb == NULL) {
> +    return;
> +  }
> +
> +  DEBUG ((DebugLevel, "Printing SD_MMC_HC_TRB\n"));
> +  DEBUG ((DebugLevel, "Slot: %d\n", Trb->Slot));
> +  DEBUG ((DebugLevel, "BlockSize: %d\n", Trb->BlockSize));
> +  DEBUG ((DebugLevel, "Data: %X\n", Trb->Data));


Please update to use %p for Trb->Data (VOID *).


> +  DEBUG ((DebugLevel, "DataLen: %d\n", Trb->DataLen));
> +  DEBUG ((DebugLevel, "Read: %d\n", Trb->Read));
> +  DEBUG ((DebugLevel, "DataPhy: %X\n", Trb->DataPhy));


Please update to use %lX for Trb->DataPhy (EFI_PHYSICAL_ADDRESS).


> +  DEBUG ((DebugLevel, "DataMap: %X\n", Trb->DataMap));


Please update to use %p for Trb->DataMap (VOID *).


> +  DEBUG ((DebugLevel, "Mode: %d\n", Trb->Mode));
> +  DEBUG ((DebugLevel, "AdmaLengthMode: %d\n", Trb-
> >AdmaLengthMode));
> +  DEBUG ((DebugLevel, "Event: %d\n", Trb->Event));


Please update to use %p for Trb->Event (EFI_EVENT).


> +  DEBUG ((DebugLevel, "Started: %d\n", Trb->Started));
> +  DEBUG ((DebugLevel, "Timeout: %d\n", Trb->Timeout));


Please update to use %ld for Trb->Timeout (UINT64).


> +  DEBUG ((DebugLevel, "Retries: %d\n", Trb->Retries));
> +  DEBUG ((DebugLevel, "Adma32Desc: %X\n", Trb->Adma32Desc));
> +  DEBUG ((DebugLevel, "Adma64V3Desc: %X\n", Trb->Adma64V3Desc));
> +  DEBUG ((DebugLevel, "Adma64V4Desc: %X\n", Trb->Adma64V4Desc));
> +  DEBUG ((DebugLevel, "AdmaMap: %X\n", Trb->AdmaMap));


Please update to use %p for:
Trb->Adma32Desc
Trb->Adma64V3Desc
Trb->Adma64V4Desc
Trb->AdmaMap
(pointers)

Best Regards,
Hao Wu

> +  DEBUG ((DebugLevel, "AdmaPages: %X\n", Trb->AdmaPages));
> +
> +  SdMmcPrintPacket (DebugLevel, Trb->Packet);
> +}
> +
>  /**
>    Create a new TRB for the SD/MMC cmd request.
> 
> @@ -1963,6 +2039,9 @@ SdMmcExecTrb (
>    UINT64                              AdmaAddr;
>    BOOLEAN                             AddressingMode64;
> 
> +  DEBUG ((DEBUG_VERBOSE, "Starting TRB execution\n"));
> +  SdMmcPrintTrb (DEBUG_VERBOSE, Trb);
> +
>    AddressingMode64 = FALSE;
> 
>    Packet = Trb->Packet;
> @@ -2235,6 +2314,10 @@ SdMmcCheckAndRecoverErrors (
>      return Status;
>    }
> 
> +  DEBUG ((DEBUG_ERROR, "Error reported by SDHCI\n"));
> +  DEBUG ((DEBUG_ERROR, "Interrupt status = %X\n", IntStatus));
> +  DEBUG ((DEBUG_ERROR, "Error interrupt status = %X\n", ErrIntStatus));
> +
>    //
>    // If the data timeout error is reported
>    // but data transfer is signaled as completed we
> @@ -2438,6 +2521,10 @@ Done:
> 
>    if (Status != EFI_NOT_READY) {
>      SdMmcHcLedOnOff (Private->PciIo, Trb->Slot, FALSE);
> +    if (EFI_ERROR (Status)) {
> +      DEBUG ((DEBUG_ERROR, "TRB failed with %r\n", Status));
> +      SdMmcPrintTrb (DEBUG_ERROR, Trb);
> +    }
>    }
> 
>    return Status;
> --
> 2.14.1.windows.1


  reply	other threads:[~2020-02-05  3:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03 14:18 [PATCH 0/4] MdeModulePkg/SdMmcPciHcDxe: Refactor command processing Albecki, Mateusz
2020-02-03 14:18 ` [PATCH 1/4] MdeModulePkg/SdMmcPciHcDxe: Enhance driver traces Albecki, Mateusz
2020-02-05  3:16   ` Wu, Hao A [this message]
2020-02-03 14:18 ` [PATCH 2/4] MdeModulePkg/SdMmcPciHcDxe: Read response on command completion Albecki, Mateusz
2020-02-05  3:16   ` [edk2-devel] " Wu, Hao A
2020-02-06 12:33     ` Albecki, Mateusz
2020-02-03 14:18 ` [PATCH 3/4] MdeModulePkg/SdMmcPciHcDxe: Refactor data transfer completion Albecki, Mateusz
2020-02-05  3:16   ` [edk2-devel] " Wu, Hao A
2020-02-06 12:37     ` Albecki, Mateusz
2020-02-03 14:18 ` [PATCH 4/4] MdeModulePkg/SdMmcPciHcDxe: Fix PIO transfer mode Albecki, Mateusz
2020-02-05  3:16   ` [edk2-devel] " Wu, Hao A
2020-02-10 13:11     ` Albecki, Mateusz
2020-02-04  7:58 ` [PATCH 0/4] MdeModulePkg/SdMmcPciHcDxe: Refactor command processing Wu, Hao A

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B80AF82E9BFB8E4FBD8C89DA810C6A093C9A419D@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox