blob: da45a38be8ebbf77003db8477836ccc0e69b0756 [file] [log] [blame]
Eddie Jamesfa1f5c02020-09-17 15:12:46 -05001#pragma once
2
3#include <span>
4
Ratan Guptabbe45792018-03-23 00:22:55 +05305namespace phosphor
6{
7namespace network
8{
9namespace ncsi
10{
11
Ratan Guptaed5d7ff2018-03-23 00:27:52 +053012constexpr auto DEFAULT_VALUE = -1;
13constexpr auto NONE = 0;
14
Jeremy Kerr8d9af022024-07-26 16:47:16 +080015struct Interface
16{
17 int ifindex;
18};
19
Ratan Guptabbe45792018-03-23 00:22:55 +053020/* @brief This function will ask underlying NCSI driver
Eddie Jamesfa1f5c02020-09-17 15:12:46 -050021 * to send an OEM command (command type 0x50) with
22 * the specified payload as the OEM data.
23 * This function talks with the NCSI driver over
24 * netlink messages.
Jeremy Kerr8d9af022024-07-26 16:47:16 +080025 * @param[in] interface - Interface
Eddie Jamesfa1f5c02020-09-17 15:12:46 -050026 * @param[in] package - NCSI Package.
27 * @param[in] channel - Channel number with in the package.
Johnathan Mantey1ebea282024-02-15 10:26:06 -080028 * @param[in] opcode - NCSI Send Command sub-operation
Eddie Jamesfa1f5c02020-09-17 15:12:46 -050029 * @param[in] payload - OEM data to send.
30 * @returns 0 on success and negative value for failure.
31 */
Jeremy Kerr8d9af022024-07-26 16:47:16 +080032int sendOemCommand(Interface& interface, int package, int channel, int opcode,
Eddie Jamesfa1f5c02020-09-17 15:12:46 -050033 std::span<const unsigned char> payload);
34
35/* @brief This function will ask underlying NCSI driver
Ratan Guptabbe45792018-03-23 00:22:55 +053036 * to set a specific package or package/channel
37 * combination as the preferred choice.
38 * This function talks with the NCSI driver over
39 * netlink messages.
Jeremy Kerr8d9af022024-07-26 16:47:16 +080040 * @param[in] interface - Interface
Ratan Guptabbe45792018-03-23 00:22:55 +053041 * @param[in] package - NCSI Package.
42 * @param[in] channel - Channel number with in the package.
43 * @returns 0 on success and negative value for failure.
44 */
Jeremy Kerr8d9af022024-07-26 16:47:16 +080045int setChannel(Interface& interface, int package, int channel);
Ratan Guptabbe45792018-03-23 00:22:55 +053046
47/* @brief This function will ask underlying NCSI driver
48 * to clear any preferred setting from the given
49 * interface.
50 * This function talks with the NCSI driver over
51 * netlink messages.
Jeremy Kerr8d9af022024-07-26 16:47:16 +080052 * @param[in] interface - Interface
Ratan Guptabbe45792018-03-23 00:22:55 +053053 * @returns 0 on success and negative value for failure.
54 */
Jeremy Kerr8d9af022024-07-26 16:47:16 +080055int clearInterface(Interface& interface);
Ratan Guptabbe45792018-03-23 00:22:55 +053056
Ratan Guptaaac603e2018-03-23 00:25:54 +053057/* @brief This function is used to dump all the info
58 * of the package and the channels underlying
59 * the package.
Jeremy Kerr8d9af022024-07-26 16:47:16 +080060 * @param[in] interface - Interface
Ratan Guptaaac603e2018-03-23 00:25:54 +053061 * @param[in] package - NCSI Package.
62 * @returns 0 on success and negative value for failure.
63 */
Jeremy Kerr8d9af022024-07-26 16:47:16 +080064int getInfo(Interface& interface, int package);
Ratan Guptaaac603e2018-03-23 00:25:54 +053065
Johnathan Mantey5a456062024-02-15 08:45:08 -080066/* @brief This function assigns a mask controlling responses to AEN from a
67 * package.
68 * @param[in] ifindex - Interface Index.
69 * @param[in] mask - A 32-bit mask integer
70 * @returns 0 on success and negative value for failure.
71 */
Jeremy Kerr8d9af022024-07-26 16:47:16 +080072int setPackageMask(Interface& interface, unsigned int mask);
Johnathan Mantey5a456062024-02-15 08:45:08 -080073
74/* @brief This function sets the AEN mask for the channels inside the selected
75 * package.
76 * @param[in] ifindex - Interface Index.
77 * @param[in] package - NCSI Package.
78 * @param[in] mask - A 32-bit mask integer
79 * @returns 0 on success and negative value for failure.
80 */
Jeremy Kerr8d9af022024-07-26 16:47:16 +080081int setChannelMask(Interface& interface, int package, unsigned int mask);
Johnathan Mantey5a456062024-02-15 08:45:08 -080082
Gunnar Mills57d9c502018-09-14 14:42:34 -050083} // namespace ncsi
84} // namespace network
85} // namespace phosphor