From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.9012.1604468028017036599 for ; Tue, 03 Nov 2020 21:33:48 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=fcvHiAh4; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: hao.a.wu@intel.com) IronPort-SDR: TlcfU2NbbB88r8AEH3c5tAf03MN6kQ6KQaEPJbqMcVMq4SMdxqLmKVTvPguc0xXG040sg2ZLI2 Uhv/k5HWDrig== X-IronPort-AV: E=McAfee;i="6000,8403,9794"; a="168382035" X-IronPort-AV: E=Sophos;i="5.77,450,1596524400"; d="scan'208";a="168382035" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2020 21:33:46 -0800 IronPort-SDR: ksC7lA+qpXOcW+GirlfIjpqjfAxm7S8Rt+VcBbUt6B3+/ofObwaLkzdWt7RDnnmk1gMkLS2xPi gsVv59TZtQnw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,450,1596524400"; d="scan'208";a="471074605" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by orsmga004.jf.intel.com with ESMTP; 03 Nov 2020 21:33:46 -0800 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 3 Nov 2020 21:33:46 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 3 Nov 2020 21:33:42 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 3 Nov 2020 21:33:42 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.49) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Tue, 3 Nov 2020 21:33:42 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kb5MkrumbpLq3e+8FqJ0xBUDiTZ+cyJUp9lYi9QgyfHgODj8Q8i6qmHWRCS0itnc368fMZ4tknHtlaaEPp1XXk7CUiIRx+e7UpSmAQEWT0z+I8B/8MFypuuE/vxqwM3hCl3r41dn49WGuzR3ia36FxQKVSjypNJJXuXmzeO7p9wMHuRNkJrZgtjsTDVzkhL9qGo9OqlqTT6zF5yBJuTDj4BGB9ON5Uf7LQstLZJjep/RTMzKdVCqZcb6G+sMSPpOsKSNtvIrin25k8BKpdVpzQqx0mj9izr2jWHIMhD1qe0ylzIxYR4gRpx1XFhh3wBiCvhZzioIscXj8FM77P68wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2/PSSzI30DLJTN1u0ool1lsmrBVCMXM2W5G8JwO008Y=; b=YViiwGPge4mcpBm20vjZRVNaCYIKBC8jfs/XIb6QPdPNZj0uM1AKG+Zfmuhjt3IsMegH3Vd+xXnpmv8fHOsffxHSMfyTGZcWcCBPPUTp0zYVm9qp1c//RcTfxPFOFJBqkwrgcPrPh/xxOOfRDlDNGbOYIBYW44o2+4La3CLrcg+djGZLeQOkdQzT2MjfqpLGkWrRFSo3lp5mAhGKFXNQ49RqX1UeVZyd2urnWvbwFdwoDhG++K/lEpy+qtP6gcA90DZxqK2539VzbQPKKIUJqH47eAss6zeIh2AipI+rzFmGjk1P6og+yH2jEvMFgAJYp491PaBzgCymzlctknaU1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2/PSSzI30DLJTN1u0ool1lsmrBVCMXM2W5G8JwO008Y=; b=fcvHiAh4dgwngPK8BwdYRXonzGwx08WOn8PTqujO++LpzHt5j5jHkOAEMfwPi3NSC4MB/tGJSm3x59wZkMpjuT3BYXFLzoRQWRPVeHZmHMv7lAxl/JKvT7P3orL33MPSYZ+41L9hyQFxeH/QnCXMbxtSHTFDHJHLSjrsmIdSWH4= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN6PR11MB1379.namprd11.prod.outlook.com (2603:10b6:404:48::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.29; Wed, 4 Nov 2020 05:33:41 +0000 Received: from BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::c123:faac:1da3:f807]) by BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::c123:faac:1da3:f807%5]) with mapi id 15.20.3499.032; Wed, 4 Nov 2020 05:33:41 +0000 From: "Wu, Hao A" To: "Albecki, Mateusz" , "devel@edk2.groups.io" CC: "Ni, Ray" Subject: Re: [PATCH 4/4] MdeModulePkg/AtaAtapiPassThru: Trace ATA packets Thread-Topic: [PATCH 4/4] MdeModulePkg/AtaAtapiPassThru: Trace ATA packets Thread-Index: AQHWseSlGmg7Ztgll0yHHBE1/T3sTqm3cS7w Date: Wed, 4 Nov 2020 05:33:41 +0000 Message-ID: References: <20201103132348.2916-1-mateusz.albecki@intel.com> <20201103132348.2916-5-mateusz.albecki@intel.com> In-Reply-To: <20201103132348.2916-5-mateusz.albecki@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.218] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 56065240-32ef-4f6b-affc-08d88083308e x-ms-traffictypediagnostic: BN6PR11MB1379: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: n6Xtj4fHrYDcHAk9PSrTq+2Sd9hKn1J8jjsiIEi88on/Tjy4If6Li7SU7ntB5teWAo0ndXM92nZ09OrzqSuBB85ZwZ2cF5NgDa1nyU9pvL4q1uOyeX0ZBUhJFSWQ/HrYu0NgNOSP9F7GOCTm4LIYelUFps3DbpFmT1yPIHfJrdBVdndSgfnp+Ea+lhgsNzmCu3+zvzdxf/RnkJjsrBnj47lzTaGsdpQEysoS7Zd8yLyI+xm6ui04pPr2yFGtdCPVQA9WcQ2WLVJzv8h6UXQxGQNlOBeAE75nvbuAPKoDEsw+fC2SNKHxhKp/ZLsOTY5zdcKkxwkuEaRVkvUnqJrrvA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3666.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(346002)(39860400002)(136003)(366004)(376002)(2906002)(4326008)(6506007)(5660300002)(86362001)(9686003)(71200400001)(52536014)(55016002)(8936002)(7696005)(53546011)(107886003)(186003)(26005)(8676002)(76116006)(478600001)(83380400001)(316002)(33656002)(66556008)(66946007)(64756008)(66446008)(66476007)(110136005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: aconNXqKhK/1xk+a/GZ4C0AvEyhVy7hCFVKRchWmdOZeqlvpBpqiNPbUm+2tSAUt8xjeM6yYdc60o+QfEolvfhJdaASf15d1L+wWL7Cke/Kpn7snTIUKxhoSVFDmretMU9pFENjI/maJZJECNmmJO/kHLwrFF9EAiID6nLc+ye5yvDrfN/z7sxk53cAyd1kRr+nO7nJEachrSpi3IhVmb9XHBPV9MqQDlKgLxcTnaXtxdo3izeisr3Tk+F16fXQOM0GD0NmgkbeX+QdXPfq6AjxMBF0tvEKySM0VX63G+ZrnXWKdQrw6xEPIjJ3jbgNf1CFp0QYESFup+qABrblQUlvHeeRrYYWUTIsOE7uFaw3pfy0m0W55zCsRjCsGAIuhH/58CgfsfQ6doWqQKvQ1gaUseS2Dban+HUKfwnLbk4PRZNeUXwGy2IkovJUI8PGpHOddtxrN5IBKNYtktTDS2mk6zvUJcuCvIMe7BKEvTxs9n64vAAUhrApWgVhJ5z/sqeVhhh6aUmzEas2pyGsbqtvsNQ8a/3/lh+U0CKYEk/eXoxXnTolbU851YnTGCCp5OmsF5RitR9QiO4toTmyF+NKLEitBM3DM4c7mOouhoj71cTjWo086QLrNGKlWYNe33vwhlUdf1n+5x2oppMFhBA== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3666.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 56065240-32ef-4f6b-affc-08d88083308e X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Nov 2020 05:33:41.5404 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vNC0ZK8vwsD/Y3jqcLOe/tpwtivrxmBacVRALnBec2EGIAZwxSpE6wtCW8XSOO6gXVIRFvd8RsYehUFD/MKPUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1379 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Albecki, Mateusz > Sent: Tuesday, November 3, 2020 9:24 PM > To: devel@edk2.groups.io > Cc: Albecki, Mateusz ; Ni, Ray > ; Wu, Hao A > Subject: [PATCH 4/4] MdeModulePkg/AtaAtapiPassThru: Trace ATA packets >=20 > From: Albecki >=20 > This simplify ATA driver debugging all ATA packets will be printed to deb= ug > port on DEBUG_VERBOSE level along with the packet execution status. > Additionally failed packets and the failed packet execution status will b= e > printed on DEBUG_ERROR level. A couple of minor comments: 1. Could you help to correct the typos for "commmand" to "command"? 2. For the below debug messages added in AhciPioTransfer(), AhciDmaTransfer= () and AhciNonDataTransfer(): DEBUG ((DEBUG_VERBOSE, "Starting commmand: \n")); DEBUG ((DEBUG_ERROR, "Failed to execute command:\n")); Could you help to add the transfer type information. Like for non-blocking = DMA transfer: DEBUG ((DEBUG_VERBOSE, "Starting command for non-blocking DMA transfer: \n"= )); DEBUG ((DEBUG_ERROR, "Failed to execute command for non-blocking DMA transf= er:\n")); This might be helpful to identify these messages with their corresponding t= ransfer request. Best Regards, Hao Wu >=20 > Signed-off-by: Mateusz Albecki >=20 > Cc: Ray Ni > Cc: Hao A Wu >=20 > --- > .../Bus/Ata/AtaAtapiPassThru/AhciMode.c | 94 +++++++++++++++++++ > 1 file changed, 94 insertions(+) >=20 > diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c > b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c > index 4fe7e4b1dc..3a7a6eb018 100644 > --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c > +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c > @@ -846,6 +846,54 @@ AhciWaitUntilFisReceived ( > return EFI_TIMEOUT; > } >=20 > +/** > + Prints contents of the ATA command block into the debug port. > + > + @param[in] AtaCommandBlock AtaCommandBlock to print. > + @param[in] DebugLevel Debug level on which to print. > +**/ > +VOID > +AhciPrintCommandBlock ( > + IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock, > + IN UINT32 DebugLevel > + ) > +{ > + DEBUG ((DebugLevel, "ATA COMMAND BLOCK:\n")); > + DEBUG ((DebugLevel, "AtaCommand: %d\n", > +AtaCommandBlock->AtaCommand)); > + DEBUG ((DebugLevel, "AtaFeatures: %X\n", > +AtaCommandBlock->AtaFeatures)); > + DEBUG ((DebugLevel, "AtaSectorNumber: %d\n", > +AtaCommandBlock->AtaSectorNumber)); > + DEBUG ((DebugLevel, "AtaCylinderLow: %X\n", > +AtaCommandBlock->AtaCylinderHigh)); > + DEBUG ((DebugLevel, "AtaCylinderHigh: %X\n", > +AtaCommandBlock->AtaCylinderHigh)); > + DEBUG ((DebugLevel, "AtaDeviceHead: %d\n", > +AtaCommandBlock->AtaDeviceHead)); > + DEBUG ((DebugLevel, "AtaSectorNumberExp: %d\n", > +AtaCommandBlock->AtaSectorNumberExp)); > + DEBUG ((DebugLevel, "AtaCylinderLowExp: %X\n", > +AtaCommandBlock->AtaCylinderLowExp)); > + DEBUG ((DebugLevel, "AtaCylinderHighExp: %X\n", > +AtaCommandBlock->AtaCylinderHighExp)); > + DEBUG ((DebugLevel, "AtaFeaturesExp: %X\n", > +AtaCommandBlock->AtaFeaturesExp)); > + DEBUG ((DebugLevel, "AtaSectorCount: %d\n", > +AtaCommandBlock->AtaSectorCount)); > + DEBUG ((DebugLevel, "AtaSectorCountExp: %d\n", > +AtaCommandBlock->AtaSectorCountExp)); > +} > + > +/** > + Prints contents of the ATA status block into the debug port. > + > + @param[in] AtaStatusBlock AtaStatusBlock to print. > + @param[in] DebugLevel Debug level on which to print. > +**/ > +VOID > +AhciPrintStatusBlock ( > + IN EFI_ATA_STATUS_BLOCK *AtaStatusBlock, > + IN UINT32 DebugLevel > + ) > +{ > + // > + // Only print status and error since we have all of the rest printed > +as > + // a part of command block print. > + // > + DEBUG ((DebugLevel, "ATA STATUS BLOCK:\n")); > + DEBUG ((DebugLevel, "AtaStatus: %d\n", AtaStatusBlock->AtaStatus)); > + DEBUG ((DebugLevel, "AtaError: %d\n", AtaStatusBlock->AtaError)); } > + > /** > Start a PIO data transfer on specific port. >=20 > @@ -947,6 +995,8 @@ AhciPioTransfer ( > DataCount > ); >=20 > + DEBUG ((DEBUG_VERBOSE, "Starting commmand: \n")); > + AhciPrintCommandBlock (AtaCommandBlock, DEBUG_VERBOSE); > Status =3D AhciStartCommand ( > PciIo, > Port, > @@ -1000,6 +1050,19 @@ AhciPioTransfer ( > ); >=20 > AhciDumpPortStatus (PciIo, AhciRegisters, Port, AtaStatusBlock); > + > + if (Status =3D=3D EFI_DEVICE_ERROR) { > + DEBUG ((DEBUG_ERROR, "Failed to execute command:\n")); > + // > + // Repeat command block here to make sure it is printed on > + // device error debug level. > + // > + AhciPrintCommandBlock (AtaCommandBlock, DEBUG_ERROR); > + AhciPrintStatusBlock (AtaStatusBlock, DEBUG_ERROR); } else { > + AhciPrintStatusBlock (AtaStatusBlock, DEBUG_VERBOSE); } > + > return Status; > } >=20 > @@ -1132,6 +1195,8 @@ AhciDmaTransfer ( > DataCount > ); >=20 > + DEBUG ((DEBUG_VERBOSE, "Starting commmand: \n")); > + AhciPrintCommandBlock (AtaCommandBlock, DEBUG_VERBOSE); > Status =3D AhciStartCommand ( > PciIo, > Port, > @@ -1168,6 +1233,8 @@ AhciDmaTransfer ( > DataCount > ); >=20 > + DEBUG ((DEBUG_VERBOSE, "Starting commmand: \n")); > + AhciPrintCommandBlock (AtaCommandBlock, DEBUG_VERBOSE); > Status =3D AhciStartCommand ( > PciIo, > Port, > @@ -1238,6 +1305,19 @@ AhciDmaTransfer ( > } >=20 > AhciDumpPortStatus (PciIo, AhciRegisters, Port, AtaStatusBlock); > + > + if (Status =3D=3D EFI_DEVICE_ERROR) { > + DEBUG ((DEBUG_ERROR, "Failed to execute command:\n")); > + // > + // Repeat command block here to make sure it is printed on > + // device error debug level. > + // > + AhciPrintCommandBlock (AtaCommandBlock, DEBUG_ERROR); > + AhciPrintStatusBlock (AtaStatusBlock, DEBUG_ERROR); } else { > + AhciPrintStatusBlock (AtaStatusBlock, DEBUG_VERBOSE); } > + > return Status; > } >=20 > @@ -1307,6 +1387,8 @@ AhciNonDataTransfer ( > 0 > ); >=20 > + DEBUG ((DEBUG_VERBOSE, "Starting commmand: \n")); > + AhciPrintCommandBlock (AtaCommandBlock, DEBUG_VERBOSE); > Status =3D AhciStartCommand ( > PciIo, > Port, > @@ -1343,6 +1425,18 @@ AhciNonDataTransfer ( >=20 > AhciDumpPortStatus (PciIo, AhciRegisters, Port, AtaStatusBlock); >=20 > + if (Status =3D=3D EFI_DEVICE_ERROR) { > + DEBUG ((DEBUG_ERROR, "Failed to execute command:\n")); > + // > + // Repeat command block here to make sure it is printed on > + // device error debug level. > + // > + AhciPrintCommandBlock (AtaCommandBlock, DEBUG_ERROR); > + AhciPrintStatusBlock (AtaStatusBlock, DEBUG_ERROR); } else { > + AhciPrintStatusBlock (AtaStatusBlock, DEBUG_VERBOSE); } > + > return Status; > } >=20 > -- > 2.28.0.windows.1