xref: /freebsd/sys/dev/e1000/e1000_manage.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
18cfa0ad2SJack F Vogel /******************************************************************************
27282444bSPedro F. Giffuni   SPDX-License-Identifier: BSD-3-Clause
38cfa0ad2SJack F Vogel 
4*702cac6cSKevin Bowling   Copyright (c) 2001-2020, Intel Corporation
58cfa0ad2SJack F Vogel   All rights reserved.
68cfa0ad2SJack F Vogel 
78cfa0ad2SJack F Vogel   Redistribution and use in source and binary forms, with or without
88cfa0ad2SJack F Vogel   modification, are permitted provided that the following conditions are met:
98cfa0ad2SJack F Vogel 
108cfa0ad2SJack F Vogel    1. Redistributions of source code must retain the above copyright notice,
118cfa0ad2SJack F Vogel       this list of conditions and the following disclaimer.
128cfa0ad2SJack F Vogel 
138cfa0ad2SJack F Vogel    2. Redistributions in binary form must reproduce the above copyright
148cfa0ad2SJack F Vogel       notice, this list of conditions and the following disclaimer in the
158cfa0ad2SJack F Vogel       documentation and/or other materials provided with the distribution.
168cfa0ad2SJack F Vogel 
178cfa0ad2SJack F Vogel    3. Neither the name of the Intel Corporation nor the names of its
188cfa0ad2SJack F Vogel       contributors may be used to endorse or promote products derived from
198cfa0ad2SJack F Vogel       this software without specific prior written permission.
208cfa0ad2SJack F Vogel 
218cfa0ad2SJack F Vogel   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
228cfa0ad2SJack F Vogel   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
238cfa0ad2SJack F Vogel   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
248cfa0ad2SJack F Vogel   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
258cfa0ad2SJack F Vogel   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
268cfa0ad2SJack F Vogel   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
278cfa0ad2SJack F Vogel   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
288cfa0ad2SJack F Vogel   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
298cfa0ad2SJack F Vogel   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
308cfa0ad2SJack F Vogel   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
318cfa0ad2SJack F Vogel   POSSIBILITY OF SUCH DAMAGE.
328cfa0ad2SJack F Vogel 
338cfa0ad2SJack F Vogel ******************************************************************************/
348cfa0ad2SJack F Vogel 
358cfa0ad2SJack F Vogel #ifndef _E1000_MANAGE_H_
368cfa0ad2SJack F Vogel #define _E1000_MANAGE_H_
378cfa0ad2SJack F Vogel 
388cfa0ad2SJack F Vogel bool e1000_check_mng_mode_generic(struct e1000_hw *hw);
398cfa0ad2SJack F Vogel bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw);
408cfa0ad2SJack F Vogel s32  e1000_mng_enable_host_if_generic(struct e1000_hw *hw);
418cfa0ad2SJack F Vogel s32  e1000_mng_host_if_write_generic(struct e1000_hw *hw, u8 *buffer,
428cfa0ad2SJack F Vogel 				     u16 length, u16 offset, u8 *sum);
438cfa0ad2SJack F Vogel s32  e1000_mng_write_cmd_header_generic(struct e1000_hw *hw,
448cfa0ad2SJack F Vogel 				     struct e1000_host_mng_command_header *hdr);
458cfa0ad2SJack F Vogel s32  e1000_mng_write_dhcp_info_generic(struct e1000_hw *hw,
468cfa0ad2SJack F Vogel 				       u8 *buffer, u16 length);
478cfa0ad2SJack F Vogel bool e1000_enable_mng_pass_thru(struct e1000_hw *hw);
48f0ecc46dSJack F Vogel u8 e1000_calculate_checksum(u8 *buffer, u32 length);
49f0ecc46dSJack F Vogel s32 e1000_host_interface_command(struct e1000_hw *hw, u8 *buffer, u32 length);
50ab5d0362SJack F Vogel s32 e1000_load_firmware(struct e1000_hw *hw, u8 *buffer, u32 length);
518cfa0ad2SJack F Vogel 
528cfa0ad2SJack F Vogel enum e1000_mng_mode {
538cfa0ad2SJack F Vogel 	e1000_mng_mode_none = 0,
548cfa0ad2SJack F Vogel 	e1000_mng_mode_asf,
558cfa0ad2SJack F Vogel 	e1000_mng_mode_pt,
568cfa0ad2SJack F Vogel 	e1000_mng_mode_ipmi,
578cfa0ad2SJack F Vogel 	e1000_mng_mode_host_if_only
588cfa0ad2SJack F Vogel };
598cfa0ad2SJack F Vogel 
608cfa0ad2SJack F Vogel #define E1000_FACTPS_MNGCG			0x20000000
618cfa0ad2SJack F Vogel 
628cfa0ad2SJack F Vogel #define E1000_FWSM_MODE_MASK			0xE
638cfa0ad2SJack F Vogel #define E1000_FWSM_MODE_SHIFT			1
64ab5d0362SJack F Vogel #define E1000_FWSM_FW_VALID			0x00008000
65ab5d0362SJack F Vogel #define E1000_FWSM_HI_EN_ONLY_MODE		0x4
668cfa0ad2SJack F Vogel 
678cfa0ad2SJack F Vogel #define E1000_MNG_IAMT_MODE			0x3
688cfa0ad2SJack F Vogel #define E1000_MNG_DHCP_COOKIE_LENGTH		0x10
698cfa0ad2SJack F Vogel #define E1000_MNG_DHCP_COOKIE_OFFSET		0x6F0
708cfa0ad2SJack F Vogel #define E1000_MNG_DHCP_COMMAND_TIMEOUT		10
718cfa0ad2SJack F Vogel #define E1000_MNG_DHCP_TX_PAYLOAD_CMD		64
728cfa0ad2SJack F Vogel #define E1000_MNG_DHCP_COOKIE_STATUS_PARSING	0x1
738cfa0ad2SJack F Vogel #define E1000_MNG_DHCP_COOKIE_STATUS_VLAN	0x2
748cfa0ad2SJack F Vogel 
758cfa0ad2SJack F Vogel #define E1000_VFTA_ENTRY_SHIFT			5
768cfa0ad2SJack F Vogel #define E1000_VFTA_ENTRY_MASK			0x7F
778cfa0ad2SJack F Vogel #define E1000_VFTA_ENTRY_BIT_SHIFT_MASK		0x1F
788cfa0ad2SJack F Vogel 
798cfa0ad2SJack F Vogel #define E1000_HI_MAX_BLOCK_BYTE_LENGTH		1792 /* Num of bytes in range */
808cfa0ad2SJack F Vogel #define E1000_HI_MAX_BLOCK_DWORD_LENGTH		448 /* Num of dwords in range */
81ab5d0362SJack F Vogel #define E1000_HI_COMMAND_TIMEOUT		500 /* Process HI cmd limit */
82ab5d0362SJack F Vogel #define E1000_HI_FW_BASE_ADDRESS		0x10000
83ab5d0362SJack F Vogel #define E1000_HI_FW_MAX_LENGTH			(64 * 1024) /* Num of bytes */
84ab5d0362SJack F Vogel #define E1000_HI_FW_BLOCK_DWORD_LENGTH		256 /* Num of DWORDs per page */
85ab5d0362SJack F Vogel #define E1000_HICR_MEMORY_BASE_EN		0x200 /* MB Enable bit - RO */
868cfa0ad2SJack F Vogel #define E1000_HICR_EN			0x01  /* Enable bit - RO */
878cfa0ad2SJack F Vogel /* Driver sets this bit when done to put command in RAM */
888cfa0ad2SJack F Vogel #define E1000_HICR_C			0x02
898cfa0ad2SJack F Vogel #define E1000_HICR_SV			0x04  /* Status Validity */
908cfa0ad2SJack F Vogel #define E1000_HICR_FW_RESET_ENABLE	0x40
918cfa0ad2SJack F Vogel #define E1000_HICR_FW_RESET		0x80
928cfa0ad2SJack F Vogel 
938cfa0ad2SJack F Vogel /* Intel(R) Active Management Technology signature */
948cfa0ad2SJack F Vogel #define E1000_IAMT_SIGNATURE		0x544D4149
958cfa0ad2SJack F Vogel 
968cfa0ad2SJack F Vogel #endif
97