Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / errno / efi.h
1 #ifndef _IPXE_ERRNO_EFI_H
2 #define _IPXE_ERRNO_EFI_H
3
4 /**
5  * @file
6  *
7  * EFI platform error codes
8  *
9  * We derive our platform error codes from the possible values for
10  * EFI_STATUS defined in the UEFI specification.
11  *
12  * EFI_STATUS codes are 32/64-bit values consisting of a top bit which
13  * is set for errors and clear for warnings, and a mildly undefined
14  * code of low bits indicating the precise error/warning code.  Errors
15  * and warnings have completely separate namespaces.
16  *
17  * We assume that no EFI_STATUS code will ever be defined which uses
18  * more than bits 0-6 of the low bits.  We then choose to encode our
19  * platform-specific error by mapping bit 31/63 of the EFI_STATUS to
20  * bit 7 of the platform-specific error code, and preserving bits 0-6
21  * as-is.
22  */
23
24 FILE_LICENCE ( GPL2_OR_LATER );
25
26 #include <ipxe/efi/efi.h>
27 #include <ipxe/efi/Uefi/UefiBaseType.h>
28
29 /** Bit shift for EFI error/warning bit */
30 #define EFI_ERR_SHIFT ( 8 * ( sizeof ( EFI_STATUS ) - 1 ) )
31
32 /**
33  * Convert platform error code to platform component of iPXE error code
34  *
35  * @v platform          Platform error code
36  * @ret errno           Platform component of iPXE error code
37  */
38 #define PLATFORM_TO_ERRNO( platform )                                   \
39         ( ( (platform) |                                                \
40             ( ( ( EFI_STATUS ) (platform) ) >> EFI_ERR_SHIFT ) ) & 0xff )
41
42 /**
43  * Convert iPXE error code to platform error code
44  *
45  * @v errno             iPXE error code
46  * @ret platform        Platform error code
47  */
48 #define ERRNO_TO_PLATFORM( errno )                                      \
49         ( ( ( ( EFI_STATUS ) (errno) & 0x80 ) << EFI_ERR_SHIFT ) |      \
50           ( (errno) & 0x7f ) )
51
52 /* Platform-specific error codes */
53 #define PLATFORM_ENOERR         EFI_SUCCESS
54 #define PLATFORM_E2BIG          EFI_BUFFER_TOO_SMALL
55 #define PLATFORM_EACCES         EFI_ACCESS_DENIED
56 #define PLATFORM_EADDRINUSE     EFI_ALREADY_STARTED
57 #define PLATFORM_EADDRNOTAVAIL  EFI_NOT_READY
58 #define PLATFORM_EAFNOSUPPORT   EFI_UNSUPPORTED
59 #define PLATFORM_EAGAIN         EFI_NOT_READY
60 #define PLATFORM_EALREADY       EFI_ALREADY_STARTED
61 #define PLATFORM_EBADF          EFI_INVALID_PARAMETER
62 #define PLATFORM_EBADMSG        EFI_PROTOCOL_ERROR
63 #define PLATFORM_EBUSY          EFI_NO_RESPONSE
64 #define PLATFORM_ECANCELED      EFI_ABORTED
65 #define PLATFORM_ECHILD         EFI_NOT_FOUND
66 #define PLATFORM_ECONNABORTED   EFI_ABORTED
67 #define PLATFORM_ECONNREFUSED   EFI_NO_RESPONSE
68 #define PLATFORM_ECONNRESET     EFI_ABORTED
69 #define PLATFORM_EDEADLK        EFI_NOT_READY
70 #define PLATFORM_EDESTADDRREQ   EFI_PROTOCOL_ERROR
71 #define PLATFORM_EDOM           EFI_INVALID_PARAMETER
72 #define PLATFORM_EDQUOT         EFI_VOLUME_FULL
73 #define PLATFORM_EEXIST         EFI_WRITE_PROTECTED
74 #define PLATFORM_EFAULT         EFI_INVALID_PARAMETER
75 #define PLATFORM_EFBIG          EFI_END_OF_MEDIA
76 #define PLATFORM_EHOSTUNREACH   EFI_NO_RESPONSE
77 #define PLATFORM_EIDRM          EFI_INVALID_PARAMETER
78 #define PLATFORM_EILSEQ         EFI_INVALID_PARAMETER
79 #define PLATFORM_EINPROGRESS    EFI_ALREADY_STARTED
80 #define PLATFORM_EINTR          EFI_NOT_READY
81 #define PLATFORM_EINVAL         EFI_INVALID_PARAMETER
82 #define PLATFORM_EIO            EFI_PROTOCOL_ERROR
83 #define PLATFORM_EISCONN        EFI_ALREADY_STARTED
84 #define PLATFORM_EISDIR         EFI_PROTOCOL_ERROR
85 #define PLATFORM_ELOOP          EFI_VOLUME_CORRUPTED
86 #define PLATFORM_EMFILE         EFI_OUT_OF_RESOURCES
87 #define PLATFORM_EMLINK         EFI_OUT_OF_RESOURCES
88 #define PLATFORM_EMSGSIZE       EFI_BAD_BUFFER_SIZE
89 #define PLATFORM_EMULTIHOP      EFI_INVALID_PARAMETER
90 #define PLATFORM_ENAMETOOLONG   EFI_INVALID_PARAMETER
91 #define PLATFORM_ENETDOWN       EFI_NO_RESPONSE
92 #define PLATFORM_ENETRESET      EFI_ABORTED
93 #define PLATFORM_ENETUNREACH    EFI_NO_RESPONSE
94 #define PLATFORM_ENFILE         EFI_OUT_OF_RESOURCES
95 #define PLATFORM_ENOBUFS        EFI_OUT_OF_RESOURCES
96 #define PLATFORM_ENODATA        EFI_NO_RESPONSE
97 #define PLATFORM_ENODEV         EFI_DEVICE_ERROR
98 #define PLATFORM_ENOENT         EFI_NOT_FOUND
99 #define PLATFORM_ENOEXEC        EFI_LOAD_ERROR
100 #define PLATFORM_ENOLCK         EFI_OUT_OF_RESOURCES
101 #define PLATFORM_ENOLINK        EFI_OUT_OF_RESOURCES
102 #define PLATFORM_ENOMEM         EFI_OUT_OF_RESOURCES
103 #define PLATFORM_ENOMSG         EFI_PROTOCOL_ERROR
104 #define PLATFORM_ENOPROTOOPT    EFI_UNSUPPORTED
105 #define PLATFORM_ENOSPC         EFI_VOLUME_FULL
106 #define PLATFORM_ENOSR          EFI_OUT_OF_RESOURCES
107 #define PLATFORM_ENOSTR         EFI_PROTOCOL_ERROR
108 #define PLATFORM_ENOSYS         EFI_UNSUPPORTED
109 #define PLATFORM_ENOTCONN       EFI_NOT_STARTED
110 #define PLATFORM_ENOTDIR        EFI_VOLUME_CORRUPTED
111 #define PLATFORM_ENOTEMPTY      EFI_VOLUME_CORRUPTED
112 #define PLATFORM_ENOTSOCK       EFI_INVALID_PARAMETER
113 #define PLATFORM_ENOTSUP        EFI_UNSUPPORTED
114 #define PLATFORM_ENOTTY         EFI_UNSUPPORTED
115 #define PLATFORM_ENXIO          EFI_NOT_FOUND
116 #define PLATFORM_EOPNOTSUPP     EFI_UNSUPPORTED
117 #define PLATFORM_EOVERFLOW      EFI_BUFFER_TOO_SMALL
118 #define PLATFORM_EPERM          EFI_ACCESS_DENIED
119 #define PLATFORM_EPIPE          EFI_ABORTED
120 #define PLATFORM_EPROTO         EFI_PROTOCOL_ERROR
121 #define PLATFORM_EPROTONOSUPPORT EFI_UNSUPPORTED
122 #define PLATFORM_EPROTOTYPE     EFI_INVALID_PARAMETER
123 #define PLATFORM_ERANGE         EFI_BUFFER_TOO_SMALL
124 #define PLATFORM_EROFS          EFI_WRITE_PROTECTED
125 #define PLATFORM_ESPIPE         EFI_END_OF_FILE
126 #define PLATFORM_ESRCH          EFI_NOT_STARTED
127 #define PLATFORM_ESTALE         EFI_PROTOCOL_ERROR
128 #define PLATFORM_ETIME          EFI_TIMEOUT
129 #define PLATFORM_ETIMEDOUT      EFI_TIMEOUT
130 #define PLATFORM_ETXTBSY        EFI_MEDIA_CHANGED
131 #define PLATFORM_EWOULDBLOCK    EFI_NOT_READY
132 #define PLATFORM_EXDEV          EFI_VOLUME_CORRUPTED
133
134 #endif /* _IPXE_ERRNO_EFI_H */