From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out03.hibox.biz (out03.hibox.biz [210.71.195.44]) by mx.groups.io with SMTP id smtpd.web08.514.1608163618922120999 for ; Wed, 16 Dec 2020 16:06:59 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: insyde.com, ip: 210.71.195.44, mailfrom: tim.lewis@insyde.com) IronPort-SDR: 8u9qM/ACKemZgUDOwr7mololDslVAdOXNclroIGG2+FNVljOsTDsUnfyTp2l4aSgVkjO1GvZJC y3HnTpxmbl9Q== X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2AjBQCdn9pf/ww0GKxigRCCa4F8V2G?= =?us-ascii?q?EP4kEiCQDjwtKFIQwiBsLAQEBAQEBAQEBCSMJAQIEAQGERAQCAoFxJjgTAgM?= =?us-ascii?q?BAQsBAQYBAQEBAQYEhlIMhXIBAQIDCAIZCiEIMAUGAw0EBAEBDhoDAhsYFQk?= =?us-ascii?q?IAgQBEgsFDQSDBoF+gQgPrGF2gTIaAoQiAYEYhRCBOIFlhH0NhjaCQYERgms?= =?us-ascii?q?uPoQ7DwIogmGCXwSCPQYpSRoJHAZFSQkaMwIYAQIBXg+PY4J4iUaaOIEPB4w?= =?us-ascii?q?akigihFSOOgOPLJIXgW6LDZE8LAyET4FtZ4ETcFCCaQk2ERmEXYlaAxeGMog?= =?us-ascii?q?VIzACNQIGAQkBAQMJdAgVAYkoAQE?= X-IronPort-AV: E=Sophos;i="5.78,425,1599494400"; d="scan'208,217";a="43749640" Received: from unknown (HELO hb3-BKT202.hibox.biz) ([172.24.52.12]) by out03.hibox.biz with ESMTP; 17 Dec 2020 08:06:56 +0800 IronPort-SDR: Q79xkHfUAaKR0Q9klSsB4AdRjjeuehRj12VH7hFhMv6zgQ3JnBj5tLP3g5isbJPcGVbsm0BFLc DA9F1loWFMnw== Received: from unknown (HELO hb3-BKT101.hibox.biz) ([172.24.51.11]) by hb3-BKT202.hibox.biz with ESMTP; 17 Dec 2020 08:06:58 +0800 IronPort-SDR: mlp7hCRSk7RAlKwa8qDYZNHLCp+5Si0XGJN6TnfSEbJRov5PlJNzzkPxAKxsLIujsvpXQcWMGN mcrTVUcy/gjg== Received: from unknown (HELO hb3-IN05.hibox.biz) ([172.24.12.15]) by hb3-BKT101.hibox.biz with ESMTP; 17 Dec 2020 08:06:56 +0800 IronPort-SDR: eA1zW2mfghXsHwT3ZvBuimKhHgVvNoFT/VrK1w/vFhFsRWJi/hwiziJeh3OSdOcrVFZE8Nlrfl osQ2dexTFvnw== X-Remote-IP: 73.116.1.175 X-Remote-Host: c-73-116-1-175.hsd1.ca.comcast.net X-SBRS: -10.0 X-MID: 52557402 X-Auth-ID: tim.lewis@insyde.com X-EnvelopeFrom: tim.lewis@insyde.com hiBox-Sender: 1 Received: from c-73-116-1-175.hsd1.ca.comcast.net (HELO DESKTOPHG9V3E8) ([73.116.1.175]) by hb3-IN05.hibox.biz with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2020 08:06:53 +0800 From: "Tim Lewis" To: , In-Reply-To: Subject: Re: [edk2-devel] How to assign NULL to a VOID* PCD? Date: Wed, 16 Dec 2020 16:06:51 -0800 Message-ID: <063901d6d408$871f9870$955ec950$@insyde.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQKMDOO8w+QH5ZjP4sHmk1JZIq8UjKiP9Anw Content-Type: multipart/alternative; boundary="----=_NextPart_000_063A_01D6D3C5.78FD90F0" Content-Language: en-us ------=_NextPart_000_063A_01D6D3C5.78FD90F0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Mike =E2=80=93 I am trying to find a way to have no data assigned to a VOID*. So either h= aving GetPtr returning NULL or returning a pointer to 0 bytes would work (a= s long as GetSize() returned 0). Either would work for us. The latter migh= t require pointing to a label in the FixedAtBuild case.=20 =20 I don=E2=80=99t think the PI spec prohibits this (in the API), and I don= =E2=80=99t see any requirement for distinct pointer values there. But ther= e is no way to enable it today. =20 We have found that requiring the PCD to be terminated just leads to implem= entation errors where an engineer forgets to put the terminator in their PC= D array. Catching this requires buffer bounds checking logic in addition t= o the normal loop logic and static code analysis doesn=E2=80=99t tend to ca= tch this well. And I just don=E2=80=99t like wasting bytes, especially in = PEI. =20 I can put this in as a BZ request. =20 Thanks, =20 Tim =20 From: devel@edk2.groups.io On Behalf Of Michael D K= inney Sent: Wednesday, December 16, 2020 3:22 PM To: devel@edk2.groups.io; tim.lewis@insyde.com; Kinney, Michael D Subject: Re: [edk2-devel] How to assign NULL to a VOID* PCD? =20 Hi Tim, =20 With the current design the smallest possible VOID* PCD is 1 byte. PcdGet= Size() can be used the determine the size. Does that work or do you need s= ome new fetures? =20 You are welcome to enter some feature requests for this and we can see if = this can be supported by the build tools in a backwards compatible manner. =20 Best regards, =20 Mike =20 From: devel@edk2.groups.io > On Behalf Of Tim Lewis Sent: Wednesday, December 16, 2020 1:30 PM To: Kinney, Michael D >; devel@edk2.groups.io =20 Subject: Re: [edk2-devel] How to assign NULL to a VOID* PCD? =20 Mike =E2=80=93 I understand, but this just adds another layer of complexity. For example,= we had a list of exception numbers (0x00-0xff) and then had to move away f= rom UINT8 because it couldn=E2=80=99t hold a terminating or illegal value. = We prefer to use PcdGetSize. It may be something we will change in our own = codebase. =20 Tim =20 From: Kinney, Michael D >=20 Sent: Wednesday, December 16, 2020 1:28 PM To: devel@edk2.groups.io ; tim.lewis@insyde.= com ; Kinney, Michael D > Subject: RE: [edk2-devel] How to assign NULL to a VOID* PCD? =20 Hi Tim, =20 Assigning NULL to a VOID* PCD is not supported. =20 I recommend you design the structure that the VOID* type PCD points to be = self describing. You can put a count field or if it is an array, use can u= se a tag in a field to mark the end of the array. =20 Mike =20 From: devel@edk2.groups.io > On Behalf Of Tim Lewis Sent: Wednesday, December 16, 2020 11:06 AM To: devel@edk2.groups.io =20 Subject: [edk2-devel] How to assign NULL to a VOID* PCD? =20 I want the PCD database to contain a NULL to a PCD that is of type VOID* b= ut this does not seem to be allowed in the .dsc files. =20 In .dec files, I can assign an for the value, which lets me p= ut a 0. But the syntax for .dsc files only lets me put data. So for array c= ases where I want 0 entries, I am always forced to put at least 1 dummy ent= ry. Normally, I would like to use PcdGetSize to get the total array size. =20 Any pointers? =20 Thanks, =20 Tim ------=_NextPart_000_063A_01D6D3C5.78FD90F0 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

