[if gte mso 9]>

[edk2] [PATCH] Update PeiCore, SmbiosDxe and IsaSerialDxe to use PcdGetxx() instead of FixedPcdGetxx()

Subject: [edk2] [PATCH] Update PeiCore, SmbiosDxe and IsaSerialDxe to use PcdGetxx() instead of FixedPcdGetxx()

From: "Zeng, Star" <star.zeng@intel.com>

To: "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>

Date: 2014-08-12 17:23:15

  • 2014-08-12 17:23:15  "Zeng, Star"   [edk2] [PATCH] Update PeiCore, SmbiosDxe and IsaSerialDxe to use PcdGetxx() instead of FixedPcdGetxx()

Hi,

 

Please help review this patch.

 

MdeModulePkg/IntelFrameworkModulePkg: Update PeiCore, SmbiosDxe and IsaSerialDxe to use PcdGetxx() instead of FixedPcdGetxx().

 

It changes some of the PCD declarations to add more supported PCD storage types and

the change in the PCD access methods is associated with that.

 

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Zeng, Star <star.zeng@intel.com>

Reviewed-by: Kinney, Michael D <michael.d.kinney@intel.com>

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

 

--------------

Index: IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf

===================================================================

--- IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf (revision 15672)

+++ IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf       (working copy)

@@ -1,7 +1,7 @@

## @file

# Serial driver for standard UARTS on an ISA bus.

#

-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>

+# Copyright (c) 2007 - 2014, 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

@@ -63,7 +63,7 @@

[FeaturePcd]

   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdIsaBusSerialUseHalfHandshake|FALSE

  

-[FixedPcd]

+[Pcd]

   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200

   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|8

   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|1

Index: IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c

===================================================================

--- IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c         (revision 15672)

+++ IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c      (working copy)

@@ -1,7 +1,7 @@

