blob: 93eee63f5af5845d6731504767c076b40945f63f [file] [log] [blame]
Patrick Venture9bf5cef2020-08-16 08:59:54 -07001/**
2 * Copyright 2017 Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Patrick Venture09334bb2020-08-16 12:22:54 -070017#include "dbus_mode.hpp"
Patrick Venture9bf5cef2020-08-16 08:59:54 -070018#include "manualcmds.hpp"
19
20#include <ipmid/iana.hpp>
21#include <ipmid/oemopenbmc.hpp>
22#include <ipmid/oemrouter.hpp>
23
24#include <cstdio>
Patrick Venture09334bb2020-08-16 12:22:54 -070025#include <functional>
26#include <memory>
27
George Liu92110f82025-07-02 15:07:35 +080028namespace pid_control::ipmi
Patrick Venture09334bb2020-08-16 12:22:54 -070029{
30
31ZoneControlIpmiHandler handler(std::make_unique<DbusZoneControl>());
32
George Liu92110f82025-07-02 15:07:35 +080033} // namespace pid_control::ipmi
Patrick Venture9bf5cef2020-08-16 08:59:54 -070034
35void setupGlobalOemFanControl() __attribute__((constructor));
36
37void setupGlobalOemFanControl()
38{
39 oem::Router* router = oem::mutableRouter();
40
41 std::fprintf(
42 stderr,
43 "Registering OEM:[%#08X], Cmd:[%#04X] for Manual Zone Control\n",
44 oem::obmcOemNumber, oem::Cmd::fanManualCmd);
45
Patrick Williamsbd63bca2024-08-16 15:21:10 -040046 router->registerHandler(
47 oem::obmcOemNumber, oem::Cmd::fanManualCmd,
Ed Tanousd2768c52025-06-26 11:42:57 -070048 std::bind_front(pid_control::ipmi::manualModeControl,
49 &pid_control::ipmi::handler));
Patrick Venture9bf5cef2020-08-16 08:59:54 -070050}