blob: 260e27bc8cd6a370263e7ab6fb6b8d077c6be94c [file] [log] [blame]
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +05301#include "config.h"
Deepak Kodihalli92a63412017-03-17 05:01:00 -05002
Gunnar Mills94df8c92018-09-14 14:50:03 -05003#include "elog-errors.hpp"
4#include "occ_events.hpp"
5#include "occ_manager.hpp"
6
7#include <org/open_power/OCC/Device/error.hpp>
8#include <phosphor-logging/elog.hpp>
9#include <phosphor-logging/log.hpp>
10#include <xyz/openbmc_project/Common/error.hpp>
11
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +053012using namespace phosphor::logging;
13
14using namespace sdbusplus::org::open_power::OCC::Device::Error;
Gunnar Mills94df8c92018-09-14 14:50:03 -050015using InternalFailure =
16 sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +053017
Deepak Kodihalli92a63412017-03-17 05:01:00 -050018int main(int argc, char* argv[])
19{
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +053020 auto bus = sdbusplus::bus::new_default();
21
22 // Need sd_event to watch for OCC device errors
23 sd_event* event = nullptr;
24 auto r = sd_event_default(&event);
25 if (r < 0)
Deepak Kodihalli92a63412017-03-17 05:01:00 -050026 {
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +053027 log<level::ERR>("Error creating a default sd_event handler");
28 return r;
Deepak Kodihalli6b492fb2017-03-18 01:09:28 -050029 }
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +053030 open_power::occ::EventPtr eventP{event};
31 event = nullptr;
32
33 // Attach the bus to sd_event to service user requests
34 bus.attach_event(eventP.get(), SD_EVENT_PRIORITY_NORMAL);
35
36 sdbusplus::server::manager::manager objManager(bus, OCC_CONTROL_ROOT);
37 open_power::occ::Manager mgr(bus, eventP);
38
39 // Claim the bus since all the house keeping is done now
40 bus.request_name(OCC_CONTROL_BUSNAME);
41
42 // Wait for requests
43 sd_event_loop(eventP.get());
Deepak Kodihalli92a63412017-03-17 05:01:00 -050044
45 return 0;
46}