From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Permerror (SPF Permanent Error: More than 10 MX records returned) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org 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 2025E22137D80 for ; Thu, 14 Dec 2017 06:50:22 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Dec 2017 06:55:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,400,1508828400"; d="scan'208";a="2696740" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga007.jf.intel.com with ESMTP; 14 Dec 2017 06:55:03 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 14 Dec 2017 06:55:02 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.152]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Thu, 14 Dec 2017 22:55:00 +0800 From: "Gao, Liming" To: Andrew Fish , krishnaLee CC: "edk2-devel@lists.01.org" Thread-Topic: [edk2] How to using PcdGetEx to change a PCD. Thread-Index: AQHTdLniqeQ644QGfUeGMVC24bBT/KNCHKiAgADLzAA= Date: Thu, 14 Dec 2017 14:55:00 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1923CC@SHSMSX104.ccr.corp.intel.com> References: <2382af2.ac98.160543fea54.Coremail.sssky307@163.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: How to using PcdGetEx to change a PCD. 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: Thu, 14 Dec 2017 14:50:23 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable PcdGet() is the recommended API to be used. It will be mapped to the matche= d PcdGet usage based on PCD type. PcdGetEx() is only used when PCD is configured to DynamicEx type. Its first= parameter is the pointer to the token space guid, the second parameter is = the token number. The token number can be get by PcdToken() macro. So, the = correct way is PcdGetEx16(&gEfiMdePkgTokenSpaceGuid, PcdToken (PcdPlatformB= ootTimeOut));. But PcdPlatformBootTimeOut is not configured to DynamicEx PC= D in NT32 platform. This style can pass build, but can't work.=20 Thanks Liming > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of An= drew Fish > Sent: Thursday, December 14, 2017 6:27 PM > To: krishnaLee > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] How to using PcdGetEx to change a PCD. >=20 >=20 >=20 > > On Dec 14, 2017, at 12:59 AM, krishnaLee wrote: > > > > Hello, > > I am learning and writing a application to change the Nt32pkg-virtual m= achine's boot time.follow code is success. > > but I think if I using PcdGetEx16 function, it will also work well,but = failed when I compile it. > > I had read some Specs about the difference between PcdGetEx and PcdGet,= but I can't understand,maybe I need some practice, > > So can anyone modify it to using PcdGetEx to implement the same functio= n in the application? > > //source-code--start >=20 > Did you add: >=20 > #include >=20 > and list gEfiMdePkgTokenSpaceGuid in the [Guids] section of the INF. >=20 > In general it is hard to comment on compiler failures in fragments of cod= e. If you post the actual compiler error it is easier to explain. >=20 >=20 >=20 > The PCDs are a GUID + token number namespace for config. Since anyone can= define a GUID that does not conflict it allows arbitrary > extension without conflict. >=20 > The Ex form of the API includes the GUID + token number. The non Ex form = is a size optimization that uses a build generated token > space. So generally if everything is built together then you use the non = Ex form to save space. If different binaries that got compiled in > different places need to work together then the Ex form is required. >=20 > Thanks, >=20 > Andrew Fish >=20 > > EFI_STATUS > > EFIAPI > > UefiMain ( > > IN EFI_HANDLE ImageHandle, > > IN EFI_SYSTEM_TABLE *SystemTable > > ) > > { > > UINTN buffer=3D0; > > UINTN index; > > buffer=3DPcdGet16(PcdPlatformBootTimeOut); > > //buffer=3DPcdGetEx16(&gEfiMdePkgTokenSpaceGuid,PcdPlatformBootTimeOut)= ;//compile failed. > > Print(L"buffer:%d\n",buffer); > > PcdSet16(PcdPlatformBootTimeOut,5); > > ... > > > > > > //source-code-end. > > > > > > attachment is the full source code. > > edk2-vUDK2017's build command: > > build -p Nt32Pkg\Nt32Pkg.dsc -m Nt32Pkg\Application\mytestpcd2\mytestpc= d2.inf > > > > > > thank you very much! > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel