]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Make MDE package pass intel IPF compiler with /W4 /WX switched on.
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 25 Jan 2007 06:05:36 +0000 (06:05 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 25 Jan 2007 06:05:36 +0000 (06:05 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2312 6f19259b-4bc3-4df7-8a09-765794883524

65 files changed:
MdePkg/Include/Library/DebugLib.h
MdePkg/Include/Library/DxeCoreEntryPoint.h
MdePkg/Include/Library/PeiCoreEntryPoint.h
MdePkg/Include/Library/PerformanceLib.h
MdePkg/Library/BaseLib/BaseLibInternals.h
MdePkg/Library/BaseLib/BitField.c
MdePkg/Library/BaseLib/Ipf/Synchronization.c
MdePkg/Library/BaseLib/Ipf/Unaligned.c
MdePkg/Library/BaseLib/LinkedList.c
MdePkg/Library/BaseLib/LongJump.c
MdePkg/Library/BaseLib/Math64.c
MdePkg/Library/BaseLib/SetJump.c
MdePkg/Library/BaseLib/String.c
MdePkg/Library/BaseLib/SwapBytes16.c
MdePkg/Library/BaseLib/SwapBytes32.c
MdePkg/Library/BaseLib/Synchronization.c
MdePkg/Library/BaseMemoryLib/CopyMem.c
MdePkg/Library/BaseMemoryLib/MemLibGuid.c
MdePkg/Library/BaseMemoryLib/SetMem.c
MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c
MdePkg/Library/BasePciExpressLib/PciLib.c
MdePkg/Library/BasePeCoffLib/BasePeCoff.c
MdePkg/Library/BasePeCoffLib/BasePeCoffLib.msa
MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h [new file with mode: 0644]
MdePkg/Library/BasePeCoffLib/Ipf/PeCoffLoaderEx.c
MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c
MdePkg/Library/BasePostCodeLibDebug/PostCode.c
MdePkg/Library/BasePostCodeLibPort80/PostCode.c
MdePkg/Library/BasePrintLib/PrintLibInternal.h
MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.msa
MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h [new file with mode: 0644]
MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.msa
MdePkg/Library/DxeCoreHobLib/HobLib.c
MdePkg/Library/DxeCoreHobLib/HobLib.h [new file with mode: 0644]
MdePkg/Library/DxeIoLibCpuIo/DxeCpuIoLibInternal.h [new file with mode: 0644]
MdePkg/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.msa
MdePkg/Library/DxeIoLibCpuIo/IoHighLevel.c
MdePkg/Library/DxeIoLibCpuIo/IoLib.c
MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.msa
MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLib.c
MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLibInternals.h [new file with mode: 0644]
MdePkg/Library/DxeMemoryLib/MemLib.c
MdePkg/Library/DxeMemoryLib/MemLibGuid.c
MdePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
MdePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PostCode.c
MdePkg/Library/PeiHobLib/HobLib.c
MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c
MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLibInternals.h [new file with mode: 0644]
MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.msa
MdePkg/Library/PeiMemoryLib/MemLib.c
MdePkg/Library/PeiMemoryLib/MemLibGuid.c
MdePkg/Library/PeiPcdLib/PeiPcdLib.c
MdePkg/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c
MdePkg/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointer.c
MdePkg/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointerLibInternals.h [new file with mode: 0644]
MdePkg/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointerLibKr1.msa
MdePkg/Library/PeiSmbusLib/InternalSmbusLib.h
MdePkg/Library/UefiDebugLibConOut/DebugLib.c
MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
MdePkg/Library/UefiDriverEntryPoint/DriverEntryPoint.c
MdePkg/Library/UefiLib/UefiLib.c
MdePkg/Library/UefiLib/UefiNotTiano.c

index 693fc3cf7a23dbad0d1d085c7c34337c71bad1b5..6e009654d2c9bdaefbaee2b407ed5778709aa758 100644 (file)
@@ -351,7 +351,7 @@ DebugClearMemoryEnabled (
   are not included in a module.\r
 \r
 **/\r
-#define DEBUG_CODE_END()    __DebugCodeLocal = 0; } } while (FALSE)\r
+#define DEBUG_CODE_END()    __DebugCodeLocal = 0; __DebugCodeLocal++; } } while (FALSE)\r
 \r
 \r
 /**\r
index 1de2798b9feb92e9fb7f56a0f039d0b845ae5355..2317dd48444a5296a076a13fb817db74726678c8 100644 (file)
@@ -61,6 +61,19 @@ ProcessLibraryConstructorList (
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   );\r
 \r
+/**\r
+  Call destructors for all libraries. Automatics Generated by tool.\r
+\r
+  @param  ImageHandle ImageHandle of the loaded driver.\r
+  @param  SystemTable Pointer to the EFI System Table.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ProcessLibraryDestructorList (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  );\r
 \r
 /**\r
   Call the list of driver entry points. Automatics Generated by tool.\r
index 4f88223d73cf35ceb1849c0b7a5131c50d27e651..a096bd451b766b55b18cbc9894e98d659ae4b846 100644 (file)
@@ -15,6 +15,33 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef __MODULE_ENTRY_POINT_H__\r
 #define __MODULE_ENTRY_POINT_H__\r
 \r
+/**\r
+  Enrty point to PEI core.\r
+\r
+  @param  PeiStartupDescriptor Pointer of start up information.\r
\r
+  @return Status returned by entry points of core and drivers. \r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+_ModuleEntryPoint (\r
+  IN EFI_PEI_STARTUP_DESCRIPTOR  *PeiStartupDescriptor\r
+  );\r
+\r
+/**\r
+  Wrapper of enrty point to PEI core.\r
+\r
+  @param  PeiStartupDescriptor Pointer of start up information.\r
\r
+  @return Status returned by entry points of core and drivers. \r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiMain (\r
+  IN EFI_PEI_STARTUP_DESCRIPTOR  *PeiStartupDescriptor\r
+  );\r
 \r
 /**\r
   Call constructs for all libraries. Automatics Generated by tool.\r
index 43e898bfb8ae3d5d5088f2b8c78794aed9bf2b50..06de00d8d88f9fc3cba2a4eb13cbb586106695cb 100644 (file)
@@ -195,7 +195,7 @@ PerformanceMeasurementEnabled (
   Otherwise, the source lines between PERF_CODE_BEGIN() and PERF_CODE_END() are not included in a module.\r
 \r
 **/\r
-#define PERF_CODE_END()    __PerformanceCodeLocal = 0; } } while (FALSE)\r
+#define PERF_CODE_END()    __PerformanceCodeLocal = 0; __PerformanceCodeLocal++; } } while (FALSE)\r
 \r
 /**\r
   Macro that declares a section of performance measurement source code.\r
index e9caef3e58b3d24b45ece726a78b918bff2b8d88..d0b9ef6f20de6416476b62d2979b45d3b75d02d4 100644 (file)
@@ -575,4 +575,219 @@ InternalX86DisablePaging64 (
   IN      UINT32                    NewStack\r
   );\r
 \r
+/**\r
+  Worker function that locates the Node in the List\r
+\r
+  By searching the List, finds the location of the Node in List. At the same time,\r
+  verifies the validity of this list.\r
+\r
+  If List is NULL, then ASSERT().\r
+  If List->ForwardLink is NULL, then ASSERT().\r
+  If List->backLink is NULL, then ASSERT().\r
+  If Node is NULL, then ASSERT();\r
+  If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number\r
+  of nodes in ListHead, including the ListHead node, is greater than or\r
+  equal to PcdMaximumLinkedListLength, then ASSERT().\r
+\r
+  @param  List  A pointer to a node in a linked list.\r
+  @param  Node  A pointer to one nod.\r
+\r
+  @retval TRUE   Node is in List\r
+  @retval FALSE  Node isn't in List, or List is invalid\r
+\r
+**/\r
+BOOLEAN\r
+IsNodeInList (\r
+  IN      CONST LIST_ENTRY      *List,\r
+  IN      CONST LIST_ENTRY      *Node\r
+  );\r
+\r
+/**\r
+  Performs an atomic increment of an 32-bit unsigned integer.\r
+\r
+  Performs an atomic increment of the 32-bit unsigned integer specified by\r
+  Value and returns the incremented value. The increment operation must be\r
+  performed using MP safe mechanisms. The state of the return value is not\r
+  guaranteed to be MP safe.\r
+\r
+  @param  Value A pointer to the 32-bit value to increment.\r
+\r
+  @return The incremented value.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+InternalSyncIncrement (\r
+  IN      volatile UINT32           *Value\r
+  );\r
+\r
+/**\r
+  Performs an atomic decrement of an 32-bit unsigned integer.\r
+\r
+  Performs an atomic decrement of the 32-bit unsigned integer specified by\r
+  Value and returns the decrement value. The decrement operation must be\r
+  performed using MP safe mechanisms. The state of the return value is not\r
+  guaranteed to be MP safe.\r
+\r
+  @param  Value A pointer to the 32-bit value to decrement.\r
+\r
+  @return The decrement value.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+InternalSyncDecrement (\r
+  IN      volatile UINT32           *Value\r
+  );\r
+\r
+/**\r
+  Performs an atomic compare exchange operation on a 32-bit unsigned integer.\r
+\r
+  Performs an atomic compare exchange operation on the 32-bit unsigned integer\r
+  specified by Value.  If Value is equal to CompareValue, then Value is set to \r
+  ExchangeValue and CompareValue is returned.  If Value is not equal to CompareValue,\r
+  then Value is returned.  The compare exchange operation must be performed using \r
+  MP safe mechanisms.\r
+\r
+  @param  Value         A pointer to the 32-bit value for the compare exchange\r
+                        operation.\r
+  @param  CompareValue  32-bit value used in compare operation.\r
+  @param  ExchangeValue 32-bit value used in exchange operation.\r
+\r
+  @return The original *Value before exchange.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+InternalSyncCompareExchange32 (\r
+  IN      volatile UINT32           *Value,\r
+  IN      UINT32                    CompareValue,\r
+  IN      UINT32                    ExchangeValue\r
+  );\r
+\r
+/**\r
+  Performs an atomic compare exchange operation on a 64-bit unsigned integer.\r
+\r
+  Performs an atomic compare exchange operation on the 64-bit unsigned integer specified \r
+  by Value.  If Value is equal to CompareValue, then Value is set to ExchangeValue and \r
+  CompareValue is returned.  If Value is not equal to CompareValue, then Value is returned. \r
+  The compare exchange operation must be performed using MP safe mechanisms.\r
+\r
+  @param  Value         A pointer to the 64-bit value for the compare exchange\r
+                        operation.\r
+  @param  CompareValue  64-bit value used in compare operation.\r
+  @param  ExchangeValue 64-bit value used in exchange operation.\r
+\r
+  @return The original *Value before exchange.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+InternalSyncCompareExchange64 (\r
+  IN      volatile UINT64           *Value,\r
+  IN      UINT64                    CompareValue,\r
+  IN      UINT64                    ExchangeValue\r
+  );\r
+\r
+/**\r
+  Worker function that returns a bit field from Operand\r
+\r
+  Returns the bitfield specified by the StartBit and the EndBit from Operand.\r
+\r
+  @param  Operand   Operand on which to perform the bitfield operation.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+\r
+  @return The bit field read.\r
+\r
+**/\r
+unsigned int\r
+BitFieldReadUint (\r
+  IN      unsigned int              Operand,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit\r
+  );\r
+\r
+/**\r
+  Worker function that reads a bit field from Operand, performs a bitwise OR, \r
+  and returns the result.\r
+\r
+  Performs a bitwise OR between the bit field specified by StartBit and EndBit\r
+  in Operand and the value specified by AndData. All other bits in Operand are\r
+  preserved. The new value is returned.\r
+\r
+  @param  Operand   Operand on which to perform the bitfield operation.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+  @param  OrData    The value to OR with the read value from the value\r
+\r
+  @return The new value.\r
+\r
+**/\r
+unsigned int\r
+BitFieldOrUint (\r
+  IN      unsigned int              Operand,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit,\r
+  IN      unsigned int              OrData\r
+  );\r
+\r
+/**\r
+  Worker function that reads a bit field from Operand, performs a bitwise AND, \r
+  and returns the result.\r
+\r
+  Performs a bitwise AND between the bit field specified by StartBit and EndBit\r
+  in Operand and the value specified by AndData. All other bits in Operand are\r
+  preserved. The new value is returned.\r
+\r
+  @param  Operand   Operand on which to perform the bitfield operation.\r
+  @param  StartBit  The ordinal of the least significant bit in the bit field.\r
+  @param  EndBit    The ordinal of the most significant bit in the bit field.\r
+  @param  AndData    The value to And with the read value from the value\r
+\r
+  @return The new value.\r
+\r
+**/\r
+unsigned int\r
+BitFieldAndUint (\r
+  IN      unsigned int              Operand,\r
+  IN      UINTN                     StartBit,\r
+  IN      UINTN                     EndBit,\r
+  IN      unsigned int              AndData\r
+  );\r
+\r
+/**\r
+  Worker function that checks ASSERT condition for JumpBuffer\r
+\r
+  Checks ASSERT condition for JumpBuffer.\r
+\r
+  If JumpBuffer is NULL, then ASSERT().\r
+  For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r
+\r
+  @param  JumpBuffer    A pointer to CPU context buffer.\r
+\r
+**/\r
+VOID\r
+InternalAssertJumpBuffer (\r
+  IN      BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer\r
+  );\r
+\r
+/**\r
+  Restores the CPU context that was saved with SetJump().\r
+\r
+  Restores the CPU context from the buffer specified by JumpBuffer.\r
+  This function never returns to the caller.\r
+  Instead is resumes execution based on the state of JumpBuffer.\r
+\r
+  @param  JumpBuffer    A pointer to CPU context buffer.\r
+  @param  Value         The value to return when the SetJump() context is restored.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+InternalLongJump (\r
+  IN      BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer,\r
+  IN      UINTN                     Value\r
+  );\r
+\r
 #endif\r
index 0b517aa974f7f505cd7a59c472df3e03a7b32305..3db8a23c950ebbc4f23b84b73277ecfc9f9b048a 100644 (file)
@@ -14,6 +14,8 @@
 \r
 **/\r
 \r
+#include "BaseLibInternals.h"\r
+\r
 /**\r
   Worker function that returns a bit field from Operand\r
 \r
@@ -763,10 +765,16 @@ BitFieldOr64 (
   IN      UINT64                    OrData\r
   )\r
 {\r
+  UINT64  Value1;\r
+  UINT64  Value2;\r
+\r
   ASSERT (EndBit < sizeof (Operand) * 8);\r
   ASSERT (StartBit <= EndBit);\r
-  return Operand |\r
-         (LShiftU64 (OrData, StartBit) & ~LShiftU64 ((UINT64)-2, EndBit));\r
+\r
+  Value1 = LShiftU64 (OrData, StartBit);\r
+  Value2 = LShiftU64 ((UINT64) - 2, EndBit);\r
+\r
+  return Operand | (Value1 & ~Value2);\r
 }\r
 \r
 /**\r
@@ -801,10 +809,16 @@ BitFieldAnd64 (
   IN      UINT64                    AndData\r
   )\r
 {\r
+  UINT64  Value1;\r
+  UINT64  Value2;\r
+  \r
   ASSERT (EndBit < sizeof (Operand) * 8);\r
   ASSERT (StartBit <= EndBit);\r
-  return Operand &\r
-         ~(LShiftU64 (~AndData, StartBit) & ~LShiftU64 ((UINT64)-2, EndBit));\r
+\r
+  Value1 = LShiftU64 (~AndData, StartBit);\r
+  Value2 = LShiftU64 ((UINT64)-2, EndBit);\r
+\r
+  return Operand & ~(Value1 & ~Value2);\r
 }\r
 \r
 /**\r
index 44593e177879209a8c7cceec19d6b1cfd81079ab..c29a8763d3a064414fbdfc867caca7327c38975a 100644 (file)
 \r
 **/\r
 \r
-/**\r
-  Performs an atomic compare exchange operation on a 32-bit unsigned integer.\r
-\r
-  Performs an atomic compare exchange operation on the 32-bit unsigned integer\r
-  specified by Value.  If Value is equal to CompareValue, then Value is set to \r
-  ExchangeValue and CompareValue is returned.  If Value is not equal to CompareValue,\r
-  then Value is returned.  The compare exchange operation must be performed using \r
-  MP safe mechanisms.\r
-\r
-  @param  Value         A pointer to the 32-bit value for the compare exchange\r
-                        operation.\r
-  @param  CompareValue  32-bit value used in compare operation.\r
-  @param  ExchangeValue 32-bit value used in exchange operation.\r
-\r
-  @return The original *Value before exchange.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-InternalSyncCompareExchange32 (\r
-  IN      volatile UINT32           *Value,\r
-  IN      UINT32                    CompareValue,\r
-  IN      UINT32                    ExchangeValue\r
-  );\r
+#include "BaseLibInternals.h"\r
 \r
 /**\r
   Performs an atomic increment of an 32-bit unsigned integer.\r
index 30e5b15c5f41c0c6b5cbee4aeeb8456cc784aacc..fc634044b9252ff6dceda744172bb6bdb9211b19 100644 (file)
@@ -143,12 +143,15 @@ ReadUnaligned32 (
   IN      CONST UINT32              *Buffer\r
   )\r
 {\r
+  UINT16  LowerBytes;\r
+  UINT16  HigherBytes;\r
+\r
   ASSERT (Buffer != NULL);\r
 \r
-  return (UINT32)(\r
-           ReadUnaligned16 ((UINT16*)Buffer) |\r
-           (ReadUnaligned16 ((UINT16*)Buffer + 1) << 16)\r
-           );\r
+  LowerBytes  = ReadUnaligned16 ((UINT16*) Buffer);\r
+  HigherBytes = ReadUnaligned16 ((UINT16*) Buffer + 1);\r
+\r
+  return (UINT32) (LowerBytes | (HigherBytes << 16));\r
 }\r
 \r
 /**\r
@@ -199,12 +202,15 @@ ReadUnaligned64 (
   IN      CONST UINT64              *Buffer\r
   )\r
 {\r
+  UINT32  LowerBytes;\r
+  UINT32  HigherBytes;\r
+\r
   ASSERT (Buffer != NULL);\r
 \r
-  return (UINT64)(\r
-           ReadUnaligned32 ((UINT32*)Buffer) |\r
-           LShiftU64 (ReadUnaligned32 ((UINT32*)Buffer + 1), 32)\r
-           );\r
+  LowerBytes  = ReadUnaligned32 ((UINT32*) Buffer);\r
+  HigherBytes = ReadUnaligned32 ((UINT32*) Buffer + 1);\r
+\r
+  return (UINT64) (LowerBytes | LShiftU64 (HigherBytes, 32));\r
 }\r
 \r
 /**\r
index 9347a2b57970e56cef2c940b6b20bd715e8d4f62..f588eacd0cc05d646e6b8516ea1878a39281383e 100644 (file)
@@ -14,6 +14,8 @@
 \r
 **/\r
 \r
+#include "BaseLibInternals.h"\r
+\r
 /**\r
   Worker function that locates the Node in the List\r
 \r
index a18c974e9110faaa51f1b56080befd455eec8e12..90a915e233e817b67fa4ff03d4b5a46e6592268e 100644 (file)
 \r
 **/\r
 \r
-/**\r
-  Worker function that checks ASSERT condition for JumpBuffer\r
-\r
-  Checks ASSERT condition for JumpBuffer.\r
-\r
-  If JumpBuffer is NULL, then ASSERT().\r
-  For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r
-\r
-  @param  JumpBuffer    A pointer to CPU context buffer.\r
-\r
-**/\r
-VOID\r
-InternalAssertJumpBuffer (\r
-  IN      BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer\r
-  );\r
-\r
-/**\r
-  Restores the CPU context that was saved with SetJump().\r
-\r
-  Restores the CPU context from the buffer specified by JumpBuffer.\r
-  This function never returns to the caller.\r
-  Instead is resumes execution based on the state of JumpBuffer.\r
-\r
-  @param  JumpBuffer    A pointer to CPU context buffer.\r
-  @param  Value         The value to return when the SetJump() context is restored.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-InternalLongJump (\r
-  IN      BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer,\r
-  IN      UINTN                     Value\r
-  );\r
+#include "BaseLibInternals.h"\r
 \r
 /**\r
   Restores the CPU context that was saved with SetJump().\r
index 3312d789acf03ef4dc2eab6f91e7d5468c630096..514ae9902086210cae22c386989a4fe2acd724e8 100644 (file)
@@ -85,10 +85,13 @@ InternalMathARShiftU64 (
   IN      UINTN                     Count\r
   )\r
 {\r
+  INTN  TestValue;\r
+\r
   //\r
   // Test if this compiler supports arithmetic shift\r
   //\r
-  if ((((-1) << (sizeof (-1) * 8 - 1)) >> (sizeof (-1) * 8 - 1)) == -1) {\r
+  TestValue = (((-1) << (sizeof (-1) * 8 - 1)) >> (sizeof (-1) * 8 - 1));\r
+  if (TestValue == -1) {\r
     //\r
     // Arithmetic shift is supported\r
     //\r
@@ -169,10 +172,13 @@ InternalMathSwapBytes64 (
   IN      UINT64                    Operand\r
   )\r
 {\r
-  return (UINT64)(\r
-           ((UINT64)SwapBytes32 ((UINT32)Operand) << 32) |\r
-           ((UINT64)SwapBytes32 ((UINT32)(Operand >> 32)))\r
-           );\r
+  UINT64  LowerBytes;\r
+  UINT64  HigherBytes;\r
+\r
+  LowerBytes  = (UINT64) SwapBytes32 ((UINT32) Operand);\r
+  HigherBytes = (UINT64) SwapBytes32 ((UINT32) (Operand >> 32));\r
+\r
+  return (LowerBytes << 32 | HigherBytes);\r
 }\r
 \r
 /**\r
index f03479ae81e095a1306aaf418fb38b66ee2ff688..cb77d096116898112846780b1222e9e9b27259e2 100644 (file)
@@ -14,6 +14,8 @@
 \r
 **/\r
 \r
+#include "BaseLibInternals.h"\r
+\r
 /**\r
   Worker function that checks ASSERT condition for JumpBuffer\r
 \r
index 2ac32254fcc8a070c076dcbbb7f7c2baabb5584e..7db468aee55dc79c251f80aeb8cff2009cf39663 100644 (file)
@@ -636,7 +636,7 @@ AsciiToUpper (
   IN      CHAR8                     Chr\r
   )\r
 {\r
-  return (Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr;\r
+  return (UINT8) ((Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr);\r
 }\r
 \r
 /**\r
@@ -675,19 +675,25 @@ AsciiStriCmp (
   IN      CONST CHAR8               *SecondString\r
   )\r
 {\r
+  CHAR8  UpperFirstString;\r
+  CHAR8  UpperSecondString;\r
+\r
   //\r
   // ASSERT both strings are less long than PcdMaximumAsciiStringLength\r
   //\r
   ASSERT (AsciiStrSize (FirstString));\r
   ASSERT (AsciiStrSize (SecondString));\r
 \r
-  while ((*FirstString != '\0') &&\r
-         (AsciiToUpper (*FirstString) == AsciiToUpper (*SecondString))) {\r
+  UpperFirstString  = AsciiToUpper (*FirstString);\r
+  UpperSecondString = AsciiToUpper (*SecondString);\r
+  while ((*FirstString != '\0') && (UpperFirstString == UpperSecondString)) {\r
     FirstString++;\r
     SecondString++;\r
+    UpperFirstString  = AsciiToUpper (*FirstString);\r
+    UpperSecondString = AsciiToUpper (*SecondString);\r
   }\r
 \r
-  return AsciiToUpper (*FirstString) - AsciiToUpper (*SecondString);\r
+  return UpperFirstString - UpperSecondString;\r
 }\r
 \r
 /**\r
@@ -861,7 +867,7 @@ DecimalToBcd8 (
   )\r
 {\r
   ASSERT (Value < 100);\r
-  return ((Value / 10) << 4) | (Value % 10);\r
+  return (UINT8) (((Value / 10) << 4) | (Value % 10));\r
 }\r
 \r
 /**\r
@@ -886,5 +892,5 @@ BcdToDecimal8 (
 {\r
   ASSERT (Value < 0xa0);\r
   ASSERT ((Value & 0xf) < 0xa);\r
-  return (Value >> 4) * 10 + (Value & 0xf);\r
+  return (UINT8) ((Value >> 4) * 10 + (Value & 0xf));\r
 }\r
index c8460a28f7998a56f7664bd8b0977d66e1c660b2..134ccb1ef098583965848bd220ad6039f4fa43ac 100644 (file)
@@ -32,5 +32,5 @@ SwapBytes16 (
   IN      UINT16                    Operand\r
   )\r
 {\r
-  return (Operand << 8) | (Operand >> 8);\r
+  return (UINT16) ((Operand << 8) | (Operand >> 8));\r
 }\r
index 4e683b09d18d397619d67ef02caecc572480cb15..09396dba4e25599904830d1cac953c3b82711bb0 100644 (file)
@@ -32,8 +32,11 @@ SwapBytes32 (
   IN      UINT32                    Operand\r
   )\r
 {\r
-  return (UINT32)(\r
-           ((UINT32)SwapBytes16 ((UINT16)Operand) << 16) |\r
-           ((UINT32)SwapBytes16 ((UINT16)(Operand >> 16)))\r
-           );\r
+  UINT32  LowerBytes;\r
+  UINT32  HigherBytes;\r
+\r
+  LowerBytes  = (UINT32) SwapBytes16 ((UINT16) Operand);\r
+  HigherBytes = (UINT32) SwapBytes16 ((UINT16) (Operand >> 16));\r
+\r
+  return (LowerBytes << 16 | HigherBytes);\r
 }\r
index 18812e242f32949f5d4400402e54bded7c3bf925..e08aa62cf98da10cf02d22d6a54a89d79b771fcd 100644 (file)
 \r
 **/\r
 \r
+#include "BaseLibInternals.h"\r
+\r
 #define SPIN_LOCK_RELEASED          ((SPIN_LOCK)1)\r
 #define SPIN_LOCK_ACQUIRED          ((SPIN_LOCK)2)\r
 \r
-/**\r
-  Performs an atomic increment of an 32-bit unsigned integer.\r
-\r
-  Performs an atomic increment of the 32-bit unsigned integer specified by\r
-  Value and returns the incremented value. The increment operation must be\r
-  performed using MP safe mechanisms. The state of the return value is not\r
-  guaranteed to be MP safe.\r
-\r
-  @param  Value A pointer to the 32-bit value to increment.\r
-\r
-  @return The incremented value.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-InternalSyncIncrement (\r
-  IN      volatile UINT32           *Value\r
-  );\r
-\r
-/**\r
-  Performs an atomic decrement of an 32-bit unsigned integer.\r
-\r
-  Performs an atomic decrement of the 32-bit unsigned integer specified by\r
-  Value and returns the decrement value. The decrement operation must be\r
-  performed using MP safe mechanisms. The state of the return value is not\r
-  guaranteed to be MP safe.\r
-\r
-  @param  Value A pointer to the 32-bit value to decrement.\r
-\r
-  @return The decrement value.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-InternalSyncDecrement (\r
-  IN      volatile UINT32           *Value\r
-  );\r
-\r
-/**\r
-  Performs an atomic compare exchange operation on a 32-bit unsigned integer.\r
-\r
-  Performs an atomic compare exchange operation on the 32-bit unsigned integer\r
-  specified by Value.  If Value is equal to CompareValue, then Value is set to \r
-  ExchangeValue and CompareValue is returned.  If Value is not equal to CompareValue,\r
-  then Value is returned.  The compare exchange operation must be performed using \r
-  MP safe mechanisms.\r
-\r
-  @param  Value         A pointer to the 32-bit value for the compare exchange\r
-                        operation.\r
-  @param  CompareValue  32-bit value used in compare operation.\r
-  @param  ExchangeValue 32-bit value used in exchange operation.\r
-\r
-  @return The original *Value before exchange.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-InternalSyncCompareExchange32 (\r
-  IN      volatile UINT32           *Value,\r
-  IN      UINT32                    CompareValue,\r
-  IN      UINT32                    ExchangeValue\r
-  );\r
-\r
-/**\r
-  Performs an atomic compare exchange operation on a 64-bit unsigned integer.\r
-\r
-  Performs an atomic compare exchange operation on the 64-bit unsigned integer specified \r
-  by Value.  If Value is equal to CompareValue, then Value is set to ExchangeValue and \r
-  CompareValue is returned.  If Value is not equal to CompareValue, then Value is returned. \r
-  The compare exchange operation must be performed using MP safe mechanisms.\r
-\r
-  @param  Value         A pointer to the 64-bit value for the compare exchange\r
-                        operation.\r
-  @param  CompareValue  64-bit value used in compare operation.\r
-  @param  ExchangeValue 64-bit value used in exchange operation.\r
-\r
-  @return The original *Value before exchange.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-InternalSyncCompareExchange64 (\r
-  IN      volatile UINT64           *Value,\r
-  IN      UINT64                    CompareValue,\r
-  IN      UINT64                    ExchangeValue\r
-  );\r
-\r
 /**\r
   Retrieves the architecture specific spin lock alignment requirements for\r
   optimal spin lock performance.\r
@@ -419,7 +334,11 @@ InterlockedCompareExchangePointer (
   IN      VOID                      *ExchangeValue\r
   )\r
 {\r
-  switch (sizeof (*Value)) {\r
+  UINT8  SizeOfValue;\r
+\r
+  SizeOfValue = sizeof (*Value);\r
+\r
+  switch (SizeOfValue) {\r
     case sizeof (UINT32):\r
       return (VOID*)(UINTN)InterlockedCompareExchange32 (\r
                              (UINT32*)Value,\r
index f2106acb18639b879bae8e0771cd08d5ce593183..632061a66862bdb02ff8942b4a55cfa9655224f5 100644 (file)
@@ -17,6 +17,8 @@
 \r
 **/\r
 \r
+#include "MemLibInternals.h"\r
+\r
 /**\r
   Copy Length bytes from Source to Destination.\r
 \r
index 6f50340bd764beb315e103e6611204a2fd81494a..36da5b742424ea92fbe05836e41d9b6587ebac1c 100644 (file)
@@ -77,12 +77,17 @@ CompareGuid (
   IN CONST GUID  *Guid2\r
   )\r
 {\r
-  return (BOOLEAN)(\r
-           ReadUnaligned64 ((CONST UINT64*)Guid1)\r
-             == ReadUnaligned64 ((CONST UINT64*)Guid2) &&\r
-           ReadUnaligned64 ((CONST UINT64*)Guid1 + 1)\r
-             == ReadUnaligned64 ((CONST UINT64*)Guid2 + 1)\r
-           );\r
+  UINT64  LowPartOfGuid1;\r
+  UINT64  LowPartOfGuid2;\r
+  UINT64  HighPartOfGuid1;\r
+  UINT64  HighPartOfGuid2;\r
+\r
+  LowPartOfGuid1  = ReadUnaligned64 ((CONST UINT64*) Guid1);\r
+  LowPartOfGuid2  = ReadUnaligned64 ((CONST UINT64*) Guid2);\r
+  HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);\r
+  HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);\r
+\r
+  return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);\r
 }\r
 \r
 /**\r
index 07acc6fbfee9c0092a0912e8387f283e430f0ab5..d051f2d63bf9f1954363f1db564b755f4a7a4b3f 100644 (file)
@@ -17,6 +17,7 @@
 \r
 **/\r
 \r
+#include "MemLibInternals.h"\r
 \r
 /**\r
   Set Buffer to Value for Size bytes.\r
index 6f50340bd764beb315e103e6611204a2fd81494a..36da5b742424ea92fbe05836e41d9b6587ebac1c 100644 (file)
@@ -77,12 +77,17 @@ CompareGuid (
   IN CONST GUID  *Guid2\r
   )\r
 {\r
-  return (BOOLEAN)(\r
-           ReadUnaligned64 ((CONST UINT64*)Guid1)\r
-             == ReadUnaligned64 ((CONST UINT64*)Guid2) &&\r
-           ReadUnaligned64 ((CONST UINT64*)Guid1 + 1)\r
-             == ReadUnaligned64 ((CONST UINT64*)Guid2 + 1)\r
-           );\r
+  UINT64  LowPartOfGuid1;\r
+  UINT64  LowPartOfGuid2;\r
+  UINT64  HighPartOfGuid1;\r
+  UINT64  HighPartOfGuid2;\r
+\r
+  LowPartOfGuid1  = ReadUnaligned64 ((CONST UINT64*) Guid1);\r
+  LowPartOfGuid2  = ReadUnaligned64 ((CONST UINT64*) Guid2);\r
+  HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);\r
+  HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);\r
+\r
+  return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);\r
 }\r
 \r
 /**\r
index f7deedd6420015f5c85b5db69a26d514740a12a1..9cdac210962946753a34bb2f7e5da936a91638ff 100644 (file)
@@ -40,6 +40,7 @@
   @return The base address of PCI Express.\r
 \r
 **/\r
+STATIC\r
 volatile VOID*\r
 GetPciExpressBaseAddress (\r
   VOID\r
index d82107ecde7813e53a01b76d01bbc945a79191ac..ad3635f2fbc42bce7c9e5a80a32474158967f5af 100644 (file)
 \r
 **/\r
 \r
-\r
-/**\r
-  Performs an Itanium-based specific relocation fixup and is a no-op on other\r
-  instruction sets.\r
-\r
-  @param  Reloc       Pointer to the relocation record.\r
-  @param  Fixup       Pointer to the address to fix up.\r
-  @param  FixupData   Pointer to a buffer to log the fixups.\r
-  @param  Adjust      The offset to adjust the fixup.\r
-\r
-  @return Status code.\r
-\r
-**/\r
-RETURN_STATUS\r
-PeCoffLoaderRelocateImageEx (\r
-  IN UINT16      *Reloc,\r
-  IN OUT CHAR8   *Fixup,\r
-  IN OUT CHAR8   **FixupData,\r
-  IN UINT64      Adjust\r
-  );\r
-\r
-\r
-/**\r
-  Performs an Itanium-based specific re-relocation fixup and is a no-op on other\r
-  instruction sets. This is used to re-relocated the image into the EFI virtual\r
-  space for runtime calls.\r
-\r
-  @param  Reloc       Pointer to the relocation record.\r
-  @param  Fixup       Pointer to the address to fix up.\r
-  @param  FixupData   Pointer to a buffer to log the fixups.\r
-  @param  Adjust      The offset to adjust the fixup.\r
-\r
-  @return Status code.\r
-\r
-**/\r
-RETURN_STATUS\r
-PeHotRelocateImageEx (\r
-  IN UINT16      *Reloc,\r
-  IN OUT CHAR8   *Fixup,\r
-  IN OUT CHAR8   **FixupData,\r
-  IN UINT64      Adjust\r
-  );\r
-\r
-\r
-/**\r
-  Returns TRUE if the machine type of PE/COFF image is supported. Supported\r
-  does not mean the image can be executed it means the PE/COFF loader supports\r
-  loading and relocating of the image type. It's up to the caller to support\r
-  the entry point.\r
-\r
-  @param  Machine   Machine type from the PE Header.\r
-\r
-  @return TRUE if this PE/COFF loader can load the image\r
-\r
-**/\r
-BOOLEAN\r
-PeCoffLoaderImageFormatSupported (\r
-  IN  UINT16  Machine\r
-  );\r
-\r
+#include "BasePeCoffLibInternals.h"\r
 \r
 /**\r
   Retrieves the magic value from the PE/COFF header.\r
index 09698a48896d71942434fefd88a9c98452b055e9..b3d754d570cbac37eca5daf61a7364c6169753fa 100644 (file)
@@ -34,6 +34,7 @@
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>BasePeCoff.c</Filename>\r
+    <Filename>BasePeCoffLibInternals.h</Filename>\r
     <Filename SupArchList="IA32">Ia32/PeCoffLoaderEx.c</Filename>\r
     <Filename SupArchList="X64">x64/PeCoffLoaderEx.c</Filename>\r
     <Filename SupArchList="IPF">Ipf/PeCoffLoaderEx.c</Filename>\r
diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h b/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h
new file mode 100644 (file)
index 0000000..3d4d71a
--- /dev/null
@@ -0,0 +1,124 @@
+/** @file\r
+  Declaration of internal functions in PE/COFF Lib.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\r
+  All rights reserved. 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
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  BasePeCoffLibInternals.h\r
+\r
+**/\r
+\r
+#ifndef __BASE_PECOFF_LIB_INTERNALS__\r
+#define __BASE_PECOFF_LIB_INTERNALS__\r
+\r
+/**\r
+  Performs an Itanium-based specific relocation fixup and is a no-op on other\r
+  instruction sets.\r
+\r
+  @param  Reloc       Pointer to the relocation record.\r
+  @param  Fixup       Pointer to the address to fix up.\r
+  @param  FixupData   Pointer to a buffer to log the fixups.\r
+  @param  Adjust      The offset to adjust the fixup.\r
+\r
+  @return Status code.\r
+\r
+**/\r
+RETURN_STATUS\r
+PeCoffLoaderRelocateImageEx (\r
+  IN UINT16      *Reloc,\r
+  IN OUT CHAR8   *Fixup,\r
+  IN OUT CHAR8   **FixupData,\r
+  IN UINT64      Adjust\r
+  );\r
+\r
+\r
+/**\r
+  Performs an Itanium-based specific re-relocation fixup and is a no-op on other\r
+  instruction sets. This is used to re-relocated the image into the EFI virtual\r
+  space for runtime calls.\r
+\r
+  @param  Reloc       Pointer to the relocation record.\r
+  @param  Fixup       Pointer to the address to fix up.\r
+  @param  FixupData   Pointer to a buffer to log the fixups.\r
+  @param  Adjust      The offset to adjust the fixup.\r
+\r
+  @return Status code.\r
+\r
+**/\r
+RETURN_STATUS\r
+PeHotRelocateImageEx (\r
+  IN UINT16      *Reloc,\r
+  IN OUT CHAR8   *Fixup,\r
+  IN OUT CHAR8   **FixupData,\r
+  IN UINT64      Adjust\r
+  );\r
+\r
+\r
+/**\r
+  Returns TRUE if the machine type of PE/COFF image is supported. Supported\r
+  does not mean the image can be executed it means the PE/COFF loader supports\r
+  loading and relocating of the image type. It's up to the caller to support\r
+  the entry point.\r
+\r
+  @param  Machine   Machine type from the PE Header.\r
+\r
+  @return TRUE if this PE/COFF loader can load the image\r
+\r
+**/\r
+BOOLEAN\r
+PeCoffLoaderImageFormatSupported (\r
+  IN  UINT16  Machine\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
+PeCoffLoaderGetPeHeaderMagicValue (\r
+  IN  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr\r
+  );\r
+\r
+/**\r
+  Retrieves the PE or TE Header from a PE/COFF or TE image.\r
+\r
+  @param  ImageContext    The context of the image being loaded.\r
+  @param  Hdr             The buffer in which to return the PE32, PE32+, or TE header.\r
+\r
+  @retval RETURN_SUCCESS  The PE or TE Header is read.\r
+  @retval Other           The error status from reading the PE/COFF or TE image using the ImageRead function.\r
+\r
+**/\r
+RETURN_STATUS\r
+PeCoffLoaderGetPeHeader (\r
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext,\r
+  OUT    EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr\r
+  );\r
+\r
+/**\r
+  Converts an image address to the loaded address.\r
+\r
+  @param  ImageContext  The context of the image being loaded.\r
+  @param  Address       The address to be converted to the loaded address.\r
+\r
+  @return The converted address or NULL if the address can not be converted.\r
+\r
+**/\r
+VOID *\r
+PeCoffLoaderImageAddress (\r
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT          *ImageContext,\r
+  IN     UINTN                                 Address\r
+  );\r
+\r
+#endif\r
index babf7ca3a2367574fae874d0605795304d77b097..065aec42ac36c2cebcb6d7ae2250231c52757bac 100644 (file)
@@ -14,7 +14,7 @@
 \r
 **/\r
 \r
-\r
+#include "BasePeCoffLibInternals.h"\r
 \r
 \r
 \r
index 406acb5ca07522c43a587ebc12313a3e03a30707..b08617c3cc1944d2a11e5e9a5fca3822c2c1389d 100644 (file)
@@ -156,5 +156,5 @@ PerformanceMeasurementEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);\r
 }\r
index 37f060228b513a7ed3e03297896ef5ba1dcd0ba3..a4996d326a13378b02fe9ee2474035b2b9c42e9c 100644 (file)
@@ -96,7 +96,7 @@ PostCodeEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -118,5 +118,5 @@ PostCodeDescriptionEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
 }\r
index 93c24d5eb6b4e86fa565d8efcdccd79ad912f027..3dfd024c2d8fe31f8380e73a4d4e71bc6ee0e255 100644 (file)
@@ -96,7 +96,7 @@ PostCodeEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -119,5 +119,5 @@ PostCodeDescriptionEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
 }\r
index e0928b8c8035515d647e7b9d5c4bc184476f775e..5a63cbb8b79f06938bbf280ba182a4dffb57818b 100644 (file)
@@ -51,6 +51,34 @@ typedef struct {
   UINT8   Pad2;\r
 } TIME;\r
 \r
+/**\r
+  Worker function that produces a Null-terminated string in an output buffer \r
+  based on a Null-terminated format string and a VA_LIST argument list.\r
+\r
+  VSPrint function to process format and place the results in Buffer. Since a \r
+  VA_LIST is used this rountine allows the nesting of Vararg routines. Thus \r
+  this is the main print working routine.\r
+\r
+  @param  Buffer      Character buffer to print the results of the parsing\r
+                      of Format into.\r
+  @param  BufferSize  Maximum number of characters to put into buffer.\r
+  @param  Flags       Intial flags value.\r
+                      Can only have FORMAT_UNICODE and OUTPUT_UNICODE set.\r
+  @param  Format      Null-terminated format string.\r
+  @param  Marker      Vararg list consumed by processing Format.\r
+\r
+  @return Number of characters printed not including the Null-terminator.\r
+\r
+**/\r
+UINTN\r
+BasePrintLibVSPrint (\r
+  OUT CHAR8        *Buffer,\r
+  IN  UINTN        BufferSize,\r
+  IN  UINTN        Flags,\r
+  IN  CONST CHAR8  *Format,\r
+  IN  VA_LIST      Marker\r
+  );\r
+\r
 /**\r
   Worker function that produces a Null-terminated string in an output buffer \r
   based on a Null-terminated format string and variable argument list.\r
index a33641776085adfac13368b46aee2cecc6008a56..e70dc88ef11cda8a642567570090b112d1633a4f 100644 (file)
 \r
 **/\r
 \r
-//\r
-// Decompression algorithm begins here\r
-//\r
-#define BITBUFSIZ 32\r
-#define MAXMATCH  256\r
-#define THRESHOLD 3\r
-#define CODE_BIT  16\r
-#define BAD_TABLE - 1\r
-\r
-//\r
-// C: Char&Len Set; P: Position Set; T: exTra Set\r
-//\r
-#define NC      (0xff + MAXMATCH + 2 - THRESHOLD)\r
-#define CBIT    9\r
-#define MAXPBIT 5\r
-#define TBIT    5\r
-#define MAXNP   ((1U << MAXPBIT) - 1)\r
-#define NT      (CODE_BIT + 3)\r
-#if NT > MAXNP\r
-#define NPT NT\r
-#else\r
-#define NPT MAXNP\r
-#endif\r
-\r
-typedef struct {\r
-  UINT8   *mSrcBase;  ///< Starting address of compressed data\r
-  UINT8   *mDstBase;  ///< Starting address of decompressed data\r
-  UINT32  mOutBuf;\r
-  UINT32  mInBuf;\r
-\r
-  UINT16  mBitCount;\r
-  UINT32  mBitBuf;\r
-  UINT32  mSubBitBuf;\r
-  UINT16  mBlockSize;\r
-  UINT32  mCompSize;\r
-  UINT32  mOrigSize;\r
-\r
-  UINT16  mBadTableFlag;\r
-\r
-  UINT16  mLeft[2 * NC - 1];\r
-  UINT16  mRight[2 * NC - 1];\r
-  UINT8   mCLen[NC];\r
-  UINT8   mPTLen[NPT];\r
-  UINT16  mCTable[4096];\r
-  UINT16  mPTTable[256];\r
-\r
-  ///\r
-  /// The length of the field 'Position Set Code Length Array Size' in Block Header.\r
-  /// For EFI 1.1 de/compression algorithm, mPBit = 4\r
-  /// For Tiano de/compression algorithm, mPBit = 5\r
-  ///\r
-  UINT8   mPBit;\r
-} SCRATCH_DATA;\r
+#include "BaseUefiDecompressLibInternals.h"\r
 \r
 /**\r
   Read NumOfBit of bits from source into mBitBuf\r
@@ -195,6 +143,9 @@ MakeTable (
   UINT16  Avail;\r
   UINT16  NextCode;\r
   UINT16  Mask;\r
+  UINT16  WordOfStart;\r
+  UINT16  WordOfCount;\r
+\r
 \r
   for (Index = 1; Index <= 16; Index++) {\r
     Count[Index] = 0;\r
@@ -207,7 +158,9 @@ MakeTable (
   Start[1] = 0;\r
 \r
   for (Index = 1; Index <= 16; Index++) {\r
-    Start[Index + 1] = (UINT16) (Start[Index] + (Count[Index] << (16 - Index)));\r
+    WordOfStart = Start[Index];\r
+    WordOfCount = Count[Index];\r
+    Start[Index + 1] = (UINT16) (WordOfStart + (WordOfCount << (16 - Index)));\r
   }\r
 \r
   if (Start[17] != 0) {\r
@@ -627,7 +580,7 @@ Decode (
     // \r
     CharC = DecodeC (Sd);\r
     if (Sd->mBadTableFlag != 0) {\r
-      return ;\r
+      goto Done;\r
     }\r
 \r
     if (CharC < 256) {\r
@@ -635,7 +588,7 @@ Decode (
       // Process an Original character\r
       //\r
       if (Sd->mOutBuf >= Sd->mOrigSize) {\r
-        return ;\r
+        goto Done;\r
       } else {\r
         //\r
         // Write orignal character into mDstBase\r
@@ -666,7 +619,7 @@ Decode (
       while ((INT16) (BytesRemain) >= 0) {\r
         Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];\r
         if (Sd->mOutBuf >= Sd->mOrigSize) {\r
-          return ;\r
+          goto Done;\r
         }\r
 \r
         BytesRemain--;\r
@@ -674,6 +627,7 @@ Decode (
     }\r
   }\r
 \r
+Done:\r
   return ;\r
 }\r
 \r
index 08ac9af7f114641adc4179f9b2093688a13575da..6302302d183ba1cb7b364f75821800a2a8387d45 100644 (file)
@@ -34,6 +34,7 @@
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>BaseUefiDecompressLib.c</Filename>\r
+    <Filename>BaseUefiDecompressLibInternals.h</Filename>\r
   </SourceFiles>\r
   <PackageDependencies>\r
     <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
diff --git a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h
new file mode 100644 (file)
index 0000000..70ae3f2
--- /dev/null
@@ -0,0 +1,215 @@
+/** @file\r
+  Internal include file for Base UEFI Decompress Libary.\r
+\r
+  Copyright (c) 2006, Intel Corporation\r
+  All rights reserved. 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
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  BaseUefiDecompressLibInternals.h\r
+\r
+**/\r
+\r
+#ifndef __BASE_UEFI_DECOMPRESS_LIB_INTERNALS_H__\r
+#define __BASE_UEFI_DECOMPRESS_LIB_INTERNALS_H__\r
+\r
+//\r
+// Decompression algorithm begins here\r
+//\r
+#define BITBUFSIZ 32\r
+#define MAXMATCH  256\r
+#define THRESHOLD 3\r
+#define CODE_BIT  16\r
+#define BAD_TABLE - 1\r
+\r
+//\r
+// C: Char&Len Set; P: Position Set; T: exTra Set\r
+//\r
+#define NC      (0xff + MAXMATCH + 2 - THRESHOLD)\r
+#define CBIT    9\r
+#define MAXPBIT 5\r
+#define TBIT    5\r
+#define MAXNP   ((1U << MAXPBIT) - 1)\r
+#define NT      (CODE_BIT + 3)\r
+#if NT > MAXNP\r
+#define NPT NT\r
+#else\r
+#define NPT MAXNP\r
+#endif\r
+\r
+typedef struct {\r
+  UINT8   *mSrcBase;  ///< Starting address of compressed data\r
+  UINT8   *mDstBase;  ///< Starting address of decompressed data\r
+  UINT32  mOutBuf;\r
+  UINT32  mInBuf;\r
+\r
+  UINT16  mBitCount;\r
+  UINT32  mBitBuf;\r
+  UINT32  mSubBitBuf;\r
+  UINT16  mBlockSize;\r
+  UINT32  mCompSize;\r
+  UINT32  mOrigSize;\r
+\r
+  UINT16  mBadTableFlag;\r
+\r
+  UINT16  mLeft[2 * NC - 1];\r
+  UINT16  mRight[2 * NC - 1];\r
+  UINT8   mCLen[NC];\r
+  UINT8   mPTLen[NPT];\r
+  UINT16  mCTable[4096];\r
+  UINT16  mPTTable[256];\r
+\r
+  ///\r
+  /// The length of the field 'Position Set Code Length Array Size' in Block Header.\r
+  /// For EFI 1.1 de/compression algorithm, mPBit = 4\r
+  /// For Tiano de/compression algorithm, mPBit = 5\r
+  ///\r
+  UINT8   mPBit;\r
+} SCRATCH_DATA;\r
+\r
+/**\r
+  Read NumOfBit of bits from source into mBitBuf\r
+\r
+  Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.\r
+\r
+  @param  Sd        The global scratch data\r
+  @param  NumOfBits The number of bits to shift and read.\r
+\r
+**/\r
+VOID\r
+FillBuf (\r
+  IN  SCRATCH_DATA  *Sd,\r
+  IN  UINT16        NumOfBits\r
+  );\r
+\r
+/**\r
+  Get NumOfBits of bits out from mBitBuf\r
+\r
+  Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent \r
+  NumOfBits of bits from source. Returns NumOfBits of bits that are \r
+  popped out.\r
+\r
+  @param  Sd        The global scratch data.\r
+  @param  NumOfBits The number of bits to pop and read.\r
+\r
+  @return The bits that are popped out.\r
+\r
+**/\r
+UINT32\r
+GetBits (\r
+  IN  SCRATCH_DATA  *Sd,\r
+  IN  UINT16        NumOfBits\r
+  );\r
+\r
+/**\r
+  Creates Huffman Code mapping table according to code length array.\r
+\r
+  Creates Huffman Code mapping table for Extra Set, Char&Len Set \r
+  and Position Set according to code length array.\r
+\r
+  @param  Sd        The global scratch data\r
+  @param  NumOfChar Number of symbols in the symbol set\r
+  @param  BitLen    Code length array\r
+  @param  TableBits The width of the mapping table\r
+  @param  Table     The table\r
+\r
+  @retval  0 OK.\r
+  @retval  BAD_TABLE The table is corrupted.\r
+\r
+**/\r
+UINT16\r
+MakeTable (\r
+  IN  SCRATCH_DATA  *Sd,\r
+  IN  UINT16        NumOfChar,\r
+  IN  UINT8         *BitLen,\r
+  IN  UINT16        TableBits,\r
+  OUT UINT16        *Table\r
+  );\r
+\r
+/**\r
+  Decodes a position value.\r
+\r
+  Get a position value according to Position Huffman Table.\r
+  \r
+  @param  Sd the global scratch data\r
+\r
+  @return The position value decoded.\r
+\r
+**/\r
+UINT32\r
+DecodeP (\r
+  IN  SCRATCH_DATA  *Sd\r
+  );\r
+\r
+/**\r
+  Reads code lengths for the Extra Set or the Position Set.\r
+\r
+  Read in the Extra Set or Pointion Set Length Arrary, then\r
+  generate the Huffman code mapping for them.\r
+\r
+  @param  Sd      The global scratch data.\r
+  @param  nn      Number of symbols.\r
+  @param  nbit    Number of bits needed to represent nn.\r
+  @param  Special The special symbol that needs to be taken care of.\r
+\r
+  @retval  0 OK.\r
+  @retval  BAD_TABLE Table is corrupted.\r
+\r
+**/\r
+UINT16\r
+ReadPTLen (\r
+  IN  SCRATCH_DATA  *Sd,\r
+  IN  UINT16        nn,\r
+  IN  UINT16        nbit,\r
+  IN  UINT16        Special\r
+  );\r
+\r
+/**\r
+  Reads code lengths for Char&Len Set.\r
+  \r
+  Read in and decode the Char&Len Set Code Length Array, then\r
+  generate the Huffman Code mapping table for the Char&Len Set.\r
+\r
+  @param  Sd the global scratch data\r
+\r
+**/\r
+VOID\r
+ReadCLen (\r
+  SCRATCH_DATA  *Sd\r
+  );\r
+\r
+/**\r
+  Decode a character/length value.\r
+  \r
+  Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates\r
+  Huffman code mapping table for Extra Set, Code&Len Set and\r
+  Position Set.\r
+\r
+  @param  Sd The global scratch data.\r
+\r
+  @return The value decoded.\r
+\r
+**/\r
+UINT16\r
+DecodeC (\r
+  SCRATCH_DATA  *Sd\r
+  );\r
+\r
+/**\r
+  Decode the source data and put the resulting data into the destination buffer.\r
+\r
+  Decode the source data and put the resulting data into the destination buffer.\r
+  \r
+  @param  Sd The global scratch data\r
+\r
+**/\r
+VOID\r
+Decode (\r
+  SCRATCH_DATA  *Sd\r
+  );\r
+\r
+#endif\r
index edd69fbde4e8cddab7ecb1c54a69564b40960f0d..3a455c11e79d9df488265168e858d9d1b753dbb0 100644 (file)
@@ -35,6 +35,7 @@
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>HobLib.c</Filename>\r
+    <Filename>HobLib.h</Filename>\r
   </SourceFiles>\r
   <PackageDependencies>\r
     <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
index 43889df497f2b3adf077963f96e27af1c9922b5e..9901c6fb6d83c2e1e7d46e47fd6ecc900b6f006f 100644 (file)
 \r
 **/\r
 \r
-\r
-\r
-extern VOID *gHobList;\r
-\r
+#include "HobLib.h"\r
 \r
 /**\r
   Returns the pointer to the HOB list.\r
diff --git a/MdePkg/Library/DxeCoreHobLib/HobLib.h b/MdePkg/Library/DxeCoreHobLib/HobLib.h
new file mode 100644 (file)
index 0000000..8f03476
--- /dev/null
@@ -0,0 +1,22 @@
+/** @file\r
+  Internal include file of DXE Entry Point HOB Library.\r
+\r
+  Copyright (c) 2006, Intel Corporation\r
+  All rights reserved. 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
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  HobLib.h\r
+\r
+**/\r
+\r
+#ifndef __DXE_ENTRY_POINT_HOB_LIB_H__\r
+#define __DXE_ENTRY_POINT_HOB_LIB_H__\r
+\r
+extern VOID *gHobList;\r
+\r
+#endif\r
diff --git a/MdePkg/Library/DxeIoLibCpuIo/DxeCpuIoLibInternal.h b/MdePkg/Library/DxeIoLibCpuIo/DxeCpuIoLibInternal.h
new file mode 100644 (file)
index 0000000..11a5f6e
--- /dev/null
@@ -0,0 +1,107 @@
+/** @file\r
+  Internal include file of DXE CPU IO Library.\r
+\r
+  Copyright (c) 2006, Intel Corporation\r
+  All rights reserved. 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
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  DxeCpuIoLibInternal.h\r
+\r
+**/\r
+\r
+#ifndef __DXE_CPUIO_LIB_INTERNAL_H__\r
+#define __DXE_CPUIO_LIB_INTERNAL_H__\r
+\r
+/**\r
+  Reads registers in the EFI CPU I/O space.\r
+\r
+  Reads the I/O port specified by Port with registers width specified by Width.\r
+  The read value is returned. If such operations are not supported, then ASSERT().\r
+  This function must guarantee that all I/O read and write operations are serialized.\r
+\r
+  @param  Port          The base address of the I/O operation.\r
+                        The caller is responsible for aligning the Address if required.\r
+  @param  Width         The width of the I/O operation.\r
+\r
+  @return Data read from registers in the EFI CPU I/O space.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+IoReadWorker (\r
+  IN      UINTN                     Port,\r
+  IN      EFI_CPU_IO_PROTOCOL_WIDTH Width\r
+  );\r
+\r
+/**\r
+  Writes registers in the EFI CPU I/O space.\r
+\r
+  Writes the I/O port specified by Port with registers width and value specified by Width\r
+  and Data respectively.  Data is returned. If such operations are not supported, then ASSERT().\r
+  This function must guarantee that all I/O read and write operations are serialized.\r
+\r
+  @param  Port          The base address of the I/O operation.\r
+                        The caller is responsible for aligning the Address if required.\r
+  @param  Width         The width of the I/O operation.\r
+  @param  Data          The value to write to the I/O port.\r
+\r
+  @return The paramter of Data.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+IoWriteWorker (\r
+  IN      UINTN                     Port,\r
+  IN      EFI_CPU_IO_PROTOCOL_WIDTH Width,\r
+  IN      UINT64                    Data\r
+  );\r
+\r
+/**\r
+  Reads memory-mapped registers in the EFI system memory space.\r
+\r
+  Reads the MMIO registers specified by Address with registers width specified by Width.\r
+  The read value is returned. If such operations are not supported, then ASSERT().\r
+  This function must guarantee that all MMIO read and write operations are serialized.\r
+\r
+  @param  Address       The MMIO register to read.\r
+                        The caller is responsible for aligning the Address if required.\r
+  @param  Width         The width of the I/O operation.\r
+\r
+  @return Data read from registers in the EFI system memory space.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+MmioReadWorker (\r
+  IN      UINTN                     Address,\r
+  IN      EFI_CPU_IO_PROTOCOL_WIDTH Width\r
+  );\r
+\r
+/**\r
+  Writes memory-mapped registers in the EFI system memory space.\r
+\r
+  Writes the MMIO registers specified by Address with registers width and value specified by Width\r
+  and Data respectively. Data is returned. If such operations are not supported, then ASSERT().\r
+  This function must guarantee that all MMIO read and write operations are serialized.\r
+\r
+  @param  Address       The MMIO register to read.\r
+                        The caller is responsible for aligning the Address if required.\r
+  @param  Width         The width of the I/O operation.\r
+\r
+  @return Data read from registers in the EFI system memory space.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+MmioWriteWorker (\r
+  IN      UINTN                     Address,\r
+  IN      EFI_CPU_IO_PROTOCOL_WIDTH Width,\r
+  IN      UINT64                    Data\r
+  );\r
+\r
+#endif\r
index c570679b1511a1d84faac659fb765e4e67787c92..8309d58192243228d4a79ff65090e540643b5db5 100644 (file)
@@ -39,6 +39,7 @@
   <SourceFiles>\r
     <Filename>IoLib.c</Filename>\r
     <Filename>IoHighLevel.c</Filename>\r
+    <Filename>DxeCpuIoLibInternal.h</Filename>\r
   </SourceFiles>\r
   <PackageDependencies>\r
     <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
index 0d8d0de8f402c26c9547598497bc1a533dea6ad2..ed09b4e5aa27f7cf93854c3b018b26126f768ec8 100644 (file)
@@ -48,7 +48,7 @@ IoOr8 (
   IN      UINT8                     OrData\r
   )\r
 {\r
-  return IoWrite8 (Port, IoRead8 (Port) | OrData);\r
+  return IoWrite8 (Port, (UINT8) (IoRead8 (Port) | OrData));\r
 }\r
 \r
 /**\r
@@ -76,7 +76,7 @@ IoAnd8 (
   IN      UINT8                     AndData\r
   )\r
 {\r
-  return IoWrite8 (Port, IoRead8 (Port) & AndData);\r
+  return IoWrite8 (Port, (UINT8) (IoRead8 (Port) & AndData));\r
 }\r
 \r
 /**\r
@@ -107,7 +107,7 @@ IoAndThenOr8 (
   IN      UINT8                     OrData\r
   )\r
 {\r
-  return IoWrite8 (Port, (IoRead8 (Port) & AndData) | OrData);\r
+  return IoWrite8 (Port, (UINT8) ((IoRead8 (Port) & AndData) | OrData));\r
 }\r
 \r
 /**\r
@@ -328,7 +328,7 @@ IoOr16 (
   IN      UINT16                    OrData\r
   )\r
 {\r
-  return IoWrite16 (Port, IoRead16 (Port) | OrData);\r
+  return IoWrite16 (Port, (UINT16) (IoRead16 (Port) | OrData));\r
 }\r
 \r
 /**\r
@@ -356,7 +356,7 @@ IoAnd16 (
   IN      UINT16                    AndData\r
   )\r
 {\r
-  return IoWrite16 (Port, IoRead16 (Port) & AndData);\r
+  return IoWrite16 (Port, (UINT16) (IoRead16 (Port) & AndData));\r
 }\r
 \r
 /**\r
@@ -387,7 +387,7 @@ IoAndThenOr16 (
   IN      UINT16                    OrData\r
   )\r
 {\r
-  return IoWrite16 (Port, (IoRead16 (Port) & AndData) | OrData);\r
+  return IoWrite16 (Port, (UINT16) ((IoRead16 (Port) & AndData) | OrData));\r
 }\r
 \r
 /**\r
@@ -1168,7 +1168,7 @@ MmioOr8 (
   IN      UINT8                     OrData\r
   )\r
 {\r
-  return MmioWrite8 (Address, MmioRead8 (Address) | OrData);\r
+  return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) | OrData));\r
 }\r
 \r
 /**\r
@@ -1196,7 +1196,7 @@ MmioAnd8 (
   IN      UINT8                     AndData\r
   )\r
 {\r
-  return MmioWrite8 (Address, MmioRead8 (Address) & AndData);\r
+  return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) & AndData));\r
 }\r
 \r
 /**\r
@@ -1228,7 +1228,7 @@ MmioAndThenOr8 (
   IN      UINT8                     OrData\r
   )\r
 {\r
-  return MmioWrite8 (Address, (MmioRead8 (Address) & AndData) | OrData);\r
+  return MmioWrite8 (Address, (UINT8) ((MmioRead8 (Address) & AndData) | OrData));\r
 }\r
 \r
 /**\r
@@ -1450,7 +1450,7 @@ MmioOr16 (
   IN      UINT16                    OrData\r
   )\r
 {\r
-  return MmioWrite16 (Address, MmioRead16 (Address) | OrData);\r
+  return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) | OrData));\r
 }\r
 \r
 /**\r
@@ -1478,7 +1478,7 @@ MmioAnd16 (
   IN      UINT16                    AndData\r
   )\r
 {\r
-  return MmioWrite16 (Address, MmioRead16 (Address) & AndData);\r
+  return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) & AndData));\r
 }\r
 \r
 /**\r
@@ -1510,7 +1510,7 @@ MmioAndThenOr16 (
   IN      UINT16                    OrData\r
   )\r
 {\r
-  return MmioWrite16 (Address, (MmioRead16 (Address) & AndData) | OrData);\r
+  return MmioWrite16 (Address, (UINT16) ((MmioRead16 (Address) & AndData) | OrData));\r
 }\r
 \r
 /**\r
index 4736c561dce609fa5bb3b4d071605c7c8c1206f9..64ba3480efa57ddcf1a9561f0f1365a84eb6d4ff 100644 (file)
@@ -14,6 +14,8 @@
 \r
 **/\r
 \r
+#include "DxeCpuIoLibInternal.h"\r
+\r
 //\r
 // Globle varible to cache pointer to CpuIo protocol.\r
 //\r
index 12d5ea35f105b4b3240178b223ac8beebf8de84b..6f9330b3604bb5ef61baabf7087080f38c1de7e1 100644 (file)
@@ -38,6 +38,7 @@
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>MemoryAllocationLib.c</Filename>\r
+    <Filename>MemoryAllocationLibInternals.h</Filename>\r
   </SourceFiles>\r
   <PackageDependencies>\r
     <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
index ab020ddc95514cbd821f52b709df1757f14b2d98..f67473af66b428279246d12120d67a88ca591450 100644 (file)
@@ -14,6 +14,7 @@
 \r
 **/\r
 \r
+#include "MemoryAllocationLibInternals.h"\r
 \r
 /**\r
   Allocates one or more 4KB pages of a certain memory type.\r
diff --git a/MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLibInternals.h b/MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLibInternals.h
new file mode 100644 (file)
index 0000000..1234e2e
--- /dev/null
@@ -0,0 +1,200 @@
+/** @file\r
+  Internal include file of DXE Memory Allocation Library.\r
+\r
+  Copyright (c) 2006, Intel Corporation\r
+  All rights reserved. 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
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  MemoryAllocationLibInternals.h\r
+\r
+**/\r
+\r
+#ifndef __DXE_MEMORY_ALLOCATION_LIB_INTERNALS_H__\r
+#define __DXE_MEMORY_ALLOCATION_LIB_INTERNALS_H__\r
+\r
+/**\r
+  Allocates one or more 4KB pages of a certain memory type.\r
+\r
+  Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated\r
+  buffer.  The buffer returned is aligned on a 4KB boundary.  If Pages is 0, then NULL is returned.\r
+  If there is not enough memory remaining to satisfy the request, then NULL is returned.\r
+\r
+  @param  MemoryType            The type of memory to allocate.\r
+  @param  Pages                 The number of 4 KB pages to allocate.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocatePages (\r
+  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN UINTN            Pages\r
+  );\r
+\r
+/**\r
+  Allocates one or more 4KB pages of a certain memory type at a specified alignment.\r
+\r
+  Allocates the number of 4KB pages specified by Pages of a certain memory type with an alignment\r
+  specified by Alignment.  The allocated buffer is returned.  If Pages is 0, then NULL is returned.\r
+  If there is not enough memory at the specified alignment remaining to satisfy the request, then\r
+  NULL is returned.\r
+  If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
+\r
+  @param  MemoryType            The type of memory to allocate.\r
+  @param  Pages                 The number of 4 KB pages to allocate.\r
+  @param  Alignment             The requested alignment of the allocation.  Must be a power of two.\r
+                                If Alignment is zero, then byte alignment is used.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocateAlignedPages (\r
+  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN UINTN            Pages,\r
+  IN UINTN            Alignment\r
+  );\r
+\r
+/**\r
+  Allocates a buffer of a certain pool type.\r
+\r
+  Allocates the number bytes specified by AllocationSize of a certain pool type and returns a\r
+  pointer to the allocated buffer.  If AllocationSize is 0, then a valid buffer of 0 size is\r
+  returned.  If there is not enough memory remaining to satisfy the request, then NULL is returned.\r
+\r
+  @param  MemoryType            The type of memory to allocate.\r
+  @param  AllocationSize        The number of bytes to allocate.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocatePool (\r
+  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN UINTN            AllocationSize\r
+  );\r
+\r
+/**\r
+  Allocates and zeros a buffer of a certian pool type.\r
+\r
+  Allocates the number bytes specified by AllocationSize of a certian pool type, clears the buffer\r
+  with zeros, and returns a pointer to the allocated buffer.  If AllocationSize is 0, then a valid\r
+  buffer of 0 size is returned.  If there is not enough memory remaining to satisfy the request,\r
+  then NULL is returned.\r
+\r
+  @param  PoolType              The type of memory to allocate.\r
+  @param  AllocationSize        The number of bytes to allocate and zero.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocateZeroPool (\r
+  IN EFI_MEMORY_TYPE  PoolType,  \r
+  IN UINTN            AllocationSize\r
+  );\r
+\r
+/**\r
+  Copies a buffer to an allocated buffer of a certian pool type.\r
+\r
+  Allocates the number bytes specified by AllocationSize of a certian pool type, copies\r
+  AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the\r
+  allocated buffer.  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there\r
+  is not enough memory remaining to satisfy the request, then NULL is returned.\r
+  If Buffer is NULL, then ASSERT().\r
+  If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+\r
+  @param  PoolType              The type of pool to allocate.\r
+  @param  AllocationSize        The number of bytes to allocate and zero.\r
+  @param  Buffer                The buffer to copy to the allocated buffer.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocateCopyPool (\r
+  IN EFI_MEMORY_TYPE  PoolType,  \r
+  IN UINTN            AllocationSize,\r
+  IN CONST VOID       *Buffer\r
+  );\r
+\r
+/**\r
+  Allocates a buffer of a certain pool type at a specified alignment.\r
+\r
+  Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r
+  specified by Alignment.  The allocated buffer is returned.  If AllocationSize is 0, then a valid\r
+  buffer of 0 size is returned.  If there is not enough memory at the specified alignment remaining\r
+  to satisfy the request, then NULL is returned.\r
+  If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
+\r
+  @param  PoolType              The type of pool to allocate.\r
+  @param  AllocationSize        The number of bytes to allocate.\r
+  @param  Alignment             The requested alignment of the allocation.  Must be a power of two.                            If Alignment is zero, then byte alignment is used.\r
+                                If Alignment is zero, then byte alignment is used.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocateAlignedPool (\r
+  IN EFI_MEMORY_TYPE  PoolType,\r
+  IN UINTN            AllocationSize,\r
+  IN UINTN            Alignment\r
+  );\r
+\r
+/**\r
+  Allocates and zeros a buffer of a certain pool type at a specified alignment.\r
+\r
+  Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r
+  specified by Alignment, clears the buffer with zeros, and returns a pointer to the allocated\r
+  buffer.  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there is not\r
+  enough memory at the specified alignment remaining to satisfy the request, then NULL is returned.\r
+  If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
+\r
+  @param  PoolType              The type of pool to allocate.\r
+  @param  AllocationSize        The number of bytes to allocate.\r
+  @param  Alignment             The requested alignment of the allocation.  Must be a power of two.\r
+                                If Alignment is zero, then byte alignment is used.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocateAlignedZeroPool (\r
+  IN EFI_MEMORY_TYPE  PoolType,\r
+  IN UINTN            AllocationSize,\r
+  IN UINTN            Alignment\r
+  );\r
+\r
+/**\r
+  Copies a buffer to an allocated buffer of a certain pool type at a specified alignment.\r
+\r
+  Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r
+  specified by Alignment.  The allocated buffer is returned.  If AllocationSize is 0, then a valid\r
+  buffer of 0 size is returned.  If there is not enough memory at the specified alignment remaining\r
+  to satisfy the request, then NULL is returned.\r
+  If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
+\r
+  @param  PoolType              The type of pool to allocate.\r
+  @param  AllocationSize        The number of bytes to allocate.\r
+  @param  Buffer                The buffer to copy to the allocated buffer.\r
+  @param  Alignment             The requested alignment of the allocation.  Must be a power of two.\r
+                                If Alignment is zero, then byte alignment is used.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocateAlignedCopyPool (\r
+  IN EFI_MEMORY_TYPE  PoolType,\r
+  IN UINTN            AllocationSize,\r
+  IN CONST VOID       *Buffer,\r
+  IN UINTN            Alignment\r
+  );\r
+\r
+#endif\r
index f8f8e30d0a6520d4ecd0a21b7223e31b5836120c..37182db2b524cad07d06d85aa731de0778ae0af0 100644 (file)
@@ -14,6 +14,8 @@
 \r
 **/\r
 \r
+#include "MemLibInternals.h"\r
+\r
 VOID *\r
 EFIAPI\r
 InternalMemCopyMem (\r
index 6f50340bd764beb315e103e6611204a2fd81494a..36da5b742424ea92fbe05836e41d9b6587ebac1c 100644 (file)
@@ -77,12 +77,17 @@ CompareGuid (
   IN CONST GUID  *Guid2\r
   )\r
 {\r
-  return (BOOLEAN)(\r
-           ReadUnaligned64 ((CONST UINT64*)Guid1)\r
-             == ReadUnaligned64 ((CONST UINT64*)Guid2) &&\r
-           ReadUnaligned64 ((CONST UINT64*)Guid1 + 1)\r
-             == ReadUnaligned64 ((CONST UINT64*)Guid2 + 1)\r
-           );\r
+  UINT64  LowPartOfGuid1;\r
+  UINT64  LowPartOfGuid2;\r
+  UINT64  HighPartOfGuid1;\r
+  UINT64  HighPartOfGuid2;\r
+\r
+  LowPartOfGuid1  = ReadUnaligned64 ((CONST UINT64*) Guid1);\r
+  LowPartOfGuid2  = ReadUnaligned64 ((CONST UINT64*) Guid2);\r
+  HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);\r
+  HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);\r
+\r
+  return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);\r
 }\r
 \r
 /**\r
index 616c237dade6a2c86a3294e285c4ecc766563cb0..4e140c61c85a7cb6c85f1123c79e5dfd5faf91c4 100644 (file)
@@ -40,6 +40,7 @@ static EFI_STATUS_CODE_PROTOCOL  *gStatusCode = NULL;
   @retval  EFI_UNSUPPORTED       Status Code Protocol is not available.\r
 \r
 **/\r
