public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: "Feng, Bob C" <bob.c.feng@intel.com>,
	"Fan, ZhijuX" <zhijux.fan@intel.com>
Cc: "Gao, Liming" <liming.gao@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [Patch] BaseTools: Correct the PcdDatabase Info in AutoGen
Date: Thu, 14 Feb 2019 15:02:42 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3DEC06@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20190202015204.5672-1-bob.c.feng@intel.com>

Zhiju:

1. Please make sure struct PEI_PCD_DATABASE_INIT in AutoGen.h to match gPEIPcdDbInit in AutoGen.c. 
2. Please make sure struct DXE_PCD_DATABASE_INIT in AutoGen.h to match gDXEPcdDbinit in AutoGen.c
3. gDXEPcdDbinit in AutoGen.c
  a. Keep origin style of /* LocalTokenNumberTable */ and /* VariableHead */
  b. Remove /* SkuHead */. It is not in PCD data bin. 
  c. Use the real string for the value in /* PcdTokenTable */ and /* PcdCNameTable */

Thanks
Liming
> -----Original Message-----
> From: Feng, Bob C
> Sent: Saturday, February 2, 2019 9:52 AM
> To: edk2-devel@lists.01.org
> Cc: Zhao, ZhiqiangX <zhiqiangx.zhao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [Patch] BaseTools: Correct the PcdDatabase Info in AutoGen
> 
> From: Zhaozh1x <zhiqiangx.zhao@intel.com>
> 
> PcdDriver AutoGen code shows PCD DB format for debug purpose only.
> But now, AutoGen code doesn't exactly match the generated
> PCD DB binary file. It brings the complex for Pcd driver debug.
> 
> This patch is going to fix that issue.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> ---
>  BaseTools/Source/Python/AutoGen/GenPcdDb.py | 41 +++++++++++++--------
>  1 file changed, 26 insertions(+), 15 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
> index cbf7a39dd5..2ca9001417 100644
> --- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
> +++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
> @@ -52,23 +52,32 @@ ${END}
>  ${BEGIN}    { ${EXMAPPING_TABLE_EXTOKEN}, ${EXMAPPING_TABLE_LOCAL_TOKEN}, ${EXMAPPING_TABLE_GUID_INDEX} },
>  ${END}
>    },
>    /* LocalTokenNumberTable */
>    {
> -${BEGIN}    offsetof(${PHASE}_PCD_DATABASE, ${TOKEN_INIT}.${TOKEN_CNAME}_${TOKEN_GUID}${VARDEF_HEADER}) |
> ${TOKEN_TYPE},
> +${BEGIN}    ${LOCAL_TOKEN_NUMBER_DB_VALUE}, /* offsetof(${PHASE}_PCD_DATABASE,
> ${TOKEN_INIT}.${TOKEN_CNAME}_${TOKEN_GUID}${VARDEF_HEADER}) | ${TOKEN_TYPE} */
>  ${END}
>    },
>    /* GuidTable */
>    {
>  ${BEGIN}    ${GUID_STRUCTURE},
>  ${END}
>    },
> +  /* StringHead */
>  ${BEGIN}  { ${STRING_HEAD_VALUE} }, /*
> ${STRING_HEAD_CNAME_DECL}_${STRING_HEAD_GUID_DECL}[${STRING_HEAD_NUMSKUS_DECL}] */
>  ${END}
> +  /* PcdNameTable */
> +  /* TokenSpaceCNameIndex, PcdCNameIndex, TokenSpaceCNameIndex, PcdCNameIndex, ...... */
> +  {
> +${BEGIN}    ${PCD_NAME_OFFSET},
> +${END}
> +  },
> +  /* VariableHead */
> +  /* StringIndex, DefaultValueOffset, GuidTableIndex, Offset, Attributes, Property */
>  ${BEGIN}  /* ${VARIABLE_HEAD_CNAME_DECL}_${VARIABLE_HEAD_GUID_DECL}_Variable_Header[${VARIABLE_HEAD_NUMSKUS_DECL}]
> */
>    {
> -    ${VARIABLE_HEAD_VALUE}
> +    ${VARIABLE_DB_VALUE}
>    },
>  ${END}
>  /* SkuHead */
>    {
>    ${BEGIN} offsetof (${PHASE}_PCD_DATABASE, ${TOKEN_INIT}.${TOKEN_CNAME}_${TOKEN_GUID}${VARDEF_HEADER}) |
> ${TOKEN_TYPE}, /* */
> @@ -76,10 +85,20 @@ ${END}
>    ${END}
>    },
>   /* StringTable */
>  ${BEGIN}  ${STRING_TABLE_VALUE}, /* ${STRING_TABLE_CNAME}_${STRING_TABLE_GUID} */
>  ${END}
> +  /* PcdTokenTable */
> +   {
> +${BEGIN}    ${PCD_TOKENSPACE}, /* PCD_TOKENSPACE */
> +${END}
> +  },
> +  /* PcdCNameTable */
> +  {
> +${BEGIN}    ${PCD_CNAME}, /* PCD_CNAME */
> +${END}
> +  },
>    /* SizeTable */
>    {
>  ${BEGIN}    ${SIZE_TABLE_MAXIMUM_LENGTH}, ${SIZE_TABLE_CURRENT_LENGTH}, /* ${SIZE_TABLE_CNAME}_${SIZE_TABLE_GUID} */
>  ${END}
>    },
> @@ -1221,18 +1240,10 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
>                  if VariableGuid not in GuidList:
>                      GuidList.append(VariableGuid)
>                      Dict['GUID_STRUCTURE'].append(VariableGuidStructure)
>                  VariableHeadGuidIndex = GuidList.index(VariableGuid)
> 
> -                if "PCD_TYPE_STRING" in Pcd.TokenTypeList:
> -                    VariableHeadValueList.append('%dU, offsetof(%s_PCD_DATABASE, Init.%s_%s), %dU, %sU' %
> -                                                 (VariableHeadStringIndex, Phase, CName, TokenSpaceGuid,
> -                                                 VariableHeadGuidIndex, Sku.VariableOffset))
> -                else:
> -                    VariableHeadValueList.append('%dU, offsetof(%s_PCD_DATABASE, Init.%s_%s_VariableDefault_%s), %dU, %sU' %
> -                                                 (VariableHeadStringIndex, Phase, CName, TokenSpaceGuid, SkuIdIndex,
> -                                                 VariableHeadGuidIndex, Sku.VariableOffset))
>                  Dict['VARDEF_CNAME_'+Pcd.DatumType].append(CName)
>                  Dict['VARDEF_GUID_'+Pcd.DatumType].append(TokenSpaceGuid)
>                  Dict['VARDEF_SKUID_'+Pcd.DatumType].append(SkuIdIndex)
>                  if "PCD_TYPE_STRING" in  Pcd.TokenTypeList:
>                      Dict['VARDEF_VALUE_' + Pcd.DatumType].append("%s_%s[%d]" % (Pcd.TokenCName, TokenSpaceGuid,
> SkuIdIndex))
> @@ -1571,13 +1582,11 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
>          if AvailableSkuNumber not in Dict['SKUID_VALUE']:
>              Dict['SKUID_VALUE'].append(AvailableSkuNumber)
>      Dict['SKUID_VALUE'][0] = len(Dict['SKUID_VALUE']) - 1
> 
>      AutoGenH.Append(gPcdDatabaseAutoGenH.Replace(Dict))
> -    if NumberOfLocalTokens == 0:
> -        AutoGenC.Append(gEmptyPcdDatabaseAutoGenC.Replace(Dict))
> -    else:
> +    if NumberOfLocalTokens != 0:
>          #
>          # Update Size Table to the right order, it should be same with LocalTokenNumberTable
>          #
>          SizeCNameTempList = []
>          SizeGuidTempList = []
> @@ -1603,15 +1612,17 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
>                  Dict['SIZE_TABLE_CNAME'][Count] = SizeCNameTempList[Count]
>                  Dict['SIZE_TABLE_GUID'][Count] = SizeGuidTempList[Count]
>                  Dict['SIZE_TABLE_CURRENT_LENGTH'][Count] = SizeCurLenTempList[Count]
>                  Dict['SIZE_TABLE_MAXIMUM_LENGTH'][Count] = SizeMaxLenTempList[Count]
> 
> -        AutoGenC.Append(gPcdDatabaseAutoGenC.Replace(Dict))
> -
> 
>  #     print Phase
>      Buffer = BuildExDataBase(Dict)
> +    if NumberOfLocalTokens == 0:
> +        AutoGenC.Append(gEmptyPcdDatabaseAutoGenC.Replace(Dict))
> +    else:
> +        AutoGenC.Append(gPcdDatabaseAutoGenC.Replace(Dict))
>      return AutoGenH, AutoGenC, Buffer, VarCheckTab
> 
>  def GetOrderedDynamicPcdList(DynamicPcdList, PcdTokenNumberList):
>      ReorderedDyPcdList = [None for i in range(len(DynamicPcdList))]
>      for Pcd in DynamicPcdList:
> --
> 2.20.1.windows.1



      reply	other threads:[~2019-02-14 15:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-02  1:52 [Patch] BaseTools: Correct the PcdDatabase Info in AutoGen Feng, Bob C
2019-02-14 15:02 ` Gao, Liming [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14E3DEC06@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox