当前位置:网站首页>How to define guid in AMI code

How to define guid in AMI code

2022-07-05 07:51:00 Yang_ Winston

When looking at the code and writing the code, I found two Guid How to define , Record here , Here to create PEIM Moudle when installPpi when Ppi Used Guid For example .
The first is the most common way , Since you need to use one Guid, We define a in the header file Guid Just fine , as follows :

EFI_GUID   gOemPeiTestPeimPpiGuid = {
    0x2e1e7cae, 0x01fd, 0x4cf7, {
    0x8f, 0xbe, 0x8, 0xc4, 0x86, 0x82, 0x61, 0x89}};

The second is not written in the header file Guid Value ,OEM_PEI_TESTPEIM_PPI_GUID This value is just a decoration , It may be to increase the readability of the code .

#define OEM_PEI_TESTPEIM_PPI_GUID \ {
      0x2e1e7cae, 0x01fd, 0x4cf7, {
      0x8f, 0xbe, 0x8, 0xc4, 0x86, 0x82, 0x61, 0x89}}
extern EFI_GUID   gOemPeiTestPeimPpiGuid;

actually gOemPeiTestPeimPpiGuid The value of is in a Package Under the dec Of documents [Ppis] Block , as follows :

[Ppis]
  gOemPeiTestPeimPpiGuid       =    {
    0x2e1e7cae, 0x01fd, 0x4cf7, {
    0x8f, 0xbe, 0x8, 0xc4, 0x86, 0x82, 0x61, 0x89}}

that C How does the file reference this value ? In fact, in this Moudle Of inf Of documents [Packages] The above is listed under the block dec file , And also in [Ppis] It is listed under the block gOemPeiTestPeimPpiGuid The name ( If you don't list your name, you won't find this Guid value ).

[Packages]
MdePkg/MdePkg.dec
OemIp3Pkg/OemIp3Pkg.dec

[Ppis]
gOemPeiTestPeimPpiGuid

Say your opinion , The second method may reduce the coupling of the code , In case you need to change this one day Guid Value , We just need to change dec In the document Guid Just fine .( Of course, this reason doesn't seem to hold water , When changes are needed Guid Well ...)

原网站

版权声明
本文为[Yang_ Winston]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140549119368.html