blob: 06008324d97d87ad189e746efe77f62ec1822a94 [file] [log] [blame]
Alexander Hansen46a755f2025-10-27 16:31:08 +01001// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright 2017 Google Inc
Patrick Venture9bf5cef2020-08-16 08:59:54 -07003
Patrick Venture09334bb2020-08-16 12:22:54 -07004#include "dbus_mode.hpp"
Patrick Venture9bf5cef2020-08-16 08:59:54 -07005#include "manualcmds.hpp"
6
7#include <ipmid/iana.hpp>
8#include <ipmid/oemopenbmc.hpp>
9#include <ipmid/oemrouter.hpp>
10
11#include <cstdio>
Patrick Venture09334bb2020-08-16 12:22:54 -070012#include <functional>
13#include <memory>
14
George Liu92110f82025-07-02 15:07:35 +080015namespace pid_control::ipmi
Patrick Venture09334bb2020-08-16 12:22:54 -070016{
17
18ZoneControlIpmiHandler handler(std::make_unique<DbusZoneControl>());
19
George Liu92110f82025-07-02 15:07:35 +080020} // namespace pid_control::ipmi
Patrick Venture9bf5cef2020-08-16 08:59:54 -070021
22void setupGlobalOemFanControl() __attribute__((constructor));
23
24void setupGlobalOemFanControl()
25{
26 oem::Router* router = oem::mutableRouter();
27
28 std::fprintf(
29 stderr,
30 "Registering OEM:[%#08X], Cmd:[%#04X] for Manual Zone Control\n",
31 oem::obmcOemNumber, oem::Cmd::fanManualCmd);
32
Patrick Williamsbd63bca2024-08-16 15:21:10 -040033 router->registerHandler(
34 oem::obmcOemNumber, oem::Cmd::fanManualCmd,
Ed Tanousd2768c52025-06-26 11:42:57 -070035 std::bind_front(pid_control::ipmi::manualModeControl,
36 &pid_control::ipmi::handler));
Patrick Venture9bf5cef2020-08-16 08:59:54 -070037}