MCPcopy Create free account
hub / github.com/F-Stack/f-stack / octeon_model_version_check

Function octeon_model_version_check

freebsd/contrib/octeon-sdk/octeon-model.c:82–120  ·  view source on GitHub ↗

* This function checks to see if the software is compatible with the * chip it is running on. This is called in the application startup code * and does not need to be called directly by the application. * Does not return if software is incompatible, unless compiled for the * FreeBSD kernel, in which case it returns -1. * * @param chip_id chip id that the software is being run on. * * @ret

Source from the content-addressed store, hash-verified

80 * -1: software is incompatible
81 */
82int octeon_model_version_check(uint32_t chip_id __attribute__ ((unused)))
83{
84 //printf("Model Number: %s\n", octeon_model_get_string(chip_id));
85#if !OCTEON_IS_COMMON_BINARY()
86 /* Check for special case of mismarked 3005 samples, and adjust cpuid */
87 if (chip_id == OCTEON_CN3010_PASS1 && (cvmx_read_csr(0x80011800800007B8ull) & (1ull << 34)))
88 chip_id |= 0x10;
89
90 if ((OCTEON_MODEL & 0xffffff) != chip_id)
91 {
92 if (!OCTEON_IS_MODEL((OM_IGNORE_REVISION | chip_id)) || (OCTEON_MODEL & 0xffffff) > chip_id || (((OCTEON_MODEL & 0xffffff) ^ chip_id) & 0x10))
93 {
94 printf("ERROR: Software not configured for this chip\n"
95 " Expecting ID=0x%08x, Chip is 0x%08x\n", (OCTEON_MODEL & 0xffffff), (unsigned int)chip_id);
96 if ((OCTEON_MODEL & 0xffffff) > chip_id)
97 printf("Refusing to run on older revision than program was compiled for.\n");
98#if !defined(CVMX_BUILD_FOR_FREEBSD_KERNEL)
99 exit(-1);
100#else
101 return(-1);
102#endif
103 }
104 else
105 {
106 printf("\n###################################################\n");
107 printf("WARNING: Software configured for older revision than running on.\n"
108 " Compiled for ID=0x%08x, Chip is 0x%08x\n", (OCTEON_MODEL & 0xffffff), (unsigned int)chip_id);
109 printf("###################################################\n\n");
110 return(1);
111 }
112 }
113#endif
114
115 cvmx_warn_if(CVMX_ENABLE_PARAMETER_CHECKING, "Parameter checks are enabled. Expect some performance loss due to the extra checking\n");
116 cvmx_warn_if(CVMX_ENABLE_CSR_ADDRESS_CHECKING, "CSR address checks are enabled. Expect some performance loss due to the extra checking\n");
117 cvmx_warn_if(CVMX_ENABLE_POW_CHECKS, "POW state checks are enabled. Expect some performance loss due to the extra checking\n");
118
119 return(0);
120}
121
122#endif
123/**

Callers 3

mainFunction · 0.85
__cvmx_app_initFunction · 0.85
platform_startFunction · 0.85

Calls 2

cvmx_read_csrFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected