Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

200 lines
6.0 KiB

  1. /*++
  2. Copyright (c) 1998 Intel Corporation
  3. Module Name:
  4. efefind.h
  5. Abstract:
  6. EFI to compile bindings
  7. Revision History
  8. --*/
  9. #pragma pack()
  10. /*
  11. * Basic int types of various widths
  12. */
  13. #if (__STDC_VERSION__ < 199901L )
  14. /* No ANSI C 1999/2000 stdint.h integer width declarations */
  15. #if _MSC_EXTENSIONS
  16. /* Use Microsoft C compiler integer width declarations */
  17. typedef unsigned __int64 uint64_t;
  18. typedef __int64 int64_t;
  19. typedef unsigned __int32 uint32_t;
  20. typedef __int32 int32_t;
  21. typedef unsigned __int16 uint16_t;
  22. typedef __int16 int16_t;
  23. typedef unsigned __int8 uint8_t;
  24. typedef __int8 int8_t;
  25. #else
  26. #ifdef UNIX_LP64
  27. /* Use LP64 programming model from C_FLAGS for integer width declarations */
  28. typedef unsigned long uint64_t;
  29. typedef long int64_t;
  30. typedef unsigned int uint32_t;
  31. typedef int int32_t;
  32. typedef unsigned short uint16_t;
  33. typedef short int16_t;
  34. typedef unsigned char uint8_t;
  35. typedef char int8_t;
  36. #else
  37. /* Assume P64 programming model from C_FLAGS for integer width declarations */
  38. typedef unsigned long long uint64_t;
  39. typedef long long int64_t;
  40. typedef unsigned int uint32_t;
  41. typedef int int32_t;
  42. typedef unsigned short uint16_t;
  43. typedef short int16_t;
  44. typedef unsigned char uint8_t;
  45. typedef char int8_t;
  46. #endif
  47. #endif
  48. #endif
  49. /*
  50. * Basic EFI types of various widths
  51. */
  52. #ifndef _BASETSD_H_
  53. typedef uint64_t UINT64;
  54. typedef int64_t INT64;
  55. typedef uint32_t UINT32;
  56. typedef int32_t INT32;
  57. typedef uint16_t UINT16;
  58. typedef int16_t INT16;
  59. typedef uint8_t UINT8;
  60. typedef int8_t INT8;
  61. #endif
  62. #undef VOID
  63. #define VOID void
  64. typedef int64_t INTN;
  65. typedef uint64_t UINTN;
  66. /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  67. * BugBug: Code to debug
  68. */
  69. #define BIT63 0x8000000000000000
  70. #define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63)
  71. #define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) )
  72. /*
  73. * Macro's with casts make this much easier to use and read.
  74. */
  75. #define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port)))
  76. #define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data))
  77. /*
  78. * BugBug: End Debug Code!!!
  79. * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
  80. #define EFIERR(a) (0x8000000000000000 | a)
  81. #define EFI_ERROR_MASK 0x8000000000000000
  82. #define EFIERR_OEM(a) (0xc000000000000000 | a)
  83. #define BAD_POINTER 0xFBFBFBFBFBFBFBFB
  84. #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF
  85. #define BREAKPOINT() while (TRUE)
  86. /*
  87. * Pointers must be aligned to these address to function
  88. * you will get an alignment fault if this value is less than 8
  89. */
  90. #define MIN_ALIGNMENT_SIZE 8
  91. #define ALIGN_VARIABLE(Value , Adjustment) \
  92. (UINTN) Adjustment = 0; \
  93. if((UINTN)Value % MIN_ALIGNMENT_SIZE) \
  94. (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \
  95. Value = (UINTN)Value + (UINTN)Adjustment
  96. /*
  97. * Define macros to create data structure signatures.
  98. */
  99. #define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))
  100. #define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16))
  101. #define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | (EFI_SIGNATURE_32(E,F,G,H) << 32))
  102. /*
  103. * To export & import functions in the EFI emulator environment
  104. */
  105. #define EXPORTAPI
  106. /*
  107. * EFIAPI - prototype calling convention for EFI function pointers
  108. * BOOTSERVICE - prototype for implementation of a boot service interface
  109. * RUNTIMESERVICE - prototype for implementation of a runtime service interface
  110. * RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service
  111. * RUNTIME_CODE - pragma macro for declaring runtime code
  112. */
  113. #ifndef EFIAPI /* Forces EFI calling conventions reguardless of compiler options */
  114. #if _MSC_EXTENSIONS
  115. #define EFIAPI __cdecl /* Force C calling convention for Microsoft C compiler */
  116. #else
  117. #define EFIAPI /* Substitute expresion to force C calling convention */
  118. #endif
  119. #endif
  120. #define BOOTSERVICE
  121. #define RUNTIMESERVICE
  122. #define RUNTIMEFUNCTION
  123. #define RUNTIME_CODE(a) alloc_text("rtcode", a)
  124. #define BEGIN_RUNTIME_DATA() data_seg("rtdata")
  125. #define END_RUNTIME_DATA() data_seg("")
  126. #define VOLATILE volatile
  127. /*
  128. * BugBug: Need to find out if this is portable accross compliers.
  129. */
  130. void __mf (void);
  131. #pragma intrinsic (__mf)
  132. #define MEMORY_FENCE() __mf()
  133. /*
  134. * When build similiar to FW, then link everything together as
  135. * one big module.
  136. */
  137. #define EFI_DRIVER_ENTRY_POINT(InitFunction)
  138. #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
  139. (_if)->LoadInternal(type, name, entry)
  140. /*
  141. * Some compilers don't support the forward reference construct:
  142. * typedef struct XXXXX
  143. *
  144. * The following macro provide a workaround for such cases.
  145. */
  146. #ifdef NO_INTERFACE_DECL
  147. #define INTERFACE_DECL(x)
  148. #else
  149. #define INTERFACE_DECL(x) typedef struct x
  150. #endif