<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:等线;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"\@等线";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:等线;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=ZH-CN link="#0563C1" vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:等线'>Tim:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:等线'>  Another way is to UINT64 PCD. PCD value is the pointer address. It can be NULL. But, the pointer address can always be accessed. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:等线'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:等线'>Thanks<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:等线'>Liming<o:p></o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-family:等线'>发件人<span lang=EN-US>:</span></span></b><span lang=EN-US style='font-family:等线'> bounce+27952+69064+4905953+8761045@groups.io <bounce+27952+69064+4905953+8761045@groups.io> </span><b><span style='font-family:等线'>代表 </span></b><span lang=EN-US style='font-family:等线'>Tim Lewis<br></span><b><span style='font-family:等线'>发送时间<span lang=EN-US>:</span></span></b><span lang=EN-US style='font-family:等线'> 2020</span><span style='font-family:等线'>年<span lang=EN-US>12</span>月<span lang=EN-US>17</span>日<span lang=EN-US> 8:07<br></span><b>收件人<span lang=EN-US>:</span></b><span lang=EN-US> devel@edk2.groups.io; michael.d.kinney@intel.com<br></span><b>主题<span lang=EN-US>:</span></b><span lang=EN-US> Re: [edk2-devel] How to assign NULL to a VOID* PCD?<o:p></o:p></span></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Mike –<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I can put this in as a BZ request.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Tim<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> <a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a> <<a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a>> <b>On Behalf Of </b>Michael D Kinney<br><b>Sent:</b> Wednesday, December 16, 2020 3:22 PM<br><b>To:</b> <a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a>; <a href="mailto:tim.lewis@insyde.com">tim.lewis@insyde.com</a>; Kinney, Michael D <<a href="mailto:michael.d.kinney@intel.com">michael.d.kinney@intel.com</a>><br><b>Subject:</b> Re: [edk2-devel] How to assign NULL to a VOID* PCD?<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Hi Tim,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Best regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Mike<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> <a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a> <<a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a>> <b>On Behalf Of </b>Tim Lewis<br><b>Sent:</b> Wednesday, December 16, 2020 1:30 PM<br><b>To:</b> Kinney, Michael D <<a href="mailto:michael.d.kinney@intel.com">michael.d.kinney@intel.com</a>>; <a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a><br><b>Subject:</b> Re: [edk2-devel] How to assign NULL to a VOID* PCD?<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Mike –<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Tim<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> Kinney, Michael D <<a href="mailto:michael.d.kinney@intel.com">michael.d.kinney@intel.com</a>> <br><b>Sent:</b> Wednesday, December 16, 2020 1:28 PM<br><b>To:</b> <a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a>; <a href="mailto:tim.lewis@insyde.com">tim.lewis@insyde.com</a>; Kinney, Michael D <<a href="mailto:michael.d.kinney@intel.com">michael.d.kinney@intel.com</a>><br><b>Subject:</b> RE: [edk2-devel] How to assign NULL to a VOID* PCD?<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Hi Tim,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Assigning NULL to a VOID* PCD is not supported.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Mike<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> <a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a> <<a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a>> <b>On Behalf Of </b>Tim Lewis<br><b>Sent:</b> Wednesday, December 16, 2020 11:06 AM<br><b>To:</b> <a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a><br><b>Subject:</b> [edk2-devel] How to assign NULL to a VOID* PCD?<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Any pointers?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Tim<o:p></o:p></span></p><div><p class=MsoNormal></o:p></span></p></div></div></body></html>


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr> Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/69072">View/Reply Online (#69072)</a> |    |  <a target="_blank" href="https://groups.io/mt/79026975/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>