1 /***********************license start***************
2 * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * * Neither the name of Cavium Inc. nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
23 * This Software, including technical data, may be subject to U.S. export control
24 * laws, including the U.S. Export Administration Act and its associated
25 * regulations, and may be subject to export or import regulations in other
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
43 * File defining checks for different Octeon features.
45 * <hr>$Revision: 1 $<hr>
47 #ifdef CVMX_BUILD_FOR_LINUX_KERNEL
48 #include <linux/init.h>
50 #include <asm/octeon/octeon.h>
55 CVMX_SHARED uint8_t octeon_feature_map[FEATURE_MAP_SIZE] __attribute__((aligned(128)));
56 #ifdef CVMX_BUILD_FOR_LINUX_KERNEL
57 EXPORT_SYMBOL(octeon_feature_map);
63 * Set the bit in octeon_feature_map for feature.
66 * @return 0 for success and nonzero for error.
68 static int __init octeon_feature_set(octeon_feature_t feature)
74 octeon_feature_map[byte] |= (((uint8_t)1) << bit);
79 void __init octeon_feature_init(void)
81 octeon_feature_result_t val;
84 * Check feature map size
86 if (OCTEON_MAX_FEATURE > (FEATURE_MAP_SIZE * 8 - 1))
88 val = OCTEON_FEATURE_MAP_OVERFLOW;
95 #define OCTEON_FEATURE_SET(feature_x) \
96 if (old_octeon_has_feature(feature_x)) \
97 octeon_feature_set(feature_x)
99 OCTEON_FEATURE_SET(OCTEON_FEATURE_SAAD);
100 OCTEON_FEATURE_SET(OCTEON_FEATURE_ZIP);
101 OCTEON_FEATURE_SET(OCTEON_FEATURE_CRYPTO);
102 OCTEON_FEATURE_SET(OCTEON_FEATURE_DORM_CRYPTO);
103 OCTEON_FEATURE_SET(OCTEON_FEATURE_PCIE);
104 OCTEON_FEATURE_SET(OCTEON_FEATURE_SRIO);
105 OCTEON_FEATURE_SET(OCTEON_FEATURE_ILK);
106 OCTEON_FEATURE_SET(OCTEON_FEATURE_KEY_MEMORY);
107 OCTEON_FEATURE_SET(OCTEON_FEATURE_LED_CONTROLLER);
108 OCTEON_FEATURE_SET(OCTEON_FEATURE_TRA);
109 OCTEON_FEATURE_SET(OCTEON_FEATURE_MGMT_PORT);
110 OCTEON_FEATURE_SET(OCTEON_FEATURE_RAID);
111 OCTEON_FEATURE_SET(OCTEON_FEATURE_USB);
112 OCTEON_FEATURE_SET(OCTEON_FEATURE_NO_WPTR);
113 OCTEON_FEATURE_SET(OCTEON_FEATURE_DFA);
114 OCTEON_FEATURE_SET(OCTEON_FEATURE_MDIO_CLAUSE_45);
115 OCTEON_FEATURE_SET(OCTEON_FEATURE_NPEI);
116 OCTEON_FEATURE_SET(OCTEON_FEATURE_PKND);
117 OCTEON_FEATURE_SET(OCTEON_FEATURE_CN68XX_WQE);
118 OCTEON_FEATURE_SET(OCTEON_FEATURE_HFA);
119 OCTEON_FEATURE_SET(OCTEON_FEATURE_DFM);
120 OCTEON_FEATURE_SET(OCTEON_FEATURE_CIU2);
121 OCTEON_FEATURE_SET(OCTEON_FEATURE_DICI_MODE);
122 OCTEON_FEATURE_SET(OCTEON_FEATURE_BIT_EXTRACTOR);
123 OCTEON_FEATURE_SET(OCTEON_FEATURE_NAND);
124 OCTEON_FEATURE_SET(OCTEON_FEATURE_MMC);
126 val = OCTEON_FEATURE_SUCCESS;
130 if (val != OCTEON_FEATURE_SUCCESS)
132 cvmx_dprintf("octeon_feature_init(): ");
135 case OCTEON_FEATURE_MAP_OVERFLOW:
136 cvmx_dprintf("feature map overflow.\n");
139 cvmx_dprintf("unknown error %d.\n", val);
142 #if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) && !defined(__U_BOOT__) && !defined(CVMX_BUILD_FOR_TOOLCHAIN) && !defined(CVMX_BUILD_FOR_FREEBSD_KERNEL)