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 typedef _Bool bool; 57 58 enum { false = 0, true = 1 }; 59 60 /* 61 * Below are truly Linux-specific types that should never collide with 62 * any application/library that wants linux/types.h. 63 */ 64 65 #ifdef __CHECKER__ 66 #define __bitwise__ __attribute__((bitwise)) 67 #else 68 #define __bitwise__ 69 #endif 70 #define __bitwise __bitwise__ 71 72 typedef __u16 __bitwise __le16; 73 typedef __u16 __bitwise __be16; 74 typedef __u32 __bitwise __le32; 75 typedef __u32 __bitwise __be32; 76 typedef __u64 __bitwise __le64; 77 typedef __u64 __bitwise __be64; 78 79 typedef __u16 __bitwise __sum16; 80 typedef __u32 __bitwise __wsum; 81 82 /* 83 * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid 84 * common 32/64-bit compat problems. 85 * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other 86 * architectures) and to 8-byte boundaries on 64-bit architectures. The new 87 * aligned_64 type enforces 8-byte alignment so that structs containing 88 * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. 89 * No conversions are necessary between 32-bit user-space and a 64-bit kernel. 90 */ 91 #define __aligned_u64 __u64 __attribute__((aligned(8))) 92 #define __aligned_be64 __be64 __attribute__((aligned(8))) 93 #define __aligned_le64 __le64 __attribute__((aligned(8))) 94 95 /* 96 * The following typedefs are also protected by individual ifdefs for 97 * historical reasons: 98 */ 99 #ifndef _SIZE_T 100 #define _SIZE_T 101 typedef __kernel_size_t size_t; 102 #endif 103 104 #ifndef _SSIZE_T 105 #define _SSIZE_T 106 typedef __kernel_ssize_t ssize_t; 107 #endif 108 109 #ifndef _PTRDIFF_T 110 #define _PTRDIFF_T 111 typedef __kernel_ptrdiff_t ptrdiff_t; 112 #endif 113 114 #ifndef _CLOCK_T 115 #define _CLOCK_T 116 typedef __kernel_clock_t clock_t; 117 #endif 118 119 #ifndef _CADDR_T 120 #define _CADDR_T 121 typedef __kernel_caddr_t caddr_t; 122 #endif 123 124 /* bsd */ 125 typedef unsigned char u_char; 126 typedef unsigned short u_short; 127 typedef unsigned int u_int; 128 typedef unsigned long u_long; 129 130 /* sysv */ 131 typedef unsigned char unchar; 132 typedef unsigned short ushort; 133 typedef unsigned int uint; 134 typedef unsigned long ulong; 135 136 typedef unsigned __bitwise __poll_t; 137