blob: 0eb8f0c9c0bf7447e6b3296eeb958d3481d89f88 [file] [log] [blame]
Patrick Venture4d49ae62018-09-17 11:35:32 -07001/*
2 * Copyright 2018 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 Venturec87de552020-05-20 20:25:39 -070017#include "handler_impl.hpp"
Patrick Ventureeff1f2e2020-08-05 08:27:36 -070018#include "ipmi.hpp"
Patrick Venture4d49ae62018-09-17 11:35:32 -070019
William A. Kennington III2c9e1622019-02-07 15:45:19 -080020#include <ipmid/api.h>
Patrick Venture4d49ae62018-09-17 11:35:32 -070021
22#include <cstdint>
Patrick Venture28557a12018-09-28 08:56:05 -070023#include <cstdio>
Patrick Ventureeff1f2e2020-08-05 08:27:36 -070024#include <functional>
William A. Kennington III2c9e1622019-02-07 15:45:19 -080025#include <ipmid/iana.hpp>
26#include <ipmid/oemrouter.hpp>
Patrick Venture4d49ae62018-09-17 11:35:32 -070027
28namespace oem
29{
30namespace google
31{
32constexpr int sysCmd = 50;
33} // namespace google
34} // namespace oem
35
36namespace google
37{
38namespace ipmi
39{
40
Patrick Venture96b088a2018-11-13 15:02:33 -080041void setupGoogleOemSysCommands() __attribute__((constructor));
Patrick Venture4d49ae62018-09-17 11:35:32 -070042
Patrick Venture96b088a2018-11-13 15:02:33 -080043void setupGoogleOemSysCommands()
Patrick Venture4d49ae62018-09-17 11:35:32 -070044{
William A. Kennington III96ad9062020-11-24 21:47:20 -080045 static Handler handlerImpl;
Patrick Venture4d49ae62018-09-17 11:35:32 -070046 oem::Router* oemRouter = oem::mutableRouter();
47
Patrick Venturece07ee02018-09-19 18:09:32 -070048 std::fprintf(stderr,
49 "Registering OEM:[%#08X], Cmd:[%#04X] for Sys Commands\n",
50 oem::googOemNumber, oem::google::sysCmd);
Patrick Venture4d49ae62018-09-17 11:35:32 -070051
Patrick Ventureeff1f2e2020-08-05 08:27:36 -070052 using namespace std::placeholders;
53 oemRouter->registerHandler(
54 oem::googOemNumber, oem::google::sysCmd,
55 std::bind(handleSysCommand, &handlerImpl, _1, _2, _3, _4));
Patrick Venture4d49ae62018-09-17 11:35:32 -070056}
57
58} // namespace ipmi
59} // namespace google