xref: /onnv-gate/usr/src/lib/libipmi/common/ipmi_lan.h (revision 11756:3ae81edcfbf7)
1*11756SRobert.Johnston@Sun.COM /*
2*11756SRobert.Johnston@Sun.COM  * CDDL HEADER START
3*11756SRobert.Johnston@Sun.COM  *
4*11756SRobert.Johnston@Sun.COM  * The contents of this file are subject to the terms of the
5*11756SRobert.Johnston@Sun.COM  * Common Development and Distribution License (the "License").
6*11756SRobert.Johnston@Sun.COM  * You may not use this file except in compliance with the License.
7*11756SRobert.Johnston@Sun.COM  *
8*11756SRobert.Johnston@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*11756SRobert.Johnston@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*11756SRobert.Johnston@Sun.COM  * See the License for the specific language governing permissions
11*11756SRobert.Johnston@Sun.COM  * and limitations under the License.
12*11756SRobert.Johnston@Sun.COM  *
13*11756SRobert.Johnston@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*11756SRobert.Johnston@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*11756SRobert.Johnston@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*11756SRobert.Johnston@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*11756SRobert.Johnston@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*11756SRobert.Johnston@Sun.COM  *
19*11756SRobert.Johnston@Sun.COM  * CDDL HEADER END
20*11756SRobert.Johnston@Sun.COM  */
21*11756SRobert.Johnston@Sun.COM /*
22*11756SRobert.Johnston@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23*11756SRobert.Johnston@Sun.COM  * Use is subject to license terms.
24*11756SRobert.Johnston@Sun.COM  */
25*11756SRobert.Johnston@Sun.COM 
26*11756SRobert.Johnston@Sun.COM #ifndef IPMI_LAN_H
27*11756SRobert.Johnston@Sun.COM #define	IPMI_LAN_H
28*11756SRobert.Johnston@Sun.COM 
29*11756SRobert.Johnston@Sun.COM #ifdef	__cplusplus
30*11756SRobert.Johnston@Sun.COM extern "C" {
31*11756SRobert.Johnston@Sun.COM #endif
32*11756SRobert.Johnston@Sun.COM 
33*11756SRobert.Johnston@Sun.COM #pragma pack(1)
34*11756SRobert.Johnston@Sun.COM 
35*11756SRobert.Johnston@Sun.COM #define	IPMI_CMD_GET_SESSION_CHALLENGE	0x39
36*11756SRobert.Johnston@Sun.COM #define	IPMI_CMD_ACTIVATE_SESSION	0x3a
37*11756SRobert.Johnston@Sun.COM #define	IPMI_CMD_SET_SESSION_PRIVLVL	0x3b
38*11756SRobert.Johnston@Sun.COM #define	IPMI_CMD_CLOSE_SESSION		0x3c
39*11756SRobert.Johnston@Sun.COM 
40*11756SRobert.Johnston@Sun.COM #define	IPMI_AUTHCODE_BUF_SIZE		20
41*11756SRobert.Johnston@Sun.COM /*
42*11756SRobert.Johnston@Sun.COM  * See section 22.13
43*11756SRobert.Johnston@Sun.COM  */
44*11756SRobert.Johnston@Sun.COM #define	IPMI_SESSION_AUTHTYPE_NONE	0x01
45*11756SRobert.Johnston@Sun.COM #define	IPMI_SESSION_AUTHTYPE_MD2	0x02
46*11756SRobert.Johnston@Sun.COM #define	IPMI_SESSION_AUTHTYPE_MD5	0x04
47*11756SRobert.Johnston@Sun.COM #define	IPMI_SESSION_AUTHTYPE_PASSWORD	0x10
48*11756SRobert.Johnston@Sun.COM #define	IPMI_SESSION_AUTHTYPE_OEM	0x20
49*11756SRobert.Johnston@Sun.COM 
50*11756SRobert.Johnston@Sun.COM #define	IPMI_SESSION_PRIV_UNSPECIFIED   0x0
51*11756SRobert.Johnston@Sun.COM #define	IPMI_SESSION_PRIV_CALLBACK	0x1
52*11756SRobert.Johnston@Sun.COM #define	IPMI_SESSION_PRIV_USER		0x2
53*11756SRobert.Johnston@Sun.COM #define	IPMI_SESSION_PRIV_OPERATOR	0x3
54*11756SRobert.Johnston@Sun.COM #define	IPMI_SESSION_PRIV_ADMIN		0x4
55*11756SRobert.Johnston@Sun.COM #define	IPMI_SESSION_PRIV_OEM		0x5
56*11756SRobert.Johnston@Sun.COM 
57*11756SRobert.Johnston@Sun.COM #define	IPMI_BMC_SLAVE_ADDR	0x20
58*11756SRobert.Johnston@Sun.COM #define	IPMI_BUF_SIZE		1024
59*11756SRobert.Johnston@Sun.COM #define	IPMI_REMOTE_SWID	0x81
60*11756SRobert.Johnston@Sun.COM 
61*11756SRobert.Johnston@Sun.COM /*
62*11756SRobert.Johnston@Sun.COM  * The primary RMCP port
63*11756SRobert.Johnston@Sun.COM  */
64*11756SRobert.Johnston@Sun.COM #define	RMCP_UDP_PORT		623
65*11756SRobert.Johnston@Sun.COM 
66*11756SRobert.Johnston@Sun.COM /*
67*11756SRobert.Johnston@Sun.COM  * The ASF IANA Enterprise Number
68*11756SRobert.Johnston@Sun.COM  */
69*11756SRobert.Johnston@Sun.COM #define	ASF_RMCP_IANA		4542
70*11756SRobert.Johnston@Sun.COM 
71*11756SRobert.Johnston@Sun.COM /*
72*11756SRobert.Johnston@Sun.COM  * ASF Message Types for presence ping and pong
73*11756SRobert.Johnston@Sun.COM  */
74*11756SRobert.Johnston@Sun.COM #define	ASF_TYPE_PING		0x80
75*11756SRobert.Johnston@Sun.COM #define	ASF_TYPE_PONG		0x40
76*11756SRobert.Johnston@Sun.COM 
77*11756SRobert.Johnston@Sun.COM /*
78*11756SRobert.Johnston@Sun.COM  * ASF message header
79*11756SRobert.Johnston@Sun.COM  *
80*11756SRobert.Johnston@Sun.COM  * See section 13.2.3
81*11756SRobert.Johnston@Sun.COM  */
82*11756SRobert.Johnston@Sun.COM typedef struct asf_hdr {
83*11756SRobert.Johnston@Sun.COM 	uint32_t	ah_iana;
84*11756SRobert.Johnston@Sun.COM 	uint8_t		ah_msg_type;
85*11756SRobert.Johnston@Sun.COM 	uint8_t		ah_msg_tag;
86*11756SRobert.Johnston@Sun.COM 	uint8_t		__reserved1;
87*11756SRobert.Johnston@Sun.COM 	uint8_t		ah_dlen;
88*11756SRobert.Johnston@Sun.COM } asf_hdr_t;
89*11756SRobert.Johnston@Sun.COM 
90*11756SRobert.Johnston@Sun.COM /*
91*11756SRobert.Johnston@Sun.COM  * RMCP message header
92*11756SRobert.Johnston@Sun.COM  *
93*11756SRobert.Johnston@Sun.COM  * See section 13.1.3
94*11756SRobert.Johnston@Sun.COM  */
95*11756SRobert.Johnston@Sun.COM #define	RMCP_VERSION_1		0x06
96*11756SRobert.Johnston@Sun.COM #define	RMCP_CLASS_ASF		0x06
97*11756SRobert.Johnston@Sun.COM #define	RMCP_CLASS_IPMI		0x07
98*11756SRobert.Johnston@Sun.COM #define	RMCP_CLASS_OEM		0x08
99*11756SRobert.Johnston@Sun.COM 
100*11756SRobert.Johnston@Sun.COM typedef struct rmcp_hdr {
101*11756SRobert.Johnston@Sun.COM 	uint8_t rh_version;
102*11756SRobert.Johnston@Sun.COM 	uint8_t __reserved1;
103*11756SRobert.Johnston@Sun.COM 	uint8_t rh_seq;
104*11756SRobert.Johnston@Sun.COM 	DECL_BITFIELD3(
105*11756SRobert.Johnston@Sun.COM 	    rh_msg_class:5,
106*11756SRobert.Johnston@Sun.COM 	    __reserved2:2,
107*11756SRobert.Johnston@Sun.COM 	    rh_msg_type:1);
108*11756SRobert.Johnston@Sun.COM } rmcp_hdr_t;
109*11756SRobert.Johnston@Sun.COM 
110*11756SRobert.Johnston@Sun.COM /*
111*11756SRobert.Johnston@Sun.COM  * IPMI Session Header
112*11756SRobert.Johnston@Sun.COM  *
113*11756SRobert.Johnston@Sun.COM  * The IPMI session header contains some optional payload fields that are only
114*11756SRobert.Johnston@Sun.COM  * present in RMCP+ sessions or if the payload type is "OEM explicit".  This
115*11756SRobert.Johnston@Sun.COM  * structure is only intended to represent the session header for IPMI v1.5
116*11756SRobert.Johnston@Sun.COM  * messages.
117*11756SRobert.Johnston@Sun.COM  *
118*11756SRobert.Johnston@Sun.COM  * See section 13.6
119*11756SRobert.Johnston@Sun.COM  */
120*11756SRobert.Johnston@Sun.COM typedef struct v15_session_hdr {
121*11756SRobert.Johnston@Sun.COM 	uint8_t		sh_authtype;
122*11756SRobert.Johnston@Sun.COM 	uint32_t	sh_seq;
123*11756SRobert.Johnston@Sun.COM 	uint32_t	sh_id;
124*11756SRobert.Johnston@Sun.COM }  v15_session_hdr_t;
125*11756SRobert.Johnston@Sun.COM 
126*11756SRobert.Johnston@Sun.COM /*
127*11756SRobert.Johnston@Sun.COM  * IPMI Lan Message Header
128*11756SRobert.Johnston@Sun.COM  *
129*11756SRobert.Johnston@Sun.COM  * See section 13.8
130*11756SRobert.Johnston@Sun.COM  */
131*11756SRobert.Johnston@Sun.COM typedef struct ipmi_msg_hdr {
132*11756SRobert.Johnston@Sun.COM 	uint8_t imh_addr1;
133*11756SRobert.Johnston@Sun.COM 	DECL_BITFIELD2(
134*11756SRobert.Johnston@Sun.COM 	    imh_lun:2,
135*11756SRobert.Johnston@Sun.COM 	    imh_netfn:6);
136*11756SRobert.Johnston@Sun.COM 	uint8_t	imh_csum;
137*11756SRobert.Johnston@Sun.COM 	uint8_t imh_addr2;
138*11756SRobert.Johnston@Sun.COM 	uint8_t imh_seq;
139*11756SRobert.Johnston@Sun.COM 	uint8_t imh_cmd;
140*11756SRobert.Johnston@Sun.COM } ipmi_msg_hdr_t;
141*11756SRobert.Johnston@Sun.COM 
142*11756SRobert.Johnston@Sun.COM #pragma pack()
143*11756SRobert.Johnston@Sun.COM 
144*11756SRobert.Johnston@Sun.COM #ifdef	__cplusplus
145*11756SRobert.Johnston@Sun.COM }
146*11756SRobert.Johnston@Sun.COM #endif
147*11756SRobert.Johnston@Sun.COM 
148*11756SRobert.Johnston@Sun.COM #endif /* IPMI_LAN_H */
149