From 01a310bd57bef731668d5d467c06b9646dbf28ba Mon Sep 17 00:00:00 2001 From: Juli Mallett Date: Sat, 24 Nov 2012 02:00:29 +0000 Subject: o) Add support for specifying a model of Octeon to target at compile-time, reducing the number of runtime checks done by the SDK code. o) Group board/CPU information at early startup by subject matter, so that e.g. CPU information is adjacent to CPU information and board information is adjacent to board information. --- sys/contrib/octeon-sdk/octeon-model.c | 12 ++++++++++-- sys/contrib/octeon-sdk/octeon-model.h | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'sys/contrib/octeon-sdk') diff --git a/sys/contrib/octeon-sdk/octeon-model.c b/sys/contrib/octeon-sdk/octeon-model.c index d93bf4ea24eb..ac314e4014f8 100644 --- a/sys/contrib/octeon-sdk/octeon-model.c +++ b/sys/contrib/octeon-sdk/octeon-model.c @@ -60,20 +60,24 @@ #include "cvmx-warn.h" #endif -#if defined(CVMX_BUILD_FOR_LINUX_USER) || defined(CVMX_BUILD_FOR_STANDALONE) +#if defined(CVMX_BUILD_FOR_LINUX_USER) || defined(CVMX_BUILD_FOR_STANDALONE) || defined(CVMX_BUILD_FOR_FREEBSD_KERNEL) +#if !defined(CVMX_BUILD_FOR_FREEBSD_KERNEL) #include +#endif #include "cvmx-sysinfo.h" /** * 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. + * 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. * * @return 0: runtime checking or exact version match * 1: chip is newer revision than compiled for, but software will run properly. + * -1: software is incompatible */ int octeon_model_version_check(uint32_t chip_id __attribute__ ((unused))) { @@ -91,7 +95,11 @@ int octeon_model_version_check(uint32_t chip_id __attribute__ ((unused))) " Expecting ID=0x%08x, Chip is 0x%08x\n", (OCTEON_MODEL & 0xffffff), (unsigned int)chip_id); if ((OCTEON_MODEL & 0xffffff) > chip_id) printf("Refusing to run on older revision than program was compiled for.\n"); +#if !defined(CVMX_BUILD_FOR_FREEBSD_KERNEL) exit(-1); +#else + return(-1); +#endif } else { diff --git a/sys/contrib/octeon-sdk/octeon-model.h b/sys/contrib/octeon-sdk/octeon-model.h index 8be809eb65ac..271fca208ae8 100644 --- a/sys/contrib/octeon-sdk/octeon-model.h +++ b/sys/contrib/octeon-sdk/octeon-model.h @@ -317,7 +317,7 @@ extern "C" { ))) #ifndef OCTEON_IS_MODEL -#if defined(USE_RUNTIME_MODEL_CHECKS) || defined(__U_BOOT__) || (defined(__linux__) && defined(__KERNEL__)) || defined(CVMX_BUILD_FOR_TOOLCHAIN) || (defined(__FreeBSD__) && defined(_KERNEL)) +#if defined(USE_RUNTIME_MODEL_CHECKS) || defined(__U_BOOT__) || (defined(__linux__) && defined(__KERNEL__)) || defined(CVMX_BUILD_FOR_TOOLCHAIN) || (defined(__FreeBSD__) && defined(_KERNEL) && !defined(OCTEON_MODEL)) /* NOTE: This for internal use only!!!!! */ static inline int __octeon_is_model_runtime__(uint32_t model) @@ -359,6 +359,7 @@ static inline int __octeon_is_model_runtime__(uint32_t model) #endif #endif +int octeon_model_version_check(uint32_t chip_id); const char *octeon_model_get_string(uint32_t chip_id); const char *octeon_model_get_string_buffer(uint32_t chip_id, char * buffer); -- cgit v1.2.3