Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
ipmi_msghandler.c File Reference
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/poll.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/ipmi.h>
#include <linux/ipmi_smi.h>
#include <linux/notifier.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/rcupdate.h>
#include <linux/interrupt.h>

Go to the source code of this file.

Data Structures

struct  ipmi_user
 
struct  cmd_rcvr
 
struct  seq_table
 
struct  ipmi_channel
 
struct  bmc_device
 
struct  ipmi_smi
 
struct  watcher_entry
 
struct  prod_dev_id
 

Macros

#define PFX   "IPMI message handler: "
 
#define IPMI_DRIVER_VERSION   "39.2"
 
#define IPMI_MAINTENANCE_MODE_TIMEOUT   30000
 
#define MAX_EVENTS_IN_QUEUE   25
 
#define MAX_MSG_TIMEOUT   60000
 
#define STORE_SEQ_IN_MSGID(seq, seqid)   (((seq&0xff)<<26) | (seqid&0x3ffffff))
 
#define GET_SEQ_FROM_MSGID(msgid, seq, seqid)
 
#define NEXT_SEQID(seqid)   (((seqid) + 1) & 0x3fffff)
 
#define IPMI_IPMB_NUM_SEQ   64
 
#define IPMI_MAX_CHANNELS   16
 
#define to_si_intf_from_dev(device)   container_of(device, struct ipmi_smi, dev)
 
#define ipmi_inc_stat(intf, stat)   atomic_inc(&(intf)->stats[IPMI_STAT_ ## stat])
 
#define ipmi_get_stat(intf, stat)   ((unsigned int) atomic_read(&(intf)->stats[IPMI_STAT_ ## stat]))
 
#define IPMI_TIMEOUT_TIME   1000
 
#define IPMI_TIMEOUT_JIFFIES   ((IPMI_TIMEOUT_TIME * HZ) / 1000)
 
#define IPMI_REQUEST_EV_TIME   (1000 / (IPMI_TIMEOUT_TIME))
 

Enumerations

enum  ipmi_stat_indexes {
  IPMI_STAT_sent_invalid_commands = 0, IPMI_STAT_sent_local_commands, IPMI_STAT_handled_local_responses, IPMI_STAT_unhandled_local_responses,
  IPMI_STAT_sent_ipmb_commands, IPMI_STAT_sent_ipmb_command_errs, IPMI_STAT_retransmitted_ipmb_commands, IPMI_STAT_timed_out_ipmb_commands,
  IPMI_STAT_timed_out_ipmb_broadcasts, IPMI_STAT_sent_ipmb_responses, IPMI_STAT_handled_ipmb_responses, IPMI_STAT_invalid_ipmb_responses,
  IPMI_STAT_unhandled_ipmb_responses, IPMI_STAT_sent_lan_commands, IPMI_STAT_sent_lan_command_errs, IPMI_STAT_retransmitted_lan_commands,
  IPMI_STAT_timed_out_lan_commands, IPMI_STAT_sent_lan_responses, IPMI_STAT_handled_lan_responses, IPMI_STAT_invalid_lan_responses,
  IPMI_STAT_unhandled_lan_responses, IPMI_STAT_handled_commands, IPMI_STAT_invalid_commands, IPMI_STAT_unhandled_commands,
  IPMI_STAT_invalid_events, IPMI_STAT_events, IPMI_STAT_dropped_rexmit_ipmb_commands, IPMI_STAT_dropped_rexmit_lan_commands,
  IPMI_NUM_STATS
}
 

Functions

int ipmi_smi_watcher_register (struct ipmi_smi_watcher *watcher)
 
 EXPORT_SYMBOL (ipmi_smi_watcher_register)
 
int ipmi_smi_watcher_unregister (struct ipmi_smi_watcher *watcher)
 
 EXPORT_SYMBOL (ipmi_smi_watcher_unregister)
 
int ipmi_validate_addr (struct ipmi_addr *addr, int len)
 
 EXPORT_SYMBOL (ipmi_validate_addr)
 