+STATIC\r
 EFI_STATUS\r
 InternalReportStatusCode (\r
   IN EFI_STATUS_CODE_TYPE     Type,\r
@@ -78,6 +79,7 @@ InternalReportStatusCode (
   @return  The size, in bytes, of DevicePath.\r
 \r
 **/\r
+STATIC\r
 UINTN\r
 InternalReportStatusCodeDevicePathSize (\r
   IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath\r
@@ -139,8 +141,8 @@ CodeTypeToPostCode (
   //\r
   if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ||\r
       ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE)       ) {\r
-    *PostCode  = (UINT8) (((Value & EFI_STATUS_CODE_CLASS_MASK) >> 24) << 5);\r
-    *PostCode |= (UINT8) (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 0x1f);\r
+    *PostCode  = (UINT8) ((((Value & EFI_STATUS_CODE_CLASS_MASK) >> 24) << 5) |\r
+                          (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 0x1f));\r
     return TRUE;\r
   }\r
   return FALSE;\r
@@ -533,7 +535,7 @@ ReportProgressCodeEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -555,7 +557,7 @@ ReportErrorCodeEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -577,5 +579,5 @@ ReportDebugCodeEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
 }\r
index 53f206332419309a804b581818bdf913438466b2..c14c100f425bfe7d1e9be5a828937bbeec1ff1e3 100644 (file)
@@ -122,11 +122,15 @@ DebugAssert (
   EFI_DEBUG_ASSERT_DATA  *AssertData;\r
   UINTN                  TotalSize;\r
   CHAR8                  *Temp;\r
+  UINTN                  FileNameLength;\r
+  UINTN                  DescriptionLength;\r
 \r
   //\r
   // Make sure it will all fit in the passed in buffer\r
   //\r
-  TotalSize = sizeof (EFI_DEBUG_ASSERT_DATA) + AsciiStrLen (FileName) + 1 + AsciiStrLen (Description) + 1;\r
+  FileNameLength    = AsciiStrLen (FileName);\r
+  DescriptionLength = AsciiStrLen (Description);\r
+  TotalSize = sizeof (EFI_DEBUG_ASSERT_DATA) + FileNameLength + 1 + DescriptionLength + 1;\r
   if (TotalSize <= EFI_STATUS_CODE_DATA_MAX_SIZE) {\r
     //\r
     // Fill in EFI_DEBUG_ASSERT_DATA\r
@@ -216,7 +220,7 @@ DebugAssertEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -237,7 +241,7 @@ DebugPrintEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -258,7 +262,7 @@ DebugCodeEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -279,5 +283,5 @@ DebugClearMemoryEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);\r
 }\r
index c57489dc3d4cf11d12f2fdc412d133a285b657c5..408ede45c72b143c75e756c2ed9e57c178173c79 100644 (file)
@@ -123,7 +123,7 @@ PostCodeEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -146,5 +146,5 @@ PostCodeDescriptionEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
 }\r
