iPXE
efi.h
Go to the documentation of this file.
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
24FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25FILE_SECBOOT ( PERMITTED );
26
27#include <ipxe/efi/efi.h>
29
30/** Bit shift for EFI error/warning bit */
31#define EFI_ERR_SHIFT ( 8 * ( sizeof ( EFI_STATUS ) - 1 ) )
32
33/**
34 * Convert platform error code to platform component of iPXE error code
35 *
36 * @v platform Platform error code
37 * @ret errno Platform component of iPXE error code
38 */
39#define PLATFORM_TO_ERRNO( platform ) \
40 ( ( (platform) | \
41 ( ( ( EFI_STATUS ) (platform) ) >> EFI_ERR_SHIFT ) ) & 0xff )
42
43/**
44 * Convert iPXE error code to platform error code
45 *
46 * @v errno iPXE error code
47 * @ret platform Platform error code
48 */
49#define ERRNO_TO_PLATFORM( errno ) \
50 ( ( ( ( EFI_STATUS ) (errno) & 0x80 ) << EFI_ERR_SHIFT ) | \
51 ( (errno) & 0x7f ) )
52
53/* Platform-specific error codes */
54#define PLATFORM_ENOERR EFI_SUCCESS
55#define PLATFORM_E2BIG EFI_BUFFER_TOO_SMALL
56#define PLATFORM_EACCES EFI_ACCESS_DENIED
57#define PLATFORM_EADDRINUSE EFI_ALREADY_STARTED
58#define PLATFORM_EADDRNOTAVAIL EFI_NOT_READY
59#define PLATFORM_EAFNOSUPPORT EFI_UNSUPPORTED
60#define PLATFORM_EAGAIN EFI_NOT_READY
61#define PLATFORM_EALREADY EFI_ALREADY_STARTED
62#define PLATFORM_EBADF EFI_INVALID_PARAMETER
63#define PLATFORM_EBADMSG EFI_PROTOCOL_ERROR
64#define PLATFORM_EBUSY EFI_NO_RESPONSE
65#define PLATFORM_ECANCELED EFI_ABORTED
66#define PLATFORM_ECHILD EFI_NOT_FOUND
67#define PLATFORM_ECONNABORTED EFI_ABORTED
68#define PLATFORM_ECONNREFUSED EFI_NO_RESPONSE
69#define PLATFORM_ECONNRESET EFI_ABORTED
70#define PLATFORM_EDEADLK EFI_NOT_READY
71#define PLATFORM_EDESTADDRREQ EFI_PROTOCOL_ERROR
72#define PLATFORM_EDOM EFI_INVALID_PARAMETER
73#define PLATFORM_EDQUOT EFI_VOLUME_FULL
74#define PLATFORM_EEXIST EFI_WRITE_PROTECTED
75#define PLATFORM_EFAULT EFI_INVALID_PARAMETER
76#define PLATFORM_EFBIG EFI_END_OF_MEDIA
77#define PLATFORM_EHOSTUNREACH EFI_NO_RESPONSE
78#define PLATFORM_EIDRM EFI_INVALID_PARAMETER
79#define PLATFORM_EILSEQ EFI_INVALID_PARAMETER
80#define PLATFORM_EINPROGRESS EFI_ALREADY_STARTED
81#define PLATFORM_EINTR EFI_NOT_READY
82#define PLATFORM_EINVAL EFI_INVALID_PARAMETER
83#define PLATFORM_EIO EFI_PROTOCOL_ERROR
84#define PLATFORM_EISCONN EFI_ALREADY_STARTED
85#define PLATFORM_EISDIR EFI_PROTOCOL_ERROR
86#define PLATFORM_ELOOP EFI_VOLUME_CORRUPTED
87#define PLATFORM_EMFILE EFI_OUT_OF_RESOURCES
88#define PLATFORM_EMLINK EFI_OUT_OF_RESOURCES
89#define PLATFORM_EMSGSIZE EFI_BAD_BUFFER_SIZE
90#define PLATFORM_EMULTIHOP EFI_INVALID_PARAMETER
91#define PLATFORM_ENAMETOOLONG EFI_INVALID_PARAMETER
92#define PLATFORM_ENETDOWN EFI_NO_RESPONSE
93#define PLATFORM_ENETRESET EFI_ABORTED
94#define PLATFORM_ENETUNREACH EFI_NO_RESPONSE
95#define PLATFORM_ENFILE EFI_OUT_OF_RESOURCES
96#define PLATFORM_ENOBUFS EFI_OUT_OF_RESOURCES
97#define PLATFORM_ENODATA EFI_NO_RESPONSE
98#define PLATFORM_ENODEV EFI_DEVICE_ERROR
99#define PLATFORM_ENOENT EFI_NOT_FOUND
100#define PLATFORM_ENOEXEC EFI_LOAD_ERROR
101#define PLATFORM_ENOLCK EFI_OUT_OF_RESOURCES
102#define PLATFORM_ENOLINK EFI_OUT_OF_RESOURCES
103#define PLATFORM_ENOMEM EFI_OUT_OF_RESOURCES
104#define PLATFORM_ENOMSG EFI_PROTOCOL_ERROR
105#define PLATFORM_ENOPROTOOPT EFI_UNSUPPORTED
106#define PLATFORM_ENOSPC EFI_VOLUME_FULL
107#define PLATFORM_ENOSR EFI_OUT_OF_RESOURCES
108#define PLATFORM_ENOSTR EFI_PROTOCOL_ERROR
109#define PLATFORM_ENOSYS EFI_UNSUPPORTED
110#define PLATFORM_ENOTCONN EFI_NOT_STARTED
111#define PLATFORM_ENOTDIR EFI_VOLUME_CORRUPTED
112#define PLATFORM_ENOTEMPTY EFI_VOLUME_CORRUPTED
113#define PLATFORM_ENOTSOCK EFI_INVALID_PARAMETER
114#define PLATFORM_ENOTSUP EFI_UNSUPPORTED
115#define PLATFORM_ENOTTY EFI_UNSUPPORTED
116#define PLATFORM_ENXIO EFI_NOT_FOUND
117#define PLATFORM_EOPNOTSUPP EFI_UNSUPPORTED
118#define PLATFORM_EOVERFLOW EFI_BUFFER_TOO_SMALL
119#define PLATFORM_EPERM EFI_ACCESS_DENIED
120#define PLATFORM_EPIPE EFI_ABORTED
121#define PLATFORM_EPROTO EFI_PROTOCOL_ERROR
122#define PLATFORM_EPROTONOSUPPORT EFI_UNSUPPORTED
123#define PLATFORM_EPROTOTYPE EFI_INVALID_PARAMETER
124#define PLATFORM_ERANGE EFI_BUFFER_TOO_SMALL
125#define PLATFORM_EROFS EFI_WRITE_PROTECTED
126#define PLATFORM_ESPIPE EFI_END_OF_FILE
127#define PLATFORM_ESRCH EFI_NOT_STARTED
128#define PLATFORM_ESTALE EFI_PROTOCOL_ERROR
129#define PLATFORM_ETIME EFI_TIMEOUT
130#define PLATFORM_ETIMEDOUT EFI_TIMEOUT
131#define PLATFORM_ETXTBSY EFI_MEDIA_CHANGED
132#define PLATFORM_EWOULDBLOCK EFI_NOT_READY
133#define PLATFORM_EXDEV EFI_VOLUME_CORRUPTED
134
135#endif /* _IPXE_ERRNO_EFI_H */
Defines data types and constants introduced in UEFI.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
EFI API.