]> git.karo-electronics.de Git - karo-tx-uboot.git/blob - arch/x86/include/asm/arch-queensbay/fsp/fsp_types.h
12ebbfdc1df53dc939814b53e9b1429a7663d991
[karo-tx-uboot.git] / arch / x86 / include / asm / arch-queensbay / fsp / fsp_types.h
1 /*
2  * Copyright (C) 2013, Intel Corporation
3  * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
4  *
5  * SPDX-License-Identifier:     Intel
6  */
7
8 #ifndef __FSP_TYPES_H__
9 #define __FSP_TYPES_H__
10
11 /*
12  * Boolean true value.  UEFI Specification defines this value to be 1,
13  * but this form is more portable.
14  */
15 #define TRUE                    ((unsigned char)(1 == 1))
16
17 /*
18  * Boolean false value.  UEFI Specification defines this value to be 0,
19  * but this form is more portable.
20  */
21 #define FALSE                   ((unsigned char)(0 == 1))
22
23 /* 128 bit buffer containing a unique identifier value */
24 struct efi_guid_t {
25         u32     data1;
26         u16     data2;
27         u16     data3;
28         u8      data4[8];
29 };
30
31 /**
32  * Returns a 16-bit signature built from 2 ASCII characters.
33  *
34  * This macro returns a 16-bit value built from the two ASCII characters
35  * specified by A and B.
36  *
37  * @A: The first ASCII character.
38  * @B: The second ASCII character.
39  *
40  * @return: A 16-bit value built from the two ASCII characters specified by
41  *          A and B.
42  */
43 #define SIGNATURE_16(A, B)      ((A) | (B << 8))
44
45 /**
46  * Returns a 32-bit signature built from 4 ASCII characters.
47  *
48  * This macro returns a 32-bit value built from the four ASCII characters
49  * specified by A, B, C, and D.
50  *
51  * @A: The first ASCII character.
52  * @B: The second ASCII character.
53  * @C: The third ASCII character.
54  * @D: The fourth ASCII character.
55  *
56  * @return: A 32-bit value built from the two ASCII characters specified by
57  *          A, B, C and D.
58  */
59 #define SIGNATURE_32(A, B, C, D)        \
60         (SIGNATURE_16(A, B) | (SIGNATURE_16(C, D) << 16))
61
62 /**
63  * Returns a 64-bit signature built from 8 ASCII characters.
64  *
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.
67  *
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.
76  *
77  * @return: A 64-bit value built from the two ASCII characters specified by
78  *          A, B, C, D, E, F, G and H.
79  */
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))
82
83 /* Assertion for debug */
84 #define ASSERT(exp)     do { if (!(exp)) for (;;); } while (FALSE)
85
86 /*
87  * Define FSP API return status code.
88  * Compatiable with EFI_STATUS defined in PI Spec.
89  */
90 #define FSP_SUCCESS             0
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
96
97 #endif