From de66bb8fdc5fcd0df7f75af71155852d0182d5c8 Mon Sep 17 00:00:00 2001 From: Cheng C Yang Date: Wed, 22 Jan 2020 10:58:39 +0800 Subject: Only rescan FRU on pmbus when PSU changes When a new PSU is inserted, only rescan the FRU on pmbus instead of rescan all the FRU on the system. Tested: Insert a new PSU, Redfish can show correct FRU of this PSU. Change-Id: I6868210868dda8f5f9f5fc5a52dad472cb129f88 Signed-off-by: Cheng C Yang --- psu-manager/src/cold_redundancy.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/psu-manager/src/cold_redundancy.cpp b/psu-manager/src/cold_redundancy.cpp index 8998771..d6bd241 100644 --- a/psu-manager/src/cold_redundancy.cpp +++ b/psu-manager/src/cold_redundancy.cpp @@ -44,6 +44,7 @@ static const constexpr char* rootPath = "/xyz/openbmc_project/CallbackManager"; static std::vector> powerSupplies; static std::vector addrTable = {0x50, 0x51}; +static uint8_t psuRescanBus = 7; static int pingFd = -1; ColdRedundancy::ColdRedundancy( @@ -338,11 +339,12 @@ int pingPSU(const uint8_t& addr) } void rescanPSUEntityManager( - std::shared_ptr& dbusConnection) + uint8_t bus, std::shared_ptr& dbusConnection) { sdbusplus::message::message method = dbusConnection->new_method_call( "xyz.openbmc_project.FruDevice", "/xyz/openbmc_project/FruDevice", - "xyz.openbmc_project.FruDeviceManager", "ReScan"); + "xyz.openbmc_project.FruDeviceManager", "ReScanBus"); + method.append(bus); try { @@ -392,7 +394,7 @@ void keepAlive(std::shared_ptr& dbusConnection) } if (newPSUFound) { - rescanPSUEntityManager(dbusConnection); + rescanPSUEntityManager(psuRescanBus, dbusConnection); } } @@ -503,6 +505,7 @@ void ColdRedundancy::createPSU( "entry in configuration\n"; return; } + psuRescanBus = *psuBus; addrTable = *psuAddress; if (setPingFd(pingFd, *psuBus)) { -- cgit v1.2.3