public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] Follow PI1.4a to fix artificial limitation of PCD SkuId range
@ 2016-09-02 11:59 Star Zeng
  2016-09-02 11:59 ` [PATCH 1/2] BaseTools: " Star Zeng
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Star Zeng @ 2016-09-02 11:59 UTC (permalink / raw)
  To: edk2-devel; +Cc: michael.a.rothman, Star Zeng

Current BaseTools follow previous PI spec to use UINT8 for SkuId, to
follow PI1.4a, BaseTools need to be updated to fix artificial limitation
of PCD SkuId range.

BaseTools is updated to use UINT64 for SkuId, since the PCD database
structure needs to be naturally aligned, the PCD database structure
layout is adjusted to keep the natural alignment and version
is updated to 6.

The structure definition in MdeModulePkg/Include/Guid/
PcdDataBaseSignatureGuid.h and PCD drivers are also updated to match BaseTools.

Note: The source code and BaseTools need to be upgraded at the same time,
and if they are not upgraded at the same time, build error like below will
be triggered to help user identify the problem.

"Please make sure the version of PCD PEIM Service and the generated
PCD PEI Database match."

Star Zeng (1):
  MdeModulePkg PCD: Update PCD database structure definition to match
    BaseTools

Yonghong Zhu (1):
  BaseTools: Follow PI1.4a to fix artificial limitation of PCD SkuId
    range

 BaseTools/Source/Python/AutoGen/GenPcdDb.py        | 91 ++++++++++++++--------
 .../Include/Guid/PcdDataBaseSignatureGuid.h        | 14 ++--
 MdeModulePkg/Universal/PCD/Dxe/Pcd.c               |  2 +-
 MdeModulePkg/Universal/PCD/Dxe/Service.c           |  2 +-
 MdeModulePkg/Universal/PCD/Dxe/Service.h           |  4 +-
 MdeModulePkg/Universal/PCD/Pei/Pcd.c               |  2 +-
 MdeModulePkg/Universal/PCD/Pei/Service.c           |  4 +-
 MdeModulePkg/Universal/PCD/Pei/Service.h           |  4 +-
 8 files changed, 73 insertions(+), 50 deletions(-)

-- 
2.7.0.windows.1



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

* [PATCH 1/2] BaseTools: Follow PI1.4a to fix artificial limitation of PCD SkuId range
  2016-09-02 11:59 [PATCH 0/2] Follow PI1.4a to fix artificial limitation of PCD SkuId range Star Zeng
@ 2016-09-02 11:59 ` Star Zeng
  2016-09-02 11:59 ` [PATCH 2/2] MdeModulePkg PCD: Update PCD database structure definition to match BaseTools Star Zeng
  2016-09-07  1:56 ` [PATCH 0/2] Follow PI1.4a to fix artificial limitation of PCD SkuId range Gao, Liming
  2 siblings, 0 replies; 4+ messages in thread
From: Star Zeng @ 2016-09-02 11:59 UTC (permalink / raw)
  To: edk2-devel; +Cc: michael.a.rothman, Yonghong Zhu, Liming Gao

From: Yonghong Zhu <yonghong.zhu@intel.com>

Current BaseTools follow previous PI spec to use UINT8 for SkuId, to
follow PI1.4a, BaseTools need to be updated to fix artificial limitation
of PCD SkuId range.

This patch is to update BaseTools to use UINT64 for SkuId, since the
PCD database structure needs to be naturally aligned, the PCD database
structure layout is adjusted to keep the natural alignment and version
is updated to 6.

Note: As the PCD database structure layout is adjusted, the structure
definition in MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h and
PCD drivers also need to be updated. That means the source code and
BaseTools need to be upgraded at the same time, and if they are not
upgraded at the same time, build error like below will be triggered
to help user identify the problem.

"Please make sure the version of PCD PEIM Service and the generated
PCD PEI Database match."

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/AutoGen/GenPcdDb.py | 91 ++++++++++++++++++-----------
 1 file changed, 57 insertions(+), 34 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
