diff options
author | raywu <raywu0301@gmail.com> | 2018-06-15 00:00:50 +0800 |
---|---|---|
committer | raywu <raywu0301@gmail.com> | 2018-06-15 00:00:50 +0800 |
commit | b7c51c9cf4864df6aabb99a1ae843becd577237c (patch) | |
tree | eebe9b0d0ca03062955223097e57da84dd618b9a /EDK/Foundation/Library/EfiCommonLib/PostCode.c | |
download | zprj-master.tar.xz |
Diffstat (limited to 'EDK/Foundation/Library/EfiCommonLib/PostCode.c')
-rw-r--r-- | EDK/Foundation/Library/EfiCommonLib/PostCode.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/EDK/Foundation/Library/EfiCommonLib/PostCode.c b/EDK/Foundation/Library/EfiCommonLib/PostCode.c new file mode 100644 index 0000000..bf9c544 --- /dev/null +++ b/EDK/Foundation/Library/EfiCommonLib/PostCode.c @@ -0,0 +1,62 @@ +/*++ + +Copyright (c) 2004, Intel Corporation +All rights reserved. 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 +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +Module Name: + + PostCode.c + +Abstract: + + Worker functions for PostCode + +--*/ + +#include "TianoCommon.h" +#include "EfiCommonLib.h" + +BOOLEAN +CodeTypeToPostCode ( + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + OUT UINT8 *PostCode + ) +/*++ + +Routine Description: + + Convert code value to an 8 bit post code + +Arguments: + + CodeType - Code type + Value - Code value + PostCode - Post code as output + +Returns: + + TRUE - Successfully converted + + FALSE - Convertion failed + +--*/ +{ + // + // Convert Value to an 8 bit post code + // + if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) || + ((CodeType & EFI_STATUS_CODE_TYPE_MASK)== EFI_ERROR_CODE)) { + *PostCode = (UINT8) (((Value & EFI_STATUS_CODE_CLASS_MASK) >> 24) << 5); + *PostCode |= (UINT8) (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 0x1f); + return TRUE; + } + + return FALSE; +} |