• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 IA-32.
19   We are using the ANSI C 2000 _t type definitions for basic types.
20   This it technically a violation of the coding standard, but they
21   are used to make EfiTypes.h portable. Code other than EfiTypes.h
22   should never use any ANSI C 2000 _t integer types.
23 
24 --*/
25 
26 #ifndef _EFI_BIND_H_
27 #define _EFI_BIND_H_
28 
29 
30 #define EFI_DRIVER_ENTRY_POINT(InitFunction)
31 #define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT
32 
33 
34 //
35 // Make sure we are useing the correct packing rules per EFI specification
36 //
37 #ifndef __GNUC__
38 #pragma pack()
39 #endif
40 
41 
42 //
43 // Assume standard IA-32 alignment.
44 // BugBug: Need to check portability of long long
45 //
46 typedef unsigned long long  uint64_t;
47 typedef long long           int64_t;
48 typedef unsigned int        uint32_t;
49 typedef int                 int32_t;
50 typedef unsigned short      uint16_t;
51 typedef short               int16_t;
52 typedef unsigned char       uint8_t;
53 typedef signed char         int8_t;
54 
55 //
56 // Native integer size in stdint.h
57 //
58 typedef uint32_t  uintn_t;
59 typedef int32_t   intn_t;
60 
61 //
62 // Processor specific defines
63 //
64 #define EFI_MAX_BIT       0x80000000
65 #define MAX_2_BITS        0xC0000000
66 
67 //
68 // Maximum legal IA-32 address
69 //
70 #define EFI_MAX_ADDRESS   0xFFFFFFFF
71 
72 //
73 //  Bad pointer value to use in check builds.
74 //  if you see this value you are using uninitialized or free'ed data
75 //
76 #define EFI_BAD_POINTER          0xAFAFAFAF
77 #define EFI_BAD_POINTER_AS_BYTE  0xAF
78 
79 #define EFI_DEADLOOP()    { volatile UINTN __iii; __iii = 1; while (__iii); }
80 
81 //
82 // Inject a break point in the code to assist debugging for NT Emulation Environment
83 // For real hardware, just put in a halt loop. Don't do a while(1) because the
84 // compiler will optimize away the rest of the function following, so that you run out in
85 // the weeds if you skip over it with a debugger.
86 //
87 #define EFI_BREAKPOINT EFI_DEADLOOP()
88 
89 
90 //
91 // Memory Fence forces serialization, and is needed to support out of order
92 //  memory transactions. The Memory Fence is mainly used to make sure IO
93 //  transactions complete in a deterministic sequence, and to syncronize locks
94 //  an other MP code. Currently no memory fencing is required.
95 //
96 #define MEMORY_FENCE()
97 
98 //
99 // Some compilers don't support the forward reference construct:
100 //  typedef struct XXXXX. The forward reference is required for
101 //  ANSI compatibility.
102 //
103 // The following macro provide a workaround for such cases.
104 //
105 
106 
107 #ifdef EFI_NO_INTERFACE_DECL
108   #define EFI_FORWARD_DECLARATION(x)
109 #else
110   #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x
111 #endif
112 
113 
114 //
115 // Some C compilers optimize the calling conventions to increase performance.
116 // _EFIAPI is used to make all public APIs follow the standard C calling
117 // convention.
118 //
119 #define _EFIAPI
120 
121 
122 
123 //
124 // For symbol name in GNU assembly code, an extra "_" is necessary
125 //
126 #if defined(__GNUC__)
127   ///
128   /// Private worker functions for ASM_PFX()
129   ///
130   #define _CONCATENATE(a, b)  __CONCATENATE(a, b)
131   #define __CONCATENATE(a, b) a ## b
132 
133   ///
134   /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix
135   /// on symbols in assembly language.
136   ///
137   #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)
138 
139 #endif
140 
141 #endif
142 
143