xref: /OK3568_Linux_fs/kernel/Documentation/driver-api/ipmb.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun==============================
2*4882a593SmuzhiyunIPMB Driver for a Satellite MC
3*4882a593Smuzhiyun==============================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunThe Intelligent Platform Management Bus or IPMB, is an
6*4882a593SmuzhiyunI2C bus that provides a standardized interconnection between
7*4882a593Smuzhiyundifferent boards within a chassis. This interconnection is
8*4882a593Smuzhiyunbetween the baseboard management (BMC) and chassis electronics.
9*4882a593SmuzhiyunIPMB is also associated with the messaging protocol through the
10*4882a593SmuzhiyunIPMB bus.
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunThe devices using the IPMB are usually management
13*4882a593Smuzhiyuncontrollers that perform management functions such as servicing
14*4882a593Smuzhiyunthe front panel interface, monitoring the baseboard,
15*4882a593Smuzhiyunhot-swapping disk drivers in the system chassis, etc...
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunWhen an IPMB is implemented in the system, the BMC serves as
18*4882a593Smuzhiyuna controller to give system software access to the IPMB. The BMC
19*4882a593Smuzhiyunsends IPMI requests to a device (usually a Satellite Management
20*4882a593SmuzhiyunController or Satellite MC) via IPMB and the device
21*4882a593Smuzhiyunsends a response back to the BMC.
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunFor more information on IPMB and the format of an IPMB message,
24*4882a593Smuzhiyunrefer to the IPMB and IPMI specifications.
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunIPMB driver for Satellite MC
27*4882a593Smuzhiyun----------------------------
28*4882a593Smuzhiyun
29*4882a593Smuzhiyunipmb-dev-int - This is the driver needed on a Satellite MC to
30*4882a593Smuzhiyunreceive IPMB messages from a BMC and send a response back.
31*4882a593SmuzhiyunThis driver works with the I2C driver and a userspace
32*4882a593Smuzhiyunprogram such as OpenIPMI:
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun1) It is an I2C slave backend driver. So, it defines a callback
35*4882a593Smuzhiyun   function to set the Satellite MC as an I2C slave.
36*4882a593Smuzhiyun   This callback function handles the received IPMI requests.
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun2) It defines the read and write functions to enable a user
39*4882a593Smuzhiyun   space program (such as OpenIPMI) to communicate with the kernel.
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunLoad the IPMB driver
43*4882a593Smuzhiyun--------------------
44*4882a593Smuzhiyun
45*4882a593SmuzhiyunThe driver needs to be loaded at boot time or manually first.
46*4882a593SmuzhiyunFirst, make sure you have the following in your config file:
47*4882a593SmuzhiyunCONFIG_IPMB_DEVICE_INTERFACE=y
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun1) If you want the driver to be loaded at boot time:
50*4882a593Smuzhiyun
51*4882a593Smuzhiyuna) Add this entry to your ACPI table, under the appropriate SMBus::
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun     Device (SMB0) // Example SMBus host controller
54*4882a593Smuzhiyun     {
55*4882a593Smuzhiyun     Name (_HID, "<Vendor-Specific HID>") // Vendor-Specific HID
56*4882a593Smuzhiyun     Name (_UID, 0) // Unique ID of particular host controller
57*4882a593Smuzhiyun     :
58*4882a593Smuzhiyun     :
59*4882a593Smuzhiyun       Device (IPMB)
60*4882a593Smuzhiyun       {
61*4882a593Smuzhiyun         Name (_HID, "IPMB0001") // IPMB device interface
62*4882a593Smuzhiyun         Name (_UID, 0) // Unique device identifier
63*4882a593Smuzhiyun       }
64*4882a593Smuzhiyun     }
65*4882a593Smuzhiyun
66*4882a593Smuzhiyunb) Example for device tree::
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun     &i2c2 {
69*4882a593Smuzhiyun            status = "okay";
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun            ipmb@10 {
72*4882a593Smuzhiyun                    compatible = "ipmb-dev";
73*4882a593Smuzhiyun                    reg = <0x10>;
74*4882a593Smuzhiyun                    i2c-protocol;
75*4882a593Smuzhiyun            };
76*4882a593Smuzhiyun     };
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunIf xmit of data to be done using raw i2c block vs smbus
79*4882a593Smuzhiyunthen "i2c-protocol" needs to be defined as above.
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun2) Manually from Linux::
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun     modprobe ipmb-dev-int
84*4882a593Smuzhiyun
85*4882a593Smuzhiyun
86*4882a593SmuzhiyunInstantiate the device
87*4882a593Smuzhiyun----------------------
88*4882a593Smuzhiyun
89*4882a593SmuzhiyunAfter loading the driver, you can instantiate the device as
90*4882a593Smuzhiyundescribed in 'Documentation/i2c/instantiating-devices.rst'.
91*4882a593SmuzhiyunIf you have multiple BMCs, each connected to your Satellite MC via
92*4882a593Smuzhiyuna different I2C bus, you can instantiate a device for each of
93*4882a593Smuzhiyunthose BMCs.
94*4882a593Smuzhiyun
95*4882a593SmuzhiyunThe name of the instantiated device contains the I2C bus number
96*4882a593Smuzhiyunassociated with it as follows::
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun  BMC1 ------ IPMB/I2C bus 1 ---------|   /dev/ipmb-1
99*4882a593Smuzhiyun				Satellite MC
100*4882a593Smuzhiyun  BMC1 ------ IPMB/I2C bus 2 ---------|   /dev/ipmb-2
101*4882a593Smuzhiyun
102*4882a593SmuzhiyunFor instance, you can instantiate the ipmb-dev-int device from
103*4882a593Smuzhiyunuser space at the 7 bit address 0x10 on bus 2::
104*4882a593Smuzhiyun
105*4882a593Smuzhiyun  # echo ipmb-dev 0x1010 > /sys/bus/i2c/devices/i2c-2/new_device
106*4882a593Smuzhiyun
107*4882a593SmuzhiyunThis will create the device file /dev/ipmb-2, which can be accessed
108*4882a593Smuzhiyunby the user space program. The device needs to be instantiated
109*4882a593Smuzhiyunbefore running the user space program.
110