From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out04.hibox.biz (out04.hibox.biz [210.71.195.41]) by mx.groups.io with SMTP id smtpd.web12.1229.1608166992638270840 for ; Wed, 16 Dec 2020 17:03:13 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: insyde.com, ip: 210.71.195.41, mailfrom: tim.lewis@insyde.com) IronPort-SDR: V38a18V3r/+Si+NVoVwCa74nammWiSvO2fLQ5/j2fKwW51y/PmUcdlK8dyMwGEVvVXdO0dIxKc 8YAueIdvtaFA== X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2AlBQByq9pf/ww0GKxigRCCa4F8V2G?= =?us-ascii?q?EP4kEiCMDg0WLRkoUjEsLAQEBAQEBAQEBCSMJAQIEAQGERAQCAoFxJjgTAgM?= =?us-ascii?q?BAQsBAQYBAQEBAQYEhlIMhXIBAQIDCAIZCiEIMAUGAQINBAQBAQ4TBwMCGxg?= =?us-ascii?q?VCQgCBAESCwUNBIMGgX6BCA+RXJsSdoEyGgKEIgGBGIURgTiBZYR9DYY2gkG?= =?us-ascii?q?BEYJrLj6EOw8CKIJhgl8EgT8WaAYpSRoJHAZFSQkaMwIYAQIBXg+PY4J4iUa?= =?us-ascii?q?aOIEPB4wakigihFSOOgOPLJIXgW6LDZE8LAyET4FtZ4ETcFCCaQk2ERmEXYl?= =?us-ascii?q?aAxeGMogVIzACNQIGAQkBAQMJdAgVAYkoAQE?= X-IronPort-AV: E=Sophos;i="5.78,425,1599494400"; d="scan'208,217";a="38980504" Received: from unknown (HELO hb3-BKT202.hibox.biz) ([172.24.52.12]) by out04.hibox.biz with ESMTP; 17 Dec 2020 09:03:09 +0800 IronPort-SDR: e2CxQj0bXVZupTD6yV4JsrZgxvCMfmjij4zzNba3EbQQxhQHTHKDfr/3vyjW057X+NAZRHBYpw H21Vn7501Udg== Received: from unknown (HELO hb3-BKT101.hibox.biz) ([172.24.51.11]) by hb3-BKT202.hibox.biz with ESMTP; 17 Dec 2020 09:03:09 +0800 IronPort-SDR: 3Y+3yFUBpTu+DTALr+jKKl53NotGJ6mx8feSDTaD5ZOp+gL9lQ7CIlVOr3WOupFmuXFSE841PW DI4wYXiM2Bgg== Received: from unknown (HELO hb3-IN04.hibox.biz) ([172.24.12.14]) by hb3-BKT101.hibox.biz with ESMTP; 17 Dec 2020 09:03:10 +0800 IronPort-SDR: eqnhLa13l0LXRyK+gKNHmSDsBqkLEcFa+Q4UWd/Uy2fjDEXp8e+8IbURn2AElNpNkba0vnAiz+ Jq8O+Gshj6ssQX+hR5obNzhIY5S02dNFQ= 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: 51003097 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-IN04.hibox.biz with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2020 09:03:09 +0800 From: "Tim Lewis" To: "'gaoliming'" , , In-Reply-To: <001301d6d40f$6e8387c0$4b8a9740$@byosoft.com.cn> Subject: Re: [edk2-devel] How to assign NULL to a VOID* PCD? Date: Wed, 16 Dec 2020 17:03:06 -0800 Message-ID: <06f101d6d410$62e88860$28b99920$@insyde.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFO6pbAO2ttMoN7WnX9rngWFveQoqsKSkhQ Content-Type: multipart/alternative; boundary="----=_NextPart_000_06F2_01D6D3CD.54C74430" Content-Language: en-us ------=_NextPart_000_06F2_01D6D3CD.54C74430 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Liming =E2=80=93 =20 The goal is to have no data for the PCD with type VOID*. Currently, there = is no way to define a PCD that has no data.=20 =20 So, though a UINT64 would give a pointer, it would still require that my V= OID* PCD (which contains my array) have data in it and be checked for the e= mpty case. =20 Thanks, =20 Tim =20 =20 =20 =20 From: gaoliming =20 Sent: Wednesday, December 16, 2020 4:56 PM To: devel@edk2.groups.io; tim.lewis@insyde.com; michael.d.kinney@intel.com Subject: =E5=9B=9E=E5=A4=8D: [edk2-devel] How to assign NULL to a VOID* PC= D? =20 Tim: Another way is to UINT64 PCD. PCD value is the pointer address. It can be= NULL. But, the pointer address can always be accessed.=20 =20 Thanks Liming =E5=8F=91=E4=BB=B6=E4=BA=BA: bounce+27952+69064+4905953+8761045@groups.io = > =E4=BB=A3=E8=A1=A8 Tim Lewis =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2020=E5=B9=B412=E6=9C=8817=E6=97=A5 = 8:07 =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io ; michael.d.kinney@intel.com =20 =E4=B8=BB=E9=A2=98: Re: [edk2-devel] How to assign NULL to a VOID* PCD? =20 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 Kinney 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_06F2_01D6D3CD.54C74430 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

