1249033Ssjg/*- 2236769Sobrien * Copyright (c) 2006 IronPort Systems Inc. <ambrisko@ironport.com> 3236769Sobrien * All rights reserved. 4236769Sobrien * 5236769Sobrien * Redistribution and use in source and binary forms, with or without 6236769Sobrien * modification, are permitted provided that the following conditions 7236769Sobrien * are met: 8236769Sobrien * 1. Redistributions of source code must retain the above copyright 9236769Sobrien * notice, this list of conditions and the following disclaimer. 10236769Sobrien * 2. Redistributions in binary form must reproduce the above copyright 11236769Sobrien * notice, this list of conditions and the following disclaimer in the 12236769Sobrien * documentation and/or other materials provided with the distribution. 13236769Sobrien * 14236769Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15236769Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16236769Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17236769Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18236769Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19236769Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20236769Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21236769Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22236769Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23236769Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24236769Sobrien * SUCH DAMAGE. 25236769Sobrien * 26236769Sobrien * $FreeBSD$ 27236769Sobrien */ 28236769Sobrien 29236769Sobrien#ifndef __SYS_IPMI_H__ 30236769Sobrien#define __SYS_IPMI_H__ 31236769Sobrien 32236769Sobrien#define IPMI_MAX_ADDR_SIZE 0x20 33236769Sobrien#define IPMI_MAX_RX 1024 34236769Sobrien#define IPMI_BMC_SLAVE_ADDR 0x20 /* Linux Default slave address */ 35236769Sobrien#define IPMI_BMC_CHANNEL 0x0f /* Linux BMC channel */ 36236769Sobrien 37236769Sobrien#define IPMI_BMC_SMS_LUN 0x02 38236769Sobrien 39236769Sobrien#define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c 40236769Sobrien#define IPMI_IPMB_ADDR_TYPE 0x01 41236769Sobrien#define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41 42236769Sobrien 43236769Sobrien#define IPMI_IOC_MAGIC 'i' 44236769Sobrien#define IPMICTL_RECEIVE_MSG_TRUNC _IOWR(IPMI_IOC_MAGIC, 11, struct ipmi_recv) 45236769Sobrien#define IPMICTL_RECEIVE_MSG _IOWR(IPMI_IOC_MAGIC, 12, struct ipmi_recv) 46236769Sobrien#define IPMICTL_SEND_COMMAND _IOW(IPMI_IOC_MAGIC, 13, struct ipmi_req) 47236769Sobrien#define IPMICTL_REGISTER_FOR_CMD _IOW(IPMI_IOC_MAGIC, 14, struct ipmi_cmdspec) 48236769Sobrien#define IPMICTL_UNREGISTER_FOR_CMD _IOW(IPMI_IOC_MAGIC, 15, struct ipmi_cmdspec) 49236769Sobrien#define IPMICTL_SET_GETS_EVENTS_CMD _IOW(IPMI_IOC_MAGIC, 16, int) 50236769Sobrien#define IPMICTL_SET_MY_ADDRESS_CMD _IOW(IPMI_IOC_MAGIC, 17, unsigned int) 51236769Sobrien#define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int) 52236769Sobrien#define IPMICTL_SET_MY_LUN_CMD _IOW(IPMI_IOC_MAGIC, 19, unsigned int) 53236769Sobrien#define IPMICTL_GET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 20, unsigned int) 54236769Sobrien 55236769Sobrien#define IPMI_RESPONSE_RECV_TYPE 1 56236769Sobrien#define IPMI_ASYNC_EVENT_RECV_TYPE 2 57236769Sobrien#define IPMI_CMD_RECV_TYPE 3 58236769Sobrien 59236769Sobrien#define IPMI_APP_REQUEST 0x06 60236769Sobrien#define IPMI_GET_DEVICE_ID 0x01 61236769Sobrien#define IPMI_CLEAR_FLAGS 0x30 62236769Sobrien#define IPMI_GET_MSG_FLAGS 0x31 63236769Sobrien# define IPMI_MSG_AVAILABLE 0x01 64236769Sobrien# define IPMI_MSG_BUFFER_FULL 0x02 65236769Sobrien# define IPMI_WDT_PRE_TIMEOUT 0x08 66236769Sobrien#define IPMI_GET_MSG 0x33 67236769Sobrien#define IPMI_SEND_MSG 0x34 68236769Sobrien#define IPMI_GET_CHANNEL_INFO 0x42 69236769Sobrien#define IPMI_RESET_WDOG 0x22 70236769Sobrien#define IPMI_SET_WDOG 0x24 71236769Sobrien#define IPMI_GET_WDOG 0x25 72236769Sobrien 73249033Ssjg#define IPMI_SET_WD_TIMER_SMS_OS 0x04 74236769Sobrien#define IPMI_SET_WD_TIMER_DONT_STOP 0x40 75236769Sobrien#define IPMI_SET_WD_ACTION_RESET 0x01 76236769Sobrien 77236769Sobrienstruct ipmi_msg { 78236769Sobrien unsigned char netfn; 79236769Sobrien unsigned char cmd; 80249033Ssjg unsigned short data_len; 81236769Sobrien unsigned char *data; 82236769Sobrien}; 83236769Sobrien 84236769Sobrienstruct ipmi_req { 85236769Sobrien unsigned char *addr; 86236769Sobrien unsigned int addr_len; 87236769Sobrien long msgid; 88236769Sobrien struct ipmi_msg msg; 89236769Sobrien}; 90236769Sobrien 91236769Sobrienstruct ipmi_recv { 92236769Sobrien int recv_type; 93236769Sobrien unsigned char *addr; 94236769Sobrien unsigned int addr_len; 95236769Sobrien long msgid; 96236769Sobrien struct ipmi_msg msg; 97236769Sobrien}; 98236769Sobrien 99236769Sobrienstruct ipmi_cmdspec { 100236769Sobrien unsigned char netfn; 101236769Sobrien unsigned char cmd; 102236769Sobrien}; 103236769Sobrien 104236769Sobrien 105236769Sobrienstruct ipmi_addr { 106236769Sobrien int addr_type; 107236769Sobrien short channel; 108236769Sobrien unsigned char data[IPMI_MAX_ADDR_SIZE]; 109236769Sobrien}; 110236769Sobrien 111236769Sobrienstruct ipmi_system_interface_addr { 112236769Sobrien int addr_type; 113236769Sobrien short channel; 114236769Sobrien unsigned char lun; 115236769Sobrien}; 116236769Sobrien 117236769Sobrienstruct ipmi_ipmb_addr { 118236769Sobrien int addr_type; 119236769Sobrien short channel; 120236769Sobrien unsigned char slave_addr; 121236769Sobrien unsigned char lun; 122236769Sobrien}; 123236769Sobrien 124236769Sobrien#if defined(__amd64__) 125236769Sobrien/* Compatibility with 32-bit binaries. */ 126236769Sobrien 127236769Sobrien#define IPMICTL_RECEIVE_MSG_TRUNC_32 _IOWR(IPMI_IOC_MAGIC, 11, struct ipmi_recv32) 128236769Sobrien#define IPMICTL_RECEIVE_MSG_32 _IOWR(IPMI_IOC_MAGIC, 12, struct ipmi_recv32) 129236769Sobrien#define IPMICTL_SEND_COMMAND_32 _IOW(IPMI_IOC_MAGIC, 13, struct ipmi_req32) 130236769Sobrien 131236769Sobrienstruct ipmi_msg32 { 132236769Sobrien unsigned char netfn; 133236769Sobrien unsigned char cmd; 134236769Sobrien unsigned short data_len; 135236769Sobrien uint32_t data; 136236769Sobrien}; 137236769Sobrien 138236769Sobrienstruct ipmi_req32 { 139236769Sobrien uint32_t addr; 140236769Sobrien unsigned int addr_len; 141236769Sobrien int32_t msgid; 142236769Sobrien struct ipmi_msg32 msg; 143236769Sobrien}; 144236769Sobrien 145236769Sobrienstruct ipmi_recv32 { 146236769Sobrien int recv_type; 147236769Sobrien uint32_t addr; 148249033Ssjg unsigned int addr_len; 149236769Sobrien int32_t msgid; 150236769Sobrien struct ipmi_msg32 msg; 151236769Sobrien}; 152236769Sobrien 153236769Sobrien#endif 154236769Sobrien 155236769Sobrien#endif /* !__SYS_IPMI_H__ */ 156236769Sobrien