Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 1 | /* |
| 2 | // Copyright (c) 2020 intel Corporation |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | #include <sdbusplus/asio/object_server.hpp> |
| 20 | #include <xyz/openbmc_project/Inventory/Decorator/Asset/server.hpp> |
| 21 | |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 22 | namespace cpu_info |
| 23 | { |
| 24 | static constexpr char const* cpuInfoObject = "xyz.openbmc_project.CPUInfo"; |
| 25 | static constexpr char const* cpuInfoPath = "/xyz/openbmc_project/CPUInfo"; |
| 26 | static constexpr char const* cpuInfoInterface = "xyz.openbmc_project.CPUInfo"; |
Jonathan Doman | 94c94bf | 2020-10-05 23:25:45 -0700 | [diff] [blame] | 27 | static constexpr const char* cpuPath = |
| 28 | "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu"; |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 29 | |
Zhikui Ren | 6d3ad58 | 2020-09-11 21:25:59 -0700 | [diff] [blame] | 30 | static constexpr const int configCheckInterval = 10; |
| 31 | static constexpr const int peciCheckInterval = 60; |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 32 | |
| 33 | /** \ todo add cpu interface to CPUInfo and consolidate with smbios service |
| 34 | * using processor = |
| 35 | sdbusplus::xyz::openbmc_project::Inventory::Item::server::Cpu; |
| 36 | */ |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 37 | |
Zhikui Ren | 6d3ad58 | 2020-09-11 21:25:59 -0700 | [diff] [blame] | 38 | // This will be expanded to CPUInfo object_server in a future patch |
| 39 | struct CPUInfo |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 40 | { |
Zhikui Ren | 6d3ad58 | 2020-09-11 21:25:59 -0700 | [diff] [blame] | 41 | CPUInfo(const size_t cpuId, const uint8_t peciAddress, |
| 42 | const uint8_t i2cBusNum, const uint8_t i2cSlaveAddress) : |
| 43 | id(cpuId), |
| 44 | peciAddr(peciAddress), i2cBus(i2cBusNum), i2cDevice(i2cSlaveAddress) |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 45 | {} |
| 46 | |
Zhikui Ren | 6d3ad58 | 2020-09-11 21:25:59 -0700 | [diff] [blame] | 47 | uint8_t id; |
| 48 | uint8_t peciAddr; |
| 49 | uint8_t i2cBus; |
| 50 | uint8_t i2cDevice; |
Jonathan Doman | 2285be4 | 2021-03-08 14:54:12 -0800 | [diff] [blame] | 51 | std::string sSpec; |
Zhikui Ren | 18a5ab9 | 2020-09-01 21:35:20 -0700 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | } // namespace cpu_info |