diff options
author | Deepak Kodihalli <dkodihal@in.ibm.com> | 2017-05-08 07:11:22 -0500 |
---|---|---|
committer | Deepak Kodihalli <dkodihal@in.ibm.com> | 2017-06-13 08:18:25 -0500 |
commit | fd358d18b8b7f73204cc482f3b29f49a50fda214 (patch) | |
tree | b231ebe86d27090357161ab7ce68c8ba2fb6bacd /occ_finder.cpp | |
parent | d13694a0658a9fc5914b06eadcaabe9d671f70b2 (diff) | |
download | openpower-occ-control-fd358d18b8b7f73204cc482f3b29f49a50fda214.tar.gz openpower-occ-control-fd358d18b8b7f73204cc482f3b29f49a50fda214.zip |
Create OCC pass-through objects
Create OCC pass-through d-bus objects when corresponding CPU objects are
created in the inventory.
Resolves openbmc/openbmc#1450.
Change-Id: I8da879f51ebef8dcc3d25358def81c5e0dce0617
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'occ_finder.cpp')
-rw-r--r-- | occ_finder.cpp | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/occ_finder.cpp b/occ_finder.cpp deleted file mode 100644 index 8d6391d..0000000 --- a/occ_finder.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include <algorithm> -#include <sdbusplus/server.hpp> -#include "occ_finder.hpp" -#include "config.h" - -namespace open_power -{ -namespace occ -{ -namespace finder -{ - -constexpr auto toChar(size_t c) -{ - constexpr auto map = "0123"; - return map[c]; -} - -std::vector<std::string> get() -{ - auto bus = sdbusplus::bus::new_default(); - auto mapper = - bus.new_method_call( - "xyz.openbmc_project.ObjectMapper", - "/xyz/openbmc_project/object_mapper", - "xyz.openbmc_project.ObjectMapper", - "GetSubTreePaths"); - - auto depth = 0; - mapper.append(std::string(INVENTORY_ROOT)); - mapper.append(depth); - mapper.append(std::vector<std::string>( - {std::string(INVENTORY_ITEM_INTERFACE)})); - - auto result = bus.call(mapper); - if (result.is_method_error()) - { - throw std::runtime_error("ObjectMapper GetSubTreePaths failed"); - } - - std::vector<std::string> response; - result.read(response); - if (response.empty()) - { - throw std::runtime_error("ObjectMapper GetSubTreePaths : bad response"); - } - - std::vector<std::string> occs; - size_t count = 0; - std::string cpu = std::string(CPU_NAME) + toChar(count); - auto constexpr MAX_PROCS = 4; // Revisit for multi-node systems - for (const auto& path: response) - { - if (std::equal(cpu.crbegin(), cpu.crend(), path.crbegin())) - { - if(count == MAX_PROCS) - { - break; - } - occs.emplace_back(std::string(OCC_NAME) + - toChar(count++)); - } - cpu.back() = toChar(count); - } - - return occs; -} - -} // namespace finder -} // namespace occ -} // namespace open_power |