1215911Sjfv/******************************************************************************
2215911Sjfv
3283620Serj  Copyright (c) 2001-2015, Intel Corporation
4215911Sjfv  All rights reserved.
5215911Sjfv
6215911Sjfv  Redistribution and use in source and binary forms, with or without
7215911Sjfv  modification, are permitted provided that the following conditions are met:
8215911Sjfv
9215911Sjfv   1. Redistributions of source code must retain the above copyright notice,
10215911Sjfv      this list of conditions and the following disclaimer.
11215911Sjfv
12215911Sjfv   2. Redistributions in binary form must reproduce the above copyright
13215911Sjfv      notice, this list of conditions and the following disclaimer in the
14215911Sjfv      documentation and/or other materials provided with the distribution.
15215911Sjfv
16215911Sjfv   3. Neither the name of the Intel Corporation nor the names of its
17215911Sjfv      contributors may be used to endorse or promote products derived from
18215911Sjfv      this software without specific prior written permission.
19215911Sjfv
20215911Sjfv  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21215911Sjfv  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22215911Sjfv  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23215911Sjfv  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24215911Sjfv  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25215911Sjfv  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26215911Sjfv  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27215911Sjfv  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28215911Sjfv  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29215911Sjfv  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30215911Sjfv  POSSIBILITY OF SUCH DAMAGE.
31215911Sjfv
32215911Sjfv******************************************************************************/
33215911Sjfv/*$FreeBSD: releng/10.3/sys/dev/ixgbe/ixgbe_vf.h 283620 2015-05-27 17:44:11Z erj $*/
34215911Sjfv
35215911Sjfv#ifndef __IXGBE_VF_H__
36215911Sjfv#define __IXGBE_VF_H__
37215911Sjfv
38230775Sjfv#define IXGBE_VF_IRQ_CLEAR_MASK	7
39230775Sjfv#define IXGBE_VF_MAX_TX_QUEUES	8
40230775Sjfv#define IXGBE_VF_MAX_RX_QUEUES	8
41215911Sjfv
42247822Sjfv/* DCB define */
43247822Sjfv#define IXGBE_VF_MAX_TRAFFIC_CLASS	8
44247822Sjfv
45230775Sjfv#define IXGBE_VFCTRL		0x00000
46230775Sjfv#define IXGBE_VFSTATUS		0x00008
47230775Sjfv#define IXGBE_VFLINKS		0x00010
48230775Sjfv#define IXGBE_VFFRTIMER		0x00048
49230775Sjfv#define IXGBE_VFRXMEMWRAP	0x03190
50230775Sjfv#define IXGBE_VTEICR		0x00100
51230775Sjfv#define IXGBE_VTEICS		0x00104
52230775Sjfv#define IXGBE_VTEIMS		0x00108
53230775Sjfv#define IXGBE_VTEIMC		0x0010C
54230775Sjfv#define IXGBE_VTEIAC		0x00110
55230775Sjfv#define IXGBE_VTEIAM		0x00114
56230775Sjfv#define IXGBE_VTEITR(x)		(0x00820 + (4 * (x)))
57230775Sjfv#define IXGBE_VTIVAR(x)		(0x00120 + (4 * (x)))
58230775Sjfv#define IXGBE_VTIVAR_MISC	0x00140
59230775Sjfv#define IXGBE_VTRSCINT(x)	(0x00180 + (4 * (x)))
60215911Sjfv/* define IXGBE_VFPBACL  still says TBD in EAS */
61230775Sjfv#define IXGBE_VFRDBAL(x)	(0x01000 + (0x40 * (x)))
62230775Sjfv#define IXGBE_VFRDBAH(x)	(0x01004 + (0x40 * (x)))
63230775Sjfv#define IXGBE_VFRDLEN(x)	(0x01008 + (0x40 * (x)))
64230775Sjfv#define IXGBE_VFRDH(x)		(0x01010 + (0x40 * (x)))
65230775Sjfv#define IXGBE_VFRDT(x)		(0x01018 + (0x40 * (x)))
66230775Sjfv#define IXGBE_VFRXDCTL(x)	(0x01028 + (0x40 * (x)))
67230775Sjfv#define IXGBE_VFSRRCTL(x)	(0x01014 + (0x40 * (x)))
68230775Sjfv#define IXGBE_VFRSCCTL(x)	(0x0102C + (0x40 * (x)))
69230775Sjfv#define IXGBE_VFPSRTYPE		0x00300
70230775Sjfv#define IXGBE_VFTDBAL(x)	(0x02000 + (0x40 * (x)))
71230775Sjfv#define IXGBE_VFTDBAH(x)	(0x02004 + (0x40 * (x)))
72230775Sjfv#define IXGBE_VFTDLEN(x)	(0x02008 + (0x40 * (x)))
73230775Sjfv#define IXGBE_VFTDH(x)		(0x02010 + (0x40 * (x)))
74230775Sjfv#define IXGBE_VFTDT(x)		(0x02018 + (0x40 * (x)))
75230775Sjfv#define IXGBE_VFTXDCTL(x)	(0x02028 + (0x40 * (x)))
76230775Sjfv#define IXGBE_VFTDWBAL(x)	(0x02038 + (0x40 * (x)))
77230775Sjfv#define IXGBE_VFTDWBAH(x)	(0x0203C + (0x40 * (x)))
78230775Sjfv#define IXGBE_VFDCA_RXCTRL(x)	(0x0100C + (0x40 * (x)))
79230775Sjfv#define IXGBE_VFDCA_TXCTRL(x)	(0x0200c + (0x40 * (x)))
80230775Sjfv#define IXGBE_VFGPRC		0x0101C
81230775Sjfv#define IXGBE_VFGPTC		0x0201C
82230775Sjfv#define IXGBE_VFGORC_LSB	0x01020
83230775Sjfv#define IXGBE_VFGORC_MSB	0x01024
84230775Sjfv#define IXGBE_VFGOTC_LSB	0x02020
85230775Sjfv#define IXGBE_VFGOTC_MSB	0x02024
86230775Sjfv#define IXGBE_VFMPRC		0x01034
87283620Serj#define IXGBE_VFMRQC		0x3000
88283620Serj#define IXGBE_VFRSSRK(x)	(0x3100 + ((x) * 4))
89283620Serj#define IXGBE_VFRETA(x)	(0x3200 + ((x) * 4))
90215911Sjfv
91215911Sjfv
92215911Sjfvstruct ixgbevf_hw_stats {
93215911Sjfv	u64 base_vfgprc;
94215911Sjfv	u64 base_vfgptc;
95215911Sjfv	u64 base_vfgorc;
96215911Sjfv	u64 base_vfgotc;
97215911Sjfv	u64 base_vfmprc;
98215911Sjfv
99215911Sjfv	u64 last_vfgprc;
100215911Sjfv	u64 last_vfgptc;
101215911Sjfv	u64 last_vfgorc;
102215911Sjfv	u64 last_vfgotc;
103215911Sjfv	u64 last_vfmprc;
104215911Sjfv
105215911Sjfv	u64 vfgprc;
106215911Sjfv	u64 vfgptc;
107215911Sjfv	u64 vfgorc;
108215911Sjfv	u64 vfgotc;
109215911Sjfv	u64 vfmprc;
110215911Sjfv
111215911Sjfv	u64 saved_reset_vfgprc;
112215911Sjfv	u64 saved_reset_vfgptc;
113215911Sjfv	u64 saved_reset_vfgorc;
114215911Sjfv	u64 saved_reset_vfgotc;
115215911Sjfv	u64 saved_reset_vfmprc;
116215911Sjfv};
117215911Sjfv
118230775Sjfvs32 ixgbe_init_hw_vf(struct ixgbe_hw *hw);
119230775Sjfvs32 ixgbe_start_hw_vf(struct ixgbe_hw *hw);
120230775Sjfvs32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw);
121230775Sjfvs32 ixgbe_stop_adapter_vf(struct ixgbe_hw *hw);
122230775Sjfvu32 ixgbe_get_num_of_tx_queues_vf(struct ixgbe_hw *hw);
123230775Sjfvu32 ixgbe_get_num_of_rx_queues_vf(struct ixgbe_hw *hw);
124230775Sjfvs32 ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, u8 *mac_addr);
125230775Sjfvs32 ixgbe_setup_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed speed,
126247822Sjfv			    bool autoneg_wait_to_complete);
127230775Sjfvs32 ixgbe_check_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
128230775Sjfv			    bool *link_up, bool autoneg_wait_to_complete);
129230775Sjfvs32 ixgbe_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
130230775Sjfv		     u32 enable_addr);
131230775Sjfvs32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr);
132230775Sjfvs32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
133230775Sjfv				 u32 mc_addr_count, ixgbe_mc_addr_itr,
134230775Sjfv				 bool clear);
135230775Sjfvs32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on);
136247822Sjfvvoid ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
137247822Sjfvint ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
138247822Sjfvint ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
139247822Sjfv		       unsigned int *default_tc);
140230775Sjfv
141215911Sjfv#endif /* __IXGBE_VF_H__ */
142