Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
octeon-feature.h
Go to the documentation of this file.
1 /***********************license start***************
2  * Author: Cavium Networks
3  *
4  * Contact: [email protected]
5  * This file is part of the OCTEON SDK
6  *
7  * Copyright (c) 2003-2008 Cavium Networks
8  *
9  * This file is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License, Version 2, as
11  * published by the Free Software Foundation.
12  *
13  * This file is distributed in the hope that it will be useful, but
14  * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16  * NONINFRINGEMENT. See the GNU General Public License for more
17  * details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this file; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22  * or visit http://www.gnu.org/licenses/.
23  *
24  * This file may also be available under a different license from Cavium.
25  * Contact Cavium Networks for more information
26  ***********************license end**************************************/
27 
28 /*
29  * File defining checks for different Octeon features.
30  */
31 
32 #ifndef __OCTEON_FEATURE_H__
33 #define __OCTEON_FEATURE_H__
36 
38  /* CN68XX uses port kinds for packet interface */
40  /* CN68XX has different fields in word0 - word2 */
42  /*
43  * Octeon models in the CN5XXX family and higher support
44  * atomic add instructions to memory (saa/saad).
45  */
47  /* Does this Octeon support the ZIP offload engine? */
49  /* Does this Octeon support crypto acceleration using COP2? */
52  /* Does this Octeon support PCI express? */
54  /* Does this Octeon support SRIOs */
56  /* Does this Octeon support Interlaken */
58  /* Some Octeon models support internal memory for storing
59  * cryptographic keys */
61  /* Octeon has a LED controller for banks of external LEDs */
63  /* Octeon has a trace buffer */
65  /* Octeon has a management port */
67  /* Octeon has a raid unit */
69  /* Octeon has a builtin USB */
71  /* Octeon IPD can run without using work queue entries */
73  /* Octeon has DFA state machines */
75  /* Octeon MDIO block supports clause 45 transactions for 10
76  * Gig support */
78  /*
79  * CN52XX and CN56XX used a block named NPEI for PCIe
80  * access. Newer chips replaced this with SLI+DPI.
81  */
87 };
88 
89 static inline int cvmx_fuse_read(int fuse);
90 
102 static inline int octeon_has_feature(enum octeon_feature feature)
103 {
104  switch (feature) {
105  case OCTEON_FEATURE_SAAD:
107 
108  case OCTEON_FEATURE_ZIP:
112  return 0;
114  return 1;
115  else
116  return !cvmx_fuse_read(121);
117 
120  union cvmx_mio_fus_dat2 fus_2;
121  fus_2.u64 = cvmx_read_csr(CVMX_MIO_FUS_DAT2);
122  if (fus_2.s.nocrypto || fus_2.s.nomul) {
123  return 0;
124  } else if (!fus_2.s.dorm_crypto) {
125  return 1;
126  } else {
127  union cvmx_rnm_ctl_status st;
128  st.u64 = cvmx_read_csr(CVMX_RNM_CTL_STATUS);
129  return st.s.eer_val;
130  }
131  } else {
132  return !cvmx_fuse_read(90);
133  }
134 
137  union cvmx_mio_fus_dat2 fus_2;
138  fus_2.u64 = cvmx_read_csr(CVMX_MIO_FUS_DAT2);
139  return !fus_2.s.nocrypto && !fus_2.s.nomul && fus_2.s.dorm_crypto;
140  } else {
141  return 0;
142  }
143 
144  case OCTEON_FEATURE_PCIE:
148 
149  case OCTEON_FEATURE_SRIO:
152 
153  case OCTEON_FEATURE_ILK:
154  return (OCTEON_IS_MODEL(OCTEON_CN68XX));
155 
161 
166 
167  case OCTEON_FEATURE_TRA:
174 
175  case OCTEON_FEATURE_RAID:
179 
180  case OCTEON_FEATURE_USB:
183 
190 
191  case OCTEON_FEATURE_DFA:
195  return 0;
196  else if (OCTEON_IS_MODEL(OCTEON_CN3020))
197  return 0;
198  else
199  return !cvmx_fuse_read(120);
200 
201  case OCTEON_FEATURE_HFA:
203  return 0;
204  else
205  return !cvmx_fuse_read(90);
206 
207  case OCTEON_FEATURE_DFM:
210  return 0;
211  else
212  return !cvmx_fuse_read(90);
213 
218 
219  case OCTEON_FEATURE_NPEI:
222 
223  case OCTEON_FEATURE_PKND:
225 
228 
229  case OCTEON_FEATURE_CIU2:
231 
232  default:
233  break;
234  }
235  return 0;
236 }
237 
238 #endif /* __OCTEON_FEATURE_H__ */