| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* Copyright(c) 2023 Intel Corporation. */ |
| 3 | |
| 4 | #ifndef _I40E_DEBUG_H_ |
| 5 | #define _I40E_DEBUG_H_ |
| 6 | |
| 7 | #include <linux/dev_printk.h> |
| 8 | |
| 9 | /* debug masks - set these bits in hw->debug_mask to control output */ |
| 10 | enum i40e_debug_mask { |
| 11 | I40E_DEBUG_INIT = 0x00000001, |
| 12 | I40E_DEBUG_RELEASE = 0x00000002, |
| 13 | |
| 14 | I40E_DEBUG_LINK = 0x00000010, |
| 15 | I40E_DEBUG_PHY = 0x00000020, |
| 16 | I40E_DEBUG_HMC = 0x00000040, |
| 17 | I40E_DEBUG_NVM = 0x00000080, |
| 18 | I40E_DEBUG_LAN = 0x00000100, |
| 19 | I40E_DEBUG_FLOW = 0x00000200, |
| 20 | I40E_DEBUG_DCB = 0x00000400, |
| 21 | I40E_DEBUG_DIAG = 0x00000800, |
| 22 | I40E_DEBUG_FD = 0x00001000, |
| 23 | I40E_DEBUG_PACKAGE = 0x00002000, |
| 24 | I40E_DEBUG_IWARP = 0x00F00000, |
| 25 | I40E_DEBUG_AQ_MESSAGE = 0x01000000, |
| 26 | I40E_DEBUG_AQ_DESCRIPTOR = 0x02000000, |
| 27 | I40E_DEBUG_AQ_DESC_BUFFER = 0x04000000, |
| 28 | I40E_DEBUG_AQ_COMMAND = 0x06000000, |
| 29 | I40E_DEBUG_AQ = 0x0F000000, |
| 30 | |
| 31 | I40E_DEBUG_USER = 0xF0000000, |
| 32 | |
| 33 | I40E_DEBUG_ALL = 0xFFFFFFFF |
| 34 | }; |
| 35 | |
| 36 | struct i40e_hw; |
| 37 | struct device *i40e_hw_to_dev(struct i40e_hw *hw); |
| 38 | |
| 39 | #define hw_dbg(hw, S, A...) dev_dbg(i40e_hw_to_dev(hw), S, ##A) |
| 40 | #define hw_warn(hw, S, A...) dev_warn(i40e_hw_to_dev(hw), S, ##A) |
| 41 | |
| 42 | #define i40e_debug(h, m, s, ...) \ |
| 43 | do { \ |
| 44 | if (((m) & (h)->debug_mask)) \ |
| 45 | dev_info(i40e_hw_to_dev(hw), s, ##__VA_ARGS__); \ |
| 46 | } while (0) |
| 47 | |
| 48 | #endif /* _I40E_DEBUG_H_ */ |
| 49 | |