iPXE
efi.h
Go to the documentation of this file.
00001 #ifndef _IPXE_ERRNO_EFI_H
00002 #define _IPXE_ERRNO_EFI_H
00003 
00004 /**
00005  * @file
00006  *
00007  * EFI platform error codes
00008  *
00009  * We derive our platform error codes from the possible values for
00010  * EFI_STATUS defined in the UEFI specification.
00011  *
00012  * EFI_STATUS codes are 32/64-bit values consisting of a top bit which
00013  * is set for errors and clear for warnings, and a mildly undefined
00014  * code of low bits indicating the precise error/warning code.  Errors
00015  * and warnings have completely separate namespaces.
00016  *
00017  * We assume that no EFI_STATUS code will ever be defined which uses
00018  * more than bits 0-6 of the low bits.  We then choose to encode our
00019  * platform-specific error by mapping bit 31/63 of the EFI_STATUS to
00020  * bit 7 of the platform-specific error code, and preserving bits 0-6
00021  * as-is.
00022  */
00023 
00024 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00025 
00026 #include <ipxe/efi/efi.h>
00027 #include <ipxe/efi/Uefi/UefiBaseType.h>
00028 
00029 /** Bit shift for EFI error/warning bit */
00030 #define EFI_ERR_SHIFT ( 8 * ( sizeof ( EFI_STATUS ) - 1 ) )
00031 
00032 /**
00033  * Convert platform error code to platform component of iPXE error code
00034  *
00035  * @v platform          Platform error code
00036  * @ret errno           Platform component of iPXE error code
00037  */
00038 #define PLATFORM_TO_ERRNO( platform )                                   \
00039         ( ( (platform) |                                                \
00040             ( ( ( EFI_STATUS ) (platform) ) >> EFI_ERR_SHIFT ) ) & 0xff )
00041 
00042 /**
00043  * Convert iPXE error code to platform error code
00044  *
00045  * @v errno             iPXE error code
00046  * @ret platform        Platform error code
00047  */
00048 #define ERRNO_TO_PLATFORM( errno )                                      \
00049         ( ( ( ( EFI_STATUS ) (errno) & 0x80 ) << EFI_ERR_SHIFT ) |      \
00050           ( (errno) & 0x7f ) )
00051 
00052 /* Platform-specific error codes */
00053 #define PLATFORM_ENOERR         EFI_SUCCESS
00054 #define PLATFORM_E2BIG          EFI_BUFFER_TOO_SMALL
00055 #define PLATFORM_EACCES         EFI_ACCESS_DENIED
00056 #define PLATFORM_EADDRINUSE     EFI_ALREADY_STARTED
00057 #define PLATFORM_EADDRNOTAVAIL  EFI_NOT_READY
00058 #define PLATFORM_EAFNOSUPPORT   EFI_UNSUPPORTED
00059 #define PLATFORM_EAGAIN         EFI_NOT_READY
00060 #define PLATFORM_EALREADY       EFI_ALREADY_STARTED
00061 #define PLATFORM_EBADF          EFI_INVALID_PARAMETER
00062 #define PLATFORM_EBADMSG        EFI_PROTOCOL_ERROR
00063 #define PLATFORM_EBUSY          EFI_NO_RESPONSE
00064 #define PLATFORM_ECANCELED      EFI_ABORTED
00065 #define PLATFORM_ECHILD         EFI_NOT_FOUND
00066 #define PLATFORM_ECONNABORTED   EFI_ABORTED
00067 #define PLATFORM_ECONNREFUSED   EFI_NO_RESPONSE
00068 #define PLATFORM_ECONNRESET     EFI_ABORTED
00069 #define PLATFORM_EDEADLK        EFI_NOT_READY
00070 #define PLATFORM_EDESTADDRREQ   EFI_PROTOCOL_ERROR
00071 #define PLATFORM_EDOM           EFI_INVALID_PARAMETER
00072 #define PLATFORM_EDQUOT         EFI_VOLUME_FULL
00073 #define PLATFORM_EEXIST         EFI_WRITE_PROTECTED
00074 #define PLATFORM_EFAULT         EFI_INVALID_PARAMETER
00075 #define PLATFORM_EFBIG          EFI_END_OF_MEDIA
00076 #define PLATFORM_EHOSTUNREACH   EFI_NO_RESPONSE
00077 #define PLATFORM_EIDRM          EFI_INVALID_PARAMETER
00078 #define PLATFORM_EILSEQ         EFI_INVALID_PARAMETER
00079 #define PLATFORM_EINPROGRESS    EFI_ALREADY_STARTED
00080 #define PLATFORM_EINTR          EFI_NOT_READY
00081 #define PLATFORM_EINVAL         EFI_INVALID_PARAMETER
00082 #define PLATFORM_EIO            EFI_PROTOCOL_ERROR
00083 #define PLATFORM_EISCONN        EFI_ALREADY_STARTED
00084 #define PLATFORM_EISDIR         EFI_PROTOCOL_ERROR
00085 #define PLATFORM_ELOOP          EFI_VOLUME_CORRUPTED
00086 #define PLATFORM_EMFILE         EFI_OUT_OF_RESOURCES
00087 #define PLATFORM_EMLINK         EFI_OUT_OF_RESOURCES
00088 #define PLATFORM_EMSGSIZE       EFI_BAD_BUFFER_SIZE
00089 #define PLATFORM_EMULTIHOP      EFI_INVALID_PARAMETER
00090 #define PLATFORM_ENAMETOOLONG   EFI_INVALID_PARAMETER
00091 #define PLATFORM_ENETDOWN       EFI_NO_RESPONSE
00092 #define PLATFORM_ENETRESET      EFI_ABORTED
00093 #define PLATFORM_ENETUNREACH    EFI_NO_RESPONSE
00094 #define PLATFORM_ENFILE         EFI_OUT_OF_RESOURCES
00095 #define PLATFORM_ENOBUFS        EFI_OUT_OF_RESOURCES
00096 #define PLATFORM_ENODATA        EFI_NO_RESPONSE
00097 #define PLATFORM_ENODEV         EFI_DEVICE_ERROR
00098 #define PLATFORM_ENOENT         EFI_NOT_FOUND
00099 #define PLATFORM_ENOEXEC        EFI_LOAD_ERROR
00100 #define PLATFORM_ENOLCK         EFI_OUT_OF_RESOURCES
00101 #define PLATFORM_ENOLINK        EFI_OUT_OF_RESOURCES
00102 #define PLATFORM_ENOMEM         EFI_OUT_OF_RESOURCES
00103 #define PLATFORM_ENOMSG         EFI_PROTOCOL_ERROR
00104 #define PLATFORM_ENOPROTOOPT    EFI_UNSUPPORTED
00105 #define PLATFORM_ENOSPC         EFI_VOLUME_FULL
00106 #define PLATFORM_ENOSR          EFI_OUT_OF_RESOURCES
00107 #define PLATFORM_ENOSTR         EFI_PROTOCOL_ERROR
00108 #define PLATFORM_ENOSYS         EFI_UNSUPPORTED
00109 #define PLATFORM_ENOTCONN       EFI_NOT_STARTED
00110 #define PLATFORM_ENOTDIR        EFI_VOLUME_CORRUPTED
00111 #define PLATFORM_ENOTEMPTY      EFI_VOLUME_CORRUPTED
00112 #define PLATFORM_ENOTSOCK       EFI_INVALID_PARAMETER
00113 #define PLATFORM_ENOTSUP        EFI_UNSUPPORTED
00114 #define PLATFORM_ENOTTY         EFI_UNSUPPORTED
00115 #define PLATFORM_ENXIO          EFI_NOT_FOUND
00116 #define PLATFORM_EOPNOTSUPP     EFI_UNSUPPORTED
00117 #define PLATFORM_EOVERFLOW      EFI_BUFFER_TOO_SMALL
00118 #define PLATFORM_EPERM          EFI_ACCESS_DENIED
00119 #define PLATFORM_EPIPE          EFI_ABORTED
00120 #define PLATFORM_EPROTO         EFI_PROTOCOL_ERROR
00121 #define PLATFORM_EPROTONOSUPPORT EFI_UNSUPPORTED
00122 #define PLATFORM_EPROTOTYPE     EFI_INVALID_PARAMETER
00123 #define PLATFORM_ERANGE         EFI_BUFFER_TOO_SMALL
00124 #define PLATFORM_EROFS          EFI_WRITE_PROTECTED
00125 #define PLATFORM_ESPIPE         EFI_END_OF_FILE
00126 #define PLATFORM_ESRCH          EFI_NOT_STARTED
00127 #define PLATFORM_ESTALE         EFI_PROTOCOL_ERROR
00128 #define PLATFORM_ETIME          EFI_TIMEOUT
00129 #define PLATFORM_ETIMEDOUT      EFI_TIMEOUT
00130 #define PLATFORM_ETXTBSY        EFI_MEDIA_CHANGED
00131 #define PLATFORM_EWOULDBLOCK    EFI_NOT_READY
00132 #define PLATFORM_EXDEV          EFI_VOLUME_CORRUPTED
00133 
00134 #endif /* _IPXE_ERRNO_EFI_H */