![]() |
|
|||
0001 /***********************license start*************** 0002 * Author: Cavium Networks 0003 * 0004 * Contact: support@caviumnetworks.com 0005 * This file is part of the OCTEON SDK 0006 * 0007 * Copyright (c) 2003-2008 Cavium Networks 0008 * 0009 * This file is free software; you can redistribute it and/or modify 0010 * it under the terms of the GNU General Public License, Version 2, as 0011 * published by the Free Software Foundation. 0012 * 0013 * This file is distributed in the hope that it will be useful, but 0014 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 0015 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 0016 * NONINFRINGEMENT. See the GNU General Public License for more 0017 * details. 0018 * 0019 * You should have received a copy of the GNU General Public License 0020 * along with this file; if not, write to the Free Software 0021 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 0022 * or visit http://www.gnu.org/licenses/. 0023 * 0024 * This file may also be available under a different license from Cavium. 0025 * Contact Cavium Networks for more information 0026 ***********************license end**************************************/ 0027 0028 /* 0029 * Functions for NPI initialization, configuration, 0030 * and monitoring. 0031 */ 0032 #include <asm/octeon/octeon.h> 0033 0034 #include <asm/octeon/cvmx-config.h> 0035 0036 #include <asm/octeon/cvmx-helper.h> 0037 0038 #include <asm/octeon/cvmx-pip-defs.h> 0039 0040 /** 0041 * Probe a NPI interface and determine the number of ports 0042 * connected to it. The NPI interface should still be down 0043 * after this call. 0044 * 0045 * @interface: Interface to probe 0046 * 0047 * Returns Number of ports on the interface. Zero to disable. 0048 */ 0049 int __cvmx_helper_npi_probe(int interface) 0050 { 0051 #if CVMX_PKO_QUEUES_PER_PORT_PCI > 0 0052 if (OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN58XX)) 0053 return 4; 0054 else if (OCTEON_IS_MODEL(OCTEON_CN56XX) 0055 && !OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X)) 0056 /* The packet engines didn't exist before pass 2 */ 0057 return 4; 0058 else if (OCTEON_IS_MODEL(OCTEON_CN52XX) 0059 && !OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X)) 0060 /* The packet engines didn't exist before pass 2 */ 0061 return 4; 0062 #endif 0063 return 0; 0064 } 0065 0066 /** 0067 * Bringup and enable a NPI interface. After this call packet 0068 * I/O should be fully functional. This is called with IPD 0069 * enabled but PKO disabled. 0070 * 0071 * @interface: Interface to bring up 0072 * 0073 * Returns Zero on success, negative on failure 0074 */ 0075 int __cvmx_helper_npi_enable(int interface) 0076 { 0077 /* 0078 * On CN50XX, CN52XX, and CN56XX we need to disable length 0079 * checking so packet < 64 bytes and jumbo frames don't get 0080 * errors. 0081 */ 0082 if (!OCTEON_IS_MODEL(OCTEON_CN3XXX) && 0083 !OCTEON_IS_MODEL(OCTEON_CN58XX)) { 0084 int num_ports = cvmx_helper_ports_on_interface(interface); 0085 int port; 0086 for (port = 0; port < num_ports; port++) { 0087 union cvmx_pip_prt_cfgx port_cfg; 0088 int ipd_port = 0089 cvmx_helper_get_ipd_port(interface, port); 0090 port_cfg.u64 = 0091 cvmx_read_csr(CVMX_PIP_PRT_CFGX(ipd_port)); 0092 port_cfg.s.maxerr_en = 0; 0093 port_cfg.s.minerr_en = 0; 0094 cvmx_write_csr(CVMX_PIP_PRT_CFGX(ipd_port), 0095 port_cfg.u64); 0096 } 0097 } 0098 0099 /* Enables are controlled by the remote host, so nothing to do here */ 0100 return 0; 0101 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |