From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web09.1801.1580872579718317387 for ; Tue, 04 Feb 2020 19:16:19 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: hao.a.wu@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Feb 2020 19:16:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,404,1574150400"; d="scan'208";a="431732465" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga006.fm.intel.com with ESMTP; 04 Feb 2020 19:16:17 -0800 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 4 Feb 2020 19:16:17 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 4 Feb 2020 19:16:17 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.5]) by shsmsx102.ccr.corp.intel.com ([169.254.2.126]) with mapi id 14.03.0439.000; Wed, 5 Feb 2020 11:16:14 +0800 From: "Wu, Hao A" To: "Albecki, Mateusz" , "devel@edk2.groups.io" CC: Marcin Wojtas , "Gao, Zhichao" , "Gao, Liming" Subject: Re: [PATCH 1/4] MdeModulePkg/SdMmcPciHcDxe: Enhance driver traces Thread-Topic: [PATCH 1/4] MdeModulePkg/SdMmcPciHcDxe: Enhance driver traces Thread-Index: AQHV2pzxAK3j4cPWPEW1p55FCAyP6qgKZxAQ Date: Wed, 5 Feb 2020 03:16:13 +0000 Message-ID: References: <20200203141858.3236-1-mateusz.albecki@intel.com> <20200203141858.3236-2-mateusz.albecki@intel.com> In-Reply-To: <20200203141858.3236-2-mateusz.albecki@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 >=20 > 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. >=20 > Cc: Hao A Wu > Cc: Marcin Wojtas > Cc: Zhichao Gao > Cc: Liming Gao >=20 > Signed-off-by: Mateusz Albecki > --- > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 87 > ++++++++++++++++++++++++ > 1 file changed, 87 insertions(+) >=20 > 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; > } >=20 > +/** > + 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 =3D=3D NULL) { > + return; > + } > + > + DEBUG ((DebugLevel, "Printing > EFI_SD_MMC_PASS_THRU_COMMAND_PACKET\n")); > + if (Packet->SdMmcCmdBlk !=3D 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 !=3D 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 =3D=3D 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. >=20 > @@ -1963,6 +2039,9 @@ SdMmcExecTrb ( > UINT64 AdmaAddr; > BOOLEAN AddressingMode64; >=20 > + DEBUG ((DEBUG_VERBOSE, "Starting TRB execution\n")); > + SdMmcPrintTrb (DEBUG_VERBOSE, Trb); > + > AddressingMode64 =3D FALSE; >=20 > Packet =3D Trb->Packet; > @@ -2235,6 +2314,10 @@ SdMmcCheckAndRecoverErrors ( > return Status; > } >=20 > + DEBUG ((DEBUG_ERROR, "Error reported by SDHCI\n")); > + DEBUG ((DEBUG_ERROR, "Interrupt status =3D %X\n", IntStatus)); > + DEBUG ((DEBUG_ERROR, "Error interrupt status =3D %X\n", ErrIntStatus))= ; > + > // > // If the data timeout error is reported > // but data transfer is signaled as completed we > @@ -2438,6 +2521,10 @@ Done: >=20 > if (Status !=3D 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); > + } > } >=20 > return Status; > -- > 2.14.1.windows.1