1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2 /* Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ 3 4 #ifndef __LIB_EVENTS_H__ 5 #define __LIB_EVENTS_H__ 6 7 #include "mlx5_core.h" 8 9 #define PORT_MODULE_EVENT_MODULE_STATUS_MASK 0xF 10 #define PORT_MODULE_EVENT_ERROR_TYPE_MASK 0xF 11 12 enum port_module_event_status_type { 13 MLX5_MODULE_STATUS_PLUGGED = 0x1, 14 MLX5_MODULE_STATUS_UNPLUGGED = 0x2, 15 MLX5_MODULE_STATUS_ERROR = 0x3, 16 MLX5_MODULE_STATUS_DISABLED = 0x4, 17 MLX5_MODULE_STATUS_NUM, 18 }; 19 20 enum port_module_event_error_type { 21 MLX5_MODULE_EVENT_ERROR_POWER_BUDGET_EXCEEDED = 0x0, 22 MLX5_MODULE_EVENT_ERROR_LONG_RANGE_FOR_NON_MLNX = 0x1, 23 MLX5_MODULE_EVENT_ERROR_BUS_STUCK = 0x2, 24 MLX5_MODULE_EVENT_ERROR_NO_EEPROM_RETRY_TIMEOUT = 0x3, 25 MLX5_MODULE_EVENT_ERROR_ENFORCE_PART_NUMBER_LIST = 0x4, 26 MLX5_MODULE_EVENT_ERROR_UNKNOWN_IDENTIFIER = 0x5, 27 MLX5_MODULE_EVENT_ERROR_HIGH_TEMPERATURE = 0x6, 28 MLX5_MODULE_EVENT_ERROR_BAD_CABLE = 0x7, 29 MLX5_MODULE_EVENT_ERROR_PCIE_POWER_SLOT_EXCEEDED = 0xc, 30 MLX5_MODULE_EVENT_ERROR_NUM, 31 }; 32 33 struct mlx5_pme_stats { 34 u64 status_counters[MLX5_MODULE_STATUS_NUM]; 35 u64 error_counters[MLX5_MODULE_EVENT_ERROR_NUM]; 36 }; 37 38 void mlx5_get_pme_stats(struct mlx5_core_dev *dev, struct mlx5_pme_stats *stats); 39 int mlx5_notifier_call_chain(struct mlx5_events *events, unsigned int event, void *data); 40 #endif 41