1 #pragma once 2 #include <efidef.h> 3 #include "compiler_attributes.h" 4 #include "linux/posix_types.h" 5 #include "linux/bitsperlong.h" 6 7 // Simplified version of Linux types.h 8 9 #define typeof(p) __typeof__(p) 10 11 /* 12 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the 13 * header files exported to user space 14 */ 15 16 #ifndef __ASSEMBLY__ 17 /* 18 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the 19 * header files exported to user space 20 */ 21 22 typedef __signed__ char __s8; 23 typedef unsigned char __u8; 24 25 typedef __signed__ short __s16; 26 typedef unsigned short __u16; 27 28 typedef __signed__ int __s32; 29 typedef unsigned int __u32; 30 31 #ifdef __GNUC__ 32 __extension__ typedef __signed__ long long __s64; 33 __extension__ typedef unsigned long long __u64; 34 #else 35 typedef __signed__ long long __s64; 36 typedef unsigned long long __u64; 37 #endif 38 39 #endif /* __ASSEMBLY__ */ 40 41 typedef __s8 s8; 42 typedef __u8 u8; 43 typedef __s16 s16; 44 typedef __u16 u16; 45 typedef __s32 s32; 46 typedef __u32 u32; 47 typedef __s64 s64; 48 typedef __u64 u64; 49 50 typedef unsigned long efi_status_t; 51 typedef u8 efi_bool_t; 52 typedef u16 efi_char16_t; /* UNICODE character */ 53 typedef u64 efi_physical_addr_t; 54 typedef void *efi_handle_t; 55 56 57 typedef _Bool bool; 58 59 enum { false = 0, true = 1 }; 60 61 /* 62 * Below are truly Linux-specific types that should never collide with 63 * any application/library that wants linux/types.h. 64 */ 65 66 #ifdef __CHECKER__ 67 #define __bitwise__ __attribute__((bitwise)) 68 #else 69 #define __bitwise__ 70 #endif 71 #define __bitwise __bitwise__ 72 73 typedef __u16 __bitwise __le16; 74 typedef __u16 __bitwise __be16; 75 typedef __u32 __bitwise __le32; 76 typedef __u32 __bitwise __be32; 77 typedef __u64 __bitwise __le64; 78 typedef __u64 __bitwise __be64; 79 80 typedef __u16 __bitwise __sum16; 81 typedef __u32 __bitwise __wsum; 82 83 /* 84 * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid 85 * common 32/64-bit compat problems. 86 * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other 87 * architectures) and to 8-byte boundaries on 64-bit architectures. The new 88 * aligned_64 type enforces 8-byte alignment so that structs containing 89 * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. 90 * No conversions are necessary between 32-bit user-space and a 64-bit kernel. 91 */ 92 #define __aligned_u64 __u64 __attribute__((aligned(8))) 93 #define __aligned_be64 __be64 __attribute__((aligned(8))) 94 #define __aligned_le64 __le64 __attribute__((aligned(8))) 95 96 /* 97 * The following typedefs are also protected by individual ifdefs for 98 * historical reasons: 99 */ 100 #ifndef _SIZE_T 101 #define _SIZE_T 102 typedef __kernel_size_t size_t; 103 #endif 104 105 #ifndef _SSIZE_T 106 #define _SSIZE_T 107 typedef __kernel_ssize_t ssize_t; 108 #endif 109 110 #ifndef _PTRDIFF_T 111 #define _PTRDIFF_T 112 typedef __kernel_ptrdiff_t ptrdiff_t; 113 #endif 114 115 #ifndef _CLOCK_T 116 #define _CLOCK_T 117 typedef __kernel_clock_t clock_t; 118 #endif 119 120 #ifndef _CADDR_T 121 #define _CADDR_T 122 typedef __kernel_caddr_t caddr_t; 123 #endif 124 125 /* bsd */ 126 typedef unsigned char u_char; 127 typedef unsigned short u_short; 128 typedef unsigned int u_int; 129 typedef unsigned long u_long; 130 131 /* sysv */ 132 typedef unsigned char unchar; 133 typedef unsigned short ushort; 134 typedef unsigned int uint; 135 typedef unsigned long ulong; 136 137 typedef unsigned __bitwise __poll_t; 138