]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
MdeModulePkg: remove PE/COFF header workaround for ELILO on IPF
[mirror_edk2.git] / MdeModulePkg / Core / PiSmmCore / SmramProfileRecord.c
index 410e0836fd1641c59cfd83905f32f5a58be4e09d..e8d60c2d2357e43b3c815d902fd84da64337543c 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support routines for SMRAM profile.\r
 \r
-  Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2018, 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
@@ -99,10 +99,10 @@ DumpSmramInfo (
   @param[in, out] ProfileSize       On entry, points to the size in bytes of the ProfileBuffer.\r
                                     On return, points to the size of the data returned in ProfileBuffer.\r
   @param[out]     ProfileBuffer     Profile buffer.\r
-                      \r
+\r
   @return EFI_SUCCESS               Get the memory profile data successfully.\r
   @return EFI_UNSUPPORTED           Memory profile is unsupported.\r
-  @return EFI_BUFFER_TO_SMALL       The ProfileSize is too small for the resulting data. \r
+  @return EFI_BUFFER_TO_SMALL       The ProfileSize is too small for the resulting data.\r
                                     ProfileSize is updated with the size required.\r
 \r
 **/\r
@@ -255,35 +255,6 @@ GetSmramProfileContext (
   return mSmramProfileContextPtr;\r
 }\r
 \r
-/**\r
-  Retrieves the magic value from the PE/COFF header.\r
-\r
-  @param Hdr    The buffer in which to return the PE32, PE32+, or TE header.\r
-\r
-  @return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32\r
-  @return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+\r
-\r
-**/\r
-UINT16\r
-InternalPeCoffGetPeHeaderMagicValue (\r
-  IN  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr\r
-  )\r
-{\r
-  //\r
-  // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value\r
-  //       in the PE/COFF Header.  If the MachineType is Itanium(IA64) and the\r
-  //       Magic value in the OptionalHeader is  EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC\r
-  //       then override the returned value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC\r
-  //\r
-  if (Hdr.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
-    return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;\r
-  }\r
-  //\r
-  // Return the magic value from the PC/COFF Optional Header\r
-  //\r
-  return Hdr.Pe32->OptionalHeader.Magic;\r
-}\r
-\r
 /**\r
   Retrieves and returns the Subsystem of a PE/COFF image that has been loaded into system memory.\r
   If Pe32Data is NULL, then ASSERT().\r
@@ -320,7 +291,7 @@ InternalPeCoffGetSubsystem (
   if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {\r
     return Hdr.Te->Subsystem;\r
   } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE)  {\r
-    Magic = InternalPeCoffGetPeHeaderMagicValue (Hdr);\r
+    Magic = Hdr.Pe32->OptionalHeader.Magic;\r
     if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
       return Hdr.Pe32->OptionalHeader.Subsystem;\r
     } else if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {\r
@@ -594,7 +565,7 @@ NeedRecordThisDriver (
     //\r
     return TRUE;\r
   }\r
-  \r
+\r
   //\r
   // Record FilePath without end node.\r
   //\r
@@ -1913,10 +1884,10 @@ Done:
   @param[in, out] ProfileSize       On entry, points to the size in bytes of the ProfileBuffer.\r
                                     On return, points to the size of the data returned in ProfileBuffer.\r
   @param[out]     ProfileBuffer     Profile buffer.\r
-                      \r
+\r
   @return EFI_SUCCESS               Get the memory profile data successfully.\r
   @return EFI_UNSUPPORTED           Memory profile is unsupported.\r
-  @return EFI_BUFFER_TO_SMALL       The ProfileSize is too small for the resulting data. \r
+  @return EFI_BUFFER_TO_SMALL       The ProfileSize is too small for the resulting data.\r
                                     ProfileSize is updated with the size required.\r
 \r
 **/\r
@@ -1986,7 +1957,7 @@ SmramProfileProtocolRegisterImage (
   EFI_SMM_DRIVER_ENTRY              DriverEntry;\r
   VOID                              *EntryPointInImage;\r
   EFI_GUID                          *Name;\r
-  \r
+\r
   ZeroMem (&DriverEntry, sizeof (DriverEntry));\r
   Name = GetFileNameFromFilePath (FilePath);\r
   if (Name != NULL) {\r