Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
ipmi_si_intf.c File Reference
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
#include <linux/timer.h>
#include <linux/errno.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/list.h>
#include <linux/pci.h>
#include <linux/ioport.h>
#include <linux/notifier.h>
#include <linux/mutex.h>
#include <linux/kthread.h>
#include <asm/irq.h>
#include <linux/interrupt.h>
#include <linux/rcupdate.h>
#include <linux/ipmi.h>
#include <linux/ipmi_smi.h>
#include <asm/io.h>
#include "ipmi_si_sm.h"
#include <linux/init.h>
#include <linux/dmi.h>
#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/pnp.h>
#include <linux/of_device.h>
#include <linux/of_platform.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>

Go to the source code of this file.

Data Structures

struct  smi_info
 
struct  hotmod_vals
 
struct  ipmi_default_vals
 

Macros

#define PFX   "ipmi_si: "
 
#define SI_TIMEOUT_TIME_USEC   10000
 
#define SI_USEC_PER_JIFFY   (1000000/HZ)
 
#define SI_TIMEOUT_JIFFIES   (SI_TIMEOUT_TIME_USEC/SI_USEC_PER_JIFFY)
 
#define SI_SHORT_TIMEOUT_USEC
 
#define IPMI_BT_INTMASK_REG   2
 
#define IPMI_BT_INTMASK_CLEAR_IRQ_BIT   2
 
#define IPMI_BT_INTMASK_ENABLE_IRQ_BIT   1
 
#define DEVICE_NAME   "ipmi_si"
 
#define RECEIVE_MSG_AVAIL   0x01
 
#define EVENT_MSG_BUFFER_FULL   0x02
 
#define WDT_PRE_TIMEOUT_INT   0x08
 
#define OEM0_DATA_AVAIL   0x20
 
#define OEM1_DATA_AVAIL   0x40
 
#define OEM2_DATA_AVAIL   0x80
 
#define OEM_DATA_AVAIL
 
#define smi_inc_stat(smi, stat)   atomic_inc(&(smi)->stats[SI_STAT_ ## stat])
 
#define smi_get_stat(smi, stat)   ((unsigned int) atomic_read(&(smi)->stats[SI_STAT_ ## stat]))
 
#define SI_MAX_PARMS   4
 
#define DEFAULT_REGSPACING   1
 
#define DEFAULT_REGSIZE   1
 
#define MAX_SI_TYPE_STR   30
 
#define IPMI_IO_ADDR_SPACE   0
 
#define IPMI_MEM_ADDR_SPACE   1
 
#define DELL_POWEREDGE_8G_BMC_DEVICE_ID   0x20
 
#define DELL_POWEREDGE_8G_BMC_DEVICE_REV   0x80
 
#define DELL_POWEREDGE_8G_BMC_IPMI_VERSION   0x51
 
#define DELL_IANA_MFR_ID   0x0002a2
 
#define CANNOT_RETURN_REQUESTED_LENGTH   0xCA
 
#define STORAGE_NETFN   0x0A
 
#define STORAGE_CMD_GET_SDR   0x23
 

Enumerations

enum  si_intf_state {
  SI_NORMAL, SI_GETTING_FLAGS, SI_GETTING_EVENTS, SI_CLEARING_FLAGS,
  SI_CLEARING_FLAGS_THEN_SET_IRQ, SI_GETTING_MESSAGES, SI_ENABLE_INTERRUPTS1, SI_ENABLE_INTERRUPTS2,
  SI_DISABLE_INTERRUPTS1, SI_DISABLE_INTERRUPTS2
}
 
enum  si_type { SI_KCS, SI_SMIC, SI_BT }
 
enum  si_stat_indexes {
  SI_STAT_short_timeouts = 0, SI_STAT_long_timeouts, SI_STAT_idles, SI_STAT_interrupts,
  SI_STAT_attentions, SI_STAT_flag_fetches, SI_STAT_hosed_count, SI_STAT_complete_transactions,
  SI_STAT_events, SI_STAT_watchdog_pretimeouts, SI_STAT_incoming_messages, SI_NUM_STATS
}
 
enum  hotmod_op { HM_ADD, HM_REMOVE }
 

