1 #pragma once 2 3 #include <memory> 4 #include <vector> 5 #include <sdbusplus/bus.hpp> 6 #include "types.hpp" 7 #include "zone.hpp" 8 9 namespace phosphor 10 { 11 namespace fan 12 { 13 namespace control 14 { 15 16 using ZoneMap = std::map<unsigned int, 17 std::unique_ptr<Zone>>; 18 19 /** 20 * @class Fan control manager 21 */ 22 class Manager 23 { 24 public: 25 26 /** 27 * The mode the manager will run in: 28 * - init - only do the initialization steps 29 * - control - run normal control algorithms 30 */ 31 enum class Mode 32 { 33 init, 34 control 35 }; 36 37 Manager() = delete; 38 Manager(const Manager&) = delete; 39 Manager(Manager&&) = default; 40 Manager& operator=(const Manager&) = delete; 41 Manager& operator=(Manager&&) = delete; 42 ~Manager() = default; 43 44 /** 45 * Constructor 46 * Creates the Zone objects based on the 47 * _zoneLayouts data. 48 * 49 * @param[in] bus - The dbus object 50 * @param[in] mode - The control mode 51 */ 52 Manager(sdbusplus::bus::bus& bus, 53 Mode mode); 54 55 /** 56 * Does the fan control inititialization, which is 57 * setting fans to full, delaying so they 58 * can get there, and starting a target. 59 */ 60 void doInit(); 61 62 private: 63 64 /** 65 * Starts the obmc-fan-control-ready dbus target 66 */ 67 void startFanControlReadyTarget(); 68 69 /** 70 * The dbus object 71 */ 72 sdbusplus::bus::bus& _bus; 73 74 /** 75 * The fan zones in the system 76 */ 77 ZoneMap _zones; 78 79 /** 80 * The fan zone layout for the system. 81 * This is generated data. 82 */ 83 static const std::vector<ZoneGroup> _zoneLayouts; 84 85 /** 86 * The number of seconds to delay after 87 * fans get set to high speed on a power on 88 * to give them a chance to get there. 89 */ 90 static const unsigned int _powerOnDelay; 91 }; 92 93 94 } 95 } 96 } 97