Loading...
1/* Broadcom NetXtreme-C/E network driver.
2 *
3 * Copyright (c) 2014-2016 Broadcom Corporation
4 * Copyright (c) 2016-2017 Broadcom Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation.
9 */
10
11#ifndef BNXT_ETHTOOL_H
12#define BNXT_ETHTOOL_H
13
14struct bnxt_led_cfg {
15 u8 led_id;
16 u8 led_state;
17 u8 led_color;
18 u8 unused;
19 __le16 led_blink_on;
20 __le16 led_blink_off;
21 u8 led_group_id;
22 u8 rsvd;
23};
24
25#define BNXT_LED_DFLT_ENA \
26 (PORT_LED_CFG_REQ_ENABLES_LED0_ID | \
27 PORT_LED_CFG_REQ_ENABLES_LED0_STATE | \
28 PORT_LED_CFG_REQ_ENABLES_LED0_BLINK_ON | \
29 PORT_LED_CFG_REQ_ENABLES_LED0_BLINK_OFF | \
30 PORT_LED_CFG_REQ_ENABLES_LED0_GROUP_ID)
31
32#define BNXT_LED_DFLT_ENA_SHIFT 6
33
34#define BNXT_LED_DFLT_ENABLES(x) \
35 cpu_to_le32(BNXT_LED_DFLT_ENA << (BNXT_LED_DFLT_ENA_SHIFT * (x)))
36
37#define BNXT_FW_RESET_AP (ETH_RESET_AP << ETH_RESET_SHARED_SHIFT)
38#define BNXT_FW_RESET_CHIP ((ETH_RESET_MGMT | ETH_RESET_IRQ | \
39 ETH_RESET_DMA | ETH_RESET_FILTER | \
40 ETH_RESET_OFFLOAD | ETH_RESET_MAC | \
41 ETH_RESET_PHY | ETH_RESET_RAM) \
42 << ETH_RESET_SHARED_SHIFT)
43
44#define BNXT_PXP_REG_LEN 0x3110
45
46extern const struct ethtool_ops bnxt_ethtool_ops;
47
48u32 bnxt_get_rxfh_indir_size(struct net_device *dev);
49u32 _bnxt_fw_to_ethtool_adv_spds(u16, u8);
50u32 bnxt_fw_to_ethtool_speed(u16);
51u16 bnxt_get_fw_auto_link_speeds(u32);
52int bnxt_hwrm_nvm_get_dev_info(struct bnxt *bp,
53 struct hwrm_nvm_get_dev_info_output *nvm_dev_info);
54int bnxt_hwrm_firmware_reset(struct net_device *dev, u8 proc_type,
55 u8 self_reset, u8 flags);
56int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware *fw,
57 u32 install_type, struct netlink_ext_ack *extack);
58int bnxt_get_pkginfo(struct net_device *dev, char *ver, int size);
59void bnxt_ethtool_init(struct bnxt *bp);
60void bnxt_ethtool_free(struct bnxt *bp);
61int bnxt_find_nvram_item(struct net_device *dev, u16 type, u16 ordinal,
62 u16 ext, u16 *index, u32 *item_length,
63 u32 *data_length);
64int bnxt_find_nvram_item(struct net_device *dev, u16 type, u16 ordinal,
65 u16 ext, u16 *index, u32 *item_length,
66 u32 *data_length);
67int bnxt_flash_nvram(struct net_device *dev, u16 dir_type,
68 u16 dir_ordinal, u16 dir_ext, u16 dir_attr,
69 u32 dir_item_len, const u8 *data,
70 size_t data_len);
71int bnxt_get_nvram_item(struct net_device *dev, u32 index, u32 offset,
72 u32 length, u8 *data);
73
74#endif
1/* Broadcom NetXtreme-C/E network driver.
2 *
3 * Copyright (c) 2014-2016 Broadcom Corporation
4 * Copyright (c) 2016-2017 Broadcom Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation.
9 */
10
11#ifndef BNXT_ETHTOOL_H
12#define BNXT_ETHTOOL_H
13
14struct bnxt_led_cfg {
15 u8 led_id;
16 u8 led_state;
17 u8 led_color;
18 u8 unused;
19 __le16 led_blink_on;
20 __le16 led_blink_off;
21 u8 led_group_id;
22 u8 rsvd;
23};
24
25#define COREDUMP_LIST_BUF_LEN 2048
26#define COREDUMP_RETRIEVE_BUF_LEN 4096
27
28struct bnxt_coredump {
29 void *data;
30 int data_size;
31 u16 total_segs;
32};
33
34#define BNXT_COREDUMP_BUF_LEN(len) ((len) - sizeof(struct bnxt_coredump_record))
35
36struct bnxt_hwrm_dbg_dma_info {
37 void *dest_buf;
38 int dest_buf_size;
39 u16 dma_len;
40 u16 seq_off;
41 u16 data_len_off;
42 u16 segs;
43 u32 seg_start;
44 u32 buf_len;
45};
46
47struct hwrm_dbg_cmn_input {
48 __le16 req_type;
49 __le16 cmpl_ring;
50 __le16 seq_id;
51 __le16 target_id;
52 __le64 resp_addr;
53 __le64 host_dest_addr;
54 __le32 host_buf_len;
55};
56
57struct hwrm_dbg_cmn_output {
58 __le16 error_code;
59 __le16 req_type;
60 __le16 seq_id;
61 __le16 resp_len;
62 u8 flags;
63 #define HWRM_DBG_CMN_FLAGS_MORE 1
64};
65
66#define BNXT_CRASH_DUMP_LEN (8 << 20)
67
68#define BNXT_LED_DFLT_ENA \
69 (PORT_LED_CFG_REQ_ENABLES_LED0_ID | \
70 PORT_LED_CFG_REQ_ENABLES_LED0_STATE | \
71 PORT_LED_CFG_REQ_ENABLES_LED0_BLINK_ON | \
72 PORT_LED_CFG_REQ_ENABLES_LED0_BLINK_OFF | \
73 PORT_LED_CFG_REQ_ENABLES_LED0_GROUP_ID)
74
75#define BNXT_LED_DFLT_ENA_SHIFT 6
76
77#define BNXT_LED_DFLT_ENABLES(x) \
78 cpu_to_le32(BNXT_LED_DFLT_ENA << (BNXT_LED_DFLT_ENA_SHIFT * (x)))
79
80#define BNXT_FW_RESET_AP (ETH_RESET_AP << ETH_RESET_SHARED_SHIFT)
81#define BNXT_FW_RESET_CHIP ((ETH_RESET_MGMT | ETH_RESET_IRQ | \
82 ETH_RESET_DMA | ETH_RESET_FILTER | \
83 ETH_RESET_OFFLOAD | ETH_RESET_MAC | \
84 ETH_RESET_PHY | ETH_RESET_RAM) \
85 << ETH_RESET_SHARED_SHIFT)
86
87#define BNXT_PXP_REG_LEN 0x3110
88
89extern const struct ethtool_ops bnxt_ethtool_ops;
90
91u32 bnxt_get_rxfh_indir_size(struct net_device *dev);
92u32 _bnxt_fw_to_ethtool_adv_spds(u16, u8);
93u32 bnxt_fw_to_ethtool_speed(u16);
94u16 bnxt_get_fw_auto_link_speeds(u32);
95int bnxt_flash_package_from_file(struct net_device *dev, const char *filename,
96 u32 install_type);
97void bnxt_ethtool_init(struct bnxt *bp);
98void bnxt_ethtool_free(struct bnxt *bp);
99
100#endif