| /openbmc/phosphor-logging/extensions/openpower-pels/ |
| H A D | device_callouts.cpp | 1 // SPDX-License-Identifier: Apache-2.0 2 // SPDX-FileCopyrightText: Copyright 2020 IBM Corporation 8 #include <phosphor-logging/lg2.hpp> 16 constexpr auto debugFilePath = "/etc/phosphor-logging/"; 17 constexpr auto calloutFileSuffix = "_dev_callouts.json"; 27 auto basePath = getPELReadOnlyDataPath(); in getJSONFilename() 37 for (const auto& name : names) in getJSONFilename() 73 * @param[in] compatibleList - The list of compatible names for this 76 * @return nlohmann::json - The JSON object 80 auto filename = getJSONFilename(compatibleList); in loadJSON() [all …]
|
| /openbmc/phosphor-power/phosphor-regulators/test/ |
| H A D | device_tests.cpp | 8 * http://www.apache.org/licenses/LICENSE-2.0 70 auto chassis = std::make_unique<Chassis>(1, chassisInvPath); 71 this->chassis = chassis.get(); 77 this->system = 98 std::unique_ptr<i2c::I2CInterface> i2cInterface = createI2CInterface(); in TEST_F() 99 i2c::I2CInterface* i2cInterfacePtr = i2cInterface.get(); in TEST_F() 114 std::unique_ptr<i2c::I2CInterface> i2cInterface = createI2CInterface(); in TEST_F() 115 i2c::I2CInterface* i2cInterfacePtr = i2cInterface.get(); in TEST_F() 120 auto presenceDetection = in TEST_F() 128 auto configuration = in TEST_F() [all …]
|
| H A D | chassis_tests.cpp | 8 * http://www.apache.org/licenses/LICENSE-2.0 151 auto presenceDetection = in TEST_F() 156 auto i2cInterface = std::make_unique<i2c::MockedI2CInterface>(); in TEST_F() 157 auto device = std::make_unique<Device>( in TEST_F() 170 presenceDetectionPtr->execute(services, *system, chassis, *devicePtr); in TEST_F() 171 EXPECT_TRUE(presenceDetectionPtr->getCachedPresence().has_value()); in TEST_F() 177 EXPECT_FALSE(presenceDetectionPtr->getCachedPresence().has_value()); in TEST_F() 183 auto action = std::make_unique<MockAction>(); in TEST_F() 188 auto sensorMonitoring = in TEST_F() 193 auto rail = std::make_unique<Rail>("vddr1", std::move(configuration), in TEST_F() [all …]
|
| H A D | phase_fault_detection_tests.cpp | 8 * http://www.apache.org/licenses/LICENSE-2.0 65 * - Regulator Device 66 * - I/O expander Device 67 * - Chassis that contains the Devices 68 * - System that contains the Chassis 77 auto regI2CInterface = std::make_unique<i2c::MockedI2CInterface>(); 78 this->regI2CInterface = regI2CInterface.get(); 81 auto regulator = std::make_unique<Device>( 85 this->regulator = regulator.get(); 88 auto ioExpI2CInterface = std::make_unique<i2c::MockedI2CInterface>(); [all …]
|
| H A D | sensor_monitoring_tests.cpp | 8 * http://www.apache.org/licenses/LICENSE-2.0 73 std::tuple<std::unique_ptr<System>, Chassis*, Device*, i2c::MockedI2CInterface*, 84 std::unique_ptr<i2c::MockedI2CInterface> i2cInterface = in createParentObjects() 85 std::make_unique<i2c::MockedI2CInterface>(); in createParentObjects() 86 i2c::MockedI2CInterface* i2cInterfacePtr = i2cInterface.get(); in createParentObjects() 146 auto [system, chassis, device, i2cInterface, rail] = in TEST() 153 i2c::I2CException{"Failed to read word data", "/dev/i2c-1", 0x70})); in TEST() 157 auto setExpectations = [](MockServices& services) { in TEST() 170 // Expect ErrorLogging service to be called once to log an I2C error in TEST() 183 monitoring->execute(services, *system, *chassis, *device, *rail); in TEST() [all …]
|
| H A D | system_tests.cpp | 8 * http://www.apache.org/licenses/LICENSE-2.0 77 EXPECT_EQ(system.getChassis()[0]->getNumber(), 1); in TEST() 83 EXPECT_EQ(system.getRules()[0]->getID(), "set_voltage_rule"); in TEST() 90 auto presenceDetection = in TEST() 95 auto i2cInterface = std::make_unique<i2c::MockedI2CInterface>(); in TEST() 96 auto device = std::make_unique<Device>( in TEST() 105 auto chassis = in TEST() 117 presenceDetectionPtr->execute(services, system, *chassisPtr, *devicePtr); in TEST() 118 EXPECT_TRUE(presenceDetectionPtr->getCachedPresence().has_value()); in TEST() 124 EXPECT_FALSE(presenceDetectionPtr->getCachedPresence().has_value()); in TEST() [all …]
|
| /openbmc/entity-manager/src/fru_device/ |
| H A D | fru_device.cpp | 1 // SPDX-License-Identifier: Apache-2.0 2 // SPDX-FileCopyrightText: Copyright 2018 Intel Corporation 14 #include <phosphor-logging/lg2.hpp> 44 #include <i2c/smbus.h> 45 #include <linux/i2c-dev.h> 63 // NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables) 75 // NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables) 91 output << "/sys/bus/i2c/devices/" << bus << "-" << std::right in getEepromPath() 99 auto path = getEepromPath(bus, address); in hasEepromFile() 112 auto result = lseek(fd, offset, SEEK_SET); in readFromEeprom() [all …]
|
| /openbmc/google-ipmi-sys/ |
| H A D | util.cpp | 7 // http://www.apache.org/licenses/LICENSE-2.0 18 #include <phosphor-logging/elog-errors.hpp> 49 auto data = nlohmann::json::parse(jsonFile, nullptr, false); in parseConfig() 66 auto msg = std::string("Unable to open file ") + fileName.c_str(); in readPropertyFile() 96 // Build a vector with i2c bus to pcie slot mapping. in buildPcieMap() 97 // Iterate through all the devices under "/sys/bus/i2c/devices". in buildPcieMap() 98 for (const auto& i2c_dev : fs::directory_iterator("/sys/bus/i2c/devices")) in buildPcieMap() 102 std::regex e("(i2c-)(\\d+)"); in buildPcieMap() 104 // Check if the device has "i2c-" in its path. in buildPcieMap() 107 // Check if the i2c device has "pcie-slot" file under "of-node" dir. in buildPcieMap() [all …]
|
| /openbmc/phosphor-power/tools/power-utils/test/ |
| H A D | test_updater.cpp | 8 * http://www.apache.org/licenses/LICENSE-2.0 35 using MockedI2CInterface = i2c::MockedI2CInterface; 36 using I2CInterface = i2c::I2CInterface; 49 auto tmpPath = fs::temp_directory_path(); in setupDeviceSysfs() 56 realDevicePath = fs::path(tmpDir) / "devices/3-0068"; in setupDeviceSysfs() 57 devPath = fs::path(tmpDir) / "i2c"; in setupDeviceSysfs() 61 devPath /= "3-0068"; in setupDeviceSysfs() 67 return *reinterpret_cast<MockedI2CInterface*>(updater->i2c.get()); in getMockedI2c() 87 updater->createI2CDevice(); in TEST_F() 88 auto& i2c = getMockedI2c(); in TEST_F() local [all …]
|
| H A D | test_utils.cpp | 8 * http://www.apache.org/licenses/LICENSE-2.0 27 auto ret = getDeviceName(""); in TEST() 30 ret = getDeviceName("/sys/bus/i2c/devices/3-0069"); in TEST() 31 EXPECT_EQ("3-0069", ret); in TEST() 33 ret = getDeviceName("/sys/bus/i2c/devices/3-0069/"); in TEST() 34 EXPECT_EQ("3-0069", ret); in TEST() 39 auto [id, addr] = parseDeviceName("3-0068"); in TEST() 43 std::tie(id, addr) = parseDeviceName("11-0069"); in TEST() 47 EXPECT_THROW(parseDeviceName("no-number"), std::invalid_argument); in TEST()
|
| /openbmc/phosphor-power/tools/power-utils/ |
| H A D | updater.hpp | 8 * http://www.apache.org/licenses/LICENSE-2.0 33 constexpr auto FW_UPDATE_FAILED_MSG = 35 constexpr auto PSU_FW_FILE_ISSUE_MSG = 37 constexpr auto FW_UPDATE_SUCCESS_MSG = 40 constexpr auto ERROR_SEVERITY = "xyz.openbmc_project.Logging.Entry.Level.Error"; 41 constexpr auto INFORMATIONAL_SEVERITY = 47 * @param[in] bus - The sdbusplus DBus bus connection 48 * @param[in] psuInventoryPath - The inventory path of the PSU 49 * @param[in] imageDir - The directory containing the PSU image 61 * @param[in] bus - The sdbusplus DBus bus connection [all …]
|
| H A D | utils.cpp | 8 * http://www.apache.org/licenses/LICENSE-2.0 22 #include <phosphor-logging/lg2.hpp> 42 constexpr auto IBMCFFPSInterface = 44 constexpr auto i2cBusProp = "I2CBus"; 45 constexpr auto i2cAddressProp = "I2CAddress"; 49 auto depth = 0; in getPsuI2c() 50 auto objects = getSubTree(bus, "/", IBMCFFPSInterface, depth); in getPsuI2c() 61 for (const auto& [path, services] : objects) in getPsuI2c() 63 auto service = services.begin()->first; in getPsuI2c() 79 auto properties = in getPsuI2c() [all …]
|
| H A D | aei_updater.cpp | 8 * http://www.apache.org/licenses/LICENSE-2.0 27 #include <phosphor-logging/lg2.hpp> 45 constexpr uint8_t BLOCK_WRITE_SIZE = 0x25; // I2C block write size 62 constexpr uint8_t CMD_BOOT_ISP = 0x02; // Boot the In-System Programming System. 81 {"I2C_INTERFACE", "I2C interface is null pointer."}}; in doUpdate() 82 // Callout PSU & I2C in doUpdate() 85 throw std::runtime_error("I2C interface error"); in doUpdate() 105 if (retryProcessTwo == (MAX_RETRIES - 1)) in doUpdate() 138 // procedure one time starting with re-writing initial ISP in doUpdate() 173 if ((retryProcessOne < (MAX_RETRIES - 1)) && in doUpdate() [all …]
|
| H A D | updater.cpp | 8 * http://www.apache.org/licenses/LICENSE-2.0 27 #include <phosphor-logging/lg2.hpp> 44 // Define the CRC-8 polynomial (CRC-8-CCITT) 67 for (const auto& entry : fs::directory_iterator(directory)) in getFWFilenamePath() 82 // Compute CRC-8 checksum for a vector of bytes 87 for (const auto& byte : data) in calculateCRC8() 130 auto fileSize = std::filesystem::file_size(fileName); in validateFWFile() 147 auto inputFile = in openFirmwareFile() 149 if (!inputFile->is_open()) in openFirmwareFile() 187 auto devPath = utils::getDevicePath(bus, psuInventoryPath); in update() [all …]
|
| /openbmc/dbus-sensors/src/ |
| H A D | DeviceMgmt.cpp | 5 #include <phosphor-logging/lg2.hpp> 22 auto findType = cfg.find("Type"); in getI2CDeviceParams() 23 auto findBus = cfg.find("Bus"); in getI2CDeviceParams() 24 auto findAddr = cfg.find("Address"); in getI2CDeviceParams() 31 const std::string* type = std::get_if<std::string>(&findType->second); in getI2CDeviceParams() 32 const uint64_t* bus = std::get_if<uint64_t>(&findBus->second); in getI2CDeviceParams() 33 const uint64_t* addr = std::get_if<uint64_t>(&findAddr->second); in getI2CDeviceParams() 40 auto findDevType = dtmap.find(type->c_str()); in getI2CDeviceParams() 46 return I2CDeviceParams(findDevType->second, *bus, *addr); in getI2CDeviceParams() 51 return {"/sys/bus/i2c/devices/i2c-" + std::to_string(bus)}; in i2cBusPath() [all …]
|
| /openbmc/phosphor-fan-presence/presence/ |
| H A D | eeprom_device.hpp | 5 #include <phosphor-logging/lg2.hpp> 36 * @param[in] address - The bus-address string as used by drivers 38 * @param[in] driver - The I2C driver name in sysfs 39 * @param[in] bindDelayInMS - The time in milliseconds to wait 79 auto bindPath = path / "bind"; in bindTimerExpired() 101 auto devicePath = path / address; in unbindDevice() 107 auto unbindPath = path / "unbind"; in unbindDevice() 122 /** @brief The base I2C drivers directory in sysfs */ 123 const std::filesystem::path baseDriverPath{"/sys/bus/i2c/drivers"}; 126 * @brief The address string with the i2c bus and address. [all …]
|
| /openbmc/ipmbbridge/ |
| H A D | ipmbbridged.cpp | 7 * http://www.apache.org/licenses/LICENSE-2.0 25 #include <phosphor-logging/log.hpp> 41 auto conn = std::make_shared<sdbusplus::asio::connection>(io); 74 // constructing ipmb request from i2c buffer in i2cToIpmbConstruct() 75 netFn = ipmbNetFnGet(ipmbBuffer->Header.Req.rsNetFnLUN); in i2cToIpmbConstruct() 76 rsLun = ipmbLunFromNetFnLunGet(ipmbBuffer->Header.Req.rsNetFnLUN); in i2cToIpmbConstruct() 77 rqSA = ipmbBuffer->Header.Req.rqSA; in i2cToIpmbConstruct() 78 seq = ipmbSeqGet(ipmbBuffer->Header.Req.rqSeqLUN); in i2cToIpmbConstruct() 79 rqLun = ipmbLunFromSeqLunGet(ipmbBuffer->Header.Req.rqSeqLUN); in i2cToIpmbConstruct() 80 cmd = ipmbBuffer->Header.Req.cmd; in i2cToIpmbConstruct() [all …]
|
| /openbmc/phosphor-logging/test/openpower-pels/ |
| H A D | device_callouts_test.cpp | 1 // SPDX-License-Identifier: Apache-2.0 2 // SPDX-FileCopyrightText: Copyright 2020 IBM Corporation 4 #include "extensions/openpower-pels/device_callouts.hpp" 5 #include "extensions/openpower-pels/paths.hpp" 16 // "I2C": 25 // "FSI-I2C": 31 // "FSI-SPI": 36 const auto calloutJSON = R"( 38 "I2C": 47 "LocationCode": "P1-C19", [all …]
|
| /openbmc/u-boot/drivers/i2c/ |
| H A D | exynos_hs_i2c.c | 1 // SPDX-License-Identifier: GPL-2.0+ 11 #include <i2c.h> 19 /* HSI2C-specific register description */ 96 * @param i2c: pointer to the appropriate register bank 102 static int hsi2c_wait_for_trx(struct exynos5_hsi2c *i2c) in hsi2c_wait_for_trx() argument 106 while (i-- > 0) { in hsi2c_wait_for_trx() 107 u32 int_status = readl(&i2c->usi_int_stat); in hsi2c_wait_for_trx() 110 u32 trans_status = readl(&i2c->usi_trans_status); in hsi2c_wait_for_trx() 113 writel(int_status, &i2c->usi_int_stat); in hsi2c_wait_for_trx() 141 struct exynos5_hsi2c *hsregs = i2c_bus->hsregs; in hsi2c_get_clk_details() [all …]
|
| /openbmc/ibm-logging/ |
| H A D | policy_find.cpp | 8 * http://www.apache.org/licenses/LICENSE-2.0 18 #include <phosphor-logging/log.hpp> 29 static constexpr auto HOST_EVENT = "org.open_power.Host.Error.Event"; 34 * @tparam - T the property data type 35 * @param[in] properties - the property map 36 * @param[in] name - the property name 38 * @return optional<T> - the property value 44 auto prop = properties.find(name); in getProperty() 48 return std::get<T>(prop->second); in getProperty() 60 * @param[in] additionalData - the AdditionalData property contents [all …]
|
| /openbmc/phosphor-power/ |
| H A D | pmbus.hpp | 15 constexpr auto READ_VIN = "in1_input"; 18 constexpr auto MFR_POUT_MAX = "max_power_out"; 20 constexpr auto IBM_CFFPS_1400W = 30725; 25 constexpr auto VIN_VOLTAGE_MIN = 20; 26 constexpr auto VIN_VOLTAGE_110_THRESHOLD = 160; 32 constexpr auto VIN_VOLTAGE_0 = 0; 33 constexpr auto VIN_VOLTAGE_110 = 110; 34 constexpr auto VIN_VOLTAGE_220 = 220; 38 constexpr auto STATUS_WORD = "status0"; 41 constexpr auto STATUS_INPUT = "status0_input"; [all …]
|
| /openbmc/dbus-sensors/src/mcu/ |
| H A D | MCUTempSensor.cpp | 8 // http://www.apache.org/licenses/LICENSE-2.0 25 #include <linux/i2c.h> 34 #include <phosphor-logging/lg2.hpp> 52 #include <i2c/smbus.h> 53 #include <linux/i2c-dev.h> 79 for (const auto& threshold : thresholds) in MCUTempSensor() 94 for (const auto& iface : thresholdInterfaces) in ~MCUTempSensor() 115 std::string i2cBus = "/dev/i2c-" + std::to_string(busId); in getMCURegsInfoWord() 117 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) in getMCURegsInfoWord() 121 lg2::error("unable to open i2c device '{BUS}' err = '{ERR}'", "BUS", in getMCURegsInfoWord() [all …]
|
| /openbmc/phosphor-bmc-code-mgmt/i2c-vr/mps/ |
| H A D | mps.hpp | 3 #include "common/include/i2c/i2c.hpp" 4 #include "i2c-vr/vr.hpp" 6 #include <phosphor-logging/lg2.hpp> 20 * Each enumerator corresponds to a tab-separated column index. 38 * type0: 7-columns ATE image without write/read command information. 40 * type1: 8-columns ATE image that includes write/read command information, 117 pointer operator->() const in operator ->() 130 auto result = *this; in operator ++() 158 auto newlinePos = remaining.find('\n'); in next() 174 auto end = line.find('\t', start); in next() [all …]
|
| /openbmc/phosphor-host-ipmid/libipmid/ |
| H A D | utils.cpp | 4 #include <linux/i2c-dev.h> 5 #include <linux/i2c.h> 12 #include <phosphor-logging/elog-errors.hpp> 13 #include <phosphor-logging/lg2.hpp> 34 * @param[in] ipaddress - IPAddress. 67 objectTree.begin()->first, in getDbusObject() 68 std::move(objectTree.begin()->second.begin()->first)); in getDbusObject() 73 auto found = std::find_if( in getDbusObject() 74 objectTree.begin(), objectTree.end(), [&match](const auto& object) { in getDbusObject() 86 return make_pair(found->first, std::move(found->second.begin()->first)); in getDbusObject() [all …]
|
| /openbmc/u-boot/cmd/aspeed/ |
| H A D | dptest.h | 1 /* SPDX-License-Identifier: GPL-2.0+ 43 /* i2c control */ 64 /* Re-driver setting */ 80 /* I2C write over AUX command with MOT */ 82 /* I2C write over AUX command with MOT and stop by addr */ 85 /* I2C read over AUX command with MOT */ 87 /* I2C read over AUX command with MOT and stop by addr */ 90 /* I2C write over AUX command */ 92 /* I2C write over AUX command stop by addr */ 95 /* I2C read over AUX command */ [all …]
|