Eddie James | fa1f5c0 | 2020-09-17 15:12:46 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <span> |
| 4 | |
Ratan Gupta | bbe4579 | 2018-03-23 00:22:55 +0530 | [diff] [blame] | 5 | namespace phosphor |
| 6 | { |
| 7 | namespace network |
| 8 | { |
| 9 | namespace ncsi |
| 10 | { |
| 11 | |
Ratan Gupta | ed5d7ff | 2018-03-23 00:27:52 +0530 | [diff] [blame] | 12 | constexpr auto DEFAULT_VALUE = -1; |
| 13 | constexpr auto NONE = 0; |
| 14 | |
Jeremy Kerr | 8d9af02 | 2024-07-26 16:47:16 +0800 | [diff] [blame^] | 15 | struct Interface |
| 16 | { |
| 17 | int ifindex; |
| 18 | }; |
| 19 | |
Ratan Gupta | bbe4579 | 2018-03-23 00:22:55 +0530 | [diff] [blame] | 20 | /* @brief This function will ask underlying NCSI driver |
Eddie James | fa1f5c0 | 2020-09-17 15:12:46 -0500 | [diff] [blame] | 21 | * 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 Kerr | 8d9af02 | 2024-07-26 16:47:16 +0800 | [diff] [blame^] | 25 | * @param[in] interface - Interface |
Eddie James | fa1f5c0 | 2020-09-17 15:12:46 -0500 | [diff] [blame] | 26 | * @param[in] package - NCSI Package. |
| 27 | * @param[in] channel - Channel number with in the package. |
Johnathan Mantey | 1ebea28 | 2024-02-15 10:26:06 -0800 | [diff] [blame] | 28 | * @param[in] opcode - NCSI Send Command sub-operation |
Eddie James | fa1f5c0 | 2020-09-17 15:12:46 -0500 | [diff] [blame] | 29 | * @param[in] payload - OEM data to send. |
| 30 | * @returns 0 on success and negative value for failure. |
| 31 | */ |
Jeremy Kerr | 8d9af02 | 2024-07-26 16:47:16 +0800 | [diff] [blame^] | 32 | int sendOemCommand(Interface& interface, int package, int channel, int opcode, |
Eddie James | fa1f5c0 | 2020-09-17 15:12:46 -0500 | [diff] [blame] | 33 | std::span<const unsigned char> payload); |
| 34 | |
| 35 | /* @brief This function will ask underlying NCSI driver |
Ratan Gupta | bbe4579 | 2018-03-23 00:22:55 +0530 | [diff] [blame] | 36 | * 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 Kerr | 8d9af02 | 2024-07-26 16:47:16 +0800 | [diff] [blame^] | 40 | * @param[in] interface - Interface |
Ratan Gupta | bbe4579 | 2018-03-23 00:22:55 +0530 | [diff] [blame] | 41 | * @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 Kerr | 8d9af02 | 2024-07-26 16:47:16 +0800 | [diff] [blame^] | 45 | int setChannel(Interface& interface, int package, int channel); |
Ratan Gupta | bbe4579 | 2018-03-23 00:22:55 +0530 | [diff] [blame] | 46 | |
| 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 Kerr | 8d9af02 | 2024-07-26 16:47:16 +0800 | [diff] [blame^] | 52 | * @param[in] interface - Interface |
Ratan Gupta | bbe4579 | 2018-03-23 00:22:55 +0530 | [diff] [blame] | 53 | * @returns 0 on success and negative value for failure. |
| 54 | */ |
Jeremy Kerr | 8d9af02 | 2024-07-26 16:47:16 +0800 | [diff] [blame^] | 55 | int clearInterface(Interface& interface); |
Ratan Gupta | bbe4579 | 2018-03-23 00:22:55 +0530 | [diff] [blame] | 56 | |
Ratan Gupta | aac603e | 2018-03-23 00:25:54 +0530 | [diff] [blame] | 57 | /* @brief This function is used to dump all the info |
| 58 | * of the package and the channels underlying |
| 59 | * the package. |
Jeremy Kerr | 8d9af02 | 2024-07-26 16:47:16 +0800 | [diff] [blame^] | 60 | * @param[in] interface - Interface |
Ratan Gupta | aac603e | 2018-03-23 00:25:54 +0530 | [diff] [blame] | 61 | * @param[in] package - NCSI Package. |
| 62 | * @returns 0 on success and negative value for failure. |
| 63 | */ |
Jeremy Kerr | 8d9af02 | 2024-07-26 16:47:16 +0800 | [diff] [blame^] | 64 | int getInfo(Interface& interface, int package); |
Ratan Gupta | aac603e | 2018-03-23 00:25:54 +0530 | [diff] [blame] | 65 | |
Johnathan Mantey | 5a45606 | 2024-02-15 08:45:08 -0800 | [diff] [blame] | 66 | /* @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 Kerr | 8d9af02 | 2024-07-26 16:47:16 +0800 | [diff] [blame^] | 72 | int setPackageMask(Interface& interface, unsigned int mask); |
Johnathan Mantey | 5a45606 | 2024-02-15 08:45:08 -0800 | [diff] [blame] | 73 | |
| 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 Kerr | 8d9af02 | 2024-07-26 16:47:16 +0800 | [diff] [blame^] | 81 | int setChannelMask(Interface& interface, int package, unsigned int mask); |
Johnathan Mantey | 5a45606 | 2024-02-15 08:45:08 -0800 | [diff] [blame] | 82 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 83 | } // namespace ncsi |
| 84 | } // namespace network |
| 85 | } // namespace phosphor |