xref: /onnv-gate/usr/src/uts/common/io/igb/igb_hw.h (revision 12111:a462ebfcbf99)
15779Sxy150489 /*
25779Sxy150489  * CDDL HEADER START
35779Sxy150489  *
45779Sxy150489  * The contents of this file are subject to the terms of the
55779Sxy150489  * Common Development and Distribution License (the "License").
65779Sxy150489  * You may not use this file except in compliance with the License.
75779Sxy150489  *
8*12111SGuoqing.Zhu@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*12111SGuoqing.Zhu@Sun.COM  * or http://www.opensolaris.org/os/licensing.
105779Sxy150489  * See the License for the specific language governing permissions
115779Sxy150489  * and limitations under the License.
125779Sxy150489  *
13*12111SGuoqing.Zhu@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*12111SGuoqing.Zhu@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
155779Sxy150489  * If applicable, add the following below this CDDL HEADER, with the
165779Sxy150489  * fields enclosed by brackets "[]" replaced with your own identifying
175779Sxy150489  * information: Portions Copyright [yyyy] [name of copyright owner]
185779Sxy150489  *
195779Sxy150489  * CDDL HEADER END
205779Sxy150489  */
215779Sxy150489 
225779Sxy150489 /*
23*12111SGuoqing.Zhu@Sun.COM  * Copyright(c) 2007-2010 Intel Corporation. All rights reserved.
248275SEric Cheng  */
258275SEric Cheng 
26*12111SGuoqing.Zhu@Sun.COM /*
27*12111SGuoqing.Zhu@Sun.COM  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28*12111SGuoqing.Zhu@Sun.COM  */
29*12111SGuoqing.Zhu@Sun.COM 
30*12111SGuoqing.Zhu@Sun.COM /* IntelVersion: 1.446.2.1 v3_3_14_3_BHSW1 */
315812Sxy150489 
325779Sxy150489 #ifndef _IGB_HW_H
335779Sxy150489 #define	_IGB_HW_H
345779Sxy150489 
355779Sxy150489 #ifdef __cplusplus
365779Sxy150489 extern "C" {
375779Sxy150489 #endif
385779Sxy150489 
395779Sxy150489 #include "igb_osdep.h"
405779Sxy150489 #include "igb_regs.h"
415779Sxy150489 #include "igb_defines.h"
425779Sxy150489 
435779Sxy150489 struct e1000_hw;
445779Sxy150489 
458571SChenlu.Chen@Sun.COM #define	E1000_DEV_ID_82576			0x10C9
468571SChenlu.Chen@Sun.COM #define	E1000_DEV_ID_82576_FIBER		0x10E6
478571SChenlu.Chen@Sun.COM #define	E1000_DEV_ID_82576_SERDES		0x10E7
488571SChenlu.Chen@Sun.COM #define	E1000_DEV_ID_82576_QUAD_COPPER		0x10E8
4910319SJason.Xu@Sun.COM #define	E1000_DEV_ID_82576_NS			0x150A
5011155SJason.Xu@Sun.COM #define	E1000_DEV_ID_82576_NS_SERDES		0x1518
5110319SJason.Xu@Sun.COM #define	E1000_DEV_ID_82576_SERDES_QUAD		0x150D
525779Sxy150489 #define	E1000_DEV_ID_82575EB_COPPER		0x10A7
535779Sxy150489 #define	E1000_DEV_ID_82575EB_FIBER_SERDES	0x10A9
545779Sxy150489 #define	E1000_DEV_ID_82575GB_QUAD_COPPER	0x10D6
5511155SJason.Xu@Sun.COM #define	E1000_DEV_ID_82580_COPPER		0x150E
5611155SJason.Xu@Sun.COM #define	E1000_DEV_ID_82580_FIBER		0x150F
5711155SJason.Xu@Sun.COM #define	E1000_DEV_ID_82580_SERDES		0x1510
5811155SJason.Xu@Sun.COM #define	E1000_DEV_ID_82580_SGMII		0x1511
5911155SJason.Xu@Sun.COM #define	E1000_DEV_ID_82580_COPPER_DUAL		0x1516
605779Sxy150489 
615779Sxy150489 #define	E1000_REVISION_0 0
625779Sxy150489 #define	E1000_REVISION_1 1
635779Sxy150489 #define	E1000_REVISION_2 2
645779Sxy150489 #define	E1000_REVISION_3 3
655779Sxy150489 #define	E1000_REVISION_4 4
665779Sxy150489 
675779Sxy150489 #define	E1000_FUNC_0	0
685779Sxy150489 #define	E1000_FUNC_1	1
6911155SJason.Xu@Sun.COM #define	E1000_FUNC_2	2
7011155SJason.Xu@Sun.COM #define	E1000_FUNC_3	3
7111155SJason.Xu@Sun.COM 
7210319SJason.Xu@Sun.COM #define	E1000_ALT_MAC_ADDRESS_OFFSET_LAN0	0
7310319SJason.Xu@Sun.COM #define	E1000_ALT_MAC_ADDRESS_OFFSET_LAN1	3
7411155SJason.Xu@Sun.COM #define	E1000_ALT_MAC_ADDRESS_OFFSET_LAN2	6
7511155SJason.Xu@Sun.COM #define	E1000_ALT_MAC_ADDRESS_OFFSET_LAN3	9
765779Sxy150489 
778571SChenlu.Chen@Sun.COM enum e1000_mac_type {
785779Sxy150489 	e1000_undefined = 0,
795779Sxy150489 	e1000_82575,
808571SChenlu.Chen@Sun.COM 	e1000_82576,
8111155SJason.Xu@Sun.COM 	e1000_82580,
825779Sxy150489 	e1000_num_macs  /* List is 1-based, so subtract 1 for true count. */
838571SChenlu.Chen@Sun.COM };
845779Sxy150489 
858571SChenlu.Chen@Sun.COM enum e1000_media_type {
865779Sxy150489 	e1000_media_type_unknown = 0,
875779Sxy150489 	e1000_media_type_copper = 1,
885779Sxy150489 	e1000_media_type_fiber = 2,
895779Sxy150489 	e1000_media_type_internal_serdes = 3,
905779Sxy150489 	e1000_num_media_types
918571SChenlu.Chen@Sun.COM };
925779Sxy150489 
938571SChenlu.Chen@Sun.COM enum e1000_nvm_type {
945779Sxy150489 	e1000_nvm_unknown = 0,
955779Sxy150489 	e1000_nvm_none,
965779Sxy150489 	e1000_nvm_eeprom_spi,
975779Sxy150489 	e1000_nvm_eeprom_microwire,
985779Sxy150489 	e1000_nvm_flash_hw,
995779Sxy150489 	e1000_nvm_flash_sw
1008571SChenlu.Chen@Sun.COM };
1015779Sxy150489 
1028571SChenlu.Chen@Sun.COM enum e1000_nvm_override {
1035779Sxy150489 	e1000_nvm_override_none = 0,
1045779Sxy150489 	e1000_nvm_override_spi_small,
1055779Sxy150489 	e1000_nvm_override_spi_large,
1065779Sxy150489 	e1000_nvm_override_microwire_small,
1075779Sxy150489 	e1000_nvm_override_microwire_large
1088571SChenlu.Chen@Sun.COM };
1095779Sxy150489 
1108571SChenlu.Chen@Sun.COM enum e1000_phy_type {
1115779Sxy150489 	e1000_phy_unknown = 0,
1125779Sxy150489 	e1000_phy_none,
1135779Sxy150489 	e1000_phy_m88,
1145779Sxy150489 	e1000_phy_igp,
1155779Sxy150489 	e1000_phy_igp_2,
1165779Sxy150489 	e1000_phy_gg82563,
1175779Sxy150489 	e1000_phy_igp_3,
1185779Sxy150489 	e1000_phy_ife,
11911155SJason.Xu@Sun.COM 	e1000_phy_82580,
1208571SChenlu.Chen@Sun.COM 	e1000_phy_vf
1218571SChenlu.Chen@Sun.COM };
1225779Sxy150489 
1238571SChenlu.Chen@Sun.COM enum e1000_bus_type {
1245779Sxy150489 	e1000_bus_type_unknown = 0,
1255779Sxy150489 	e1000_bus_type_pci,
1265779Sxy150489 	e1000_bus_type_pcix,
1275779Sxy150489 	e1000_bus_type_pci_express,
1285779Sxy150489 	e1000_bus_type_reserved
1298571SChenlu.Chen@Sun.COM };
1305779Sxy150489 
1318571SChenlu.Chen@Sun.COM enum e1000_bus_speed {
1325779Sxy150489 	e1000_bus_speed_unknown = 0,
1335779Sxy150489 	e1000_bus_speed_33,
1345779Sxy150489 	e1000_bus_speed_66,
1355779Sxy150489 	e1000_bus_speed_100,
1365779Sxy150489 	e1000_bus_speed_120,
1375779Sxy150489 	e1000_bus_speed_133,
1385779Sxy150489 	e1000_bus_speed_2500,
1395779Sxy150489 	e1000_bus_speed_5000,
1405779Sxy150489 	e1000_bus_speed_reserved
1418571SChenlu.Chen@Sun.COM };
1425779Sxy150489 
1438571SChenlu.Chen@Sun.COM enum e1000_bus_width {
1445779Sxy150489 	e1000_bus_width_unknown = 0,
1455779Sxy150489 	e1000_bus_width_pcie_x1,
1465779Sxy150489 	e1000_bus_width_pcie_x2,
1475779Sxy150489 	e1000_bus_width_pcie_x4 = 4,
1485779Sxy150489 	e1000_bus_width_pcie_x8 = 8,
1495779Sxy150489 	e1000_bus_width_32,
1505779Sxy150489 	e1000_bus_width_64,
1515779Sxy150489 	e1000_bus_width_reserved
1528571SChenlu.Chen@Sun.COM };
1535779Sxy150489 
1548571SChenlu.Chen@Sun.COM enum e1000_1000t_rx_status {
1555779Sxy150489 	e1000_1000t_rx_status_not_ok = 0,
1565779Sxy150489 	e1000_1000t_rx_status_ok,
1575779Sxy150489 	e1000_1000t_rx_status_undefined = 0xFF
1588571SChenlu.Chen@Sun.COM };
1595779Sxy150489 
1608571SChenlu.Chen@Sun.COM enum e1000_rev_polarity {
1615779Sxy150489 	e1000_rev_polarity_normal = 0,
1625779Sxy150489 	e1000_rev_polarity_reversed,
1635779Sxy150489 	e1000_rev_polarity_undefined = 0xFF
1648571SChenlu.Chen@Sun.COM };
1655779Sxy150489 
1668571SChenlu.Chen@Sun.COM enum e1000_fc_mode {
1675779Sxy150489 	e1000_fc_none = 0,
1685779Sxy150489 	e1000_fc_rx_pause,
1695779Sxy150489 	e1000_fc_tx_pause,
1705779Sxy150489 	e1000_fc_full,
1715779Sxy150489 	e1000_fc_default = 0xFF
1728571SChenlu.Chen@Sun.COM };
1738571SChenlu.Chen@Sun.COM 
1748571SChenlu.Chen@Sun.COM enum e1000_ms_type {
1758571SChenlu.Chen@Sun.COM 	e1000_ms_hw_default = 0,
1768571SChenlu.Chen@Sun.COM 	e1000_ms_force_master,
1778571SChenlu.Chen@Sun.COM 	e1000_ms_force_slave,
1788571SChenlu.Chen@Sun.COM 	e1000_ms_auto
1798571SChenlu.Chen@Sun.COM };
1808571SChenlu.Chen@Sun.COM 
1818571SChenlu.Chen@Sun.COM enum e1000_smart_speed {
1828571SChenlu.Chen@Sun.COM 	e1000_smart_speed_default = 0,
1838571SChenlu.Chen@Sun.COM 	e1000_smart_speed_on,
1848571SChenlu.Chen@Sun.COM 	e1000_smart_speed_off
1858571SChenlu.Chen@Sun.COM };
1865779Sxy150489 
18710319SJason.Xu@Sun.COM enum e1000_serdes_link_state {
18810319SJason.Xu@Sun.COM 	e1000_serdes_link_down = 0,
18910319SJason.Xu@Sun.COM 	e1000_serdes_link_autoneg_progress,
19010319SJason.Xu@Sun.COM 	e1000_serdes_link_autoneg_complete,
19110319SJason.Xu@Sun.COM 	e1000_serdes_link_forced_up
19210319SJason.Xu@Sun.COM };
19310319SJason.Xu@Sun.COM 
1945779Sxy150489 /* Receive Descriptor */
1955779Sxy150489 struct e1000_rx_desc {
1968571SChenlu.Chen@Sun.COM 	__le64 buffer_addr; /* Address of the descriptor's data buffer */
1978571SChenlu.Chen@Sun.COM 	__le16 length;	/* Length of data DMAed into data buffer */
1988571SChenlu.Chen@Sun.COM 	__le16 csum;	/* Packet checksum */
1995779Sxy150489 	u8  status;	/* Descriptor status */
2005779Sxy150489 	u8  errors;	/* Descriptor Errors */
2018571SChenlu.Chen@Sun.COM 	__le16 special;
2025779Sxy150489 };
2035779Sxy150489 
2045779Sxy150489 /* Receive Descriptor - Extended */
2055779Sxy150489 union e1000_rx_desc_extended {
2065779Sxy150489 	struct {
2078571SChenlu.Chen@Sun.COM 		__le64 buffer_addr;
2088571SChenlu.Chen@Sun.COM 		__le64 reserved;
2095779Sxy150489 	} read;
2105779Sxy150489 	struct {
2115779Sxy150489 		struct {
2128571SChenlu.Chen@Sun.COM 			__le32 mrq;	/* Multiple Rx Queues */
2135779Sxy150489 			union {
2148571SChenlu.Chen@Sun.COM 				__le32 rss;	/* RSS Hash */
2155779Sxy150489 				struct {
2168571SChenlu.Chen@Sun.COM 					__le16 ip_id;  /* IP id */
2178571SChenlu.Chen@Sun.COM 					__le16 csum;   /* Packet Checksum */
2185779Sxy150489 				} csum_ip;
2195779Sxy150489 			} hi_dword;
2205779Sxy150489 		} lower;
2215779Sxy150489 		struct {
2228571SChenlu.Chen@Sun.COM 			__le32 status_error;	/* ext status/error */
2238571SChenlu.Chen@Sun.COM 			__le16 length;
2248571SChenlu.Chen@Sun.COM 			__le16 vlan;		/* VLAN tag */
2255779Sxy150489 		} upper;
2265779Sxy150489 	} wb;  /* writeback */
2275779Sxy150489 };
2285779Sxy150489 
2295779Sxy150489 #define	MAX_PS_BUFFERS 4
2305779Sxy150489 /* Receive Descriptor - Packet Split */
2315779Sxy150489 union e1000_rx_desc_packet_split {
2325779Sxy150489 	struct {
2335779Sxy150489 		/* one buffer for protocol header(s), three data buffers */
2348571SChenlu.Chen@Sun.COM 		__le64 buffer_addr[MAX_PS_BUFFERS];
2355779Sxy150489 	} read;
2365779Sxy150489 	struct {
2375779Sxy150489 		struct {
2388571SChenlu.Chen@Sun.COM 			__le32 mrq;	/* Multiple Rx Queues */
2395779Sxy150489 			union {
2408571SChenlu.Chen@Sun.COM 				__le32 rss;	/* RSS Hash */
2415779Sxy150489 				struct {
2428571SChenlu.Chen@Sun.COM 					__le16 ip_id;	/* IP id */
2438571SChenlu.Chen@Sun.COM 					__le16 csum;	/* Packet Checksum */
2445779Sxy150489 				} csum_ip;
2455779Sxy150489 			} hi_dword;
2465779Sxy150489 		} lower;
2475779Sxy150489 		struct {
2488571SChenlu.Chen@Sun.COM 			__le32 status_error;	/* ext status/error */
2498571SChenlu.Chen@Sun.COM 			__le16 length0;	/* length of buffer 0 */
2508571SChenlu.Chen@Sun.COM 			__le16 vlan;	/* VLAN tag */
2515779Sxy150489 		} middle;
2525779Sxy150489 		struct {
2538571SChenlu.Chen@Sun.COM 			__le16 header_status;
2548571SChenlu.Chen@Sun.COM 			__le16 length[3];	/* length of buffers 1-3 */
2555779Sxy150489 		} upper;
2568571SChenlu.Chen@Sun.COM 		__le64 reserved;
2575779Sxy150489 	} wb; /* writeback */
2585779Sxy150489 };
2595779Sxy150489 
2605779Sxy150489 /* Transmit Descriptor */
2615779Sxy150489 struct e1000_tx_desc {
2628571SChenlu.Chen@Sun.COM 	__le64 buffer_addr;	/* Address of the descriptor's data buffer */
2635779Sxy150489 	union {
2648571SChenlu.Chen@Sun.COM 		__le32 data;
2655779Sxy150489 		struct {
2668571SChenlu.Chen@Sun.COM 			__le16 length;	/* Data buffer length */
2675779Sxy150489 			u8 cso;		/* Checksum offset */
2685779Sxy150489 			u8 cmd;		/* Descriptor control */
2695779Sxy150489 		} flags;
2705779Sxy150489 	} lower;
2715779Sxy150489 	union {
2728571SChenlu.Chen@Sun.COM 		__le32 data;
2735779Sxy150489 		struct {
2745779Sxy150489 			u8 status;	/* Descriptor status */
2755779Sxy150489 			u8 css;		/* Checksum start */
2768571SChenlu.Chen@Sun.COM 			__le16 special;
2775779Sxy150489 		} fields;
2785779Sxy150489 	} upper;
2795779Sxy150489 };
2805779Sxy150489 
2815779Sxy150489 /* Offload Context Descriptor */
2825779Sxy150489 struct e1000_context_desc {
2835779Sxy150489 	union {
2848571SChenlu.Chen@Sun.COM 		__le32 ip_config;
2855779Sxy150489 		struct {
2865779Sxy150489 			u8 ipcss;	/* IP checksum start */
2875779Sxy150489 			u8 ipcso;	/* IP checksum offset */
2888571SChenlu.Chen@Sun.COM 			__le16 ipcse;	/* IP checksum end */
2895779Sxy150489 		} ip_fields;
2905779Sxy150489 	} lower_setup;
2915779Sxy150489 	union {
2928571SChenlu.Chen@Sun.COM 		__le32 tcp_config;
2935779Sxy150489 		struct {
2945779Sxy150489 			u8 tucss;	/* TCP checksum start */
2955779Sxy150489 			u8 tucso;	/* TCP checksum offset */
2968571SChenlu.Chen@Sun.COM 			__le16 tucse;	/* TCP checksum end */
2975779Sxy150489 		} tcp_fields;
2985779Sxy150489 	} upper_setup;
2998571SChenlu.Chen@Sun.COM 	__le32 cmd_and_length;
3005779Sxy150489 	union {
3018571SChenlu.Chen@Sun.COM 		__le32 data;
3025779Sxy150489 		struct {
3035779Sxy150489 			u8 status;	/* Descriptor status */
3045779Sxy150489 			u8 hdr_len;	/* Header length */
3058571SChenlu.Chen@Sun.COM 			__le16 mss;	/* Maximum segment size */
3065779Sxy150489 		} fields;
3075779Sxy150489 	} tcp_seg_setup;
3085779Sxy150489 };
3095779Sxy150489 
3105779Sxy150489 /* Offload data descriptor */
3115779Sxy150489 struct e1000_data_desc {
3128571SChenlu.Chen@Sun.COM 	__le64 buffer_addr;   /* Address of the descriptor's buffer address */
3135779Sxy150489 	union {
3148571SChenlu.Chen@Sun.COM 		__le32 data;
3155779Sxy150489 		struct {
3168571SChenlu.Chen@Sun.COM 			__le16 length;    /* Data buffer length */
3175779Sxy150489 			u8 typ_len_ext;
3185779Sxy150489 			u8 cmd;
3195779Sxy150489 		} flags;
3205779Sxy150489 	} lower;
3215779Sxy150489 	union {
3228571SChenlu.Chen@Sun.COM 		__le32 data;
3235779Sxy150489 		struct {
3245779Sxy150489 			u8 status;	/* Descriptor status */
3255779Sxy150489 			u8 popts;	/* Packet Options */
3268571SChenlu.Chen@Sun.COM 			__le16 special;
3275779Sxy150489 		} fields;
3285779Sxy150489 	} upper;
3295779Sxy150489 };
3305779Sxy150489 
3315779Sxy150489 /* Statistics counters collected by the MAC */
3325779Sxy150489 struct e1000_hw_stats {
3335779Sxy150489 	u64 crcerrs;
3345779Sxy150489 	u64 algnerrc;
3355779Sxy150489 	u64 symerrs;
3365779Sxy150489 	u64 rxerrc;
3375779Sxy150489 	u64 mpc;
3385779Sxy150489 	u64 scc;
3395779Sxy150489 	u64 ecol;
3405779Sxy150489 	u64 mcc;
3415779Sxy150489 	u64 latecol;
3425779Sxy150489 	u64 colc;
3435779Sxy150489 	u64 dc;
3445779Sxy150489 	u64 tncrs;
3455779Sxy150489 	u64 sec;
3465779Sxy150489 	u64 cexterr;
3475779Sxy150489 	u64 rlec;
3485779Sxy150489 	u64 xonrxc;
3495779Sxy150489 	u64 xontxc;
3505779Sxy150489 	u64 xoffrxc;
3515779Sxy150489 	u64 xofftxc;
3525779Sxy150489 	u64 fcruc;
3535779Sxy150489 	u64 prc64;
3545779Sxy150489 	u64 prc127;
3555779Sxy150489 	u64 prc255;
3565779Sxy150489 	u64 prc511;
3575779Sxy150489 	u64 prc1023;
3585779Sxy150489 	u64 prc1522;
3595779Sxy150489 	u64 gprc;
3605779Sxy150489 	u64 bprc;
3615779Sxy150489 	u64 mprc;
3625779Sxy150489 	u64 gptc;
3635779Sxy150489 	u64 gorc;
3645779Sxy150489 	u64 gotc;
3655779Sxy150489 	u64 rnbc;
3665779Sxy150489 	u64 ruc;
3675779Sxy150489 	u64 rfc;
3685779Sxy150489 	u64 roc;
3695779Sxy150489 	u64 rjc;
3705779Sxy150489 	u64 mgprc;
3715779Sxy150489 	u64 mgpdc;
3725779Sxy150489 	u64 mgptc;
3735779Sxy150489 	u64 tor;
3745779Sxy150489 	u64 tot;
3755779Sxy150489 	u64 tpr;
3765779Sxy150489 	u64 tpt;
3775779Sxy150489 	u64 ptc64;
3785779Sxy150489 	u64 ptc127;
3795779Sxy150489 	u64 ptc255;
3805779Sxy150489 	u64 ptc511;
3815779Sxy150489 	u64 ptc1023;
3825779Sxy150489 	u64 ptc1522;
3835779Sxy150489 	u64 mptc;
3845779Sxy150489 	u64 bptc;
3855779Sxy150489 	u64 tsctc;
3865779Sxy150489 	u64 tsctfc;
3875779Sxy150489 	u64 iac;
3885779Sxy150489 	u64 icrxptc;
3895779Sxy150489 	u64 icrxatc;
3905779Sxy150489 	u64 ictxptc;
3915779Sxy150489 	u64 ictxatc;
3925779Sxy150489 	u64 ictxqec;
3935779Sxy150489 	u64 ictxqmtc;
3945779Sxy150489 	u64 icrxdmtc;
3955779Sxy150489 	u64 icrxoc;
3965779Sxy150489 	u64 cbtmpc;
3975779Sxy150489 	u64 htdpmc;
3985779Sxy150489 	u64 cbrdpc;
3995779Sxy150489 	u64 cbrmpc;
4005779Sxy150489 	u64 rpthc;
4015779Sxy150489 	u64 hgptc;
4025779Sxy150489 	u64 htcbdpc;
4035779Sxy150489 	u64 hgorc;
4045779Sxy150489 	u64 hgotc;
4055779Sxy150489 	u64 lenerrs;
4065779Sxy150489 	u64 scvpc;
4075779Sxy150489 	u64 hrmpc;
4088571SChenlu.Chen@Sun.COM 	u64 doosync;
4095779Sxy150489 };
4105779Sxy150489 
4115779Sxy150489 struct e1000_phy_stats {
4125779Sxy150489 	u32 idle_errors;
4135779Sxy150489 	u32 receive_errors;
4145779Sxy150489 };
4155779Sxy150489 
4165779Sxy150489 struct e1000_host_mng_dhcp_cookie {
4175779Sxy150489 	u32 signature;
4185779Sxy150489 	u8  status;
4195779Sxy150489 	u8  reserved0;
4205779Sxy150489 	u16 vlan_id;
4215779Sxy150489 	u32 reserved1;
4225779Sxy150489 	u16 reserved2;
4235779Sxy150489 	u8  reserved3;
4245779Sxy150489 	u8  checksum;
4255779Sxy150489 };
4265779Sxy150489 
4275779Sxy150489 /* Host Interface "Rev 1" */
4285779Sxy150489 struct e1000_host_command_header {
4295779Sxy150489 	u8 command_id;
4305779Sxy150489 	u8 command_length;
4315779Sxy150489 	u8 command_options;
4325779Sxy150489 	u8 checksum;
4335779Sxy150489 };
4345779Sxy150489 
4355779Sxy150489 #define	E1000_HI_MAX_DATA_LENGTH	252
4365779Sxy150489 struct e1000_host_command_info {
4375779Sxy150489 	struct e1000_host_command_header command_header;
4385779Sxy150489 	u8 command_data[E1000_HI_MAX_DATA_LENGTH];
4395779Sxy150489 };
4405779Sxy150489 
4415779Sxy150489 /* Host Interface "Rev 2" */
4425779Sxy150489 struct e1000_host_mng_command_header {
4435779Sxy150489 	u8  command_id;
4445779Sxy150489 	u8  checksum;
4455779Sxy150489 	u16 reserved1;
4465779Sxy150489 	u16 reserved2;
4475779Sxy150489 	u16 command_length;
4485779Sxy150489 };
4495779Sxy150489 
4505779Sxy150489 #define	E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8
4515779Sxy150489 struct e1000_host_mng_command_info {
4525779Sxy150489 	struct e1000_host_mng_command_header command_header;
4535779Sxy150489 	u8 command_data[E1000_HI_MAX_MNG_DATA_LENGTH];
4545779Sxy150489 };
4555779Sxy150489 
4565779Sxy150489 #include "igb_mac.h"
4575779Sxy150489 #include "igb_phy.h"
4585779Sxy150489 #include "igb_nvm.h"
4595779Sxy150489 #include "igb_manage.h"
4605779Sxy150489 
4618571SChenlu.Chen@Sun.COM struct e1000_mac_operations {
4625779Sxy150489 	/* Function pointers for the MAC. */
4638571SChenlu.Chen@Sun.COM 	s32  (*init_params)(struct e1000_hw *);
46410319SJason.Xu@Sun.COM 	s32  (*id_led_init)(struct e1000_hw *);
4655779Sxy150489 	s32  (*blink_led)(struct e1000_hw *);
4665779Sxy150489 	s32  (*check_for_link)(struct e1000_hw *);
4675779Sxy150489 	bool (*check_mng_mode)(struct e1000_hw *hw);
4685779Sxy150489 	s32  (*cleanup_led)(struct e1000_hw *);
4695779Sxy150489 	void (*clear_hw_cntrs)(struct e1000_hw *);
4705779Sxy150489 	void (*clear_vfta)(struct e1000_hw *);
4715779Sxy150489 	s32  (*get_bus_info)(struct e1000_hw *);
47210319SJason.Xu@Sun.COM 	void (*set_lan_id)(struct e1000_hw *);
4735779Sxy150489 	s32  (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *);
4745779Sxy150489 	s32  (*led_on)(struct e1000_hw *);
4755779Sxy150489 	s32  (*led_off)(struct e1000_hw *);
47610319SJason.Xu@Sun.COM 	void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32);
4775779Sxy150489 	s32  (*reset_hw)(struct e1000_hw *);
4785779Sxy150489 	s32  (*init_hw)(struct e1000_hw *);
4798571SChenlu.Chen@Sun.COM 	void (*shutdown_serdes)(struct e1000_hw *);
4805779Sxy150489 	s32  (*setup_link)(struct e1000_hw *);
4815779Sxy150489 	s32  (*setup_physical_interface)(struct e1000_hw *);
4825779Sxy150489 	s32  (*setup_led)(struct e1000_hw *);
4835779Sxy150489 	void (*write_vfta)(struct e1000_hw *, u32, u32);
4845779Sxy150489 	void (*mta_set)(struct e1000_hw *, u32);
4855779Sxy150489 	void (*config_collision_dist)(struct e1000_hw *);
4865779Sxy150489 	void (*rar_set)(struct e1000_hw *, u8*, u32);
4875779Sxy150489 	s32  (*read_mac_addr)(struct e1000_hw *);
4885779Sxy150489 	s32  (*validate_mdi_setting)(struct e1000_hw *);
4895779Sxy150489 	s32  (*mng_host_if_write)(struct e1000_hw *, u8*, u16, u16, u8*);
4905779Sxy150489 	s32  (*mng_write_cmd_header)(struct e1000_hw *hw,
4915779Sxy150489 	    struct e1000_host_mng_command_header *);
4925779Sxy150489 	s32  (*mng_enable_host_if)(struct e1000_hw *);
4935779Sxy150489 	s32  (*wait_autoneg)(struct e1000_hw *);
4948571SChenlu.Chen@Sun.COM };
4955779Sxy150489 
4968571SChenlu.Chen@Sun.COM struct e1000_phy_operations {
4978571SChenlu.Chen@Sun.COM 	s32  (*init_params)(struct e1000_hw *);
4988571SChenlu.Chen@Sun.COM 	s32  (*acquire)(struct e1000_hw *);
4995779Sxy150489 	s32  (*check_polarity)(struct e1000_hw *);
5005779Sxy150489 	s32  (*check_reset_block)(struct e1000_hw *);
5018571SChenlu.Chen@Sun.COM 	s32  (*commit)(struct e1000_hw *);
5025779Sxy150489 	s32  (*force_speed_duplex)(struct e1000_hw *);
5035779Sxy150489 	s32  (*get_cfg_done)(struct e1000_hw *hw);
5045779Sxy150489 	s32  (*get_cable_length)(struct e1000_hw *);
5058571SChenlu.Chen@Sun.COM 	s32  (*get_info)(struct e1000_hw *);
5068571SChenlu.Chen@Sun.COM 	s32  (*read_reg)(struct e1000_hw *, u32, u16 *);
50711155SJason.Xu@Sun.COM 	s32  (*read_reg_locked)(struct e1000_hw *, u32, u16 *);
5088571SChenlu.Chen@Sun.COM 	void (*release)(struct e1000_hw *);
5098571SChenlu.Chen@Sun.COM 	s32  (*reset)(struct e1000_hw *);
5105779Sxy150489 	s32  (*set_d0_lplu_state)(struct e1000_hw *, bool);
5115779Sxy150489 	s32  (*set_d3_lplu_state)(struct e1000_hw *, bool);
5128571SChenlu.Chen@Sun.COM 	s32  (*write_reg)(struct e1000_hw *, u32, u16);
51311155SJason.Xu@Sun.COM 	s32  (*write_reg_locked)(struct e1000_hw *, u32, u16);
5148571SChenlu.Chen@Sun.COM 	void (*power_up)(struct e1000_hw *);
5158571SChenlu.Chen@Sun.COM 	void (*power_down)(struct e1000_hw *);
5168571SChenlu.Chen@Sun.COM };
5175779Sxy150489 
5188571SChenlu.Chen@Sun.COM struct e1000_nvm_operations {
5198571SChenlu.Chen@Sun.COM 	s32  (*init_params)(struct e1000_hw *);
5208571SChenlu.Chen@Sun.COM 	s32  (*acquire)(struct e1000_hw *);
5218571SChenlu.Chen@Sun.COM 	s32  (*read)(struct e1000_hw *, u16, u16, u16 *);
5228571SChenlu.Chen@Sun.COM 	void (*release)(struct e1000_hw *);
5238571SChenlu.Chen@Sun.COM 	void (*reload)(struct e1000_hw *);
5248571SChenlu.Chen@Sun.COM 	s32  (*update)(struct e1000_hw *);
5255779Sxy150489 	s32  (*valid_led_default)(struct e1000_hw *, u16 *);
5268571SChenlu.Chen@Sun.COM 	s32  (*validate)(struct e1000_hw *);
5278571SChenlu.Chen@Sun.COM 	s32  (*write)(struct e1000_hw *, u16, u16, u16 *);
5285779Sxy150489 };
5295779Sxy150489 
5305779Sxy150489 struct e1000_mac_info {
5318571SChenlu.Chen@Sun.COM 	struct e1000_mac_operations ops;
5325779Sxy150489 	u8 addr[6];
5335779Sxy150489 	u8 perm_addr[6];
5345779Sxy150489 
5358571SChenlu.Chen@Sun.COM 	enum e1000_mac_type type;
5365779Sxy150489 
5375779Sxy150489 	u32 collision_delta;
5385779Sxy150489 	u32 ledctl_default;
5395779Sxy150489 	u32 ledctl_mode1;
5405779Sxy150489 	u32 ledctl_mode2;
5415779Sxy150489 	u32 mc_filter_type;
5425779Sxy150489 	u32 tx_packet_delta;
5435779Sxy150489 	u32 txcw;
5445779Sxy150489 
5455779Sxy150489 	u16 current_ifs_val;
5465779Sxy150489 	u16 ifs_max_val;
5475779Sxy150489 	u16 ifs_min_val;
5485779Sxy150489 	u16 ifs_ratio;
5495779Sxy150489 	u16 ifs_step_size;
5505779Sxy150489 	u16 mta_reg_count;
55111155SJason.Xu@Sun.COM 	u16 uta_reg_count;
55210319SJason.Xu@Sun.COM 
55310319SJason.Xu@Sun.COM 	/* Maximum size of the MTA register table in all supported adapters */
55410319SJason.Xu@Sun.COM #define	MAX_MTA_REG 128
55510319SJason.Xu@Sun.COM 	u32 mta_shadow[MAX_MTA_REG];
5565779Sxy150489 	u16 rar_entry_count;
5575779Sxy150489 
5585779Sxy150489 	u8  forced_speed_duplex;
5595779Sxy150489 
5605779Sxy150489 	bool adaptive_ifs;
5615779Sxy150489 	bool arc_subsystem_valid;
5625779Sxy150489 	bool asf_firmware_present;
5635779Sxy150489 	bool autoneg;
5645779Sxy150489 	bool autoneg_failed;
5655779Sxy150489 	bool get_link_status;
5665779Sxy150489 	bool in_ifs_mode;
56710319SJason.Xu@Sun.COM 	enum e1000_serdes_link_state serdes_link_state;
5685779Sxy150489 	bool serdes_has_link;
5695779Sxy150489 	bool tx_pkt_filtering;
5705779Sxy150489 };
5715779Sxy150489 
5725779Sxy150489 struct e1000_phy_info {
5738571SChenlu.Chen@Sun.COM 	struct e1000_phy_operations ops;
5748571SChenlu.Chen@Sun.COM 	enum e1000_phy_type type;
5755779Sxy150489 
5768571SChenlu.Chen@Sun.COM 	enum e1000_1000t_rx_status local_rx;
5778571SChenlu.Chen@Sun.COM 	enum e1000_1000t_rx_status remote_rx;
5788571SChenlu.Chen@Sun.COM 	enum e1000_ms_type ms_type;
5798571SChenlu.Chen@Sun.COM 	enum e1000_ms_type original_ms_type;
5808571SChenlu.Chen@Sun.COM 	enum e1000_rev_polarity cable_polarity;
5818571SChenlu.Chen@Sun.COM 	enum e1000_smart_speed smart_speed;
5825779Sxy150489 
5835779Sxy150489 	u32 addr;
5845779Sxy150489 	u32 id;
5855779Sxy150489 	u32 reset_delay_us; /* in usec */
5865779Sxy150489 	u32 revision;
5875779Sxy150489 
5888571SChenlu.Chen@Sun.COM 	enum e1000_media_type media_type;
5895779Sxy150489 
5905779Sxy150489 	u16 autoneg_advertised;
5915779Sxy150489 	u16 autoneg_mask;
5925779Sxy150489 	u16 cable_length;
5935779Sxy150489 	u16 max_cable_length;
5945779Sxy150489 	u16 min_cable_length;
5955779Sxy150489 
5965779Sxy150489 	u8 mdix;
5975779Sxy150489 
5985779Sxy150489 	bool disable_polarity_correction;
5995779Sxy150489 	bool is_mdix;
6005779Sxy150489 	bool polarity_correction;
6015779Sxy150489 	bool reset_disable;
6025779Sxy150489 	bool speed_downgraded;
6035779Sxy150489 	bool autoneg_wait_to_complete;
6045779Sxy150489 };
6055779Sxy150489 
6065779Sxy150489 struct e1000_nvm_info {
6078571SChenlu.Chen@Sun.COM 	struct e1000_nvm_operations ops;
6088571SChenlu.Chen@Sun.COM 	enum e1000_nvm_type type;
6098571SChenlu.Chen@Sun.COM 	enum e1000_nvm_override override;
6105779Sxy150489 
6115779Sxy150489 	u32 flash_bank_size;
6125779Sxy150489 	u32 flash_base_addr;
6135779Sxy150489 
6145779Sxy150489 	u16 word_size;
6155779Sxy150489 	u16 delay_usec;
6165779Sxy150489 	u16 address_bits;
6175779Sxy150489 	u16 opcode_bits;
6185779Sxy150489 	u16 page_size;
6195779Sxy150489 };
6205779Sxy150489 
6215779Sxy150489 struct e1000_bus_info {
6228571SChenlu.Chen@Sun.COM 	enum e1000_bus_type type;
6238571SChenlu.Chen@Sun.COM 	enum e1000_bus_speed speed;
6248571SChenlu.Chen@Sun.COM 	enum e1000_bus_width width;
6255779Sxy150489 
6265779Sxy150489 	u16 func;
6275779Sxy150489 	u16 pci_cmd_word;
6285779Sxy150489 };
6295779Sxy150489 
6305779Sxy150489 struct e1000_fc_info {
6315779Sxy150489 	u32 high_water;		/* Flow control high-water mark */
6325779Sxy150489 	u32 low_water;		/* Flow control low-water mark */
6335779Sxy150489 	u16 pause_time;		/* Flow control pause timer */
6345779Sxy150489 	bool send_xon;		/* Flow control send XON */
6355779Sxy150489 	bool strict_ieee;	/* Strict IEEE mode */
6368571SChenlu.Chen@Sun.COM 	enum e1000_fc_mode current_mode; /* FC mode in effect */
6378571SChenlu.Chen@Sun.COM 	enum e1000_fc_mode requested_mode; /* FC mode requested by caller */
6388571SChenlu.Chen@Sun.COM };
6398571SChenlu.Chen@Sun.COM 
6408571SChenlu.Chen@Sun.COM struct e1000_dev_spec_82575 {
6418571SChenlu.Chen@Sun.COM 	bool sgmii_active;
64210319SJason.Xu@Sun.COM 	bool global_device_reset;
6438571SChenlu.Chen@Sun.COM };
6448571SChenlu.Chen@Sun.COM 
6458571SChenlu.Chen@Sun.COM struct e1000_dev_spec_vf {
6468571SChenlu.Chen@Sun.COM 	u32	vf_number;
64710319SJason.Xu@Sun.COM 	u32	v2p_mailbox;
6485779Sxy150489 };
6495779Sxy150489 
6505779Sxy150489 struct e1000_hw {
6515779Sxy150489 	void *back;
6525779Sxy150489 
6535779Sxy150489 	u8 *hw_addr;
6545779Sxy150489 	u8 *flash_address;
6555779Sxy150489 	unsigned long io_base;
6565779Sxy150489 
6575779Sxy150489 	struct e1000_mac_info  mac;
6585779Sxy150489 	struct e1000_fc_info   fc;
6595779Sxy150489 	struct e1000_phy_info  phy;
6605779Sxy150489 	struct e1000_nvm_info  nvm;
6615779Sxy150489 	struct e1000_bus_info  bus;
6625779Sxy150489 	struct e1000_host_mng_dhcp_cookie mng_cookie;
6635779Sxy150489 
6648571SChenlu.Chen@Sun.COM 	union {
6658571SChenlu.Chen@Sun.COM 		struct e1000_dev_spec_82575	_82575;
6668571SChenlu.Chen@Sun.COM 		struct e1000_dev_spec_vf	vf;
6678571SChenlu.Chen@Sun.COM 	} dev_spec;
6685779Sxy150489 
6695779Sxy150489 	u16 device_id;
6705779Sxy150489 	u16 subsystem_vendor_id;
6715779Sxy150489 	u16 subsystem_device_id;
6725779Sxy150489 	u16 vendor_id;
6735779Sxy150489 
6745779Sxy150489 	u8  revision_id;
6755779Sxy150489 };
6765779Sxy150489 
6778571SChenlu.Chen@Sun.COM #include "igb_82575.h"
6788571SChenlu.Chen@Sun.COM 
6795779Sxy150489 /* These functions must be implemented by drivers */
6805779Sxy150489 s32  e1000_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
68110319SJason.Xu@Sun.COM s32  e1000_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
6825779Sxy150489 
6835779Sxy150489 #ifdef __cplusplus
6845779Sxy150489 }
6855779Sxy150489 #endif
6865779Sxy150489 
6875779Sxy150489 #endif	/* _IGB_HW_H */
688