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