From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 81B8D2095D8D8 for ; Thu, 31 Aug 2017 23:32:08 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Aug 2017 23:34:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,456,1498546800"; d="scan'208";a="306839149" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 31 Aug 2017 23:34:52 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 31 Aug 2017 23:34:52 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 31 Aug 2017 23:34:51 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.117]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.219]) with mapi id 14.03.0319.002; Fri, 1 Sep 2017 14:34:50 +0800 From: "Ni, Ruiyu" To: "Wu, Hao A" , "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Zeng, Star" Thread-Topic: [edk2] [PATCH] SourceLevelDebugPkg/DebugCommLibUsb3Pei: Make sure alloc physical mem Thread-Index: AQHTIjk1kjHtQBXQGUGocoRLNqofxqKfC0qAgACIllA= Date: Fri, 1 Sep 2017 06:34:48 +0000 Deferred-Delivery: Fri, 1 Sep 2017 06:34:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BA1EB37@SHSMSX104.ccr.corp.intel.com> References: <1504170679-7412-1-git-send-email-star.zeng@intel.com> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] SourceLevelDebugPkg/DebugCommLibUsb3Pei: Make sure alloc physical mem X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Sep 2017 06:32:08 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni Thanks/Ray > -----Original Message----- > From: Wu, Hao A > Sent: Friday, September 1, 2017 2:24 PM > To: Zeng, Star ; edk2-devel@lists.01.org > Cc: Ni, Ruiyu ; Zeng, Star > Subject: RE: [edk2] [PATCH] SourceLevelDebugPkg/DebugCommLibUsb3Pei: > Make sure alloc physical mem >=20 > Reviewed-by: Hao Wu >=20 >=20 > Best Regards, > Hao Wu >=20 >=20 > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > Star Zeng > > Sent: Thursday, August 31, 2017 5:11 PM > > To: edk2-devel@lists.01.org > > Cc: Ni, Ruiyu; Wu, Hao A; Zeng, Star > > Subject: [edk2] [PATCH] SourceLevelDebugPkg/DebugCommLibUsb3Pei: > Make > > sure alloc physical mem > > > > PI 1.6 has supported pre permanent memory page allocation, to make > > sure the allocated memory is physical memory for DMA, the patch is to > > check memory discovered PPI installed or not first before calling > > AllocatePages. > > > > Cc: Ruiyu Ni > > Cc: Hao Wu > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Star Zeng > > --- > > .../DebugCommunicationLibUsb3Pei.c | 28 ++++++++++++++= +----- > -- > > .../DebugCommunicationLibUsb3Pei.inf | 5 +++- > > 2 files changed, 24 insertions(+), 9 deletions(-) > > > > diff --git > > > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom > mun > > icationLibUsb3Pei.c > > > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom > mun > > icationLibUsb3Pei.c > > index be3174e75fd6..902a3b626acc 100644 > > --- > > > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom > mun > > icationLibUsb3Pei.c > > +++ > > > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom > mun > > icationLibUsb3Pei.c > > @@ -1,7 +1,7 @@ > > /** @file > > Debug Port Library implementation based on usb3 debug port. > > > > - Copyright (c) 2014, Intel Corporation. All rights reserved.
> > + Copyright (c) 2014 - 2017, Intel Corporation. All rights > > + reserved.
> > This program and the accompanying materials > > are licensed and made available under the terms and conditions of > > the BSD License > > which accompanies this distribution. The full text of the license > > may be found at @@ -14,6 +14,7 @@ > > > > #include > > #include > > +#include > > #include "DebugCommunicationLibUsb3Internal.h" > > > > /** > > @@ -32,13 +33,24 @@ AllocateAlignBuffer ( > > VOID *Buf; > > EFI_PHYSICAL_ADDRESS Address; > > EFI_STATUS Status; > > - > > - Buf =3D NULL; > > - Status =3D PeiServicesAllocatePages (EfiACPIMemoryNVS, > > EFI_SIZE_TO_PAGES (BufferSize), &Address); > > - if (EFI_ERROR (Status)) { > > - Buf =3D NULL; > > - } else { > > - Buf =3D (VOID *)(UINTN) Address; > > + VOID *MemoryDiscoveredPpi; > > + > > + Buf =3D NULL; > > + > > + // > > + // Make sure the allocated memory is physical memory. > > + // > > + Status =3D PeiServicesLocatePpi ( > > + &gEfiPeiMemoryDiscoveredPpiGuid, > > + 0, > > + NULL, > > + (VOID **) &MemoryDiscoveredPpi > > + ); > > + if (!EFI_ERROR (Status)) { > > + Status =3D PeiServicesAllocatePages (EfiACPIMemoryNVS, > > EFI_SIZE_TO_PAGES (BufferSize), &Address); > > + if (!EFI_ERROR (Status)) { > > + Buf =3D (VOID *)(UINTN) Address; > > + } > > } > > return Buf; > > } > > diff --git > > > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom > mun > > icationLibUsb3Pei.inf > > > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom > mun > > icationLibUsb3Pei.inf > > index 74dcdd124b47..6cd5e1068333 100644 > > --- > > > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom > mun > > icationLibUsb3Pei.inf > > +++ > > > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom > mun > > icationLibUsb3Pei.inf > > @@ -1,7 +1,7 @@ > > ## @file > > # Debug Communication Library instance based on usb3 debug port. > > # > > -# Copyright (c) 2014 - 2015, Intel Corporation. All rights > > reserved.
> > +# Copyright (c) 2014 - 2017, Intel Corporation. All rights > > +reserved.
> > # > > # This program and the accompanying materials # are licensed and > > made available under the terms and conditions of the BSD License @@ > > -40,6 +40,9 @@ [Packages] > > IntelFrameworkPkg/IntelFrameworkPkg.dec > > SourceLevelDebugPkg/SourceLevelDebugPkg.dec > > > > +[Ppis] > > + gEfiPeiMemoryDiscoveredPpiGuid ## CONSUMES > > + > > [Pcd] > > # The memory BAR of ehci host controller, in which usb debug > > feature is enabled. > > # Note that the memory BAR address is only used before Pci bus > > resource allocation. > > -- > > 2.7.0.windows.1 > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel