2 * Copyright (C) 2013, Intel Corporation
3 * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
5 * SPDX-License-Identifier: Intel
8 #ifndef __FSP_TYPES_H__
9 #define __FSP_TYPES_H__
12 * Boolean true value. UEFI Specification defines this value to be 1,
13 * but this form is more portable.
15 #define TRUE ((unsigned char)(1 == 1))
18 * Boolean false value. UEFI Specification defines this value to be 0,
19 * but this form is more portable.
21 #define FALSE ((unsigned char)(0 == 1))
23 /* 128 bit buffer containing a unique identifier value */
32 * Returns a 16-bit signature built from 2 ASCII characters.
34 * This macro returns a 16-bit value built from the two ASCII characters
35 * specified by A and B.
37 * @A: The first ASCII character.
38 * @B: The second ASCII character.
40 * @return: A 16-bit value built from the two ASCII characters specified by
43 #define SIGNATURE_16(A, B) ((A) | (B << 8))
46 * Returns a 32-bit signature built from 4 ASCII characters.
48 * This macro returns a 32-bit value built from the four ASCII characters
49 * specified by A, B, C, and D.
51 * @A: The first ASCII character.
52 * @B: The second ASCII character.
53 * @C: The third ASCII character.
54 * @D: The fourth ASCII character.
56 * @return: A 32-bit value built from the two ASCII characters specified by
59 #define SIGNATURE_32(A, B, C, D) \
60 (SIGNATURE_16(A, B) | (SIGNATURE_16(C, D) << 16))
63 * Returns a 64-bit signature built from 8 ASCII characters.
65 * This macro returns a 64-bit value built from the eight ASCII characters
66 * specified by A, B, C, D, E, F, G,and H.
68 * @A: The first ASCII character.
69 * @B: The second ASCII character.
70 * @C: The third ASCII character.
71 * @D: The fourth ASCII character.
72 * @E: The fifth ASCII character.
73 * @F: The sixth ASCII character.
74 * @G: The seventh ASCII character.
75 * @H: The eighth ASCII character.
77 * @return: A 64-bit value built from the two ASCII characters specified by
78 * A, B, C, D, E, F, G and H.
80 #define SIGNATURE_64(A, B, C, D, E, F, G, H) \
81 (SIGNATURE_32(A, B, C, D) | ((u64)(SIGNATURE_32(E, F, G, H)) << 32))
83 /* Assertion for debug */
84 #define ASSERT(exp) do { if (!(exp)) for (;;); } while (FALSE)
87 * Define FSP API return status code.
88 * Compatiable with EFI_STATUS defined in PI Spec.
91 #define FSP_INVALID_PARAM 0x80000002
92 #define FSP_UNSUPPORTED 0x80000003
93 #define FSP_DEVICE_ERROR 0x80000007
94 #define FSP_NOT_FOUND 0x8000000E
95 #define FSP_ALREADY_STARTED 0x80000014