Functions

 module_param_call (hotmod, hotmod_handler, NULL, NULL, 0200)
 
 MODULE_PARM_DESC (hotmod,"Add and remove interfaces. See"" Documentation/IPMI.txt in the kernel sources for the"" gory details.")
 
 module_param_named (trydefaults, si_trydefaults, bool, 0)
 
 MODULE_PARM_DESC (trydefaults,"Setting this to 'false' will disable the"" default scan of the KCS and SMIC interface at the standard"" address")
 
 module_param_string (type, si_type_str, MAX_SI_TYPE_STR, 0)
 
 MODULE_PARM_DESC (type,"Defines the type of each interface, each"" interface separated by commas. The types are 'kcs',"" 'smic', and 'bt'. For example si_type=kcs,bt will set"" the first interface to kcs and the second to bt")
 
 module_param_array (addrs, ulong,&num_addrs, 0)
 
 MODULE_PARM_DESC (addrs,"Sets the memory address of each interface, the"" addresses separated by commas. Only use if an interface"" is in memory. Otherwise, set it to zero or leave"" it blank.")
 
 module_param_array (ports, uint,&num_ports, 0)
 
 MODULE_PARM_DESC (ports,"Sets the port address of each interface, the"" addresses separated by commas. Only use if an interface"" is a port. Otherwise, set it to zero or leave"" it blank.")
 
 module_param_array (irqs, int,&num_irqs, 0)
 
 MODULE_PARM_DESC (irqs,"Sets the interrupt of each interface, the"" addresses separated by commas. Only use if an interface"" has an interrupt. Otherwise, set it to zero or leave"" it blank.")
 
 module_param_array (regspacings, int,&num_regspacings, 0)
 
 MODULE_PARM_DESC (regspacings,"The number of bytes between the start address"" and each successive register used by the interface. For"" instance, if the start address is 0xca2 and the spacing"" is 2, then the second address is at 0xca4. Defaults"" to 1.")
 
 module_param_array (regsizes, int,&num_regsizes, 0)
 
 MODULE_PARM_DESC (regsizes,"The size of the specific IPMI register in bytes."" This should generally be 1, 2, 4, or 8 for an 8-bit,"" 16-bit, 32-bit, or 64-bit register. Use this if you"" the 8-bit IPMI register has to be read from a larger"" register.")
 
 module_param_array (regshifts, int,&num_regshifts, 0)
 
 MODULE_PARM_DESC (regshifts,"The amount to shift the data read from the."" IPMI register, in bits. For instance, if the data"" is read from a 32-bit word and the IPMI data is in"" bit 8-15, then the shift would be 8")
 
 module_param_array (slave_addrs, int,&num_slave_addrs, 0)
 
 MODULE_PARM_DESC (slave_addrs,"Set the default IPMB slave address for"" the controller. Normally this is 0x20, but can be"" overridden by this parm. This is an array indexed"" by interface number.")
 
 module_param_array (force_kipmid, int,&num_force_kipmid, 0)
 
 MODULE_PARM_DESC (force_kipmid,"Force the kipmi daemon to be enabled (1) or"" disabled(0). Normally the IPMI driver auto-detects"" this, but the value may be overridden by this parm.")
 
 module_param (unload_when_empty, int, 0)
 
 MODULE_PARM_DESC (unload_when_empty,"Unload the module if no interfaces are"" specified or found, default is 1. Setting to 0"" is useful for hot add of devices using hotmod.")
 
 module_param_array (kipmid_max_busy_us, uint,&num_max_busy_us, 0644)
 
 MODULE_PARM_DESC (kipmid_max_busy_us,"Max time (in microseconds) to busy-wait for IPMI data before"" sleeping. 0 (default) means to wait forever. Set to 100-500"" if kipmid is using up a lot of CPU time.")
 
 module_init (init_ipmi_si)
 
 module_exit (cleanup_ipmi_si)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Corey Minyard <[email protected]>")
 
 MODULE_DESCRIPTION ("Interface to the IPMI driver for the KCS, SMIC, and BT"" system interfaces.")
 

Macro Definition Documentation

#define CANNOT_RETURN_REQUESTED_LENGTH   0xCA

Definition at line 2954 of file ipmi_si_intf.c.

#define DEFAULT_REGSIZE   1

Definition at line 1208 of file ipmi_si_intf.c.

#define DEFAULT_REGSPACING   1

Definition at line 1207 of file ipmi_si_intf.c.

#define DELL_IANA_MFR_ID   0x0002a2

Definition at line 2935 of file ipmi_si_intf.c.

#define DELL_POWEREDGE_8G_BMC_DEVICE_ID   0x20

Definition at line 2932 of file ipmi_si_intf.c.

#define DELL_POWEREDGE_8G_BMC_DEVICE_REV   0x80

Definition at line 2933 of file ipmi_si_intf.c.

#define DELL_POWEREDGE_8G_BMC_IPMI_VERSION   0x51

