From 72b646067cce8d614dcd56baa40c8a17fce56528 Mon Sep 17 00:00:00 2001 From: "Andrey V.Kosteltsev" Date: Mon, 27 Jun 2022 19:18:54 +0300 Subject: IPMI: ports from Intel-BMC meta-openbmc-mods --- .../ipmi/phosphor-ipmi-config.bbappend | 21 + .../ipmi/phosphor-ipmi-config/channel_access.json | 23 + .../ipmi/phosphor-ipmi-config/channel_config.json | 179 +++++++ .../ipmi/phosphor-ipmi-config/dev_id.json | 2 + .../master_write_read_white_list.json | 76 +++ .../phosphor-ipmi-fru-merge-config-native.bbappend | 8 + .../config.yaml | 31 ++ .../0001-Add-dbus-method-SlotIpmbRequest.patch | 536 +++++++++++++++++++++ ...02-Add-log-count-limitation-to-requestAdd.patch | 95 ++++ ...003-Fix-for-clearing-outstanding-requests.patch | 63 +++ .../ipmi/phosphor-ipmi-ipmb/ipmb-channels.json | 8 +- .../ipmi/phosphor-ipmi-ipmb_%.bbappend | 9 +- .../ipmi/phosphor-ipmi-kcs/99-ipmi-kcs.rules | 2 + .../ipmi/phosphor-ipmi-kcs_%.bbappend | 21 + ...bus-namespace-of-chassis-control-for-guid.patch | 43 ++ ...p12-Add-username-to-SessionInfo-interface.patch | 50 ++ .../ipmi/phosphor-ipmi-net/10-nice-rules.conf | 2 + .../ipmi/phosphor-ipmi-net_%.bbappend | 30 ++ 18 files changed, 1197 insertions(+), 2 deletions(-) create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_access.json create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/master_write_read_white_list.json create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-fru-merge-config-native.bbappend create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-fru-merge-config-native/config.yaml create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0002-Add-log-count-limitation-to-requestAdd.patch create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0003-Fix-for-clearing-outstanding-requests.patch create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs/99-ipmi-kcs.rules create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0001-Modify-dbus-namespace-of-chassis-control-for-guid.patch create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0002-rakp12-Add-username-to-SessionInfo-interface.patch create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/10-nice-rules.conf create mode 100644 meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend new file mode 100644 index 0000000000..73c3f21901 --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend @@ -0,0 +1,21 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" +SRC_URI += " file://dev_id.json \ + file://channel_access.json \ + file://channel_config.json \ + file://master_write_read_white_list.json \ + " + +FILES:${PN} += " \ + ${datadir}/ipmi-providers/channel_access.json \ + ${datadir}/ipmi-providers/channel_config.json \ + ${datadir}/ipmi-providers/master_write_read_white_list.json \ + " + +do_install:append() { + install -m 0644 -D ${WORKDIR}/channel_access.json \ + ${D}${datadir}/ipmi-providers/channel_access.json + install -m 0644 -D ${WORKDIR}/channel_config.json \ + ${D}${datadir}/ipmi-providers/channel_config.json + install -m 0644 -D ${WORKDIR}/master_write_read_white_list.json \ + ${D}${datadir}/ipmi-providers/master_write_read_white_list.json +} diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_access.json b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_access.json new file mode 100644 index 0000000000..2994831212 --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_access.json @@ -0,0 +1,23 @@ +{ + "1" : { + "access_mode" : "always_available", + "user_auth_disabled" : false, + "per_msg_auth_disabled" : false, + "alerting_disabled" : false, + "priv_limit" : "priv-admin" + }, + "2" : { + "access_mode" : "always_available", + "user_auth_disabled" : false, + "per_msg_auth_disabled" : false, + "alerting_disabled" : false, + "priv_limit" : "priv-admin" + }, + "3" : { + "access_mode" : "always_available", + "user_auth_disabled" : false, + "per_msg_auth_disabled" : false, + "alerting_disabled" : false, + "priv_limit" : "priv-admin" + } +} diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json new file mode 100644 index 0000000000..73fb214a2b --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json @@ -0,0 +1,179 @@ +{ + "0" : { + "name" : "Ipmb", + "is_valid" : true, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "ipmb", + "protocol_type" : "ipmb-1.0", + "session_supported" : "session-less", + "is_ipmi" : true + } + }, + "1" : { + "name" : "eth1", + "is_valid" : true, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "lan-802.3", + "protocol_type" : "ipmb-1.0", + "session_supported" : "multi-session", + "is_ipmi" : true + } + }, + "2" : { + "name" : "RESERVED", + "is_valid" : false, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "reserved", + "protocol_type" : "na", + "session_supported" : "session-less", + "is_ipmi" : true + } + }, + "3" : { + "name" : "eth0", + "is_valid" : true, + "active_sessions" : 0, + "is_management_nic" : true, + "channel_info" : { + "medium_type" : "lan-802.3", + "protocol_type" : "ipmb-1.0", + "session_supported" : "multi-session", + "is_ipmi" : true + } + }, + "4" : { + "name" : "RESERVED", + "is_valid" : false, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "reserved", + "protocol_type" : "na", + "session_supported" : "session-less", + "is_ipmi" : true + } + }, + "5" : { + "name" : "RESERVED", + "is_valid" : false, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "reserved", + "protocol_type" : "na", + "session_supported" : "session-less", + "is_ipmi" : true + } + }, + "6" : { + "name" : "SMLINK", + "is_valid" : true, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "ipmb", + "protocol_type" : "ipmb-1.0", + "session_supported" : "session-less", + "is_ipmi" : true + } + }, + "7" : { + "name" : "ipmi_kcs4", + "is_valid" : true, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "system-interface", + "protocol_type" : "kcs", + "session_supported" : "session-less", + "is_ipmi" : true + } + }, + "8" : { + "name" : "INTRABMC", + "is_valid" : true, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "oem", + "protocol_type" : "oem", + "session_supported" : "session-less", + "is_ipmi" : true + } + }, + "9" : { + "name" : "SIPMB", + "is_valid" : true, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "ipmb", + "protocol_type" : "ipmb-1.0", + "session_supported" : "session-less", + "is_ipmi" : true + } + }, + "10" : { + "name" : "PCIE", + "is_valid" : true, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "ipmb", + "protocol_type" : "ipmb-1.0", + "session_supported" : "session-less", + "is_ipmi" : true + } + }, + "11" : { + "name" : "RESERVED", + "is_valid" : false, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "reserved", + "protocol_type" : "na", + "session_supported" : "session-less", + "is_ipmi" : true + } + }, + "12" : { + "name" : "INTERNAL", + "is_valid" : false, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "ipmb", + "protocol_type" : "ipmb-1.0", + "session_supported" : "session-less", + "is_ipmi" : true + } + }, + "13" : { + "name" : "RESERVED", + "is_valid" : false, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "reserved", + "protocol_type" : "na", + "session_supported" : "session-less", + "is_ipmi" : true + } + }, + "14" : { + "name" : "SELF", + "is_valid" : false, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "unknown", + "protocol_type" : "na", + "session_supported" : "session-less", + "is_ipmi" : true + } + }, + "15" : { + "name" : "ipmi_kcs3", + "is_valid" : true, + "active_sessions" : 0, + "channel_info" : { + "medium_type" : "system-interface", + "protocol_type" : "kcs", + "session_supported" : "session-less", + "is_ipmi" : true + } + } +} diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json new file mode 100644 index 0000000000..e561569d9d --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json @@ -0,0 +1,2 @@ +{"id": 35, "revision": 0, "addn_dev_support": 191, + "manuf_id": 343, "prod_id": 123, "aux": 0} diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/master_write_read_white_list.json b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/master_write_read_white_list.json new file mode 100644 index 0000000000..6fc46f4520 --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/master_write_read_white_list.json @@ -0,0 +1,76 @@ +{ + "filters": [ + { + "Description": "Allow full read - ignore first byte write value", + "busId": "0x01", + "slaveAddr": "0x4d", + "slaveAddrMask": "0x00", + "command": "0x00", + "commandMask": "0xFF" + }, + { + "Description": "Allow full read - ignore first byte write value", + "busId": "0x01", + "slaveAddr": "0x57", + "slaveAddrMask": "0x00", + "command": "0x00", + "commandMask": "0xFF" + }, + { + "Description": "Allow full read - ignore first byte write value", + "busId": "0x02", + "slaveAddr": "0x40", + "slaveAddrMask": "0x00", + "command": "0x00", + "commandMask": "0xFF" + }, + { + "Description": "Allow full read - ignore first byte write value", + "busId": "0x02", + "slaveAddr": "0x49", + "slaveAddrMask": "0x00", + "command": "0x00", + "commandMask": "0xFF" + }, + { + "Description": "Allow full read - ignore first byte write value", + "busId": "0x02", + "slaveAddr": "0x51", + "slaveAddrMask": "0x00", + "command": "0x00", + "commandMask": "0xFF" + }, + { + "Description": "Allow full read - ignore first byte write value", + "busId": "0x03", + "slaveAddr": "0x44", + "slaveAddrMask": "0x00", + "command": "0x00", + "commandMask": "0xFF" + }, + { + "Description": "Allow full read - ignore first byte write value", + "busId": "0x03", + "slaveAddr": "0x68", + "slaveAddrMask": "0x00", + "command": "0x00", + "commandMask": "0xFF" + }, + { + "Description": "Allow full read - ignore first byte write value", + "busId": "0x06", + "slaveAddr": "0x40", + "slaveAddrMask": "0x00", + "command": "0x00", + "commandMask": "0xFF" + }, + { + "Description": "Allow full read - ignore first byte write value", + "busId": "0x07", + "slaveAddr": "0x51", + "slaveAddrMask": "0x00", + "command": "0x00", + "commandMask": "0xFF" + } + ] +} diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-fru-merge-config-native.bbappend b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-fru-merge-config-native.bbappend new file mode 100644 index 0000000000..3a2cf0e018 --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-fru-merge-config-native.bbappend @@ -0,0 +1,8 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" +SRC_URI += " file://config.yaml" + +#override source file before it is used for final FRU file (merged from multiple sources) +do_install() { + cp ${WORKDIR}/config.yaml ${config_datadir}/ +} + diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-fru-merge-config-native/config.yaml b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-fru-merge-config-native/config.yaml new file mode 100644 index 0000000000..eb4bf2a156 --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-fru-merge-config-native/config.yaml @@ -0,0 +1,31 @@ +# A YAML similar to this example would have to be generated, for eg with MRW +# inputs and system configuration, to depict IPMI Fru information. +# +# This file maps IPMI properties to phosphor dbus inventory properties +# +# This YAML could help generate C++ code. +# Format of the YAML: +# Fruid: +# Associated Fru paths +# d-bus Interfaces +# d-bus Properties +# IPMI Fru mapping +0: + /system/board/SILA_Baseboard: + entityID: 23 + entityInstance: 1 + interfaces: + xyz.openbmc_project.Inventory.Item: + name: + IPMIFruProperty: Product Name + IPMIFruSection: Product + xyz.openbmc_project.Inventory.Decorator.Asset: + Manufacturer: + IPMIFruProperty: Manufacturer + IPMIFruSection: Product + PartNumber: + IPMIFruProperty: Part Number + IPMIFruSection: Product + SerialNumber: + IPMIFruProperty: Serial Number + IPMIFruSection: Product diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch new file mode 100644 index 0000000000..8631316e9c --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch @@ -0,0 +1,536 @@ +From 3ebcdde7363a8c4853975bf3b756f4b0cc81622b Mon Sep 17 00:00:00 2001 +From: Rajashekar Gade Reddy +Date: Mon, 23 Mar 2020 22:19:07 +0530 +Subject: [PATCH 1/3] Add dbus method SlotIpmbRequest + +Added dbus method SlotIpmbRequest which enables the applications to +communicate with add-in cards. + +This is submitted in down stream because SlotIpmbRequest uses hold and +unhold mux kernel patches which are downstream only patches. + +Tested: + +busctl call xyz.openbmc_project.Ipmi.Channel.Ipmb +/xyz/openbmc_project/Ipmi/Channel/Ipmb org.openbmc.Ipmb SlotIpmbRequest +"yyyyyay" // method call +(iyyyyay) 0 7 0 1 0 15 0 0 0 0 2 12 87 1 0 0 0 0 0 0 0 // success + +busctl call xyz.openbmc_project.Ipmi.Channel.Ipmb +/xyz/openbmc_project/Ipmi/Channel/Ipmb org.openbmc.Ipmb SlotIpmbRequest +"yyyyyay" // method call +(iyyyyay) 4 0 0 0 0 0 // failure + +busctl call xyz.openbmc_project.Ipmi.Channel.Ipmb +/xyz/openbmc_project/Ipmi/Channel/Ipmb org.openbmc.Ipmb SlotIpmbRequest +"yyyyyay" // method call +(iyyyyay) 4 0 0 0 0 0 // failure + +//This ipmi command internally calls the dbus method SlotIpmbRequest. +ipmitool raw 0x3e 0x51 0 0x01 0xb0 0x6 1 +00 00 00 00 00 02 0c 57 01 00 00 00 00 00 00 00 //success + +Note: Tested for all possible negative test cases and it works fine. + +Signed-off-by: Rajashekar Gade Reddy +Signed-off-by: Andrey V.Kosteltsev +--- + CMakeLists.txt | 2 +- + include/linux/i2c.h | 159 +++++++++++++++++++++++++++++++ + ipmb-channels.json | 6 ++ + ipmbbridged.cpp | 221 +++++++++++++++++++++++++++++++++++++++++++- + ipmbbridged.hpp | 8 +- + 5 files changed, 392 insertions(+), 4 deletions(-) + create mode 100644 include/linux/i2c.h + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4acdccf..3484a58 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -8,7 +8,7 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON) + #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") + #set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti") + +-include_directories (${CMAKE_CURRENT_SOURCE_DIR}) ++include_directories (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include) + find_package (Boost REQUIRED) + include_directories (${Boost_INCLUDE_DIRS}) + add_definitions (-DBOOST_ERROR_CODE_HEADER_ONLY) +diff --git a/include/linux/i2c.h b/include/linux/i2c.h +new file mode 100644 +index 0000000..a1db9b1 +--- /dev/null ++++ b/include/linux/i2c.h +@@ -0,0 +1,159 @@ ++/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ ++/* ------------------------------------------------------------------------- */ ++/* */ ++/* i2c.h - definitions for the i2c-bus interface */ ++/* */ ++/* ------------------------------------------------------------------------- */ ++/* Copyright (C) 1995-2000 Simon G. Vogl ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, ++ MA 02110-1301 USA. */ ++/* ------------------------------------------------------------------------- */ ++ ++/* With some changes from Kyösti Mälkki and ++ Frodo Looijaard */ ++ ++#ifndef _UAPI_LINUX_I2C_H ++#define _UAPI_LINUX_I2C_H ++ ++#include ++ ++/** ++ * struct i2c_msg - an I2C transaction segment beginning with START ++ * @addr: Slave address, either seven or ten bits. When this is a ten ++ * bit address, I2C_M_TEN must be set in @flags and the adapter ++ * must support I2C_FUNC_10BIT_ADDR. ++ * @flags: I2C_M_RD is handled by all adapters. No other flags may be ++ * provided unless the adapter exported the relevant I2C_FUNC_* ++ * flags through i2c_check_functionality(). ++ * @len: Number of data bytes in @buf being read from or written to the ++ * I2C slave address. For read transactions where I2C_M_RECV_LEN ++ * is set, the caller guarantees that this buffer can hold up to ++ * 32 bytes in addition to the initial length byte sent by the ++ * slave (plus, if used, the SMBus PEC); and this value will be ++ * incremented by the number of block data bytes received. ++ * @buf: The buffer into which data is read, or from which it's written. ++ * ++ * An i2c_msg is the low level representation of one segment of an I2C ++ * transaction. It is visible to drivers in the @i2c_transfer() procedure, ++ * to userspace from i2c-dev, and to I2C adapter drivers through the ++ * @i2c_adapter.@master_xfer() method. ++ * ++ * Except when I2C "protocol mangling" is used, all I2C adapters implement ++ * the standard rules for I2C transactions. Each transaction begins with a ++ * START. That is followed by the slave address, and a bit encoding read ++ * versus write. Then follow all the data bytes, possibly including a byte ++ * with SMBus PEC. The transfer terminates with a NAK, or when all those ++ * bytes have been transferred and ACKed. If this is the last message in a ++ * group, it is followed by a STOP. Otherwise it is followed by the next ++ * @i2c_msg transaction segment, beginning with a (repeated) START. ++ * ++ * Alternatively, when the adapter supports I2C_FUNC_PROTOCOL_MANGLING then ++ * passing certain @flags may have changed those standard protocol behaviors. ++ * Those flags are only for use with broken/nonconforming slaves, and with ++ * adapters which are known to support the specific mangling options they ++ * need (one or more of IGNORE_NAK, NO_RD_ACK, NOSTART, and REV_DIR_ADDR). ++ */ ++struct i2c_msg { ++ __u16 addr; /* slave address */ ++ __u16 flags; ++#define I2C_M_RD 0x0001 /* read data, from slave to master */ ++ /* I2C_M_RD is guaranteed to be 0x0001! */ ++#define I2C_M_TEN 0x0010 /* this is a ten bit chip address */ ++#define I2C_M_HOLD 0x0100 /* for holding a mux path */ ++#define I2C_M_DMA_SAFE 0x0200 /* the buffer of this message is DMA safe */ ++ /* makes only sense in kernelspace */ ++ /* userspace buffers are copied anyway */ ++#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */ ++#define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */ ++#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */ ++#define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */ ++#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_NOSTART */ ++#define I2C_M_STOP 0x8000 /* if I2C_FUNC_PROTOCOL_MANGLING */ ++ __u16 len; /* msg length */ ++ __u8 *buf; /* pointer to msg data */ ++}; ++ ++/* To determine what functionality is present */ ++ ++#define I2C_FUNC_I2C 0x00000001 ++#define I2C_FUNC_10BIT_ADDR 0x00000002 ++#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_IGNORE_NAK etc. */ ++#define I2C_FUNC_SMBUS_PEC 0x00000008 ++#define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */ ++#define I2C_FUNC_SLAVE 0x00000020 ++#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ ++#define I2C_FUNC_SMBUS_QUICK 0x00010000 ++#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 ++#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 ++#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 ++#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 ++#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 ++#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 ++#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 ++#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 ++#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 ++#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ ++#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ ++#define I2C_FUNC_SMBUS_HOST_NOTIFY 0x10000000 ++ ++#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ ++ I2C_FUNC_SMBUS_WRITE_BYTE) ++#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ ++ I2C_FUNC_SMBUS_WRITE_BYTE_DATA) ++#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ ++ I2C_FUNC_SMBUS_WRITE_WORD_DATA) ++#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ ++ I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) ++#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ ++ I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) ++ ++#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \ ++ I2C_FUNC_SMBUS_BYTE | \ ++ I2C_FUNC_SMBUS_BYTE_DATA | \ ++ I2C_FUNC_SMBUS_WORD_DATA | \ ++ I2C_FUNC_SMBUS_PROC_CALL | \ ++ I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ ++ I2C_FUNC_SMBUS_I2C_BLOCK | \ ++ I2C_FUNC_SMBUS_PEC) ++ ++/* ++ * Data for SMBus Messages ++ */ ++#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ ++union i2c_smbus_data { ++ __u8 byte; ++ __u16 word; ++ __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ ++ /* and one more for user-space compatibility */ ++}; ++ ++/* i2c_smbus_xfer read or write markers */ ++#define I2C_SMBUS_READ 1 ++#define I2C_SMBUS_WRITE 0 ++ ++/* SMBus transaction types (size parameter in the above functions) ++ Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ ++#define I2C_SMBUS_QUICK 0 ++#define I2C_SMBUS_BYTE 1 ++#define I2C_SMBUS_BYTE_DATA 2 ++#define I2C_SMBUS_WORD_DATA 3 ++#define I2C_SMBUS_PROC_CALL 4 ++#define I2C_SMBUS_BLOCK_DATA 5 ++#define I2C_SMBUS_I2C_BLOCK_BROKEN 6 ++#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ ++#define I2C_SMBUS_I2C_BLOCK_DATA 8 ++ ++#endif /* _UAPI_LINUX_I2C_H */ +diff --git a/ipmb-channels.json b/ipmb-channels.json +index 0876db7..ff570c6 100644 +--- a/ipmb-channels.json ++++ b/ipmb-channels.json +@@ -11,6 +11,12 @@ + "slave-path": "/dev/ipmb-0", + "bmc-addr": 32, + "remote-addr": 88 ++ }, ++ { ++ "type": "slot-ipmb", ++ "slave-path": "/dev/ipmb-6", ++ "bmc-addr": 18, ++ "remote-addr": 176 + } + ] + } +diff --git a/ipmbbridged.cpp b/ipmbbridged.cpp +index f8d5142..dec6ad2 100644 +--- a/ipmbbridged.cpp ++++ b/ipmbbridged.cpp +@@ -18,6 +18,11 @@ + #include "ipmbdefines.hpp" + #include "ipmbutils.hpp" + ++#include ++#include ++#include ++#include ++ + #include + #include + #include +@@ -40,7 +45,8 @@ auto conn = std::make_shared(io); + static std::list ipmbChannels; + static const std::unordered_map + ipmbChannelTypeMap = {{"me", ipmbChannelType::me}, +- {"ipmb", ipmbChannelType::ipmb}}; ++ {"ipmb", ipmbChannelType::ipmb}, ++ {"slot-ipmb", ipmbChannelType::slot_ipmb}}; + + /** + * @brief Ipmb request class methods +@@ -555,7 +561,10 @@ int IpmbChannel::ipmbChannelInit(const char *ipmbI2cSlave) + { + std::string deviceFileName = + "/sys/bus/i2c/devices/i2c-" + busStr + "/new_device"; +- std::string para = "ipmb-dev 0x1010"; // init with BMC addr 0x20 ++ std::ostringstream param; ++ param << "ipmb-dev 0x" << std::hex ++ << static_cast(0x1000 | (ipmbBmcSlaveAddress >> 1)); ++ std::string para(param.str()); + std::fstream deviceFile; + deviceFile.open(deviceFileName, std::ios::out); + if (!deviceFile.good()) +@@ -711,6 +720,171 @@ void IpmbChannel::addFilter(const uint8_t respNetFn, const uint8_t cmd) + } + } + ++class Mux ++{ ++ public: ++ Mux(const std::string &path) : heldMux(false) ++ { ++ fd = open(path.c_str(), O_RDWR | O_NONBLOCK); ++ } ++ ~Mux() ++ { ++ if (heldMux) ++ { ++ if (unholdMux() < 0) ++ { ++ phosphor::logging::log( ++ "Error while unholding the bus"); ++ } ++ } ++ if (!(fd < 0)) ++ { ++ close(fd); ++ } ++ } ++ ++ int transferAndHoldMux(const uint8_t slaveAddr, uint8_t *buffer, ++ const uint8_t len, uint16_t timeout) ++ { ++ if (!isMuxFdOpen()) ++ { ++ return -1; ++ } ++ struct i2c_msg holdmsg[2] = { ++ {slaveAddr, 0, len, buffer}, ++ {0, I2C_M_HOLD, sizeof(timeout), (uint8_t *)&timeout}}; ++ ++ struct i2c_rdwr_ioctl_data msgrdwr = {&holdmsg[0], 2}; ++ ++ int retVal = ioctl(fd, I2C_RDWR, &msgrdwr); ++ if (retVal >= 0) ++ { ++ heldMux = true; ++ } ++ return retVal; ++ } ++ ++ bool isMuxFdOpen() ++ { ++ if (fd < 0) ++ { ++ phosphor::logging::log( ++ "Error while opening the mux device file"); ++ return false; ++ } ++ return true; ++ } ++ ++ private: ++ int unholdMux() ++ { ++ if (!isMuxFdOpen()) ++ { ++ return -1; ++ } ++ uint16_t holdtimeout = 0; // unhold the bus ++ ++ struct i2c_msg holdmsg = {0, I2C_M_HOLD, sizeof(holdtimeout), ++ (uint8_t *)&holdtimeout}; ++ ++ struct i2c_rdwr_ioctl_data msgrdwr = {&holdmsg, 1}; ++ ++ return ioctl(fd, I2C_RDWR, &msgrdwr); ++ } ++ ++ int fd; ++ bool heldMux; ++}; ++ ++std::tuple> ++ IpmbChannel::slotRequestAdd(boost::asio::yield_context &yield, ++ std::shared_ptr request, ++ const uint8_t pcieSlot) ++{ ++ makeRequestValid(request); ++ std::filesystem::path p = ++ "/dev/i2c-mux/PCIE_Mux/Pcie_Slot_" + std::to_string(pcieSlot); ++ ++ if (!std::filesystem::exists(p) || !std::filesystem::is_symlink(p)) ++ { ++ phosphor::logging::log( ++ "does not exist or not a symlink ", ++ phosphor::logging::entry("File:%s", p.c_str())); ++ return returnStatus(ipmbResponseStatus::error); ++ } ++ ++ Mux mux(p); ++ if (!mux.isMuxFdOpen()) ++ { ++ return returnStatus(ipmbResponseStatus::error); ++ } ++ ++ std::vector buffer(0); ++ if (request->ipmbToi2cConstruct(buffer) != 0) ++ { ++ return returnStatus(ipmbResponseStatus::error); ++ } ++ ++ uint8_t size = buffer.size(); ++ ++ const uint8_t slaveAddrIndex = 1; ++ const uint8_t slotIpmbHeader = 2; ++ ++ for (int i = 0; i < ipmbNumberOfTries; i++) ++ { ++ boost::system::error_code ec; ++ int i2cRetryCnt = 0; ++ do ++ { ++ if (mux.transferAndHoldMux( ++ buffer[slaveAddrIndex] >> 1, buffer.data() + slotIpmbHeader, ++ size - slotIpmbHeader, ipmbRequestRetryTimeout) >= 0) ++ { ++ break; ++ } ++ ++ phosphor::logging::log( ++ "Error sending slot IPMB command"); ++ i2cRetryCnt++; ++ } while (i2cRetryCnt < ipmbI2cNumberOfRetries); ++ ++ if (i2cRetryCnt == ipmbI2cNumberOfRetries) ++ { ++ std::string msgToLog = ++ "slotRequestAdd: Sent to I2C failed after retries." ++ " busId=" + ++ std::to_string(ipmbBusId) + ", error=" + ec.message(); ++ phosphor::logging::log( ++ msgToLog.c_str()); ++ makeRequestInvalid(*request); ++ return returnStatus(ipmbResponseStatus::error); ++ } ++ ++ request->timer->expires_after( ++ std::chrono::milliseconds(ipmbRequestRetryTimeout)); ++ request->timer->async_wait(yield[ec]); ++ ++ if (ec && ec != boost::asio::error::operation_aborted) ++ { ++ // unexpected error - invalidate request and return generic error ++ phosphor::logging::log( ++ "requestAdd: async_wait error"); ++ makeRequestInvalid(*request); ++ return returnStatus(ipmbResponseStatus::error); ++ } ++ ++ if (request->state == ipmbRequestState::matched) ++ { ++ // matched response, send it to client application ++ makeRequestInvalid(*request); ++ return request->returnMatchedResponse(); ++ } ++ } ++ ++ makeRequestInvalid(*request); ++ return returnStatus(ipmbResponseStatus::timeout); ++} ++ + std::tuple> + IpmbChannel::requestAdd(boost::asio::yield_context &yield, + std::shared_ptr request) +@@ -848,6 +1022,47 @@ static int initializeChannels() + return 0; + } + ++auto slotIpmbHandleRequest = ++ [](boost::asio::yield_context yield, uint8_t addressType, ++ uint8_t slotNumber, uint8_t targetSlaveAddr, uint8_t netfn, uint8_t cmd, ++ std::vector dataReceived) { ++ uint8_t lun = 0; // No support for lun in slot IPMB ++ IpmbChannel *channel = ++ getChannel(static_cast(ipmbChannelType::slot_ipmb)); ++ if (channel == nullptr) ++ { ++ phosphor::logging::log( ++ "slotIpmbHandleRequest: Slot IPMB channel does not exist"); ++ return returnStatus(ipmbResponseStatus::error); ++ } ++ ++ // check outstanding request list for valid sequence number ++ uint8_t seqNum = 0; ++ bool seqValid = channel->seqNumGet(seqNum); ++ if (!seqValid) ++ { ++ phosphor::logging::log( ++ "slotIpmbHandleRequest: cannot add more requests to the list"); ++ return returnStatus(ipmbResponseStatus::busy); ++ } ++ ++ uint8_t bmcSlaveAddress = channel->getBmcSlaveAddress(); ++ uint8_t rqSlaveAddress = targetSlaveAddr; ++ ++ // construct the request to add it to outstanding request list ++ std::shared_ptr request = std::make_shared( ++ rqSlaveAddress, netfn, ipmbRsLun, bmcSlaveAddress, seqNum, lun, cmd, ++ dataReceived); ++ ++ if (!request->timer) ++ { ++ phosphor::logging::log( ++ "slotIpmbHandleRequest: timer object does not exist"); ++ return returnStatus(ipmbResponseStatus::error); ++ } ++ return channel->slotRequestAdd(yield, request, slotNumber); ++ }; ++ + auto ipmbHandleRequest = [](boost::asio::yield_context yield, + uint8_t reqChannel, uint8_t netfn, uint8_t lun, + uint8_t cmd, std::vector dataReceived) { +@@ -994,6 +1209,8 @@ int main(int argc, char *argv[]) + server.add_interface(ipmbObj, ipmbDbusIntf); + + ipmbIface->register_method("sendRequest", std::move(ipmbHandleRequest)); ++ ipmbIface->register_method("SlotIpmbRequest", ++ std::move(slotIpmbHandleRequest)); + ipmbIface->initialize(); + + if (initializeChannels() < 0) +diff --git a/ipmbbridged.hpp b/ipmbbridged.hpp +index 052c193..c79ac63 100644 +--- a/ipmbbridged.hpp ++++ b/ipmbbridged.hpp +@@ -155,7 +155,8 @@ enum class ipmbRequestState + enum class ipmbChannelType + { + ipmb = 0, +- me = 1 ++ me = 1, ++ slot_ipmb = 2 + }; + + /** +@@ -293,6 +294,11 @@ class IpmbChannel + void ipmbSendI2cFrame(std::shared_ptr> buffer, + size_t retriesAttempted); + ++ std::tuple> ++ slotRequestAdd(boost::asio::yield_context &yield, ++ std::shared_ptr requestToSend, ++ const uint8_t pcieSlot); ++ + std::tuple> + requestAdd(boost::asio::yield_context &yield, + std::shared_ptr requestToSend); +-- +2.35.1 + diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0002-Add-log-count-limitation-to-requestAdd.patch b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0002-Add-log-count-limitation-to-requestAdd.patch new file mode 100644 index 0000000000..4e98f67a57 --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0002-Add-log-count-limitation-to-requestAdd.patch @@ -0,0 +1,95 @@ +From e6bd7ce41f4729469617891e24f35abb195dfd5e Mon Sep 17 00:00:00 2001 +From: Helen Huang +Date: Mon, 31 May 2021 09:19:55 +0800 +Subject: [PATCH 2/3] Add log count limitation to requestAdd() + +To avoid log storm, add the log count limitation to +requestAdd(). + +Change-Id: I91894ff07fa252ed7746816535611a33b6f640ea +Signed-off-by: Helen Huang +Signed-off-by: Andrey V.Kosteltsev +--- + ipmbbridged.cpp | 44 ++++++++++++++++++++++++++++++++++++++------ + ipmbbridged.hpp | 3 +++ + 2 files changed, 41 insertions(+), 6 deletions(-) + +diff --git a/ipmbbridged.cpp b/ipmbbridged.cpp +index dec6ad2..3ffc1f7 100644 +--- a/ipmbbridged.cpp ++++ b/ipmbbridged.cpp +@@ -916,12 +916,44 @@ std::tuple> + + if (i2cRetryCnt == ipmbI2cNumberOfRetries) + { +- std::string msgToLog = +- "requestAdd: Sent to I2C failed after retries." +- " busId=" + +- std::to_string(ipmbBusId) + ", error=" + ec.message(); +- phosphor::logging::log( +- msgToLog.c_str()); ++ if ((requestAddLogCount <= ipmbRequestAddLogLimit) || ++ (!(requestAddLogCount % ipmbRequestAddLogInterval)) || ++ (UINT_MAX == requestAddLogCount)) ++ { ++ std::string msgToLog; ++ if (requestAddLogCount == ipmbRequestAddLogLimit) ++ { ++ msgToLog = "requestAdd: There are " + ++ std::to_string(ipmbRequestAddLogLimit - 1) + ++ " similiar logs." ++ " To avoid log storm, not all the logs for the " ++ "issue will be shown: "; ++ } ++ if (!(requestAddLogCount % ipmbRequestAddLogInterval) && (requestAddLogCount != 0)) ++ { ++ msgToLog = "requestAdd: There are " + ++ std::to_string(requestAddLogCount) + ++ " similiar logs so far: "; ++ } ++ if (UINT_MAX == requestAddLogCount) ++ { ++ msgToLog = "requestAdd: There are " + ++ std::to_string(requestAddLogCount) + ++ " similiar logs," ++ " The log count will be rolled back to zero: "; ++ } ++ msgToLog += "requestAdd: Sent to I2C failed after retries." ++ " busId=" + ++ std::to_string(ipmbBusId) + ++ ", error=" + ec.message(); ++ phosphor::logging::log( ++ msgToLog.c_str()); ++ } ++ requestAddLogCount++; ++ } ++ else ++ { ++ requestAddLogCount = 0; + } + + request->timer->expires_after( +diff --git a/ipmbbridged.hpp b/ipmbbridged.hpp +index c79ac63..eaba7ae 100644 +--- a/ipmbbridged.hpp ++++ b/ipmbbridged.hpp +@@ -50,6 +50,8 @@ constexpr int ipmbMaxOutstandingRequestsCount = 64; + constexpr int ipmbNumberOfTries = 6; + constexpr uint64_t ipmbRequestRetryTimeout = 250; // ms + ++constexpr int ipmbRequestAddLogLimit = 10; ++constexpr int ipmbRequestAddLogInterval = 100; + /** + * @brief Ipmb I2C communication + */ +@@ -313,6 +315,7 @@ class IpmbChannel + uint8_t ipmbBusId; + uint8_t channelIdx; + ++ unsigned int requestAddLogCount = 0; + std::shared_ptr commandFilter; + + // array storing outstanding requests +-- +2.35.1 + diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0003-Fix-for-clearing-outstanding-requests.patch b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0003-Fix-for-clearing-outstanding-requests.patch new file mode 100644 index 0000000000..1b7d47b01f --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0003-Fix-for-clearing-outstanding-requests.patch @@ -0,0 +1,63 @@ +From 3a528516ea20cac006c6a892b353faa25fe64e7f Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala +Date: Mon, 20 Sep 2021 14:06:05 +0000 +Subject: [PATCH 3/3] Fix for clearing outstanding requests + +IPMB requests were made valid even if there was an error in opening the +mux bus. This fix makes the IPMB requests valid only we were able to +successfully open the Mux fd. + +Tested: +Verified using busctl command. +Command: busctl call xyz.openbmc_project.Ipmi.Channel.Ipmb + /xyz/openbmc_project/Ipmi/Channel/Ipmb org.openbmc.Ipmb + sendRequest yyyyay 0 0x30 0 0x70 2 0 32 +Response: (iyyyyay) 0 49 0 112 193 0 + +Signed-off-by: Jayaprakash Mutyala +Signed-off-by: Andrey V.Kosteltsev +--- + ipmbbridged.cpp | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/ipmbbridged.cpp b/ipmbbridged.cpp +index 3ffc1f7..0508fcc 100644 +--- a/ipmbbridged.cpp ++++ b/ipmbbridged.cpp +@@ -801,7 +801,6 @@ std::tuple> + std::shared_ptr request, + const uint8_t pcieSlot) + { +- makeRequestValid(request); + std::filesystem::path p = + "/dev/i2c-mux/PCIE_Mux/Pcie_Slot_" + std::to_string(pcieSlot); + +@@ -825,6 +824,7 @@ std::tuple> + return returnStatus(ipmbResponseStatus::error); + } + ++ makeRequestValid(request); + uint8_t size = buffer.size(); + + const uint8_t slaveAddrIndex = 1; +@@ -894,6 +894,7 @@ std::tuple> + std::vector buffer(0); + if (request->ipmbToi2cConstruct(buffer) != 0) + { ++ makeRequestInvalid(*request); + return returnStatus(ipmbResponseStatus::error); + } + +@@ -929,7 +930,8 @@ std::tuple> + " To avoid log storm, not all the logs for the " + "issue will be shown: "; + } +- if (!(requestAddLogCount % ipmbRequestAddLogInterval) && (requestAddLogCount != 0)) ++ if (!(requestAddLogCount % ipmbRequestAddLogInterval) && ++ (requestAddLogCount != 0)) + { + msgToLog = "requestAdd: There are " + + std::to_string(requestAddLogCount) + +-- +2.35.1 + diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/ipmb-channels.json b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/ipmb-channels.json index cf5a28303a..2d77aa6e73 100644 --- a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/ipmb-channels.json +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/ipmb-channels.json @@ -10,7 +10,13 @@ "type": "ipmb", "slave-path": "/dev/ipmb-13", "bmc-addr": 32, - "remote-addr": 56 + "remote-addr": 32 + }, + { + "type": "slot-ipmb", + "slave-path": "/dev/ipmb-6", + "bmc-addr": 18, + "remote-addr": 176 } ] } diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend index 29b98581fe..817ecd4349 100644 --- a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend @@ -1,6 +1,13 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" -SRC_URI:append = " file://ipmb-channels.json" +SRC_URI = "git://github.com/openbmc/ipmbbridge.git;branch=master;protocol=https" +SRCREV = "8227626764edf13350c5f5a5857298a905fb43f7" + +SRC_URI:append = " file://0001-Add-dbus-method-SlotIpmbRequest.patch \ + file://0002-Add-log-count-limitation-to-requestAdd.patch \ + file://0003-Fix-for-clearing-outstanding-requests.patch \ + file://ipmb-channels.json \ + " do_install:append(){ install -m 0644 -D ${WORKDIR}/ipmb-channels.json \ diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs/99-ipmi-kcs.rules b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs/99-ipmi-kcs.rules new file mode 100644 index 0000000000..0a64b58dba --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs/99-ipmi-kcs.rules @@ -0,0 +1,2 @@ +KERNEL=="ipmi-kcs3", SYMLINK+="ipmi_kcs3" +KERNEL=="ipmi-kcs4", SYMLINK+="ipmi_kcs4" diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend new file mode 100644 index 0000000000..f4820e1113 --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend @@ -0,0 +1,21 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +#SYSTEMD_SUBSTITUTIONS_remove = "KCS_DEVICE:${KCS_DEVICE}:${DBUS_SERVICE_${PN}}" + +# Default kcs device is ipmi-kcs3; this is SMS. +# Add SMM kcs device instance + +# Replace the '-' to '_', since Dbus object/interface names do not allow '-'. +KCS_DEVICE = "ipmi_kcs3" +SMM_DEVICE = "ipmi_kcs4" +SYSTEMD_SERVICE:${PN}:append = " ${PN}@${SMM_DEVICE}.service " + +SRC_URI = "git://github.com/openbmc/kcsbridge.git;branch=master;protocol=https" +SRCREV = "7580a8e60d868b5bcb1a8f8d276374afe7c0983a" + +SRC_URI += "file://99-ipmi-kcs.rules" + +do_install:append() { + install -d ${D}${base_libdir}/udev/rules.d + install -m 0644 ${WORKDIR}/99-ipmi-kcs.rules ${D}${base_libdir}/udev/rules.d/ +} diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0001-Modify-dbus-namespace-of-chassis-control-for-guid.patch b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0001-Modify-dbus-namespace-of-chassis-control-for-guid.patch new file mode 100644 index 0000000000..6eb2325d6f --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0001-Modify-dbus-namespace-of-chassis-control-for-guid.patch @@ -0,0 +1,43 @@ +From da59ce9f701167120dc4a3fbef63d0cc4b8e988e Mon Sep 17 00:00:00 2001 +From: Kuiying Wang +Date: Mon, 2 Jul 2018 15:51:52 +0800 +Subject: [PATCH 1/2] Modify dbus namespace of chassis control for guid.cpp +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Switch chassis control service namespace for guid.cpp from “org” to “xyz”, +to compatible with new intel-chassis services + +Signed-off-by: Kuiying Wang +Signed-off-by: Andrey V.Kosteltsev +--- + command/guid.cpp | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/command/guid.cpp b/command/guid.cpp +index c69f825..53a9c21 100644 +--- a/command/guid.cpp ++++ b/command/guid.cpp +@@ -21,7 +21,8 @@ namespace command + + std::unique_ptr matchPtr(nullptr); + +-static constexpr auto guidObjPath = "/org/openbmc/control/chassis0"; ++static constexpr auto guidObjPath = ++ "/xyz/openbmc_project/Chassis/Control/Chassis0"; + static constexpr auto propInterface = "org.freedesktop.DBus.Properties"; + + Guid getSystemGUID() +@@ -31,7 +32,7 @@ Guid getSystemGUID() + Guid guid = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10}; + +- constexpr auto chassisIntf = "org.openbmc.control.Chassis"; ++ constexpr auto chassisIntf = "xyz.openbmc_project.Chassis.Control.Chassis"; + + sd_bus_message* reply = nullptr; + sd_bus_error error = SD_BUS_ERROR_NULL; +-- +2.35.1 + diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0002-rakp12-Add-username-to-SessionInfo-interface.patch b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0002-rakp12-Add-username-to-SessionInfo-interface.patch new file mode 100644 index 0000000000..3c7a939c9b --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0002-rakp12-Add-username-to-SessionInfo-interface.patch @@ -0,0 +1,50 @@ +From 9343b695d3128f5e1674987d0f001eb1cace5d03 Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala +Date: Tue, 1 Jun 2021 12:22:19 +0000 +Subject: [PATCH 2/2] rakp12: Add username to SessionInfo interface + +Add username to SessionInfo interface to get username info on individual +IPMI session Id's on Redfish + +Tested: +1. Activate SOL session +Command: ipmitool -I lanplus -U root -P 0penBmc -H -C 17 + sol activate +Response: // Success +2. Verified on SessionInfo D-bus interface. +busctl introspect xyz.openbmc_project.Ipmi.Channel.eth0 + /xyz/openbmc_project/ipmi/session/eth0/ +NAME TYPE SIGNATURE RESULT/VALUE FLAGS +...... +xyz.openbmc_project.Ipmi.SessionInfo interface - - - +.ChannelNum property y 3 emits-change writable +.CurrentPrivilege property y 4 emits-change writable +.RemoteIPAddr property u 22253066 emits-change writable +.RemoteMACAddress property ay 0 emits-change writable +.RemotePort property q 41096 emits-change writable +.SessionHandle property y 129 emits-change writable +.State property y 2 emits-change writable +.UserID property y 1 emits-change writable +.Username property s "root" emits-change writable + +Signed-off-by: Jayaprakash Mutyala +Signed-off-by: Andrey V.Kosteltsev +--- + command/rakp12.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/command/rakp12.cpp b/command/rakp12.cpp +index b8dc17c..3b2c49d 100644 +--- a/command/rakp12.cpp ++++ b/command/rakp12.cpp +@@ -250,6 +250,7 @@ std::vector RAKP12(const std::vector& inPayload, + } + session->channelNum(chNum); + session->userID(userId); ++ session->username(userName); + // minimum privilege of Channel / User / session::privilege::USER + // has to be used as session current privilege level + uint8_t minPriv = 0; +-- +2.35.1 + diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/10-nice-rules.conf b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/10-nice-rules.conf new file mode 100644 index 0000000000..d2fb5ba043 --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/10-nice-rules.conf @@ -0,0 +1,2 @@ +[Service] +Nice=-18 diff --git a/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend new file mode 100644 index 0000000000..f5d2706954 --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend @@ -0,0 +1,30 @@ +inherit useradd + +# TODO: This should be removed, once up-stream bump up +# issue is resolved +SRC_URI += "git://github.com/openbmc/phosphor-net-ipmid;branch=master;protocol=https" +SRCREV = "aa8b541d6b4aba53a3a0b39d9123f433cb5cc5e7" + +USERADD_PACKAGES = "${PN}" +# add a group called ipmi +GROUPADD_PARAM:${PN} = "ipmi " + +# Default rmcpp iface is eth0; channel 1 +# Add channel 2 instance (eth1) +RMCPP_EXTRA = "eth1" +SYSTEMD_SERVICE:${PN} += " \ + ${PN}@${RMCPP_EXTRA}.service \ + ${PN}@${RMCPP_EXTRA}.socket \ + " + +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI += " file://10-nice-rules.conf \ + file://0001-Modify-dbus-namespace-of-chassis-control-for-guid.patch \ + file://0002-rakp12-Add-username-to-SessionInfo-interface.patch \ + " + +do_install:append() { + mkdir -p ${D}${sysconfdir}/systemd/system/phosphor-ipmi-net@.service.d/ + install -m 0644 ${WORKDIR}/10-nice-rules.conf ${D}${sysconfdir}/systemd/system/phosphor-ipmi-net@.service.d/ +} -- cgit v1.2.3