xref: /onnv-gate/usr/src/uts/common/io/igb/igb_api.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.
245779Sxy150489  */
255779Sxy150489 
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.53 v3_3_14_3_BHSW1 */
315812Sxy150489 
325779Sxy150489 #ifndef _IGB_API_H
335779Sxy150489 #define	_IGB_API_H
345779Sxy150489 
355779Sxy150489 #ifdef __cplusplus
365779Sxy150489 extern "C" {
375779Sxy150489 #endif
385779Sxy150489 
395779Sxy150489 #include "igb_hw.h"
405779Sxy150489 
415779Sxy150489 extern void e1000_init_function_pointers_82575(struct e1000_hw *hw);
428571SChenlu.Chen@Sun.COM extern void e1000_rx_fifo_flush_82575(struct e1000_hw *hw);
438571SChenlu.Chen@Sun.COM extern void e1000_init_function_pointers_vf(struct e1000_hw *hw);
448571SChenlu.Chen@Sun.COM extern void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw);
455779Sxy150489 
465779Sxy150489 s32 e1000_set_mac_type(struct e1000_hw *hw);
475779Sxy150489 s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device);
485779Sxy150489 s32 e1000_init_mac_params(struct e1000_hw *hw);
495779Sxy150489 s32 e1000_init_nvm_params(struct e1000_hw *hw);
505779Sxy150489 s32 e1000_init_phy_params(struct e1000_hw *hw);
515779Sxy150489 s32 e1000_get_bus_info(struct e1000_hw *hw);
525779Sxy150489 void e1000_clear_vfta(struct e1000_hw *hw);
535779Sxy150489 void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value);
545779Sxy150489 s32 e1000_force_mac_fc(struct e1000_hw *hw);
555779Sxy150489 s32 e1000_check_for_link(struct e1000_hw *hw);
565779Sxy150489 s32 e1000_reset_hw(struct e1000_hw *hw);
575779Sxy150489 s32 e1000_init_hw(struct e1000_hw *hw);
585779Sxy150489 s32 e1000_setup_link(struct e1000_hw *hw);
595779Sxy150489 s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex);
605779Sxy150489 s32 e1000_disable_pcie_master(struct e1000_hw *hw);
615779Sxy150489 void e1000_config_collision_dist(struct e1000_hw *hw);
625779Sxy150489 void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
635779Sxy150489 void e1000_mta_set(struct e1000_hw *hw, u32 hash_value);
645779Sxy150489 u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr);
655779Sxy150489 void e1000_update_mc_addr_list(struct e1000_hw *hw,
6610319SJason.Xu@Sun.COM     u8 *mc_addr_list, u32 mc_addr_count);
675779Sxy150489 s32 e1000_setup_led(struct e1000_hw *hw);
685779Sxy150489 s32 e1000_cleanup_led(struct e1000_hw *hw);
695779Sxy150489 s32 e1000_check_reset_block(struct e1000_hw *hw);
705779Sxy150489 s32 e1000_blink_led(struct e1000_hw *hw);
715779Sxy150489 s32 e1000_led_on(struct e1000_hw *hw);
725779Sxy150489 s32 e1000_led_off(struct e1000_hw *hw);
7310319SJason.Xu@Sun.COM s32 e1000_id_led_init(struct e1000_hw *hw);
745779Sxy150489 void e1000_reset_adaptive(struct e1000_hw *hw);
755779Sxy150489 void e1000_update_adaptive(struct e1000_hw *hw);
765779Sxy150489 s32 e1000_get_cable_length(struct e1000_hw *hw);
775779Sxy150489 s32 e1000_validate_mdi_setting(struct e1000_hw *hw);
785779Sxy150489 s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data);
795779Sxy150489 s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data);
805779Sxy150489 s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg,
815779Sxy150489     u32 offset, u8 data);
825779Sxy150489 s32 e1000_get_phy_info(struct e1000_hw *hw);
838571SChenlu.Chen@Sun.COM void e1000_release_phy(struct e1000_hw *hw);
848571SChenlu.Chen@Sun.COM s32 e1000_acquire_phy(struct e1000_hw *hw);
855779Sxy150489 s32 e1000_phy_hw_reset(struct e1000_hw *hw);
865779Sxy150489 s32 e1000_phy_commit(struct e1000_hw *hw);
875779Sxy150489 void e1000_power_up_phy(struct e1000_hw *hw);
885779Sxy150489 void e1000_power_down_phy(struct e1000_hw *hw);
895779Sxy150489 s32 e1000_read_mac_addr(struct e1000_hw *hw);
905779Sxy150489 s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num);
915779Sxy150489 void e1000_reload_nvm(struct e1000_hw *hw);
925779Sxy150489 s32 e1000_update_nvm_checksum(struct e1000_hw *hw);
935779Sxy150489 s32 e1000_validate_nvm_checksum(struct e1000_hw *hw);
945779Sxy150489 s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
955779Sxy150489 s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
965779Sxy150489 s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
975779Sxy150489 s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
985779Sxy150489 s32 e1000_wait_autoneg(struct e1000_hw *hw);
995779Sxy150489 s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active);
1005779Sxy150489 s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active);
1015779Sxy150489 bool e1000_check_mng_mode(struct e1000_hw *hw);
1025779Sxy150489 bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw);
1035779Sxy150489 s32 e1000_mng_enable_host_if(struct e1000_hw *hw);
1045779Sxy150489 s32 e1000_mng_host_if_write(struct e1000_hw *hw,
1055779Sxy150489     u8 *buffer, u16 length, u16 offset, u8 *sum);
1065779Sxy150489 s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
1075779Sxy150489     struct e1000_host_mng_command_header *hdr);
1085779Sxy150489 s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw,
1095779Sxy150489     u8 *buffer, u16 length);
1105779Sxy150489 
1115779Sxy150489 /*
1125779Sxy150489  * TBI_ACCEPT macro definition:
1135779Sxy150489  *
1145779Sxy150489  * This macro requires:
1155779Sxy150489  *	adapter = a pointer to struct e1000_hw
1165779Sxy150489  *	status = the 8 bit status field of the Rx descriptor with EOP set
1175779Sxy150489  *	error = the 8 bit error field of the Rx descriptor with EOP set
1185779Sxy150489  *	length = the sum of all the length fields of the Rx descriptors that
1195779Sxy150489  *		make up the current frame
1205779Sxy150489  *	last_byte = the last byte of the frame DMAed by the hardware
1215779Sxy150489  *	max_frame_length = the maximum frame length we want to accept.
1225779Sxy150489  *	min_frame_length = the minimum frame length we want to accept.
1235779Sxy150489  *
1245779Sxy150489  * This macro is a conditional that should be used in the interrupt
1255779Sxy150489  * handler's Rx processing routine when RxErrors have been detected.
1265779Sxy150489  *
1275779Sxy150489  * Typical use:
1285779Sxy150489  *  ...
1295779Sxy150489  *  if (TBI_ACCEPT) {
1308571SChenlu.Chen@Sun.COM  *	accept_frame = true;
1315779Sxy150489  *	e1000_tbi_adjust_stats(adapter, MacAddress);
1325779Sxy150489  *	frame_length--;
1335779Sxy150489  *  } else {
1348571SChenlu.Chen@Sun.COM  *	accept_frame = false;
1355779Sxy150489  *  }
1365779Sxy150489  *  ...
1375779Sxy150489  */
1385779Sxy150489 
1395779Sxy150489 /* The carrier extension symbol, as received by the NIC. */
1405779Sxy150489 #define	CARRIER_EXTENSION	0x0F
1415779Sxy150489 
1425779Sxy150489 #define	TBI_ACCEPT(a, status, errors, length, last_byte, \
1435779Sxy150489     min_frame_size, max_frame_size) \
1445779Sxy150489 	(e1000_tbi_sbp_enabled_82543(a) && \
1455779Sxy150489 	(((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \
1465779Sxy150489 	((last_byte) == CARRIER_EXTENSION) && \
1475779Sxy150489 	(((status) & E1000_RXD_STAT_VP) ? \
1485779Sxy150489 	    (((length) > (min_frame_size - VLAN_TAG_SIZE)) && \
1495779Sxy150489 	    ((length) <= (max_frame_size + 1))) : \
1505779Sxy150489 	    (((length) > min_frame_size) && \
1515779Sxy150489 	    ((length) <= (max_frame_size + VLAN_TAG_SIZE + 1)))))
1525779Sxy150489 
1535779Sxy150489 #ifdef __cplusplus
1545779Sxy150489 }
1555779Sxy150489 #endif
1565779Sxy150489 
1575779Sxy150489 #endif	/* _IGB_API_H */
158