unsigned int ipmi_addr_length (int addr_type)
 
 EXPORT_SYMBOL (ipmi_addr_length)
 
int ipmi_create_user (unsigned int if_num, struct ipmi_user_hndl *handler, void *handler_data, ipmi_user_t *user)
 
 EXPORT_SYMBOL (ipmi_create_user)
 
int ipmi_get_smi_info (int if_num, struct ipmi_smi_info *data)
 
 EXPORT_SYMBOL (ipmi_get_smi_info)
 
int ipmi_destroy_user (ipmi_user_t user)
 
 EXPORT_SYMBOL (ipmi_destroy_user)
 
void ipmi_get_version (ipmi_user_t user, unsigned char *major, unsigned char *minor)
 
 EXPORT_SYMBOL (ipmi_get_version)
 
int ipmi_set_my_address (ipmi_user_t user, unsigned int channel, unsigned char address)
 
 EXPORT_SYMBOL (ipmi_set_my_address)
 
int ipmi_get_my_address (ipmi_user_t user, unsigned int channel, unsigned char *address)
 
 EXPORT_SYMBOL (ipmi_get_my_address)
 
int ipmi_set_my_LUN (ipmi_user_t user, unsigned int channel, unsigned char LUN)
 
 EXPORT_SYMBOL (ipmi_set_my_LUN)
 
int ipmi_get_my_LUN (ipmi_user_t user, unsigned int channel, unsigned char *address)
 
 EXPORT_SYMBOL (ipmi_get_my_LUN)
 
int ipmi_get_maintenance_mode (ipmi_user_t user)
 
 EXPORT_SYMBOL (ipmi_get_maintenance_mode)
 
int ipmi_set_maintenance_mode (ipmi_user_t user, int mode)
 
 EXPORT_SYMBOL (ipmi_set_maintenance_mode)
 
int ipmi_set_gets_events (ipmi_user_t user, int val)
 
 EXPORT_SYMBOL (ipmi_set_gets_events)
 
int ipmi_register_for_cmd (ipmi_user_t user, unsigned char netfn, unsigned char cmd, unsigned int chans)
 
 EXPORT_SYMBOL (ipmi_register_for_cmd)
 
int ipmi_unregister_for_cmd (ipmi_user_t user, unsigned char netfn, unsigned char cmd, unsigned int chans)
 
 EXPORT_SYMBOL (ipmi_unregister_for_cmd)
 
int ipmi_request_settime (ipmi_user_t user, struct ipmi_addr *addr, long msgid, struct kernel_ipmi_msg *msg, void *user_msg_data, int priority, int retries, unsigned int retry_time_ms)
 
 EXPORT_SYMBOL (ipmi_request_settime)
 
int ipmi_request_supply_msgs (ipmi_user_t user, struct ipmi_addr *addr, long msgid, struct kernel_ipmi_msg *msg, void *user_msg_data, void *supplied_smi, struct ipmi_recv_msg *supplied_recv, int priority)
 
 EXPORT_SYMBOL (ipmi_request_supply_msgs)
 
int ipmi_smi_add_proc_entry (ipmi_smi_t smi, char *name, const struct file_operations *proc_ops, void *data)
 
 EXPORT_SYMBOL (ipmi_smi_add_proc_entry)
 
void ipmi_poll_interface (ipmi_user_t user)
 
 EXPORT_SYMBOL (ipmi_poll_interface)
 
int ipmi_register_smi (struct ipmi_smi_handlers *handlers, void *send_info, struct ipmi_device_id *device_id, struct device *si_dev, const char *sysfs_name, unsigned char slave_addr)
 
 EXPORT_SYMBOL (ipmi_register_smi)
 
int ipmi_unregister_smi (ipmi_smi_t intf)
 
 EXPORT_SYMBOL (ipmi_unregister_smi)
 
void ipmi_smi_msg_received (ipmi_smi_t intf, struct ipmi_smi_msg *msg)
 
 EXPORT_SYMBOL (ipmi_smi_msg_received)
 
