Imported Upstream version 16.04
[deb_dpdk.git] / drivers / net / cxgbe / base / t4_pci_id_tbl.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2014-2015 Chelsio Communications.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Chelsio Communications nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef __T4_PCI_ID_TBL_H__
35 #define __T4_PCI_ID_TBL_H__
36
37 /*
38  * The Os-Dependent code can defined cpp macros for creating a PCI Device ID
39  * Table.  This is useful because it allows the PCI ID Table to be maintained
40  * in a single place and all supporting OSes to get new PCI Device IDs
41  * automatically.
42  *
43  * The macros are:
44  *
45  * CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN
46  *   -- Used to start the definition of the PCI ID Table.
47  *
48  * CH_PCI_DEVICE_ID_FUNCTION
49  *   -- The PCI Function Number to use in the PCI Device ID Table.  "0"
50  *   -- for drivers attaching to PF0-3, "4" for drivers attaching to PF4,
51  *   -- "8" for drivers attaching to SR-IOV Virtual Functions, etc.
52  *
53  * CH_PCI_DEVICE_ID_FUNCTION2 [optional]
54  *   -- If defined, create a PCI Device ID Table with both
55  *   -- CH_PCI_DEVICE_ID_FUNCTION and CH_PCI_DEVICE_ID_FUNCTION2 populated.
56  *
57  * CH_PCI_ID_TABLE_ENTRY(DeviceID)
58  *   -- Used for the individual PCI Device ID entries.  Note that we will
59  *   -- be adding a trailing comma (",") after all of the entries (and
60  *   -- between the pairs of entries if CH_PCI_DEVICE_ID_FUNCTION2 is defined).
61  *
62  * CH_PCI_DEVICE_ID_TABLE_DEFINE_END
63  *   -- Used to finish the definition of the PCI ID Table.  Note that we
64  *   -- will be adding a trailing semi-colon (";") here.
65  *
66  * CH_PCI_DEVICE_ID_BYPASS_SUPPORTED [optional]
67  *   -- If defined, indicates that the OS Driver has support for Bypass
68  *   -- Adapters.
69  */
70 #ifdef CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN
71
72 /*
73  * Some sanity checks ...
74  */
75 #ifndef CH_PCI_DEVICE_ID_FUNCTION
76 #error CH_PCI_DEVICE_ID_FUNCTION not defined!
77 #endif
78 #ifndef CH_PCI_ID_TABLE_ENTRY
79 #error CH_PCI_ID_TABLE_ENTRY not defined!
80 #endif
81 #ifndef CH_PCI_DEVICE_ID_TABLE_DEFINE_END
82 #error CH_PCI_DEVICE_ID_TABLE_DEFINE_END not defined!
83 #endif
84
85 /*
86  * T4 and later ASICs use a PCI Device ID scheme of 0xVFPP where:
87  *
88  *   V  = "4" for T4; "5" for T5, etc.
89  *   F  = "0" for PF 0..3; "4".."7" for PF4..7; and "8" for VFs
90  *   PP = adapter product designation
91  *
92  * We use this consistency in order to create the proper PCI Device IDs
93  * for the specified CH_PCI_DEVICE_ID_FUNCTION.
94  */
95 #ifndef CH_PCI_DEVICE_ID_FUNCTION2
96 #define CH_PCI_ID_TABLE_FENTRY(devid) \
97         CH_PCI_ID_TABLE_ENTRY((devid) | \
98                               ((CH_PCI_DEVICE_ID_FUNCTION) << 8))
99 #else
100 #define CH_PCI_ID_TABLE_FENTRY(devid) \
101         CH_PCI_ID_TABLE_ENTRY((devid) | \
102                               ((CH_PCI_DEVICE_ID_FUNCTION) << 8)), \
103         CH_PCI_ID_TABLE_ENTRY((devid) | \
104                               ((CH_PCI_DEVICE_ID_FUNCTION2) << 8))
105 #endif
106
107 CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN
108         /*
109          * T5 adapters:
110          */
111         CH_PCI_ID_TABLE_FENTRY(0x5000), /* T580-dbg */
112         CH_PCI_ID_TABLE_FENTRY(0x5001), /* T520-cr */
113         CH_PCI_ID_TABLE_FENTRY(0x5002), /* T522-cr */
114         CH_PCI_ID_TABLE_FENTRY(0x5003), /* T540-cr */
115         CH_PCI_ID_TABLE_FENTRY(0x5004), /* T520-bch */
116         CH_PCI_ID_TABLE_FENTRY(0x5005), /* T540-bch */
117         CH_PCI_ID_TABLE_FENTRY(0x5006), /* T540-ch */
118         CH_PCI_ID_TABLE_FENTRY(0x5007), /* T520-so */
119         CH_PCI_ID_TABLE_FENTRY(0x5008), /* T520-cx */
120         CH_PCI_ID_TABLE_FENTRY(0x5009), /* T520-bt */
121         CH_PCI_ID_TABLE_FENTRY(0x500a), /* T504-bt */
122 #ifdef CH_PCI_DEVICE_ID_BYPASS_SUPPORTED
123         CH_PCI_ID_TABLE_FENTRY(0x500b), /* B520-sr */
124         CH_PCI_ID_TABLE_FENTRY(0x500c), /* B504-bt */
125 #endif
126         CH_PCI_ID_TABLE_FENTRY(0x500d), /* T580-cr */
127         CH_PCI_ID_TABLE_FENTRY(0x500e), /* T540-LP-cr */
128         CH_PCI_ID_TABLE_FENTRY(0x5010), /* T580-LP-cr */
129         CH_PCI_ID_TABLE_FENTRY(0x5011), /* T520-LL-cr */
130         CH_PCI_ID_TABLE_FENTRY(0x5012), /* T560-cr */
131         CH_PCI_ID_TABLE_FENTRY(0x5013), /* T580-chr */
132         CH_PCI_ID_TABLE_FENTRY(0x5014), /* T580-so */
133         CH_PCI_ID_TABLE_FENTRY(0x5015), /* T502-bt */
134         CH_PCI_ID_TABLE_FENTRY(0x5080), /* Custom T540-cr */
135         CH_PCI_ID_TABLE_FENTRY(0x5081), /* Custom T540-LL-cr */
136         CH_PCI_ID_TABLE_FENTRY(0x5082), /* Custom T504-cr */
137         CH_PCI_ID_TABLE_FENTRY(0x5083), /* Custom T540-LP-CR */
138         CH_PCI_ID_TABLE_FENTRY(0x5084), /* Custom T580-cr */
139         CH_PCI_ID_TABLE_FENTRY(0x5085), /* Custom 3x T580-CR */
140         CH_PCI_ID_TABLE_FENTRY(0x5086), /* Custom 2x T580-CR */
141         CH_PCI_ID_TABLE_FENTRY(0x5087), /* Custom T580-CR */
142         CH_PCI_ID_TABLE_FENTRY(0x5088), /* Custom T570-CR */
143         CH_PCI_ID_TABLE_FENTRY(0x5089), /* Custom T520-CR */
144         CH_PCI_ID_TABLE_FENTRY(0x5090), /* Custom T540-CR */
145         CH_PCI_ID_TABLE_FENTRY(0x5091), /* Custom T522-CR */
146         CH_PCI_ID_TABLE_FENTRY(0x5092), /* Custom T520-CR */
147 CH_PCI_DEVICE_ID_TABLE_DEFINE_END;
148
149 #endif /* CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN */
150
151 #endif /* __T4_PCI_ID_TBL_H__ */