Lines Matching +full:mux +full:- +full:add +full:- +full:data

8 //      http://www.apache.org/licenses/LICENSE-2.0
41 #include <linux/i2c-dev.h>
97 rootBus = -1; in clearConfig()
116 int file = -1;
130 file = open(("/dev/i2c-" + std::to_string(bus)).c_str(), in initialize()
135 << "\" - Unable to open bus : " << bus << "\n"; in initialize()
143 << "\" - Unable to set address to " << address in initialize()
156 << "\" - Byte map error ! Unable to find " in initialize()
167 << "\" - Error: Unable to read data from clock " in initialize()
176 * ignore where byteMap is "-"). We do not want to touch other in initialize()
180 if (byte->second.at(bit) != "-") in initialize()
186 /* TODO: This code might require a re-visit in case of in initialize()
202 << "\" - Error: Unable to write data to clock " in initialize()
268 << "\" - Byte map error ! Unable to find " << byteName in enableDisableClock()
279 << "\" - Error: Unable to read data from clock " in enableDisableClock()
294 if (nvmeDrivesInserted.remove(byte->second.at(bit))) in enableDisableClock()
301 if (nvmeDrivesRemoved.remove(byte->second.at(bit))) in enableDisableClock()
320 << "\" - Error: Unable to write data to clock " in enableDisableClock()
349 int file = -1;
358 file = open(("/dev/i2c-" + std::to_string(bus)).c_str(), in initialize()
363 << " - Unable to open bus : " << bus << "\n"; in initialize()
371 << "\" - Unable to set address to " << address << "\n"; in initialize()
383 << "\" - IO map error ! Unable to find " << ioName in initialize()
394 << "\" - Error: Unable to read data from io expander " in initialize()
405 << "\" - Error: Unable to read data from io expander " in initialize()
415 * ignore where ioMap is "-"). We do not want to touch other in initialize()
419 if (io->second.at(bit) != "-") in initialize()
440 << "\" - Error: Unable to write data to IO expander " in initialize()
452 << "\" - Error: Unable to write data to IO expander " in initialize()
509 << "\" - IO map error ! Unable to find " << ioName in enableDisableOuput()
520 << "\" - Error: Unable to read data from io expander " in enableDisableOuput()
535 if (nvmeDrivesInserted.remove(io->second.at(bit))) in enableDisableOuput()
542 if (nvmeDrivesRemoved.remove(io->second.at(bit))) in enableDisableOuput()
561 << "\" - Error: Unable to write data to IO expander " in enableDisableOuput()
604 struct Mux struct
606 Mux(size_t busIn, size_t addressIn, size_t channelsIn, size_t indexIn) : in Mux() function
615 bool operator<(const Mux& rhs) const in operator <() argument
643 ledInterface->register_property( in createInterface()
664 if (!self->set(pattern)) in createInterface()
672 ledInterface->initialize(); in createInterface()
701 itemIface->register_property("Present", isPresent); in Drive()
702 itemIface->register_property("PrettyName", driveName); in Drive()
703 itemIface->initialize(); in Drive()
705 itemIface->get_object_path(), in Drive()
708 operationalIface->register_property( in Drive()
729 operationalIface->initialize(); in Drive()
731 itemIface->get_object_path(), "xyz.openbmc_project.State.Drive"); in Drive()
732 rebuildingIface->register_property("Rebuilding", rebuilding); in Drive()
733 rebuildingIface->initialize(); in Drive()
735 objServer.add_interface(itemIface->get_object_path(), in Drive()
737 driveIface->initialize(); in Drive()
738 associations = objServer.add_interface(itemIface->get_object_path(), in Drive()
740 associations->register_property("Associations", in Drive()
742 associations->initialize(); in Drive()
766 const boost::container::flat_map<std::string, std::string>& data) in createAsset()
773 itemIface->get_object_path(), in createAsset()
775 for (const auto& [key, value] : data) in createAsset()
777 assetIface->register_property(key, value); in createAsset()
784 assetIface->initialize(); in createAsset()
798 operationalIface->set_property("Functional", false); in markFailed()
801 associations->set_property("Associations", warning); in markFailed()
807 operationalIface->set_property("Functional", true); in clearFailed()
808 associations->set_property("Associations", std::vector<Association>{}); in clearFailed()
818 itemIface->set_property("Present", set); in setPresent()
865 bus(busIn), address(addressIn), backplaneIndex(backplaneIndexIn - 1), in Backplane()
867 muxes(std::make_shared<boost::container::flat_set<Mux>>()) in Backplane()
871 conn->async_method_call( in populateAsset()
891 assetIface->register_property(key, *ptr); in populateAsset()
893 assetIface->initialize(); in populateAsset()
909 file = open(("/dev/i2c-" + std::to_string(bus)).c_str(), in run()
936 hsbpItemIface->register_property("Present", true); in run()
937 hsbpItemIface->register_property("PrettyName", name); in run()
938 hsbpItemIface->initialize(); in run()
941 hsbpItemIface->get_object_path(), in run()
943 storageInterface->initialize(); in run()
946 objServer.add_interface(hsbpItemIface->get_object_path(), assetTag); in run()
951 versionIface->register_property( in run()
954 versionIface->register_property( in run()
958 versionIface->initialize(); in run()
963 activationIface->register_property( in run()
967 activationIface->register_property( in run()
971 activationIface->initialize(); in run()
1007 self->runTimer(); in runTimer()
1011 self->getPresence(self->presence); in runTimer()
1012 self->getIFDET(self->ifdet); in runTimer()
1013 self->getFailed(self->failed); in runTimer()
1014 self->getRebuild(self->rebuilding); in runTimer()
1016 self->updateDrives(); in runTimer()
1017 self->runTimer(); in runTimer()
1037 drive.itemIface->get_object_path(), ii, file)); in createDrives()
1038 led->createInterface(); in createDrives()
1054 it->isNvme = isNvme; in updateDrives()
1055 it->setPresent(isPresent); in updateDrives()
1056 it->logPresent(); in updateDrives()
1058 it->rebuildingIface->set_property("Rebuilding", isRebuilding); in updateDrives()
1061 it->markFailed(); in updateDrives()
1065 it->clearFailed(); in updateDrives()
1248 nvmeDrivesInserted.emplace_front(nvmeMap->second.at(index)); in getInsertedAndRemovedNvmeDrives()
1257 nvmeDrivesRemoved.emplace_front(nvmeMap->second.at(index)); in getInsertedAndRemovedNvmeDrives()
1298 int file = -1;
1309 std::shared_ptr<boost::container::flat_set<Mux>> muxes;
1366 std::cerr << __FUNCTION__ << ": Stopping hsbp-manager\n"; in stopHsbpManager()
1459 backplane->getInsertedAndRemovedNvmeDrives(nvmeDrivesInserted, in scanHsbpDrives()
1494 /* There is already a Re-Scan in queue. No need to create multiple in checkHsbpDrivesStatus()
1504 driveScanTimer->expires_after(std::chrono::seconds(1)); in checkHsbpDrivesStatus()
1505 driveScanTimer->async_wait( in checkHsbpDrivesStatus()
1541 count += backplane->drives.size(); in getDriveCount()
1563 conn->async_method_call( in updateAssets()
1570 drivesLoadedCallback->setError(); in updateAssets()
1584 const std::string& owner = objDict.begin()->first; in updateAssets()
1590 if (std::find(objDict.begin()->second.begin(), in updateAssets()
1591 objDict.begin()->second.end(), assetTag) == in updateAssets()
1592 objDict.begin()->second.end()) in updateAssets()
1598 conn->async_method_call( in updateAssets()
1610 drivesLoadedCallback->setError(); in updateAssets()
1620 drivesLoadedCallback->setError(); in updateAssets()
1624 // find the mux bus and addr in updateAssets()
1626 std::get<uint64_t>(findBus->second)); in updateAssets()
1628 "/sys/bus/i2c/devices/i2c-" + in updateAssets()
1632 std::cerr << path << " mux does not exist\n"; in updateAssets()
1633 drivesLoadedCallback->setError(); in updateAssets()
1637 // we should be getting something of the form 7-0052 in updateAssets()
1641 auto findDash = fname.find('-'); in updateAssets()
1646 std::cerr << path << " mux path invalid\n"; in updateAssets()
1647 drivesLoadedCallback->setError(); in updateAssets()
1659 // find the channel of the mux the drive is on in updateAssets()
1661 "/sys/bus/i2c/devices/i2c-" + in updateAssets()
1668 drivesLoadedCallback->setError(); in updateAssets()
1675 // file is of the form "i2c-4-mux (chan_id 1)", get chan in updateAssets()
1715 for (const Mux& mux : *(backplane->muxes)) in updateAssets()
1717 if (bus == mux.bus && addr == mux.address) in updateAssets()
1722 muxIndex += mux.channels; in updateAssets()
1745 if (parent->drives.size() <= driveIndex) in updateAssets()
1750 drivesLoadedCallback->setError(); in updateAssets()
1753 auto it = parent->drives.begin(); in updateAssets()
1756 it->createAsset(assetInventory); in updateAssets()
1766 void populateMuxes(std::shared_ptr<boost::container::flat_set<Mux>> muxes, in populateMuxes()
1775 conn->async_method_call( in populateMuxes()
1787 if (objDict.empty() || objDict.begin()->second.empty()) in populateMuxes()
1792 const std::string& owner = objDict.begin()->first; in populateMuxes()
1794 objDict.begin()->second; in populateMuxes()
1809 std::cerr << __FUNCTION__ << ": Cannot get mux type\n"; in populateMuxes()
1813 conn->async_method_call( in populateMuxes()
1839 std::get<uint64_t>(findBus->second)); in populateMuxes()
1841 std::get<uint64_t>(findAddress->second)); in populateMuxes()
1844 findChannelNames->second); in populateMuxes()
1845 muxes->emplace(bus, address, channels.size(), index); in populateMuxes()
1863 conn->async_method_call( in populateHsbpBackplanes()
1870 backplanesLoadedCallback->setError(); in populateHsbpBackplanes()
1889 << ": Subtree data " in populateHsbpBackplanes()
1891 backplanesLoadedCallback->setError(); in populateHsbpBackplanes()
1895 const std::string& owner = objDict.begin()->first; in populateHsbpBackplanes()
1896 conn->async_method_call( in populateHsbpBackplanes()
1906 backplanesLoadedCallback->setError(); in populateHsbpBackplanes()
1937 backplanesLoadedCallback->setError(); in populateHsbpBackplanes()
1945 backplane->second->run(parentPath, owner); in populateHsbpBackplanes()
1946 populateMuxes(backplane->second->muxes, parentPath); in populateHsbpBackplanes()
1975 /* There is already a Re-Scan in queue. No need to create multiple in setUpBackplanesAndDrives()
1986 backplaneScanTimer->expires_after(std::chrono::seconds(1)); in setUpBackplanesAndDrives()
1987 backplaneScanTimer->async_wait( in setUpBackplanesAndDrives()
2075 * have to be re-discovered. So, setting state to in setupBackplanesAndDrivesMatch()
2095 backplaneTimer->expires_after(std::chrono::seconds(2)); in setupBackplanesAndDrivesMatch()
2096 backplaneTimer->async_wait( in setupBackplanesAndDrivesMatch()
2136 * have to be re-discovered. So, setting state to in setupBackplanesAndDrivesMatch()
2156 driveTimer->expires_after(std::chrono::seconds(2)); in setupBackplanesAndDrivesMatch()
2157 driveTimer->async_wait( in setupBackplanesAndDrivesMatch()
2223 conn->async_method_call( in loadIoExpanderInfo()
2230 componentsLoadedCallback->setError(); in loadIoExpanderInfo()
2238 std::cerr << __FUNCTION__ << ": Subtree data corrupted !\n"; in loadIoExpanderInfo()
2239 componentsLoadedCallback->setError(); in loadIoExpanderInfo()
2246 const std::string& service = objDict.begin()->first; in loadIoExpanderInfo()
2247 const std::string& intf = objDict.begin()->second.front(); in loadIoExpanderInfo()
2249 conn->async_method_call( in loadIoExpanderInfo()
2260 componentsLoadedCallback->setError(); in loadIoExpanderInfo()
2325 componentsLoadedCallback->setError(); in loadIoExpanderInfo()
2334 componentsLoadedCallback->setError(); in loadIoExpanderInfo()
2338 /* Create IO expander object and add it to global in loadIoExpanderInfo()
2364 conn->async_method_call( in loadClockBufferInfo()
2371 componentsLoadedCallback->setError(); in loadClockBufferInfo()
2379 std::cerr << __FUNCTION__ << ": Subtree data corrupted !\n"; in loadClockBufferInfo()
2380 componentsLoadedCallback->setError(); in loadClockBufferInfo()
2387 const std::string& service = objDict.begin()->first; in loadClockBufferInfo()
2388 const std::string& intf = objDict.begin()->second.front(); in loadClockBufferInfo()
2390 conn->async_method_call( in loadClockBufferInfo()
2401 componentsLoadedCallback->setError(); in loadClockBufferInfo()
2467 componentsLoadedCallback->setError(); in loadClockBufferInfo()
2477 componentsLoadedCallback->setError(); in loadClockBufferInfo()
2481 /* Create clock buffer object and add it to global in loadClockBufferInfo()
2503 conn->async_method_call( in loadHsbpConfig()
2532 auto& path = subtree.begin()->first; in loadHsbpConfig()
2533 auto& objDict = subtree.begin()->second; in loadHsbpConfig()
2538 std::cerr << __FUNCTION__ << ": Subtree data corrupted !\n"; in loadHsbpConfig()
2543 const std::string& service = objDict.begin()->first; in loadHsbpConfig()
2545 conn->async_method_call( in loadHsbpConfig()
2622 /* Loop through to get HSBP-NVME map and Components map in loadHsbpConfig()
2642 /* Check if we were able to get all the HSBP-NVMe maps */ in loadHsbpConfig()
2722 * come here, its either the first initialization or entity-manager in setupHsbpConfigMatch()
2737 loadTimer->expires_after(std::chrono::seconds(1)); in setupHsbpConfigMatch()
2738 loadTimer->async_wait( in setupHsbpConfigMatch()
2820 {"hsbp-manager", gpiod::line_request::EVENT_BOTH_EDGES, 0}); in hsbpRequestAlertGpioEvents()
2855 std::cerr << "******* Starting hsbp-manager *******\n"; in main()
2858 conn->request_name(busName); in main()
2862 /* Add interface for storage inventory */ in main()
2867 storageIface->initialize(); in main()
2871 * 2. Set up Dbus match for power - determine if host is up and running in main()
2875 * - Also setup a match to capture HSBP configuation in case in main()
2876 * entity-manager restarts in main()
2879 * - Reload the info each time HSBP configuration is changed in main()
2892 return -1; in main()
2895 /* Setup Dbus-match for power */ in main()
2898 /* Setup Dbus-match for HSBP backplanes and Drives */ in main()
2902 * In the event of entity-manager reboot, the match will help catch new in main()
2904 * In the event of hsbp-manager reboot, loadHsbpConfig will get all in main()
2912 std::cerr << __FUNCTION__ << ": Aborting hsbp-manager !\n"; in main()
2913 return -1; in main()