xref: /titanic_50/usr/src/lib/libipmi/common/ipmi_lan.h (revision 174bc6499d233e329ecd3d98a880a7b07df16bfa)
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 2010 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef IPMI_LAN_H
27 #define	IPMI_LAN_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #pragma pack(1)
34 
35 #define	IPMI_CMD_GET_SESSION_CHALLENGE	0x39
36 #define	IPMI_CMD_ACTIVATE_SESSION	0x3a
37 #define	IPMI_CMD_SET_SESSION_PRIVLVL	0x3b
38 #define	IPMI_CMD_CLOSE_SESSION		0x3c
39 
40 #define	IPMI_AUTHCODE_BUF_SIZE		20
41 /*
42  * See section 22.13
43  */
44 #define	IPMI_SESSION_AUTHTYPE_NONE	0x01
45 #define	IPMI_SESSION_AUTHTYPE_MD2	0x02
46 #define	IPMI_SESSION_AUTHTYPE_MD5	0x04
47 #define	IPMI_SESSION_AUTHTYPE_PASSWORD	0x10
48 #define	IPMI_SESSION_AUTHTYPE_OEM	0x20
49 
50 #define	IPMI_SESSION_PRIV_UNSPECIFIED   0x0
51 #define	IPMI_SESSION_PRIV_CALLBACK	0x1
52 #define	IPMI_SESSION_PRIV_USER		0x2
53 #define	IPMI_SESSION_PRIV_OPERATOR	0x3
54 #define	IPMI_SESSION_PRIV_ADMIN		0x4
55 #define	IPMI_SESSION_PRIV_OEM		0x5
56 
57 #define	IPMI_BMC_SLAVE_ADDR	0x20
58 #define	IPMI_BUF_SIZE		1024
59 #define	IPMI_REMOTE_SWID	0x81
60 
61 /*
62  * The primary RMCP port
63  */
64 #define	RMCP_UDP_PORT		623
65 
66 /*
67  * The ASF IANA Enterprise Number
68  */
69 #define	ASF_RMCP_IANA		4542
70 
71 /*
72  * ASF Message Types for presence ping and pong
73  */
74 #define	ASF_TYPE_PING		0x80
75 #define	ASF_TYPE_PONG		0x40
76 
77 /*
78  * ASF message header
79  *
80  * See section 13.2.3
81  */
82 typedef struct asf_hdr {
83 	uint32_t	ah_iana;
84 	uint8_t		ah_msg_type;
85 	uint8_t		ah_msg_tag;
86 	uint8_t		__reserved1;
87 	uint8_t		ah_dlen;
88 } asf_hdr_t;
89 
90 /*
91  * RMCP message header
92  *
93  * See section 13.1.3
94  */
95 #define	RMCP_VERSION_1		0x06
96 #define	RMCP_CLASS_ASF		0x06
97 #define	RMCP_CLASS_IPMI		0x07
98 #define	RMCP_CLASS_OEM		0x08
99 
100 typedef struct rmcp_hdr {
101 	uint8_t rh_version;
102 	uint8_t __reserved1;
103 	uint8_t rh_seq;
104 	DECL_BITFIELD3(
105 	    rh_msg_class:5,
106 	    __reserved2:2,
107 	    rh_msg_type:1);
108 } rmcp_hdr_t;
109 
110 /*
111  * IPMI Session Header
112  *
113  * The IPMI session header contains some optional payload fields that are only
114  * present in RMCP+ sessions or if the payload type is "OEM explicit".  This
115  * structure is only intended to represent the session header for IPMI v1.5
116  * messages.
117  *
118  * See section 13.6
119  */
120 typedef struct v15_session_hdr {
121 	uint8_t		sh_authtype;
122 	uint32_t	sh_seq;
123 	uint32_t	sh_id;
124 }  v15_session_hdr_t;
125 
126 /*
127  * IPMI Lan Message Header
128  *
129  * See section 13.8
130  */
131 typedef struct ipmi_msg_hdr {
132 	uint8_t imh_addr1;
133 	DECL_BITFIELD2(
134 	    imh_lun:2,
135 	    imh_netfn:6);
136 	uint8_t	imh_csum;
137 	uint8_t imh_addr2;
138 	uint8_t imh_seq;
139 	uint8_t imh_cmd;
140 } ipmi_msg_hdr_t;
141 
142 #pragma pack()
143 
144 #ifdef	__cplusplus
145 }
146 #endif
147 
148 #endif /* IPMI_LAN_H */
149