summaryrefslogtreecommitdiffstats
path: root/sys/contrib/octeon-sdk
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2012-11-24 02:00:29 +0000
committerjmallett <jmallett@FreeBSD.org>2012-11-24 02:00:29 +0000
commitd15ac5b46e09876d5f3003476234efbe7d6518c5 (patch)
treec9de71813dcf22952c3cd3b22c52e9537fe277e4 /sys/contrib/octeon-sdk
parentfd1a7a0cc854bcf4a3a5524519e927cf11ba8934 (diff)
downloadFreeBSD-src-d15ac5b46e09876d5f3003476234efbe7d6518c5.zip
FreeBSD-src-d15ac5b46e09876d5f3003476234efbe7d6518c5.tar.gz
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.
Diffstat (limited to 'sys/contrib/octeon-sdk')
-rw-r--r--sys/contrib/octeon-sdk/octeon-model.c12
-rw-r--r--sys/contrib/octeon-sdk/octeon-model.h3
2 files changed, 12 insertions, 3 deletions
diff --git a/sys/contrib/octeon-sdk/octeon-model.c b/sys/contrib/octeon-sdk/octeon-model.c
index d93bf4e..ac314e4 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 <octeon-app-init.h>
+#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 8be809e..271fca2 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);
OpenPOWER on IntegriCloud