index 3765d47cdb3d7b4cfe59c516e7c69282934a9c13..43490cc46b45d0a4b866c704eebc840568f1fb17 100644 (file)
@@ -178,6 +178,7 @@ GetFirstGuidHob (
   @return The address of new HOB.\r
 \r
 **/\r
+STATIC\r
 VOID *\r
 InternalPeiCreateHob (\r
   IN UINT16                      Type,\r
index 0d8d0de8f402c26c9547598497bc1a533dea6ad2..ed09b4e5aa27f7cf93854c3b018b26126f768ec8 100644 (file)
@@ -48,7 +48,7 @@ IoOr8 (
   IN      UINT8                     OrData\r
   )\r
 {\r
-  return IoWrite8 (Port, IoRead8 (Port) | OrData);\r
+  return IoWrite8 (Port, (UINT8) (IoRead8 (Port) | OrData));\r
 }\r
 \r
 /**\r
@@ -76,7 +76,7 @@ IoAnd8 (
   IN      UINT8                     AndData\r
   )\r
 {\r
-  return IoWrite8 (Port, IoRead8 (Port) & AndData);\r
+  return IoWrite8 (Port, (UINT8) (IoRead8 (Port) & AndData));\r
 }\r
 \r
 /**\r
@@ -107,7 +107,7 @@ IoAndThenOr8 (
   IN      UINT8                     OrData\r
   )\r
 {\r
-  return IoWrite8 (Port, (IoRead8 (Port) & AndData) | OrData);\r
+  return IoWrite8 (Port, (UINT8) ((IoRead8 (Port) & AndData) | OrData));\r
 }\r
 \r
 /**\r
@@ -328,7 +328,7 @@ IoOr16 (
   IN      UINT16                    OrData\r
   )\r
 {\r
-  return IoWrite16 (Port, IoRead16 (Port) | OrData);\r
+  return IoWrite16 (Port, (UINT16) (IoRead16 (Port) | OrData));\r
 }\r
 \r
 /**\r
@@ -356,7 +356,7 @@ IoAnd16 (
   IN      UINT16                    AndData\r
   )\r
 {\r
-  return IoWrite16 (Port, IoRead16 (Port) & AndData);\r
+  return IoWrite16 (Port, (UINT16) (IoRead16 (Port) & AndData));\r
 }\r
 \r
 /**\r
@@ -387,7 +387,7 @@ IoAndThenOr16 (
   IN      UINT16                    OrData\r
   )\r
 {\r
-  return IoWrite16 (Port, (IoRead16 (Port) & AndData) | OrData);\r
+  return IoWrite16 (Port, (UINT16) ((IoRead16 (Port) & AndData) | OrData));\r
 }\r
 \r
 /**\r
@@ -1168,7 +1168,7 @@ MmioOr8 (
   IN      UINT8                     OrData\r
   )\r
 {\r
-  return MmioWrite8 (Address, MmioRead8 (Address) | OrData);\r
+  return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) | OrData));\r
 }\r
 \r
 /**\r
@@ -1196,7 +1196,7 @@ MmioAnd8 (
   IN      UINT8                     AndData\r
   )\r
 {\r
-  return MmioWrite8 (Address, MmioRead8 (Address) & AndData);\r
+  return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) & AndData));\r
 }\r
 \r
 /**\r
@@ -1228,7 +1228,7 @@ MmioAndThenOr8 (
   IN      UINT8                     OrData\r
   )\r
 {\r
-  return MmioWrite8 (Address, (MmioRead8 (Address) & AndData) | OrData);\r
+  return MmioWrite8 (Address, (UINT8) ((MmioRead8 (Address) & AndData) | OrData));\r
 }\r
 \r
 /**\r
@@ -1450,7 +1450,7 @@ MmioOr16 (
   IN      UINT16                    OrData\r
   )\r
 {\r
-  return MmioWrite16 (Address, MmioRead16 (Address) | OrData);\r
+  return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) | OrData));\r
 }\r
 \r
 /**\r
@@ -1478,7 +1478,7 @@ MmioAnd16 (
   IN      UINT16                    AndData\r
   )\r
 {\r
-  return MmioWrite16 (Address, MmioRead16 (Address) & AndData);\r
+  return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) & AndData));\r
 }\r
 \r
 /**\r
@@ -1510,7 +1510,7 @@ MmioAndThenOr16 (
   IN      UINT16                    OrData\r
   )\r
 {\r
-  return MmioWrite16 (Address, (MmioRead16 (Address) & AndData) | OrData);\r
+  return MmioWrite16 (Address, (UINT16) ((MmioRead16 (Address) & AndData) | OrData));\r
 }\r
 \r
 /**\r
index ae3481d19c9fc9c22898e16f6f7147328a2775df..ece64d3dd7ceae8eb57a43c007b0083186320abd 100644 (file)
@@ -14,6 +14,7 @@
 \r
 **/\r
 \r
+#include "MemoryAllocationLibInternals.h"\r
 \r
 /**\r
   Allocates one or more 4KB pages of a certain memory type.\r
diff --git a/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLibInternals.h b/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLibInternals.h
new file mode 100644 (file)
index 0000000..55e594f
--- /dev/null
@@ -0,0 +1,200 @@
+/** @file\r
+  Internal include file of PEI Memory Allocation Library.\r
+\r
+  Copyright (c) 2006, Intel Corporation\r
+  All rights reserved. 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
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  MemoryAllocationLibInternals.h\r
+\r
+**/\r
+\r
+#ifndef __PEI_MEMORY_ALLOCATION_LIB_INTERNALS_H__\r
+#define __PEI_MEMORY_ALLOCATION_LIB_INTERNALS_H__\r
+\r
+/**\r
+  Allocates one or more 4KB pages of a certain memory type.\r
+\r
+  Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated\r
+  buffer.  The buffer returned is aligned on a 4KB boundary.  If Pages is 0, then NULL is returned.\r
+  If there is not enough memory remaining to satisfy the request, then NULL is returned.\r
+\r
+  @param  MemoryType            The type of memory to allocate.\r
+  @param  Pages                 The number of 4 KB pages to allocate.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocatePages (\r
+  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN UINTN            Pages\r
+  );\r
+\r
+/**\r
+  Allocates one or more 4KB pages of a certain memory type at a specified alignment.\r
+\r
+  Allocates the number of 4KB pages specified by Pages of a certain memory type with an alignment\r
+  specified by Alignment.  The allocated buffer is returned.  If Pages is 0, then NULL is returned.\r
+  If there is not enough memory at the specified alignment remaining to satisfy the request, then\r
+  NULL is returned.\r
+  If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
+\r
+  @param  MemoryType            The type of memory to allocate.\r
+  @param  Pages                 The number of 4 KB pages to allocate.\r
+  @param  Alignment             The requested alignment of the allocation.  Must be a power of two.\r
+                                If Alignment is zero, then byte alignment is used.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocateAlignedPages (\r
+  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN UINTN            Pages,\r
+  IN UINTN            Alignment\r
+  );\r
+\r
+/**\r
+  Allocates a buffer of a certain pool type.\r
+\r
+  Allocates the number bytes specified by AllocationSize of a certain pool type and returns a\r
+  pointer to the allocated buffer.  If AllocationSize is 0, then a valid buffer of 0 size is\r
+  returned.  If there is not enough memory remaining to satisfy the request, then NULL is returned.\r
+\r
+  @param  MemoryType            The type of memory to allocate.\r
+  @param  AllocationSize        The number of bytes to allocate.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocatePool (\r
+  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN UINTN            AllocationSize\r
+  );\r
+\r
+/**\r
+  Allocates and zeros a buffer of a certian pool type.\r
+\r
+  Allocates the number bytes specified by AllocationSize of a certian pool type, clears the buffer\r
+  with zeros, and returns a pointer to the allocated buffer.  If AllocationSize is 0, then a valid\r
+  buffer of 0 size is returned.  If there is not enough memory remaining to satisfy the request,\r
+  then NULL is returned.\r
+\r
+  @param  PoolType              The type of memory to allocate.\r
+  @param  AllocationSize        The number of bytes to allocate and zero.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocateZeroPool (\r
+  IN EFI_MEMORY_TYPE  PoolType,  \r
+  IN UINTN            AllocationSize\r
+  );\r
+\r
+/**\r
+  Copies a buffer to an allocated buffer of a certian pool type.\r
+\r
+  Allocates the number bytes specified by AllocationSize of a certian pool type, copies\r
+  AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the\r
+  allocated buffer.  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there\r
+  is not enough memory remaining to satisfy the request, then NULL is returned.\r
+  If Buffer is NULL, then ASSERT().\r
+  If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+\r
+  @param  PoolType              The type of pool to allocate.\r
+  @param  AllocationSize        The number of bytes to allocate and zero.\r
+  @param  Buffer                The buffer to copy to the allocated buffer.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocateCopyPool (\r
+  IN EFI_MEMORY_TYPE  PoolType,  \r
+  IN UINTN            AllocationSize,\r
+  IN CONST VOID       *Buffer\r
+  );\r
+\r
+/**\r
+  Allocates a buffer of a certain pool type at a specified alignment.\r
+\r
+  Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r
+  specified by Alignment.  The allocated buffer is returned.  If AllocationSize is 0, then a valid\r
+  buffer of 0 size is returned.  If there is not enough memory at the specified alignment remaining\r
+  to satisfy the request, then NULL is returned.\r
+  If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
+\r
+  @param  PoolType              The type of pool to allocate.\r
+  @param  AllocationSize        The number of bytes to allocate.\r
+  @param  Alignment             The requested alignment of the allocation.  Must be a power of two.                            If Alignment is zero, then byte alignment is used.\r
+                                If Alignment is zero, then byte alignment is used.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocateAlignedPool (\r
+  IN EFI_MEMORY_TYPE  PoolType,\r
+  IN UINTN            AllocationSize,\r
+  IN UINTN            Alignment\r
+  );\r
+\r
+/**\r
+  Allocates and zeros a buffer of a certain pool type at a specified alignment.\r
+\r
+  Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r
+  specified by Alignment, clears the buffer with zeros, and returns a pointer to the allocated\r
+  buffer.  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there is not\r
+  enough memory at the specified alignment remaining to satisfy the request, then NULL is returned.\r
+  If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
+\r
+  @param  PoolType              The type of pool to allocate.\r
+  @param  AllocationSize        The number of bytes to allocate.\r
+  @param  Alignment             The requested alignment of the allocation.  Must be a power of two.\r
+                                If Alignment is zero, then byte alignment is used.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocateAlignedZeroPool (\r
+  IN EFI_MEMORY_TYPE  PoolType,\r
+  IN UINTN            AllocationSize,\r
+  IN UINTN            Alignment\r
+  );\r
+\r
+/**\r
+  Copies a buffer to an allocated buffer of a certain pool type at a specified alignment.\r
+\r
+  Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r
+  specified by Alignment.  The allocated buffer is returned.  If AllocationSize is 0, then a valid\r
+  buffer of 0 size is returned.  If there is not enough memory at the specified alignment remaining\r
+  to satisfy the request, then NULL is returned.\r
+  If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
+\r
+  @param  PoolType              The type of pool to allocate.\r
+  @param  AllocationSize        The number of bytes to allocate.\r
+  @param  Buffer                The buffer to copy to the allocated buffer.\r
+  @param  Alignment             The requested alignment of the allocation.  Must be a power of two.\r
+                                If Alignment is zero, then byte alignment is used.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+InternalAllocateAlignedCopyPool (\r
+  IN EFI_MEMORY_TYPE  PoolType,\r
+  IN UINTN            AllocationSize,\r
+  IN CONST VOID       *Buffer,\r
+  IN UINTN            Alignment\r
+  );\r
+\r
+#endif\r
index 6054b76c7d011927863b37cc30242c78e1a7dc9d..14bdff78602f476593eff5b200db0babef7aaa07 100644 (file)
@@ -38,6 +38,7 @@
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>MemoryAllocationLib.c</Filename>\r
+    <Filename>MemoryAllocationLibInternals.h</Filename>\r
   </SourceFiles>\r
   <PackageDependencies>\r
     <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
index 3a27ab2e835f7a871214e27d76df0509e1102db0..6f81e21c240a5c4b1caed9e1702f8c1962c22b54 100644 (file)
@@ -14,6 +14,8 @@
 \r
 **/\r
 \r
+#include "MemLibInternals.h"\r
+\r
 VOID *\r
 EFIAPI\r
 InternalMemCopyMem (\r
index 6f50340bd764beb315e103e6611204a2fd81494a..36da5b742424ea92fbe05836e41d9b6587ebac1c 100644 (file)
@@ -77,12 +77,17 @@ CompareGuid (
   IN CONST GUID  *Guid2\r
   )\r
 {\r
-  return (BOOLEAN)(\r
-           ReadUnaligned64 ((CONST UINT64*)Guid1)\r
-             == ReadUnaligned64 ((CONST UINT64*)Guid2) &&\r
-           ReadUnaligned64 ((CONST UINT64*)Guid1 + 1)\r
-             == ReadUnaligned64 ((CONST UINT64*)Guid2 + 1)\r
-           );\r
+  UINT64  LowPartOfGuid1;\r
+  UINT64  LowPartOfGuid2;\r
+  UINT64  HighPartOfGuid1;\r
+  UINT64  HighPartOfGuid2;\r
+\r
+  LowPartOfGuid1  = ReadUnaligned64 ((CONST UINT64*) Guid1);\r
+  LowPartOfGuid2  = ReadUnaligned64 ((CONST UINT64*) Guid2);\r
+  HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);\r
+  HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);\r
+\r
+  return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);\r
 }\r
 \r
 /**\r
index f241227fb32eb8fbb8b2bce0b6e5850aa68a5f69..a7892f76f41c8c37f39a33e6c1686f1f0a71a09d 100644 (file)
@@ -25,6 +25,7 @@ Module Name: PeiPcdLib.c
   @retval PCD_PPI * The pointer to the PCD_PPI.\r
 \r
 **/\r
+STATIC\r
 PCD_PPI  *\r
 GetPcdPpiPtr (\r
   VOID\r
index dda3d717e8057b6fe627f0417109cd53f8b64495..05fdd9cdb8d783b6568e30e826997e4c0b7cb2d3 100644 (file)
@@ -40,6 +40,7 @@
   @retval  EFI_UNSUPPORTED       Status Code Protocol is not available.\r
 \r
 **/\r
+STATIC\r
 EFI_STATUS\r
 InternalReportStatusCode (\r
   IN EFI_STATUS_CODE_TYPE     Type,\r
@@ -102,8 +103,8 @@ CodeTypeToPostCode (
   //\r
   if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ||\r
       ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE)       ) {\r
-    *PostCode  = (UINT8) (((Value & EFI_STATUS_CODE_CLASS_MASK) >> 24) << 5);\r
-    *PostCode |= (UINT8) (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 0x1f);\r
+    *PostCode  = (UINT8) ((((Value & EFI_STATUS_CODE_CLASS_MASK) >> 24) << 5) |\r
+                          (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 0x1f));\r
     return TRUE;\r
   }\r
   return FALSE;\r
@@ -468,7 +469,7 @@ ReportProgressCodeEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -490,7 +491,7 @@ ReportErrorCodeEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -512,5 +513,5 @@ ReportDebugCodeEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
 }\r
