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