Extended support for 16bit logic bus
This commit will add the support of 16 bit logical bus.
Tested :
all EEPROM fru getting listed Successfully which were connected
to 8 and 16 bit logical bus.
dependent commit:-
https://gerrit.openbmc.org/c/openbmc/entity-manager/+/58634
Signed-off-by: krishnar4 <krishnar@ami.com>
Change-Id: I547ef8a27fdc74ec34a421c4cf5949c29fcc77b4
diff --git a/dbus-sdr/storagecommands.cpp b/dbus-sdr/storagecommands.cpp
index 17ed9ff..b50db1a 100644
--- a/dbus-sdr/storagecommands.cpp
+++ b/dbus-sdr/storagecommands.cpp
@@ -112,12 +112,14 @@
constexpr static const uint8_t deassertionEvent = 0x80;
static std::vector<uint8_t> fruCache;
-static uint8_t cacheBus = 0xFF;
-static uint8_t cacheAddr = 0XFF;
+static constexpr uint16_t invalidBus = 0xFFFF;
+static constexpr uint8_t invalidAddr = 0xFF;
+static uint16_t cacheBus = invalidBus;
+static uint8_t cacheAddr = invalidAddr;
static uint8_t lastDevId = 0xFF;
-static uint8_t writeBus = 0xFF;
-static uint8_t writeAddr = 0XFF;
+static uint16_t writeBus = invalidBus;
+static uint8_t writeAddr = invalidAddr;
std::unique_ptr<phosphor::Timer> writeTimer = nullptr;
static std::vector<sdbusplus::bus::match_t> fruMatches;
@@ -126,12 +128,12 @@
// we unfortunately have to build a map of hashes in case there is a
// collision to verify our dev-id
-boost::container::flat_map<uint8_t, std::pair<uint8_t, uint8_t>> deviceHashes;
+boost::container::flat_map<uint8_t, std::pair<uint16_t, uint8_t>> deviceHashes;
void registerStorageFunctions() __attribute__((constructor));
bool writeFru(const std::vector<uint8_t>& fru)
{
- if (writeBus == 0xFF && writeAddr == 0xFF)
+ if (writeBus == invalidBus && writeAddr == invalidAddr)
{
return true;
}
@@ -152,8 +154,8 @@
"error writing fru");
return false;
}
- writeBus = 0xFF;
- writeAddr = 0xFF;
+ writeBus = invalidBus;
+ writeAddr = invalidAddr;
return true;
}
@@ -193,7 +195,7 @@
continue;
}
- uint8_t fruBus = std::get<uint32_t>(busFind->second);
+ uint16_t fruBus = std::get<uint32_t>(busFind->second);
uint8_t fruAddr = std::get<uint32_t>(addrFind->second);
auto chassisFind = fruIface->second.find("CHASSIS_TYPE");
std::string chassisType;
@@ -213,7 +215,7 @@
fruHash = 1;
}
}
- std::pair<uint8_t, uint8_t> newDev(fruBus, fruAddr);
+ std::pair<uint16_t, uint8_t> newDev(fruBus, fruAddr);
bool emplacePassed = false;
while (!emplacePassed)
@@ -286,8 +288,8 @@
"Couldn't get raw fru",
phosphor::logging::entry("ERROR=%s", ec.message().c_str()));
- cacheBus = 0xFF;
- cacheAddr = 0xFF;
+ cacheBus = invalidBus;
+ cacheAddr = invalidAddr;
return {ipmi::ccResponseError, {}};
}
@@ -577,7 +579,7 @@
return IPMI_CC_INVALID_FIELD_REQUEST;
}
auto device = deviceHashes.begin() + index;
- uint8_t& bus = device->second.first;
+ uint16_t& bus = device->second.first;
uint8_t& address = device->second.second;
boost::container::flat_map<std::string, Value>* fruData = nullptr;