index 474748d332d8df1eb7f786f2dd0f4054a218f951..aea35ef0343a92b0c3e0e317f4fff232cb1f47ec 100644 (file)
@@ -20,30 +20,7 @@ Abstract:
   \r
 --*/\r
 \r
-\r
-/**\r
-  Reads the current value of Kr1.\r
-\r
-  @return The current value of Kr1.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-AsmReadKr1 (\r
-  VOID\r
-  );\r
-\r
-/**\r
-  Writes the current value of Kr1.\r
-\r
-  @param  Value The 64-bit value to write to Kr1.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-AsmWriteKr1 (\r
-  IN      UINT64                    Value\r
-  );\r
+#include "PeiServicesTablePointerLibInternals.h"\r
 \r
 /**\r
   The function returns the pointer to PeiServices.\r
diff --git a/MdePkg/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointerLibInternals.h b/MdePkg/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointerLibInternals.h
new file mode 100644 (file)
index 0000000..bb0463e
--- /dev/null
@@ -0,0 +1,44 @@
+/** @file\r
+  Include file for internal functions of PEI Services table pointer libary.\r
+\r
+  Copyright (c) 2006, Intel Corporation\r
+  All rights reserved. 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
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+  Module Name:  PeiServicesTablePointerLibInternals.h\r
+\r
+**/\r
+\r
+#ifndef __PEI_SERVICES_TABLE_POINTER_LIB_INTERTALS_H__\r
+#define __PEI_SERVICES_TABLE_POINTER_LIB_INTERTALS_H__\r
+\r
+/**\r
+  Reads the current value of Kr1.\r
+\r
+  @return The current value of Kr1.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+AsmReadKr1 (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Writes the current value of Kr1.\r
+\r
+  @param  Value The 64-bit value to write to Kr1.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmWriteKr1 (\r
+  IN      UINT64                    Value\r
+  );\r
+\r
+#endif\r
index 2b39ae952f3a235d68c1fcfc0e75fb1bd3beb65d..a73f9a592d831e63a942ec730d6977b34811c203 100644 (file)
@@ -35,6 +35,7 @@
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>PeiServicesTablePointer.c</Filename>\r
+    <Filename>PeiServicesTablePointerLibInternals.h</Filename>\r
     <Filename SupArchList="IPF">Ipf/ReadKr1.s</Filename>\r
     <Filename SupArchList="IPF">Ipf/WriteKr1.s</Filename>\r
   </SourceFiles>\r
index 47c00a7306d1e6a04cacbb6099219e80fa65943d..58b093d039dce6a7d5fb2b61104b8761d7d3e4e7 100644 (file)
@@ -25,6 +25,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 //\r
 // Declaration for internal functions\r
 //\r
+\r
+/**\r
+  Gets Smbus PPIs.\r
+\r
+  This internal function retrieves Smbus PPI from PPI database.\r
+\r
+  @param  PeiServices   An indirect pointer to the EFI_PEI_SERVICES published by the PEI Foundation.\r
+\r
+  @return The pointer to Smbus PPI.\r
+\r
+**/\r
+EFI_PEI_SMBUS_PPI *\r
+InternalGetSmbusPpi (\r
+  EFI_PEI_SERVICES      **PeiServices\r
+  );\r
+\r
 /**\r
   Executes an SMBus operation to an SMBus controller. \r
 \r
index 1494607309e6542110575730ed5bbf21f060bdfc..3fe3b6e043f4d2cd1c468fb6979573223355011e 100644 (file)
@@ -180,7 +180,7 @@ DebugAssertEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -201,7 +201,7 @@ DebugPrintEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -222,7 +222,7 @@ DebugCodeEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -243,5 +243,5 @@ DebugClearMemoryEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);\r
 }\r
index 041fbc72f0f661c76c0b17f21e7b4b166982326b..9338217762a6becc9f9e1b68db1b6635f70c6eea 100644 (file)
@@ -180,7 +180,7 @@ DebugAssertEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -201,7 +201,7 @@ DebugPrintEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -222,7 +222,7 @@ DebugCodeEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -243,5 +243,5 @@ DebugClearMemoryEnabled (
   VOID\r
   )\r
 {\r
-  return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);\r
 }\r
index 57b6a755b2535ab7f844d65147b4bc846e1e2346..9ec19e3f4af1d0bc00fb0f95078cd782d5270966 100644 (file)
@@ -25,6 +25,7 @@ EFI_EVENT  _mDriverExitBootServicesNotifyEvent;
   @retval EFI_SUCCESS\r
 \r
 **/\r
+STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 _DriverUnloadHandler (\r
@@ -70,6 +71,7 @@ _DriverUnloadHandler (
   @param Context Event Context.\r
 \r
 **/\r
+STATIC\r
 VOID\r
 EFIAPI\r
 _DriverExitBootServices (\r
index 11408543030b1486b7015a892b989a52447cc16d..a2dd6a8c1259aeadf5fd6946523cd9d224b0ebca 100644 (file)
   @retval FALSE     Language 1 and language 2 are not the same.\r
 \r
 **/\r
+STATIC\r
 BOOLEAN\r
 CompareIso639LanguageCode (\r
   IN CONST CHAR8  *Language1,\r
   IN CONST CHAR8  *Language2\r
   )\r
 {\r
-  return (BOOLEAN) (ReadUnaligned24 ((CONST UINT32 *) Language1) == ReadUnaligned24 ((CONST UINT32 *) Language2));\r
+  UINT32  Name1;\r
+  UINT32  Name2;\r
+\r
+  Name1 = ReadUnaligned24 ((CONST UINT32 *) Language1);\r
+  Name2 = ReadUnaligned24 ((CONST UINT32 *) Language2);\r
+\r
+  return (BOOLEAN) (Name1 == Name2);\r
 }\r
 \r
 /**\r
index 9342da9744e383fa8b97a4632ce32b03f86dbf8f..ce59eaf417c0e4dab77d3f8354ef41e5f7f6e88a 100644 (file)
@@ -25,6 +25,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.\r
   \r
 **/\r
+STATIC\r
 VOID\r
 EFIAPI\r
 InternalEmptyFuntion (\r