xref: /openbmc/u-boot/arch/x86/include/asm/fsp/fsp_types.h (revision 1f124eba)
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 /* 128 bit buffer containing a unique identifier value */
12 struct efi_guid {
13 	u32	data1;
14 	u16	data2;
15 	u16	data3;
16 	u8	data4[8];
17 };
18 
19 /**
20  * Returns a 16-bit signature built from 2 ASCII characters.
21  *
22  * This macro returns a 16-bit value built from the two ASCII characters
23  * specified by A and B.
24  *
25  * @A: The first ASCII character.
26  * @B: The second ASCII character.
27  *
28  * @return: A 16-bit value built from the two ASCII characters specified by
29  *          A and B.
30  */
31 #define SIGNATURE_16(A, B)	((A) | (B << 8))
32 
33 /**
34  * Returns a 32-bit signature built from 4 ASCII characters.
35  *
36  * This macro returns a 32-bit value built from the four ASCII characters
37  * specified by A, B, C, and D.
38  *
39  * @A: The first ASCII character.
40  * @B: The second ASCII character.
41  * @C: The third ASCII character.
42  * @D: The fourth ASCII character.
43  *
44  * @return: A 32-bit value built from the two ASCII characters specified by
45  *          A, B, C and D.
46  */
47 #define SIGNATURE_32(A, B, C, D)	\
48 	(SIGNATURE_16(A, B) | (SIGNATURE_16(C, D) << 16))
49 
50 /**
51  * Returns a 64-bit signature built from 8 ASCII characters.
52  *
53  * This macro returns a 64-bit value built from the eight ASCII characters
54  * specified by A, B, C, D, E, F, G,and H.
55  *
56  * @A: The first ASCII character.
57  * @B: The second ASCII character.
58  * @C: The third ASCII character.
59  * @D: The fourth ASCII character.
60  * @E: The fifth ASCII character.
61  * @F: The sixth ASCII character.
62  * @G: The seventh ASCII character.
63  * @H: The eighth ASCII character.
64  *
65  * @return: A 64-bit value built from the two ASCII characters specified by
66  *          A, B, C, D, E, F, G and H.
67  */
68 #define SIGNATURE_64(A, B, C, D, E, F, G, H)	\
69 	(SIGNATURE_32(A, B, C, D) | ((u64)(SIGNATURE_32(E, F, G, H)) << 32))
70 
71 #endif
72