blob: d867dd5102c81e5cc5cfa7e840cc7e52ee92a12c [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
28namespace pid_control
29{
30namespace ipmi
31{
32
33ZoneControlIpmiHandler handler(std::make_unique<DbusZoneControl>());
34
35}
36} // namespace pid_control
Patrick Venture9bf5cef2020-08-16 08:59:54 -070037
38void setupGlobalOemFanControl() __attribute__((constructor));
39
40void setupGlobalOemFanControl()
41{
42 oem::Router* router = oem::mutableRouter();
43
44 std::fprintf(
45 stderr,
46 "Registering OEM:[%#08X], Cmd:[%#04X] for Manual Zone Control\n",
47 oem::obmcOemNumber, oem::Cmd::fanManualCmd);
48
Patrick Williamsbd63bca2024-08-16 15:21:10 -040049 router->registerHandler(
50 oem::obmcOemNumber, oem::Cmd::fanManualCmd,
Ed Tanousd2768c52025-06-26 11:42:57 -070051 std::bind_front(pid_control::ipmi::manualModeControl,
52 &pid_control::ipmi::handler));
Patrick Venture9bf5cef2020-08-16 08:59:54 -070053}