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 
14 struct 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 
28 struct bnxt_coredump {
29 	void		*data;
30 	int		data_size;
31 	u16		total_segs;
32 };
33 
34 struct bnxt_hwrm_dbg_dma_info {
35 	void *dest_buf;
36 	int dest_buf_size;
37 	u16 dma_len;
38 	u16 seq_off;
39 	u16 data_len_off;
40 	u16 segs;
41 };
42 
43 struct hwrm_dbg_cmn_input {
44 	__le16 req_type;
45 	__le16 cmpl_ring;
46 	__le16 seq_id;
47 	__le16 target_id;
48 	__le64 resp_addr;
49 	__le64 host_dest_addr;
50 	__le32 host_buf_len;
51 };
52 
53 struct hwrm_dbg_cmn_output {
54 	__le16 error_code;
55 	__le16 req_type;
56 	__le16 seq_id;
57 	__le16 resp_len;
58 	u8 flags;
59 	#define HWRM_DBG_CMN_FLAGS_MORE	1
60 };
61 
62 #define BNXT_LED_DFLT_ENA				\
63 	(PORT_LED_CFG_REQ_ENABLES_LED0_ID |		\
64 	 PORT_LED_CFG_REQ_ENABLES_LED0_STATE |		\
65 	 PORT_LED_CFG_REQ_ENABLES_LED0_BLINK_ON |	\
66 	 PORT_LED_CFG_REQ_ENABLES_LED0_BLINK_OFF |	\
67 	 PORT_LED_CFG_REQ_ENABLES_LED0_GROUP_ID)
68 
69 #define BNXT_LED_DFLT_ENA_SHIFT	6
70 
71 #define BNXT_LED_DFLT_ENABLES(x)			\
72 	cpu_to_le32(BNXT_LED_DFLT_ENA << (BNXT_LED_DFLT_ENA_SHIFT * (x)))
73 
74 #define BNXT_FW_RESET_AP	0xfffe
75 #define BNXT_FW_RESET_CHIP	0xffff
76 
77 extern const struct ethtool_ops bnxt_ethtool_ops;
78 
79 u32 _bnxt_fw_to_ethtool_adv_spds(u16, u8);
80 u32 bnxt_fw_to_ethtool_speed(u16);
81 u16 bnxt_get_fw_auto_link_speeds(u32);
82 void bnxt_ethtool_init(struct bnxt *bp);
83 void bnxt_ethtool_free(struct bnxt *bp);
84 
85 #endif
86