From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ma1-aaemail-dr-lapp02.apple.com (ma1-aaemail-dr-lapp02.apple.com [17.171.2.68]) by mx.groups.io with SMTP id smtpd.web11.3031.1579813733604632152 for ; Thu, 23 Jan 2020 13:08:54 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@apple.com header.s=20180706 header.b=JSUL4Kq+; spf=pass (domain: apple.com, ip: 17.171.2.68, mailfrom: afish@apple.com) Received: from pps.filterd (ma1-aaemail-dr-lapp02.apple.com [127.0.0.1]) by ma1-aaemail-dr-lapp02.apple.com (8.16.0.27/8.16.0.27) with SMTP id 00NL7DO5034265; Thu, 23 Jan 2020 13:08:51 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=sender : content-type : mime-version : subject : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=20180706; bh=UpF+bNr2tDj6NqvDJb58LNwwogt3CnzJ11joE+5GIxA=; b=JSUL4Kq+VkKRhLCdhqFwNX/sRUvbu0/K/mKLRZYB+IvaRZPmYeuPo5rihhqZ7MF18bin hzKGzjGTs8gCg2QJ1HLsHr2hwP7SR+c8fTgRAmuD7ZWAVX5DcMLSjK8uj+f6QXh2cW1e 95x+PK3Fz5OxcJ2/aAg0OQKqWBmxi8TAaTi6uy/G1PYhMeVVvtJvXLEC4KEdhWEqgmw2 9sxEZOAXxleW+aPgUV8QQdytL8zMgHsvfb08rfFOUAx/rYKb0bPomm7KqyXWXcFR1lH1 s7LnN3MiSvMdJwm7AKSGjCiYmuUVNuZ4ES7Pc0Wu4aGkiPqEyyChIfvz40trMbNGBqMT KQ== Received: from mr2-mtap-s02.rno.apple.com (mr2-mtap-s02.rno.apple.com [17.179.226.134]) by ma1-aaemail-dr-lapp02.apple.com with ESMTP id 2xkyjypxd9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Thu, 23 Jan 2020 13:08:51 -0800 Received: from nwk-mmpp-sz13.apple.com (nwk-mmpp-sz13.apple.com [17.128.115.216]) by mr2-mtap-s02.rno.apple.com (Oracle Communications Messaging Server 8.0.2.4.20190507 64bit (built May 7 2019)) with ESMTPS id <0Q4K003VPW2R1A20@mr2-mtap-s02.rno.apple.com>; Thu, 23 Jan 2020 13:08:51 -0800 (PST) Received: from process_milters-daemon.nwk-mmpp-sz13.apple.com by nwk-mmpp-sz13.apple.com (Oracle Communications Messaging Server 8.0.2.4.20190507 64bit (built May 7 2019)) id <0Q4K00A00V872700@nwk-mmpp-sz13.apple.com>; Thu, 23 Jan 2020 13:08:51 -0800 (PST) X-Va-A: X-Va-T-CD: 08777febe38bb384cc57fda39d0586b7 X-Va-E-CD: b99733db443861ef190dfe7952ef77aa X-Va-R-CD: 0a8315ed90353a647fd496f13aaeb94b X-Va-CD: 0 X-Va-ID: 00f516ae-32ea-415b-82a3-b77251b179d9 X-V-A: X-V-T-CD: 08777febe38bb384cc57fda39d0586b7 X-V-E-CD: b99733db443861ef190dfe7952ef77aa X-V-R-CD: 0a8315ed90353a647fd496f13aaeb94b X-V-CD: 0 X-V-ID: 616060cf-af09-4882-a372-ee73e2cd347e X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2020-01-23_12:,, signatures=0 Received: from [17.235.33.53] by nwk-mmpp-sz13.apple.com (Oracle Communications Messaging Server 8.0.2.4.20190507 64bit (built May 7 2019)) with ESMTPSA id <0Q4K003HLW2OLZ50@nwk-mmpp-sz13.apple.com>; Thu, 23 Jan 2020 13:08:50 -0800 (PST) Sender: afish@apple.com MIME-version: 1.0 (Mac OS X Mail 13.0 \(3594.4.17\)) Subject: Re: [edk2-devel] PCD EX interface. From: "Andrew Fish" In-reply-to: Date: Thu, 23 Jan 2020 13:08:48 -0800 Cc: Ken_Taylor@phoenix.com Message-id: <5D2A47A2-6DCE-448B-A5BA-14BE7BBA464B@apple.com> References: <2fb8e97b19214251bf25f44c7b4149a3@SCL-EXCHMB-13.phoenix.com> To: devel@edk2.groups.io, lersek@redhat.com X-Mailer: Apple Mail (2.3594.4.17) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2020-01-23_12:,, signatures=0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: quoted-printable > On Jan 23, 2020, at 3:21 AM, Laszlo Ersek wrote: >=20 > Hi Ken, >=20 > On 01/23/20 02:37, Ken Taylor wrote: >=20 >> If I try to get the size of a DynamicEx PCD in the context of a BIOS >> build for which that PCD is undefined, the call locks up. I expected >> to just get a size of 0, since the PCD is not defined in the build >> context of the PCD DXE service. Is this a problem that's been fixed >> since my BIOS source code was cut? What can I do for older builds >> that haven't been fixed (and probably never will)? Do I have to just >> accept that I'm going to get garbage or lockup if I run my shell >> utility on some builds? Do I have to write a DXE driver and expose a >> protocol, just so I can know if that PCD exists and is properly >> defined? >=20 > I think the ASSERT() that you run into is the one in > GetExPcdTokenNumber(), file "MdeModulePkg/Universal/PCD/Dxe/Service.c": >=20 >> MatchGuid =3D ScanGuid (GuidTable, mDxeGuidTableSize, Guid); >> // >> // We need to ASSERT here. If GUID can't be found in GuidTable, this i= s a >> // error in the BUILD system. >> // >> ASSERT (MatchGuid !=3D NULL); >=20 > Can you try the following: >=20 > - Locate EFI_PCD_PROTOCOL. >=20 > - Call EFI_PCD_PROTOCOL.GetNextTokenSpace() in a loop, until you find > the GUID of your own token space GUID, or the function returns an > error. >=20 > - If your token space GUID has been found, call PcdGetEx8(). >=20 Laszlo, I think it may be better to call PCD_PROTOCOL.GetNextToken() as the GUID a= nd Token spaces are both sparse name spaces. The Get*Ex() functions don't r= eturn errors so I guess this is your only choice. You could probably make a= MyLibGet*Ex() function that returns EFI_STATUS, and returns the data via a= n arg. MyLibGet*Ex() could abstract the PCD_PROTOCOL.GetNextToken() check= , and it could also probably abstract grabbing the protocol.=20 FYI it looks like the function header is much more description for GetNext= Token() in PCD_PROTOCOL [1] vs EFI_PCD_PROTOCOL [2]. Also EFI_PCD_PROTOCOL = does not have the *Ex functions, so you need PCD_PROTOCOL anyway to have ac= cess to the *Ex versions of the API. [1] https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Protocol/= Pcd.h [2] https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Protocol/= PiPcd.h Thanks, Andrew Fish > Thanks, > Laszlo >=20 >=20 >=20 >=20