xref: /openbmc/google-ipmi-sys/eth.hpp (revision 444b5ea4)
1a2056e9cSWilly Tu // Copyright 2021 Google LLC
2a2056e9cSWilly Tu //
3a2056e9cSWilly Tu // Licensed under the Apache License, Version 2.0 (the "License");
4a2056e9cSWilly Tu // you may not use this file except in compliance with the License.
5a2056e9cSWilly Tu // You may obtain a copy of the License at
6a2056e9cSWilly Tu //
7a2056e9cSWilly Tu //      http://www.apache.org/licenses/LICENSE-2.0
8a2056e9cSWilly Tu //
9a2056e9cSWilly Tu // Unless required by applicable law or agreed to in writing, software
10a2056e9cSWilly Tu // distributed under the License is distributed on an "AS IS" BASIS,
11a2056e9cSWilly Tu // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12a2056e9cSWilly Tu // See the License for the specific language governing permissions and
13a2056e9cSWilly Tu // limitations under the License.
14a2056e9cSWilly Tu 
154d49ae65SPatrick Venture #pragma once
164d49ae65SPatrick Venture 
17f085d91dSPatrick Venture #include "handler.hpp"
18f085d91dSPatrick Venture 
192c9e1625SWilliam A. Kennington III #include <ipmid/api.h>
204d49ae65SPatrick Venture 
21ff3cd8e9SWilly Tu #include <ipmid/api-types.hpp>
22*444b5ea4SPatrick Williams 
23b4e3704cSWilly Tu #include <span>
24ff3cd8e9SWilly Tu 
254d49ae65SPatrick Venture namespace google
264d49ae65SPatrick Venture {
274d49ae65SPatrick Venture namespace ipmi
284d49ae65SPatrick Venture {
294d49ae65SPatrick Venture 
305d26d832SPatrick Venture // The reply to the ethdevice command specifies the
3145fad1bbSPatrick Venture // IPMI channel number and the ifName used for the
325d26d832SPatrick Venture // ncis connection.
335d26d832SPatrick Venture struct EthDeviceReply
345d26d832SPatrick Venture {
355d26d832SPatrick Venture     uint8_t channel;
3645fad1bbSPatrick Venture     // ifNameLength doesn't include the null-terminator.
3745fad1bbSPatrick Venture     uint8_t ifNameLength;
385d26d832SPatrick Venture } __attribute__((packed));
395d26d832SPatrick Venture 
404d49ae65SPatrick Venture // Handle the eth query command.
4145fad1bbSPatrick Venture // Sys can query the ifName and IPMI channel of the BMC's NCSI ethernet
424d49ae65SPatrick Venture // device.
43b4e3704cSWilly Tu Resp getEthDevice(std::span<const uint8_t> data,
44ff3cd8e9SWilly Tu                   const HandlerInterface* handler);
454d49ae65SPatrick Venture 
464d49ae65SPatrick Venture } // namespace ipmi
474d49ae65SPatrick Venture } // namespace google
48