]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Vlv2TbltDevicePkg/SaveMemoryConfig/SaveMemoryConfig.c
edk2: Remove packages moved to edk2-platforms
[mirror_edk2.git] / Vlv2TbltDevicePkg / SaveMemoryConfig / SaveMemoryConfig.c
diff --git a/Vlv2TbltDevicePkg/SaveMemoryConfig/SaveMemoryConfig.c b/Vlv2TbltDevicePkg/SaveMemoryConfig/SaveMemoryConfig.c
deleted file mode 100644 (file)
index 69c16c5..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/** \r
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-\r
-Module Name:\r
-\r
-  SaveMemoryConfig.c\r
-\r
-Abstract:\r
-  This is the driver that locates the MemoryConfigurationData HOB, if it\r
-  exists, and saves the data to nvRAM.\r
-\r
\r
-\r
---*/\r
-\r
-#include "SaveMemoryConfig.h"\r
-\r
-CHAR16    EfiMemoryConfigVariable[] = L"MemoryConfig";\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-SaveMemoryConfigEntryPoint (\r
-  IN EFI_HANDLE         ImageHandle,\r
-  IN EFI_SYSTEM_TABLE   *SystemTable\r
-  )\r
-/*++\r
-\r
-  Routine Description:\r
-    This is the standard EFI driver point that detects whether there is a\r
-    MemoryConfigurationData HOB and, if so, saves its data to nvRAM.\r
-\r
-  Arguments:\r
-    ImageHandle   - Handle for the image of this driver\r
-    SystemTable   - Pointer to the EFI System Table\r
-\r
-  Returns:\r
-    EFI_SUCCESS   - if the data is successfully saved or there was no data\r
-    EFI_NOT_FOUND - if the HOB list could not be located.\r
-    EFI_UNLOAD_IMAGE - It is not success\r
-\r
---*/\r
-{\r
-  EFI_STATUS                      Status=EFI_SUCCESS;\r
-  VOID                            *MemHobData;\r
-  VOID                            *VariableData;\r
-  UINTN                           BufferSize;\r
-  BOOLEAN                         MfgMode;\r
-  EFI_PLATFORM_SETUP_ID           *BootModeBuffer;\r
-  EFI_PLATFORM_INFO_HOB           *PlatformInfoHobPtr;\r
-  MEM_INFO_PROTOCOL               *MemInfoProtocol;\r
-  EFI_HANDLE                      Handle;\r
-  UINT8                                                                      Channel, Slot;\r
-  VOID                            *GuidHob;\r
-\r
-  VariableData   = NULL;\r
-  MfgMode        = FALSE;\r
-  Handle         = NULL;\r
-  BootModeBuffer = NULL;\r
-  MemHobData     = NULL;\r
-  PlatformInfoHobPtr = NULL;\r
-  BufferSize     = 0;\r
-\r
-  //\r
-  // Get Platform Info HOB\r
-  //\r
-  GuidHob = GetFirstGuidHob (&gEfiPlatformInfoGuid);\r
-  if (GuidHob == NULL) {\r
-    Status = EFI_NOT_FOUND;\r
-  }\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  PlatformInfoHobPtr = GET_GUID_HOB_DATA (GuidHob);\r
-\r
-  //\r
-  // Get the BootMode guid hob\r
-  //\r
-  GuidHob = GetFirstGuidHob (&gEfiPlatformBootModeGuid);\r
-  if (GuidHob == NULL) {\r
-    Status = EFI_NOT_FOUND;\r
-  }\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  BootModeBuffer = GET_GUID_HOB_DATA (GuidHob);\r
-\r
-\r
-  //\r
-  // Check whether in Manufacturing Mode\r
-  //\r
-  if (BootModeBuffer) {\r
-    if ( !CompareMem (   //EfiCompareMem\r
-            &BootModeBuffer->SetupName,\r
-            MANUFACTURE_SETUP_NAME,\r
-            StrSize (MANUFACTURE_SETUP_NAME)  //EfiStrSize\r
-            ) ) {\r
-      MfgMode = TRUE;\r
-    }\r
-  }\r
-\r
-  if (MfgMode) {\r
-    //\r
-    // Don't save Memory Configuration in Manufacturing Mode. Clear memory configuration.\r
-    //\r
-    Status = gRT->SetVariable (\r
-              EfiMemoryConfigVariable,\r
-              &gEfiVlv2VariableGuid,\r
-              EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
-              0,\r
-              NULL\r
-              );      \r
-  } else {\r
-\r
-    MemInfoProtocol = (MEM_INFO_PROTOCOL*)AllocateZeroPool(sizeof(MEM_INFO_PROTOCOL));\r
-    if (PlatformInfoHobPtr != NULL) {\r
-      MemInfoProtocol->MemInfoData.memSize  = 0;\r
-      for (Channel = 0; Channel < CH_NUM; Channel ++){\r
-        for (Slot = 0; Slot < DIMM_NUM; Slot ++){               \r
-          MemInfoProtocol->MemInfoData.dimmSize[Slot + (Channel * DIMM_NUM)] = PlatformInfoHobPtr->MemData.DimmSize[Slot + (Channel * DIMM_NUM)];\r
-        }\r
-      }\r
-         MemInfoProtocol->MemInfoData.memSize       = PlatformInfoHobPtr->MemData.MemSize;        \r
-         MemInfoProtocol->MemInfoData.EccSupport    = PlatformInfoHobPtr->MemData.EccSupport;\r
-      MemInfoProtocol->MemInfoData.ddrFreq       = PlatformInfoHobPtr->MemData.DdrFreq;\r
-      MemInfoProtocol->MemInfoData.ddrType       = PlatformInfoHobPtr->MemData.DdrType;\r
-      if (MemInfoProtocol->MemInfoData.memSize == 0){\r
-        //\r
-        // We hardcode if MRC didn't fill these info in\r
-        //\r
-        MemInfoProtocol->MemInfoData.memSize     = 0x800; //per 1MB \r
-        MemInfoProtocol->MemInfoData.dimmSize[0] = 0x800;\r
-        MemInfoProtocol->MemInfoData.dimmSize[1] = 0;    \r
-        MemInfoProtocol->MemInfoData.EccSupport  = FALSE;\r
-        MemInfoProtocol->MemInfoData.ddrType     = 5; //DDRType_LPDDR3\r
-      }\r
-\r
-      Status = gBS->InstallMultipleProtocolInterfaces (\r
-             &Handle,\r
-             &gMemInfoProtocolGuid,\r
-             MemInfoProtocol,\r
-             NULL\r
-             );\r
-    }\r
-\r
-    Status = EFI_SUCCESS;\r
-    if (BOOT_WITH_MINIMAL_CONFIGURATION != GetBootModeHob()){\r
-      //\r
-      // Get the Memory Config guid hob\r
-      //\r
-      GuidHob = GetFirstGuidHob (&gEfiMemoryConfigDataGuid);\r
-      if (GuidHob == NULL) {\r
-        Status = EFI_NOT_FOUND;\r
-      }\r
-      ASSERT_EFI_ERROR (Status);\r
-      \r
-      MemHobData = GET_GUID_HOB_DATA (GuidHob);\r
-      BufferSize = GET_GUID_HOB_DATA_SIZE (GuidHob);\r
-\r
-      Status = gRT->GetVariable (\r
-                  EfiMemoryConfigVariable,\r
-                  &gEfiVlv2VariableGuid,\r
-                  NULL,\r
-                  &BufferSize,\r
-                  VariableData\r
-                  );\r
-      if (EFI_ERROR(Status) && (MemHobData != NULL)) {    \r
-        Status = gRT->SetVariable (\r
-                      EfiMemoryConfigVariable,\r
-                      &gEfiVlv2VariableGuid,\r
-                      (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS),\r
-                      BufferSize,\r
-                      MemHobData\r
-                      );\r
-      } \r
-    }\r
-\r
-  } // if-else MfgMode\r
-\r
-  return EFI_SUCCESS;\r
-}\r