public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* How to assign NULL to a VOID* PCD?
@ 2020-12-16 19:05 Tim Lewis
  2020-12-16 21:28 ` [edk2-devel] " Michael D Kinney
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Lewis @ 2020-12-16 19:05 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 470 bytes --]

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 <Expression> 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 always forced to put at least 1 dummy entry.
Normally, I would like to use PcdGetSize to get the total array size.

 

Any pointers?

 

Thanks,

 

Tim


[-- Attachment #2: Type: text/html, Size: 2165 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] How to assign NULL to a VOID* PCD?
  2020-12-16 19:05 How to assign NULL to a VOID* PCD? Tim Lewis
@ 2020-12-16 21:28 ` Michael D Kinney
  2020-12-16 21:30   ` Tim Lewis
  0 siblings, 1 reply; 7+ messages in thread
From: Michael D Kinney @ 2020-12-16 21:28 UTC (permalink / raw)
  To: devel@edk2.groups.io, tim.lewis@insyde.com, Kinney, Michael D

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

Hi Tim,

Assigning 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

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.

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 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 PcdGetSize to get the total array size.

Any pointers?

Thanks,

Tim


[-- Attachment #2: Type: text/html, Size: 40839 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] How to assign NULL to a VOID* PCD?
  2020-12-16 21:28 ` [edk2-devel] " Michael D Kinney
@ 2020-12-16 21:30   ` Tim Lewis
  2020-12-16 23:22     ` Michael D Kinney
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Lewis @ 2020-12-16 21:30 UTC (permalink / raw)
  To: 'Kinney, Michael D', devel

