xref: /aosp_15_r20/external/coreboot/src/include/efi/efi_datatype.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 /* Create EFI equivalent datatype in coreboot based on UEFI specification */
4 #ifndef __EFI_DATATYPE_H__
5 #define __EFI_DATATYPE_H__
6 
7 /*
8  * EDK2 EFIAPI macro definition relies on compiler flags such as __GNUC__ which
9  * is not working well when included by coreboot. While it has no side-effect on
10  * i386 because the C calling convention used by coreboot and FSP are the same,
11  * it breaks on x86_64 because FSP/UEFI uses the Microsoft x64 calling
12  * convention while coreboot uses the System V AMD64 ABI.
13  *
14  * Fortunately, EDK2 header allows to override EFIAPI.
15  */
16 #if CONFIG(PLATFORM_USES_FSP2_X86_32)
17 #define EFIAPI __attribute__((regparm(0)))
18 #else
19 #define EFIAPI __attribute__((__ms_abi__))
20 #endif
21 
22 #include <Base.h>
23 #include <Uefi/UefiBaseType.h>
24 
25 #if CONFIG_UDK_VERSION >= 2017
26 #include <Guid/StatusCodeDataTypeId.h>
27 #include <IndustryStandard/Bmp.h>
28 #include <Pi/PiPeiCis.h>
29 #include <Pi/PiStatusCode.h>
30 #include <Protocol/GraphicsOutput.h>
31 #include <Protocol/MpService.h>
32 
33 /* Data structure for EFI_PEI_SERVICE. */
34 typedef EFI_PEI_SERVICES efi_pei_services;
35 /*  Structure that describes information about a logical CPU. */
36 typedef EFI_PROCESSOR_INFORMATION efi_processor_information;
37 /* Status code type definition */
38 typedef EFI_STATUS_CODE_TYPE efi_status_code_type_t;
39 /* Status value type definition */
40 typedef EFI_STATUS_CODE_VALUE efi_status_code_value_t;
41 /* Status data type definition */
42 typedef EFI_STATUS_CODE_DATA efi_status_code_data_t;
43 /* Status string data type definition */
44 typedef EFI_STATUS_CODE_STRING_DATA efi_status_code_string_data;
45 /* Data structure for EFI_GRAPHICS_OUTPUT_BLT_PIXEL. */
46 typedef EFI_GRAPHICS_OUTPUT_BLT_PIXEL efi_graphics_output_blt_pixel;
47 /* Data structure for BMP_IMAGE_HEADER. */
48 typedef BMP_IMAGE_HEADER efi_bmp_image_header;
49 /* Data structure for BMP_COLOR_MAP; . */
50 typedef BMP_COLOR_MAP efi_bmp_color_map;
51 #endif
52 
53 /* EFIAPI calling convention */
54 #define __efiapi EFIAPI
55 
56 /* Basic Data types */
57 /* 8-byte unsigned value. */
58 typedef UINT64 efi_uint64_t;
59 /* 8-byte signed value. */
60 typedef INT64 efi_int64_t;
61 /* 4-byte unsigned value. */
62 typedef UINT32 efi_uint32_t;
63 /* 4-byte signed value. */
64 typedef INT32 efi_int32_t;
65 /* 2-byte unsigned value. */
66 typedef UINT16 efi_uint16_t;
67 /* 2-byte Character. */
68 typedef CHAR16 efi_char16_t;
69 /* 2-byte signed value. */
70 typedef INT16 efi_int16_t;
71 /* Logical Boolean. */
72 typedef BOOLEAN efi_boolean_t;
73 /* 1-byte unsigned value. */
74 typedef UINT8 efi_uint8_t;
75 /* 1-byte Character */
76 typedef CHAR8 efi_char8_t;
77 /* 1-byte signed value */
78 typedef INT8 efi_int8_t;
79 /* Unsigned value of native width. */
80 typedef UINTN efi_uintn_t;
81 /* Signed value of native width. */
82 typedef INTN efi_intn_t;
83 /* Status codes common to all execution phases */
84 #if CONFIG(PLATFORM_USES_FSP2_X86_32)
85 typedef UINT32 efi_return_status_t;
86 #else
87 typedef UINT64 efi_return_status_t;
88 #endif
89 /* Data structure for EFI_PHYSICAL_ADDRESS */
90 typedef EFI_PHYSICAL_ADDRESS efi_physical_address;
91 /* 128-bit buffer containing a unique identifier value */
92 typedef EFI_GUID efi_guid_t;
93 
94 /*
95  * The function prototype for invoking a function on an
96  * Application Processor.
97  */
98 typedef
99 void
100 (__efiapi *efi_ap_procedure)(void *buffer);
101 
102 #endif
103