1 #include "config.h" 2 3 #include "elog-errors.hpp" 4 #include "occ_events.hpp" 5 #include "occ_manager.hpp" 6 #include "utils.hpp" 7 8 #include <org/open_power/OCC/Device/error.hpp> 9 #include <phosphor-logging/elog.hpp> 10 #include <phosphor-logging/log.hpp> 11 #include <xyz/openbmc_project/Common/error.hpp> 12 13 using namespace phosphor::logging; 14 15 using namespace sdbusplus::org::open_power::OCC::Device::Error; 16 using InternalFailure = 17 sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; 18 19 int main(int /*argc*/, char** /*argv[]*/) 20 { 21 auto& bus = open_power::occ::utils::getBus(); 22 23 // Need sd_event to watch for OCC device errors 24 sd_event* event = nullptr; 25 auto r = sd_event_default(&event); 26 if (r < 0) 27 { 28 log<level::ERR>("Error creating a default sd_event handler"); 29 return r; 30 } 31 open_power::occ::EventPtr eventP{event}; 32 event = nullptr; 33 34 // Attach the bus to sd_event to service user requests 35 bus.attach_event(eventP.get(), SD_EVENT_PRIORITY_NORMAL); 36 37 sdbusplus::server::manager::manager objManager(bus, OCC_CONTROL_ROOT); 38 #ifdef READ_OCC_SENSORS 39 sdbusplus::server::manager::manager objManagerXyz(bus, OCC_SENSORS_ROOT); 40 #endif 41 open_power::occ::Manager mgr(eventP); 42 43 // Claim the bus since all the house keeping is done now 44 bus.request_name(OCC_CONTROL_BUSNAME); 45 46 // Wait for requests 47 sd_event_loop(eventP.get()); 48 49 return 0; 50 } 51