void ipmi_smi_watchdog_pretimeout (ipmi_smi_t intf)
 
 EXPORT_SYMBOL (ipmi_smi_watchdog_pretimeout)
 
struct ipmi_smi_msgipmi_alloc_smi_msg (void)
 
 EXPORT_SYMBOL (ipmi_alloc_smi_msg)
 
void ipmi_free_recv_msg (struct ipmi_recv_msg *msg)
 
 EXPORT_SYMBOL (ipmi_free_recv_msg)
 
 module_exit (cleanup_ipmi)
 
 module_init (ipmi_init_msghandler_mod)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Corey Minyard <[email protected]>")
 
 MODULE_DESCRIPTION ("Incoming and outgoing message routing for an IPMI"" interface.")
 
 MODULE_VERSION (IPMI_DRIVER_VERSION)
 

Macro Definition Documentation

#define GET_SEQ_FROM_MSGID (   msgid,
  seq,
  seqid 
)
Value:
do { \
seq = ((msgid >> 26) & 0x3f); \
seqid = (msgid & 0x3fffff); \
} while (0)

Definition at line 146 of file ipmi_msghandler.c.

#define IPMI_DRIVER_VERSION   "39.2"

Definition at line 52 of file ipmi_msghandler.c.

#define ipmi_get_stat (   intf,
  stat 
)    ((unsigned int) atomic_read(&(intf)->stats[IPMI_STAT_ ## stat]))

Definition at line 457 of file ipmi_msghandler.c.

#define ipmi_inc_stat (   intf,
  stat 
)    atomic_inc(&(intf)->stats[IPMI_STAT_ ## stat])

Definition at line 455 of file ipmi_msghandler.c.

#define IPMI_IPMB_NUM_SEQ   64

Definition at line 303 of file ipmi_msghandler.c.

#define IPMI_MAINTENANCE_MODE_TIMEOUT   30000

Definition at line 66 of file ipmi_msghandler.c.

#define IPMI_MAX_CHANNELS   16

Definition at line 304 of file ipmi_msghandler.c.

#define IPMI_REQUEST_EV_TIME   (1000 / (IPMI_TIMEOUT_TIME))

Definition at line 4134 of file ipmi_msghandler.c.

#define IPMI_TIMEOUT_JIFFIES   ((IPMI_TIMEOUT_TIME * HZ) / 1000)

Definition at line 4126 of file ipmi_msghandler.c.

#define IPMI_TIMEOUT_TIME   1000

Definition at line 4123 of file ipmi_msghandler.c.

#define MAX_EVENTS_IN_QUEUE   25

Definition at line 68 of file ipmi_msghandler.c.

#define MAX_MSG_TIMEOUT   60000

Definition at line 74 of file ipmi_msghandler.c.

#define NEXT_SEQID (   seqid)    (((seqid) + 1) & 0x3fffff)

Definition at line 152 of file ipmi_msghandler.c.

#define PFX   "IPMI message handler: "

Definition at line 50 of file ipmi_msghandler.c.

#define STORE_SEQ_IN_MSGID (   seq,
  seqid 
)    (((seq&0xff)<<26) | (seqid&0x3ffffff))

Definition at line 144 of file ipmi_msghandler.c.

#define to_si_intf_from_dev (   device)    container_of(device, struct ipmi_smi, dev)

Definition at line 432 of file ipmi_msghandler.c.

Enumeration Type Documentation

Enumerator:
IPMI_STAT_sent_invalid_commands 
IPMI_STAT_sent_local_commands 
IPMI_STAT_handled_local_responses 
IPMI_STAT_unhandled_local_responses 
IPMI_STAT_sent_ipmb_commands 
IPMI_STAT_sent_ipmb_command_errs 
IPMI_STAT_retransmitted_ipmb_commands 
IPMI_STAT_timed_out_ipmb_commands 
IPMI_STAT_timed_out_ipmb_broadcasts 
IPMI_STAT_sent_ipmb_responses 
IPMI_STAT_handled_ipmb_responses 
IPMI_STAT_invalid_ipmb_responses 
IPMI_STAT_unhandled_ipmb_responses 
IPMI_STAT_sent_lan_commands 
IPMI_STAT_sent_lan_command_errs 
IPMI_STAT_retransmitted_lan_commands 
IPMI_STAT_timed_out_lan_commands 
IPMI_STAT_sent_lan_responses 
IPMI_STAT_handled_lan_responses 
IPMI_STAT_invalid_lan_responses 
IPMI_STAT_unhandled_lan_responses 
IPMI_STAT_handled_commands 
IPMI_STAT_invalid_commands 
IPMI_STAT_unhandled_commands 
IPMI_STAT_invalid_events 
IPMI_STAT_events 
IPMI_STAT_dropped_rexmit_ipmb_commands 
IPMI_STAT_dropped_rexmit_lan_commands 
IPMI_NUM_STATS 

Definition at line 203 of file ipmi_msghandler.c.

Function Documentation

EXPORT_SYMBOL ( ipmi_smi_watcher_register  )
EXPORT_SYMBOL ( ipmi_smi_watcher_unregister  )
EXPORT_SYMBOL ( ipmi_validate_addr  )
EXPORT_SYMBOL ( ipmi_addr_length  )
EXPORT_SYMBOL ( ipmi_create_user  )
EXPORT_SYMBOL ( ipmi_get_smi_info  )
EXPORT_SYMBOL ( ipmi_destroy_user  )
EXPORT_SYMBOL ( ipmi_get_version  )
EXPORT_SYMBOL ( ipmi_set_my_address  )
EXPORT_SYMBOL ( ipmi_get_my_address  )
EXPORT_SYMBOL ( ipmi_set_my_LUN  )
EXPORT_SYMBOL ( ipmi_get_my_LUN  )
EXPORT_SYMBOL ( ipmi_get_maintenance_mode  )
EXPORT_SYMBOL ( ipmi_set_maintenance_mode  )
EXPORT_SYMBOL ( ipmi_set_gets_events  )
EXPORT_SYMBOL ( ipmi_register_for_cmd  )
EXPORT_SYMBOL ( ipmi_unregister_for_cmd  )
EXPORT_SYMBOL ( ipmi_request_settime  )
EXPORT_SYMBOL ( ipmi_request_supply_msgs  )
EXPORT_SYMBOL ( ipmi_smi_add_proc_entry  )
EXPORT_SYMBOL ( ipmi_poll_interface  )
EXPORT_SYMBOL ( ipmi_register_smi  )
EXPORT_SYMBOL ( ipmi_unregister_smi  )
EXPORT_SYMBOL ( ipmi_smi_msg_received  )
EXPORT_SYMBOL ( ipmi_smi_watchdog_pretimeout  )
EXPORT_SYMBOL ( ipmi_alloc_smi_msg  )
EXPORT_SYMBOL ( ipmi_free_recv_msg  )
unsigned int ipmi_addr_length ( int  addr_type)

Definition at line 690 of file ipmi_msghandler.c.

struct ipmi_smi_msg* ipmi_alloc_smi_msg ( void  )
read

Definition at line 4166 of file ipmi_msghandler.c.

int ipmi_create_user ( unsigned int  if_num,
struct ipmi_user_hndl handler,
void handler_data,
ipmi_user_t user 
)

Definition at line 885 of file ipmi_msghandler.c.

int ipmi_destroy_user ( ipmi_user_t  user)

Definition at line 1014 of file ipmi_msghandler.c.

void ipmi_free_recv_msg ( struct ipmi_recv_msg msg)

Definition at line 4198 of file ipmi_msghandler.c.

int ipmi_get_maintenance_mode ( ipmi_user_t  user)

Definition at line 1128 of file ipmi_msghandler.c.

int ipmi_get_my_address ( ipmi_user_t  user,
unsigned int  channel,
unsigned char address 
)

Definition at line 1095 of file ipmi_msghandler.c.

int ipmi_get_my_LUN ( ipmi_user_t  user,
unsigned int  channel,
unsigned char address 
)

Definition at line 1117 of file ipmi_msghandler.c.

int ipmi_get_smi_info ( int  if_num,
struct ipmi_smi_info data 
)

Definition at line 981 of file ipmi_msghandler.c.

void ipmi_get_version ( ipmi_user_t  user,
unsigned char major,
unsigned char minor 
)

Definition at line 1075 of file ipmi_msghandler.c.

void ipmi_poll_interface ( ipmi_user_t  user)

Definition at line 2804 of file ipmi_msghandler.c.

int ipmi_register_for_cmd ( ipmi_user_t  user,
unsigned char  netfn,
unsigned char  cmd,
unsigned int  chans 
)

Definition at line 1267 of file ipmi_msghandler.c.

int ipmi_register_smi ( struct ipmi_smi_handlers handlers,
void send_info,
struct ipmi_device_id device_id,
struct device si_dev,
const char sysfs_name,
unsigned char  slave_addr 
)

Definition at line 2810 of file ipmi_msghandler.c.

int ipmi_request_settime ( ipmi_user_t  user,
struct ipmi_addr addr,
long  msgid,
struct kernel_ipmi_msg msg,
void user_msg_data,
int  priority,
int  retries,
unsigned int  retry_time_ms 
)

Definition at line 1842 of file ipmi_msghandler.c.

int ipmi_request_supply_msgs ( ipmi_user_t  user,
struct ipmi_addr addr,
long  msgid,
struct kernel_ipmi_msg msg,
void user_msg_data,
void supplied_smi,
struct ipmi_recv_msg supplied_recv,
int  priority 
)

Definition at line 1874 of file ipmi_msghandler.c.

int ipmi_set_gets_events ( ipmi_user_t  user,
int  val 
)

Definition at line 1187 of file ipmi_msghandler.c.

int ipmi_set_maintenance_mode ( ipmi_user_t  user,
int  mode 
)

Definition at line 1148 of file ipmi_msghandler.c.

int ipmi_set_my_address ( ipmi_user_t  user,
unsigned int  channel,
unsigned char  address 
)

Definition at line 1084 of file ipmi_msghandler.c.

int ipmi_set_my_LUN ( ipmi_user_t  user,
unsigned int  channel,
unsigned char  LUN 
)

Definition at line 1106 of file ipmi_msghandler.c.

int ipmi_smi_add_proc_entry ( ipmi_smi_t  smi,
char name,
const struct file_operations proc_ops,
void data 
)

Definition at line 2027 of file ipmi_msghandler.c.

void ipmi_smi_msg_received ( ipmi_smi_t  intf,
struct ipmi_smi_msg msg 
)

Definition at line 3865 of file ipmi_msghandler.c.

void ipmi_smi_watchdog_pretimeout ( ipmi_smi_t  intf)

Definition at line 3932 of file ipmi_msghandler.c.

int ipmi_smi_watcher_register ( struct ipmi_smi_watcher watcher)

Definition at line 539 of file ipmi_msghandler.c.

int ipmi_smi_watcher_unregister ( struct ipmi_smi_watcher watcher)

Definition at line 590 of file ipmi_msghandler.c.

int ipmi_unregister_for_cmd ( ipmi_user_t  user,
unsigned char  netfn,
unsigned char  cmd,
unsigned int  chans 
)

Definition at line 1303 of file ipmi_msghandler.c.

int ipmi_unregister_smi ( ipmi_smi_t  intf)

Definition at line 2986 of file ipmi_msghandler.c.

int ipmi_validate_addr ( struct ipmi_addr addr,
int  len 
)

Definition at line 658 of file ipmi_msghandler.c.

MODULE_AUTHOR ( "Corey Minyard <[email protected]>"  )
MODULE_DESCRIPTION ( "Incoming and outgoing message routing for an IPMI"" interface."  )
module_exit ( cleanup_ipmi  )
module_init ( ipmi_init_msghandler_mod  )
MODULE_LICENSE ( "GPL"  )
MODULE_VERSION ( IPMI_DRIVER_VERSION  )