1 /*++
2 
3 Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 Module Name:
13 
14   EfiBind.h
15 
16 Abstract:
17 
18   Processor or compiler specific defines and types for EBC.
19 
20 --*/
21 
22 #ifndef _EFI_BIND_H_
23 #define _EFI_BIND_H_
24 
25 #define EFI_DRIVER_ENTRY_POINT(InitFunction)
26 #define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT
27 
28 //
29 // Disable warning that make it impossible to compile at /W3
30 // This only works for Intel EBC Compiler tools
31 //
32 
33 //
34 // Disabling argument of type "TYPE **" is incompatible with parameter of type "void **"
35 //
36 #pragma warning ( disable : 167 )
37 
38 //
39 // Disabling pointless comparison of unsigned integer with zero
40 //
41 #pragma warning ( disable : 186 )
42 
43 //
44 // Disabling enumerated type mixed with another type
45 //
46 #pragma warning ( disable : 188 )
47 
48 //
49 // Native integer types
50 //
51 typedef signed char           int8_t;
52 typedef unsigned char         uint8_t;
53 
54 typedef short                 int16_t;
55 typedef unsigned short        uint16_t;
56 
57 typedef int                   int32_t;
58 typedef unsigned int          uint32_t;
59 
60 typedef __int64               int64_t;
61 typedef unsigned __int64      uint64_t;
62 
63 //
64 // "long" type scales to the processor native size with EBC compiler
65 //
66 typedef long                  intn_t;
67 typedef unsigned long         uintn_t;
68 
69 //
70 // Scalable macro to set the most significant bit in a natural number
71 //
72 #define EFI_MAX_BIT           ((UINTN)0x01 << ((sizeof (char *) * 8) - 1))
73 #define MAX_2_BITS            (EFI_MAX_BIT | (EFI_MAX_BIT >> 1))
74 
75 //
76 // Maximum legal EBC address
77 //
78 #define EFI_MAX_ADDRESS   (UINTN)~0
79 
80 //
81 //  Bad pointer value to use in check builds.
82 //  if you see this value you are using uninitialized or free'ed data
83 //
84 #define EFI_BAD_POINTER          (UINTN)0xAFAFAFAFAFAFAFAF
85 #define EFI_BAD_POINTER_AS_BYTE  (UINTN)0xAF
86 
87 //
88 // _break() is an EBC compiler intrinsic function
89 //
90 extern
91 uint64_t
92 _break (
93   unsigned char BreakCode
94   );
95 
96 //
97 // Macro to inject a break point in the code to assist debugging.
98 //
99 #define EFI_BREAKPOINT()  _break ( 3 )
100 #define EFI_DEADLOOP()    while (TRUE)
101 
102 //
103 // Memory Fence forces serialization, and is needed to support out of order
104 //  memory transactions. The Memory Fence is mainly used to make sure IO
105 //  transactions complete in a deterministic sequence, and to syncronize locks
106 //  an other MP code. Currently no memory fencing is required.
107 //
108 #define MEMORY_FENCE()
109 
110 //
111 // Some compilers don't support the forward reference construct:
112 //  typedef struct XXXXX. The forward reference is required for
113 //  ANSI compatibility.
114 //
115 // The following macro provide a workaround for such cases.
116 //
117 
118 
119 #ifdef EFI_NO_INTERFACE_DECL
120   #define EFI_FORWARD_DECLARATION(x)
121 #else
122   #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x
123 #endif
124 
125 
126 #define _EFIAPI
127 
128 #endif // ifndef _EFI_BIND_H_
129 
130