Date: Sat, 24 Nov 2012 02:00:30 +0000 (UTC) From: Juli Mallett <jmallett@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243469 - in head/sys: conf contrib/octeon-sdk mips/cavium mips/conf Message-ID: <201211240200.qAO20Ut7041971@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jmallett Date: Sat Nov 24 02:00:29 2012 New Revision: 243469 URL: http://svnweb.freebsd.org/changeset/base/243469 Log: 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. Modified: head/sys/conf/options.mips head/sys/contrib/octeon-sdk/octeon-model.c head/sys/contrib/octeon-sdk/octeon-model.h head/sys/mips/cavium/octeon_machdep.c head/sys/mips/conf/OCTEON1 Modified: head/sys/conf/options.mips ============================================================================== --- head/sys/conf/options.mips Fri Nov 23 23:51:06 2012 (r243468) +++ head/sys/conf/options.mips Sat Nov 24 02:00:29 2012 (r243469) @@ -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 Modified: head/sys/contrib/octeon-sdk/octeon-model.c ============================================================================== --- head/sys/contrib/octeon-sdk/octeon-model.c Fri Nov 23 23:51:06 2012 (r243468) +++ head/sys/contrib/octeon-sdk/octeon-model.c Sat Nov 24 02:00:29 2012 (r243469) @@ -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 " 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 { Modified: head/sys/contrib/octeon-sdk/octeon-model.h ============================================================================== --- head/sys/contrib/octeon-sdk/octeon-model.h Fri Nov 23 23:51:06 2012 (r243468) +++ head/sys/contrib/octeon-sdk/octeon-model.h Sat Nov 24 02:00:29 2012 (r243469) @@ -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_runt #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); Modified: head/sys/mips/cavium/octeon_machdep.c ============================================================================== --- head/sys/mips/cavium/octeon_machdep.c Fri Nov 23 23:51:06 2012 (r243468) +++ head/sys/mips/cavium/octeon_machdep.c Sat Nov 24 02:00:29 2012 (r243469) @@ -276,6 +276,7 @@ platform_start(__register_t a0, __regist { 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, __regist 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, __regist 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 Modified: head/sys/mips/conf/OCTEON1 ============================================================================== --- head/sys/mips/conf/OCTEON1 Fri Nov 23 23:51:06 2012 (r243468) +++ head/sys/mips/conf/OCTEON1 Sat Nov 24 02:00:29 2012 (r243469) @@ -41,6 +41,13 @@ makeoptions DEBUG=-g #Build kernel with #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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211240200.qAO20Ut7041971>