From f3b5686f7e3cf9e19a55019fba35da6ba586fb94 Mon Sep 17 00:00:00 2001
From: Liming Gao <liming.gao@intel.com>
Date: Fri, 6 Feb 2015 06:37:55 +0000
Subject: [PATCH] IntelFspPkg: Update BaseFspDebugLibSerialPort library

Implement new API DebugPrintLevelEnabled() to base on PCD PcdFixedDebugPrintErrorLevel.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16795 6f19259b-4bc3-4df7-8a09-765794883524
---
 .../BaseFspDebugLibSerialPort.inf             |  1 +
 .../BaseFspDebugLibSerialPort/DebugLib.c      | 20 ++++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/IntelFspPkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf b/IntelFspPkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf
index 00d79705ae..e706c3cb9d 100644
--- a/IntelFspPkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf
+++ b/IntelFspPkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf
@@ -47,4 +47,5 @@
 [Pcd]
   gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue       ## CONSUMES
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask           ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel   ## CONSUMES
 
diff --git a/IntelFspPkg/Library/BaseFspDebugLibSerialPort/DebugLib.c b/IntelFspPkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
index 471659072c..8d90a1a598 100644
--- a/IntelFspPkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
+++ b/IntelFspPkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
@@ -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
@@ -303,3 +303,21 @@ DebugClearMemoryEnabled (
 {
   return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
 }
+
+/**
+  Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+  This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+  @retval  TRUE    Current ErrorLevel is supported.
+  @retval  FALSE   Current ErrorLevel is not supported.
+
+**/
+BOOLEAN
+EFIAPI
+DebugPrintLevelEnabled (
+  IN  CONST UINTN        ErrorLevel
+  )
+{
+  return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
+}