]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFspWrapperPkg/Library/PeiFspHobProcessLibSample/FspHobProcessLibSample.c
Fix issue that calling GetS3MemoryInfo() with wrong order.
[mirror_edk2.git] / IntelFspWrapperPkg / Library / PeiFspHobProcessLibSample / FspHobProcessLibSample.c
index f293dc8be8096c231ed8749ef073c36a5b1d32d0..099980e5255655e7a316a0fa41766cce556e008c 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Sample to provide FSP hob process related function.\r
 \r
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -132,7 +132,7 @@ GetPeiMemSize (
 }\r
 \r
 /**\r
-  BIOS process FspBobList.\r
+  BIOS process FspBobList for Memory Resource Descriptor.\r
 \r
   @param[in] FspHobList  Pointer to the HOB data structure produced by FSP.\r
 \r
@@ -140,7 +140,7 @@ GetPeiMemSize (
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-FspHobProcess (\r
+FspHobProcessForMemoryResource (\r
   IN VOID                 *FspHobList\r
   )\r
 {\r
@@ -155,7 +155,7 @@ FspHobProcess (
   BOOLEAN              FoundFspMemHob;\r
   EFI_STATUS           Status;\r
   EFI_BOOT_MODE        BootMode;\r
-  PEI_CAPSULE_PPI      *Capsule;\r
+  EFI_PEI_CAPSULE_PPI  *Capsule;\r
   VOID                 *CapsuleBuffer;\r
   UINTN                CapsuleBufferLength;\r
   UINT64               RequiredMemSize;\r
@@ -244,12 +244,14 @@ FspHobProcess (
       LowMemorySize\r
       );\r
 \r
-    Status = GetS3MemoryInfo (&S3PeiMemBase, &S3PeiMemSize);\r
+    S3PeiMemBase = 0;\r
+    S3PeiMemSize = 0;\r
+    Status = GetS3MemoryInfo (&S3PeiMemSize, &S3PeiMemBase);\r
     ASSERT_EFI_ERROR (Status);\r
     DEBUG((DEBUG_INFO, "S3 memory %Xh - %Xh bytes\n", S3PeiMemBase, S3PeiMemSize));\r
 \r
     //\r
-    // Make sure Stack and PeiMemory are not overlap - JYAO1\r
+    // Make sure Stack and PeiMemory are not overlap\r
     //\r
 \r
     Status = PeiServicesInstallPeiMemory (\r
@@ -269,7 +271,7 @@ FspHobProcess (
     CapsuleBufferLength = 0;\r
     if (BootMode == BOOT_ON_FLASH_UPDATE) {\r
       Status = PeiServicesLocatePpi (\r
-                 &gPeiCapsulePpiGuid,\r
+                 &gEfiPeiCapsulePpiGuid,\r
                  0,\r
                  NULL,\r
                  (VOID **) &Capsule\r
@@ -278,7 +280,7 @@ FspHobProcess (
 \r
       if (Status == EFI_SUCCESS) {\r
         //\r
-        // Make sure Stack and CapsuleBuffer are not overlap - JYAO1\r
+        // Make sure Stack and CapsuleBuffer are not overlap\r
         //\r
         CapsuleBuffer = (VOID *)(UINTN)BASE_1MB;\r
         CapsuleBufferLength = (UINTN)(LowMemorySize - PeiMemSize);\r
@@ -311,7 +313,7 @@ FspHobProcess (
       );\r
 \r
     //\r
-    // Make sure Stack and CapsuleBuffer are not overlap - JYAO1\r
+    // Make sure Stack and CapsuleBuffer are not overlap\r
     //\r
 \r
     //\r
@@ -329,9 +331,45 @@ FspHobProcess (
     }\r
   }\r
 \r
-  //\r
-  // NV Storage Hob\r
-  //\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  BIOS process FspBobList for other data (not Memory Resource Descriptor).\r
+\r
+  @param[in] FspHobList  Pointer to the HOB data structure produced by FSP.\r
 \r
+  @return If platform process the FSP hob list successfully.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FspHobProcessForOtherData (\r
+  IN VOID                 *FspHobList\r
+  )\r
+{\r
   return EFI_SUCCESS;\r
 }\r
+\r
+/**\r
+  BIOS process FspBobList.\r
+\r
+  @param[in] FspHobList  Pointer to the HOB data structure produced by FSP.\r
+\r
+  @return If platform process the FSP hob list successfully.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FspHobProcess (\r
+  IN VOID                 *FspHobList\r
+  )\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  Status = FspHobProcessForMemoryResource (FspHobList);\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+  Status = FspHobProcessForOtherData (FspHobList);\r
+\r
+  return Status;\r
+}\r