summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0001-Add-dbus-method-SlotIpmbRequest.patch
blob: 3f01cd2c831d3c115518c0d3687b468dbdd00e1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
From 644165bf32fd6e757c261881987d127a865cbf2b Mon Sep 17 00:00:00 2001
From: Rajashekar Gade Reddy <raja.sekhar.reddy.gade@linux.intel.com>
Date: Mon, 23 Mar 2020 22:19:07 +0530
Subject: [PATCH] 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" <valid_addressType> <valid_slot> <valid_slaveAddr> <valid_netFun> <valid_cmd> <data> // 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" <valid_addressType> <invalid_slot> <valid_slaveAddr> <valid_netFun> <valid_cmd> <data> // 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" <valid_addressType> <valid_slot> <invalid_slaveAddr> <valid_netFun> <valid_cmd> <data> // 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 <raja.sekhar.reddy.gade@intel.com>

%% original patch: 0001-Add-dbus-method-SlotIpmbRequest.patch
---
 CMakeLists.txt      |   2 +-
 include/linux/i2c.h | 159 ++++++++++++++++++++++++++++++++
 ipmb-channels.json  |   6 ++
 ipmbbridged.cpp     | 220 +++++++++++++++++++++++++++++++++++++++++++-
 ipmbbridged.hpp     |   8 +-
 5 files changed, 391 insertions(+), 4 deletions(-)
 create mode 100644 include/linux/i2c.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 80377f5..1436d5e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,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 <kmalkki@cc.hut.fi> and
+   Frodo Looijaard <frodol@dds.nl> */
+
+#ifndef _UAPI_LINUX_I2C_H
+#define _UAPI_LINUX_I2C_H
+
+#include <linux/types.h>
+
+/**
+ * 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 e0eadfc..72ede8c 100644
--- a/ipmbbridged.cpp
+++ b/ipmbbridged.cpp
@@ -18,6 +18,11 @@
 #include "ipmbdefines.hpp"
 #include "ipmbutils.hpp"
 
+#include <i2c/smbus.h>
+#include <linux/i2c-dev.h>
+#include <linux/i2c.h>
+#include <sys/ioctl.h>
+
 #include <boost/algorithm/string/replace.hpp>
 #include <filesystem>
 #include <fstream>
@@ -39,7 +44,8 @@ auto conn = std::make_shared<sdbusplus::asio::connection>(io);
 static std::list<IpmbChannel> ipmbChannels;
 static const std::unordered_map<std::string, ipmbChannelType>
     ipmbChannelTypeMap = {{"me", ipmbChannelType::me},
-                          {"ipmb", ipmbChannelType::ipmb}};
+                          {"ipmb", ipmbChannelType::ipmb},
+                          {"slot-ipmb", ipmbChannelType::slot_ipmb}};
 
 /**
  * @brief Ipmb request class methods
@@ -551,7 +557,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<uint16_t>(0x1000 | (ipmbBmcSlaveAddress >> 1));
+        std::string para(param.str());
         std::fstream deviceFile;
         deviceFile.open(deviceFileName, std::ios::out);
         if (!deviceFile.good())
@@ -697,6 +706,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<phosphor::logging::level::ERR>(
+                    "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<phosphor::logging::level::ERR>(
+                "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<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>
+    IpmbChannel::slotRequestAdd(boost::asio::yield_context &yield,
+                                std::shared_ptr<IpmbRequest> 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<phosphor::logging::level::ERR>(
+            "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<uint8_t> 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<phosphor::logging::level::ERR>(
+                "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<phosphor::logging::level::INFO>(
+                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<phosphor::logging::level::ERR>(
+                "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<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>
     IpmbChannel::requestAdd(boost::asio::yield_context &yield,
                             std::shared_ptr<IpmbRequest> request)
@@ -826,6 +1000,46 @@ 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<uint8_t> dataReceived) {
+        uint8_t lun = 0; // No support for lun in slot IPMB
+        IpmbChannel *channel = getChannel(ipmbChannelType::slot_ipmb);
+        if (channel == nullptr)
+        {
+            phosphor::logging::log<phosphor::logging::level::ERR>(
+                "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<phosphor::logging::level::WARNING>(
+                "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<IpmbRequest> request = std::make_shared<IpmbRequest>(
+            rqSlaveAddress, netfn, ipmbRsLun, bmcSlaveAddress, seqNum, lun, cmd,
+            dataReceived);
+
+        if (!request->timer)
+        {
+            phosphor::logging::log<phosphor::logging::level::ERR>(
+                "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<uint8_t> dataReceived) {
@@ -971,6 +1185,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 e264195..167f613 100644
--- a/ipmbbridged.hpp
+++ b/ipmbbridged.hpp
@@ -153,7 +153,8 @@ enum class ipmbRequestState
 enum class ipmbChannelType
 {
     ipmb = 0,
-    me = 1
+    me = 1,
+    slot_ipmb = 2
 };
 
 /**
@@ -287,6 +288,11 @@ class IpmbChannel
     void ipmbSendI2cFrame(std::shared_ptr<std::vector<uint8_t>> buffer,
                           size_t retriesAttempted);
 
+    std::tuple<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>
+        slotRequestAdd(boost::asio::yield_context &yield,
+                       std::shared_ptr<IpmbRequest> requestToSend,
+                       const uint8_t pcieSlot);
+
     std::tuple<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>
         requestAdd(boost::asio::yield_context &yield,
                    std::shared_ptr<IpmbRequest> requestToSend);
-- 
2.17.1