ipmbbridged.hpp (bbfd00abdbc6d2f7c0389eae91cc055a1d4fe0c3) ipmbbridged.hpp (37a7eace7148ae352d9f4f2fb2ae29e2f0d01e09)
1/* Copyright 2018 Intel
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *

--- 52 unchanged lines hidden (view full) ---

61/**
62 * @brief Ipmb defines
63 */
64constexpr size_t ipmbMaxDataSize = 256;
65constexpr size_t ipmbConnectionHeaderLength = 3;
66constexpr size_t ipmbResponseDataHeaderLength = 4;
67constexpr size_t ipmbRequestDataHeaderLength = 3;
68constexpr size_t ipmbAddressSize = 1;
1/* Copyright 2018 Intel
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *

--- 52 unchanged lines hidden (view full) ---

61/**
62 * @brief Ipmb defines
63 */
64constexpr size_t ipmbMaxDataSize = 256;
65constexpr size_t ipmbConnectionHeaderLength = 3;
66constexpr size_t ipmbResponseDataHeaderLength = 4;
67constexpr size_t ipmbRequestDataHeaderLength = 3;
68constexpr size_t ipmbAddressSize = 1;
69constexpr size_t ipmbPktLenSize = 1;
69constexpr size_t ipmbChecksumSize = 1;
70constexpr size_t ipmbChecksum2StartOffset = 3;
71constexpr size_t ipmbMinFrameLength = 7;
70constexpr size_t ipmbChecksumSize = 1;
71constexpr size_t ipmbChecksum2StartOffset = 3;
72constexpr size_t ipmbMinFrameLength = 7;
72constexpr size_t ipmbMaxFrameLength = ipmbConnectionHeaderLength +
73 ipmbResponseDataHeaderLength +
74 ipmbChecksumSize + ipmbMaxDataSize;
73constexpr size_t ipmbMaxFrameLength =
74 ipmbPktLenSize + ipmbConnectionHeaderLength + ipmbResponseDataHeaderLength +
75 ipmbChecksumSize + ipmbMaxDataSize;
75
76/**
77 * @brief Ipmb misc
78 */
79constexpr uint8_t ipmbNetFnResponseMask = 0x01;
80constexpr uint8_t ipmbLunMask = 0x03;
81constexpr uint8_t ipmbSeqMask = 0x3F;
82constexpr uint8_t ipmbRsLun = 0x0;

--- 177 unchanged lines hidden (view full) ---

260 public:
261 IpmbChannel(boost::asio::io_service &io, uint8_t ipmbBmcSlaveAddress,
262 uint8_t ipmbRqSlaveAddress, ipmbChannelType type,
263 std::shared_ptr<IpmbCommandFilter> commandFilter);
264
265 IpmbChannel(const IpmbChannel &) = delete;
266 IpmbChannel &operator=(IpmbChannel const &) = delete;
267
76
77/**
78 * @brief Ipmb misc
79 */
80constexpr uint8_t ipmbNetFnResponseMask = 0x01;
81constexpr uint8_t ipmbLunMask = 0x03;
82constexpr uint8_t ipmbSeqMask = 0x3F;
83constexpr uint8_t ipmbRsLun = 0x0;

--- 177 unchanged lines hidden (view full) ---

261 public:
262 IpmbChannel(boost::asio::io_service &io, uint8_t ipmbBmcSlaveAddress,
263 uint8_t ipmbRqSlaveAddress, ipmbChannelType type,
264 std::shared_ptr<IpmbCommandFilter> commandFilter);
265
266 IpmbChannel(const IpmbChannel &) = delete;
267 IpmbChannel &operator=(IpmbChannel const &) = delete;
268
268 int ipmbChannelInit(const char *ipmbI2cSlave, const char *ipmbI2cMaster);
269 int ipmbChannelInit(const char *ipmbI2cSlave);
269
270 int ipmbChannelUpdateSlaveAddress(const uint8_t newBmcSlaveAddr);
271
272 bool seqNumGet(uint8_t &seq);
273
274 ipmbChannelType getChannelType();
275
276 uint8_t getBusId();

--- 9 unchanged lines hidden (view full) ---

286 void ipmbSendI2cFrame(std::shared_ptr<std::vector<uint8_t>> buffer,
287 size_t retriesAttempted);
288
289 std::tuple<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>
290 requestAdd(boost::asio::yield_context &yield,
291 std::shared_ptr<IpmbRequest> requestToSend);
292
293 private:
270
271 int ipmbChannelUpdateSlaveAddress(const uint8_t newBmcSlaveAddr);
272
273 bool seqNumGet(uint8_t &seq);
274
275 ipmbChannelType getChannelType();
276
277 uint8_t getBusId();

--- 9 unchanged lines hidden (view full) ---

287 void ipmbSendI2cFrame(std::shared_ptr<std::vector<uint8_t>> buffer,
288 size_t retriesAttempted);
289
290 std::tuple<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>
291 requestAdd(boost::asio::yield_context &yield,
292 std::shared_ptr<IpmbRequest> requestToSend);
293
294 private:
294 boost::asio::ip::tcp::socket i2cSlaveSocket;
295 boost::asio::posix::stream_descriptor i2cMasterSocket;
295 boost::asio::posix::stream_descriptor i2cSlaveDescriptor;
296
296
297 int ipmbi2cMasterFd;
298 int ipmbi2cSlaveFd;
299
300 uint8_t ipmbBmcSlaveAddress;
301 uint8_t ipmbRqSlaveAddress;
302 uint8_t ipmbBusId;
303
304 ipmbChannelType type;
305

--- 49 unchanged lines hidden ---
297 int ipmbi2cSlaveFd;
298
299 uint8_t ipmbBmcSlaveAddress;
300 uint8_t ipmbRqSlaveAddress;
301 uint8_t ipmbBusId;
302
303 ipmbChannelType type;
304

--- 49 unchanged lines hidden ---