Definition at line 2934 of file ipmi_si_intf.c.

#define DEVICE_NAME   "ipmi_si"

Definition at line 113 of file ipmi_si_intf.c.

#define EVENT_MSG_BUFFER_FULL   0x02

Definition at line 204 of file ipmi_si_intf.c.

#define IPMI_BT_INTMASK_CLEAR_IRQ_BIT   2

Definition at line 101 of file ipmi_si_intf.c.

#define IPMI_BT_INTMASK_ENABLE_IRQ_BIT   1

Definition at line 102 of file ipmi_si_intf.c.

#define IPMI_BT_INTMASK_REG   2

Definition at line 100 of file ipmi_si_intf.c.

#define IPMI_IO_ADDR_SPACE   0

Definition at line 1229 of file ipmi_si_intf.c.

#define IPMI_MEM_ADDR_SPACE   1

Definition at line 1230 of file ipmi_si_intf.c.

#define MAX_SI_TYPE_STR   30

Definition at line 1212 of file ipmi_si_intf.c.

#define OEM0_DATA_AVAIL   0x20

Definition at line 206 of file ipmi_si_intf.c.

#define OEM1_DATA_AVAIL   0x40

Definition at line 207 of file ipmi_si_intf.c.

#define OEM2_DATA_AVAIL   0x80

Definition at line 208 of file ipmi_si_intf.c.

#define OEM_DATA_AVAIL
Value:
OEM1_DATA_AVAIL | \
OEM2_DATA_AVAIL)

Definition at line 209 of file ipmi_si_intf.c.

#define PFX   "ipmi_si: "

Definition at line 74 of file ipmi_si_intf.c.

#define RECEIVE_MSG_AVAIL   0x01

Definition at line 203 of file ipmi_si_intf.c.

#define SI_MAX_PARMS   4

Definition at line 290 of file ipmi_si_intf.c.

#define SI_SHORT_TIMEOUT_USEC
Value:
250 /* .25ms when the SM request a
short timeout */

Definition at line 83 of file ipmi_si_intf.c.

#define SI_TIMEOUT_JIFFIES   (SI_TIMEOUT_TIME_USEC/SI_USEC_PER_JIFFY)

Definition at line 82 of file ipmi_si_intf.c.

#define SI_TIMEOUT_TIME_USEC   10000

Definition at line 80 of file ipmi_si_intf.c.

#define SI_USEC_PER_JIFFY   (1000000/HZ)

Definition at line 81 of file ipmi_si_intf.c.

