Main Page | Class List | Directories | File List | Class Members | File Members

ipmi_types.h

Go to the documentation of this file.
00001 /*
00002  * ipmi_types.h
00003  *
00004  * MontaVista IPMI interface general types.
00005  *
00006  * Author: MontaVista Software, Inc.
00007  *         Corey Minyard <minyard@mvista.com>
00008  *         source@mvista.com
00009  *
00010  * Copyright 2003,2004,2005 MontaVista Software Inc.
00011  *
00012  * This software is available to you under a choice of one of two
00013  * licenses.  You may choose to be licensed under the terms of the GNU
00014  * Lesser General Public License (GPL) Version 2 or the modified BSD
00015  * license below.  The following disclamer applies to both licenses:
00016  *
00017  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
00018  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00019  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00022  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00023  *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024  *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
00025  *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00026  *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  *
00028  * GNU Lesser General Public Licence
00029  *
00030  *  This program is free software; you can redistribute it and/or
00031  *  modify it under the terms of the GNU Lesser General Public License
00032  *  as published by the Free Software Foundation; either version 2 of
00033  *  the License, or (at your option) any later version.
00034  *
00035  *  You should have received a copy of the GNU Lesser General Public
00036  *  License along with this program; if not, write to the Free
00037  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00038  *
00039  * Modified BSD Licence
00040  *
00041  * Redistribution and use in source and binary forms, with or without
00042  * modification, are permitted provided that the following conditions
00043  * are met:
00044  *
00045  *   1. Redistributions of source code must retain the above copyright
00046  *      notice, this list of conditions and the following disclaimer.
00047  *   2. Redistributions in binary form must reproduce the above
00048  *      copyright notice, this list of conditions and the following
00049  *      disclaimer in the documentation and/or other materials provided
00050  *      with the distribution.
00051  *   3. The name of the author may not be used to endorse or promote
00052  *      products derived from this software without specific prior
00053  *      written permission.
00054  */
00055 
00056 #ifndef _IPMI_TYPES_H
00057 #define _IPMI_TYPES_H
00058 
00059 #ifndef IPMI_FUNC_DEPRECATED
00060 # if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2))
00061 #  define IPMI_FUNC_DEPRECATED __attribute__ ((deprecated))
00062 #  define IPMI_TYPE_DEPRECATED __attribute__ ((deprecated))
00063 #  define IPMI_VAR_DEPRECATED __attribute__ ((deprecated))
00064 # else
00065 #  define IPMI_FUNC_DEPRECATED
00066 #  define IPMI_TYPE_DEPRECATED
00067 #  define IPMI_VAR_DEPRECATED
00068 # endif
00069 #endif
00070 
00071 #include <stdint.h>
00072 #include <OpenIPMI/ipmi_addr.h>
00073 
00074 #ifdef __cplusplus
00075 extern "C" {
00076 #endif
00077 
00078 /*
00079  * These are the main types the user has to deal with.
00080  */
00081 
00082 /*
00083  * This represents IPMI system, called a "domain".  A domain is where
00084  * a set of entities reside.
00085  */
00086 typedef struct ipmi_domain_s ipmi_domain_t;
00087 typedef struct ipmi_domain_id_s ipmi_domain_id_t;
00088 
00089 /*
00090  * An entity is a physical device that can be monitored or controlled.
00091  */
00092 typedef struct ipmi_entity_s ipmi_entity_t;
00093 typedef struct ipmi_entity_id_s ipmi_entity_id_t;
00094 
00095 /* 
00096  * A fru is something that an entity contains that holds information
00097  * about the entity in a defined format.
00098  */
00099 typedef struct ipmi_fru_s ipmi_fru_t;
00100 
00101 /*
00102  * A sensor is something connected to an entity that can monitor or control
00103  * the entity.
00104  */
00105 typedef struct ipmi_sensor_s ipmi_sensor_t;
00106 typedef struct ipmi_sensor_id_s ipmi_sensor_id_t;
00107 
00108 /*
00109  * A control is an output device, such as a light, relay, or display.
00110  */
00111 typedef struct ipmi_control_s ipmi_control_t;
00112 typedef struct ipmi_control_id_s ipmi_control_id_t;
00113 
00114 /* Used to represent a time difference, in nanoseconds. */
00115 typedef int64_t ipmi_timeout_t;
00116 
00117 #define IPMI_INVALID_TIME INT64_MIN
00118 /* Used to represent an absolute time, in nanoseconds since 00:00 Jan
00119    1, 1970 */
00120 typedef int64_t ipmi_time_t;
00121 
00122 #ifndef __LINUX_IPMI_H /* Don't include this is we are including the kernel */
00123 
00124 #define IPMI_MAX_MSG_LENGTH     80
00125 
00126 /* A raw IPMI message without any addressing.  This covers both
00127    commands and responses.  The completion code is always the first
00128    byte of data in the response (as the spec shows the messages laid
00129    out). */
00130 typedef struct ipmi_msg
00131 {
00132     unsigned char  netfn;
00133     unsigned char  cmd;
00134     unsigned short data_len;
00135     unsigned char  *data;
00136 } ipmi_msg_t;
00137 
00138 #else
00139 
00140 /* Generate a type for the kernel version of this. */
00141 typedef struct ipmi_msg ipmi_msg_t;
00142 
00143 #endif
00144 
00145 /* A structure used to hold messages that can be put into a linked
00146    list. */
00147 typedef struct ipmi_msg_item_s
00148 {
00149     ipmi_addr_t   addr;
00150     unsigned int  addr_len;
00151     ipmi_msg_t    msg;
00152     unsigned char data[IPMI_MAX_MSG_LENGTH];
00153     struct ipmi_msg_item_s *next;
00154     void          *data1;
00155     void          *data2;
00156     void          *data3;
00157     void          *data4;
00158 } ipmi_msgi_t;
00159 
00160 /* Return values for function that take the previous item. */
00161 #define IPMI_MSG_ITEM_NOT_USED  0
00162 #define IPMI_MSG_ITEM_USED      1
00163 
00164 /* Pay no attention to the contents of these structures... */
00165 struct ipmi_domain_id_s
00166 {
00167     ipmi_domain_t *domain;
00168 };
00169 #define IPMI_DOMAIN_ID_INVALID { NULL }
00170 
00171 struct ipmi_entity_id_s
00172 {
00173     ipmi_domain_id_t domain_id;
00174     unsigned int     entity_id       : 8;
00175     unsigned int     entity_instance : 8;
00176     unsigned int     channel         : 4;
00177     unsigned int     address         : 8;
00178     long             seq;
00179 };
00180 #define IPMI_ENTITY_ID_INVALID { IPMI_DOMAIN_ID_INVALID, 0, 0, 0, 0, 0 }
00181 
00182 /* This structure is kind of a cheap hack.  It's internal and
00183    definately *NOT* for use by the user.  It can represent two
00184    different types of addresses.  An IPMI will have a normal channel
00185    number (usually 0 or 1) and the IPMB address will be in "mc_num".
00186    A direct connection to a system interface (KCS, LAN, etc.) is
00187    represented as IPMI_BMC_CHANNEL in the channel number and the
00188    interface number in mc_num.  Multiple interface numbers are used
00189    because you can have more than one connection to a domain; the
00190    first connection will be mc_num 0, the second will be mc_num 1,
00191    etc. */
00192 typedef struct ipmi_mcid_s
00193 {
00194     ipmi_domain_id_t domain_id;
00195     unsigned char    mc_num;
00196     unsigned char    channel;
00197     long             seq;
00198 } ipmi_mcid_t;
00199 #define IPMI_MCID_INVALID { IPMI_DOMAIN_ID_INVALID, 0, 0, 0 }
00200 
00201 typedef struct ipmi_mc_s ipmi_mc_t;
00202 
00203 struct ipmi_sensor_id_s
00204 {
00205     ipmi_mcid_t  mcid;
00206     unsigned int lun        : 3;
00207     unsigned int sensor_num : 8;
00208 };
00209 #define IPMI_SENSOR_ID_INVALID { IPMI_MCID_INVALID, 0, 0 }
00210 
00211 struct ipmi_control_id_s
00212 {
00213     ipmi_mcid_t  mcid;
00214     unsigned int lun         : 3;
00215     unsigned int control_num : 8;
00216 };
00217 #define IPMI_CONTROL_ID_INVALID { IPMI_MCID_INVALID, 0, 0 }
00218 
00219 /* The event structure is no longer public. */
00220 typedef struct ipmi_event_s ipmi_event_t;
00221 
00222 /* This represents a low-level connection. */
00223 typedef struct ipmi_con_s ipmi_con_t;
00224 
00225 /*
00226  * Channel information for a connection.
00227  */
00228 typedef struct ipmi_chan_info_s
00229 {
00230     unsigned int medium : 7;
00231     unsigned int xmit_support : 1;
00232     unsigned int recv_lun : 3;
00233     unsigned int protocol : 5;
00234     unsigned int session_support : 2;
00235     unsigned int vendor_id : 24;
00236     unsigned int aux_info : 16;
00237 } ipmi_chan_info_t;
00238 
00239 #define MAX_IPMI_USED_CHANNELS 8
00240 
00241 #ifdef __cplusplus
00242 }
00243 #endif
00244 
00245 #endif /* _IPMI_TYPES_H */

© sourcejam.com 2005-2008