From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web09.11739.1580992636337125447 for ; Thu, 06 Feb 2020 04:37:16 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=kifGjID1; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: mateusz.albecki@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Feb 2020 04:37:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,409,1574150400"; d="scan'208";a="279666979" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by FMSMGA003.fm.intel.com with ESMTP; 06 Feb 2020 04:37:14 -0800 Received: from orsmsx115.amr.corp.intel.com (10.22.240.11) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 6 Feb 2020 04:37:13 -0800 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by ORSMSX115.amr.corp.intel.com (10.22.240.11) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 6 Feb 2020 04:37:13 -0800 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.101) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 6 Feb 2020 04:37:13 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uk500fqIrfD+BZnclWB0zuna6h5Ek+2AUeiFjwAKo3sRUsvTVy5LqUhvcORltwI1vYL6zgqJ8L56hIOA49Q1UvYQi4sIYtHL0ZgLohivrYhfHIfPgw85cDu6KYbeRXhjm19LEQXWdLhaWn4kEk2LcCH3IPYLFfiJAO4eMMjAWTygnxUiZDjOmWb8MCi0PiVhF/pX91HOEfF1AnoR3X4ahtW2CHqbHX1kuuDFbnO4qxWr7HvmqsbQ7aWDcBwvHBfuFOSu9D2/E3y7QKUkvFeUgMAoHbFjgj1s/8NSW+Dp3NhdJK1Srefc7ZYobs0LIQval0Omo41PYvHUyFNJCr41lQ== 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=Wq7BHYI5FplreGFjBMWFloRhGx/bSS5fD3KM1hxjWsc=; b=NzKxgJXLbTcRAIv+uHqN4Pg2Pt2iuGTqV9SRG4xL8rn/R6sVRSc3YiDfpEE+fSu0LOX6qaGbYS+Spa7jP8kNHnpQ2/73uc1qyqSJ1v4nrjdNfQTSviP4J2HmDK6Xd7k89THcI0bMlEsaRaMKquetsUiuhfbql+CCSqZxYuYFpK4/CAr66Q2wx4si6ZkG7hf2niwg70hLMv1GzblEf9Di2GKxkgU+xmk/T1jbgwsQ8l6JVorIPnZ/Qix7HzoCYdZ21rJyOmReKP2t8VhO8RgmXk1hgMBdg3h13A+o62dBtH7Fa7YSWaWKq9X7Q8Fk7LXWik7PIMZdIKHLt7rvSVQXwA== 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=Wq7BHYI5FplreGFjBMWFloRhGx/bSS5fD3KM1hxjWsc=; b=kifGjID12yHm4a8IGhN9s1tGU+k+RgL3Y3WGYQN+a1SgJqJDiExToIrWV5aceifuQ9qlGsrcIzaPP8zxqD9BWwCWnISoVbAP/MZs2ZZGiXVMJY8oKwLUs+5Ir2H/iQzjrqVPvZHmurr+lrtWZvIuhVbdJtzNtGcZopAoNechCVk= Received: from MN2PR11MB3600.namprd11.prod.outlook.com (20.178.254.142) by MN2PR11MB4144.namprd11.prod.outlook.com (20.179.150.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2707.21; Thu, 6 Feb 2020 12:37:11 +0000 Received: from MN2PR11MB3600.namprd11.prod.outlook.com ([fe80::a47a:3dc2:c4aa:4ede]) by MN2PR11MB3600.namprd11.prod.outlook.com ([fe80::a47a:3dc2:c4aa:4ede%4]) with mapi id 15.20.2686.036; Thu, 6 Feb 2020 12:37:11 +0000 From: "Albecki, Mateusz" To: "Wu, Hao A" , "devel@edk2.groups.io" CC: Marcin Wojtas , "Gao, Zhichao" , "Gao, Liming" Subject: Re: [edk2-devel] [PATCH 3/4] MdeModulePkg/SdMmcPciHcDxe: Refactor data transfer completion Thread-Topic: [edk2-devel] [PATCH 3/4] MdeModulePkg/SdMmcPciHcDxe: Refactor data transfer completion Thread-Index: AQHV2p0JE6nXMp2XY0KnrRNjQeZbpagL8AsAgAIt8ZA= Date: Thu, 6 Feb 2020 12:37:11 +0000 Message-ID: References: <20200203141858.3236-1-mateusz.albecki@intel.com> <20200203141858.3236-4-mateusz.albecki@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmI3NDNmZTctOGU5Mi00Njg1LTlmYTMtYjBiM2FjODM5MTFlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTnBCcW5XSnpQMm04bVdjRmQ4TW5pWWJST0pzNnR2R3R3amNjOUhEUzloREJRRXp6dzBiSVFSQTVFSm9vXC8rUloifQ== dlp-product: dlpe-windows x-ctpclassification: CTP_NT dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: spf=none (sender IP is ) smtp.mailfrom=mateusz.albecki@intel.com; x-originating-ip: [134.191.221.97] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d2a47a79-971f-4ab2-a9a0-08d7ab0149a6 x-ms-traffictypediagnostic: MN2PR11MB4144: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-forefront-prvs: 0305463112 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6029001)(39860400002)(136003)(366004)(396003)(376002)(346002)(199004)(189003)(71200400001)(52536014)(26005)(66946007)(76116006)(4326008)(186003)(66476007)(66446008)(64756008)(66556008)(19627235002)(8936002)(5660300002)(33656002)(7696005)(966005)(6506007)(53546011)(8676002)(81156014)(81166006)(9686003)(55016002)(107886003)(316002)(86362001)(54906003)(2906002)(478600001)(110136005);DIR:OUT;SFP:1102;SCL:1;SRVR:MN2PR11MB4144;H:MN2PR11MB3600.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9zn34LTGY3C9i/N/fO2SEHQqllobU4S55sK1Txwp1j4BYHHWv9Pc8ESiI0Twj3iiwXs0XE7G5mBG1F+N8QQXIsjYA+zQbfP84Y8SeTWBFpuPO9pBIeOHOnF3IrPIq1FDWLonJs5C/AKerJc/dapYJxL8L1V8/C5n3AGh4rBcv/5DqaYiYsbaWbtSQBqo21jkEbG7nEOu5VwdCrmnhmb3iqXKJahQ37Yid1KqTtTbFJdE7JP6+lIF2F2ewsIpFP1S8nNbOz9krCex1UTEnh7unMWB4oIK+QfxdpjEnh783DVV0fOyNgds8KDfGsldczo8CZWP4be2Gx7AOdVJ5K+HJbrVtsL8hL0fyfjiAWoFdE0bxcMasEsEVf1LaUBdchkoTxWQn6DCYAlOLkkQ/QX8X5fiWhMCBVt2PyI6vQCQOVGHoCPPqezloUKkkmpWV8xjI03pVRPi1tKNyBILMJ6QGnSYOfUy8AJ3zwkdFGhNsVYCxM+GzcHyuEE2oupScV2kd3SQJaFMQpY5q/kQ7aUZkA== x-ms-exchange-antispam-messagedata: l87KiwVXuK0mFbtXqGITwV9nK+aToj3dhJ0E1UbBmq9LkrJhGgnJxF0NwZZcNB2oqSWbHS9m5CLcIkDil/xgDHrxry5RzfHZIukzugShciFfNgK4zXA1GHew7ta4DQBVOcmDcfZIkQK99t88O+Dn2g== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d2a47a79-971f-4ab2-a9a0-08d7ab0149a6 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Feb 2020 12:37:11.3701 (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: F+j0UW9XX90EWQcvq7KThLhXvEiFB1CuCdYPlwn9+a8sKpyeBOHHlkNxt/E4ghQ7ZP5kTsqie5zmAs40o9Tvf33WHB9lv2Ah0cE7BtJEFo4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4144 Return-Path: mateusz.albecki@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, As in the patch 2/4 section 3.7.1.2 recommends that we clear the transfer = complete(step 6) just after reading it(step 5). Thanks, Mateusz > -----Original Message----- > From: Wu, Hao A > Sent: Wednesday, February 5, 2020 4:16 AM > To: devel@edk2.groups.io; Albecki, Mateusz > Cc: Marcin Wojtas ; Gao, Zhichao > ; Gao, Liming > Subject: RE: [edk2-devel] [PATCH 3/4] MdeModulePkg/SdMmcPciHcDxe: > Refactor data transfer completion >=20 > Just a similar question to PATCH 2/4 below: >=20 >=20 > > -----Original Message----- > > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > > 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: [edk2-devel] [PATCH 3/4] MdeModulePkg/SdMmcPciHcDxe: > > Refactor data transfer completion > > > > This patch refactors the way in which the driver will check the data > > transfer completion. Data transfer related functionalities have been > > moved to separate function. > > > > Cc: Hao A Wu > > Cc: Marcin Wojtas > > Cc: Zhichao Gao > > Cc: Liming Gao > > > > Signed-off-by: Mateusz Albecki > > --- > > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 181 > > ++++++++++++++--------- > > 1 file changed, 112 insertions(+), 69 deletions(-) > > > > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > > index 3dfaae8542..480a1664ea 100644 > > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > > @@ -2447,6 +2447,112 @@ SdMmcCheckCommandComplete ( > > return EFI_NOT_READY; > > } > > > > +/** > > + Update the SDMA address on the SDMA buffer boundary interrupt. > > + > > + @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA > > instance. > > + @param[in] Trb The pointer to the SD_MMC_HC_TRB instance. > > + > > + @retval EFI_SUCCESS Updated SDMA buffer address. > > + @retval Others Failed to update SDMA buffer address. > > +**/ > > +EFI_STATUS > > +SdMmcUpdateSdmaAddress ( > > + IN SD_MMC_HC_PRIVATE_DATA *Private, > > + IN SD_MMC_HC_TRB *Trb > > + ) > > +{ > > + UINT64 SdmaAddr; > > + EFI_STATUS Status; > > + > > + SdmaAddr =3D SD_MMC_SDMA_ROUND_UP ((UINTN)Trb->DataPhy, > > SD_MMC_SDMA_BOUNDARY); > > + > > + if (Private->ControllerVersion[Trb->Slot] >=3D > > + SD_MMC_HC_CTRL_VER_400) > > { > > + Status =3D SdMmcHcRwMmio ( > > + Private->PciIo, > > + Trb->Slot, > > + SD_MMC_HC_ADMA_SYS_ADDR, > > + FALSE, > > + sizeof (UINT64), > > + &SdmaAddr > > + ); > > + } else { > > + Status =3D SdMmcHcRwMmio ( > > + Private->PciIo, > > + Trb->Slot, > > + SD_MMC_HC_SDMA_ADDR, > > + FALSE, > > + sizeof (UINT32), > > + &SdmaAddr > > + ); > > + } > > + > > + if (EFI_ERROR (Status)) { > > + return Status; > > + } > > + > > + Trb->DataPhy =3D (UINT64)(UINTN)SdmaAddr; > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + Checks if the data transfer completed and performs any actions > > + neccessary to continue the data transfer such as SDMA system > > + address fixup or PIO data transfer. > > + > > + @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA > > instance. > > + @param[in] Trb The pointer to the SD_MMC_HC_TRB instance. > > + @param[in] IntStatus Snapshot of the normal interrupt status regis= ter. > > + > > + @retval EFI_SUCCESS Data transfer completed successfully. > > + @retval EFI_NOT_READY Data transfer completion still pending. > > + @retval Others Data transfer failed to complete. > > +**/ > > +EFI_STATUS > > +SdMmcCheckDataTransfer ( > > + IN SD_MMC_HC_PRIVATE_DATA *Private, > > + IN SD_MMC_HC_TRB *Trb, > > + IN UINT16 IntStatus > > + ) > > +{ > > + UINT16 Data16; > > + EFI_STATUS Status; > > + > > + if ((IntStatus & BIT1) !=3D 0) { > > + Data16 =3D BIT1; > > + Status =3D SdMmcHcRwMmio ( > > + Private->PciIo, > > + Trb->Slot, > > + SD_MMC_HC_NOR_INT_STS, > > + FALSE, > > + sizeof (Data16), > > + &Data16 > > + ); >=20 >=20 > Cleaning the Transfer Complete (BIT1) right after checking it is more al= igned > with the spec, right? >=20 > Best Regards, > Hao Wu >=20 >=20 > > + return Status; > > + } > > + > > + if ((Trb->Mode =3D=3D SdMmcSdmaMode) && ((IntStatus & BIT3) !=3D 0)= ) { > > + Data16 =3D BIT3; > > + Status =3D SdMmcHcRwMmio ( > > + Private->PciIo, > > + Trb->Slot, > > + SD_MMC_HC_NOR_INT_STS, > > + FALSE, > > + sizeof (Data16), > > + &Data16 > > + ); > > + if (EFI_ERROR (Status)) { > > + return Status; > > + } > > + Status =3D SdMmcUpdateSdmaAddress (Private, Trb); > > + if (EFI_ERROR (Status)) { > > + return Status; > > + } > > + } > > + > > + return EFI_NOT_READY; > > +} > > + > > /** > > Check the TRB execution result. > > > > @@ -2467,7 +2573,6 @@ SdMmcCheckTrbResult ( > > EFI_STATUS Status; > > EFI_SD_MMC_PASS_THRU_COMMAND_PACKET *Packet; > > UINT16 IntStatus; > > - UINT64 SdmaAddr; > > UINT32 PioLength; > > > > Packet =3D Trb->Packet; > > @@ -2530,80 +2635,18 @@ SdMmcCheckTrbResult ( > > Status =3D SdMmcCheckCommandComplete (Private, Trb, IntStatus); > > if (EFI_ERROR (Status)) { > > goto Done; > > - } else { > > - // > > - // If the command doesn't require data transfer skip the transf= er > > - // complete checking. > > - // > > - if ((Packet->SdMmcCmdBlk->CommandType !=3D > > SdMmcCommandTypeAdtc) && > > - (Packet->SdMmcCmdBlk->ResponseType !=3D > SdMmcResponseTypeR1b) > > && > > - (Packet->SdMmcCmdBlk->ResponseType !=3D > SdMmcResponseTypeR5b)) > > { > > - goto Done; > > - } > > } > > } > > > > - // > > - // Check Transfer Complete bit is set or not. > > - // > > - if ((IntStatus & BIT1) =3D=3D BIT1) { > > - goto Done; > > - } > > - > > - // > > - // Check if DMA interrupt is signalled for the SDMA transfer. > > - // > > - if ((Trb->Mode =3D=3D SdMmcSdmaMode) && ((IntStatus & BIT3) =3D=3D = BIT3)) { > > - // > > - // Clear DMA interrupt bit. > > - // > > - IntStatus =3D BIT3; > > - Status =3D SdMmcHcRwMmio ( > > - Private->PciIo, > > - Trb->Slot, > > - SD_MMC_HC_NOR_INT_STS, > > - FALSE, > > - sizeof (IntStatus), > > - &IntStatus > > - ); > > - if (EFI_ERROR (Status)) { > > - goto Done; > > - } > > - // > > - // Update SDMA Address register. > > - // > > - SdmaAddr =3D SD_MMC_SDMA_ROUND_UP ((UINTN)Trb->DataPhy, > > SD_MMC_SDMA_BOUNDARY); > > - > > - if (Private->ControllerVersion[Trb->Slot] >=3D > SD_MMC_HC_CTRL_VER_400) > > { > > - Status =3D SdMmcHcRwMmio ( > > - Private->PciIo, > > - Trb->Slot, > > - SD_MMC_HC_ADMA_SYS_ADDR, > > - FALSE, > > - sizeof (UINT64), > > - &SdmaAddr > > - ); > > - } else { > > - Status =3D SdMmcHcRwMmio ( > > - Private->PciIo, > > - Trb->Slot, > > - SD_MMC_HC_SDMA_ADDR, > > - FALSE, > > - sizeof (UINT32), > > - &SdmaAddr > > - ); > > - } > > - > > - if (EFI_ERROR (Status)) { > > - goto Done; > > - } > > - Trb->DataPhy =3D (UINT64)(UINTN)SdmaAddr; > > + if (Packet->SdMmcCmdBlk->CommandType =3D=3D > SdMmcCommandTypeAdtc > > || > > + Packet->SdMmcCmdBlk->ResponseType =3D=3D SdMmcResponseTypeR1b > || > > + Packet->SdMmcCmdBlk->ResponseType =3D=3D > SdMmcResponseTypeR5b) { > > + Status =3D SdMmcCheckDataTransfer (Private, Trb, IntStatus); } > > + else { > > + Status =3D EFI_SUCCESS; > > } > > > > - > > - Status =3D EFI_NOT_READY; > > Done: > > - > > if (Status !=3D EFI_NOT_READY) { > > SdMmcHcLedOnOff (Private->PciIo, Trb->Slot, FALSE); > > if (EFI_ERROR (Status)) { > > -- > > 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. > > > > > >=20 >=20 -------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wyd= zial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-3= 16 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresat= a i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej w= iadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakie= kolwiek 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 recipien= t, please contact the sender and delete all copies; any review or distribut= ion by others is strictly prohibited.