#define smi_get_stat (   smi,
  stat 
)    ((unsigned int) atomic_read(&(smi)->stats[SI_STAT_ ## stat]))

Definition at line 287 of file ipmi_si_intf.c.

#define smi_inc_stat (   smi,
  stat 
)    atomic_inc(&(smi)->stats[SI_STAT_ ## stat])

Definition at line 285 of file ipmi_si_intf.c.

#define STORAGE_CMD_GET_SDR   0x23

Definition at line 2980 of file ipmi_si_intf.c.

#define STORAGE_NETFN   0x0A

Definition at line 2979 of file ipmi_si_intf.c.

#define WDT_PRE_TIMEOUT_INT   0x08

Definition at line 205 of file ipmi_si_intf.c.

Enumeration Type Documentation

enum hotmod_op
Enumerator:
HM_ADD 
HM_REMOVE 

Definition at line 1589 of file ipmi_si_intf.c.

Enumerator:
SI_NORMAL 
SI_GETTING_FLAGS 
SI_GETTING_EVENTS 
SI_CLEARING_FLAGS 
SI_CLEARING_FLAGS_THEN_SET_IRQ 
SI_GETTING_MESSAGES 
SI_ENABLE_INTERRUPTS1 
SI_ENABLE_INTERRUPTS2 
SI_DISABLE_INTERRUPTS1 
SI_DISABLE_INTERRUPTS2 

Definition at line 85 of file ipmi_si_intf.c.

Enumerator:
SI_STAT_short_timeouts 
SI_STAT_long_timeouts 
SI_STAT_idles 
SI_STAT_interrupts 
SI_STAT_attentions 
SI_STAT_flag_fetches 
SI_STAT_hosed_count 
SI_STAT_complete_transactions 
SI_STAT_events 
SI_STAT_watchdog_pretimeouts 
SI_STAT_incoming_messages 
SI_NUM_STATS 

Definition at line 120 of file ipmi_si_intf.c.

enum si_type
Enumerator:
SI_KCS 
SI_SMIC 
SI_BT 

Definition at line 104 of file ipmi_si_intf.c.

Function Documentation

MODULE_AUTHOR ( "Corey Minyard <[email protected]>"  )
MODULE_DESCRIPTION ( "Interface to the IPMI driver for the  KCS,
SMIC  ,
and BT""system interfaces."   
)
module_exit ( cleanup_ipmi_si  )
module_init ( init_ipmi_si  )
MODULE_LICENSE ( "GPL"  )
module_param ( unload_when_empty  ,
int  ,
 
)
module_param_array ( addrs  ,
ulong  ,
num_addrs,
 
)
module_param_array ( ports  ,
uint  ,
num_ports,
 
)
module_param_array ( irqs  ,
int  ,
num_irqs,
 
)
module_param_array ( regspacings  ,
int  ,
num_regspacings,
 
)
module_param_array ( regsizes  ,
int  ,
num_regsizes,
 
)
module_param_array ( regshifts  ,
int  ,
num_regshifts,
 
)
module_param_array ( slave_addrs  ,
int  ,
num_slave_addrs,
 
)
module_param_array ( force_kipmid  ,
int  ,
num_force_kipmid,
 
)
module_param_array ( kipmid_max_busy_us  ,
uint  ,
num_max_busy_us,
0644   
)
module_param_call ( hotmod  ,
hotmod_handler  ,
NULL  ,
NULL  ,
0200   
)
module_param_named ( trydefaults  ,
si_trydefaults  ,
bool  ,
 
)
module_param_string ( type  ,
si_type_str  ,
MAX_SI_TYPE_STR  ,
 
)
MODULE_PARM_DESC ( hotmod  ,
"Add and remove interfaces. See"" Documentation/IPMI.txt in the kernel sources for the"" gory details."   
)
MODULE_PARM_DESC ( trydefaults  ,
"Setting this to 'false' will disable the"" default scan of the KCS and SMIC interface at the standard"" address  
)
MODULE_PARM_DESC ( type  ,
"Defines the type of each  interface,
each""interface separated by commas.The types are 'kcs'  ,
"" 'smic'  ,
and 'bt'.For example  si_type = kcs,
bt will set""the first interface to kcs and the second to bt  
)
MODULE_PARM_DESC ( addrs  ,
"Sets the memory address of each  interface,
the""addresses separated by commas.Only use if an interface""is in memory.  Otherwise,
set it to zero or leave""it blank."   
)
MODULE_PARM_DESC ( ports  ,
"Sets the port address of each  interface,
the""addresses separated by commas.Only use if an interface""is a port.  Otherwise,
set it to zero or leave""it blank."   
)
MODULE_PARM_DESC ( irqs  ,
"Sets the interrupt of each  interface,
the""addresses separated by commas.Only use if an interface""has an interrupt.  Otherwise,
set it to zero or leave""it blank."   
)
MODULE_PARM_DESC ( regspacings  ,
"The number of bytes between the start address"" and each successive register used by the interface. For""  instance,
if the start address is 0xca2 and the spacing""is  2,
then the second address is at 0xca4.Defaults""to 1."   
)
MODULE_PARM_DESC ( regsizes  ,
"The size of the specific IPMI register in bytes."" This should generally be  1,
,
,
or 8 for an 8-  bit,
""16-  bit,
32-  bit,
or 64-bit register.Use this if you""the 8-bit IPMI register has to be read from a larger""register."   
)
MODULE_PARM_DESC ( regshifts  ,
"The amount to shift the data read from the."" IPMI  register,
in bits.For  instance,
if the data""is read from a 32-bit word and the IPMI data is in""bit 8-  15,
then the shift would be 8"   
)
MODULE_PARM_DESC ( slave_addrs  ,
"Set the default IPMB slave address for"" the controller. Normally this is  0x20,
but can be""overridden by this parm.This is an array indexed""by interface number."   
)
MODULE_PARM_DESC ( force_kipmid  ,
"Force the kipmi daemon to be enabled (1) or"" disabled(0). Normally the IPMI driver auto-detects""  this,
but the value may be overridden by this parm."   
)
MODULE_PARM_DESC ( unload_when_empty  ,
"Unload the module if no interfaces are"" specified or  found,
default is 1.Setting to 0""is useful for hot add of devices using hotmod."   
)
MODULE_PARM_DESC ( kipmid_max_busy_us  ,
"Max time (in microseconds) to busy-wait for IPMI data before"" sleeping. 0 (default) means to wait forever. Set to 100-500"" if kipmid is using up a lot of CPU time."   
)