81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston/*
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * CDDL HEADER START
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston *
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * The contents of this file are subject to the terms of the
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * Common Development and Distribution License (the "License").
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * You may not use this file except in compliance with the License.
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston *
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * or http://www.opensolaris.org/os/licensing.
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * See the License for the specific language governing permissions
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * and limitations under the License.
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston *
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * When distributing Covered Code, include this CDDL HEADER in each
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * If applicable, add the following below this CDDL HEADER, with the
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * fields enclosed by brackets "[]" replaced with your own identifying
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * information: Portions Copyright [yyyy] [name of copyright owner]
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston *
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * CDDL HEADER END
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston */
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston/*
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * Use is subject to license terms.
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston */
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#ifndef IPMI_LAN_H
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_LAN_H
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#ifdef __cplusplus
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnstonextern "C" {
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#endif
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#pragma pack(1)
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_CMD_GET_SESSION_CHALLENGE 0x39
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_CMD_ACTIVATE_SESSION 0x3a
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_CMD_SET_SESSION_PRIVLVL 0x3b
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_CMD_CLOSE_SESSION 0x3c
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_AUTHCODE_BUF_SIZE 20
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston/*
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * See section 22.13
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston */
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_SESSION_AUTHTYPE_NONE 0x01
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_SESSION_AUTHTYPE_MD2 0x02
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_SESSION_AUTHTYPE_MD5 0x04
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_SESSION_AUTHTYPE_PASSWORD 0x10
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_SESSION_AUTHTYPE_OEM 0x20
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_SESSION_PRIV_UNSPECIFIED 0x0
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_SESSION_PRIV_CALLBACK 0x1
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_SESSION_PRIV_USER 0x2
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_SESSION_PRIV_OPERATOR 0x3
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_SESSION_PRIV_ADMIN 0x4
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_SESSION_PRIV_OEM 0x5
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_BMC_SLAVE_ADDR 0x20
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_BUF_SIZE 1024
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define IPMI_REMOTE_SWID 0x81
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston/*
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * The primary RMCP port
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston */
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define RMCP_UDP_PORT 623
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston/*
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * The ASF IANA Enterprise Number
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston */
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define ASF_RMCP_IANA 4542
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston/*
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * ASF Message Types for presence ping and pong
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston */
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define ASF_TYPE_PING 0x80
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define ASF_TYPE_PONG 0x40
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston/*
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * ASF message header
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston *
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * See section 13.2.3
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston */
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnstontypedef struct asf_hdr {
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint32_t ah_iana;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint8_t ah_msg_type;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint8_t ah_msg_tag;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint8_t __reserved1;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint8_t ah_dlen;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston} asf_hdr_t;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston/*
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * RMCP message header
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston *
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * See section 13.1.3
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston */
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define RMCP_VERSION_1 0x06
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define RMCP_CLASS_ASF 0x06
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define RMCP_CLASS_IPMI 0x07
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#define RMCP_CLASS_OEM 0x08
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnstontypedef struct rmcp_hdr {
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint8_t rh_version;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint8_t __reserved1;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint8_t rh_seq;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston DECL_BITFIELD3(
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston rh_msg_class:5,
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston __reserved2:2,
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston rh_msg_type:1);
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston} rmcp_hdr_t;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston/*
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * IPMI Session Header
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston *
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * The IPMI session header contains some optional payload fields that are only
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * present in RMCP+ sessions or if the payload type is "OEM explicit". This
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * structure is only intended to represent the session header for IPMI v1.5
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * messages.
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston *
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * See section 13.6
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston */
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnstontypedef struct v15_session_hdr {
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint8_t sh_authtype;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint32_t sh_seq;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint32_t sh_id;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston} v15_session_hdr_t;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston/*
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * IPMI Lan Message Header
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston *
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston * See section 13.8
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston */
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnstontypedef struct ipmi_msg_hdr {
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint8_t imh_addr1;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston DECL_BITFIELD2(
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston imh_lun:2,
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston imh_netfn:6);
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint8_t imh_csum;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint8_t imh_addr2;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint8_t imh_seq;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston uint8_t imh_cmd;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston} ipmi_msg_hdr_t;
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#pragma pack()
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#ifdef __cplusplus
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston}
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#endif
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston
81d9f076db88c1f40c85831ce1ebb444a209c5a8Robert Johnston#endif /* IPMI_LAN_H */