Commit 316b7eaa authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'for-linus-5.16-1' of https://github.com/cminyard/linux-ipmi

Pull IPMI driver updates from Corey Minyard:
 "A new type of low-level IPMI driver is added for direct communication
  over the IPMI message bus without a BMC between the driver and the
  bus.

  Other than that, lots of little bug fixes and enhancements"

* tag 'for-linus-5.16-1' of https://github.com/cminyard/linux-ipmi:
  ipmi: kcs_bmc: Fix a memory leak in the error handling path of 'kcs_bmc_serio_add_device()'
  char: ipmi: replace snprintf in show functions with sysfs_emit
  ipmi: ipmb: fix dependencies to eliminate build error
  ipmi:ipmb: Add OF support
  ipmi: bt: Add ast2600 compatible string
  ipmi: bt-bmc: Use registers directly
  ipmi: ipmb: Fix off-by-one size check on rcvlen
  ipmi:ssif: Use depends on, not select, for I2C
  ipmi: Add docs for the IPMI IPMB driver
  ipmi: Add docs for IPMB direct addressing
  ipmi:ipmb: Add initial support for IPMI over IPMB
  ipmi: Add support for IPMB direct messages
  ipmi: Export ipmb_checksum()
  ipmi: Fix a typo
  ipmi: Check error code before processing BMC response
  ipmi:devintf: Return a proper error when recv buffer too small
  ipmi: Disable some operations during a panic
  ipmi:watchdog: Set panic count to proper value on a panic
parents 4dee0606 f281d010
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ Required properties:
- compatible : should be one of
	"aspeed,ast2400-ibt-bmc"
	"aspeed,ast2500-ibt-bmc"
	"aspeed,ast2600-ibt-bmc"
- reg: physical address and size of the registers

Optional properties:
+59 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/ipmi/ipmi-ipmb.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: IPMI IPMB device bindings

description: IPMI IPMB device bindings

maintainers:
  - Corey Minyard <cminyard@mvista.com>

properties:
  compatible:
    enum:
      - ipmi-ipmb

  device_type:
    items:
      - const: "ipmi"

  reg:
    maxItems: 1

  bmcaddr:
    $ref: /schemas/types.yaml#/definitions/uint8
    description: The address of the BMC on the IPMB bus.  Defaults to 0x20.

  retry-time:
    $ref: /schemas/types.yaml#/definitions/uint32
    description: |
      Time between retries of sends, in milliseconds.  Defaults to 250.

  max-retries:
    $ref: /schemas/types.yaml#/definitions/uint32
    description: Number of retries before a failure is declared.  Defaults to 1.

required:
  - compatible
  - reg

additionalProperties: false

examples:
  - |
    i2c {
            #address-cells = <1>;
            #size-cells = <0>;

            ipmi-ipmb@40 {
                    compatible = "ipmi-ipmb";
                    device_type = "ipmi";
                    reg = <0x40>;
                    bmcaddr = /bits/ 8 <0x20>;
                    retry-time = <250>;
                    max-retries = <1>;
            };
    };
+62 −2
Original line number Diff line number Diff line
@@ -166,8 +166,8 @@ and the type is IPMI_SYSTEM_INTERFACE_ADDR_TYPE. This is used for talking
straight to the BMC on the current card.  The channel must be
IPMI_BMC_CHANNEL.

