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