habanalabs/gaudi: add NIC firmware-related definitions

Add new structures and messages that the driver use to interact with the
firmware to receive information and events (errors) about GAUDI's NIC.

Signed-off-by: Omer Shpigelman <oshpigelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
This commit is contained in:
Oded Gabbay 2020-11-02 21:07:51 +02:00
Родитель 16ac365045
Коммит b3a9c0bd2f
2 изменённых файлов: 54 добавлений и 4 удалений

Просмотреть файл

@ -9,6 +9,7 @@
#define CPUCP_IF_H
#include <linux/types.h>
#include <linux/if_ether.h>
/*
* EVENT QUEUE
@ -199,6 +200,11 @@ enum pq_init_status {
* CpuCP to write to the structure, to prevent data corruption in case of
* mismatched driver/FW versions.
*
* CPUCP_PACKET_NIC_INFO_GET -
* Fetch information from the device regarding the NIC. the host's driver
* passes the max size it allows the CpuCP to write to the structure, to
* prevent data corruption in case of mismatched driver/FW versions.
*
* CPUCP_PACKET_TEMPERATURE_SET -
* Set the value of the offset property of a specified thermal sensor.
* The packet's arguments specify the desired sensor and the field to
@ -244,7 +250,7 @@ enum cpucp_packet_id {
CPUCP_PACKET_MAX_POWER_GET, /* sysfs */
CPUCP_PACKET_MAX_POWER_SET, /* sysfs */
CPUCP_PACKET_EEPROM_DATA_GET, /* sysfs */
CPUCP_RESERVED,
CPUCP_PACKET_NIC_INFO_GET, /* internal */
CPUCP_PACKET_TEMPERATURE_SET, /* sysfs */
CPUCP_PACKET_VOLTAGE_SET, /* sysfs */
CPUCP_PACKET_CURRENT_SET, /* sysfs */
@ -300,7 +306,7 @@ struct cpucp_packet {
/* For led set */
__le32 led_index;
/* For get CpuCP info/EEPROM data */
/* For get CpuCP info/EEPROM data/NIC info */
__le32 data_max_size;
};
@ -392,6 +398,12 @@ struct eq_generic_event {
#define CARD_NAME_MAX_LEN 16
#define VERSION_MAX_LEN 128
#define CPUCP_MAX_SENSORS 128
#define CPUCP_MAX_NICS 128
#define CPUCP_LANES_PER_NIC 4
#define CPUCP_NIC_QSFP_EEPROM_MAX_LEN 1024
#define CPUCP_MAX_NIC_LANES (CPUCP_MAX_NICS * CPUCP_LANES_PER_NIC)
#define CPUCP_NIC_MASK_ARR_LEN ((CPUCP_MAX_NICS + 63) / 64)
#define CPUCP_NIC_POLARITY_ARR_LEN ((CPUCP_MAX_NIC_LANES + 63) / 64)
struct cpucp_sensor {
__le32 type;
@ -440,4 +452,18 @@ struct cpucp_info {
char card_name[CARD_NAME_MAX_LEN];
};
struct cpucp_mac_addr {
__u8 mac_addr[ETH_ALEN];
};
struct cpucp_nic_info {
struct cpucp_mac_addr mac_addrs[CPUCP_MAX_NICS];
__le64 link_mask[CPUCP_NIC_MASK_ARR_LEN];
__le64 pol_tx_mask[CPUCP_NIC_POLARITY_ARR_LEN];
__le64 pol_rx_mask[CPUCP_NIC_POLARITY_ARR_LEN];
__le64 link_ext_mask[CPUCP_NIC_MASK_ARR_LEN];
__u8 qsfp_eeprom[CPUCP_NIC_QSFP_EEPROM_MAX_LEN];
__le64 auto_neg_mask[CPUCP_NIC_MASK_ARR_LEN];
};
#endif /* CPUCP_IF_H */

Просмотреть файл

@ -8,6 +8,8 @@
#ifndef GAUDI_FW_IF_H
#define GAUDI_FW_IF_H
#include <linux/types.h>
#define GAUDI_EVENT_QUEUE_MSI_IDX 8
#define GAUDI_NIC_PORT1_MSI_IDX 10
#define GAUDI_NIC_PORT3_MSI_IDX 12
@ -31,6 +33,28 @@ enum gaudi_pll_index {
IF_PLL
};
enum gaudi_nic_axi_error {
RXB,
RXE,
TXS,
TXE,
QPC_RESP,
NON_AXI_ERR,
};
/*
* struct eq_nic_sei_event - describes an AXI error cause.
* @axi_error_cause: one of the events defined in enum gaudi_nic_axi_error.
* @id: can be either 0 or 1, to further describe unit with interrupt cause
* (i.e. TXE0 or TXE1).
* @pad[6]: padding structure to 64bit.
*/
struct eq_nic_sei_event {
__u8 axi_error_cause;
__u8 id;
__u8 pad[6];
};
#define GAUDI_PLL_FREQ_LOW 200000000 /* 200 MHz */
#endif /* GAUDI_FW_IF_H */