]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/PostCode.c
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EfiCommonLib / PostCode.c
1 /*++
2
3 Copyright (c) 2004, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 PostCode.c
15
16 Abstract:
17
18 Worker functions for PostCode
19
20 --*/
21
22 #include "TianoCommon.h"
23 #include "EfiCommonLib.h"
24
25 BOOLEAN
26 CodeTypeToPostCode (
27 IN EFI_STATUS_CODE_TYPE CodeType,
28 IN EFI_STATUS_CODE_VALUE Value,
29 OUT UINT8 *PostCode
30 )
31 /*++
32
33 Routine Description:
34
35 Convert code value to an 8 bit post code
36
37 Arguments:
38
39 CodeType - Code type
40 Value - Code value
41 PostCode - Post code as output
42
43 Returns:
44
45 TRUE - Successfully converted
46
47 FALSE - Convertion failed
48
49 --*/
50 {
51 //
52 // Convert Value to an 8 bit post code
53 //
54 if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ||
55 ((CodeType & EFI_STATUS_CODE_TYPE_MASK)== EFI_ERROR_CODE)) {
56 *PostCode = (UINT8) (((Value & EFI_STATUS_CODE_CLASS_MASK) >> 24) << 5);
57 *PostCode |= (UINT8) (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 0x1f);
58 return TRUE;
59 }
60
61 return FALSE;
62 }