Mike =E2=80=93

I= am trying to find a way to have no data assigned to a VOID*. So either hav= ing GetPtr returning NULL or returning a pointer to 0 bytes would work (as = long as GetSize() returned 0). Either would work for us. =C2=A0The latter m= ight require pointing to a label in the FixedAtBuild case.

<= p class=3DMsoNormal> 

I don=E2=80= =99t think the PI spec prohibits this (in the API), and I don=E2=80=99t se= e any requirement for distinct pointer values there. But there is no way to= enable it today.

 

<= p class=3DMsoNormal>We have found that requiring the PCD to be terminated j= ust leads to implementation errors where an engineer forgets to put the ter= minator in their PCD array. =C2=A0Catching this requires buffer bounds chec= king logic in addition to the normal loop logic and static code analysis do= esn=E2=80=99t tend to catch this well. =C2=A0And I just don=E2=80=99t like = wasting bytes, especially in PEI.

&= nbsp;

I can put this in as a BZ request.=

 

Th= anks,

 

Tim

 

From: devel@edk2.groups.io <devel@edk= 2.groups.io> On Behalf Of Michael D Kinney
Sent: Wednes= day, December 16, 2020 3:22 PM
To: devel@edk2.groups.io; tim.lewi= s@insyde.com; Kinney, Michael D <michael.d.kinney@intel.com>
Su= bject: Re: [edk2-devel] How to assign NULL to a VOID* PCD?

 

Hi Tim,

 

With the current design the smallest possible VOID* PCD is 1 = byte.=C2=A0 PcdGetSize() can be used the determine the size.=C2=A0 Does tha= t work or do you need some new fetures?

=  

You are welcome to enter some fea= ture requests for this and we can see if this can be supported by the build= tools in a backwards compatible manner.

 

Best regards,

 

Mike<= /p>

 

 

Mike =E2=80=93

I understand, but this just adds another la= yer of complexity. For example, we had a list of exception numbers (0x00-0x= ff) and then had to move away from UINT8 because it couldn=E2=80=99t hold a= terminating or illegal value. We prefer to use PcdGetSize. It may be somet= hing we will change in our own codebase.

 

Tim

 

From:= Kinney, Michael D <michae= l.d.kinney@intel.com>
Sent: Wednesday, December 16, 2020 = 1:28 PM
To: devel@edk2.gr= oups.io; tim.lewis@insyde.com; Kinney, Michael D <mic= hael.d.kinney@intel.com>
Subject: RE: [edk2-devel] How to = assign NULL to a VOID* PCD?

=  

Hi Tim,

 

Assigning NULL to a VOI= D* PCD is not supported.

 

I recommend you design the structure that the VO= ID* type PCD points to be self describing.  You can put a count field = or if it is an array, use can use a tag in a field to mark the end of the a= rray.

 

Mike

 

<= div style=3D'border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0= in 0in'>

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Tim Lewis
Sent:= Wednesday, December 16, 2020 11:06 AM
To: devel@edk2.groups.io
Subject: [edk2-devel] = How to assign NULL to a VOID* PCD?

 

I want the PCD database to= contain a NULL to a PCD that is of type VOID* but this does not seem to be= allowed in the .dsc files.

 <= /o:p>

In .dec files, I can assign an <Expression= > for the value, which lets me put a 0. But the syntax for .dsc files on= ly lets me put data. So for array cases where I want 0 entries, I am always= forced to put at least 1 dummy entry. Normally, I would like to use PcdGet= Size to get the total array size.

&= nbsp;

Any pointers?

 

Thanks,

<= p class=3DMsoNormal> 

Tim

------=_NextPart_000_063A_01D6D3C5.78FD90F0--