Messages that are destined to go out on the IPMB bus use the
IPMI_IPMB_ADDR_TYPE address type.  The format is::
Messages that are destined to go out on the IPMB bus going through the
BMC use the IPMI_IPMB_ADDR_TYPE address type.  The format is::

  struct ipmi_ipmb_addr
  {
@@ -181,6 +181,23 @@ The "channel" here is generally zero, but some devices support more
than one channel, it corresponds to the channel as defined in the IPMI
spec.

There is also an IPMB direct address for a situation where the sender
is directly on an IPMB bus and doesn't have to go through the BMC.
You can send messages to a specific management controller (MC) on the
IPMB using the IPMI_IPMB_DIRECT_ADDR_TYPE with the following format::

  struct ipmi_ipmb_direct_addr
  {
	int           addr_type;
	short         channel;
	unsigned char slave_addr;
	unsigned char rq_lun;
	unsigned char rs_lun;
  };

The channel is always zero.  You can also receive commands from other
MCs that you have registered to handle and respond to them, so you can
use this to implement a management controller on a bus..

Messages
--------
@@ -348,6 +365,10 @@ user may be registered for each netfn/cmd/channel, but different users
may register for different commands, or the same command if the
channel bitmasks do not overlap.

To respond to a received command, set the response bit in the returned
netfn, use the address from the received message, and use the same
msgid that you got in the receive message.

From userland, equivalent IOCTLs are provided to do these functions.


@@ -570,6 +591,45 @@ web page.
The driver supports a hot add and remove of interfaces through the I2C
sysfs interface.

The IPMI IPMB Driver
--------------------

This driver is for supporting a system that sits on an IPMB bus; it
allows the interface to look like a normal IPMI interface.  Sending
system interface addressed messages to it will cause the message to go
to the registered BMC on the system (default at IPMI address 0x20).

It also allows you to directly address other MCs on the bus using the
ipmb direct addressing.  You can receive commands from other MCs on
the bus and they will be handled through the normal received command
mechanism described above.

Parameters are::

  ipmi_ipmb.bmcaddr=<address to use for system interface addresses messages>
	ipmi_ipmb.retry_time_ms=<Time between retries on IPMB>
	ipmi_ipmb.max_retries=<Number of times to retry a message>

Loading the module will not result in the driver automatcially
starting unless there is device tree information setting it up.  If
you want to instantiate one of these by hand, do::

  echo ipmi-ipmb <addr> > /sys/class/i2c-dev/i2c-<n>/device/new_device

Note that the address you give here is the I2C address, not the IPMI
address.  So if you want your MC address to be 0x60, you put 0x30
here.  See the I2C driver info for more details.

Command bridging to other IPMB busses through this interface does not
work.  The receive message queue is not implemented, by design.  There
is only one receive message queue on a BMC, and that is meant for the
host drivers, not something on the IPMB bus.

A BMC may have multiple IPMB busses, which bus your device sits on
depends on how the system is wired.  You can fetch the channels with
"ipmitool channel info <n>" where <n> is the channel, with the
channels being 0-7 and try the IPMB channels.

Other Pieces
------------

+10 −1
Original line number Diff line number Diff line
@@ -69,12 +69,21 @@ config IPMI_SI

config IPMI_SSIF
	tristate 'IPMI SMBus handler (SSIF)'
	select I2C
	depends on I2C
	help
	  Provides a driver for a SMBus interface to a BMC, meaning that you
	  have a driver that must be accessed over an I2C bus instead of a
	  standard interface.  This module requires I2C support.

config IPMI_IPMB
	tristate 'IPMI IPMB interface'
	depends on I2C && I2C_SLAVE
	help
	  Provides a driver for a system running right on the IPMB bus.
	  It supports normal system interface messages to a BMC on the IPMB
	  bus, and it also supports direct messaging on the bus using
	  IPMB direct messages.  This module requires I2C support.

config IPMI_POWERNV
	depends on PPC_POWERNV
	tristate 'POWERNV (OPAL firmware) IPMI interface'
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ obj-$(CONFIG_IPMI_SI) += ipmi_si.o
obj-$(CONFIG_IPMI_DMI_DECODE) += ipmi_dmi.o
obj-$(CONFIG_IPMI_PLAT_DATA) += ipmi_plat_data.o
obj-$(CONFIG_IPMI_SSIF) += ipmi_ssif.o
obj-$(CONFIG_IPMI_IPMB) += ipmi_ipmb.o
obj-$(CONFIG_IPMI_POWERNV) += ipmi_powernv.o
obj-$(CONFIG_IPMI_WATCHDOG) += ipmi_watchdog.o
obj-$(CONFIG_IPMI_POWEROFF) += ipmi_poweroff.o
Loading