xref: /OK3568_Linux_fs/kernel/Documentation/driver-api/ipmi.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun=====================
2*4882a593SmuzhiyunThe Linux IPMI Driver
3*4882a593Smuzhiyun=====================
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun:Author: Corey Minyard <minyard@mvista.com> / <minyard@acm.org>
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunThe Intelligent Platform Management Interface, or IPMI, is a
8*4882a593Smuzhiyunstandard for controlling intelligent devices that monitor a system.
9*4882a593SmuzhiyunIt provides for dynamic discovery of sensors in the system and the
10*4882a593Smuzhiyunability to monitor the sensors and be informed when the sensor's
11*4882a593Smuzhiyunvalues change or go outside certain boundaries.  It also has a
12*4882a593Smuzhiyunstandardized database for field-replaceable units (FRUs) and a watchdog
13*4882a593Smuzhiyuntimer.
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunTo use this, you need an interface to an IPMI controller in your
16*4882a593Smuzhiyunsystem (called a Baseboard Management Controller, or BMC) and
17*4882a593Smuzhiyunmanagement software that can use the IPMI system.
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunThis document describes how to use the IPMI driver for Linux.  If you
20*4882a593Smuzhiyunare not familiar with IPMI itself, see the web site at
21*4882a593Smuzhiyunhttps://www.intel.com/design/servers/ipmi/index.htm.  IPMI is a big
22*4882a593Smuzhiyunsubject and I can't cover it all here!
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunConfiguration
25*4882a593Smuzhiyun-------------
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunThe Linux IPMI driver is modular, which means you have to pick several
28*4882a593Smuzhiyunthings to have it work right depending on your hardware.  Most of
29*4882a593Smuzhiyunthese are available in the 'Character Devices' menu then the IPMI
30*4882a593Smuzhiyunmenu.
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunNo matter what, you must pick 'IPMI top-level message handler' to use
33*4882a593SmuzhiyunIPMI.  What you do beyond that depends on your needs and hardware.
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunThe message handler does not provide any user-level interfaces.
36*4882a593SmuzhiyunKernel code (like the watchdog) can still use it.  If you need access
37*4882a593Smuzhiyunfrom userland, you need to select 'Device interface for IPMI' if you
38*4882a593Smuzhiyunwant access through a device driver.
39*4882a593Smuzhiyun
40*4882a593SmuzhiyunThe driver interface depends on your hardware.  If your system
41*4882a593Smuzhiyunproperly provides the SMBIOS info for IPMI, the driver will detect it
42*4882a593Smuzhiyunand just work.  If you have a board with a standard interface (These
43*4882a593Smuzhiyunwill generally be either "KCS", "SMIC", or "BT", consult your hardware
44*4882a593Smuzhiyunmanual), choose the 'IPMI SI handler' option.  A driver also exists
45*4882a593Smuzhiyunfor direct I2C access to the IPMI management controller.  Some boards
46*4882a593Smuzhiyunsupport this, but it is unknown if it will work on every board.  For
47*4882a593Smuzhiyunthis, choose 'IPMI SMBus handler', but be ready to try to do some
48*4882a593Smuzhiyunfiguring to see if it will work on your system if the SMBIOS/APCI
49*4882a593Smuzhiyuninformation is wrong or not present.  It is fairly safe to have both
50*4882a593Smuzhiyunthese enabled and let the drivers auto-detect what is present.
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunYou should generally enable ACPI on your system, as systems with IPMI
53*4882a593Smuzhiyuncan have ACPI tables describing them.
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunIf you have a standard interface and the board manufacturer has done
56*4882a593Smuzhiyuntheir job correctly, the IPMI controller should be automatically
57*4882a593Smuzhiyundetected (via ACPI or SMBIOS tables) and should just work.  Sadly,
58*4882a593Smuzhiyunmany boards do not have this information.  The driver attempts
59*4882a593Smuzhiyunstandard defaults, but they may not work.  If you fall into this
60*4882a593Smuzhiyunsituation, you need to read the section below named 'The SI Driver' or
61*4882a593Smuzhiyun"The SMBus Driver" on how to hand-configure your system.
62*4882a593Smuzhiyun
63*4882a593SmuzhiyunIPMI defines a standard watchdog timer.  You can enable this with the
64*4882a593Smuzhiyun'IPMI Watchdog Timer' config option.  If you compile the driver into
65*4882a593Smuzhiyunthe kernel, then via a kernel command-line option you can have the
66*4882a593Smuzhiyunwatchdog timer start as soon as it initializes.  It also have a lot
67*4882a593Smuzhiyunof other options, see the 'Watchdog' section below for more details.
68*4882a593SmuzhiyunNote that you can also have the watchdog continue to run if it is
69*4882a593Smuzhiyunclosed (by default it is disabled on close).  Go into the 'Watchdog
70*4882a593SmuzhiyunCards' menu, enable 'Watchdog Timer Support', and enable the option
71*4882a593Smuzhiyun'Disable watchdog shutdown on close'.
72*4882a593Smuzhiyun
73*4882a593SmuzhiyunIPMI systems can often be powered off using IPMI commands.  Select
74*4882a593Smuzhiyun'IPMI Poweroff' to do this.  The driver will auto-detect if the system
75*4882a593Smuzhiyuncan be powered off by IPMI.  It is safe to enable this even if your
76*4882a593Smuzhiyunsystem doesn't support this option.  This works on ATCA systems, the
77*4882a593SmuzhiyunRadisys CPI1 card, and any IPMI system that supports standard chassis
78*4882a593Smuzhiyunmanagement commands.
79*4882a593Smuzhiyun
80*4882a593SmuzhiyunIf you want the driver to put an event into the event log on a panic,
81*4882a593Smuzhiyunenable the 'Generate a panic event to all BMCs on a panic' option.  If
82*4882a593Smuzhiyunyou want the whole panic string put into the event log using OEM
83*4882a593Smuzhiyunevents, enable the 'Generate OEM events containing the panic string'
84*4882a593Smuzhiyunoption.  You can also enable these dynamically by setting the module
85*4882a593Smuzhiyunparameter named "panic_op" in the ipmi_msghandler module to "event"
86*4882a593Smuzhiyunor "string".  Setting that parameter to "none" disables this function.
87*4882a593Smuzhiyun
88*4882a593SmuzhiyunBasic Design
89*4882a593Smuzhiyun------------
90*4882a593Smuzhiyun
91*4882a593SmuzhiyunThe Linux IPMI driver is designed to be very modular and flexible, you
92*4882a593Smuzhiyunonly need to take the pieces you need and you can use it in many
93*4882a593Smuzhiyundifferent ways.  Because of that, it's broken into many chunks of
94*4882a593Smuzhiyuncode.  These chunks (by module name) are:
95*4882a593Smuzhiyun
96*4882a593Smuzhiyunipmi_msghandler - This is the central piece of software for the IPMI
97*4882a593Smuzhiyunsystem.  It handles all messages, message timing, and responses.  The
98*4882a593SmuzhiyunIPMI users tie into this, and the IPMI physical interfaces (called
99*4882a593SmuzhiyunSystem Management Interfaces, or SMIs) also tie in here.  This
100*4882a593Smuzhiyunprovides the kernelland interface for IPMI, but does not provide an
101*4882a593Smuzhiyuninterface for use by application processes.
102*4882a593Smuzhiyun
103*4882a593Smuzhiyunipmi_devintf - This provides a userland IOCTL interface for the IPMI
104*4882a593Smuzhiyundriver, each open file for this device ties in to the message handler
105*4882a593Smuzhiyunas an IPMI user.
106*4882a593Smuzhiyun
107*4882a593Smuzhiyunipmi_si - A driver for various system interfaces.  This supports KCS,
108*4882a593SmuzhiyunSMIC, and BT interfaces.  Unless you have an SMBus interface or your
109*4882a593Smuzhiyunown custom interface, you probably need to use this.
110*4882a593Smuzhiyun
111*4882a593Smuzhiyunipmi_ssif - A driver for accessing BMCs on the SMBus. It uses the
112*4882a593SmuzhiyunI2C kernel driver's SMBus interfaces to send and receive IPMI messages
113*4882a593Smuzhiyunover the SMBus.
114*4882a593Smuzhiyun
115*4882a593Smuzhiyunipmi_powernv - A driver for access BMCs on POWERNV systems.
116*4882a593Smuzhiyun
117*4882a593Smuzhiyunipmi_watchdog - IPMI requires systems to have a very capable watchdog
118*4882a593Smuzhiyuntimer.  This driver implements the standard Linux watchdog timer
119*4882a593Smuzhiyuninterface on top of the IPMI message handler.
120*4882a593Smuzhiyun
121*4882a593Smuzhiyunipmi_poweroff - Some systems support the ability to be turned off via
122*4882a593SmuzhiyunIPMI commands.
123*4882a593Smuzhiyun
124*4882a593Smuzhiyunbt-bmc - This is not part of the main driver, but instead a driver for
125*4882a593Smuzhiyunaccessing a BMC-side interface of a BT interface.  It is used on BMCs
126*4882a593Smuzhiyunrunning Linux to provide an interface to the host.
127*4882a593Smuzhiyun
128*4882a593SmuzhiyunThese are all individually selectable via configuration options.
129*4882a593Smuzhiyun
130*4882a593SmuzhiyunMuch documentation for the interface is in the include files.  The
131*4882a593SmuzhiyunIPMI include files are:
132*4882a593Smuzhiyun
133*4882a593Smuzhiyunlinux/ipmi.h - Contains the user interface and IOCTL interface for IPMI.
134*4882a593Smuzhiyun
135*4882a593Smuzhiyunlinux/ipmi_smi.h - Contains the interface for system management interfaces
136*4882a593Smuzhiyun(things that interface to IPMI controllers) to use.
137*4882a593Smuzhiyun
138*4882a593Smuzhiyunlinux/ipmi_msgdefs.h - General definitions for base IPMI messaging.
139*4882a593Smuzhiyun
140*4882a593Smuzhiyun
141*4882a593SmuzhiyunAddressing
142*4882a593Smuzhiyun----------
143*4882a593Smuzhiyun
144*4882a593SmuzhiyunThe IPMI addressing works much like IP addresses, you have an overlay
145*4882a593Smuzhiyunto handle the different address types.  The overlay is::
146*4882a593Smuzhiyun
147*4882a593Smuzhiyun  struct ipmi_addr
148*4882a593Smuzhiyun  {
149*4882a593Smuzhiyun	int   addr_type;
150*4882a593Smuzhiyun	short channel;
151*4882a593Smuzhiyun	char  data[IPMI_MAX_ADDR_SIZE];
152*4882a593Smuzhiyun  };
153*4882a593Smuzhiyun
154*4882a593SmuzhiyunThe addr_type determines what the address really is.  The driver
155*4882a593Smuzhiyuncurrently understands two different types of addresses.
156*4882a593Smuzhiyun
157*4882a593Smuzhiyun"System Interface" addresses are defined as::
158*4882a593Smuzhiyun
159*4882a593Smuzhiyun  struct ipmi_system_interface_addr
160*4882a593Smuzhiyun  {
161*4882a593Smuzhiyun	int   addr_type;
162*4882a593Smuzhiyun	short channel;
163*4882a593Smuzhiyun  };
164*4882a593Smuzhiyun
165*4882a593Smuzhiyunand the type is IPMI_SYSTEM_INTERFACE_ADDR_TYPE.  This is used for talking
166*4882a593Smuzhiyunstraight to the BMC on the current card.  The channel must be
167*4882a593SmuzhiyunIPMI_BMC_CHANNEL.
168*4882a593Smuzhiyun
169*4882a593SmuzhiyunMessages that are destined to go out on the IPMB bus use the
170*4882a593SmuzhiyunIPMI_IPMB_ADDR_TYPE address type.  The format is::
171*4882a593Smuzhiyun
172*4882a593Smuzhiyun  struct ipmi_ipmb_addr
173*4882a593Smuzhiyun  {
174*4882a593Smuzhiyun	int           addr_type;
175*4882a593Smuzhiyun	short         channel;
176*4882a593Smuzhiyun	unsigned char slave_addr;
177*4882a593Smuzhiyun	unsigned char lun;
178*4882a593Smuzhiyun  };
179*4882a593Smuzhiyun
180*4882a593SmuzhiyunThe "channel" here is generally zero, but some devices support more
181*4882a593Smuzhiyunthan one channel, it corresponds to the channel as defined in the IPMI
182*4882a593Smuzhiyunspec.
183*4882a593Smuzhiyun
184*4882a593Smuzhiyun
185*4882a593SmuzhiyunMessages
186*4882a593Smuzhiyun--------
187*4882a593Smuzhiyun
188*4882a593SmuzhiyunMessages are defined as::
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun  struct ipmi_msg
191*4882a593Smuzhiyun  {
192*4882a593Smuzhiyun	unsigned char netfn;
193*4882a593Smuzhiyun	unsigned char lun;
194*4882a593Smuzhiyun	unsigned char cmd;
195*4882a593Smuzhiyun	unsigned char *data;
196*4882a593Smuzhiyun	int           data_len;
197*4882a593Smuzhiyun  };
198*4882a593Smuzhiyun
199*4882a593SmuzhiyunThe driver takes care of adding/stripping the header information.  The
200*4882a593Smuzhiyundata portion is just the data to be send (do NOT put addressing info
201*4882a593Smuzhiyunhere) or the response.  Note that the completion code of a response is
202*4882a593Smuzhiyunthe first item in "data", it is not stripped out because that is how
203*4882a593Smuzhiyunall the messages are defined in the spec (and thus makes counting the
204*4882a593Smuzhiyunoffsets a little easier :-).
205*4882a593Smuzhiyun
206*4882a593SmuzhiyunWhen using the IOCTL interface from userland, you must provide a block
207*4882a593Smuzhiyunof data for "data", fill it, and set data_len to the length of the
208*4882a593Smuzhiyunblock of data, even when receiving messages.  Otherwise the driver
209*4882a593Smuzhiyunwill have no place to put the message.
210*4882a593Smuzhiyun
211*4882a593SmuzhiyunMessages coming up from the message handler in kernelland will come in
212*4882a593Smuzhiyunas::
213*4882a593Smuzhiyun
214*4882a593Smuzhiyun  struct ipmi_recv_msg
215*4882a593Smuzhiyun  {
216*4882a593Smuzhiyun	struct list_head link;
217*4882a593Smuzhiyun
218*4882a593Smuzhiyun	/* The type of message as defined in the "Receive Types"
219*4882a593Smuzhiyun           defines above. */
220*4882a593Smuzhiyun	int         recv_type;
221*4882a593Smuzhiyun
222*4882a593Smuzhiyun	ipmi_user_t      *user;
223*4882a593Smuzhiyun	struct ipmi_addr addr;
224*4882a593Smuzhiyun	long             msgid;
225*4882a593Smuzhiyun	struct ipmi_msg  msg;
226*4882a593Smuzhiyun
227*4882a593Smuzhiyun	/* Call this when done with the message.  It will presumably free
228*4882a593Smuzhiyun	   the message and do any other necessary cleanup. */
229*4882a593Smuzhiyun	void (*done)(struct ipmi_recv_msg *msg);
230*4882a593Smuzhiyun
231*4882a593Smuzhiyun	/* Place-holder for the data, don't make any assumptions about
232*4882a593Smuzhiyun	   the size or existence of this, since it may change. */
233*4882a593Smuzhiyun	unsigned char   msg_data[IPMI_MAX_MSG_LENGTH];
234*4882a593Smuzhiyun  };
235*4882a593Smuzhiyun
236*4882a593SmuzhiyunYou should look at the receive type and handle the message
237*4882a593Smuzhiyunappropriately.
238*4882a593Smuzhiyun
239*4882a593Smuzhiyun
240*4882a593SmuzhiyunThe Upper Layer Interface (Message Handler)
241*4882a593Smuzhiyun-------------------------------------------
242*4882a593Smuzhiyun
243*4882a593SmuzhiyunThe upper layer of the interface provides the users with a consistent
244*4882a593Smuzhiyunview of the IPMI interfaces.  It allows multiple SMI interfaces to be
245*4882a593Smuzhiyunaddressed (because some boards actually have multiple BMCs on them)
246*4882a593Smuzhiyunand the user should not have to care what type of SMI is below them.
247*4882a593Smuzhiyun
248*4882a593Smuzhiyun
249*4882a593SmuzhiyunWatching For Interfaces
250*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^
251*4882a593Smuzhiyun
252*4882a593SmuzhiyunWhen your code comes up, the IPMI driver may or may not have detected
253*4882a593Smuzhiyunif IPMI devices exist.  So you might have to defer your setup until
254*4882a593Smuzhiyunthe device is detected, or you might be able to do it immediately.
255*4882a593SmuzhiyunTo handle this, and to allow for discovery, you register an SMI
256*4882a593Smuzhiyunwatcher with ipmi_smi_watcher_register() to iterate over interfaces
257*4882a593Smuzhiyunand tell you when they come and go.
258*4882a593Smuzhiyun
259*4882a593Smuzhiyun
260*4882a593SmuzhiyunCreating the User
261*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^
262*4882a593Smuzhiyun
263*4882a593SmuzhiyunTo use the message handler, you must first create a user using
264*4882a593Smuzhiyunipmi_create_user.  The interface number specifies which SMI you want
265*4882a593Smuzhiyunto connect to, and you must supply callback functions to be called
266*4882a593Smuzhiyunwhen data comes in.  The callback function can run at interrupt level,
267*4882a593Smuzhiyunso be careful using the callbacks.  This also allows to you pass in a
268*4882a593Smuzhiyunpiece of data, the handler_data, that will be passed back to you on
269*4882a593Smuzhiyunall calls.
270*4882a593Smuzhiyun
271*4882a593SmuzhiyunOnce you are done, call ipmi_destroy_user() to get rid of the user.
272*4882a593Smuzhiyun
273*4882a593SmuzhiyunFrom userland, opening the device automatically creates a user, and
274*4882a593Smuzhiyunclosing the device automatically destroys the user.
275*4882a593Smuzhiyun
276*4882a593Smuzhiyun
277*4882a593SmuzhiyunMessaging
278*4882a593Smuzhiyun^^^^^^^^^
279*4882a593Smuzhiyun
280*4882a593SmuzhiyunTo send a message from kernel-land, the ipmi_request_settime() call does
281*4882a593Smuzhiyunpretty much all message handling.  Most of the parameter are
282*4882a593Smuzhiyunself-explanatory.  However, it takes a "msgid" parameter.  This is NOT
283*4882a593Smuzhiyunthe sequence number of messages.  It is simply a long value that is
284*4882a593Smuzhiyunpassed back when the response for the message is returned.  You may
285*4882a593Smuzhiyunuse it for anything you like.
286*4882a593Smuzhiyun
287*4882a593SmuzhiyunResponses come back in the function pointed to by the ipmi_recv_hndl
288*4882a593Smuzhiyunfield of the "handler" that you passed in to ipmi_create_user().
289*4882a593SmuzhiyunRemember again, these may be running at interrupt level.  Remember to
290*4882a593Smuzhiyunlook at the receive type, too.
291*4882a593Smuzhiyun
292*4882a593SmuzhiyunFrom userland, you fill out an ipmi_req_t structure and use the
293*4882a593SmuzhiyunIPMICTL_SEND_COMMAND ioctl.  For incoming stuff, you can use select()
294*4882a593Smuzhiyunor poll() to wait for messages to come in.  However, you cannot use
295*4882a593Smuzhiyunread() to get them, you must call the IPMICTL_RECEIVE_MSG with the
296*4882a593Smuzhiyunipmi_recv_t structure to actually get the message.  Remember that you
297*4882a593Smuzhiyunmust supply a pointer to a block of data in the msg.data field, and
298*4882a593Smuzhiyunyou must fill in the msg.data_len field with the size of the data.
299*4882a593SmuzhiyunThis gives the receiver a place to actually put the message.
300*4882a593Smuzhiyun
301*4882a593SmuzhiyunIf the message cannot fit into the data you provide, you will get an
302*4882a593SmuzhiyunEMSGSIZE error and the driver will leave the data in the receive
303*4882a593Smuzhiyunqueue.  If you want to get it and have it truncate the message, us
304*4882a593Smuzhiyunthe IPMICTL_RECEIVE_MSG_TRUNC ioctl.
305*4882a593Smuzhiyun
306*4882a593SmuzhiyunWhen you send a command (which is defined by the lowest-order bit of
307*4882a593Smuzhiyunthe netfn per the IPMI spec) on the IPMB bus, the driver will
308*4882a593Smuzhiyunautomatically assign the sequence number to the command and save the
309*4882a593Smuzhiyuncommand.  If the response is not receive in the IPMI-specified 5
310*4882a593Smuzhiyunseconds, it will generate a response automatically saying the command
311*4882a593Smuzhiyuntimed out.  If an unsolicited response comes in (if it was after 5
312*4882a593Smuzhiyunseconds, for instance), that response will be ignored.
313*4882a593Smuzhiyun
314*4882a593SmuzhiyunIn kernelland, after you receive a message and are done with it, you
315*4882a593SmuzhiyunMUST call ipmi_free_recv_msg() on it, or you will leak messages.  Note
316*4882a593Smuzhiyunthat you should NEVER mess with the "done" field of a message, that is
317*4882a593Smuzhiyunrequired to properly clean up the message.
318*4882a593Smuzhiyun
319*4882a593SmuzhiyunNote that when sending, there is an ipmi_request_supply_msgs() call
320*4882a593Smuzhiyunthat lets you supply the smi and receive message.  This is useful for
321*4882a593Smuzhiyunpieces of code that need to work even if the system is out of buffers
322*4882a593Smuzhiyun(the watchdog timer uses this, for instance).  You supply your own
323*4882a593Smuzhiyunbuffer and own free routines.  This is not recommended for normal use,
324*4882a593Smuzhiyunthough, since it is tricky to manage your own buffers.
325*4882a593Smuzhiyun
326*4882a593Smuzhiyun
327*4882a593SmuzhiyunEvents and Incoming Commands
328*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^
329*4882a593Smuzhiyun
330*4882a593SmuzhiyunThe driver takes care of polling for IPMI events and receiving
331*4882a593Smuzhiyuncommands (commands are messages that are not responses, they are
332*4882a593Smuzhiyuncommands that other things on the IPMB bus have sent you).  To receive
333*4882a593Smuzhiyunthese, you must register for them, they will not automatically be sent
334*4882a593Smuzhiyunto you.
335*4882a593Smuzhiyun
336*4882a593SmuzhiyunTo receive events, you must call ipmi_set_gets_events() and set the
337*4882a593Smuzhiyun"val" to non-zero.  Any events that have been received by the driver
338*4882a593Smuzhiyunsince startup will immediately be delivered to the first user that
339*4882a593Smuzhiyunregisters for events.  After that, if multiple users are registered
340*4882a593Smuzhiyunfor events, they will all receive all events that come in.
341*4882a593Smuzhiyun
342*4882a593SmuzhiyunFor receiving commands, you have to individually register commands you
343*4882a593Smuzhiyunwant to receive.  Call ipmi_register_for_cmd() and supply the netfn
344*4882a593Smuzhiyunand command name for each command you want to receive.  You also
345*4882a593Smuzhiyunspecify a bitmask of the channels you want to receive the command from
346*4882a593Smuzhiyun(or use IPMI_CHAN_ALL for all channels if you don't care).  Only one
347*4882a593Smuzhiyunuser may be registered for each netfn/cmd/channel, but different users
348*4882a593Smuzhiyunmay register for different commands, or the same command if the
349*4882a593Smuzhiyunchannel bitmasks do not overlap.
350*4882a593Smuzhiyun
351*4882a593SmuzhiyunFrom userland, equivalent IOCTLs are provided to do these functions.
352*4882a593Smuzhiyun
353*4882a593Smuzhiyun
354*4882a593SmuzhiyunThe Lower Layer (SMI) Interface
355*4882a593Smuzhiyun-------------------------------
356*4882a593Smuzhiyun
357*4882a593SmuzhiyunAs mentioned before, multiple SMI interfaces may be registered to the
358*4882a593Smuzhiyunmessage handler, each of these is assigned an interface number when
359*4882a593Smuzhiyunthey register with the message handler.  They are generally assigned
360*4882a593Smuzhiyunin the order they register, although if an SMI unregisters and then
361*4882a593Smuzhiyunanother one registers, all bets are off.
362*4882a593Smuzhiyun
363*4882a593SmuzhiyunThe ipmi_smi.h defines the interface for management interfaces, see
364*4882a593Smuzhiyunthat for more details.
365*4882a593Smuzhiyun
366*4882a593Smuzhiyun
367*4882a593SmuzhiyunThe SI Driver
368*4882a593Smuzhiyun-------------
369*4882a593Smuzhiyun
370*4882a593SmuzhiyunThe SI driver allows KCS, BT, and SMIC interfaces to be configured
371*4882a593Smuzhiyunin the system.  It discovers interfaces through a host of different
372*4882a593Smuzhiyunmethods, depending on the system.
373*4882a593Smuzhiyun
374*4882a593SmuzhiyunYou can specify up to four interfaces on the module load line and
375*4882a593Smuzhiyuncontrol some module parameters::
376*4882a593Smuzhiyun
377*4882a593Smuzhiyun  modprobe ipmi_si.o type=<type1>,<type2>....
378*4882a593Smuzhiyun       ports=<port1>,<port2>... addrs=<addr1>,<addr2>...
379*4882a593Smuzhiyun       irqs=<irq1>,<irq2>...
380*4882a593Smuzhiyun       regspacings=<sp1>,<sp2>,... regsizes=<size1>,<size2>,...
381*4882a593Smuzhiyun       regshifts=<shift1>,<shift2>,...
382*4882a593Smuzhiyun       slave_addrs=<addr1>,<addr2>,...
383*4882a593Smuzhiyun       force_kipmid=<enable1>,<enable2>,...
384*4882a593Smuzhiyun       kipmid_max_busy_us=<ustime1>,<ustime2>,...
385*4882a593Smuzhiyun       unload_when_empty=[0|1]
386*4882a593Smuzhiyun       trydmi=[0|1] tryacpi=[0|1]
387*4882a593Smuzhiyun       tryplatform=[0|1] trypci=[0|1]
388*4882a593Smuzhiyun
389*4882a593SmuzhiyunEach of these except try... items is a list, the first item for the
390*4882a593Smuzhiyunfirst interface, second item for the second interface, etc.
391*4882a593Smuzhiyun
392*4882a593SmuzhiyunThe si_type may be either "kcs", "smic", or "bt".  If you leave it blank, it
393*4882a593Smuzhiyundefaults to "kcs".
394*4882a593Smuzhiyun
395*4882a593SmuzhiyunIf you specify addrs as non-zero for an interface, the driver will
396*4882a593Smuzhiyunuse the memory address given as the address of the device.  This
397*4882a593Smuzhiyunoverrides si_ports.
398*4882a593Smuzhiyun
399*4882a593SmuzhiyunIf you specify ports as non-zero for an interface, the driver will
400*4882a593Smuzhiyunuse the I/O port given as the device address.
401*4882a593Smuzhiyun
402*4882a593SmuzhiyunIf you specify irqs as non-zero for an interface, the driver will
403*4882a593Smuzhiyunattempt to use the given interrupt for the device.
404*4882a593Smuzhiyun
405*4882a593SmuzhiyunThe other try... items disable discovery by their corresponding
406*4882a593Smuzhiyunnames.  These are all enabled by default, set them to zero to disable
407*4882a593Smuzhiyunthem.  The tryplatform disables openfirmware.
408*4882a593Smuzhiyun
409*4882a593SmuzhiyunThe next three parameters have to do with register layout.  The
410*4882a593Smuzhiyunregisters used by the interfaces may not appear at successive
411*4882a593Smuzhiyunlocations and they may not be in 8-bit registers.  These parameters
412*4882a593Smuzhiyunallow the layout of the data in the registers to be more precisely
413*4882a593Smuzhiyunspecified.
414*4882a593Smuzhiyun
415*4882a593SmuzhiyunThe regspacings parameter give the number of bytes between successive
416*4882a593Smuzhiyunregister start addresses.  For instance, if the regspacing is set to 4
417*4882a593Smuzhiyunand the start address is 0xca2, then the address for the second
418*4882a593Smuzhiyunregister would be 0xca6.  This defaults to 1.
419*4882a593Smuzhiyun
420*4882a593SmuzhiyunThe regsizes parameter gives the size of a register, in bytes.  The
421*4882a593Smuzhiyundata used by IPMI is 8-bits wide, but it may be inside a larger
422*4882a593Smuzhiyunregister.  This parameter allows the read and write type to specified.
423*4882a593SmuzhiyunIt may be 1, 2, 4, or 8.  The default is 1.
424*4882a593Smuzhiyun
425*4882a593SmuzhiyunSince the register size may be larger than 32 bits, the IPMI data may not
426*4882a593Smuzhiyunbe in the lower 8 bits.  The regshifts parameter give the amount to shift
427*4882a593Smuzhiyunthe data to get to the actual IPMI data.
428*4882a593Smuzhiyun
429*4882a593SmuzhiyunThe slave_addrs specifies the IPMI address of the local BMC.  This is
430*4882a593Smuzhiyunusually 0x20 and the driver defaults to that, but in case it's not, it
431*4882a593Smuzhiyuncan be specified when the driver starts up.
432*4882a593Smuzhiyun
433*4882a593SmuzhiyunThe force_ipmid parameter forcefully enables (if set to 1) or disables
434*4882a593Smuzhiyun(if set to 0) the kernel IPMI daemon.  Normally this is auto-detected
435*4882a593Smuzhiyunby the driver, but systems with broken interrupts might need an enable,
436*4882a593Smuzhiyunor users that don't want the daemon (don't need the performance, don't
437*4882a593Smuzhiyunwant the CPU hit) can disable it.
438*4882a593Smuzhiyun
439*4882a593SmuzhiyunIf unload_when_empty is set to 1, the driver will be unloaded if it
440*4882a593Smuzhiyundoesn't find any interfaces or all the interfaces fail to work.  The
441*4882a593Smuzhiyundefault is one.  Setting to 0 is useful with the hotmod, but is
442*4882a593Smuzhiyunobviously only useful for modules.
443*4882a593Smuzhiyun
444*4882a593SmuzhiyunWhen compiled into the kernel, the parameters can be specified on the
445*4882a593Smuzhiyunkernel command line as::
446*4882a593Smuzhiyun
447*4882a593Smuzhiyun  ipmi_si.type=<type1>,<type2>...
448*4882a593Smuzhiyun       ipmi_si.ports=<port1>,<port2>... ipmi_si.addrs=<addr1>,<addr2>...
449*4882a593Smuzhiyun       ipmi_si.irqs=<irq1>,<irq2>...
450*4882a593Smuzhiyun       ipmi_si.regspacings=<sp1>,<sp2>,...
451*4882a593Smuzhiyun       ipmi_si.regsizes=<size1>,<size2>,...
452*4882a593Smuzhiyun       ipmi_si.regshifts=<shift1>,<shift2>,...
453*4882a593Smuzhiyun       ipmi_si.slave_addrs=<addr1>,<addr2>,...
454*4882a593Smuzhiyun       ipmi_si.force_kipmid=<enable1>,<enable2>,...
455*4882a593Smuzhiyun       ipmi_si.kipmid_max_busy_us=<ustime1>,<ustime2>,...
456*4882a593Smuzhiyun
457*4882a593SmuzhiyunIt works the same as the module parameters of the same names.
458*4882a593Smuzhiyun
459*4882a593SmuzhiyunIf your IPMI interface does not support interrupts and is a KCS or
460*4882a593SmuzhiyunSMIC interface, the IPMI driver will start a kernel thread for the
461*4882a593Smuzhiyuninterface to help speed things up.  This is a low-priority kernel
462*4882a593Smuzhiyunthread that constantly polls the IPMI driver while an IPMI operation
463*4882a593Smuzhiyunis in progress.  The force_kipmid module parameter will all the user to
464*4882a593Smuzhiyunforce this thread on or off.  If you force it off and don't have
465*4882a593Smuzhiyuninterrupts, the driver will run VERY slowly.  Don't blame me,
466*4882a593Smuzhiyunthese interfaces suck.
467*4882a593Smuzhiyun
468*4882a593SmuzhiyunUnfortunately, this thread can use a lot of CPU depending on the
469*4882a593Smuzhiyuninterface's performance.  This can waste a lot of CPU and cause
470*4882a593Smuzhiyunvarious issues with detecting idle CPU and using extra power.  To
471*4882a593Smuzhiyunavoid this, the kipmid_max_busy_us sets the maximum amount of time, in
472*4882a593Smuzhiyunmicroseconds, that kipmid will spin before sleeping for a tick.  This
473*4882a593Smuzhiyunvalue sets a balance between performance and CPU waste and needs to be
474*4882a593Smuzhiyuntuned to your needs.  Maybe, someday, auto-tuning will be added, but
475*4882a593Smuzhiyunthat's not a simple thing and even the auto-tuning would need to be
476*4882a593Smuzhiyuntuned to the user's desired performance.
477*4882a593Smuzhiyun
478*4882a593SmuzhiyunThe driver supports a hot add and remove of interfaces.  This way,
479*4882a593Smuzhiyuninterfaces can be added or removed after the kernel is up and running.
480*4882a593SmuzhiyunThis is done using /sys/modules/ipmi_si/parameters/hotmod, which is a
481*4882a593Smuzhiyunwrite-only parameter.  You write a string to this interface.  The string
482*4882a593Smuzhiyunhas the format::
483*4882a593Smuzhiyun
484*4882a593Smuzhiyun   <op1>[:op2[:op3...]]
485*4882a593Smuzhiyun
486*4882a593SmuzhiyunThe "op"s are::
487*4882a593Smuzhiyun
488*4882a593Smuzhiyun   add|remove,kcs|bt|smic,mem|i/o,<address>[,<opt1>[,<opt2>[,...]]]
489*4882a593Smuzhiyun
490*4882a593SmuzhiyunYou can specify more than one interface on the line.  The "opt"s are::
491*4882a593Smuzhiyun
492*4882a593Smuzhiyun   rsp=<regspacing>
493*4882a593Smuzhiyun   rsi=<regsize>
494*4882a593Smuzhiyun   rsh=<regshift>
495*4882a593Smuzhiyun   irq=<irq>
496*4882a593Smuzhiyun   ipmb=<ipmb slave addr>
497*4882a593Smuzhiyun
498*4882a593Smuzhiyunand these have the same meanings as discussed above.  Note that you
499*4882a593Smuzhiyuncan also use this on the kernel command line for a more compact format
500*4882a593Smuzhiyunfor specifying an interface.  Note that when removing an interface,
501*4882a593Smuzhiyunonly the first three parameters (si type, address type, and address)
502*4882a593Smuzhiyunare used for the comparison.  Any options are ignored for removing.
503*4882a593Smuzhiyun
504*4882a593SmuzhiyunThe SMBus Driver (SSIF)
505*4882a593Smuzhiyun-----------------------
506*4882a593Smuzhiyun
507*4882a593SmuzhiyunThe SMBus driver allows up to 4 SMBus devices to be configured in the
508*4882a593Smuzhiyunsystem.  By default, the driver will only register with something it
509*4882a593Smuzhiyunfinds in DMI or ACPI tables.  You can change this
510*4882a593Smuzhiyunat module load time (for a module) with::
511*4882a593Smuzhiyun
512*4882a593Smuzhiyun  modprobe ipmi_ssif.o
513*4882a593Smuzhiyun	addr=<i2caddr1>[,<i2caddr2>[,...]]
514*4882a593Smuzhiyun	adapter=<adapter1>[,<adapter2>[...]]
515*4882a593Smuzhiyun	dbg=<flags1>,<flags2>...
516*4882a593Smuzhiyun	slave_addrs=<addr1>,<addr2>,...
517*4882a593Smuzhiyun	tryacpi=[0|1] trydmi=[0|1]
518*4882a593Smuzhiyun	[dbg_probe=1]
519*4882a593Smuzhiyun	alerts_broken
520*4882a593Smuzhiyun
521*4882a593SmuzhiyunThe addresses are normal I2C addresses.  The adapter is the string
522*4882a593Smuzhiyunname of the adapter, as shown in /sys/class/i2c-adapter/i2c-<n>/name.
523*4882a593SmuzhiyunIt is *NOT* i2c-<n> itself.  Also, the comparison is done ignoring
524*4882a593Smuzhiyunspaces, so if the name is "This is an I2C chip" you can say
525*4882a593Smuzhiyunadapter_name=ThisisanI2cchip.  This is because it's hard to pass in
526*4882a593Smuzhiyunspaces in kernel parameters.
527*4882a593Smuzhiyun
528*4882a593SmuzhiyunThe debug flags are bit flags for each BMC found, they are:
529*4882a593SmuzhiyunIPMI messages: 1, driver state: 2, timing: 4, I2C probe: 8
530*4882a593Smuzhiyun
531*4882a593SmuzhiyunThe tryxxx parameters can be used to disable detecting interfaces
532*4882a593Smuzhiyunfrom various sources.
533*4882a593Smuzhiyun
534*4882a593SmuzhiyunSetting dbg_probe to 1 will enable debugging of the probing and
535*4882a593Smuzhiyundetection process for BMCs on the SMBusses.
536*4882a593Smuzhiyun
537*4882a593SmuzhiyunThe slave_addrs specifies the IPMI address of the local BMC.  This is
538*4882a593Smuzhiyunusually 0x20 and the driver defaults to that, but in case it's not, it
539*4882a593Smuzhiyuncan be specified when the driver starts up.
540*4882a593Smuzhiyun
541*4882a593Smuzhiyunalerts_broken does not enable SMBus alert for SSIF. Otherwise SMBus
542*4882a593Smuzhiyunalert will be enabled on supported hardware.
543*4882a593Smuzhiyun
544*4882a593SmuzhiyunDiscovering the IPMI compliant BMC on the SMBus can cause devices on
545*4882a593Smuzhiyunthe I2C bus to fail. The SMBus driver writes a "Get Device ID" IPMI
546*4882a593Smuzhiyunmessage as a block write to the I2C bus and waits for a response.
547*4882a593SmuzhiyunThis action can be detrimental to some I2C devices. It is highly
548*4882a593Smuzhiyunrecommended that the known I2C address be given to the SMBus driver in
549*4882a593Smuzhiyunthe smb_addr parameter unless you have DMI or ACPI data to tell the
550*4882a593Smuzhiyundriver what to use.
551*4882a593Smuzhiyun
552*4882a593SmuzhiyunWhen compiled into the kernel, the addresses can be specified on the
553*4882a593Smuzhiyunkernel command line as::
554*4882a593Smuzhiyun
555*4882a593Smuzhiyun  ipmb_ssif.addr=<i2caddr1>[,<i2caddr2>[...]]
556*4882a593Smuzhiyun	ipmi_ssif.adapter=<adapter1>[,<adapter2>[...]]
557*4882a593Smuzhiyun	ipmi_ssif.dbg=<flags1>[,<flags2>[...]]
558*4882a593Smuzhiyun	ipmi_ssif.dbg_probe=1
559*4882a593Smuzhiyun	ipmi_ssif.slave_addrs=<addr1>[,<addr2>[...]]
560*4882a593Smuzhiyun	ipmi_ssif.tryacpi=[0|1] ipmi_ssif.trydmi=[0|1]
561*4882a593Smuzhiyun
562*4882a593SmuzhiyunThese are the same options as on the module command line.
563*4882a593Smuzhiyun
564*4882a593SmuzhiyunThe I2C driver does not support non-blocking access or polling, so
565*4882a593Smuzhiyunthis driver cannod to IPMI panic events, extend the watchdog at panic
566*4882a593Smuzhiyuntime, or other panic-related IPMI functions without special kernel
567*4882a593Smuzhiyunpatches and driver modifications.  You can get those at the openipmi
568*4882a593Smuzhiyunweb page.
569*4882a593Smuzhiyun
570*4882a593SmuzhiyunThe driver supports a hot add and remove of interfaces through the I2C
571*4882a593Smuzhiyunsysfs interface.
572*4882a593Smuzhiyun
573*4882a593SmuzhiyunOther Pieces
574*4882a593Smuzhiyun------------
575*4882a593Smuzhiyun
576*4882a593SmuzhiyunGet the detailed info related with the IPMI device
577*4882a593Smuzhiyun--------------------------------------------------
578*4882a593Smuzhiyun
579*4882a593SmuzhiyunSome users need more detailed information about a device, like where
580*4882a593Smuzhiyunthe address came from or the raw base device for the IPMI interface.
581*4882a593SmuzhiyunYou can use the IPMI smi_watcher to catch the IPMI interfaces as they
582*4882a593Smuzhiyuncome or go, and to grab the information, you can use the function
583*4882a593Smuzhiyunipmi_get_smi_info(), which returns the following structure::
584*4882a593Smuzhiyun
585*4882a593Smuzhiyun  struct ipmi_smi_info {
586*4882a593Smuzhiyun	enum ipmi_addr_src addr_src;
587*4882a593Smuzhiyun	struct device *dev;
588*4882a593Smuzhiyun	union {
589*4882a593Smuzhiyun		struct {
590*4882a593Smuzhiyun			void *acpi_handle;
591*4882a593Smuzhiyun		} acpi_info;
592*4882a593Smuzhiyun	} addr_info;
593*4882a593Smuzhiyun  };
594*4882a593Smuzhiyun
595*4882a593SmuzhiyunCurrently special info for only for SI_ACPI address sources is
596*4882a593Smuzhiyunreturned.  Others may be added as necessary.
597*4882a593Smuzhiyun
598*4882a593SmuzhiyunNote that the dev pointer is included in the above structure, and
599*4882a593Smuzhiyunassuming ipmi_smi_get_info returns success, you must call put_device
600*4882a593Smuzhiyunon the dev pointer.
601*4882a593Smuzhiyun
602*4882a593Smuzhiyun
603*4882a593SmuzhiyunWatchdog
604*4882a593Smuzhiyun--------
605*4882a593Smuzhiyun
606*4882a593SmuzhiyunA watchdog timer is provided that implements the Linux-standard
607*4882a593Smuzhiyunwatchdog timer interface.  It has three module parameters that can be
608*4882a593Smuzhiyunused to control it::
609*4882a593Smuzhiyun
610*4882a593Smuzhiyun  modprobe ipmi_watchdog timeout=<t> pretimeout=<t> action=<action type>
611*4882a593Smuzhiyun      preaction=<preaction type> preop=<preop type> start_now=x
612*4882a593Smuzhiyun      nowayout=x ifnum_to_use=n panic_wdt_timeout=<t>
613*4882a593Smuzhiyun
614*4882a593Smuzhiyunifnum_to_use specifies which interface the watchdog timer should use.
615*4882a593SmuzhiyunThe default is -1, which means to pick the first one registered.
616*4882a593Smuzhiyun
617*4882a593SmuzhiyunThe timeout is the number of seconds to the action, and the pretimeout
618*4882a593Smuzhiyunis the amount of seconds before the reset that the pre-timeout panic will
619*4882a593Smuzhiyunoccur (if pretimeout is zero, then pretimeout will not be enabled).  Note
620*4882a593Smuzhiyunthat the pretimeout is the time before the final timeout.  So if the
621*4882a593Smuzhiyuntimeout is 50 seconds and the pretimeout is 10 seconds, then the pretimeout
622*4882a593Smuzhiyunwill occur in 40 second (10 seconds before the timeout). The panic_wdt_timeout
623*4882a593Smuzhiyunis the value of timeout which is set on kernel panic, in order to let actions
624*4882a593Smuzhiyunsuch as kdump to occur during panic.
625*4882a593Smuzhiyun
626*4882a593SmuzhiyunThe action may be "reset", "power_cycle", or "power_off", and
627*4882a593Smuzhiyunspecifies what to do when the timer times out, and defaults to
628*4882a593Smuzhiyun"reset".
629*4882a593Smuzhiyun
630*4882a593SmuzhiyunThe preaction may be "pre_smi" for an indication through the SMI
631*4882a593Smuzhiyuninterface, "pre_int" for an indication through the SMI with an
632*4882a593Smuzhiyuninterrupts, and "pre_nmi" for a NMI on a preaction.  This is how
633*4882a593Smuzhiyunthe driver is informed of the pretimeout.
634*4882a593Smuzhiyun
635*4882a593SmuzhiyunThe preop may be set to "preop_none" for no operation on a pretimeout,
636*4882a593Smuzhiyun"preop_panic" to set the preoperation to panic, or "preop_give_data"
637*4882a593Smuzhiyunto provide data to read from the watchdog device when the pretimeout
638*4882a593Smuzhiyunoccurs.  A "pre_nmi" setting CANNOT be used with "preop_give_data"
639*4882a593Smuzhiyunbecause you can't do data operations from an NMI.
640*4882a593Smuzhiyun
641*4882a593SmuzhiyunWhen preop is set to "preop_give_data", one byte comes ready to read
642*4882a593Smuzhiyunon the device when the pretimeout occurs.  Select and fasync work on
643*4882a593Smuzhiyunthe device, as well.
644*4882a593Smuzhiyun
645*4882a593SmuzhiyunIf start_now is set to 1, the watchdog timer will start running as
646*4882a593Smuzhiyunsoon as the driver is loaded.
647*4882a593Smuzhiyun
648*4882a593SmuzhiyunIf nowayout is set to 1, the watchdog timer will not stop when the
649*4882a593Smuzhiyunwatchdog device is closed.  The default value of nowayout is true
650*4882a593Smuzhiyunif the CONFIG_WATCHDOG_NOWAYOUT option is enabled, or false if not.
651*4882a593Smuzhiyun
652*4882a593SmuzhiyunWhen compiled into the kernel, the kernel command line is available
653*4882a593Smuzhiyunfor configuring the watchdog::
654*4882a593Smuzhiyun
655*4882a593Smuzhiyun  ipmi_watchdog.timeout=<t> ipmi_watchdog.pretimeout=<t>
656*4882a593Smuzhiyun	ipmi_watchdog.action=<action type>
657*4882a593Smuzhiyun	ipmi_watchdog.preaction=<preaction type>
658*4882a593Smuzhiyun	ipmi_watchdog.preop=<preop type>
659*4882a593Smuzhiyun	ipmi_watchdog.start_now=x
660*4882a593Smuzhiyun	ipmi_watchdog.nowayout=x
661*4882a593Smuzhiyun	ipmi_watchdog.panic_wdt_timeout=<t>
662*4882a593Smuzhiyun
663*4882a593SmuzhiyunThe options are the same as the module parameter options.
664*4882a593Smuzhiyun
665*4882a593SmuzhiyunThe watchdog will panic and start a 120 second reset timeout if it
666*4882a593Smuzhiyungets a pre-action.  During a panic or a reboot, the watchdog will
667*4882a593Smuzhiyunstart a 120 timer if it is running to make sure the reboot occurs.
668*4882a593Smuzhiyun
669*4882a593SmuzhiyunNote that if you use the NMI preaction for the watchdog, you MUST NOT
670*4882a593Smuzhiyunuse the nmi watchdog.  There is no reasonable way to tell if an NMI
671*4882a593Smuzhiyuncomes from the IPMI controller, so it must assume that if it gets an
672*4882a593Smuzhiyunotherwise unhandled NMI, it must be from IPMI and it will panic
673*4882a593Smuzhiyunimmediately.
674*4882a593Smuzhiyun
675*4882a593SmuzhiyunOnce you open the watchdog timer, you must write a 'V' character to the
676*4882a593Smuzhiyundevice to close it, or the timer will not stop.  This is a new semantic
677*4882a593Smuzhiyunfor the driver, but makes it consistent with the rest of the watchdog
678*4882a593Smuzhiyundrivers in Linux.
679*4882a593Smuzhiyun
680*4882a593Smuzhiyun
681*4882a593SmuzhiyunPanic Timeouts
682*4882a593Smuzhiyun--------------
683*4882a593Smuzhiyun
684*4882a593SmuzhiyunThe OpenIPMI driver supports the ability to put semi-custom and custom
685*4882a593Smuzhiyunevents in the system event log if a panic occurs.  if you enable the
686*4882a593Smuzhiyun'Generate a panic event to all BMCs on a panic' option, you will get
687*4882a593Smuzhiyunone event on a panic in a standard IPMI event format.  If you enable
688*4882a593Smuzhiyunthe 'Generate OEM events containing the panic string' option, you will
689*4882a593Smuzhiyunalso get a bunch of OEM events holding the panic string.
690*4882a593Smuzhiyun
691*4882a593Smuzhiyun
692*4882a593SmuzhiyunThe field settings of the events are:
693*4882a593Smuzhiyun
694*4882a593Smuzhiyun* Generator ID: 0x21 (kernel)
695*4882a593Smuzhiyun* EvM Rev: 0x03 (this event is formatting in IPMI 1.0 format)
696*4882a593Smuzhiyun* Sensor Type: 0x20 (OS critical stop sensor)
697*4882a593Smuzhiyun* Sensor #: The first byte of the panic string (0 if no panic string)
698*4882a593Smuzhiyun* Event Dir | Event Type: 0x6f (Assertion, sensor-specific event info)
699*4882a593Smuzhiyun* Event Data 1: 0xa1 (Runtime stop in OEM bytes 2 and 3)
700*4882a593Smuzhiyun* Event data 2: second byte of panic string
701*4882a593Smuzhiyun* Event data 3: third byte of panic string
702*4882a593Smuzhiyun
703*4882a593SmuzhiyunSee the IPMI spec for the details of the event layout.  This event is
704*4882a593Smuzhiyunalways sent to the local management controller.  It will handle routing
705*4882a593Smuzhiyunthe message to the right place
706*4882a593Smuzhiyun
707*4882a593SmuzhiyunOther OEM events have the following format:
708*4882a593Smuzhiyun
709*4882a593Smuzhiyun* Record ID (bytes 0-1): Set by the SEL.
710*4882a593Smuzhiyun* Record type (byte 2): 0xf0 (OEM non-timestamped)
711*4882a593Smuzhiyun* byte 3: The slave address of the card saving the panic
712*4882a593Smuzhiyun* byte 4: A sequence number (starting at zero)
713*4882a593Smuzhiyun  The rest of the bytes (11 bytes) are the panic string.  If the panic string
714*4882a593Smuzhiyun  is longer than 11 bytes, multiple messages will be sent with increasing
715*4882a593Smuzhiyun  sequence numbers.
716*4882a593Smuzhiyun
717*4882a593SmuzhiyunBecause you cannot send OEM events using the standard interface, this
718*4882a593Smuzhiyunfunction will attempt to find an SEL and add the events there.  It
719*4882a593Smuzhiyunwill first query the capabilities of the local management controller.
720*4882a593SmuzhiyunIf it has an SEL, then they will be stored in the SEL of the local
721*4882a593Smuzhiyunmanagement controller.  If not, and the local management controller is
722*4882a593Smuzhiyunan event generator, the event receiver from the local management
723*4882a593Smuzhiyuncontroller will be queried and the events sent to the SEL on that
724*4882a593Smuzhiyundevice.  Otherwise, the events go nowhere since there is nowhere to
725*4882a593Smuzhiyunsend them.
726*4882a593Smuzhiyun
727*4882a593Smuzhiyun
728*4882a593SmuzhiyunPoweroff
729*4882a593Smuzhiyun--------
730*4882a593Smuzhiyun
731*4882a593SmuzhiyunIf the poweroff capability is selected, the IPMI driver will install
732*4882a593Smuzhiyuna shutdown function into the standard poweroff function pointer.  This
733*4882a593Smuzhiyunis in the ipmi_poweroff module.  When the system requests a powerdown,
734*4882a593Smuzhiyunit will send the proper IPMI commands to do this.  This is supported on
735*4882a593Smuzhiyunseveral platforms.
736*4882a593Smuzhiyun
737*4882a593SmuzhiyunThere is a module parameter named "poweroff_powercycle" that may
738*4882a593Smuzhiyuneither be zero (do a power down) or non-zero (do a power cycle, power
739*4882a593Smuzhiyunthe system off, then power it on in a few seconds).  Setting
740*4882a593Smuzhiyunipmi_poweroff.poweroff_control=x will do the same thing on the kernel
741*4882a593Smuzhiyuncommand line.  The parameter is also available via the proc filesystem
742*4882a593Smuzhiyunin /proc/sys/dev/ipmi/poweroff_powercycle.  Note that if the system
743*4882a593Smuzhiyundoes not support power cycling, it will always do the power off.
744*4882a593Smuzhiyun
745*4882a593SmuzhiyunThe "ifnum_to_use" parameter specifies which interface the poweroff
746*4882a593Smuzhiyuncode should use.  The default is -1, which means to pick the first one
747*4882a593Smuzhiyunregistered.
748*4882a593Smuzhiyun
749*4882a593SmuzhiyunNote that if you have ACPI enabled, the system will prefer using ACPI to
750*4882a593Smuzhiyunpower off.
751