Liming =E2=80=93

 

The goal is to have no data for = the PCD with type VOID*. Currently, there is no way to define a PCD that ha= s no data.

 

So, though a UINT64 would give a pointer, it would still requ= ire that my VOID* PCD (which contains my array) have data in it and be chec= ked for the empty case.

 

Thanks,

&= nbsp;

Tim

=  

 

 

 

From: gaoliming <gaoliming@byosof= t.com.cn>
Sent: Wednesday, December 16, 2020 4:56 PM
To= : devel@edk2.groups.io; tim.lewis@insyde.com; michael.d.kinney@intel.co= m
Subject: =E5=9B= =9E=E5=A4=8D: [edk2-devel] How to assign NULL to a VOID* PCD?<= /o:p>

 

Tim:

&nbs= p;Another way is to UINT64 PCD. PCD value is the pointer address. It can be= NULL. But, the pointer address can always be accessed. <= /p>

 

Thanks

Liming

=E5=8F=91=E4=BB= =B6=E4=BA=BA: bounce+27952+69064+4905953+8761045@groups.io <bounce+27952+69064+4905953= +8761045@groups.io> =E4=BB=A3=E8=A1=A8 = Tim Lewis
=E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4= : 2020=E5=B9=B412= =E6=9C=8817=E6=97=A5 8:07
=E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io; michael.d.kinney@intel.com
=E4=B8= =BB=E9=A2=98: Re: [edk2-devel] How to assign NULL to a VOID* PC= D?

 

<= span style=3D'mso-fareast-language:ZH-CN'>Mike =E2=80=93<= /p>

I am try= ing to find a way to have no data assigned to a VOID*. So either having Get= Ptr returning NULL or returning a pointer to 0 bytes would work (as long as= GetSize() returned 0). Either would work for us.  The latter might re= quire pointing to a label in the FixedAtBuild case.

<= p class=3DMsoNormal> <= /o:p>

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

=  

We have found t= hat requiring the PCD to be terminated just leads to implementation errors = where an engineer forgets to put the terminator in their PCD array.  C= atching this requires buffer bounds checking logic in addition to the norma= l loop logic and static code analysis doesn=E2=80=99t tend to catch this we= ll.  And I just don=E2=80=99t like wasting bytes, especially in PEI.

 

I can put this in as a BZ request.

 

Thanks,

 

Tim

=

 =

From: devel@edk2.groups.io &l= t;devel@edk2.groups.io> O= n Behalf Of Michael D Kinney
Sent: Wednesday, December 16, 20= 20 3:22 PM
To: devel@edk2= .groups.io; tim.lewis@insyde.co= m; Kinney, Michael D <= michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] How = to assign NULL to a VOID* PCD?

 

Hi Ti= m,

 

With the current design the smallest possi= ble VOID* PCD is 1 byte.  PcdGetSize() can be used the determine the s= ize.  Does that work or do you need some new fetures?

&= nbsp;

You are welcome to enter some feature requests for this and we c= an see if this can be supported by the build tools in a backwards compatibl= e manner.

 

Best regards,

 

Mike

 

From: devel@edk2.groups.io <deve= l@edk2.groups.io> On Behalf Of Tim Lewis
Sent: Wedn= esday, December 16, 2020 1:30 PM
To: Kinney, Michael D <michael.d.kinney@intel.com>;= devel@edk2.groups.io
Sub= ject: Re: [edk2-devel] How to assign NULL to a VOID* PCD?

 

Mike =E2=80=93

I understand, but this j= ust adds another layer of complexity. For example, we had a list of excepti= on numbers (0x00-0xff) and then had to move away from UINT8 because it coul= dn=E2=80=99t hold a terminating or illegal value. We prefer to use PcdGetSi= ze. It may be something we will change in our own codebase.

=  

Tim

 

From: Kinney, Michael D <michael.d.kinney@intel.com> =
Sent: Wednesday, December 16, 2020 1:28 PM
To: devel@edk2.groups.io; tim.lewis@insyde.com; Kinney, Michael D <michael.d.kinney@intel.com&= gt;
Subject: RE: [edk2-devel] How to assign NULL to a VOID* PCD?<= o:p>

 

Hi Tim,

 <= /span>

A= ssigning NULL to a VOID* PCD is not supported.

 <= /span>

I= recommend you design the structure that the VOID* type PCD points to be se= lf describing.  You can put a count field or if it is an array, use ca= n use a tag in a field to mark the end of the array.

<= p class=3DMsoNormal> <= /o:p>

Mike

 

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

 <= /span>

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.

<= p class=3DMsoNormal> <= /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 only lets me put data. So f= or array cases where I want 0 entries, I am always forced to put at least 1= dummy entry. Normally, I would like to use PcdGetSize to get the total arr= ay size.

 

Any pointers?

 

Thanks,

 

Tim

------=_NextPart_000_06F2_01D6D3CD.54C74430--