On 10/07/15 23:11, Kinney, Michael D wrote:
> Laszlo,
> 
> Good question.  
> 
> It is a good practice to have the .h file for each GUID.  The .h file 
> contains the extern for the global variable associated with the GUID along 
> with data structures associated with the GUID.
> 
> For PCD token space GUIDs, there is no data structure and the AutoGen.h file 
> contains an extern to all token space GUIDs a module references, so the .h 
> file for the token space GUID is not required.
> 
> The C name for a Token space GUID (i.e. gUefiCpuPkgTokenSpaceGuid) would be 
> required in C code if the PcdLib PcdGetEx8 (),PcdGetEx16 (),PcdGetEx32 
> (),PcdGetEx64 (),PcdGetExBool (),or PcdGetExPtr () APIs are used.  Most 
> modules/libs do not use the 'Ex' versions of these, so it is very rare for a 
> module to use the C name for a Token space GUID.
> 
> I will remove the UefiCpuPkg/Include/Guid/UefiCpuPkgTokenSpace.h from the 
> patch set.

Thank you for explaining me the PcdGetEx__() family of functions at the
same time :) I've been wondering about both them, and how one could
resolve token name collisions between different token spaces.
Apparently, with the Ex family (but it remains unnecessary in practice).

Thank you!
Laszlo

> 
> Thanks,
> 
> Mike
> 
> -----Original Message-----
> From: Laszlo Ersek [mailto:ler...@redhat.com] 
> Sent: Wednesday, October 07, 2015 10:38 AM
> To: Kinney, Michael D; edk2-de...@ml01.01.org
> Subject: Re: [edk2] [PATCH 7/7] UefiCpuPkg: Add missing UefiCpuPkgTokenSpace 
> include
> 
> On 10/05/15 01:57, Michael Kinney wrote:
>> Add missing include files for the token space GUID for the UefiCpuPkg
>> Add path to the token space include file to the UefiCpuPkg DEC file.
> 
> Is this usual? For example, gUefiOvmfPkgTokenSpaceGuid is also not
> defined anywhere else than in the DEC file.
> 
> What could a programmer use UEFICPUPKG_TOKEN_SPACE_GUID /
> gUefiCpuPkgTokenSpaceGuid for, in C source code?
> 
> ... Only the following packages / header files seem to expose their
> respective token space GUIDs in a similar way:
> 
> MdeModulePkg/Include/Guid/MdeModulePkgTokenSpace.h
> MdePkg/Include/Guid/MdePkgTokenSpace.h
> PcAtChipsetPkg/Include/Guid/PcAtChipsetTokenSpace.h
> PerformancePkg/Include/Guid/PerformancePkgTokenSpace.h
> SecurityPkg/Include/Guid/SecurityPkgTokenSpace.h
> ShellPkg/Include/Guid/ShellPkgTokenSpace.h
> Vlv2DeviceRefCodePkg/Include/Guid/Vlv2DeviceRefCodePkgTokenSpace.h
> 
> Thanks!
> Laszlo
> 
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Michael Kinney <michael.d.kin...@intel.com>
>> ---
>>  UefiCpuPkg/Include/Guid/UefiCpuPkgTokenSpace.h | 25 
>> +++++++++++++++++++++++++
>>  UefiCpuPkg/UefiCpuPkg.dec                      |  1 +
>>  2 files changed, 26 insertions(+)
>>  create mode 100644 UefiCpuPkg/Include/Guid/UefiCpuPkgTokenSpace.h
>>
>> diff --git a/UefiCpuPkg/Include/Guid/UefiCpuPkgTokenSpace.h 
>> b/UefiCpuPkg/Include/Guid/UefiCpuPkgTokenSpace.h
>> new file mode 100644
>> index 0000000..6c4e671
>> --- /dev/null
>> +++ b/UefiCpuPkg/Include/Guid/UefiCpuPkgTokenSpace.h
>> @@ -0,0 +1,25 @@
>> +/** @file
>> +GUID for UefiCpuPkg PCD Token Space
>> +
>> +Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
>> +This program and the accompanying materials
>> +are licensed and made available under the terms and conditions of the BSD 
>> License
>> +which accompanies this distribution.  The full text of the license may be 
>> found at
>> +http://opensource.org/licenses/bsd-license.php
>> +
>> +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
>> +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
>> IMPLIED.
>> +
>> +**/
>> +
>> +#ifndef _UEFICPUPKG_TOKEN_SPACE_GUID_H_
>> +#define _UEFICPUPKG_TOKEN_SPACE_GUID_H_
>> +
>> +#define UEFICPUPKG_TOKEN_SPACE_GUID \
>> +  { \
>> +    0xac05bf33, 0x995a, 0x4ed4, { 0xaa, 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 
>> 0xb0 } \
>> +  }
>> +
>> +extern EFI_GUID gUefiCpuPkgTokenSpaceGuid;
>> +
>> +#endif
>> diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
>> index e4b8030..e293390 100644
>> --- a/UefiCpuPkg/UefiCpuPkg.dec
>> +++ b/UefiCpuPkg/UefiCpuPkg.dec
>> @@ -51,6 +51,7 @@
>>    SmmCpuFeaturesLib|Include/Library/SmmCpuFeaturesLib.h
>>  
>>  [Guids]
>> +  ## Include/Guid/UefiCpuPkgTokenSpace.h
>>    gUefiCpuPkgTokenSpaceGuid      = { 0xac05bf33, 0x995a, 0x4ed4, { 0xaa, 
>> 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }}
>>  
>>  [Protocols]
>>
> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to