Get i2c addresses from configuration files.
Different platforms have different bus topology.
Use the peci address and i2c address specified in
json file to read data from cpu.
Tested:
Update baseboard json file:
{
"Address": "0x30",
"Bus": 0,
"CpuID": 1,
"Name": "CPU 1",
"PresenceGpio": [
{
"Name": "CPU1_PRESENCE",
"Polarity": "Low"
}
],
"PiromI2cBus": 13,
"PiromI2cAddress": "0x50",
"Type": "XeonCPU"
}
Verified that correct bus addresses are used.
Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Change-Id: Ib133958af8349b43c2f8f73c32d1aaa0d5bf52eb
diff --git a/include/cpuinfo.hpp b/include/cpuinfo.hpp
index 5267c00..27a7264 100644
--- a/include/cpuinfo.hpp
+++ b/include/cpuinfo.hpp
@@ -29,30 +29,27 @@
static constexpr const char* cpuPath =
"/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu";
-static constexpr const int peciCheckInterval = 10;
+static constexpr const int configCheckInterval = 10;
+static constexpr const int peciCheckInterval = 60;
/** \ todo add cpu interface to CPUInfo and consolidate with smbios service
* using processor =
sdbusplus::xyz::openbmc_project::Inventory::Item::server::Cpu;
*/
-using asset =
- sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::Asset;
-struct CPUInfo : sdbusplus::server::object_t<asset>
+// This will be expanded to CPUInfo object_server in a future patch
+struct CPUInfo
{
- public:
- CPUInfo() = delete;
- CPUInfo(const CPUInfo&) = delete;
- CPUInfo& operator=(const CPUInfo&) = delete;
- CPUInfo(CPUInfo&&) = delete;
- CPUInfo& operator=(CPUInfo&&) = delete;
- ~CPUInfo() = default;
-
- CPUInfo(sdbusplus::bus::bus& bus, const std::string& path) :
- sdbusplus::server::object_t<asset>(bus, path.c_str())
+ CPUInfo(const size_t cpuId, const uint8_t peciAddress,
+ const uint8_t i2cBusNum, const uint8_t i2cSlaveAddress) :
+ id(cpuId),
+ peciAddr(peciAddress), i2cBus(i2cBusNum), i2cDevice(i2cSlaveAddress)
{}
- private:
+ uint8_t id;
+ uint8_t peciAddr;
+ uint8_t i2cBus;
+ uint8_t i2cDevice;
};
} // namespace cpu_info