Revision: 17230
          http://sourceforge.net/p/edk2/code/17230
Author:   hwu1225
Date:     2015-04-28 05:12:03 +0000 (Tue, 28 Apr 2015)
Log Message:
-----------
Replace SetPower2 by EDKII baselib - GetPowerOfTwo64.

(Sync patch r17222 from main trunk.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <[email protected]>
Reviewed-by: "Ma, Maurice" <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/17222

Modified Paths:
--------------
    branches/UDK2014.SP1/IntelFspPkg/Library/BaseCacheLib/CacheLib.c

Modified: branches/UDK2014.SP1/IntelFspPkg/Library/BaseCacheLib/CacheLib.c
===================================================================
--- branches/UDK2014.SP1/IntelFspPkg/Library/BaseCacheLib/CacheLib.c    
2015-04-28 05:10:01 UTC (rev 17229)
+++ branches/UDK2014.SP1/IntelFspPkg/Library/BaseCacheLib/CacheLib.c    
2015-04-28 05:12:03 UTC (rev 17230)
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -18,17 +18,6 @@
 #include "CacheLibInternal.h"
 
 /**
-  Calculate the maximum value which is a power of 2, but less the Input.
-
-  @param[in]  Input        The number to pass in.
-  @return The maximum value which is align to power of 2 and less the Input
-**/
-UINT32
-SetPower2 (
-  IN  UINT32                    Input
-  );
-
-/**
   Search the memory cache type for specific memory from MTRR.
 
   @param[in]  MemoryAddress         the address of target memory
@@ -236,11 +225,7 @@
   //
   // Compute inital power of 2 size to return
   //
-  if (RShiftU64(MemoryLength, 32)) {
-    Result = LShiftU64((UINT64)SetPower2((UINT32) RShiftU64(MemoryLength, 
32)), 32);
-  } else {
-    Result = (UINT64)SetPower2((UINT32)MemoryLength);
-  }
+  Result = GetPowerOfTwo64(MemoryLength);
 
   //
   // Special case base of 0 as all ranges are valid
@@ -296,37 +281,6 @@
 }
 
 /**
-  Calculate the maximum value which is a power of 2, but less the Input.
-
-  @param[in]  Input        The number to pass in.
-
-  @return The maximum value which is align to power of 2 and less the Input.
-**/
-UINT32
-SetPower2 (
-  IN UINT32 Input
-  )
-{
-  UINT32 Result;
-
-  Result = 0;
-#if defined(__GCC__)
-  asm("bsr %1, \
-      %%eax; \
-     bts %%eax, \
-      %0;" :"=r"(Result) :
-    "r"(Input)
-  );
-#elif defined(_MSC_VER)
-  _asm {
-    bsr eax, Input
-    bts Result, eax
-  }
-#endif
-  return Result;
-}
-
-/**
   Programs fixed MTRRs registers.
 
   @param[in]  MemoryCacheType  The memory type to set.


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to