xref: /onnv-gate/usr/src/uts/common/io/e1000g/e1000_api.h (revision 11020:e0feef27b61a)
14919Sxy150489 /*
24919Sxy150489  * This file is provided under a CDDLv1 license.  When using or
34919Sxy150489  * redistributing this file, you may do so under this license.
44919Sxy150489  * In redistributing this file this license must be included
54919Sxy150489  * and no other modification of this header file is permitted.
64919Sxy150489  *
74919Sxy150489  * CDDL LICENSE SUMMARY
84919Sxy150489  *
98479SChenlu.Chen@Sun.COM  * Copyright(c) 1999 - 2009 Intel Corporation. All rights reserved.
104919Sxy150489  *
114919Sxy150489  * The contents of this file are subject to the terms of Version
124919Sxy150489  * 1.0 of the Common Development and Distribution License (the "License").
134919Sxy150489  *
144919Sxy150489  * You should have received a copy of the License with this software.
154919Sxy150489  * You can obtain a copy of the License at
164919Sxy150489  *	http://www.opensolaris.org/os/licensing.
174919Sxy150489  * See the License for the specific language governing permissions
184919Sxy150489  * and limitations under the License.
194919Sxy150489  */
204919Sxy150489 
214919Sxy150489 /*
228479SChenlu.Chen@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
234919Sxy150489  * Use is subject to license terms of the CDDLv1.
244919Sxy150489  */
254919Sxy150489 
264919Sxy150489 /*
27*11020SMin.Xu@Sun.COM  * IntelVersion: 1.53 v3-1-10-1_2009-9-18_Release14-6
284919Sxy150489  */
294919Sxy150489 #ifndef _E1000_API_H_
304919Sxy150489 #define	_E1000_API_H_
314919Sxy150489 
324919Sxy150489 #ifdef __cplusplus
334919Sxy150489 extern "C" {
344919Sxy150489 #endif
354919Sxy150489 
364919Sxy150489 #include "e1000_hw.h"
374919Sxy150489 
386735Scc210113 extern void e1000_init_function_pointers_82542(struct e1000_hw *hw);
396735Scc210113 extern void e1000_init_function_pointers_82543(struct e1000_hw *hw);
406735Scc210113 extern void e1000_init_function_pointers_82540(struct e1000_hw *hw);
416735Scc210113 extern void e1000_init_function_pointers_82571(struct e1000_hw *hw);
426735Scc210113 extern void e1000_init_function_pointers_82541(struct e1000_hw *hw);
436735Scc210113 extern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw);
446735Scc210113 extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw);
456735Scc210113 
464919Sxy150489 s32 e1000_set_mac_type(struct e1000_hw *hw);
476735Scc210113 s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device);
484919Sxy150489 s32 e1000_init_mac_params(struct e1000_hw *hw);
494919Sxy150489 s32 e1000_init_nvm_params(struct e1000_hw *hw);
504919Sxy150489 s32 e1000_init_phy_params(struct e1000_hw *hw);
514919Sxy150489 s32 e1000_get_bus_info(struct e1000_hw *hw);
524919Sxy150489 void e1000_clear_vfta(struct e1000_hw *hw);
534919Sxy150489 void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value);
544919Sxy150489 s32 e1000_force_mac_fc(struct e1000_hw *hw);
554919Sxy150489 s32 e1000_check_for_link(struct e1000_hw *hw);
564919Sxy150489 s32 e1000_reset_hw(struct e1000_hw *hw);
574919Sxy150489 s32 e1000_init_hw(struct e1000_hw *hw);
584919Sxy150489 s32 e1000_setup_link(struct e1000_hw *hw);
594919Sxy150489 s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex);
604919Sxy150489 s32 e1000_disable_pcie_master(struct e1000_hw *hw);
614919Sxy150489 void e1000_config_collision_dist(struct e1000_hw *hw);
624919Sxy150489 void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
634919Sxy150489 void e1000_mta_set(struct e1000_hw *hw, u32 hash_value);
644919Sxy150489 u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr);
656735Scc210113 void e1000_update_mc_addr_list(struct e1000_hw *hw,
6610680SMin.Xu@Sun.COM     u8 *mc_addr_list, u32 mc_addr_count);
674919Sxy150489 s32 e1000_setup_led(struct e1000_hw *hw);
684919Sxy150489 s32 e1000_cleanup_led(struct e1000_hw *hw);
694919Sxy150489 s32 e1000_check_reset_block(struct e1000_hw *hw);
704919Sxy150489 s32 e1000_blink_led(struct e1000_hw *hw);
714919Sxy150489 s32 e1000_led_on(struct e1000_hw *hw);
724919Sxy150489 s32 e1000_led_off(struct e1000_hw *hw);
7310680SMin.Xu@Sun.COM s32 e1000_id_led_init(struct e1000_hw *hw);
744919Sxy150489 void e1000_reset_adaptive(struct e1000_hw *hw);
754919Sxy150489 void e1000_update_adaptive(struct e1000_hw *hw);
764919Sxy150489 s32 e1000_get_cable_length(struct e1000_hw *hw);
774919Sxy150489 s32 e1000_validate_mdi_setting(struct e1000_hw *hw);
784919Sxy150489 s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data);
794919Sxy150489 s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data);
804919Sxy150489 s32 e1000_get_phy_info(struct e1000_hw *hw);
816735Scc210113 void e1000_release_phy(struct e1000_hw *hw);
826735Scc210113 s32 e1000_acquire_phy(struct e1000_hw *hw);
838479SChenlu.Chen@Sun.COM s32 e1000_cfg_on_link_up(struct e1000_hw *hw);
844919Sxy150489 s32 e1000_phy_hw_reset(struct e1000_hw *hw);
854919Sxy150489 s32 e1000_phy_commit(struct e1000_hw *hw);
866735Scc210113 void e1000_power_up_phy(struct e1000_hw *hw);
876735Scc210113 void e1000_power_down_phy(struct e1000_hw *hw);
884919Sxy150489 s32 e1000_read_mac_addr(struct e1000_hw *hw);
8910680SMin.Xu@Sun.COM s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num);
904919Sxy150489 void e1000_reload_nvm(struct e1000_hw *hw);
914919Sxy150489 s32 e1000_update_nvm_checksum(struct e1000_hw *hw);
924919Sxy150489 s32 e1000_validate_nvm_checksum(struct e1000_hw *hw);
934919Sxy150489 s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
944919Sxy150489 s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
954919Sxy150489 s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
964919Sxy150489 s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
974919Sxy150489 s32 e1000_wait_autoneg(struct e1000_hw *hw);
986735Scc210113 s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active);
996735Scc210113 s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active);
1006735Scc210113 bool e1000_check_mng_mode(struct e1000_hw *hw);
1016735Scc210113 bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw);
1024919Sxy150489 s32 e1000_mng_enable_host_if(struct e1000_hw *hw);
1034919Sxy150489 s32 e1000_mng_host_if_write(struct e1000_hw *hw,
1044919Sxy150489     u8 *buffer, u16 length, u16 offset, u8 *sum);
1054919Sxy150489 s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
1064919Sxy150489     struct e1000_host_mng_command_header *hdr);
1074919Sxy150489 s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw,
1084919Sxy150489     u8 *buffer, u16 length);
1094919Sxy150489 u32 e1000_translate_register_82542(u32 reg);
1104919Sxy150489 
1114919Sxy150489 /*
1124919Sxy150489  * TBI_ACCEPT macro definition:
1134919Sxy150489  *
1144919Sxy150489  * This macro requires:
1154919Sxy150489  *	adapter = a pointer to struct e1000_hw
1166735Scc210113  *	status = the 8 bit status field of the Rx descriptor with EOP set
1176735Scc210113  *	error = the 8 bit error field of the Rx descriptor with EOP set
1186735Scc210113  *	length = the sum of all the length fields of the Rx descriptors that
1194919Sxy150489  *		make up the current frame
1204919Sxy150489  *	last_byte = the last byte of the frame DMAed by the hardware
1214919Sxy150489  *	max_frame_length = the maximum frame length we want to accept.
1224919Sxy150489  *	min_frame_length = the minimum frame length we want to accept.
1234919Sxy150489  *
1244919Sxy150489  * This macro is a conditional that should be used in the interrupt
1254919Sxy150489  * handler's Rx processing routine when RxErrors have been detected.
1264919Sxy150489  *
1274919Sxy150489  * Typical use:
1284919Sxy150489  *  ...
1294919Sxy150489  *  if (TBI_ACCEPT) {
1307607STed.You@Sun.COM  *	accept_frame = true;
1314919Sxy150489  *	e1000_tbi_adjust_stats(adapter, MacAddress);
1324919Sxy150489  *	frame_length--;
1334919Sxy150489  *  } else {
1347607STed.You@Sun.COM  *	accept_frame = false;
1354919Sxy150489  *  }
1364919Sxy150489  *  ...
1374919Sxy150489  */
1384919Sxy150489 
1394919Sxy150489 /* The carrier extension symbol, as received by the NIC. */
1404919Sxy150489 #define	CARRIER_EXTENSION	0x0F
1414919Sxy150489 
1426735Scc210113 #define	TBI_ACCEPT(a, status, errors, length, last_byte, \
1436735Scc210113 	min_frame_size, max_frame_size)	\
1444919Sxy150489 	(e1000_tbi_sbp_enabled_82543(a) && \
1454919Sxy150489 	(((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \
1464919Sxy150489 	((last_byte) == CARRIER_EXTENSION) && \
1474919Sxy150489 	(((status) & E1000_RXD_STAT_VP) ? \
1486735Scc210113 		(((length) > (min_frame_size - VLAN_TAG_SIZE)) && \
1496735Scc210113 		((length) <= (max_frame_size + 1))) : \
1506735Scc210113 		(((length) > min_frame_size) && \
1516735Scc210113 		((length) <= (max_frame_size + VLAN_TAG_SIZE + 1)))))
1524919Sxy150489 
1534919Sxy150489 #ifdef __cplusplus
1544919Sxy150489 }
1554919Sxy150489 #endif
1564919Sxy150489 
1574919Sxy150489 #endif	/* _E1000_API_H_ */
158