Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 3 | #include "config.h" |
| 4 | |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 5 | #include "types.hpp" |
Matt Spinler | 57352a3 | 2017-04-10 14:48:35 -0500 | [diff] [blame] | 6 | #include "zone.hpp" |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 7 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 8 | #include <sdbusplus/bus.hpp> |
| 9 | #include <sdeventplus/event.hpp> |
| 10 | |
| 11 | #include <memory> |
| 12 | #include <vector> |
| 13 | |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 14 | namespace phosphor |
| 15 | { |
| 16 | namespace fan |
| 17 | { |
| 18 | namespace control |
| 19 | { |
| 20 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 21 | using ZoneMap = std::map<unsigned int, std::unique_ptr<Zone>>; |
Matt Spinler | 57352a3 | 2017-04-10 14:48:35 -0500 | [diff] [blame] | 22 | |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 23 | /** |
| 24 | * @class Fan control manager |
| 25 | */ |
| 26 | class Manager |
| 27 | { |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 28 | public: |
| 29 | Manager() = delete; |
| 30 | Manager(const Manager&) = delete; |
| 31 | Manager(Manager&&) = default; |
| 32 | Manager& operator=(const Manager&) = delete; |
| 33 | Manager& operator=(Manager&&) = delete; |
| 34 | ~Manager() = default; |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 35 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 36 | /** |
| 37 | * Constructor |
| 38 | * Creates the Zone objects based on the |
| 39 | * _zoneLayouts data. |
| 40 | * |
| 41 | * @param[in] bus - The dbus object |
| 42 | * @param[in] event - The event loop |
| 43 | * @param[in] mode - The control mode |
| 44 | */ |
| 45 | Manager(sdbusplus::bus::bus& bus, const sdeventplus::Event& event, |
| 46 | Mode mode); |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 47 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 48 | /** |
| 49 | * Does the fan control inititialization, which is |
| 50 | * setting fans to full, delaying so they |
| 51 | * can get there, and starting a target. |
| 52 | */ |
| 53 | void doInit(); |
Matt Spinler | ee7f642 | 2017-05-09 11:03:14 -0500 | [diff] [blame] | 54 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 55 | private: |
| 56 | /** |
| 57 | * The dbus object |
| 58 | */ |
| 59 | sdbusplus::bus::bus& _bus; |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 60 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 61 | /** |
| 62 | * The sdbusplus object manager |
| 63 | */ |
| 64 | sdbusplus::server::manager::manager _objMgr; |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 65 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 66 | /** |
| 67 | * The fan zones in the system |
| 68 | */ |
| 69 | ZoneMap _zones; |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 70 | #ifndef CONTROL_USE_JSON |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 71 | /** |
| 72 | * The fan zone layout for the system. |
| 73 | * This is generated data. |
| 74 | */ |
| 75 | static const std::vector<ZoneGroup> _zoneLayouts; |
Matthew Barth | 93af419 | 2019-01-18 09:30:57 -0600 | [diff] [blame] | 76 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 77 | /** |
| 78 | * The number of seconds to delay after |
| 79 | * fans get set to high speed on a power on |
| 80 | * to give them a chance to get there. |
| 81 | */ |
| 82 | static const unsigned int _powerOnDelay; |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 83 | #endif |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 84 | }; |
| 85 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 86 | } // namespace control |
| 87 | } // namespace fan |
| 88 | } // namespace phosphor |