octeon-model.c (232812) | octeon-model.c (243469) |
---|---|
1/***********************license start*************** 2 * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights 3 * reserved. 4 * 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: --- 46 unchanged lines hidden (view full) --- 55#include <asm/octeon/octeon.h> 56#include <asm/octeon/cvmx-clock.h> 57#else 58#include "cvmx.h" 59#include "cvmx-pow.h" 60#include "cvmx-warn.h" 61#endif 62 | 1/***********************license start*************** 2 * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights 3 * reserved. 4 * 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: --- 46 unchanged lines hidden (view full) --- 55#include <asm/octeon/octeon.h> 56#include <asm/octeon/cvmx-clock.h> 57#else 58#include "cvmx.h" 59#include "cvmx-pow.h" 60#include "cvmx-warn.h" 61#endif 62 |
63#if defined(CVMX_BUILD_FOR_LINUX_USER) || defined(CVMX_BUILD_FOR_STANDALONE) | 63#if defined(CVMX_BUILD_FOR_LINUX_USER) || defined(CVMX_BUILD_FOR_STANDALONE) || defined(CVMX_BUILD_FOR_FREEBSD_KERNEL) 64#if !defined(CVMX_BUILD_FOR_FREEBSD_KERNEL) |
64#include <octeon-app-init.h> | 65#include <octeon-app-init.h> |
66#endif |
|
65#include "cvmx-sysinfo.h" 66 67/** 68 * This function checks to see if the software is compatible with the 69 * chip it is running on. This is called in the application startup code 70 * and does not need to be called directly by the application. | 67#include "cvmx-sysinfo.h" 68 69/** 70 * This function checks to see if the software is compatible with the 71 * chip it is running on. This is called in the application startup code 72 * and does not need to be called directly by the application. |
71 * Does not return if software is incompatible. | 73 * Does not return if software is incompatible, unless compiled for the 74 * FreeBSD kernel, in which case it returns -1. |
72 * 73 * @param chip_id chip id that the software is being run on. 74 * 75 * @return 0: runtime checking or exact version match 76 * 1: chip is newer revision than compiled for, but software will run properly. | 75 * 76 * @param chip_id chip id that the software is being run on. 77 * 78 * @return 0: runtime checking or exact version match 79 * 1: chip is newer revision than compiled for, but software will run properly. |
80 * -1: software is incompatible |
|
77 */ 78int octeon_model_version_check(uint32_t chip_id __attribute__ ((unused))) 79{ 80 //printf("Model Number: %s\n", octeon_model_get_string(chip_id)); 81#if !OCTEON_IS_COMMON_BINARY() 82 /* Check for special case of mismarked 3005 samples, and adjust cpuid */ 83 if (chip_id == OCTEON_CN3010_PASS1 && (cvmx_read_csr(0x80011800800007B8ull) & (1ull << 34))) 84 chip_id |= 0x10; 85 86 if ((OCTEON_MODEL & 0xffffff) != chip_id) 87 { 88 if (!OCTEON_IS_MODEL((OM_IGNORE_REVISION | chip_id)) || (OCTEON_MODEL & 0xffffff) > chip_id || (((OCTEON_MODEL & 0xffffff) ^ chip_id) & 0x10)) 89 { 90 printf("ERROR: Software not configured for this chip\n" 91 " Expecting ID=0x%08x, Chip is 0x%08x\n", (OCTEON_MODEL & 0xffffff), (unsigned int)chip_id); 92 if ((OCTEON_MODEL & 0xffffff) > chip_id) 93 printf("Refusing to run on older revision than program was compiled for.\n"); | 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) |
|
94 exit(-1); | 99 exit(-1); |
100#else 101 return(-1); 102#endif |
|
95 } 96 else 97 { 98 printf("\n###################################################\n"); 99 printf("WARNING: Software configured for older revision than running on.\n" 100 " Compiled for ID=0x%08x, Chip is 0x%08x\n", (OCTEON_MODEL & 0xffffff), (unsigned int)chip_id); 101 printf("###################################################\n\n"); 102 return(1); --- 344 unchanged lines hidden --- | 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); --- 344 unchanged lines hidden --- |