1 /*
2  * ipmi_pef.h
3  *
4  * OpenIPMI interface for dealing with platform event filters
5  *
6  * Author: Intel Corporation
7  *         Jeff Zheng <Jeff.Zheng@intel.com>
8  *
9  * Mostly rewritten by: MontaVista Software, Inc.
10  *                      Corey Minyard <minyard@mvista.com>
11  *                      source@mvista.com
12  *
13  *  This program is free software; you can redistribute it and/or
14  *  modify it under the terms of the GNU Lesser General Public License
15  *  as published by the Free Software Foundation; either version 2 of
16  *  the License, or (at your option) any later version.
17  *
18  *
19  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
20  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
25  *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26  *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
27  *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
28  *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  *  You should have received a copy of the GNU Lesser General Public
31  *  License along with this program; if not, write to the Free
32  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33  */
34 
35 #ifndef OPENIPMI_PEF_H
36 #define OPENIPMI_PEF_H
37 
38 #include <OpenIPMI/ipmi_types.h>
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /* The abstract type for pef.  Note that if you use this directly, you
45    must understand about PEF locking.  If you want easier access to
46    the configuration, see the ipmi_pef_config_t type later in this
47    file. */
48 typedef struct ipmi_pef_s ipmi_pef_t;
49 
50 
51 /* Generic callback used to tell when a PEF operation is done. */
52 typedef void (*ipmi_pef_done_cb)(ipmi_pef_t *pef,
53 				 int        err,
54 				 void       *cb_data);
55 
56 /* Generic callback for iterating. */
57 typedef void (*ipmi_pef_ptr_cb)(ipmi_pef_t *pef,
58 				void       *cb_data);
59 
60 /* Allocate a PEF.  The PEF will not be usable (it can only be
61    destroyed) until the done callback is called. */
62 int ipmi_pef_alloc(ipmi_mc_t        *mc,
63 		   ipmi_pef_done_cb done,
64 		   void             *cb_data,
65 		   ipmi_pef_t       **new_pef);
66 
67 /* Destroy a PEF. */
68 int ipmi_pef_destroy(ipmi_pef_t       *pef,
69                      ipmi_pef_done_cb handler,
70                      void             *cb_data);
71 
72 /* Used to track references to a pef.  You can use this instead of
73    ipmi_pef_destroy, but use of the destroy function is
74    recommended.  This is primarily here to help reference-tracking
75    garbage collection systems like what is in Perl to be able to
76    automatically destroy pefs when they are done. */
77 void ipmi_pef_ref(ipmi_pef_t *pef);
78 void ipmi_pef_deref(ipmi_pef_t *pef);
79 
80 void ipmi_pef_iterate_pefs(ipmi_domain_t   *domain,
81 			   ipmi_pef_ptr_cb handler,
82 			   void            *cb_data);
83 
84 /* Fetch a parameter value from the PEF.  The "set" and "block"
85    parameters are the set selector and block selectors.  If those are
86    not relevant for the given parm, then set them to zero.  On the
87    return data, the parameter version is the first byte, followed by
88    the data. */
89 typedef void (*ipmi_pef_get_cb)(ipmi_pef_t    *pef,
90 				int           err,
91 				unsigned char *data,
92 				unsigned int  data_len,
93 				void          *cb_data);
94 int ipmi_pef_get_parm(ipmi_pef_t      *pef,
95 		      unsigned int    parm,
96 		      unsigned int    set,
97 		      unsigned int    block,
98 		      ipmi_pef_get_cb done,
99 		      void            *cb_data);
100 
101 /* Set the parameter value in the PEF to the given data. */
102 int ipmi_pef_set_parm(ipmi_pef_t       *pef,
103 		      unsigned int     parm,
104 		      unsigned char    *data,
105 		      unsigned int     data_len,
106 		      ipmi_pef_done_cb done,
107 		      void             *cb_data);
108 
109 /* Returns if the MC has a valid working PEF. */
110 int ipmi_pef_valid(ipmi_pef_t *pef);
111 
112 /* Information fetched from the PEF capabilities. */
113 int ipmi_pef_supports_diagnostic_interrupt(ipmi_pef_t *pef);
114 int ipmi_pef_supports_oem_action(ipmi_pef_t *pef);
115 int ipmi_pef_supports_power_cycle(ipmi_pef_t *pef);
116 int ipmi_pef_supports_reset(ipmi_pef_t *pef);
117 int ipmi_pef_supports_power_down(ipmi_pef_t *pef);
118 int ipmi_pef_supports_alert(ipmi_pef_t *pef);
119 
120 unsigned int ipmi_pef_major_version(ipmi_pef_t *pef);
121 unsigned int ipmi_pef_minor_version(ipmi_pef_t *pef);
122 
123 unsigned int num_event_filter_table_entries(ipmi_pef_t *pef);
124 
125 /* Return the MC this PEF uses. */
126 ipmi_mcid_t ipmi_pef_get_mc(ipmi_pef_t *pef);
127 #define IPMI_PEF_NAME_LEN 64
128 int ipmi_pef_get_name(ipmi_pef_t *pef, char *name, int length);
129 
130 /* Standard entries in the PEF configuration. */
131 
132 #define IPMI_PEFPARM_SET_IN_PROGRESS		0
133 #define IPMI_PEFPARM_CONTROL			1
134 #define IPMI_PEFPARM_ACTION_GLOBAL_CONTROL	2
135 #define IPMI_PEFPARM_STARTUP_DELAY		3
136 #define IPMI_PEFPARM_ALERT_STARTUP_DELAY	4
137 #define IPMI_PEFPARM_NUM_EVENT_FILTERS		5
138 #define IPMI_PEFPARM_EVENT_FILTER_TABLE		6
139 #define IPMI_PEFPARM_EVENT_FILTER_TABLE_DATA1	7
140 #define IPMI_PEFPARM_NUM_ALERT_POLICIES		8
141 #define IPMI_PEFPARM_ALERT_POLICY_TABLE		9
142 #define IPMI_PEFPARM_SYSTEM_GUID		10
143 #define IPMI_PEFPARM_NUM_ALERT_STRINGS		11
144 #define IPMI_PEFPARM_ALERT_STRING_KEY		12
145 #define IPMI_PEFPARM_ALERT_STRING		13
146 
147 
148 /*
149  * *** NOTE *** READ THIS BEFORE USING THE CONFIG STUFF BELOW
150  *
151  * The configuration working below is strongly tied to locking of the
152  * PEF.  If you successfully get a configuration (no error), then the
153  * PEF *will* be locked, and you hold the lock.  You must call either
154  * ipmi_pef_set_config() or ipmi_pef_clear_lock() to clean up the
155  * lock.
156  *
157  * This allows you to do a read-modify-write operation and blocking
158  * other operations on the PEF while you are doing this.
159  */
160 
161 /* A full PEF configuration. */
162 typedef struct ipmi_pef_config_s ipmi_pef_config_t;
163 
164 /* Get the full PEF configuration and lock the PEF.  Note that if the
165    PEF is locked by another, you will get an EAGAIN error in the
166    callback.  You can retry the operation, or if you are sure that it
167    is free, you can call ipmi_pef_clear_lock() before retrying.   Note
168    that the config in the callback *must* be freed by you.*/
169 typedef void (*ipmi_pef_get_config_cb)(ipmi_pef_t        *pef,
170 				       int               err,
171 				       ipmi_pef_config_t *config,
172 				       void              *cb_data);
173 int ipmi_pef_get_config(ipmi_pef_t             *pef,
174 			ipmi_pef_get_config_cb done,
175 			void                   *cb_data);
176 
177 /* Set the full PEF configuration.  The config *MUST* be locked and
178    the pef must match the PEF that it was fetched with.  Note that a
179    copy is made of the configuration, so you are free to do whatever
180    you like with it after this.  Note that this unlocks the config, so
181    it cannot be used for future set operations. */
182 int ipmi_pef_set_config(ipmi_pef_t        *pef,
183 			ipmi_pef_config_t *pefc,
184 			ipmi_pef_done_cb  done,
185 			void              *cb_data);
186 
187 /* Clear the lock on a PEF.  If the PEF config is non-NULL, then it's
188    lock is also cleared. */
189 int ipmi_pef_clear_lock(ipmi_pef_t        *pef,
190 			ipmi_pef_config_t *pefc,
191 			ipmi_pef_done_cb  done,
192 			void              *cb_data);
193 
194 /* Free a PEF configuration. */
195 void ipmi_pef_free_config(ipmi_pef_config_t *config);
196 
197 /* This interface lets you fetch and set the data values by parm
198    num. Note that the parm nums *DO NOT* correspond to the
199    IPMI_PEFPARM_xxx values above. */
200 
201 enum ipmi_pefconf_val_type_e { IPMI_PEFCONFIG_INT, IPMI_PEFCONFIG_BOOL,
202 			       IPMI_PEFCONFIG_DATA, IPMI_PEFCONFIG_STR };
203 /* When getting the value, the valtype will be set to int or data.  If
204    it is int or bool, the value is returned in ival and the dval is
205    not used.  If it is data, the data will be returned in an allocated
206    array in dval and the length set in dval_len.  The data must be
207    freed with ipmi_pefconfig_data_free().  The is used for some data
208    items (the priv level for authentication type, the destination for
209    alerts and destination addresses); for other items it is ignored.
210    The index should point to the value to fetch (starting at zero), it
211    will be updated to the next value or -1 if no more are left.  The
212    index will be unchanged if the parm does not support an index.
213 
214    The string name is returned in the name field, if it is not NULL.
215 
216    Note that when fetching a value, if the passed in pointer is NULL
217    the data will not be filled in (except for index, which must always
218    be present).  That lets you get the value type without getting the
219    data, for instance. */
220 int ipmi_pefconfig_get_val(ipmi_pef_config_t *pefc,
221 			   unsigned int      parm,
222 			   const char        **name,
223 			   int               *index,
224 			   enum ipmi_pefconf_val_type_e *valtype,
225 			   unsigned int      *ival,
226 			   unsigned char     **dval,
227 			   unsigned int      *dval_len);
228   /* Set a value in the pef config.  You must know ahead of time the
229      actual value type and set the proper one. */
230 int ipmi_pefconfig_set_val(ipmi_pef_config_t *pefc,
231 			   unsigned int      parm,
232 			   int               index,
233 			   unsigned int      ival,
234 			   unsigned char     *dval,
235 			   unsigned int      dval_len);
236 /* If the value is an integer, this can be used to determine if it is
237    an enumeration and what the values are.  If the parm is not an
238    enumeration, this will return ENOSYS for the parm.  Otherwise, if
239    you pass in zero, you will get either the first enumeration value,
240    or EINVAL if zero is not a valid enumeration, but there are others.
241    If this returns EINVAL or 0, nval will be set to the next valid
242    enumeration value, or -1 if val is the last or past the last
243    enumeration value.  If this returns 0, val will be set to the
244    string value for the enumeration. */
245 int ipmi_pefconfig_enum_val(unsigned int parm, int val, int *nval,
246 			    const char **sval);
247 /* Sometimes array indexes may be enumerations.  This allows the user
248    to detect if a specific parm's array index is an enumeration, and
249    to get the enumeration values.  */
250 int ipmi_pefconfig_enum_idx(unsigned int parm, int idx, const char **sval);
251 /* Free data from ipmi_pefconfig_get_val(). */
252 void ipmi_pefconfig_data_free(void *data);
253 /* Convert a string to a pefconfig parm number.  Returns -1 if the
254    string is invalid. */
255 unsigned int ipmi_pefconfig_str_to_parm(char *name);
256 /* Convert the parm to a string name. */
257 const char *ipmi_pefconfig_parm_to_str(unsigned int parm);
258 /* Get the type of a specific parm. */
259 int ipmi_pefconfig_parm_to_type(unsigned int                 parm,
260 				enum ipmi_pefconf_val_type_e *valtype);
261 
262 
263 /*
264  * Main configuration items for the PEF.
265  */
266 unsigned int
267 ipmi_pefconfig_get_alert_startup_delay_enabled(ipmi_pef_config_t *pefc);
268 int ipmi_pefconfig_set_alert_startup_delay_enabled(ipmi_pef_config_t *pefc,
269 						   unsigned int val);
270 unsigned int ipmi_pefconfig_get_startup_delay_enabled(ipmi_pef_config_t *pefc);
271 int ipmi_pefconfig_set_startup_delay_enabled(ipmi_pef_config_t *pefc,
272 					     unsigned int val);
273 unsigned int ipmi_pefconfig_get_event_messages_enabled(ipmi_pef_config_t *pefc);
274 int ipmi_pefconfig_set_event_messages_enabled(ipmi_pef_config_t *pefc,
275 					      unsigned int val);
276 unsigned int ipmi_pefconfig_get_pef_enabled(ipmi_pef_config_t *pefc);
277 int ipmi_pefconfig_set_pef_enabled(ipmi_pef_config_t *pefc, unsigned int val);
278 unsigned int
279 ipmi_pefconfig_get_diagnostic_interrupt_enabled(ipmi_pef_config_t *pefc);
280 int ipmi_pefconfig_set_diagnostic_interrupt_enabled(ipmi_pef_config_t *pefc,
281 						    unsigned int val);
282 unsigned int ipmi_pefconfig_get_oem_action_enabled(ipmi_pef_config_t *pefc);
283 int ipmi_pefconfig_set_oem_action_enabled(ipmi_pef_config_t *pefc,
284 					  unsigned int val);
285 unsigned int ipmi_pefconfig_get_power_cycle_enabled(ipmi_pef_config_t *pefc);
286 int ipmi_pefconfig_set_power_cycle_enabled(ipmi_pef_config_t *pefc,
287 					   unsigned int val);
288 unsigned int ipmi_pefconfig_get_reset_enabled(ipmi_pef_config_t *pefc);
289 int ipmi_pefconfig_set_reset_enabled(ipmi_pef_config_t *pefc, unsigned int val);
290 unsigned int ipmi_pefconfig_get_power_down_enabled(ipmi_pef_config_t *pefc);
291 int ipmi_pefconfig_set_power_down_enabled(ipmi_pef_config_t *pefc,
292 					  unsigned int val);
293 unsigned int ipmi_pefconfig_get_alert_enabled(ipmi_pef_config_t *pefc);
294 int ipmi_pefconfig_set_alert_enabled(ipmi_pef_config_t *pefc, unsigned int val);
295 int ipmi_pefconfig_get_startup_delay(ipmi_pef_config_t *pefc,
296 				     unsigned int *val);
297 int ipmi_pefconfig_set_startup_delay(ipmi_pef_config_t *pefc,
298 				     unsigned int val);
299 int ipmi_pefconfig_get_alert_startup_delay(ipmi_pef_config_t *pefc,
300 					   unsigned int *val);
301 int ipmi_pefconfig_set_alert_startup_delay(ipmi_pef_config_t *pefc,
302 					   unsigned int val);
303 
304 unsigned int ipmi_pefconfig_get_guid_enabled(ipmi_pef_config_t *pefc);
305 int ipmi_pefconfig_set_guid_enabled(ipmi_pef_config_t *pefc,
306 				    unsigned int      val);
307 int ipmi_pefconfig_get_guid_val(ipmi_pef_config_t *pefc,
308 				unsigned char     *data,
309 				unsigned int      *data_len);
310 int ipmi_pefconfig_set_guid_val(ipmi_pef_config_t *pefc,
311 				unsigned char     *data,
312 				unsigned int      data_len);
313 
314 /*
315  * The following is for the event filter table entries.
316  *
317  * NOTE! The event filter table in IPMI is one-based (entry zero is not
318  * used, entry 1 is the first entry).  This might make Ada programmers
319  * happy, but to make it so C programmers are not confused, this
320  * implementation converts it to be zero-based (entry zero *is* the
321  * first entry)
322  */
323 unsigned int ipmi_pefconfig_get_num_event_filters(ipmi_pef_config_t *pefc);
324 int ipmi_pefconfig_get_enable_filter(ipmi_pef_config_t *pefc,
325 				     unsigned int      sel,
326 				     unsigned int      *val);
327 int ipmi_pefconfig_set_enable_filter(ipmi_pef_config_t *pefc,
328 				     unsigned int      sel,
329 				     unsigned int      val);
330 
331 /* PEF Filter types */
332 #define IPMI_PEFPARM_EFT_FILTER_CONFIG_MANUFACTURE_CONFIG 2
333 #define IPMI_PEFPARM_EFT_FILTER_CONFIG_SOFTWARE_CONFIG 0
334 
335 int ipmi_pefconfig_get_filter_type(ipmi_pef_config_t *pefc,
336 				   unsigned int      sel,
337 				   unsigned int      *val);
338 int ipmi_pefconfig_set_filter_type(ipmi_pef_config_t *pefc,
339 				   unsigned int      sel,
340 				   unsigned int      val);
341 
342 int ipmi_pefconfig_get_diagnostic_interrupt(ipmi_pef_config_t *pefc,
343 					    unsigned int      sel,
344 					    unsigned int      *val);
345 int ipmi_pefconfig_set_diagnostic_interrupt(ipmi_pef_config_t *pefc,
346 					    unsigned int      sel,
347 					    unsigned int      val);
348 
349 int ipmi_pefconfig_get_oem_action(ipmi_pef_config_t *pefc,
350 				  unsigned int      sel,
351 				  unsigned int      *val);
352 int ipmi_pefconfig_set_oem_action(ipmi_pef_config_t *pefc,
353 				  unsigned int      sel,
354 				  unsigned int      val);
355 
356 int ipmi_pefconfig_get_power_cycle(ipmi_pef_config_t *pefc,
357 				   unsigned int      sel,
358 				   unsigned int      *val);
359 int ipmi_pefconfig_set_power_cycle(ipmi_pef_config_t *pefc,
360 				   unsigned int      sel,
361 				   unsigned int      val);
362 
363 int ipmi_pefconfig_get_reset(ipmi_pef_config_t *pefc,
364 			     unsigned int      sel,
365 			     unsigned int      *val);
366 int ipmi_pefconfig_set_reset(ipmi_pef_config_t *pefc,
367 			     unsigned int      sel,
368 			     unsigned int      val);
369 
370 int ipmi_pefconfig_get_power_down(ipmi_pef_config_t *pefc,
371 				  unsigned int      sel,
372 				  unsigned int      *val);
373 int ipmi_pefconfig_set_power_down(ipmi_pef_config_t *pefc,
374 				  unsigned int      sel,
375 				  unsigned int      val);
376 
377 int ipmi_pefconfig_get_alert(ipmi_pef_config_t *pefc,
378 			     unsigned int      sel,
379 			     unsigned int      *val);
380 int ipmi_pefconfig_set_alert(ipmi_pef_config_t *pefc,
381 			     unsigned int      sel,
382 			     unsigned int      val);
383 
384 int ipmi_pefconfig_get_alert_policy_number(ipmi_pef_config_t *pefc,
385 					   unsigned int      sel,
386 					   unsigned int      *val);
387 int ipmi_pefconfig_set_alert_policy_number(ipmi_pef_config_t *pefc,
388 					   unsigned int      sel,
389 					   unsigned int      val);
390 
391 /* PEF event severities */
392 #define IPMI_PEFPARM_EVENT_SEVERITY_UNSPECIFIED 	0x00
393 #define IPMI_PEFPARM_EVENT_SEVERITY_MONITOR		0x01
394 #define IPMI_PEFPARM_EVENT_SEVERITY_INFORMATION		0x02
395 #define IPMI_PEFPARM_EVENT_SEVERITY_OK			0x04
396 #define IPMI_PEFPARM_EVENT_SEVERITY_NON_CRITICAL	0x08
397 #define IPMI_PEFPARM_EVENT_SEVERITY_CRITICAL		0x10
398 #define IPMI_PEFPARM_EVENT_SEVERITY_NON_RECOVERABLE	0x20
399 int ipmi_pefconfig_get_event_severity(ipmi_pef_config_t *pefc,
400 				      unsigned int      sel,
401 				      unsigned int      *val);
402 int ipmi_pefconfig_set_event_severity(ipmi_pef_config_t *pefc,
403 				      unsigned int      sel,
404 				      unsigned int      val);
405 
406 int ipmi_pefconfig_get_generator_id_addr(ipmi_pef_config_t *pefc,
407 					 unsigned int      sel,
408 					 unsigned int      *val);
409 int ipmi_pefconfig_set_generator_id_addr(ipmi_pef_config_t *pefc,
410 					 unsigned int      sel,
411 					 unsigned int      val);
412 
413 int ipmi_pefconfig_get_generator_id_channel_lun(ipmi_pef_config_t *pefc,
414 						unsigned int      sel,
415 						unsigned int      *val);
416 int ipmi_pefconfig_set_generator_id_channel_lun(ipmi_pef_config_t *pefc,
417 						unsigned int      sel,
418 						unsigned int      val);
419 
420 int ipmi_pefconfig_get_sensor_type(ipmi_pef_config_t *pefc,
421 				   unsigned int      sel,
422 				   unsigned int      *val);
423 int ipmi_pefconfig_set_sensor_type(ipmi_pef_config_t *pefc,
424 				   unsigned int      sel,
425 				   unsigned int      val);
426 
427 int ipmi_pefconfig_get_sensor_number(ipmi_pef_config_t *pefc,
428 				     unsigned int      sel,
429 				     unsigned int      *val);
430 int ipmi_pefconfig_set_sensor_number(ipmi_pef_config_t *pefc,
431 				     unsigned int      sel,
432 				     unsigned int      val);
433 
434 int ipmi_pefconfig_get_event_trigger(ipmi_pef_config_t *pefc,
435 				     unsigned int      sel,
436 				     unsigned int      *val);
437 int ipmi_pefconfig_set_event_trigger(ipmi_pef_config_t *pefc,
438 				     unsigned int      sel,
439 				     unsigned int      val);
440 
441 int ipmi_pefconfig_get_data1_offset_mask(ipmi_pef_config_t *pefc,
442 					 unsigned int      sel,
443 					 unsigned int      *val);
444 int ipmi_pefconfig_set_data1_offset_mask(ipmi_pef_config_t *pefc,
445 					 unsigned int      sel,
446 					 unsigned int      val);
447 int ipmi_pefconfig_get_data1_mask(ipmi_pef_config_t *pefc,
448 				  unsigned int      sel,
449 				  unsigned int      *val);
450 int ipmi_pefconfig_set_data1_mask(ipmi_pef_config_t *pefc,
451 				  unsigned int      sel,
452 				  unsigned int      val);
453 int ipmi_pefconfig_get_data1_compare1(ipmi_pef_config_t *pefc,
454 				      unsigned int      sel,
455 				      unsigned int      *val);
456 int ipmi_pefconfig_set_data1_compare1(ipmi_pef_config_t *pefc,
457 				      unsigned int      sel,
458 				      unsigned int      val);
459 int ipmi_pefconfig_get_data1_compare2(ipmi_pef_config_t *pefc,
460 				      unsigned int      sel,
461 				      unsigned int      *val);
462 int ipmi_pefconfig_set_data1_compare2(ipmi_pef_config_t *pefc,
463 				      unsigned int      sel,
464 				      unsigned int      val);
465 
466 int ipmi_pefconfig_get_data2_mask(ipmi_pef_config_t *pefc,
467 				  unsigned int      sel,
468 				  unsigned int      *val);
469 int ipmi_pefconfig_set_data2_mask(ipmi_pef_config_t *pefc,
470 				  unsigned int      sel,
471 				  unsigned int      val);
472 int ipmi_pefconfig_get_data2_compare1(ipmi_pef_config_t *pefc,
473 				      unsigned int      sel,
474 				      unsigned int      *val);
475 int ipmi_pefconfig_set_data2_compare1(ipmi_pef_config_t *pefc,
476 				      unsigned int      sel,
477 				      unsigned int      val);
478 int ipmi_pefconfig_get_data2_compare2(ipmi_pef_config_t *pefc,
479 				      unsigned int      sel,
480 				      unsigned int      *val);
481 int ipmi_pefconfig_set_data2_compare2(ipmi_pef_config_t *pefc,
482 				      unsigned int      sel,
483 				      unsigned int      val);
484 
485 int ipmi_pefconfig_get_data3_mask(ipmi_pef_config_t *pefc,
486 				  unsigned int      sel,
487 				  unsigned int      *val);
488 int ipmi_pefconfig_set_data3_mask(ipmi_pef_config_t *pefc,
489 				  unsigned int      sel,
490 				  unsigned int      val);
491 int ipmi_pefconfig_get_data3_compare1(ipmi_pef_config_t *pefc,
492 				      unsigned int      sel,
493 				      unsigned int      *val);
494 int ipmi_pefconfig_set_data3_compare1(ipmi_pef_config_t *pefc,
495 				      unsigned int      sel,
496 				      unsigned int      val);
497 int ipmi_pefconfig_get_data3_compare2(ipmi_pef_config_t *pefc,
498 				      unsigned int      sel,
499 				      unsigned int      *val);
500 int ipmi_pefconfig_set_data3_compare2(ipmi_pef_config_t *pefc,
501 				      unsigned int      sel,
502 				      unsigned int      val);
503 
504 /*
505  * Values from the alert policy table.
506  *
507  * NOTE! The event filter table in IPMI is one-based (entry zero is not
508  * used, entry 1 is the first entry).  This might make Ada programmers
509  * happy, but to make it so C programmers are not confused, this
510  * implementation converts it to be zero-based (entry zero *is* the
511  * first entry)
512  */
513 unsigned int ipmi_pefconfig_get_num_alert_policies(ipmi_pef_config_t *pefc);
514 int ipmi_pefconfig_get_policy_num(ipmi_pef_config_t *pefc,
515 				  unsigned int      sel,
516 				  unsigned int      *val);
517 int ipmi_pefconfig_set_policy_num(ipmi_pef_config_t *pefc,
518 				  unsigned int      sel,
519 				  unsigned int      val);
520 int ipmi_pefconfig_get_enabled(ipmi_pef_config_t *pefc,
521 			       unsigned int      sel,
522 			       unsigned int      *val);
523 int ipmi_pefconfig_set_enabled(ipmi_pef_config_t *pefc,
524 			       unsigned int      sel,
525 			       unsigned int      val);
526 int ipmi_pefconfig_get_policy(ipmi_pef_config_t *pefc,
527 			      unsigned int      sel,
528 			      unsigned int      *val);
529 int ipmi_pefconfig_set_policy(ipmi_pef_config_t *pefc,
530 			      unsigned int      sel,
531 			      unsigned int      val);
532 int ipmi_pefconfig_get_channel(ipmi_pef_config_t *pefc,
533 			       unsigned int      sel,
534 			       unsigned int      *val);
535 int ipmi_pefconfig_set_channel(ipmi_pef_config_t *pefc,
536 			       unsigned int      sel,
537 			       unsigned int      val);
538 int ipmi_pefconfig_get_destination_selector(ipmi_pef_config_t *pefc,
539 					    unsigned int      sel,
540 					    unsigned int      *val);
541 int ipmi_pefconfig_set_destination_selector(ipmi_pef_config_t *pefc,
542 					    unsigned int      sel,
543 					    unsigned int      val);
544 int ipmi_pefconfig_get_alert_string_event_specific(ipmi_pef_config_t *pefc,
545 						   unsigned int      sel,
546 						   unsigned int      *val);
547 int ipmi_pefconfig_set_alert_string_event_specific(ipmi_pef_config_t *pefc,
548 						   unsigned int      sel,
549 						   unsigned int      val);
550 int ipmi_pefconfig_get_alert_string_selector(ipmi_pef_config_t *pefc,
551 					     unsigned int      sel,
552 					     unsigned int      *val);
553 int ipmi_pefconfig_set_alert_string_selector(ipmi_pef_config_t *pefc,
554 					     unsigned int      sel,
555 					     unsigned int      val);
556 
557 /*
558  * Values from the alert string keys and alert strings.  Note that
559  * unlike the other PEF set data, there is a zero value here so the
560  * numbering matches the numbering in the actual data.
561  */
562 unsigned int ipmi_pefconfig_get_num_alert_strings(ipmi_pef_config_t *pefc);
563 int ipmi_pefconfig_get_event_filter(ipmi_pef_config_t *pefc,
564 				    unsigned int      sel,
565 				    unsigned int      *val);
566 int ipmi_pefconfig_set_event_filter(ipmi_pef_config_t *pefc,
567 				    unsigned int      sel,
568 				    unsigned int      val);
569 int ipmi_pefconfig_get_alert_string_set(ipmi_pef_config_t *pefc,
570 					unsigned int      sel,
571 					unsigned int      *val);
572 int ipmi_pefconfig_set_alert_string_set(ipmi_pef_config_t *pefc,
573 					unsigned int      sel,
574 					unsigned int      val);
575 int ipmi_pefconfig_get_alert_string(ipmi_pef_config_t *pefc, unsigned int sel,
576 				    unsigned char *val, unsigned int *len);
577 int ipmi_pefconfig_set_alert_string(ipmi_pef_config_t *pefc, unsigned int sel,
578 				    unsigned char *val);
579 
580 
581 /*
582  * Cruft, don't use
583  */
584 int ipmi_pefconfig_get_guid(ipmi_pef_config_t *pefc,
585 			    unsigned int      *enabled,
586 			    unsigned char     *data,
587 			    unsigned int      *data_len);
588 int ipmi_pefconfig_set_guid(ipmi_pef_config_t *pefc, unsigned int enabled,
589 			    unsigned char *data, unsigned int data_len);
590 
591 
592 #ifdef __cplusplus
593 }
594 #endif
595 
596 #endif /* OPENIPMI_PEF_H */
597