/** @file

   Serial driver for standard UARTS on an ISA bus.

-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>

+Copyright (c) 2006 - 2014, 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

@@ -43,11 +43,11 @@

   { // SerialMode

     SERIAL_PORT_SUPPORT_CONTROL_MASK,

     SERIAL_PORT_DEFAULT_TIMEOUT,

-    FixedPcdGet64 (PcdUartDefaultBaudRate),     // BaudRate

+    0,

     SERIAL_PORT_DEFAULT_RECEIVE_FIFO_DEPTH,

-    FixedPcdGet8 (PcdUartDefaultDataBits),      // DataBits

-    FixedPcdGet8 (PcdUartDefaultParity),        // Parity

-    FixedPcdGet8 (PcdUartDefaultStopBits)       // StopBits

+    0,

+    0,

+    0

   },

   NULL,

   NULL,

@@ -61,10 +61,10 @@

       }

     },

     0,

-    FixedPcdGet64 (PcdUartDefaultBaudRate),   

-    FixedPcdGet8 (PcdUartDefaultDataBits),

-    FixedPcdGet8 (PcdUartDefaultParity),

-    FixedPcdGet8 (PcdUartDefaultStopBits)

+    0,

+    0,

+    0,

+    0

   },

   NULL,

   0,    //BaseAddress

@@ -163,6 +163,17 @@

              );

   ASSERT_EFI_ERROR (Status);

+  //

+  // Initialize UART default setting in gSerialDevTempate

+  //

+  gSerialDevTempate.SerialMode.BaudRate = PcdGet64 (PcdUartDefaultBaudRate);

+  gSerialDevTempate.SerialMode.DataBits = PcdGet8 (PcdUartDefaultDataBits);

+  gSerialDevTempate.SerialMode.Parity   = PcdGet8 (PcdUartDefaultParity);

+  gSerialDevTempate.SerialMode.StopBits = PcdGet8 (PcdUartDefaultStopBits);

+  gSerialDevTempate.UartDevicePath.BaudRate = PcdGet64 (PcdUartDefaultBaudRate);

+  gSerialDevTempate.UartDevicePath.DataBits = PcdGet8 (PcdUartDefaultDataBits);

+  gSerialDevTempate.UartDevicePath.Parity   = PcdGet8 (PcdUartDefaultParity);

+  gSerialDevTempate.UartDevicePath.StopBits = PcdGet8 (PcdUartDefaultStopBits);

   return Status;

}

Index: MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c

===================================================================

--- MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c  (revision 15672)

+++ MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c         (working copy)

@@ -49,8 +49,8 @@

   UINTN                               PeimIndex;

   UINTN                               PeimCount;

   EFI_GUID                            *Guid;

-  EFI_PEI_FILE_HANDLE                 TempFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv) + 1];

-  EFI_GUID                            FileGuid[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];

+  EFI_PEI_FILE_HANDLE                 *TempFileHandles;

+  EFI_GUID                            *FileGuid;

   EFI_PEI_FIRMWARE_VOLUME_PPI         *FvPpi;

   EFI_FV_FILE_INFO                    FileInfo;

  

@@ -63,12 +63,14 @@

   Private->CurrentFvFileHandles[0] = NULL;

   Guid = NULL;

   FileHandle = NULL;

+  TempFileHandles = Private->FileHandles;

+  FileGuid        = Private->FileGuid;

   //

   // If the current Fv has been scanned, directly get its cachable record.

   //

   if (Private->Fv[Private->CurrentPeimFvCount].ScanFv) {

-    CopyMem (Private->CurrentFvFileHandles, Private->Fv[Private->CurrentPeimFvCount].FvFileHandles, sizeof (Private->CurrentFvFileHandles));

+    CopyMem (Private->CurrentFvFileHandles, Private->Fv[Private->CurrentPeimFvCount].FvFileHandles, sizeof (EFI_PEI_FILE_HANDLE) * PcdGet32 (PcdPeiCoreMaxPeimPerFv));

     return;

  }

@@ -76,9 +78,9 @@

   // Go ahead to scan this Fv, and cache FileHandles within it.

   //

   Status = EFI_NOT_FOUND;

-  for (PeimCount = 0; PeimCount <= FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv); PeimCount++) {

+  for (PeimCount = 0; PeimCount <= PcdGet32 (PcdPeiCoreMaxPeimPerFv); PeimCount++) {

     Status = FvPpi->FindFileByType (FvPpi, PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE, CoreFileHandle->FvHandle, &FileHandle);

-    if (Status != EFI_SUCCESS || PeimCount == FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)) {

+    if (Status != EFI_SUCCESS || PeimCount == PcdGet32 (PcdPeiCoreMaxPeimPerFv)) {

       break;

     }

@@ -89,7 +91,7 @@

   // Check whether the count of files exceeds the max support files in a FV image

   // If more files are required in a FV image, PcdPeiCoreMaxPeimPerFv can be set to a larger value in DSC file.

   //

-  ASSERT ((Status != EFI_SUCCESS) || (PeimCount < FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)));

+  ASSERT ((Status != EFI_SUCCESS) || (PeimCount < PcdGet32 (PcdPeiCoreMaxPeimPerFv)));

   //

   // Get Apriori File handle

@@ -115,7 +117,6 @@

       }

       Private->AprioriCount /= sizeof (EFI_GUID);

-      ZeroMem (FileGuid, sizeof (FileGuid));

       for (Index = 0; Index < PeimCount; Index++) {

         //

         // Make an array of file name guids that matches the FileHandle array so we can convert

@@ -176,7 +177,7 @@

       // We need to update it to start with files in the A Priori list and

       // then the remaining files in PEIM order.

       //

-      CopyMem (Private->CurrentFvFileHandles, TempFileHandles, sizeof (Private->CurrentFvFileHandles));

+      CopyMem (Private->CurrentFvFileHandles, TempFileHandles, sizeof (EFI_PEI_FILE_HANDLE) * PcdGet32 (PcdPeiCoreMaxPeimPerFv));

     }

   }

   //

@@ -184,7 +185,7 @@

   // Instead, we can retrieve the file handles within this Fv from cachable data.

   //

   Private->Fv[Private->CurrentPeimFvCount].ScanFv = TRUE;

-  CopyMem (Private->Fv[Private->CurrentPeimFvCount].FvFileHandles, Private->CurrentFvFileHandles, sizeof (Private->CurrentFvFileHandles));

+  CopyMem (Private->Fv[Private->CurrentPeimFvCount].FvFileHandles, Private->CurrentFvFileHandles, sizeof (EFI_PEI_FILE_HANDLE) * PcdGet32 (PcdPeiCoreMaxPeimPerFv));

 }

@@ -699,7 +700,7 @@

     SaveCurrentFileHandle =  Private->CurrentFileHandle;

     for (Index1 = 0; Index1 <= SaveCurrentFvCount; Index1++) {

-      for (Index2 = 0; (Index2 < FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)) && (Private->Fv[Index1].FvFileHandles[Index2] != NULL); Index2++) {

+      for (Index2 = 0; (Index2 < PcdGet32 (PcdPeiCoreMaxPeimPerFv)) && (Private->Fv[Index1].FvFileHandles[Index2] != NULL); Index2++) {

         if (Private->Fv[Index1].PeimState[Index2] == PEIM_STATE_REGISITER_FOR_SHADOW) {

           PeimFileHandle = Private->Fv[Index1].FvFileHandles[Index2];

           Status = PeiLoadImage (

@@ -785,7 +786,7 @@

       // Start to dispatch all modules within the current Fv.

       //

       for (PeimCount = Private->CurrentPeimCount;

-           (PeimCount < FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)) && (Private->CurrentFvFileHandles[PeimCount] != NULL);

+           (PeimCount < PcdGet32 (PcdPeiCoreMaxPeimPerFv)) && (Private->CurrentFvFileHandles[PeimCount] != NULL);

            PeimCount++) {

         Private->CurrentPeimCount  = PeimCount;

         PeimFileHandle = Private->CurrentFileHandle = Private->CurrentFvFileHandles[PeimCount];

@@ -1142,7 +1143,7 @@

       //

       // Before walking through the next FV,Private->CurrentFvFileHandles[]should set to NULL

       //

-      SetMem (Private->CurrentFvFileHandles, sizeof (Private->CurrentFvFileHandles), 0);

+      SetMem (Private->CurrentFvFileHandles, sizeof (EFI_PEI_FILE_HANDLE) * PcdGet32 (PcdPeiCoreMaxPeimPerFv), 0);

     }

     //

Index: MdeModulePkg/Core/Pei/FwVol/FwVol.c

===================================================================

--- MdeModulePkg/Core/Pei/FwVol/FwVol.c  (revision 15672)

+++ MdeModulePkg/Core/Pei/FwVol/FwVol.c        (working copy)

@@ -530,8 +530,8 @@

   Status       = EFI_SUCCESS;

   PrivateData  = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);

-  if (PrivateData->FvCount >= FixedPcdGet32 (PcdPeiCoreMaxFvSupported)) {

-    DEBUG ((EFI_D_ERROR, "The number of Fv Images (%d) exceed the max supported FVs (%d) in Pei", PrivateData->FvCount + 1, FixedPcdGet32 (PcdPeiCoreMaxFvSupported)));

+  if (PrivateData->FvCount >= PcdGet32 (PcdPeiCoreMaxFvSupported)) {

+    DEBUG ((EFI_D_ERROR, "The number of Fv Images (%d) exceed the max supported FVs (%d) in Pei", PrivateData->FvCount + 1, PcdGet32 (PcdPeiCoreMaxFvSupported)));

     DEBUG ((EFI_D_ERROR, "PcdPeiCoreMaxFvSupported value need be reconfigurated in DSC"));

     ASSERT (FALSE);

   }

@@ -1967,7 +1967,7 @@

     }

   }

-  ASSERT (Private->FvCount <= FixedPcdGet32 (PcdPeiCoreMaxFvSupported));

+  ASSERT (Private->FvCount <= PcdGet32 (PcdPeiCoreMaxFvSupported));

   if (Instance >= Private->FvCount) {

     return NULL;

   }

@@ -2015,7 +2015,7 @@

   //

   // Fixup all FvPpi pointers for the implementation in flash to permanent memory.

   //

-  for (Index = 0; Index < FixedPcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {

+  for (Index = 0; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {

     if (PrivateData->Fv[Index].FvPpi == OldFfsFvPpi) {

       PrivateData->Fv[Index].FvPpi = &mPeiFfs2FwVol.Fv;

     }

@@ -2043,7 +2043,7 @@

   //

   // Fixup all FvPpi pointers for the implementation in flash to permanent memory.

   //

-  for (Index = 0; Index < FixedPcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {

+  for (Index = 0; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {

     if (PrivateData->Fv[Index].FvPpi == OldFfsFvPpi) {

       PrivateData->Fv[Index].FvPpi = &mPeiFfs3FwVol.Fv;

     }

@@ -2074,7 +2074,7 @@

{

   PEI_CORE_UNKNOW_FORMAT_FV_INFO    *NewUnknownFv;

  

-  if (PrivateData->UnknownFvInfoCount + 1 >= FixedPcdGet32 (PcdPeiCoreMaxFvSupported)) {

+  if (PrivateData->UnknownFvInfoCount + 1 >= PcdGet32 (PcdPeiCoreMaxFvSupported)) {

     return EFI_OUT_OF_RESOURCES;

   }

  

@@ -2212,8 +2212,8 @@

       continue;

     }

    

-    if (PrivateData->FvCount >= FixedPcdGet32 (PcdPeiCoreMaxFvSupported)) {

-      DEBUG ((EFI_D_ERROR, "The number of Fv Images (%d) exceed the max supported FVs (%d) in Pei", PrivateData->FvCount + 1, FixedPcdGet32 (PcdPeiCoreMaxFvSupported)));

+    if (PrivateData->FvCount >= PcdGet32 (PcdPeiCoreMaxFvSupported)) {

+      DEBUG ((EFI_D_ERROR, "The number of Fv Images (%d) exceed the max supported FVs (%d) in Pei", PrivateData->FvCount + 1, PcdGet32 (PcdPeiCoreMaxFvSupported)));

       DEBUG ((EFI_D_ERROR, "PcdPeiCoreMaxFvSupported value need be reconfigurated in DSC"));

       ASSERT (FALSE);

     }

Index: MdeModulePkg/Core/Pei/PeiMain.h

===================================================================

--- MdeModulePkg/Core/Pei/PeiMain.h  (revision 15672)

+++ MdeModulePkg/Core/Pei/PeiMain.h         (working copy)

@@ -1,7 +1,7 @@

/** @file

   Definition of Pei Core Structures and Services

  

-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>

+Copyright (c) 2006 - 2014, 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

@@ -89,9 +89,9 @@

   ///

   INTN                    LastDispatchedNotify;

   ///

-  /// Ppi database.

+  /// Ppi database has the PcdPeiCoreMaxPpiSupported number of entries.

   ///

-  PEI_PPI_LIST_POINTERS   PpiListPtrs[FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)];

+  PEI_PPI_LIST_POINTERS   *PpiListPtrs;

} PEI_PPI_DATABASE;

 

@@ -109,8 +109,14 @@

   EFI_FIRMWARE_VOLUME_HEADER          *FvHeader;

   EFI_PEI_FIRMWARE_VOLUME_PPI         *FvPpi;

   EFI_PEI_FV_HANDLE                   FvHandle;

-  UINT8                               PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];

-  EFI_PEI_FILE_HANDLE                 FvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];

+  //

+  // Ponter to the buffer with the PcdPeiCoreMaxPeimPerFv number of Entries.

+  //

+  UINT8                               *PeimState;

+  //

+  // Ponter to the buffer with the PcdPeiCoreMaxPeimPerFv number of Entries.

+  //

+  EFI_PEI_FILE_HANDLE                 *FvFileHandles;

   BOOLEAN                             ScanFv;

   UINT32                              AuthenticationStatus;

} PEI_CORE_FV_HANDLE;

@@ -188,13 +194,22 @@

   UINTN                              FvCount;

  

   ///

-  /// The instance arrary for FVs which contains FFS and could be dispatched by PeiCore.

+  /// Pointer to the buffer with the PcdPeiCoreMaxFvSupported number of entries.

+  /// Each entry is for one FV which contains FFS and could be dispatched by PeiCore.

   ///

-  PEI_CORE_FV_HANDLE                 Fv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];

-  PEI_CORE_UNKNOW_FORMAT_FV_INFO     UnknownFvInfo[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];

+  PEI_CORE_FV_HANDLE                 *Fv;

+

+  ///

+  /// Pointer to the buffer with the PcdPeiCoreMaxFvSupported number of entries.

+  /// Each entry is for one FV which could not be dispatched by PeiCore.

+  ///

+  PEI_CORE_UNKNOW_FORMAT_FV_INFO     *UnknownFvInfo;

   UINTN                              UnknownFvInfoCount;

  

-  EFI_PEI_FILE_HANDLE                CurrentFvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];

+  ///

+  /// Pointer to the buffer with the PcdPeiCoreMaxPeimPerFv number of entries.

+  ///

+  EFI_PEI_FILE_HANDLE                *CurrentFvFileHandles;

   UINTN                              AprioriCount;

   UINTN                              CurrentPeimFvCount;

   UINTN                              CurrentPeimCount;

@@ -234,7 +249,17 @@

   // This field points to the shadowed image read function

   //

   PE_COFF_LOADER_READ_FILE          ShadowedImageRead;

+

   //

+  // Pointer to the temp buffer with the PcdPeiCoreMaxPeimPerFv + 1 number of entries.

+  //

+  EFI_PEI_FILE_HANDLE               *FileHandles;

+  //

+  // Pointer to the temp buffer with the PcdPeiCoreMaxPeimPerFv number of entries.

+  //

+  EFI_GUID                          *FileGuid;

+

+  //

   // Temp Memory Range is not covered by PeiTempMem and Stack.

   // Those Memory Range will be migrated into phisical memory.

   //

Index: MdeModulePkg/Core/Pei/PeiMain.inf

===================================================================

--- MdeModulePkg/Core/Pei/PeiMain.inf         (revision 15672)

+++ MdeModulePkg/Core/Pei/PeiMain.inf      (working copy)

@@ -4,7 +4,7 @@

# 2) Dispatch PEIM from discovered FV.

# 3) Handoff control to DxeIpl to load DXE core and enter DXE phase.

#

-# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>

+# Copyright (c) 2006 - 2014, 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

@@ -87,12 +87,10 @@

   gEfiTemporaryRamSupportPpiGuid                ## SOMETIMES_CONSUMES

   gEfiTemporaryRamDonePpiGuid                   ## SOMETIMES_CONSUMES

-[FixedPcd]

+[Pcd]

   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported             ## CONSUMES

   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv               ## CONSUMES

   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPpiSupported            ## CONSUMES

-

-[Pcd] 

   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeiStackSize                   ## CONSUMES

   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst   ## CONSUMES

   gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport            ## CONSUMES

Index: MdeModulePkg/Core/Pei/PeiMain/PeiMain.c

===================================================================

--- MdeModulePkg/Core/Pei/PeiMain/PeiMain.c   (revision 15672)

+++ MdeModulePkg/Core/Pei/PeiMain/PeiMain.c         (working copy)

@@ -1,7 +1,7 @@

/** @file

   Pei Core Main Entry Point

  

-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>

+Copyright (c) 2006 - 2014, 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

@@ -152,6 +152,7 @@

   EFI_PEI_PCI_CFG2_PPI        *PciCfg;

   EFI_HOB_HANDOFF_INFO_TABLE  *HandoffInformationTable;

   EFI_PEI_TEMPORARY_RAM_DONE_PPI *TemporaryRamDonePpi;

+  UINTN                       Index;

  

   //

   // Retrieve context passed into PEI Core

@@ -181,8 +182,28 @@

       OldCoreData->CpuIo = &OldCoreData->ServiceTableShadow.CpuIo;

       if (OldCoreData->HeapOffsetPositive) {

         OldCoreData->HobList.Raw = (VOID *)(OldCoreData->HobList.Raw + OldCoreData->HeapOffset);

+        OldCoreData->UnknownFvInfo        = (PEI_CORE_UNKNOW_FORMAT_FV_INFO *) ((UINT8 *) OldCoreData->UnknownFvInfo + OldCoreData->HeapOffset);

+        OldCoreData->CurrentFvFileHandles = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->CurrentFvFileHandles + OldCoreData->HeapOffset);

+        OldCoreData->PpiData.PpiListPtrs  = (PEI_PPI_LIST_POINTERS *) ((UINT8 *) OldCoreData->PpiData.PpiListPtrs + OldCoreData->HeapOffset);

+        OldCoreData->Fv                   = (PEI_CORE_FV_HANDLE *) ((UINT8 *) OldCoreData->Fv + OldCoreData->HeapOffset);

+        for (Index = 0; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {

+          OldCoreData->Fv[Index].PeimState     = (UINT8 *) OldCoreData->Fv[Index].PeimState + OldCoreData->HeapOffset;

+          OldCoreData->Fv[Index].FvFileHandles = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->Fv[Index].FvFileHandles + OldCoreData->HeapOffset);

+        }

+        OldCoreData->FileGuid             = (EFI_GUID *) ((UINT8 *) OldCoreData->FileGuid + OldCoreData->HeapOffset);

+        OldCoreData->FileHandles          = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->FileHandles + OldCoreData->HeapOffset);

       } else {

         OldCoreData->HobList.Raw = (VOID *)(OldCoreData->HobList.Raw - OldCoreData->HeapOffset);

+        OldCoreData->UnknownFvInfo        = (PEI_CORE_UNKNOW_FORMAT_FV_INFO *) ((UINT8 *) OldCoreData->UnknownFvInfo - OldCoreData->HeapOffset);

+        OldCoreData->CurrentFvFileHandles = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->CurrentFvFileHandles - OldCoreData->HeapOffset);

+        OldCoreData->PpiData.PpiListPtrs  = (PEI_PPI_LIST_POINTERS *) ((UINT8 *) OldCoreData->PpiData.PpiListPtrs - OldCoreData->HeapOffset);

+        OldCoreData->Fv                   = (PEI_CORE_FV_HANDLE *) ((UINT8 *) OldCoreData->Fv - OldCoreData->HeapOffset);

+        for (Index = 0; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {

+          OldCoreData->Fv[Index].PeimState     = (UINT8 *) OldCoreData->Fv[Index].PeimState - OldCoreData->HeapOffset;

+          OldCoreData->Fv[Index].FvFileHandles = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->Fv[Index].FvFileHandles - OldCoreData->HeapOffset);

+        }

+        OldCoreData->FileGuid             = (EFI_GUID *) ((UINT8 *) OldCoreData->FileGuid - OldCoreData->HeapOffset);

+        OldCoreData->FileHandles          = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->FileHandles - OldCoreData->HeapOffset);

       }

       //

@@ -285,8 +306,25 @@

   //

   // Initialize PEI Core Services

-  // 

+  //

   InitializeMemoryServices   (&PrivateData,    SecCoreData, OldCoreData);

+  if (OldCoreData == NULL) {

+    //

+    // Initialize PEI Core Private Data Buffer

+    //

+    PrivateData.PpiData.PpiListPtrs  = AllocateZeroPool (sizeof (PEI_PPI_LIST_POINTERS) * PcdGet32 (PcdPeiCoreMaxPpiSupported));

+    PrivateData.Fv                   = AllocateZeroPool (sizeof (PEI_CORE_FV_HANDLE) * PcdGet32 (PcdPeiCoreMaxFvSupported));

+    PrivateData.Fv[0].PeimState      = AllocateZeroPool (sizeof (UINT8) * PcdGet32 (PcdPeiCoreMaxPeimPerFv) * PcdGet32 (PcdPeiCoreMaxFvSupported));

+    PrivateData.Fv[0].FvFileHandles  = AllocateZeroPool (sizeof (EFI_PEI_FILE_HANDLE) * PcdGet32 (PcdPeiCoreMaxPeimPerFv) * PcdGet32 (PcdPeiCoreMaxFvSupported));

+    for (Index = 1; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {

+      PrivateData.Fv[Index].PeimState     = PrivateData.Fv[Index - 1].PeimState + PcdGet32 (PcdPeiCoreMaxPeimPerFv);

+      PrivateData.Fv[Index].FvFileHandles = PrivateData.Fv[Index - 1].FvFileHandles + PcdGet32 (PcdPeiCoreMaxPeimPerFv);

+    }

+    PrivateData.UnknownFvInfo        = AllocateZeroPool (sizeof (PEI_CORE_UNKNOW_FORMAT_FV_INFO) * PcdGet32 (PcdPeiCoreMaxFvSupported));

+    PrivateData.CurrentFvFileHandles = AllocateZeroPool (sizeof (EFI_PEI_FILE_HANDLE) * PcdGet32 (PcdPeiCoreMaxPeimPerFv));

+    PrivateData.FileGuid             = AllocatePool (sizeof (EFI_GUID) * PcdGet32 (PcdPeiCoreMaxPeimPerFv));

+    PrivateData.FileHandles          = AllocatePool (sizeof (EFI_PEI_FILE_HANDLE) * (PcdGet32 (PcdPeiCoreMaxPeimPerFv) + 1));

+  }

   InitializePpiServices      (&PrivateData,    OldCoreData);

  

   //

Index: MdeModulePkg/Core/Pei/Ppi/Ppi.c

===================================================================

--- MdeModulePkg/Core/Pei/Ppi/Ppi.c     (revision 15672)

+++ MdeModulePkg/Core/Pei/Ppi/Ppi.c  (working copy)

@@ -1,7 +1,7 @@

/** @file

   EFI PEI Core PPI services

  

-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>

+Copyright (c) 2006 - 2014, 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

@@ -30,9 +30,9 @@

   )

{

   if (OldCoreData == NULL) {

-    PrivateData->PpiData.NotifyListEnd = FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1;

-    PrivateData->PpiData.DispatchListEnd = FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1;

-    PrivateData->PpiData.LastDispatchedNotify = FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1;

+    PrivateData->PpiData.NotifyListEnd = PcdGet32 (PcdPeiCoreMaxPpiSupported)-1;

+    PrivateData->PpiData.DispatchListEnd = PcdGet32 (PcdPeiCoreMaxPpiSupported)-1;

+    PrivateData->PpiData.LastDispatchedNotify = PcdGet32 (PcdPeiCoreMaxPpiSupported)-1;

   }

}

@@ -119,7 +119,7 @@

   UINT8                 Index;

   UINT8                 IndexHole;

-  for (Index = 0; Index < FixedPcdGet32 (PcdPeiCoreMaxPpiSupported); Index++) {

+  for (Index = 0; Index < PcdGet32 (PcdPeiCoreMaxPpiSupported); Index++) {

     if (Index < PrivateData->PpiData.PpiListEnd || Index > PrivateData->PpiData.NotifyListEnd) {

       //

       // Convert PPI pointer in old Heap

@@ -312,7 +312,7 @@

   // Remove the old PPI from the database, add the new one.

   //

   DEBUG((EFI_D_INFO, "Reinstall PPI: %g\n", NewPpi->Guid));

-  ASSERT (Index < (INTN)(FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)));

+  ASSERT (Index < (INTN)(PcdGet32 (PcdPeiCoreMaxPpiSupported)));

   PrivateData->PpiData.PpiListPtrs[Index].Ppi = (EFI_PEI_PPI_DESCRIPTOR *) NewPpi;

   //

@@ -570,7 +570,7 @@

         EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH,

         PrivateData->PpiData.LastDispatchedInstall,

         PrivateData->PpiData.PpiListEnd,

-        FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)-1,

+        PcdGet32 (PcdPeiCoreMaxPpiSupported)-1,

         PrivateData->PpiData.DispatchListEnd

         );

       PrivateData->PpiData.LastDispatchedInstall = TempValue;

Index: MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c

===================================================================

--- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c         (revision 15672)

+++ MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c      (working copy)

@@ -2,7 +2,7 @@

   This code produces the Smbios protocol. It also responsible for constructing

   SMBIOS table into system table.

  

-Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>

+Copyright (c) 2009 - 2014, 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       

@@ -49,11 +49,11 @@

   //

   // MajorVersion

   //

-  (UINT8) (FixedPcdGet16 (PcdSmbiosVersion) >> 8),

+  0,

   //

   // MinorVersion

   //

-  (UINT8) (FixedPcdGet16 (PcdSmbiosVersion) & 0x00ff),

+  0,

   //

   // MaxStructureSize, TO BE FILLED

   //

@@ -101,8 +101,7 @@

   //

   // SmbiosBcdRevision

   //

-  (UINT8) ((FixedPcdGet16 (PcdSmbiosVersion) >> 4) & 0xf0)

-  | (UINT8) (FixedPcdGet16 (PcdSmbiosVersion) & 0x0f)

+  0

};

 

@@ -1079,8 +1078,11 @@

   mPrivateData.Smbios.UpdateString      = SmbiosUpdateString;

   mPrivateData.Smbios.Remove            = SmbiosRemove;

   mPrivateData.Smbios.GetNext           = SmbiosGetNext;

-  mPrivateData.Smbios.MajorVersion      = (UINT8) (FixedPcdGet16 (PcdSmbiosVersion) >> 8);

-  mPrivateData.Smbios.MinorVersion      = (UINT8) (FixedPcdGet16 (PcdSmbiosVersion) & 0x00ff);

+  mPrivateData.Smbios.MajorVersion      = (UINT8) (PcdGet16 (PcdSmbiosVersion) >> 8);

+  mPrivateData.Smbios.MinorVersion      = (UINT8) (PcdGet16 (PcdSmbiosVersion) & 0x00ff);

+  EntryPointStructureData.MajorVersion  = mPrivateData.Smbios.MajorVersion;

+  EntryPointStructureData.MinorVersion  = mPrivateData.Smbios.MinorVersion;

+  EntryPointStructureData.SmbiosBcdRevision = (UINT8) ((PcdGet16 (PcdSmbiosVersion) >> 4) & 0xf0) | (UINT8) (PcdGet16 (PcdSmbiosVersion) & 0x0f);

   InitializeListHead (&mPrivateData.DataListHead);

   InitializeListHead (&mPrivateData.AllocatedHandleListHead);

Index: MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf

===================================================================

--- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf     (revision 15672)

+++ MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf  (working copy)

@@ -2,7 +2,7 @@

# Component description file for Smbios module.

#

# This driver initializes and installs the SMBIOS protocol.

-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>

+# Copyright (c) 2009 - 2014, 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

@@ -54,7 +54,7 @@

   gEfiEventReadyToBootGuid                    # PROTOCOL ALWAYS_CONSUMED

   gEfiSmbiosTableGuid                         # PROTOCOL ALWAYS_CONSUMED

-[FixedPcd]

+[Pcd]

   gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion

 [Depex]

Index: MdeModulePkg/MdeModulePkg.dec

===================================================================

--- MdeModulePkg/MdeModulePkg.dec (revision 15780)

+++ MdeModulePkg/MdeModulePkg.dec        (working copy)

@@ -525,19 +525,9 @@

   #  for a dynamic PCD used in PEI phase.

   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPcdCallBackNumberPerPcdEntry|0x08|UINT32|0x0001000f

-  ## Maximum number of FV is supported by PeiCore's dispatching.

-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6|UINT32|0x00010030

-

-  ## Maximum File count in every FV is supported by PeiCore's dispatching.

-  #  PeiCore supported File type includes PEIM, Combined PEIM and FV.

-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32|UINT32|0x00010031

-

   ## Maximum stack size for PeiCore.

   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeiStackSize|0x20000|UINT32|0x00010032

-  ## Maximum PPI count is supported by PeiCore's PPI database.

-  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPpiSupported|64|UINT32|0x00010033

-

   ## Size of the NV variable range. Note that this value should less than or equal to PcdFlashNvStorageFtwSpareSize

   #  The root cause is that variable driver will use FTW protocol to reclaim variable region.

   #  If the length of variable region is larger than FTW spare size, it means the whole variable region can not

@@ -582,9 +572,6 @@

   #  Other Value:        Enable the feature as fixed absolute address, and the value is the top memory address

   gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable|0|UINT64|0x30001015

-  ## Smbios version

-  gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion|0x0208|UINT16|0x00010055

-

   ## TFTP BlockSize. Initial value 0 means using default block size which is (MTU-IP_HEADER-UDP_HEADER-TFTP_HEADER)

   #  to handle all link layers. If the value is non zero, the PCD value will be used as block size.

   #

@@ -616,6 +603,19 @@

   #

   gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0|UINT32|0x00010010

+  ## Maximum number of FV is supported by PeiCore's dispatching.

+  # @Prompt Maximum number of FV supported by PeiCore.

+  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6|UINT32|0x00010030

+

+  ## Maximum File count in every FV is supported by PeiCore's dispatching.

+  #  PeiCore supported File type includes PEIM, Combined PEIM and FV.

+  # @Prompt Maximum File count per FV supported by PeiCore.

+  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32|UINT32|0x00010031

+

+  ## Maximum PPI count is supported by PeiCore's PPI database.

+  # @Prompt Maximum PPI count supported by PeiCore.

+  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPpiSupported|64|UINT32|0x00010033

+

   ## Maximun number of performance log entries during PEI phase.

   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries|40|UINT8|0x0001002f

@@ -874,6 +874,10 @@

   ## This PCD specifies whether 1G page table is enabled.

   gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable|FALSE|BOOLEAN|0x0001005E

+  ## Smbios version.

+  # @Prompt Smbios version.

+  gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion|0x0208|UINT16|0x00010055

+

   ## This PCD specifies the additional pad size in FPDT Basic Boot Performance Table for

   #  the extension FPDT boot records got after ReadyToBoot and before ExitBootService.

   gEfiMdeModulePkgTokenSpaceGuid.PcdExtFpdtBootRecordPadSize|0x0|UINT32|0x0001005F

 

 

 

Thanks

Liming