1 /* 2 * ipmi_err.h 3 * 4 * MontaVista IPMI interface, error values. 5 * 6 * Author: MontaVista Software, Inc. 7 * Corey Minyard <minyard@mvista.com> 8 * source@mvista.com 9 * 10 * Copyright 2002,2003,2004,2005 MontaVista Software Inc. 11 * 12 * This software is available to you under a choice of one of two 13 * licenses. You may choose to be licensed under the terms of the GNU 14 * Lesser General Public License (GPL) Version 2 or the modified BSD 15 * license below. The following disclamer applies to both licenses: 16 * 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 23 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 26 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * GNU Lesser General Public Licence 29 * 30 * This program is free software; you can redistribute it and/or 31 * modify it under the terms of the GNU Lesser General Public License 32 * as published by the Free Software Foundation; either version 2 of 33 * the License, or (at your option) any later version. 34 * 35 * You should have received a copy of the GNU Lesser General Public 36 * License along with this program; if not, write to the Free 37 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 38 * 39 * Modified BSD Licence 40 * 41 * Redistribution and use in source and binary forms, with or without 42 * modification, are permitted provided that the following conditions 43 * are met: 44 * 45 * 1. Redistributions of source code must retain the above copyright 46 * notice, this list of conditions and the following disclaimer. 47 * 2. Redistributions in binary form must reproduce the above 48 * copyright notice, this list of conditions and the following 49 * disclaimer in the documentation and/or other materials provided 50 * with the distribution. 51 * 3. The name of the author may not be used to endorse or promote 52 * products derived from this software without specific prior 53 * written permission. 54 */ 55 56 #ifndef OPENIPMI_ERR_H 57 #define OPENIPMI_ERR_H 58 59 /* 60 * Error values 61 * 62 * Return errors or reported errors can be due to OS problems or to 63 * reported IPMI errors for messages this code handled. These macros 64 * differentiate these. Note that this is NOT for handling the first 65 * byte of a response (the completion code) on a message you handle, it 66 * will simply be a byte of information. 67 */ 68 #define IPMI_OS_ERR_TOP 0x00000000 69 #define IPMI_IPMI_ERR_TOP 0x01000000 70 #define IPMI_RMCPP_ERR_TOP 0x02000000 71 #define IPMI_SOL_ERR_TOP 0x03000000 72 #define IPMI_IS_OS_ERR(E) (((E) & 0xffffff00) == IPMI_OS_ERR_TOP) 73 #define IPMI_GET_OS_ERR(E) ((E) & 0xff) 74 #define IPMI_OS_ERR_VAL(v) ((v) | IPMI_OS_ERR_TOP) 75 #define IPMI_IS_IPMI_ERR(E) (((E) & 0xffffff00) == IPMI_IPMI_ERR_TOP) 76 #define IPMI_GET_IPMI_ERR(E) ((E) & 0xff) 77 #define IPMI_IPMI_ERR_VAL(v) ((v) | IPMI_IPMI_ERR_TOP) 78 #define IPMI_IS_RMCPP_ERR(E) (((E) & 0xffffff00) == IPMI_RMCPP_ERR_TOP) 79 #define IPMI_GET_RMCPP_ERR(E) ((E) & 0xff) 80 #define IPMI_RMCPP_ERR_VAL(v) ((v) | IPMI_RMCPP_ERR_TOP) 81 #define IPMI_IS_SOL_ERR(E) (((E) & 0xffffff00) == IPMI_SOL_ERR_TOP) 82 #define IPMI_GET_SOL_ERR(E) ((E) & 0xff) 83 #define IPMI_SOL_ERR_VAL(v) ((v) | IPMI_SOL_ERR_TOP) 84 85 /* The following local system completion codes are defined to be 86 * returned by OpenIPMI: 87 * 88 * EBADF 89 * EINVAL 90 * E2BIG 91 * ENOMEM 92 * ENOENT 93 * ECANCELED 94 * ENOSYS 95 * EEXIST 96 * EAGAIN 97 * EPERM 98 */ 99 100 /* 101 * Completion codes for IPMI. 102 */ 103 #define IPMI_NODE_BUSY_CC 0xC0 104 #define IPMI_INVALID_CMD_CC 0xC1 105 #define IPMI_COMMAND_INVALID_FOR_LUN_CC 0xC2 106 #define IPMI_TIMEOUT_CC 0xC3 107 #define IPMI_OUT_OF_SPACE_CC 0xC4 108 #define IPMI_INVALID_RESERVATION_CC 0xC5 109 #define IPMI_REQUEST_DATA_TRUNCATED_CC 0xC6 110 #define IPMI_REQUEST_DATA_LENGTH_INVALID_CC 0xC7 111 #define IPMI_REQUESTED_DATA_LENGTH_EXCEEDED_CC 0xC8 112 #define IPMI_PARAMETER_OUT_OF_RANGE_CC 0xC9 113 #define IPMI_CANNOT_RETURN_REQ_LENGTH_CC 0xCA 114 #define IPMI_NOT_PRESENT_CC 0xCB 115 #define IPMI_INVALID_DATA_FIELD_CC 0xCC 116 #define IPMI_COMMAND_ILLEGAL_FOR_SENSOR_CC 0xCD 117 #define IPMI_COULD_NOT_PROVIDE_RESPONSE_CC 0xCE 118 #define IPMI_CANNOT_EXEC_DUPLICATE_REQUEST_CC 0xCF 119 #define IPMI_REPOSITORY_IN_UPDATE_MODE_CC 0xD0 120 #define IPMI_DEVICE_IN_FIRMWARE_UPDATE_CC 0xD1 121 #define IPMI_BMC_INIT_IN_PROGRESS_CC 0xD2 122 #define IPMI_DESTINATION_UNAVAILABLE_CC 0xD3 123 #define IPMI_INSUFFICIENT_PRIVILEGE_CC 0xD4 124 #define IPMI_NOT_SUPPORTED_IN_PRESENT_STATE_CC 0xD5 125 #define IPMI_UNKNOWN_ERR_CC 0xff 126 127 /* Error codes from RMCP+ */ 128 #define IPMI_RMCPP_INSUFFICIENT_RESOURCES_FOR_SESSION 0x01 129 #define IPMI_RMCPP_INVALID_SESSION_ID 0x02 130 #define IPMI_RMCPP_INVALID_PAYLOAD_TYPE 0x03 131 #define IPMI_RMCPP_INVALID_AUTHENTICATION_ALGORITHM 0x04 132 #define IPMI_RMCPP_INVALID_INTEGRITY_ALGORITHM 0x05 133 #define IPMI_RMCPP_NO_MATCHING_AUTHENTICATION_PAYLOAD 0x06 134 #define IPMI_RMCPP_NO_MATCHING_INTEGRITY_PAYLOAD 0x07 135 #define IPMI_RMCPP_INACTIVE_SESSION_ID 0x08 136 #define IPMI_RMCPP_INVALID_ROLE 0x09 137 #define IPMI_RMCPP_UNAUTHORIZED_ROLE_OR_PRIVILEGE 0x0a 138 #define IPMI_RMCPP_INSUFFICIENT_RESOURCES_FOR_ROLE 0x0b 139 #define IPMI_RMCPP_INVALID_NAME_LENGTH 0x0c 140 #define IPMI_RMCPP_UNAUTHORIZED_NAME 0x0d 141 #define IPMI_RMCPP_UNAUTHORIZED_GUID 0x0e 142 #define IPMI_RMCPP_INVALID_INTEGRITY_CHECK_VALUE 0x0f 143 #define IPMI_RMCPP_INVALID_CONFIDENTIALITY_ALGORITHM 0x10 144 #define IPMI_RMCPP_NO_CIPHER_SUITE_MATCHES 0x11 145 #define IPMI_RMCPP_ILLEGAL_PARAMETER 0x12 146 147 /** 148 * Serial-over-LAN error codes 149 */ 150 #define IPMI_SOL_CHARACTER_TRANSFER_UNAVAILABLE 0x01 ///< The request was NACKed because Char Trans was Unavail 151 #define IPMI_SOL_DEACTIVATED 0x02 ///< The managed system deactivated SoL 152 #define IPMI_SOL_NOT_AVAILABLE 0x03 ///< SoL is not available due to managed system configuration. 153 #define IPMI_SOL_DISCONNECTED 0x04 ///< The connection has been forcibly disconnected. 154 #define IPMI_SOL_UNCONFIRMABLE_OPERATION 0x05 ///< The operation has been attempted, but no confirmation is possible. 155 #define IPMI_SOL_FLUSHED 0x06 ///< The packet containing the request was flushed before transmission. 156 157 #ifdef __cplusplus 158 extern "C" { 159 #endif 160 161 /* Convert a completion code into a string. You must pass a buffer in 162 (32 bytes is good) and the buffer length. The string will be 163 stored in that buffer and also returned. */ 164 char *ipmi_get_cc_string(unsigned int cc, 165 char *buffer, 166 unsigned int buf_len); 167 int ipmi_get_cc_string_len(unsigned int cc); 168 169 char *ipmi_get_error_string(unsigned int err, 170 char *buffer, 171 unsigned int buf_len); 172 int ipmi_get_error_string_len(unsigned int err); 173 174 #ifdef __cplusplus 175 } 176 #endif 177 178 #include <errno.h> 179 180 #endif /* OPENIPMI_ERR_H */ 181