From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web11.1138.1608166580807718281 for ; Wed, 16 Dec 2020 16:56:22 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Thu, 17 Dec 2020 08:56:16 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , References: <063901d6d408$871f9870$955ec950$@insyde.com> In-Reply-To: <063901d6d408$871f9870$955ec950$@insyde.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gSG93IHRvIGFzc2lnbiBOVUxMIHRvIGEgVk9JRCogUENEPw==?= Date: Thu, 17 Dec 2020 08:56:19 +0800 Message-ID: <001301d6d40f$6e8387c0$4b8a9740$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQLnIzHH4R1osqccLmglrmP91HM52qfZ19Ag Content-Type: multipart/alternative; boundary="----=_NextPart_000_0014_01D6D452.7CA7D930" Content-Language: zh-cn ------=_NextPart_000_0014_01D6D452.7CA7D930 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 =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_0014_01D6D452.7CA7D930 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

Tim:

= =C2=A0Another way is to UINT64 PCD. PCD value is the pointer address. It c= an be NULL. But, the pointer address can always be accessed.

 

Thanks

Liming

=E5=8F=91=E4=BB=B6=E4=BA=BA: b= ounce+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:<= /span> 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@i= ntel.com
=E4=B8=BB=E9=A2=98: Re: [edk2-devel] How to assign NULL to a VOID* PCD?

 

Mike =E2= =80=93

I am t= rying to find a way to have no data assigned to a VOID*. So either having G= etPtr 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 = require pointing to a label in the FixedAtBuild case.

 

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

 

We have found that requiring the P= CD to be terminated just leads to implementation errors where an engineer f= orgets to put the terminator in their PCD array.  Catching this requir= es buffer bounds checking logic in addition to the normal loop logic and st= atic code analysis doesn=E2=80=99t tend to catch this well.  And I jus= t 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 <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; K= inney, Michael D <michael.= d.kinney@intel.com>
Subject: Re: [edk2-devel] How to assig= n NULL to a VOID* PCD?

 

Hi Tim,

 

With the current design the smallest possible VOID* PCD is 1 byte. = PcdGetSize() can be used the determine the size.  Does that work or d= o you need some new fetures?

 

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

=  

Best regards= ,

 <= /o:p>

Mike

 

=

 

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 from UINT8 because it couldn=E2=80=99t hol= d a terminating or illegal value. We prefer to use PcdGetSize. It may be so= mething we will change in our own codebase.

 

Tim

 

From: Kinney, Micha= el D <michael.d.kinney@int= el.com>
Sent: Wednesday, December 16, 2020 1:28 PM
= To: devel@edk2.groups.io; <= a href=3D"mailto:tim.lewis@insyde.com">tim.lewis@insyde.com; Kinney, Mi= chael D <michael.d.kinney@= intel.com>
Subject: RE: [edk2-devel] How to assign NULL to= a VOID* PCD?

 

Hi Tim,

<= o:p> 

Assignin= g NULL to a VOID* PCD is not supported.

 

= 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 use a tag in a field to mark the end of the array.

 

Mike<= /p>

 

From: devel@edk2.groups.io<= /a> <devel@edk2.groups.io>= ; On Behalf Of Tim Lewis
Sent: Wednesday, December 16, 202= 0 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.

 

In .dec files, I can assign an <Express= ion> for the value, which lets me put a 0. But the syntax for .dsc files= only lets me put data. So for array cases where I want 0 entries, I am alw= ays forced to put at least 1 dummy entry. Normally, I would like to use Pcd= GetSize to get the total array size.

 

Any pointers?

 

Thanks,

 

Tim=

------=_NextPart_000_0014_01D6D452.7CA7D930--