4
* MontaVista IPMI interface for SDRs
6
* Author: MontaVista Software, Inc.
7
* Corey Minyard <minyard@mvista.com>
10
* Copyright 2002,2003 MontaVista Software Inc.
12
* This program is free software; you can redistribute it and/or
13
* modify it under the terms of the GNU Lesser General Public License
14
* as published by the Free Software Foundation; either version 2 of
15
* the License, or (at your option) any later version.
18
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
26
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
27
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
* You should have received a copy of the GNU Lesser General Public
30
* License along with this program; if not, write to the Free
31
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
36
#include <OpenIPMI/ipmi_types.h>
43
#define MAX_SDR_DATA 255
45
/* Generic information about an SDR. */
46
typedef struct ipmi_sdr_s
49
uint8_t major_version;
50
uint8_t minor_version;
53
uint8_t data[MAX_SDR_DATA];
56
/* Opaque type representing a remote SDR repository. */
57
typedef struct ipmi_sdr_info_s ipmi_sdr_info_t;
59
/* Create a local representation of a remote SDR repository. When
60
created, it will not automatically fetch the remote SDRs, you need
61
to do that. If "sensor" is true, then this will fetch the "sensor"
62
SDRs using GET DEVICE SDR. If not, it will use GET SDR for
64
int ipmi_sdr_info_alloc(ipmi_domain_t *domain,
68
ipmi_sdr_info_t **new_sdrs);
70
/* Remove all the SDRs, but don't destroy the SDR repository. */
71
void ipmi_sdr_clean_out_sdrs(ipmi_sdr_info_t *sdrs);
73
/* Destroy an SDR. Note that if the SDR is currently fetching SDRs,
74
the destroy cannot complete immediatly, it will be marked for
75
destruction later. You can supply a callback that, if not NULL,
76
will be called when the sdr is destroyed. */
77
typedef void (*ipmi_sdr_destroyed_t)(ipmi_sdr_info_t *sdrs, void *cb_data);
78
int ipmi_sdr_info_destroy(ipmi_sdr_info_t *sdrs,
79
ipmi_sdr_destroyed_t handler,
82
/* Fetch the remote SDRs, but do not wait until the fetch is complete,
83
return immediately. When the fetch is complete, call the given
85
typedef void (*ipmi_sdrs_fetched_t)(ipmi_sdr_info_t *sdrs,
90
int ipmi_sdr_fetch(ipmi_sdr_info_t *sdrs,
91
ipmi_sdrs_fetched_t handler,
94
/* Return the number of SDRs in the sdr repository. */
95
int ipmi_get_sdr_count(ipmi_sdr_info_t *sdr,
98
/* Find the SDR with the given record id. */
99
int ipmi_get_sdr_by_recid(ipmi_sdr_info_t *sdr,
101
ipmi_sdr_t *return_sdr);
103
/* Find the first SDR with the given type. */
104
int ipmi_get_sdr_by_type(ipmi_sdr_info_t *sdr,
106
ipmi_sdr_t *return_sdr);
108
/* Find the SDR with the given index. The indexes are the internal
109
array indexes for the SDR, this can be used to iterate through the
111
int ipmi_get_sdr_by_index(ipmi_sdr_info_t *sdr,
113
ipmi_sdr_t *return_sdr);
115
/* Set an SDR's value. This is primarily for the OEM SDR fixup code,
116
so it can fix an SDR and write it back. */
117
int ipmi_set_sdr_by_index(ipmi_sdr_info_t *sdrs,
121
/* Fetch all the sdrs. The array size should point to a value that
122
holds the number of elements in the passed in array. The
123
array_size will be set to the actual number of elements put into
124
the array. If the number of SDRs is larger than the supplied
125
array_size, this will return E2BIG and do nothing. */
126
int ipmi_get_all_sdrs(ipmi_sdr_info_t *sdr,
130
/* Get various information from the IPMI SDR info commands. */
131
int ipmi_sdr_get_major_version(ipmi_sdr_info_t *sdr, int *val);
132
int ipmi_sdr_get_minor_version(ipmi_sdr_info_t *sdr, int *val);
133
int ipmi_sdr_get_overflow(ipmi_sdr_info_t *sdr, int *val);
134
int ipmi_sdr_get_update_mode(ipmi_sdr_info_t *sdr, int *val);
135
int ipmi_sdr_get_supports_delete_sdr(ipmi_sdr_info_t *sdr, int *val);
136
int ipmi_sdr_get_supports_partial_add_sdr(ipmi_sdr_info_t *sdr, int *val);
137
int ipmi_sdr_get_supports_reserve_sdr(ipmi_sdr_info_t *sdr, int *val);
138
int ipmi_sdr_get_supports_get_sdr_repository_allocation(ipmi_sdr_info_t *sdr,
140
int ipmi_sdr_get_dynamic_population(ipmi_sdr_info_t *sdr, int *val);
141
int ipmi_sdr_get_lun_has_sensors(ipmi_sdr_info_t *sdr,
145
/* Append the SDR to the repository. */
146
int ipmi_sdr_add(ipmi_sdr_info_t *sdrs,
149
/* Store the SDRs into the SDR repository. */
150
typedef void (*ipmi_sdr_save_cb)(ipmi_sdr_info_t *sdrs, int err, void *cb_data);
151
int ipmi_sdr_save(ipmi_sdr_info_t *sdrs,
152
ipmi_sdr_save_cb done,
159
#endif /* _IPMI_SDR_H */