blob: 34ae0b9e678656b0294e85d3aaa9b71f8ca55a94 [file] [log] [blame]
Matt Spinlere10416e2017-04-10 14:15:53 -05001#pragma once
2
Matt Spinlere10416e2017-04-10 14:15:53 -05003#include "types.hpp"
Matt Spinler57352a32017-04-10 14:48:35 -05004#include "zone.hpp"
Matt Spinlere10416e2017-04-10 14:15:53 -05005
Matthew Barth3e1bb272020-05-26 11:09:21 -05006#include <sdbusplus/bus.hpp>
7#include <sdeventplus/event.hpp>
8
9#include <memory>
10#include <vector>
11
Matt Spinlere10416e2017-04-10 14:15:53 -050012namespace phosphor
13{
14namespace fan
15{
16namespace control
17{
18
Matthew Barth3e1bb272020-05-26 11:09:21 -050019using ZoneMap = std::map<unsigned int, std::unique_ptr<Zone>>;
Matt Spinler57352a32017-04-10 14:48:35 -050020
Matt Spinlere10416e2017-04-10 14:15:53 -050021/**
22 * @class Fan control manager
23 */
24class Manager
25{
Matthew Barth3e1bb272020-05-26 11:09:21 -050026 public:
27 Manager() = delete;
28 Manager(const Manager&) = delete;
29 Manager(Manager&&) = default;
30 Manager& operator=(const Manager&) = delete;
31 Manager& operator=(Manager&&) = delete;
32 ~Manager() = default;
Matt Spinlere10416e2017-04-10 14:15:53 -050033
Matthew Barth3e1bb272020-05-26 11:09:21 -050034 /**
35 * Constructor
36 * Creates the Zone objects based on the
37 * _zoneLayouts data.
38 *
39 * @param[in] bus - The dbus object
40 * @param[in] event - The event loop
41 * @param[in] mode - The control mode
42 */
43 Manager(sdbusplus::bus::bus& bus, const sdeventplus::Event& event,
44 Mode mode);
Matt Spinlere10416e2017-04-10 14:15:53 -050045
Matthew Barth3e1bb272020-05-26 11:09:21 -050046 /**
47 * Does the fan control inititialization, which is
48 * setting fans to full, delaying so they
49 * can get there, and starting a target.
50 */
51 void doInit();
Matt Spinleree7f6422017-05-09 11:03:14 -050052
Matthew Barth3e1bb272020-05-26 11:09:21 -050053 private:
54 /**
55 * The dbus object
56 */
57 sdbusplus::bus::bus& _bus;
Matt Spinlere10416e2017-04-10 14:15:53 -050058
Matthew Barth3e1bb272020-05-26 11:09:21 -050059 /**
60 * The sdbusplus object manager
61 */
62 sdbusplus::server::manager::manager _objMgr;
Matt Spinlere10416e2017-04-10 14:15:53 -050063
Matthew Barth3e1bb272020-05-26 11:09:21 -050064 /**
65 * The fan zones in the system
66 */
67 ZoneMap _zones;
Matt Spinlere10416e2017-04-10 14:15:53 -050068
Matthew Barth3e1bb272020-05-26 11:09:21 -050069 /**
70 * The fan zone layout for the system.
71 * This is generated data.
72 */
73 static const std::vector<ZoneGroup> _zoneLayouts;
Matthew Barth93af4192019-01-18 09:30:57 -060074
Matthew Barth3e1bb272020-05-26 11:09:21 -050075 /**
76 * The number of seconds to delay after
77 * fans get set to high speed on a power on
78 * to give them a chance to get there.
79 */
80 static const unsigned int _powerOnDelay;
Matt Spinlere10416e2017-04-10 14:15:53 -050081};
82
Matthew Barth3e1bb272020-05-26 11:09:21 -050083} // namespace control
84} // namespace fan
85} // namespace phosphor