1281156Sandrew/* $FreeBSD: stable/11/stand/efi/include/arm/efibind.h 298826 2016-04-30 00:26:38Z pfg $ */
2281156Sandrew/*++
3281156Sandrew
4281156SandrewCopyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
5281156Sandrew
6281156SandrewThis program and the accompanying materials
7281156Sandreware licensed and made available under the terms and conditions of the BSD License
8281156Sandrewwhich accompanies this distribution.  The full text of the license may be found at
9281156Sandrewhttp://opensource.org/licenses/bsd-license.php
10281156Sandrew
11281156SandrewTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12281156SandrewWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13281156Sandrew
14281156SandrewModule Name:
15281156Sandrew
16281156Sandrew  EfiBind.h
17281156Sandrew
18281156SandrewAbstract:
19281156Sandrew
20281156Sandrew  Processor or Compiler specific defines and types for IA-32.
21281156Sandrew  We are using the ANSI C 2000 _t type definitions for basic types.
22281156Sandrew  This it technically a violation of the coding standard, but they
23281156Sandrew  are used to make EfiTypes.h portable. Code other than EfiTypes.h
24281156Sandrew  should never use any ANSI C 2000 _t integer types.
25281156Sandrew
26281156Sandrew--*/
27281156Sandrew
28281156Sandrew#ifndef _EFI_BIND_H_
29281156Sandrew#define _EFI_BIND_H_
30281156Sandrew
31281156Sandrew
32281156Sandrew#define EFI_DRIVER_ENTRY_POINT(InitFunction)
33281156Sandrew#define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT
34281156Sandrew
35281156Sandrew
36281156Sandrew//
37298826Spfg// Make sure we are using the correct packing rules per EFI specification
38281156Sandrew//
39281156Sandrew#ifndef __GNUC__
40281156Sandrew#pragma pack()
41281156Sandrew#endif
42281156Sandrew
43281156Sandrew
44281156Sandrew#ifdef __FreeBSD__
45281156Sandrew#include <sys/stdint.h>
46281156Sandrew#else
47281156Sandrew//
48281156Sandrew// Assume standard IA-32 alignment.
49281156Sandrew// BugBug: Need to check portability of long long
50281156Sandrew//
51281156Sandrewtypedef unsigned long long  uint64_t;
52281156Sandrewtypedef long long           int64_t;
53281156Sandrewtypedef unsigned int        uint32_t;
54281156Sandrewtypedef int                 int32_t;
55281156Sandrewtypedef unsigned short      uint16_t;
56281156Sandrewtypedef short               int16_t;
57281156Sandrewtypedef unsigned char       uint8_t;
58281156Sandrewtypedef signed char         int8_t;
59281156Sandrew#endif
60281156Sandrew
61281156Sandrewtypedef uint64_t   UINT64;
62281156Sandrewtypedef int64_t    INT64;
63281156Sandrewtypedef uint32_t   UINT32;
64281156Sandrewtypedef int32_t    INT32;
65281156Sandrewtypedef uint16_t   UINT16;
66281156Sandrewtypedef int16_t    INT16;
67281156Sandrewtypedef uint8_t    UINT8;
68281156Sandrewtypedef int8_t     INT8;
69281156Sandrew
70281156Sandrew#undef VOID
71281156Sandrew#define VOID    void
72281156Sandrew
73281156Sandrew//
74281156Sandrew// Native integer size in stdint.h
75281156Sandrew//
76281156Sandrewtypedef uint32_t  UINTN;
77281156Sandrewtypedef int32_t   INTN;
78281156Sandrew
79281156Sandrew#define EFIERR(a)           (0x80000000 | a)
80281156Sandrew#define EFI_ERROR_MASK      0x80000000
81281156Sandrew#define EFIERR_OEM(a)       (0xc0000000 | a)
82281156Sandrew
83281156Sandrew//
84281156Sandrew// Processor specific defines
85281156Sandrew//
86281156Sandrew#define EFI_MAX_BIT       0x80000000
87281156Sandrew#define MAX_2_BITS        0xC0000000
88281156Sandrew
89281156Sandrew//
90281156Sandrew// Maximum legal IA-32 address
91281156Sandrew//
92281156Sandrew#define EFI_MAX_ADDRESS   0xFFFFFFFF
93281156Sandrew
94281156Sandrew//
95281156Sandrew//  Bad pointer value to use in check builds.
96281156Sandrew//  if you see this value you are using uninitialized or free'ed data
97281156Sandrew//
98281156Sandrew#define EFI_BAD_POINTER          0xAFAFAFAF
99281156Sandrew#define EFI_BAD_POINTER_AS_BYTE  0xAF
100281156Sandrew
101281156Sandrew#define EFI_DEADLOOP()    { volatile UINTN __iii; __iii = 1; while (__iii); }
102281156Sandrew
103281156Sandrew//
104281156Sandrew// Inject a break point in the code to assist debugging for NT Emulation Environment
105281156Sandrew// For real hardware, just put in a halt loop. Don't do a while(1) because the
106281156Sandrew// compiler will optimize away the rest of the function following, so that you run out in
107281156Sandrew// the weeds if you skip over it with a debugger.
108281156Sandrew//
109281156Sandrew#define EFI_BREAKPOINT EFI_DEADLOOP()
110281156Sandrew
111281156Sandrew
112281156Sandrew//
113281156Sandrew// Memory Fence forces serialization, and is needed to support out of order
114281156Sandrew//  memory transactions. The Memory Fence is mainly used to make sure IO
115281156Sandrew//  transactions complete in a deterministic sequence, and to syncronize locks
116281156Sandrew//  an other MP code. Currently no memory fencing is required.
117281156Sandrew//
118281156Sandrew#define MEMORY_FENCE()
119281156Sandrew
120281156Sandrew//
121281156Sandrew// Some compilers don't support the forward reference construct:
122281156Sandrew//  typedef struct XXXXX. The forward reference is required for
123281156Sandrew//  ANSI compatibility.
124281156Sandrew//
125281156Sandrew// The following macro provide a workaround for such cases.
126281156Sandrew//
127281156Sandrew
128281156Sandrew
129281156Sandrew#ifdef EFI_NO_INTERFACE_DECL
130281156Sandrew  #define EFI_FORWARD_DECLARATION(x)
131281156Sandrew#else
132281156Sandrew  #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x
133281156Sandrew#endif
134281156Sandrew
135281156Sandrew
136281156Sandrew//
137281156Sandrew// Some C compilers optimize the calling conventions to increase performance.
138281156Sandrew// EFIAPI is used to make all public APIs follow the standard C calling
139281156Sandrew// convention.
140281156Sandrew//
141281156Sandrew#define EFIAPI
142281156Sandrew
143281156Sandrew
144281156Sandrew
145281156Sandrew//
146281156Sandrew// For symbol name in GNU assembly code, an extra "_" is necessary
147281156Sandrew//
148281156Sandrew#if defined(__GNUC__)
149281156Sandrew  ///
150281156Sandrew  /// Private worker functions for ASM_PFX()
151281156Sandrew  ///
152281156Sandrew  #define _CONCATENATE(a, b)  __CONCATENATE(a, b)
153281156Sandrew  #define __CONCATENATE(a, b) a ## b
154281156Sandrew
155281156Sandrew  ///
156281156Sandrew  /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix
157281156Sandrew  /// on symbols in assembly language.
158281156Sandrew  ///
159281156Sandrew  #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)
160281156Sandrew
161281156Sandrew#endif
162281156Sandrew
163281156Sandrew#define INTERFACE_DECL(x) struct x
164281156Sandrew
165281156Sandrew#endif
166