xref: /titanic_44/usr/src/lib/libipmi/common/ipmi_impl.h (revision ee5416c9d7e449233197d5d20bc6b81e4ff091b2)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_IPMI_IMPL_H
27 #define	_IPMI_IMPL_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <stdlib.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 struct ipmi_sdr_generic_locator;
38 struct ipmi_sdr_fru_locator;
39 
40 typedef struct ipmi_sdr_cache_ent {
41 	uint8_t				isc_type;
42 	struct ipmi_sdr_generic_locator	*isc_generic;
43 	struct ipmi_sdr_fru_locator	*isc_fru;
44 	struct ipmi_sdr_cache_ent	*isc_next;
45 } ipmi_sdr_cache_ent_t;
46 
47 typedef struct ipmi_transport {
48 	void *		(*it_open)(struct ipmi_handle *);
49 	void		(*it_close)(void *);
50 	int 		(*it_send)(void *, struct ipmi_cmd *, struct ipmi_cmd *,
51 			    int *);
52 } ipmi_transport_t;
53 
54 struct ipmi_handle {
55 	ipmi_transport_t	*ih_transport;
56 	void			*ih_tdata;
57 	ipmi_cmd_t		ih_response;
58 	int			ih_errno;
59 	uint16_t		ih_reservation;
60 	int			ih_retries;
61 	ipmi_sdr_cache_ent_t	*ih_sdr_cache;
62 	ipmi_deviceid_t		ih_deviceid;
63 	boolean_t		ih_deviceid_valid;
64 	char			ih_errmsg[1024];
65 	char			ih_errbuf[1024];
66 };
67 
68 /*
69  * Error handling
70  */
71 extern int ipmi_set_error(ipmi_handle_t *, int, const char *, ...);
72 
73 /*
74  * Memory allocation
75  */
76 extern void *ipmi_alloc(ipmi_handle_t *, size_t);
77 extern void *ipmi_zalloc(ipmi_handle_t *, size_t);
78 extern void ipmi_free(ipmi_handle_t *, void *);
79 extern void *impi_realloc(ipmi_handle_t *, void *, size_t);
80 
81 /*
82  * Supported transports
83  */
84 extern ipmi_transport_t ipmi_transport_bmc;
85 
86 /*
87  * Miscellaneous routines
88  */
89 extern void ipmi_sdr_clear(ipmi_handle_t *);
90 
91 #ifdef	__cplusplus
92 }
93 #endif
94 
95 #endif	/* _IPMI_IMPL_H */
96