xref: /onnv-gate/usr/src/uts/common/io/igb/igb_api.h (revision 8571:60e408ef19cc)
15779Sxy150489 /*
25779Sxy150489  * CDDL HEADER START
35779Sxy150489  *
4*8571SChenlu.Chen@Sun.COM  * Copyright(c) 2007-2009 Intel Corporation. All rights reserved.
55779Sxy150489  * The contents of this file are subject to the terms of the
65779Sxy150489  * Common Development and Distribution License (the "License").
75779Sxy150489  * You may not use this file except in compliance with the License.
85779Sxy150489  *
95779Sxy150489  * You can obtain a copy of the license at:
105779Sxy150489  *	http://www.opensolaris.org/os/licensing.
115779Sxy150489  * See the License for the specific language governing permissions
125779Sxy150489  * and limitations under the License.
135779Sxy150489  *
145779Sxy150489  * When using or redistributing this file, you may do so under the
155779Sxy150489  * License only. No other modification of this header is permitted.
165779Sxy150489  *
175779Sxy150489  * If applicable, add the following below this CDDL HEADER, with the
185779Sxy150489  * fields enclosed by brackets "[]" replaced with your own identifying
195779Sxy150489  * information: Portions Copyright [yyyy] [name of copyright owner]
205779Sxy150489  *
215779Sxy150489  * CDDL HEADER END
225779Sxy150489  */
235779Sxy150489 
245779Sxy150489 /*
25*8571SChenlu.Chen@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
265779Sxy150489  * Use is subject to license terms of the CDDL.
275779Sxy150489  */
285779Sxy150489 
29*8571SChenlu.Chen@Sun.COM /* IntelVersion: 1.50 v2008-10-7 */
305812Sxy150489 
315779Sxy150489 #ifndef _IGB_API_H
325779Sxy150489 #define	_IGB_API_H
335779Sxy150489 
345779Sxy150489 #ifdef __cplusplus
355779Sxy150489 extern "C" {
365779Sxy150489 #endif
375779Sxy150489 
385779Sxy150489 #include "igb_hw.h"
395779Sxy150489 
405779Sxy150489 extern void e1000_init_function_pointers_82575(struct e1000_hw *hw);
41*8571SChenlu.Chen@Sun.COM extern void e1000_rx_fifo_flush_82575(struct e1000_hw *hw);
42*8571SChenlu.Chen@Sun.COM extern void e1000_init_function_pointers_vf(struct e1000_hw *hw);
43*8571SChenlu.Chen@Sun.COM extern void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw);
445779Sxy150489 
455779Sxy150489 s32 e1000_set_mac_type(struct e1000_hw *hw);
465779Sxy150489 s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device);
475779Sxy150489 s32 e1000_init_mac_params(struct e1000_hw *hw);
485779Sxy150489 s32 e1000_init_nvm_params(struct e1000_hw *hw);
495779Sxy150489 s32 e1000_init_phy_params(struct e1000_hw *hw);
505779Sxy150489 s32 e1000_get_bus_info(struct e1000_hw *hw);
515779Sxy150489 void e1000_clear_vfta(struct e1000_hw *hw);
525779Sxy150489 void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value);
535779Sxy150489 s32 e1000_force_mac_fc(struct e1000_hw *hw);
545779Sxy150489 s32 e1000_check_for_link(struct e1000_hw *hw);
555779Sxy150489 s32 e1000_reset_hw(struct e1000_hw *hw);
565779Sxy150489 s32 e1000_init_hw(struct e1000_hw *hw);
575779Sxy150489 s32 e1000_setup_link(struct e1000_hw *hw);
585779Sxy150489 s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex);
595779Sxy150489 s32 e1000_disable_pcie_master(struct e1000_hw *hw);
605779Sxy150489 void e1000_config_collision_dist(struct e1000_hw *hw);
615779Sxy150489 void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
625779Sxy150489 void e1000_mta_set(struct e1000_hw *hw, u32 hash_value);
635779Sxy150489 u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr);
645779Sxy150489 void e1000_update_mc_addr_list(struct e1000_hw *hw,
655779Sxy150489     u8 *mc_addr_list, u32 mc_addr_count,
665779Sxy150489     u32 rar_used_count, u32 rar_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);
735779Sxy150489 void e1000_reset_adaptive(struct e1000_hw *hw);
745779Sxy150489 void e1000_update_adaptive(struct e1000_hw *hw);
755779Sxy150489 s32 e1000_get_cable_length(struct e1000_hw *hw);
765779Sxy150489 s32 e1000_validate_mdi_setting(struct e1000_hw *hw);
775779Sxy150489 s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data);
785779Sxy150489 s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data);
795779Sxy150489 s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg,
805779Sxy150489     u32 offset, u8 data);
815779Sxy150489 s32 e1000_get_phy_info(struct e1000_hw *hw);
82*8571SChenlu.Chen@Sun.COM void e1000_release_phy(struct e1000_hw *hw);
83*8571SChenlu.Chen@Sun.COM s32 e1000_acquire_phy(struct e1000_hw *hw);
845779Sxy150489 s32 e1000_phy_hw_reset(struct e1000_hw *hw);
855779Sxy150489 s32 e1000_phy_commit(struct e1000_hw *hw);
865779Sxy150489 void e1000_power_up_phy(struct e1000_hw *hw);
875779Sxy150489 void e1000_power_down_phy(struct e1000_hw *hw);
885779Sxy150489 s32 e1000_read_mac_addr(struct e1000_hw *hw);
895779Sxy150489 s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num);
905779Sxy150489 void e1000_reload_nvm(struct e1000_hw *hw);
915779Sxy150489 s32 e1000_update_nvm_checksum(struct e1000_hw *hw);
925779Sxy150489 s32 e1000_validate_nvm_checksum(struct e1000_hw *hw);
935779Sxy150489 s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
945779Sxy150489 s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
955779Sxy150489 s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
965779Sxy150489 s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
975779Sxy150489 s32 e1000_wait_autoneg(struct e1000_hw *hw);
985779Sxy150489 s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active);
995779Sxy150489 s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active);
1005779Sxy150489 bool e1000_check_mng_mode(struct e1000_hw *hw);
1015779Sxy150489 bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw);
1025779Sxy150489 s32 e1000_mng_enable_host_if(struct e1000_hw *hw);
1035779Sxy150489 s32 e1000_mng_host_if_write(struct e1000_hw *hw,
1045779Sxy150489     u8 *buffer, u16 length, u16 offset, u8 *sum);
1055779Sxy150489 s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
1065779Sxy150489     struct e1000_host_mng_command_header *hdr);
1075779Sxy150489 s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw,
1085779Sxy150489     u8 *buffer, u16 length);
1095779Sxy150489 
1105779Sxy150489 /*
1115779Sxy150489  * TBI_ACCEPT macro definition:
1125779Sxy150489  *
1135779Sxy150489  * This macro requires:
1145779Sxy150489  *	adapter = a pointer to struct e1000_hw
1155779Sxy150489  *	status = the 8 bit status field of the Rx descriptor with EOP set
1165779Sxy150489  *	error = the 8 bit error field of the Rx descriptor with EOP set
1175779Sxy150489  *	length = the sum of all the length fields of the Rx descriptors that
1185779Sxy150489  *		make up the current frame
1195779Sxy150489  *	last_byte = the last byte of the frame DMAed by the hardware
1205779Sxy150489  *	max_frame_length = the maximum frame length we want to accept.
1215779Sxy150489  *	min_frame_length = the minimum frame length we want to accept.
1225779Sxy150489  *
1235779Sxy150489  * This macro is a conditional that should be used in the interrupt
1245779Sxy150489  * handler's Rx processing routine when RxErrors have been detected.
1255779Sxy150489  *
1265779Sxy150489  * Typical use:
1275779Sxy150489  *  ...
1285779Sxy150489  *  if (TBI_ACCEPT) {
129*8571SChenlu.Chen@Sun.COM  *	accept_frame = true;
1305779Sxy150489  *	e1000_tbi_adjust_stats(adapter, MacAddress);
1315779Sxy150489  *	frame_length--;
1325779Sxy150489  *  } else {
133*8571SChenlu.Chen@Sun.COM  *	accept_frame = false;
1345779Sxy150489  *  }
1355779Sxy150489  *  ...
1365779Sxy150489  */
1375779Sxy150489 
1385779Sxy150489 /* The carrier extension symbol, as received by the NIC. */
1395779Sxy150489 #define	CARRIER_EXTENSION	0x0F
1405779Sxy150489 
1415779Sxy150489 #define	TBI_ACCEPT(a, status, errors, length, last_byte, \
1425779Sxy150489     min_frame_size, max_frame_size) \
1435779Sxy150489 	(e1000_tbi_sbp_enabled_82543(a) && \
1445779Sxy150489 	(((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \
1455779Sxy150489 	((last_byte) == CARRIER_EXTENSION) && \
1465779Sxy150489 	(((status) & E1000_RXD_STAT_VP) ? \
1475779Sxy150489 	    (((length) > (min_frame_size - VLAN_TAG_SIZE)) && \
1485779Sxy150489 	    ((length) <= (max_frame_size + 1))) : \
1495779Sxy150489 	    (((length) > min_frame_size) && \
1505779Sxy150489 	    ((length) <= (max_frame_size + VLAN_TAG_SIZE + 1)))))
1515779Sxy150489 
1525779Sxy150489 #ifdef __cplusplus
1535779Sxy150489 }
1545779Sxy150489 #endif
1555779Sxy150489 
1565779Sxy150489 #endif	/* _IGB_API_H */
157