[-- Attachment #1: Type: text/plain, Size: 1686 bytes --]

Mike –

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’t hold a terminating or illegal value. We prefer to use PcdGetSize. 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>
Subject: RE: [edk2-devel] How to assign NULL to a VOID* PCD?

 

Hi Tim,

 

Assigning 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

 

From: devel@edk2.groups.io <mailto:devel@edk2.groups.io>  <devel@edk2.groups.io <mailto:devel@edk2.groups.io> > On Behalf Of Tim Lewis
Sent: Wednesday, December 16, 2020 11:06 AM
To: devel@edk2.groups.io <mailto: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 <Expression> 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 always forced to put at least 1 dummy entry. Normally, I would like to use PcdGetSize to get the total array size.

 

Any pointers?

 

Thanks,

 

Tim




[-- Attachment #2: Type: text/html, Size: 4545 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] How to assign NULL to a VOID* PCD?
  2020-12-16 21:30   ` Tim Lewis
@ 2020-12-16 23:22     ` Michael D Kinney
  2020-12-17  0:06       ` Tim Lewis
  0 siblings, 1 reply; 7+ messages in thread
From: Michael D Kinney @ 2020-12-16 23:22 UTC (permalink / raw)
  To: devel@edk2.groups.io, tim.lewis@insyde.com, Kinney, Michael D

[-- Attachment #1: Type: text/plain, Size: 2354 bytes --]

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 do you need some new fetures?

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.

Best regards,

Mike

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

Mike –
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’t hold a terminating or illegal value. We prefer to use PcdGetSize. It may be something we will change in our own codebase.

Tim

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

Hi Tim,

Assigning 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

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Tim Lewis
Sent: Wednesday, December 16, 2020 11:06 AM
To: devel@edk2.groups.io<mailto: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 <Expression> 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 always forced to put at least 1 dummy entry. Normally, I would like to use PcdGetSize to get the total array size.

Any pointers?

Thanks,

Tim


[-- Attachment #2: Type: text/html, Size: 43769 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] How to assign NULL to a VOID* PCD?
  2020-12-16 23:22     ` Michael D Kinney
@ 2020-12-17  0:06       ` Tim Lewis
  2020-12-17  0:56         ` 回复: " gaoliming
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Lewis @ 2020-12-17  0:06 UTC (permalink / raw)
  To: devel, michael.d.kinney

[-- Attachment #1: Type: text/plain, Size: 3806 bytes --]

Mike –

I am trying to find a way to have no data assigned to a VOID*. So either having GetPtr 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’t think the PI spec prohibits this (in the API), and I don’t see any requirement for distinct pointer values there. But there is no way to enable it today.

 

We have found that requiring the PCD to be terminated just leads to implementation errors where an engineer forgets to put the terminator in their PCD array.  Catching this requires buffer bounds checking logic in addition to the normal loop logic and static code analysis doesn’t tend to catch this well.  And I just don’t 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; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: 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.  PcdGetSize() can be used the determine the size.  Does that work or do you need some new fetures?

 

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.

 

Best regards,

 

Mike

 

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

 

Mike –

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’t hold a terminating or illegal value. We prefer to use PcdGetSize. It may be something we will change in our own codebase.

 

Tim

 

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

 

Hi Tim,

 

Assigning 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

 

From: devel@edk2.groups.io <mailto:devel@edk2.groups.io>  <devel@edk2.groups.io <mailto:devel@edk2.groups.io> > On Behalf Of Tim Lewis
Sent: Wednesday, December 16, 2020 11:06 AM
To: devel@edk2.groups.io <mailto: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 <Expression> 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 always forced to put at least 1 dummy entry. Normally, I would like to use PcdGetSize to get the total array size.

 

Any pointers?

 

Thanks,

 

Tim




[-- Attachment #2: Type: text/html, Size: 7941 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* 回复: [edk2-devel] How to assign NULL to a VOID* PCD?
  2020-12-17  0:06       ` Tim Lewis
@ 2020-12-17  0:56         ` gaoliming
  2020-12-17  1:03           ` Tim Lewis
  0 siblings, 1 reply; 7+ messages in thread
From: gaoliming @ 2020-12-17  0:56 UTC (permalink / raw)
  To: devel, tim.lewis, michael.d.kinney

[-- Attachment #1: Type: text/plain, Size: 4422 bytes --]

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. 

 

Thanks

Liming

发件人: bounce+27952+69064+4905953+8761045@groups.io <bounce+27952+69064+4905953+8761045@groups.io> 代表 Tim Lewis
发送时间: 2020年12月17日 8:07
收件人: devel@edk2.groups.io; michael.d.kinney@intel.com
主题: Re: [edk2-devel] How to assign NULL to a VOID* PCD?

 

Mike –

I am trying to find a way to have no data assigned to a VOID*. So either having GetPtr 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’t think the PI spec prohibits this (in the API), and I don’t see any requirement for distinct pointer values there. But there is no way to enable it today.

 

We have found that requiring the PCD to be terminated just leads to implementation errors where an engineer forgets to put the terminator in their PCD array.  Catching this requires buffer bounds checking logic in addition to the normal loop logic and static code analysis doesn’t tend to catch this well.  And I just don’t like wasting bytes, especially in PEI.

 

I can put this in as a BZ request.

 

Thanks,

 

Tim

 

From: devel@edk2.groups.io <mailto:devel@edk2.groups.io>  <devel@edk2.groups.io <mailto:devel@edk2.groups.io> > On Behalf Of Michael D Kinney
Sent: Wednesday, December 16, 2020 3:22 PM
To: devel@edk2.groups.io <mailto:devel@edk2.groups.io> ; tim.lewis@insyde.com <mailto:tim.lewis@insyde.com> ; Kinney, Michael D <michael.d.kinney@intel.com <mailto:michael.d.kinney@intel.com> >
Subject: 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.  PcdGetSize() can be used the determine the size.  Does that work or do you need some new fetures?

 

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.

 

Best regards,

 

Mike

 

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

 

Mike –

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’t hold a terminating or illegal value. We prefer to use PcdGetSize. It may be something we will change in our own codebase.

 

Tim

 

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

 

Hi Tim,

 

Assigning 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

 

From: devel@edk2.groups.io <mailto:devel@edk2.groups.io>  <devel@edk2.groups.io <mailto:devel@edk2.groups.io> > On Behalf Of Tim Lewis
Sent: Wednesday, December 16, 2020 11:06 AM
To: devel@edk2.groups.io <mailto: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 <Expression> 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 always forced to put at least 1 dummy entry. Normally, I would like to use PcdGetSize to get the total array size.

 

Any pointers?

 

Thanks,

 

Tim




[-- Attachment #2: Type: text/html, Size: 11534 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] How to assign NULL to a VOID* PCD?
  2020-12-17  0:56         ` 回复: " gaoliming
@ 2020-12-17  1:03           ` Tim Lewis
  0 siblings, 0 replies; 7+ messages in thread
From: Tim Lewis @ 2020-12-17  1:03 UTC (permalink / raw)
  To: 'gaoliming', devel, michael.d.kinney

[-- Attachment #1: Type: text/plain, Size: 5195 bytes --]

Liming –

 

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. 

 

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

 

Thanks,

 

Tim

 

 

 

 

From: gaoliming <gaoliming@byosoft.com.cn> 
Sent: Wednesday, December 16, 2020 4:56 PM
To: devel@edk2.groups.io; tim.lewis@insyde.com; michael.d.kinney@intel.com
Subject: 回复: [edk2-devel] How to assign NULL to a VOID* PCD?

 

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. 

 

Thanks

Liming

发件人: bounce+27952+69064+4905953+8761045@groups.io <mailto:bounce+27952+69064+4905953+8761045@groups.io>  <bounce+27952+69064+4905953+8761045@groups.io <mailto:bounce+27952+69064+4905953+8761045@groups.io> > 代表 Tim Lewis
发送时间: 2020年12月17日 8:07
收件人: devel@edk2.groups.io <mailto:devel@edk2.groups.io> ; michael.d.kinney@intel.com <mailto:michael.d.kinney@intel.com> 
主题: Re: [edk2-devel] How to assign NULL to a VOID* PCD?

 

Mike –

I am trying to find a way to have no data assigned to a VOID*. So either having GetPtr 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’t think the PI spec prohibits this (in the API), and I don’t see any requirement for distinct pointer values there. But there is no way to enable it today.

 

We have found that requiring the PCD to be terminated just leads to implementation errors where an engineer forgets to put the terminator in their PCD array.  Catching this requires buffer bounds checking logic in addition to the normal loop logic and static code analysis doesn’t tend to catch this well.  And I just don’t like wasting bytes, especially in PEI.

 

I can put this in as a BZ request.

 

Thanks,

 

Tim

 

From: devel@edk2.groups.io <mailto:devel@edk2.groups.io>  <devel@edk2.groups.io <mailto:devel@edk2.groups.io> > On Behalf Of Michael D Kinney
Sent: Wednesday, December 16, 2020 3:22 PM
To: devel@edk2.groups.io <mailto:devel@edk2.groups.io> ; tim.lewis@insyde.com <mailto:tim.lewis@insyde.com> ; Kinney, Michael D <michael.d.kinney@intel.com <mailto:michael.d.kinney@intel.com> >
Subject: 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.  PcdGetSize() can be used the determine the size.  Does that work or do you need some new fetures?

 

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.

 

Best regards,

 

Mike

 

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

 

Mike –

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’t hold a terminating or illegal value. We prefer to use PcdGetSize. It may be something we will change in our own codebase.

 

Tim

 

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

 

Hi Tim,

 

Assigning 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

 

From: devel@edk2.groups.io <mailto:devel@edk2.groups.io>  <devel@edk2.groups.io <mailto:devel@edk2.groups.io> > On Behalf Of Tim Lewis
Sent: Wednesday, December 16, 2020 11:06 AM
To: devel@edk2.groups.io <mailto: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 <Expression> 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 always forced to put at least 1 dummy entry. Normally, I would like to use PcdGetSize to get the total array size.

 

Any pointers?

 

Thanks,

 

Tim




[-- Attachment #2: Type: text/html, Size: 14546 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-17  1:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-16 19:05 How to assign NULL to a VOID* PCD? Tim Lewis
2020-12-16 21:28 ` [edk2-devel] " Michael D Kinney
2020-12-16 21:30   ` Tim Lewis
2020-12-16 23:22     ` Michael D Kinney
2020-12-17  0:06       ` Tim Lewis
2020-12-17  0:56         ` 回复: " gaoliming
2020-12-17  1:03           ` Tim Lewis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox