xref: /openbmc/google-ipmi-sys/eth.hpp (revision a2056e9c)
1*a2056e9cSWilly Tu // Copyright 2021 Google LLC
2*a2056e9cSWilly Tu //
3*a2056e9cSWilly Tu // Licensed under the Apache License, Version 2.0 (the "License");
4*a2056e9cSWilly Tu // you may not use this file except in compliance with the License.
5*a2056e9cSWilly Tu // You may obtain a copy of the License at
6*a2056e9cSWilly Tu //
7*a2056e9cSWilly Tu //      http://www.apache.org/licenses/LICENSE-2.0
8*a2056e9cSWilly Tu //
9*a2056e9cSWilly Tu // Unless required by applicable law or agreed to in writing, software
10*a2056e9cSWilly Tu // distributed under the License is distributed on an "AS IS" BASIS,
11*a2056e9cSWilly Tu // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*a2056e9cSWilly Tu // See the License for the specific language governing permissions and
13*a2056e9cSWilly Tu // limitations under the License.
14*a2056e9cSWilly Tu 
154d49ae65SPatrick Venture #pragma once
164d49ae65SPatrick Venture 
17f085d91dSPatrick Venture #include "handler.hpp"
18f085d91dSPatrick Venture 
192c9e1625SWilliam A. Kennington III #include <ipmid/api.h>
204d49ae65SPatrick Venture 
214d49ae65SPatrick Venture namespace google
224d49ae65SPatrick Venture {
234d49ae65SPatrick Venture namespace ipmi
244d49ae65SPatrick Venture {
254d49ae65SPatrick Venture 
265d26d832SPatrick Venture // The reply to the ethdevice command specifies the
2745fad1bbSPatrick Venture // IPMI channel number and the ifName used for the
285d26d832SPatrick Venture // ncis connection.
295d26d832SPatrick Venture struct EthDeviceReply
305d26d832SPatrick Venture {
315d26d832SPatrick Venture     uint8_t subcommand;
325d26d832SPatrick Venture     uint8_t channel;
3345fad1bbSPatrick Venture     // ifNameLength doesn't include the null-terminator.
3445fad1bbSPatrick Venture     uint8_t ifNameLength;
355d26d832SPatrick Venture } __attribute__((packed));
365d26d832SPatrick Venture 
374d49ae65SPatrick Venture // Handle the eth query command.
3845fad1bbSPatrick Venture // Sys can query the ifName and IPMI channel of the BMC's NCSI ethernet
394d49ae65SPatrick Venture // device.
4045fad1bbSPatrick Venture ipmi_ret_t getEthDevice(const uint8_t* reqBuf, uint8_t* replyBuf,
41c87de558SPatrick Venture                         size_t* dataLen, const HandlerInterface* handler);
424d49ae65SPatrick Venture 
434d49ae65SPatrick Venture } // namespace ipmi
444d49ae65SPatrick Venture } // namespace google
45