index d5997f0e66aa..fc9ac7178f61 100644
--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -19,7 +19,7 @@ from ValidCheckingInfoObject import VAR_CHECK_PCD_VARIABLE_TAB
 from ValidCheckingInfoObject import VAR_VALID_OBJECT_FACTORY
 from Common.VariableAttributes import VariableAttributes
 
-DATABASE_VERSION = 5
+DATABASE_VERSION = 6
 
 gPcdDatabaseAutoGenC = TemplateString("""
 //
@@ -27,6 +27,8 @@ gPcdDatabaseAutoGenC = TemplateString("""
 //
 #if 0
 ${PHASE}_PCD_DATABASE_INIT g${PHASE}PcdDbInit = {
+  /* SkuIdTable */
+  { ${BEGIN}${SKUID_VALUE}, ${END} },
 ${BEGIN}  { ${INIT_VALUE_UINT64} }, /*  ${INIT_CNAME_DECL_UINT64}_${INIT_GUID_DECL_UINT64}[${INIT_NUMSKUS_DECL_UINT64}] */
 ${END}
 ${BEGIN}  ${VARDEF_VALUE_UINT64}, /* ${VARDEF_CNAME_UINT64}_${VARDEF_GUID_UINT64}_VariableDefault_${VARDEF_SKUID_UINT64} */
@@ -86,8 +88,6 @@ ${BEGIN}  { ${INIT_VALUE_BOOLEAN} }, /*  ${INIT_CNAME_DECL_BOOLEAN}_${INIT_GUID_
 ${END}
 ${BEGIN}  ${VARDEF_VALUE_BOOLEAN}, /* ${VARDEF_CNAME_BOOLEAN}_${VARDEF_GUID_BOOLEAN}_VariableDefault_${VARDEF_SKUID_BOOLEAN} */
 ${END}
-  /* SkuIdTable */
-  { ${BEGIN}${SKUID_VALUE}, ${END} },
   ${SYSTEM_SKU_ID_VALUE}
 };
 #endif
@@ -122,6 +122,7 @@ gPcdDatabaseAutoGenH = TemplateString("""
 #define ${PHASE}_EXMAP_TABLE_EMPTY              ${EXMAP_TABLE_EMPTY}
 
 typedef struct {
+  UINT64             SkuIdTable[${PHASE}_SKUID_TABLE_SIZE];
 ${BEGIN}  UINT64             ${INIT_CNAME_DECL_UINT64}_${INIT_GUID_DECL_UINT64}[${INIT_NUMSKUS_DECL_UINT64}];
 ${END}
 ${BEGIN}  UINT64             ${VARDEF_CNAME_UINT64}_${VARDEF_GUID_UINT64}_VariableDefault_${VARDEF_SKUID_UINT64};
@@ -156,7 +157,6 @@ ${BEGIN}  BOOLEAN            ${INIT_CNAME_DECL_BOOLEAN}_${INIT_GUID_DECL_BOOLEAN
 ${END}
 ${BEGIN}  BOOLEAN            ${VARDEF_CNAME_BOOLEAN}_${VARDEF_GUID_BOOLEAN}_VariableDefault_${VARDEF_SKUID_BOOLEAN};
 ${END}
-  UINT8              SkuIdTable[${PHASE}_SKUID_TABLE_SIZE];
 ${SYSTEM_SKU_ID}
 } ${PHASE}_PCD_DATABASE_INIT;
 
@@ -176,7 +176,9 @@ ${END}
 
 typedef struct {
   //GUID                  Signature;  // PcdDataBaseGuid
+  //UINT32                BuildVersion;
   //UINT32                Length;
+  //SKU_ID                SystemSkuId;      // Current SkuId value.
   //UINT32                UninitDataBaseSize;// Total size for PCD those default value with 0.
   //TABLE_OFFSET          LocalTokenNumberTableOffset;
   //TABLE_OFFSET          ExMapTableOffset;
@@ -184,11 +186,11 @@ typedef struct {
   //TABLE_OFFSET          StringTableOffset;
   //TABLE_OFFSET          SizeTableOffset;
   //TABLE_OFFSET          SkuIdTableOffset; 
+  //TABLE_OFFSET          PcdNameTableOffset;
   //UINT16                LocalTokenCount;  // LOCAL_TOKEN_NUMBER for all
   //UINT16                ExTokenCount;     // EX_TOKEN_NUMBER for DynamicEx
   //UINT16                GuidTableCount;   // The Number of Guid in GuidTable
-  //SKU_ID                SystemSkuId;      // Current SkuId value.
-  //UINT8                 Pad;
+  //UINT8                 Pad[2];
   ${PHASE}_PCD_DATABASE_INIT    Init;
   ${PHASE}_PCD_DATABASE_UNINIT  Uninit;
 } ${PHASE}_PCD_DATABASE;
@@ -204,6 +206,8 @@ gEmptyPcdDatabaseAutoGenC = TemplateString("""
 //
 #if 0
 ${PHASE}_PCD_DATABASE_INIT g${PHASE}PcdDbInit = {
+  /* SkuIdTable */
+  { 0 },
   /* ExMapTable */
   {
     {0, 0, 0}
@@ -226,8 +230,6 @@ ${PHASE}_PCD_DATABASE_INIT g${PHASE}PcdDbInit = {
   {
     0, 0
   },
-  /* SkuIdTable */
-  { 0 },
   ${SYSTEM_SKU_ID_VALUE}
 };
 #endif
@@ -760,9 +762,9 @@ def BuildExDataBase(Dict):
     VardefValueBoolean = Dict['VARDEF_DB_VALUE_BOOLEAN']
     DbVardefValueBoolean = DbItemList(1, RawDataList = VardefValueBoolean)
     SkuidValue = Dict['SKUID_VALUE']
-    DbSkuidValue = DbItemList(1, RawDataList = SkuidValue)
+    DbSkuidValue = DbItemList(8, RawDataList = SkuidValue)
     SkuIndexValue = Dict['SKU_INDEX_VALUE']
-    DbSkuIndexValue = DbItemList(0,RawDataList = SkuIndexValue)
+    DbSkuIndexValue = DbItemList(8,RawDataList = SkuIndexValue)
     
     # Unit Db Items
     UnInitValueUint64 = Dict['UNINIT_GUID_DECL_UINT64']
@@ -777,24 +779,24 @@ def BuildExDataBase(Dict):
     DbUnInitValueBoolean = DbItemList(1, RawDataList = UnInitValueBoolean)
     PcdTokenNumberMap = Dict['PCD_ORDER_TOKEN_NUMBER_MAP']
  
-    DbNameTotle = ["InitValueUint64", "VardefValueUint64", "InitValueUint32", "VardefValueUint32", "VpdHeadValue", "ExMapTable", 
+    DbNameTotle = ["SkuidValue", "SkuIndexValue", "InitValueUint64", "VardefValueUint64", "InitValueUint32", "VardefValueUint32", "VpdHeadValue", "ExMapTable",
                "LocalTokenNumberTable", "GuidTable", "StringHeadValue",  "PcdNameOffsetTable","VariableTable","SkuTable", "StringTableLen", "PcdTokenTable", "PcdCNameTable", 
                "SizeTableValue", "InitValueUint16", "VardefValueUint16", "InitValueUint8", "VardefValueUint8", "InitValueBoolean",
-               "VardefValueBoolean", "SkuidValue", "SkuIndexValue","UnInitValueUint64", "UnInitValueUint32", "UnInitValueUint16", "UnInitValueUint8", "UnInitValueBoolean"]
+               "VardefValueBoolean", "UnInitValueUint64", "UnInitValueUint32", "UnInitValueUint16", "UnInitValueUint8", "UnInitValueBoolean"]
  
-    DbTotal = [InitValueUint64, VardefValueUint64, InitValueUint32, VardefValueUint32, VpdHeadValue, ExMapTable, 
+    DbTotal = [SkuidValue, SkuIndexValue, InitValueUint64, VardefValueUint64, InitValueUint32, VardefValueUint32, VpdHeadValue, ExMapTable,
                LocalTokenNumberTable, GuidTable, StringHeadValue,  PcdNameOffsetTable,VariableTable,SkuTable, StringTableLen, PcdTokenTable,PcdCNameTable, 
                SizeTableValue, InitValueUint16, VardefValueUint16, InitValueUint8, VardefValueUint8, InitValueBoolean,
-               VardefValueBoolean, SkuidValue, SkuIndexValue, UnInitValueUint64, UnInitValueUint32, UnInitValueUint16, UnInitValueUint8, UnInitValueBoolean]
-    DbItemTotal = [DbInitValueUint64, DbVardefValueUint64, DbInitValueUint32, DbVardefValueUint32, DbVpdHeadValue, DbExMapTable, 
+               VardefValueBoolean, UnInitValueUint64, UnInitValueUint32, UnInitValueUint16, UnInitValueUint8, UnInitValueBoolean]
+    DbItemTotal = [DbSkuidValue, DbSkuIndexValue, DbInitValueUint64, DbVardefValueUint64, DbInitValueUint32, DbVardefValueUint32, DbVpdHeadValue, DbExMapTable,
                DbLocalTokenNumberTable, DbGuidTable, DbStringHeadValue,  DbPcdNameOffsetTable,DbVariableTable,DbSkuTable, DbStringTableLen, DbPcdTokenTable, DbPcdCNameTable, 
                DbSizeTableValue, DbInitValueUint16, DbVardefValueUint16, DbInitValueUint8, DbVardefValueUint8, DbInitValueBoolean,
-               DbVardefValueBoolean, DbSkuidValue, DbSkuIndexValue, DbUnInitValueUint64, DbUnInitValueUint32, DbUnInitValueUint16, DbUnInitValueUint8, DbUnInitValueBoolean]
+               DbVardefValueBoolean, DbUnInitValueUint64, DbUnInitValueUint32, DbUnInitValueUint16, DbUnInitValueUint8, DbUnInitValueBoolean]
     
-    # SkuidValue is the last table in the init table items
-    InitTableNum = DbTotal.index(SkuidValue) + 1 + 1 # +1 is for SkuIndexValue table
+    # VardefValueBoolean is the last table in the init table items
+    InitTableNum = DbNameTotle.index("VardefValueBoolean") + 1
     # The FixedHeader length of the PCD_DATABASE_INIT, from Signature to Pad
-    FixedHeaderLen = 64
+    FixedHeaderLen = 72
 
     # Get offset of SkuId table in the database 
     SkuIdTableOffset = FixedHeaderLen
@@ -809,18 +811,15 @@ def BuildExDataBase(Dict):
     for DbIndex in xrange(len(DbTotal)):
         if DbTotal[DbIndex] is SkuTable:
             break
+        elif DbItemTotal[DbIndex] is DbSkuIndexValue:
+            if DbItemTotal[DbIndex].RawDataList:
+                Count = 0
+                for item in DbItemTotal[DbIndex].RawDataList:
+                    Count += len(item)
+                SkuTableOffset += DbItemTotal[DbIndex].ItemSize * Count
+                continue
         SkuTableOffset += DbItemTotal[DbIndex].GetListSize()
-    PcdTokenTableDbOffset = FixedHeaderLen
-    for DbIndex in xrange(len(DbTotal)):
-        if DbTotal[DbIndex] is PcdTokenTable:
-            break
-        PcdTokenTableDbOffset += DbItemTotal[DbIndex].GetListSize()
-    
-    PcdCNameTableDbOffset = FixedHeaderLen
-    for DbIndex in xrange(len(DbTotal)):
-        if DbTotal[DbIndex] is PcdCNameTable:
-            break
-        PcdCNameTableDbOffset += DbItemTotal[DbIndex].GetListSize()
+
     # Fix up the LocalTokenNumberTable, SkuHeader table
     SkuHeaderIndex = 0
     if len(Dict['SKU_INDEX_VALUE']) > 0:
@@ -835,6 +834,13 @@ def BuildExDataBase(Dict):
             if DbTotal[DbIndex] is Table:
                 DbOffset += DbItemTotal[DbIndex].GetInterOffset(Offset)
                 break
+            elif DbItemTotal[DbIndex] is DbSkuIndexValue:
+                if DbItemTotal[DbIndex].RawDataList:
+                    Count = 0
+                    for item in DbItemTotal[DbIndex].RawDataList:
+                        Count += len(item)
+                    DbOffset += DbItemTotal[DbIndex].ItemSize * Count
+                    continue
             DbOffset += DbItemTotal[DbIndex].GetListSize()
             if DbIndex + 1 == InitTableNum:
                 if DbOffset % 8:
@@ -847,9 +853,9 @@ def BuildExDataBase(Dict):
         LocalTokenNumberTable[LocalTokenNumberTableIndex] = DbOffset|int(TokenTypeValue)
         # if PCD_TYPE_SKU_ENABLED, then we need to fix up the SkuTable
         
-        SkuIndexTabalOffset = SkuIdTableOffset + Dict['SKUID_VALUE'][0] + 1
+        SkuIndexTabalOffset = SkuIdTableOffset + len(Dict['SKUID_VALUE']) * 8
         if (TokenTypeValue & (0x2 << 28)):
-            SkuTable[SkuHeaderIndex] = (DbOffset|int(TokenTypeValue & ~(0x2<<28)), SkuIndexTabalOffset + SkuIndexIndexTable[PcdTokenNumberMap[LocalTokenNumberTableIndex]])
+            SkuTable[SkuHeaderIndex] = (DbOffset|int(TokenTypeValue & ~(0x2<<28)), SkuIndexTabalOffset + SkuIndexIndexTable[PcdTokenNumberMap[LocalTokenNumberTableIndex]] * 8)
             LocalTokenNumberTable[LocalTokenNumberTableIndex] = (SkuTableOffset + SkuHeaderIndex * 8) | int(TokenTypeValue)
             SkuHeaderIndex += 1
         
@@ -869,6 +875,13 @@ def BuildExDataBase(Dict):
                 if DbTotal[DbIndex] is VariableRefTable:
                     DbOffset += DbItemTotal[DbIndex].GetInterOffset(VariableOffset)
                     break
+                elif DbItemTotal[DbIndex] is DbSkuIndexValue:
+                    if DbItemTotal[DbIndex].RawDataList:
+                        Count = 0
+                        for item in DbItemTotal[DbIndex].RawDataList:
+                            Count += len(item)
+                        DbOffset += DbItemTotal[DbIndex].ItemSize * Count
+                        continue
                 DbOffset += DbItemTotal[DbIndex].GetListSize()
                 if DbIndex + 1 == InitTableNum:
                     if DbOffset % 8:
@@ -900,6 +913,13 @@ def BuildExDataBase(Dict):
             SkuIdTableOffset = DbTotalLength
         elif DbItemTotal[DbIndex] is DbPcdNameOffsetTable:
             DbPcdNameOffset = DbTotalLength
+        elif DbItemTotal[DbIndex] is DbSkuIndexValue:
+            if DbItemTotal[DbIndex].RawDataList:
+                Count = 0
+                for item in DbItemTotal[DbIndex].RawDataList:
+                    Count += len(item)
+                DbTotalLength += DbItemTotal[DbIndex].ItemSize * Count
+                continue
 
         DbTotalLength += DbItemTotal[DbIndex].GetListSize()
     if not Dict['PCD_INFO_FLAG']:
@@ -939,6 +959,9 @@ def BuildExDataBase(Dict):
     b = pack('=L', DbTotalLength - UninitDataBaseSize)
 
     Buffer += b
+    b = pack('=Q', SystemSkuId)
+
+    Buffer += b
     b = pack('=L', UninitDataBaseSize)
 
     Buffer += b
@@ -972,8 +995,8 @@ def BuildExDataBase(Dict):
     b = pack('=H', GuidTableCount)
  
     Buffer += b
-    b = pack('=B', SystemSkuId)
- 
+    b = pack('=B', Pad)
+
     Buffer += b
     b = pack('=B', Pad)
  
-- 
2.7.0.windows.1



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

* [PATCH 2/2] MdeModulePkg PCD: Update PCD database structure definition to match BaseTools
  2016-09-02 11:59 [PATCH 0/2] Follow PI1.4a to fix artificial limitation of PCD SkuId range Star Zeng
  2016-09-02 11:59 ` [PATCH 1/2] BaseTools: " Star Zeng
@ 2016-09-02 11:59 ` Star Zeng
  2016-09-07  1:56 ` [PATCH 0/2] Follow PI1.4a to fix artificial limitation of PCD SkuId range Gao, Liming
  2 siblings, 0 replies; 4+ messages in thread
From: Star Zeng @ 2016-09-02 11:59 UTC (permalink / raw)
  To: edk2-devel; +Cc: michael.a.rothman, Star Zeng, Liming Gao, Yonghong Zhu

To follow PI1.4a, BaseTools has be updated to fix artificial limitation of
SkuId range.

This patch is to update PCD database structure definition to match BaseTools.

Note: The source code and BaseTools need to be upgraded at the same time,
and if they are not upgraded at the same time, build error like below will
be triggered to help user identify the problem.

"Please make sure the version of PCD PEIM Service and the generated
PCD PEI Database match."

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h | 14 +++++++-------
 MdeModulePkg/Universal/PCD/Dxe/Pcd.c                 |  2 +-
 MdeModulePkg/Universal/PCD/Dxe/Service.c             |  2 +-
 MdeModulePkg/Universal/PCD/Dxe/Service.h             |  4 ++--
 MdeModulePkg/Universal/PCD/Pei/Pcd.c                 |  2 +-
 MdeModulePkg/Universal/PCD/Pei/Service.c             |  4 ++--
 MdeModulePkg/Universal/PCD/Pei/Service.h             |  4 ++--
 7 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h b/MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h
index ac95f7e21ae8..d2e848800b75 100644
--- a/MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h
+++ b/MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h
@@ -1,7 +1,7 @@
 /** @file
   Guid for Pcd DataBase Signature.
 
-Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2012 - 2016, 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 that accompanies this distribution.
 The full text of the license may be found at
@@ -23,7 +23,7 @@ extern EFI_GUID gPcdDataBaseSignatureGuid;
 //
 // Common definitions
 //
-typedef UINT8 SKU_ID;
+typedef UINT64 SKU_ID;
 
 #define PCD_TYPE_SHIFT        28
 
@@ -62,7 +62,7 @@ typedef struct  {
 } DYNAMICEX_MAPPING;
 
 typedef struct {
-  UINT32  SkuDataStartOffset;   // Offset(with TYPE info) from the PCD_DB.
+  UINT32  SkuDataStartOffset;   // Offset(with DATUM TYPE info) from the PCD_DB.
   UINT32  SkuIdTableOffset;     // Offset from the PCD_DB.
 } SKU_HEAD;
 
@@ -95,6 +95,7 @@ typedef struct {
     GUID                  Signature;            // PcdDataBaseGuid.
     UINT32                BuildVersion;
     UINT32                Length;
+    SKU_ID                SystemSkuId;          // Current SkuId value.
     UINT32                UninitDataBaseSize;   // Total size for PCD those default value with 0.
     TABLE_OFFSET          LocalTokenNumberTableOffset;
     TABLE_OFFSET          ExMapTableOffset;
@@ -106,14 +107,15 @@ typedef struct {
     UINT16                LocalTokenCount;      // LOCAL_TOKEN_NUMBER for all.
     UINT16                ExTokenCount;         // EX_TOKEN_NUMBER for DynamicEx.
     UINT16                GuidTableCount;       // The Number of Guid in GuidTable.
-    SKU_ID                SystemSkuId;          // Current SkuId value.
-    UINT8                 Pad;                  // Pad bytes to satisfy the alignment.
+    UINT8                 Pad[2];               // Pad bytes to satisfy the alignment.
 
     //
     // Default initialized external PCD database binary structure
     //
     // Padding is needed to keep necessary alignment
     //
+    //SKU_ID                         SkuIdTable[];            // SkuIds system supports.
+    //SKU_ID                         SkuIndexTable[];         // SkuIds for each PCD with SKU enable.
     //UINT64                         ValueUint64[];
     //UINT32                         ValueUint32[];
     //VPD_HEAD                       VpdHead[];               // VPD Offset
@@ -129,8 +131,6 @@ typedef struct {
     //UINT16                         ValueUint16[];
     //UINT8                          ValueUint8[];
     //BOOLEAN                        ValueBoolean[];
-    //UINT8                          SkuIdTable[];            // SkuIds system supports.
-    //UINT8                          SkuIndexTable[];         // SkuIds for each PCD with SKU enable.
 
 } PCD_DATABASE_INIT;
 
diff --git a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
index b9cf9e4e7646..1bb9098c04cf 100644
--- a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
+++ b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
@@ -239,7 +239,7 @@ DxeGetPcdInfoGetSku (
   VOID
   )
 {
-  return mPcdDatabase.DxeDb->SystemSkuId;
+  return (UINTN) mPcdDatabase.DxeDb->SystemSkuId;
 }
 
 /**
diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c b/MdeModulePkg/Universal/PCD/Dxe/Service.c
index 9ab456624fc7..6d0b0f8adec6 100644
--- a/MdeModulePkg/Universal/PCD/Dxe/Service.c
+++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c
@@ -958,7 +958,7 @@ GetSkuEnabledTokenNumber (
 {
   SKU_HEAD              *SkuHead;
   SKU_ID                *SkuIdTable;
-  INTN                  Index;
+  UINTN                 Index;
   UINT8                 *Value;
   UINT8                 *PcdDb;
   BOOLEAN               FoundSku;
diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.h b/MdeModulePkg/Universal/PCD/Dxe/Service.h
index 4d8ab0f13fd6..0257a3487cc4 100644
--- a/MdeModulePkg/Universal/PCD/Dxe/Service.h
+++ b/MdeModulePkg/Universal/PCD/Dxe/Service.h
@@ -1,7 +1,7 @@
 /** @file
 Private functions used by PCD DXE driver.
 
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2016, 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
@@ -39,7 +39,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 // Please make sure the PCD Serivce DXE Version is consistent with
 // the version of the generated DXE PCD Database by build tool.
 //
-#define PCD_SERVICE_DXE_VERSION      5
+#define PCD_SERVICE_DXE_VERSION      6
 
 //
 // PCD_DXE_SERVICE_DRIVER_VERSION is defined in Autogen.h.
diff --git a/MdeModulePkg/Universal/PCD/Pei/Pcd.c b/MdeModulePkg/Universal/PCD/Pei/Pcd.c
index 4d0caed5a94e..7a486b7d1d05 100644
--- a/MdeModulePkg/Universal/PCD/Pei/Pcd.c
+++ b/MdeModulePkg/Universal/PCD/Pei/Pcd.c
@@ -226,7 +226,7 @@ PeiGetPcdInfoGetSku (
   VOID
   )
 {
-  return GetPcdDatabase()->SystemSkuId;
+  return (UINTN) GetPcdDatabase()->SystemSkuId;
 }
 
 /**
diff --git a/MdeModulePkg/Universal/PCD/Pei/Service.c b/MdeModulePkg/Universal/PCD/Pei/Service.c
index 45ce01b1fa73..66ca892ed2e0 100644
--- a/MdeModulePkg/Universal/PCD/Pei/Service.c
+++ b/MdeModulePkg/Universal/PCD/Pei/Service.c
@@ -2,7 +2,7 @@
   The driver internal functions are implmented here.
   They build Pei PCD database, and provide access service to PCD database.
 
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2016, 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
@@ -550,7 +550,7 @@ GetSkuEnabledTokenNumber (
   PEI_PCD_DATABASE      *PeiPcdDb;
   SKU_HEAD              *SkuHead;
   SKU_ID                *SkuIdTable;
-  INTN                  Index;
+  UINTN                 Index;
   UINT8                 *Value;
   BOOLEAN               FoundSku;
 
diff --git a/MdeModulePkg/Universal/PCD/Pei/Service.h b/MdeModulePkg/Universal/PCD/Pei/Service.h
index c75187c2b117..fa14abeaa3b1 100644
--- a/MdeModulePkg/Universal/PCD/Pei/Service.h
+++ b/MdeModulePkg/Universal/PCD/Pei/Service.h
@@ -1,7 +1,7 @@
 /** @file
   The internal header file declares the private functions used by PeiPcd driver.
 
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2016, 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
@@ -36,7 +36,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 // Please make sure the PCD Serivce PEIM Version is consistent with
 // the version of the generated PEIM PCD Database by build tool.
 //
-#define PCD_SERVICE_PEIM_VERSION      5
+#define PCD_SERVICE_PEIM_VERSION      6
 
 //
 // PCD_PEI_SERVICE_DRIVER_VERSION is defined in Autogen.h.
-- 
2.7.0.windows.1



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

* Re: [PATCH 0/2] Follow PI1.4a to fix artificial limitation of PCD SkuId range
  2016-09-02 11:59 [PATCH 0/2] Follow PI1.4a to fix artificial limitation of PCD SkuId range Star Zeng
  2016-09-02 11:59 ` [PATCH 1/2] BaseTools: " Star Zeng
  2016-09-02 11:59 ` [PATCH 2/2] MdeModulePkg PCD: Update PCD database structure definition to match BaseTools Star Zeng
@ 2016-09-07  1:56 ` Gao, Liming
  2 siblings, 0 replies; 4+ messages in thread
From: Gao, Liming @ 2016-09-07  1:56 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Zeng, Star

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Star Zeng
> Sent: Friday, September 02, 2016 7:59 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>
> Subject: [edk2] [PATCH 0/2] Follow PI1.4a to fix artificial limitation of PCD
> SkuId range
> 
> Current BaseTools follow previous PI spec to use UINT8 for SkuId, to
> follow PI1.4a, BaseTools need to be updated to fix artificial limitation
> of PCD SkuId range.
> 
> BaseTools is updated to use UINT64 for SkuId, since the PCD database
> structure needs to be naturally aligned, the PCD database structure
> layout is adjusted to keep the natural alignment and version
> is updated to 6.
> 
> The structure definition in MdeModulePkg/Include/Guid/
> PcdDataBaseSignatureGuid.h and PCD drivers are also updated to match
> BaseTools.
> 
> Note: The source code and BaseTools need to be upgraded at the same time,
> and if they are not upgraded at the same time, build error like below will
> be triggered to help user identify the problem.
> 
> "Please make sure the version of PCD PEIM Service and the generated
> PCD PEI Database match."
> 
> Star Zeng (1):
>   MdeModulePkg PCD: Update PCD database structure definition to match
>     BaseTools
> 
> Yonghong Zhu (1):
>   BaseTools: Follow PI1.4a to fix artificial limitation of PCD SkuId
>     range
> 
>  BaseTools/Source/Python/AutoGen/GenPcdDb.py        | 91
> ++++++++++++++--------
>  .../Include/Guid/PcdDataBaseSignatureGuid.h        | 14 ++--
>  MdeModulePkg/Universal/PCD/Dxe/Pcd.c               |  2 +-
>  MdeModulePkg/Universal/PCD/Dxe/Service.c           |  2 +-
>  MdeModulePkg/Universal/PCD/Dxe/Service.h           |  4 +-
>  MdeModulePkg/Universal/PCD/Pei/Pcd.c               |  2 +-
>  MdeModulePkg/Universal/PCD/Pei/Service.c           |  4 +-
>  MdeModulePkg/Universal/PCD/Pei/Service.h           |  4 +-
>  8 files changed, 73 insertions(+), 50 deletions(-)
> 
> --
> 2.7.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


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

end of thread, other threads:[~2016-09-07  1:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-02 11:59 [PATCH 0/2] Follow PI1.4a to fix artificial limitation of PCD SkuId range Star Zeng
2016-09-02 11:59 ` [PATCH 1/2] BaseTools: " Star Zeng
2016-09-02 11:59 ` [PATCH 2/2] MdeModulePkg PCD: Update PCD database structure definition to match BaseTools Star Zeng
2016-09-07  1:56 ` [PATCH 0/2] Follow PI1.4a to fix artificial limitation of PCD SkuId range Gao, Liming

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