AppaRao Puli | e63eeda | 2019-07-05 16:25:38 +0530 | [diff] [blame] | 1 | /* |
| 2 | // Copyright (c) 2019 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 | #include "pfr_mgr.hpp" |
| 18 | |
| 19 | static std::array<std::string, 5> listVersionPaths = { |
| 20 | "bmc_active", "bmc_recovery", "bios_active", "bios_recovery", "cpld"}; |
| 21 | |
| 22 | int main() |
| 23 | { |
| 24 | // setup connection to dbus |
| 25 | boost::asio::io_service io; |
| 26 | auto conn = std::make_shared<sdbusplus::asio::connection>(io); |
| 27 | conn->request_name("xyz.openbmc_project.Intel.PFR.Manager"); |
| 28 | auto server = sdbusplus::asio::object_server(conn, true); |
| 29 | |
| 30 | // Create Intel PFR attributes object and interface |
| 31 | intel::pfr::PfrConfig obj(server, conn); |
| 32 | |
| 33 | // Create Software objects using Versions interface |
| 34 | for (const auto& path : listVersionPaths) |
| 35 | { |
| 36 | intel::pfr::PfrVersion obj(server, conn, path); |
| 37 | } |
| 38 | |
| 39 | phosphor::logging::log<phosphor::logging::level::INFO>( |
| 40 | "Intel PFR service started successfully"); |
| 41 | |
| 42 | io.run(); |
| 43 | |
| 44 | return 0; |
| 45 | } |