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.
This commit is contained in:
Juli Mallett 2012-11-24 02:00:29 +00:00
parent 4063f92555
commit 01a310bd57
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=243469
5 changed files with 49 additions and 13 deletions

View File

@ -71,6 +71,7 @@ MAXMEM opt_global.h
#
# Options that control the Cavium Simple Executive.
#
OCTEON_MODEL opt_cvmx.h
OCTEON_VENDOR_LANNER opt_cvmx.h
OCTEON_VENDOR_RADISYS opt_cvmx.h
OCTEON_BOARD_CAPK_0100ND opt_cvmx.h

View File

@ -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
{

View File

@ -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);

View File

@ -276,6 +276,7 @@ platform_start(__register_t a0, __register_t a1, __register_t a2 __unused,
{
const struct octeon_feature_description *ofd;
uint64_t platform_counter_freq;
int rv;
mips_postboot_fixup();
@ -293,19 +294,25 @@ platform_start(__register_t a0, __register_t a1, __register_t a2 __unused,
cninit();
/*
* Display information about the board/CPU.
* Display information about the CPU.
*/
#if !defined(OCTEON_MODEL)
printf("Using runtime CPU model checks.\n");
#else
printf("Compiled for CPU model: " __XSTRING(OCTEON_MODEL) "\n");
#endif
strcpy(cpu_model, octeon_model_get_string(cvmx_get_proc_id()));
printf("CPU Model: %s\n", cpu_model);
printf("CPU clock: %uMHz Core Mask: %#x\n",
cvmx_sysinfo_get()->cpu_clock_hz / 1000000,
cvmx_sysinfo_get()->core_mask);
printf("Board Type: %u Revision: %u/%u\n",
cvmx_sysinfo_get()->board_type,
cvmx_sysinfo_get()->board_rev_major,
cvmx_sysinfo_get()->board_rev_minor);
printf("MAC address base: %6D (%u configured)\n",
cvmx_sysinfo_get()->mac_addr_base, ":",
cvmx_sysinfo_get()->mac_addr_count);
rv = octeon_model_version_check(cvmx_get_proc_id());
if (rv == -1)
panic("%s: kernel not compatible with this processor.", __func__);
/*
* Display information about the board.
*/
#if defined(OCTEON_BOARD_CAPK_0100ND)
strcpy(cpu_board, "CAPK-0100ND");
if (cvmx_sysinfo_get()->board_type != CVMX_BOARD_TYPE_CN3010_EVB_HS5) {
@ -317,10 +324,22 @@ platform_start(__register_t a0, __register_t a1, __register_t a2 __unused,
cvmx_board_type_to_string(cvmx_sysinfo_get()->board_type));
#endif
printf("Board: %s\n", cpu_board);
strcpy(cpu_model, octeon_model_get_string(cvmx_get_proc_id()));
printf("Model: %s\n", cpu_model);
printf("Board Type: %u Revision: %u/%u\n",
cvmx_sysinfo_get()->board_type,
cvmx_sysinfo_get()->board_rev_major,
cvmx_sysinfo_get()->board_rev_minor);
printf("Serial number: %s\n", cvmx_sysinfo_get()->board_serial_number);
/*
* Additional on-chip hardware/settings.
*
* XXX Display PCI host/target? What else?
*/
printf("MAC address base: %6D (%u configured)\n",
cvmx_sysinfo_get()->mac_addr_base, ":",
cvmx_sysinfo_get()->mac_addr_count);
octeon_ciu_reset();
/*
* XXX

View File

@ -41,6 +41,13 @@ makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols
#options OCTEON_VENDOR_RADISYS # Support for Radisys boards.
#options OCTEON_BOARD_CAPK_0100ND # Support for CAPK-0100nd.
# Compile for a specified Octeon model. If not specified, support for
# detection at runtime will be used instead, which may give inferior
# performance.
#
# See sys/contrib/octeon-sdk/octeon-model.h for possible values.
#options OCTEON_MODEL=OCTEON_CN58XX_PASS1_1
options SCHED_ULE # ULE scheduler
options PREEMPTION # Enable kernel thread preemption
options INET # InterNETworking