]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Include/AArch64/EfiBind.h
Enhance TPM driver to protect TPM physical presence flags.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Include / AArch64 / EfiBind.h
1 /** @file
2
3 Copyright (c) 2013, ARM Ltd. All rights reserved.<BR>
4
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Module Name:
14
15 EfiBind.h
16
17 Abstract:
18
19 Processor or Compiler specific defines and types for AArch64.
20 We are using the ANSI C 2000 _t type definitions for basic types.
21 This it technically a violation of the coding standard, but they
22 are used to make EfiTypes.h portable. Code other than EfiTypes.h
23 should never use any ANSI C 2000 _t integer types.
24
25 **/
26
27
28 #ifndef _EFI_BIND_H_
29 #define _EFI_BIND_H_
30
31
32 #define EFI_DRIVER_ENTRY_POINT(InitFunction)
33 #define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT
34
35
36 //
37 // Make sure we are using the correct packing rules per EFI specification.
38 //
39 #ifndef __GNUC__
40 #pragma pack()
41 #endif
42
43
44 //
45 // Assume standard AArch64 alignment.
46 // BugBug: Need to check portability of long long
47 //
48 typedef unsigned long long uint64_t;
49 typedef long long int64_t;
50 typedef unsigned int uint32_t;
51 typedef int int32_t;
52 typedef unsigned short uint16_t;
53 typedef short int16_t;
54 typedef unsigned char uint8_t;
55 typedef signed char int8_t;
56
57 //
58 // Native integer size in stdint.h
59 //
60 typedef uint64_t uintn_t;
61 typedef int64_t intn_t;
62
63 //
64 // Processor specific defines
65 //
66 #define EFI_MAX_BIT 0x8000000000000000
67 #define MAX_2_BITS 0xC000000000000000
68
69 //
70 // Maximum legal AArch64 address
71 //
72 #define EFI_MAX_ADDRESS 0xFFFFFFFFFFFFFFFF
73
74 //
75 // Bad pointer value to use in check builds.
76 // if you see this value you are using uninitialized or free'ed data
77 //
78 #define EFI_BAD_POINTER 0xAFAFAFAFAFAFAFAF
79 #define EFI_BAD_POINTER_AS_BYTE 0xAF
80
81 #define EFI_DEADLOOP() { volatile UINTN __iii; __iii = 1; while (__iii); }
82
83 //
84 // For real hardware, just put in a halt loop. Don't do a while(1) because the
85 // compiler will optimize away the rest of the function following, so that you run out in
86 // the weeds if you skip over it with a debugger.
87 //
88 #define EFI_BREAKPOINT EFI_DEADLOOP()
89
90
91 //
92 // Memory Fence forces serialization, and is needed to support out of order
93 // memory transactions. The Memory Fence is mainly used to make sure IO
94 // transactions complete in a deterministic sequence, and to syncronize locks
95 // an other MP code. Currently no memory fencing is required.
96 //
97 #define MEMORY_FENCE()
98
99 //
100 // Some compilers don't support the forward reference construct:
101 // typedef struct XXXXX. The forward reference is required for
102 // ANSI compatibility.
103 //
104 // The following macro provide a workaround for such cases.
105 //
106
107
108 #ifdef EFI_NO_INTERFACE_DECL
109 #define EFI_FORWARD_DECLARATION(x)
110 #else
111 #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x
112 #endif
113
114
115 //
116 // Some C compilers optimize the calling conventions to increase performance.
117 // _EFIAPI is used to make all public APIs follow the standard C calling
118 // convention.
119 //
120 #define _EFIAPI
121
122
123
124 //
125 // For symbol name in GNU assembly code, an extra "_" is necessary
126 //
127 #if defined(__GNUC__)
128 ///
129 /// Private worker functions for ASM_PFX()
130 ///
131 #define _CONCATENATE(a, b) __CONCATENATE(a, b)
132 #define __CONCATENATE(a, b) a ## b
133
134 ///
135 /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix
136 /// on symbols in assembly language.
137 ///
138 #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)
139
140 #endif
141
142 #endif
143