From 90a3efca982a4328ad9a43b36ddde0ebed7095d8 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 18 Apr 2018 15:02:47 +0000 Subject: [PATCH] The x86_64_as7726_32x module was not generated using the newmodule script. A new module will be generated and the appropriate code moved into it. --- .../onlp/builds/src/.gitignore | 1 - .../onlp/builds/src/.module | 1 - .../onlp/builds/src/Makefile | 9 - .../onlp/builds/src/README | 6 - .../module/auto/x86_64_accton_as7726_32x.yml | 50 -- .../x86_64_accton_as7726_32x.x | 14 - .../x86_64_accton_as7726_32x_config.h | 137 ----- .../x86_64_accton_as7726_32x_dox.h | 26 - .../x86_64_accton_as7726_32x_porting.h | 107 ---- .../onlp/builds/src/module/src/Makefile | 9 - .../onlp/builds/src/module/src/debug.c | 45 -- .../onlp/builds/src/module/src/fani.c | 367 ------------- .../onlp/builds/src/module/src/ledi.c | 261 ---------- .../onlp/builds/src/module/src/platform_lib.c | 202 -------- .../onlp/builds/src/module/src/platform_lib.h | 87 ---- .../onlp/builds/src/module/src/psui.c | 185 ------- .../onlp/builds/src/module/src/sfpi.c | 422 --------------- .../onlp/builds/src/module/src/sysi.c | 490 ------------------ .../onlp/builds/src/module/src/thermali.c | 174 ------- .../src/x86_64_accton_as7726_32x_config.c | 81 --- .../src/x86_64_accton_as7726_32x_enums.c | 10 - .../module/src/x86_64_accton_as7726_32x_int.h | 12 - .../module/src/x86_64_accton_as7726_32x_log.c | 17 - .../module/src/x86_64_accton_as7726_32x_log.h | 12 - .../src/x86_64_accton_as7726_32x_module.c | 24 - .../src/x86_64_accton_as7726_32x_ucli.c | 50 -- 26 files changed, 2799 deletions(-) delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/.gitignore delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/.module delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/Makefile delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/README delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/auto/x86_64_accton_as7726_32x.yml delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x.x delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_config.h delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_dox.h delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_porting.h delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/Makefile delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/debug.c delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/fani.c delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/ledi.c delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/platform_lib.c delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/platform_lib.h delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/psui.c delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/sfpi.c delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/sysi.c delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/thermali.c delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_config.c delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_enums.c delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_int.h delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_log.c delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_log.h delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_module.c delete mode 100755 packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_ucli.c diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/.gitignore b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/.gitignore deleted file mode 100755 index c81d16be..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.mk diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/.module b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/.module deleted file mode 100755 index 28f927de..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/.module +++ /dev/null @@ -1 +0,0 @@ -name: x86_64_accton_as7726_32x diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/Makefile b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/Makefile deleted file mode 100755 index 9dfffde1..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -############################################################################### -# -# -# -############################################################################### -include $(ONL)/make/config.mk -MODULE := x86_64_accton_as7726_32x -AUTOMODULE := x86_64_accton_as77262_32x -include $(BUILDER)/definemodule.mk diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/README b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/README deleted file mode 100755 index 5aad1403..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/README +++ /dev/null @@ -1,6 +0,0 @@ -############################################################################### -# -# x86_64_accton_as7726_32x README -# -############################################################################### - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/auto/x86_64_accton_as7726_32x.yml b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/auto/x86_64_accton_as7726_32x.yml deleted file mode 100755 index d53b22b2..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/auto/x86_64_accton_as7726_32x.yml +++ /dev/null @@ -1,50 +0,0 @@ -############################################################################### -# -# x86_64_accton_as7726_32x Autogeneration Definitions. -# -############################################################################### - -cdefs: &cdefs -- X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_LOGGING: - doc: "Include or exclude logging." - default: 1 -- X86_64_ACCTON_AS7726_32X_CONFIG_LOG_OPTIONS_DEFAULT: - doc: "Default enabled log options." - default: AIM_LOG_OPTIONS_DEFAULT -- X86_64_ACCTON_AS7726_32X_CONFIG_LOG_BITS_DEFAULT: - doc: "Default enabled log bits." - default: AIM_LOG_BITS_DEFAULT -- X86_64_ACCTON_AS7726_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT: - doc: "Default enabled custom log bits." - default: 0 -- X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB: - doc: "Default all porting macros to use the C standard libraries." - default: 1 -- X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: - doc: "Include standard library headers for stdlib porting macros." - default: x86_64_accton_as7726_32x_CONFIG_PORTING_STDLIB -- X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_UCLI: - doc: "Include generic uCli support." - default: 0 -- X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION: - doc: "Assume chassis fan direction is the same as the PSU fan direction." - default: 0 - - -definitions: - cdefs: - x86_64_accton_as7726_32x_CONFIG_HEADER: - defs: *cdefs - basename: x86_64_accton_as7726_32x_config - - portingmacro: - x86_64_accton_as7726_32x: - macros: - - malloc - - free - - memset - - memcpy - - strncpy - - vsnprintf - - snprintf - - strlen diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x.x b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x.x deleted file mode 100755 index b0e04177..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x.x +++ /dev/null @@ -1,14 +0,0 @@ -/**************************************************************************//** - * - * - * - *****************************************************************************/ -#include - -/* <--auto.start.xmacro(ALL).define> */ -/* */ - -/* <--auto.start.xenum(ALL).define> */ -/* */ - - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_config.h b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_config.h deleted file mode 100755 index 72cb2aa4..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_config.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************//** - * - * @file - * @brief x86_64_accton_as7726_32x Configuration Header - * - * @addtogroup x86_64_accton_as7726_32x-config - * @{ - * - *****************************************************************************/ -#ifndef __x86_64_accton_as7726_32x_CONFIG_H__ -#define __x86_64_accton_as7726_32x_CONFIG_H__ - -#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG -#include -#endif -#ifdef x86_64_accton_as7726_32x_INCLUDE_CUSTOM_CONFIG -#include -#endif - -/* */ -#include -/** - * X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_LOGGING - * - * Include or exclude logging. */ - - -#ifndef X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_LOGGING -#define X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_LOGGING 1 -#endif - -/** - * X86_64_ACCTON_AS7726_32X_CONFIG_LOG_OPTIONS_DEFAULT - * - * Default enabled log options. */ - - -#ifndef X86_64_ACCTON_AS7726_32X_CONFIG_LOG_OPTIONS_DEFAULT -#define X86_64_ACCTON_AS7726_32X_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT -#endif - -/** - * X86_64_ACCTON_AS7726_32X_CONFIG_LOG_BITS_DEFAULT - * - * Default enabled log bits. */ - - -#ifndef X86_64_ACCTON_AS7726_32X_CONFIG_LOG_BITS_DEFAULT -#define X86_64_ACCTON_AS7726_32X_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT -#endif - -/** - * X86_64_ACCTON_AS7726_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT - * - * Default enabled custom log bits. */ - - -#ifndef X86_64_ACCTON_AS7726_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT -#define X86_64_ACCTON_AS7726_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 -#endif - -/** - * X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB - * - * Default all porting macros to use the C standard libraries. */ - - -#ifndef X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB -#define X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB 1 -#endif - -/** - * X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS - * - * Include standard library headers for stdlib porting macros. */ - - -#ifndef X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS -#define X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS x86_64_accton_as7726_32x_CONFIG_PORTING_STDLIB -#endif - -/** - * X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_UCLI - * - * Include generic uCli support. */ - - -#ifndef X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_UCLI -#define X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_UCLI 0 -#endif - -/** - * X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION - * - * Assume chassis fan direction is the same as the PSU fan direction. */ - - -#ifndef X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION -#define X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION 0 -#endif - - - -/** - * All compile time options can be queried or displayed - */ - -/** Configuration settings structure. */ -typedef struct x86_64_accton_as7726_32x_config_settings_s { - /** name */ - const char* name; - /** value */ - const char* value; -} x86_64_accton_as7726_32x_config_settings_t; - -/** Configuration settings table. */ -/** x86_64_accton_as7726_32x_config_settings table. */ -extern x86_64_accton_as7726_32x_config_settings_t x86_64_accton_as7726_32x_config_settings[]; - -/** - * @brief Lookup a configuration setting. - * @param setting The name of the configuration option to lookup. - */ -const char* x86_64_accton_as7726_32x_config_lookup(const char* setting); - -/** - * @brief Show the compile-time configuration. - * @param pvs The output stream. - */ -int x86_64_accton_as7726_32x_config_show(struct aim_pvs_s* pvs); - -/* */ - -#include "x86_64_accton_as7726_32x_porting.h" - -#endif /* __x86_64_accton_as7726_32x_CONFIG_H__ */ -/* @} */ diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_dox.h b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_dox.h deleted file mode 100755 index d92d6638..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_dox.h +++ /dev/null @@ -1,26 +0,0 @@ -/**************************************************************************//** - * - * x86_64_accton_as7726_32x Doxygen Header - * - *****************************************************************************/ -#ifndef __x86_64_accton_as7726_32x_DOX_H__ -#define __x86_64_accton_as7726_32x_DOX_H__ - -/** - * @defgroup x86_64_accton_as7726_32x x86_64_accton_as7726_32x - x86_64_accton_as7726_32x Description - * - -The documentation overview for this module should go here. - - * - * @{ - * - * @defgroup x86_64_accton_as7726_32x-x86_64_accton_as7726_32x Public Interface - * @defgroup x86_64_accton_as7726_32x-config Compile Time Configuration - * @defgroup x86_64_accton_as7726_32x-porting Porting Macros - * - * @} - * - */ - -#endif /* __x86_64_accton_as7726_32x_DOX_H__ */ diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_porting.h b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_porting.h deleted file mode 100755 index 8893de7f..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_porting.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************//** - * - * @file - * @brief x86_64_accton_as7726_32x Porting Macros. - * - * @addtogroup x86_64_accton_as7726_32x-porting - * @{ - * - *****************************************************************************/ -#ifndef __x86_64_accton_as7726_32x_PORTING_H__ -#define __x86_64_accton_as7726_32x_PORTING_H__ - - -/* */ -#if X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 -#include -#include -#include -#include -#include -#endif - -#ifndef X86_64_ACCTON_AS7726_32X_MALLOC - #if defined(GLOBAL_MALLOC) - #define X86_64_ACCTON_AS7726_32X_MALLOC GLOBAL_MALLOC - #elif X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7726_32X_MALLOC malloc - #else - #error The macro X86_64_ACCTON_AS7726_32X_MALLOC is required but cannot be defined. - #endif -#endif - -#ifndef X86_64_ACCTON_AS7726_32X_FREE - #if defined(GLOBAL_FREE) - #define X86_64_ACCTON_AS7726_32X_FREE GLOBAL_FREE - #elif X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7726_32X_FREE free - #else - #error The macro X86_64_ACCTON_AS7726_32X_FREE is required but cannot be defined. - #endif -#endif - -#ifndef X86_64_ACCTON_AS7726_32X_MEMSET - #if defined(GLOBAL_MEMSET) - #define X86_64_ACCTON_AS7726_32X_MEMSET GLOBAL_MEMSET - #elif X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7726_32X_MEMSET memset - #else - #error The macro X86_64_ACCTON_AS7726_32X_MEMSET is required but cannot be defined. - #endif -#endif - -#ifndef X86_64_ACCTON_AS7726_32X_MEMCPY - #if defined(GLOBAL_MEMCPY) - #define X86_64_ACCTON_AS7726_32X_MEMCPY GLOBAL_MEMCPY - #elif X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7726_32X_MEMCPY memcpy - #else - #error The macro X86_64_ACCTON_AS7726_32X_MEMCPY is required but cannot be defined. - #endif -#endif - -#ifndef X86_64_ACCTON_AS7726_32X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7726_32X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7726_32X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7726_32X_STRNCPY is required but cannot be defined. - #endif -#endif - -#ifndef X86_64_ACCTON_AS7726_32X_VSNPRINTF - #if defined(GLOBAL_VSNPRINTF) - #define X86_64_ACCTON_AS7726_32X_VSNPRINTF GLOBAL_VSNPRINTF - #elif X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7726_32X_VSNPRINTF vsnprintf - #else - #error The macro X86_64_ACCTON_AS7726_32X_VSNPRINTF is required but cannot be defined. - #endif -#endif - -#ifndef X86_64_ACCTON_AS7726_32X_SNPRINTF - #if defined(GLOBAL_SNPRINTF) - #define X86_64_ACCTON_AS7726_32X_SNPRINTF GLOBAL_SNPRINTF - #elif X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7726_32X_SNPRINTF snprintf - #else - #error The macro X86_64_ACCTON_AS7726_32X_SNPRINTF is required but cannot be defined. - #endif -#endif - -#ifndef X86_64_ACCTON_AS7726_32X_STRLEN - #if defined(GLOBAL_STRLEN) - #define X86_64_ACCTON_AS7726_32X_STRLEN GLOBAL_STRLEN - #elif X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7726_32X_STRLEN strlen - #else - #error The macro X86_64_ACCTON_AS7726_32X_STRLEN is required but cannot be defined. - #endif -#endif - -/* */ - - -#endif /* __x86_64_accton_as7726_32x_PORTING_H__ */ -/* @} */ diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/Makefile b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/Makefile deleted file mode 100755 index b1a02144..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -############################################################################### -# -# Local source generation targets. -# -############################################################################### - -ucli: - @../../../../tools/uclihandlers.py x86_64_accton_as7726_32x_ucli.c - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/debug.c b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/debug.c deleted file mode 100755 index 92890fb7..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/debug.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "x86_64_accton_as7726_32x_int.h" - -#if x86_64_accton_as7726_32x_CONFIG_INCLUDE_DEBUG == 1 - -#include - -static char help__[] = - "Usage: debug [options]\n" - " -c CPLD Versions\n" - " -h Help\n" - ; - -int -x86_64_accton_as7726_32x_debug_main(int argc, char* argv[]) -{ - int c = 0; - int help = 0; - int rv = 0; - - while( (c = getopt(argc, argv, "ch")) != -1) { - switch(c) - { - case 'c': c = 1; break; - case 'h': help = 1; rv = 0; break; - default: help = 1; rv = 1; break; - } - - } - - if(help || argc == 1) { - printf("%s", help__); - return rv; - } - - if(c) { - printf("Not implemented.\n"); - } - - - return 0; -} - -#endif - - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/fani.c b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/fani.c deleted file mode 100755 index e82f8a77..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/fani.c +++ /dev/null @@ -1,367 +0,0 @@ -/************************************************************ - * - * - * Copyright 2014 Big Switch Networks, Inc. - * Copyright 2014 Accton Technology Corporation. - * - * Licensed under the Eclipse Public License, Version 1.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.eclipse.org/legal/epl-v10.html - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - * - * - ************************************************************ - * - * Fan Platform Implementation Defaults. - * - ***********************************************************/ -#include -#include "platform_lib.h" - -#define PSU_PREFIX_PATH "/sys/bus/i2c/devices/" - -#define MAX_FAN_SPEED 25500 -#define MAX_PSU_FAN_SPEED 25500 - -enum fan_id { - FAN_1_ON_FAN_BOARD = 1, - FAN_2_ON_FAN_BOARD, - FAN_3_ON_FAN_BOARD, - FAN_4_ON_FAN_BOARD, - FAN_5_ON_FAN_BOARD, - FAN_6_ON_FAN_BOARD, - FAN_1_ON_PSU_1, - FAN_1_ON_PSU_2, -}; - -#define CHASSIS_FAN_INFO(fid) \ - { \ - { ONLP_FAN_ID_CREATE(FAN_##fid##_ON_FAN_BOARD), "Chassis Fan - "#fid, 0 },\ - 0x0,\ - ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE,\ - 0,\ - 0,\ - ONLP_FAN_MODE_INVALID,\ - } - -#define PSU_FAN_INFO(pid, fid) \ - { \ - { ONLP_FAN_ID_CREATE(FAN_##fid##_ON_PSU_##pid), "PSU "#pid" - Fan "#fid, 0 },\ - 0x0,\ - ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE,\ - 0,\ - 0,\ - ONLP_FAN_MODE_INVALID,\ - } - -/* Static fan information */ -onlp_fan_info_t finfo[] = { - { }, /* Not used */ - CHASSIS_FAN_INFO(1), - CHASSIS_FAN_INFO(2), - CHASSIS_FAN_INFO(3), - CHASSIS_FAN_INFO(4), - CHASSIS_FAN_INFO(5), - CHASSIS_FAN_INFO(6), - PSU_FAN_INFO(1,1), - PSU_FAN_INFO(2,1) -}; - -#define VALIDATE(_id) \ - do { \ - if(!ONLP_OID_IS_FAN(_id)) { \ - return ONLP_STATUS_E_INVALID; \ - } \ - } while(0) - -static int -_onlp_fani_info_get_fan(int fid, onlp_fan_info_t* info) -{ - int value; - char path[64] = {0}; - - /* get fan present status - */ - sprintf(path, "%s""fan%d_present", FAN_BOARD_PATH, fid); - DEBUG_PRINT("Fan(%d), present path = (%s)", fid, path); - - if (onlp_file_read_int(&value, path) < 0) { - AIM_LOG_ERROR("Unable to read status from file (%s)\r\n", path); - return ONLP_STATUS_E_INTERNAL; - } - - if (value == 0) { - return ONLP_STATUS_OK; - } - info->status |= ONLP_FAN_STATUS_PRESENT; - - - /* get fan fault status (turn on when any one fails) - */ - sprintf(path, "%s""fan%d_fault", FAN_BOARD_PATH, fid); - DEBUG_PRINT("Fan(%d), fault path = (%s)", fid, path); - - if (onlp_file_read_int(&value, path) < 0) { - AIM_LOG_ERROR("Unable to read status from file (%s)\r\n", path); - return ONLP_STATUS_E_INTERNAL; - } - - if (value > 0) { - info->status |= ONLP_FAN_STATUS_FAILED; - } - - - /* get fan direction (both : the same) - */ - sprintf(path, "%s""fan%d_direction", FAN_BOARD_PATH, fid); - DEBUG_PRINT("Fan(%d), direction path = (%s)", fid, path); - - if (onlp_file_read_int(&value, path) < 0) { - AIM_LOG_ERROR("Unable to read status from file (%s)\r\n", path); - return ONLP_STATUS_E_INTERNAL; - } - - info->status |= value ? ONLP_FAN_STATUS_F2B : ONLP_FAN_STATUS_B2F; - - - /* get front fan speed - */ - sprintf(path, "%s""fan%d_front_speed_rpm", FAN_BOARD_PATH, fid); - DEBUG_PRINT("Fan (%d), front speed path = (%s)", fid, path); - - if (onlp_file_read_int(&value, path) < 0) { - AIM_LOG_ERROR("Unable to read status from file (%s)\r\n", path); - return ONLP_STATUS_E_INTERNAL; - } - info->rpm = value; - - /* get rear fan speed - */ - sprintf(path, "%s""fan%d_rear_speed_rpm", FAN_BOARD_PATH, fid); - DEBUG_PRINT("Fan (%d), rear speed path = (%s)", fid, path); - - if (onlp_file_read_int(&value, path) < 0) { - AIM_LOG_ERROR("Unable to read status from file (%s)\r\n", path); - return ONLP_STATUS_E_INTERNAL; - } - - /* take the min value from front/rear fan speed - */ - if (info->rpm > value) { - info->rpm = value; - } - - /* get speed percentage from rpm - */ - info->percentage = (info->rpm * 100)/MAX_FAN_SPEED; - - return ONLP_STATUS_OK; -} - -static uint32_t -_onlp_get_fan_direction_on_psu(void) -{ - /* Try to read direction from PSU1. - * If PSU1 is not valid, read from PSU2 - */ - int i = 0; - - for (i = PSU1_ID; i <= PSU2_ID; i++) { - psu_type_t psu_type; - psu_type = get_psu_type(i, NULL, 0); - - if (psu_type == PSU_TYPE_UNKNOWN) { - continue; - } - - if (PSU_TYPE_AC_F2B == psu_type) { - return ONLP_FAN_STATUS_F2B; - } - else { - return ONLP_FAN_STATUS_B2F; - } - } - - return 0; -} - -static int -_onlp_fani_info_get_fan_on_psu(int pid, onlp_fan_info_t* info) -{ - int val = 0; - - info->status |= ONLP_FAN_STATUS_PRESENT; - - /* get fan direction - */ - info->status |= _onlp_get_fan_direction_on_psu(); - - /* get fan fault status - */ - if (psu_ym2651y_pmbus_info_get(pid, "psu_fan1_fault", &val) == ONLP_STATUS_OK) { - info->status |= (val > 0) ? ONLP_FAN_STATUS_FAILED : 0; - } - - /* get fan speed - */ - if (psu_ym2651y_pmbus_info_get(pid, "psu_fan1_speed_rpm", &val) == ONLP_STATUS_OK) { - info->rpm = val; - info->percentage = (info->rpm * 100) / MAX_PSU_FAN_SPEED; - } - - return ONLP_STATUS_OK; -} - -/* - * This function will be called prior to all of onlp_fani_* functions. - */ -int -onlp_fani_init(void) -{ - return ONLP_STATUS_OK; -} - -int -onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info) -{ - int rc = 0; - int fid; - VALIDATE(id); - - fid = ONLP_OID_ID_GET(id); - *info = finfo[fid]; - - switch (fid) - { - case FAN_1_ON_PSU_1: - rc = _onlp_fani_info_get_fan_on_psu(PSU1_ID, info); - break; - case FAN_1_ON_PSU_2: - rc = _onlp_fani_info_get_fan_on_psu(PSU2_ID, info); - break; - case FAN_1_ON_FAN_BOARD: - case FAN_2_ON_FAN_BOARD: - case FAN_3_ON_FAN_BOARD: - case FAN_4_ON_FAN_BOARD: - case FAN_5_ON_FAN_BOARD: - case FAN_6_ON_FAN_BOARD: - rc =_onlp_fani_info_get_fan(fid, info); - break; - default: - rc = ONLP_STATUS_E_INVALID; - break; - } - - return rc; -} - -/* - * This function sets the speed of the given fan in RPM. - * - * This function will only be called if the fan supprots the RPM_SET - * capability. - * - * It is optional if you have no fans at all with this feature. - */ -int -onlp_fani_rpm_set(onlp_oid_t id, int rpm) -{ - return ONLP_STATUS_E_UNSUPPORTED; -} - -/* - * This function sets the fan speed of the given OID as a percentage. - * - * This will only be called if the OID has the PERCENTAGE_SET - * capability. - * - * It is optional if you have no fans at all with this feature. - */ -int -onlp_fani_percentage_set(onlp_oid_t id, int p) -{ - int fid; - char *path = NULL; - - VALIDATE(id); - - fid = ONLP_OID_ID_GET(id); - - /* reject p=0 (p=0, stop fan) */ - if (p == 0){ - return ONLP_STATUS_E_INVALID; - } - - switch (fid) - { - case FAN_1_ON_PSU_1: - return psu_ym2651y_pmbus_info_set(PSU1_ID, "psu_fan_duty_cycle_percentage", p); - case FAN_1_ON_PSU_2: - return psu_ym2651y_pmbus_info_set(PSU2_ID, "psu_fan_duty_cycle_percentage", p); - case FAN_1_ON_FAN_BOARD: - case FAN_2_ON_FAN_BOARD: - case FAN_3_ON_FAN_BOARD: - case FAN_4_ON_FAN_BOARD: - case FAN_5_ON_FAN_BOARD: - case FAN_6_ON_FAN_BOARD: - path = FAN_NODE(fan_duty_cycle_percentage); - break; - default: - return ONLP_STATUS_E_INVALID; - } - - DEBUG_PRINT("Fan path = (%s)", path); - - if (onlp_file_write_integer(path, p) < 0) { - AIM_LOG_ERROR("Unable to write data to file (%s)\r\n", path); - return ONLP_STATUS_E_INTERNAL; - } - - return ONLP_STATUS_OK; -} - - -/* - * This function sets the fan speed of the given OID as per - * the predefined ONLP fan speed modes: off, slow, normal, fast, max. - * - * Interpretation of these modes is up to the platform. - * - */ -int -onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode) -{ - return ONLP_STATUS_E_UNSUPPORTED; -} - -/* - * This function sets the fan direction of the given OID. - * - * This function is only relevant if the fan OID supports both direction - * capabilities. - * - * This function is optional unless the functionality is available. - */ -int -onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir) -{ - return ONLP_STATUS_E_UNSUPPORTED; -} - -/* - * Generic fan ioctl. Optional. - */ -int -onlp_fani_ioctl(onlp_oid_t id, va_list vargs) -{ - return ONLP_STATUS_E_UNSUPPORTED; -} - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/ledi.c b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/ledi.c deleted file mode 100755 index 94926527..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/ledi.c +++ /dev/null @@ -1,261 +0,0 @@ -/************************************************************ - * - * - * Copyright 2014 Big Switch Networks, Inc. - * Copyright 2014 Accton Technology Corporation. - * - * Licensed under the Eclipse Public License, Version 1.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.eclipse.org/legal/epl-v10.html - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - * - * - ************************************************************ - * - * - * - ***********************************************************/ -#include -#include -#include -#include -#include -#include - -#include "platform_lib.h" - -#define prefix_path "/sys/class/leds/accton_as7726_32x_led::" -#define filename "brightness" - -#define VALIDATE(_id) \ - do { \ - if(!ONLP_OID_IS_LED(_id)) { \ - return ONLP_STATUS_E_INVALID; \ - } \ - } while(0) - -/* LED related data - */ -enum onlp_led_id -{ - LED_RESERVED = 0, - LED_DIAG, - LED_LOC, - LED_FAN, - LED_PSU1, - LED_PSU2 -}; - -enum led_light_mode { - LED_MODE_OFF = 0, - LED_MODE_GREEN, - LED_MODE_AMBER, - LED_MODE_RED, - LED_MODE_BLUE, - LED_MODE_GREEN_BLINK, - LED_MODE_AMBER_BLINK, - LED_MODE_RED_BLINK, - LED_MODE_BLUE_BLINK, - LED_MODE_AUTO, - LED_MODE_UNKNOWN -}; - -typedef struct led_light_mode_map { - enum onlp_led_id id; - enum led_light_mode driver_led_mode; - enum onlp_led_mode_e onlp_led_mode; -} led_light_mode_map_t; - -led_light_mode_map_t led_map[] = { -{LED_DIAG, LED_MODE_OFF, ONLP_LED_MODE_OFF}, -{LED_DIAG, LED_MODE_GREEN, ONLP_LED_MODE_GREEN}, -{LED_DIAG, LED_MODE_AMBER, ONLP_LED_MODE_ORANGE}, -{LED_DIAG, LED_MODE_RED, ONLP_LED_MODE_RED}, -{LED_LOC, LED_MODE_OFF, ONLP_LED_MODE_OFF}, -{LED_LOC, LED_MODE_BLUE, ONLP_LED_MODE_BLUE}, -{LED_FAN, LED_MODE_AUTO, ONLP_LED_MODE_AUTO}, -{LED_PSU1, LED_MODE_AUTO, ONLP_LED_MODE_AUTO}, -{LED_PSU2, LED_MODE_AUTO, ONLP_LED_MODE_AUTO} -}; - -static char last_path[][10] = /* must map with onlp_led_id */ -{ - "reserved", - "diag", - "loc", - "fan", - "psu1", - "psu2" -}; - -/* - * Get the information for the given LED OID. - */ -static onlp_led_info_t linfo[] = -{ - { }, /* Not used */ - { - { ONLP_LED_ID_CREATE(LED_DIAG), "LED 1 (DIAG LED)", 0 }, - ONLP_LED_STATUS_PRESENT, - ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_ORANGE, - }, - { - { ONLP_LED_ID_CREATE(LED_LOC), "LED 2 (LOC LED)", 0 }, - ONLP_LED_STATUS_PRESENT, - ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_BLUE, - }, - { - { ONLP_LED_ID_CREATE(LED_FAN), "LED 3 (FAN LED)", 0 }, - ONLP_LED_STATUS_PRESENT, - ONLP_LED_CAPS_AUTO, - }, - { - { ONLP_LED_ID_CREATE(LED_PSU1), "LED 4 (PSU1 LED)", 0 }, - ONLP_LED_STATUS_PRESENT, - ONLP_LED_CAPS_AUTO, - }, - { - { ONLP_LED_ID_CREATE(LED_PSU2), "LED 4 (PSU2 LED)", 0 }, - ONLP_LED_STATUS_PRESENT, - ONLP_LED_CAPS_AUTO, - }, -}; - -static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) -{ - int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - - for (i = 0; i < nsize; i++) - { - if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) - { - return led_map[i].onlp_led_mode; - } - } - - return 0; -} - -static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) -{ - int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - - for(i = 0; i < nsize; i++) - { - if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) - { - return led_map[i].driver_led_mode; - } - } - - return 0; -} - -/* - * This function will be called prior to any other onlp_ledi_* functions. - */ -int -onlp_ledi_init(void) -{ - onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_DIAG), ONLP_LED_MODE_OFF); - onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_LOC), ONLP_LED_MODE_OFF); - - return ONLP_STATUS_OK; -} - -int -onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) -{ - int local_id; - char data[2] = {0}; - char fullpath[50] = {0}; - - VALIDATE(id); - - local_id = ONLP_OID_ID_GET(id); - - /* get fullpath */ - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - - /* Set the onlp_oid_hdr_t and capabilities */ - *info = linfo[ONLP_OID_ID_GET(id)]; - - /* Set LED mode */ - if (onlp_file_read_string(fullpath, data, sizeof(data), 0) != 0) { - DEBUG_PRINT("%s(%d)\r\n", __FUNCTION__, __LINE__); - return ONLP_STATUS_E_INTERNAL; - } - - info->mode = driver_to_onlp_led_mode(local_id, atoi(data)); - - /* Set the on/off status */ - if (info->mode != ONLP_LED_MODE_OFF) { - info->status |= ONLP_LED_STATUS_ON; - } - - return ONLP_STATUS_OK; -} - -/* - * Turn an LED on or off. - * - * This function will only be called if the LED OID supports the ONOFF - * capability. - * - * What 'on' means in terms of colors or modes for multimode LEDs is - * up to the platform to decide. This is intended as baseline toggle mechanism. - */ -int -onlp_ledi_set(onlp_oid_t id, int on_or_off) -{ - VALIDATE(id); - - if (!on_or_off) { - return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF); - } - - return ONLP_STATUS_E_UNSUPPORTED; -} - -/* - * This function puts the LED into the given mode. It is a more functional - * interface for multimode LEDs. - * - * Only modes reported in the LED's capabilities will be attempted. - */ -int -onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) -{ - int local_id; - char fullpath[50] = {0}; - - VALIDATE(id); - - local_id = ONLP_OID_ID_GET(id); - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - - if (onlp_file_write_integer(fullpath, onlp_to_driver_led_mode(local_id, mode)) != 0) - { - return ONLP_STATUS_E_INTERNAL; - } - - return ONLP_STATUS_OK; -} - -/* - * Generic LED ioctl interface. - */ -int -onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) -{ - return ONLP_STATUS_E_UNSUPPORTED; -} - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/platform_lib.c b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/platform_lib.c deleted file mode 100755 index fc7a5f2c..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/platform_lib.c +++ /dev/null @@ -1,202 +0,0 @@ -#include -#include -#include -#include -#include "platform_lib.h" -#include -#include "x86_64_accton_as7726_32x_log.h" - - -static int _onlp_file_write(char *filename, char *buffer, int buf_size, int data_len) -{ - int fd; - int len; - - if ((buffer == NULL) || (buf_size < 0)) { - return -1; - } - - if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) { - return -1; - } - - if ((len = write(fd, buffer, buf_size)) < 0) { - close(fd); - return -1; - } - - if ((close(fd) == -1)) { - return -1; - } - - if ((len > buf_size) || (data_len != 0 && len != data_len)) { - return -1; - } - - return 0; -} - -int onlp_file_write_integer(char *filename, int value) -{ - char buf[8] = {0}; - sprintf(buf, "%d", value); - - return _onlp_file_write(filename, buf, (int)strlen(buf), 0); -} - -int onlp_file_read_binary(char *filename, char *buffer, int buf_size, int data_len) -{ - int fd; - int len; - - if ((buffer == NULL) || (buf_size < 0)) { - return -1; - } - - if ((fd = open(filename, O_RDONLY)) == -1) { - return -1; - } - - if ((len = read(fd, buffer, buf_size)) < 0) { - close(fd); - return -1; - } - - if ((close(fd) == -1)) { - return -1; - } - - if ((len > buf_size) || (data_len != 0 && len != data_len)) { - return -1; - } - - return 0; -} - -int onlp_file_read_string(char *filename, char *buffer, int buf_size, int data_len) -{ - int ret; - - if (data_len >= buf_size) { - return -1; - } - - ret = onlp_file_read_binary(filename, buffer, buf_size-1, data_len); - - if (ret == 0) { - buffer[buf_size-1] = '\0'; - } - - return ret; -} - -#define I2C_PSU_MODEL_NAME_LEN 9 -#define I2C_PSU_FAN_DIR_LEN 3 - -psu_type_t get_psu_type(int id, char* modelname, int modelname_len) -{ - char *node = NULL; - char model_name[I2C_PSU_MODEL_NAME_LEN + 1] = {0}; - char fan_dir[I2C_PSU_FAN_DIR_LEN + 1] = {0}; - - - /* Check AC model name */ - node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_mfr_model) : PSU2_AC_PMBUS_NODE(psu_mfr_model); - if (onlp_file_read_string(node, model_name, sizeof(model_name), 0) != 0) { - return PSU_TYPE_UNKNOWN; - } - - if (strncmp(model_name, "YM-2651Y", strlen("YM-2651Y")) != 0) { - return PSU_TYPE_UNKNOWN; - } - - if (modelname) { - strncpy(modelname, model_name, modelname_len-1); - } - - node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); - - if (onlp_file_read_string(node, fan_dir, sizeof(fan_dir), 0) != 0) { - return PSU_TYPE_UNKNOWN; - } - - if (strncmp(fan_dir, "F2B", strlen("F2B")) == 0) { - return PSU_TYPE_AC_F2B; - } - - if (strncmp(fan_dir, "B2F", strlen("B2F")) == 0) { - return PSU_TYPE_AC_B2F; - } - - return PSU_TYPE_UNKNOWN; -} - -int psu_ym2651y_pmbus_info_get(int id, char *node, int *value) -{ - int ret = 0; - char path[PSU_NODE_MAX_PATH_LEN] = {0}; - - *value = 0; - - if (PSU1_ID == id) { - sprintf(path, "%s%s", PSU1_AC_PMBUS_PREFIX, node); - } - else { - sprintf(path, "%s%s", PSU2_AC_PMBUS_PREFIX, node); - } - - if (onlp_file_read_int(value, path) < 0) { - AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", path); - return ONLP_STATUS_E_INTERNAL; - } - - return ret; -} - -int psu_ym2651y_pmbus_info_set(int id, char *node, int value) -{ - char path[PSU_NODE_MAX_PATH_LEN] = {0}; - - switch (id) { - case PSU1_ID: - sprintf(path, "%s%s", PSU1_AC_PMBUS_PREFIX, node); - break; - case PSU2_ID: - sprintf(path, "%s%s", PSU2_AC_PMBUS_PREFIX, node); - break; - default: - return ONLP_STATUS_E_UNSUPPORTED; - }; - - if (onlp_file_write_integer(path, value) < 0) { - AIM_LOG_ERROR("Unable to write data to file (%s)\r\n", path); - return ONLP_STATUS_E_INTERNAL; - } - - return ONLP_STATUS_OK; -} - -#define PSU_SERIAL_NUMBER_LEN 18 - -int psu_serial_number_get(int id, char *serial, int serial_len) -{ - int size = 0; - int ret = ONLP_STATUS_OK; - char *prefix = NULL; - - if (serial == NULL || serial_len < PSU_SERIAL_NUMBER_LEN) { - return ONLP_STATUS_E_PARAM; - } - - prefix = (id == PSU1_ID) ? PSU1_AC_PMBUS_PREFIX : PSU2_AC_PMBUS_PREFIX; - - ret = onlp_file_read((uint8_t*)serial, PSU_SERIAL_NUMBER_LEN, &size, "%s%s", prefix, "psu_mfr_serial"); - if (ret != ONLP_STATUS_OK || size != PSU_SERIAL_NUMBER_LEN) { - return ONLP_STATUS_E_INTERNAL; - - } - - serial[PSU_SERIAL_NUMBER_LEN] = '\0'; - return ONLP_STATUS_OK; -} - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/platform_lib.h b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/platform_lib.h deleted file mode 100755 index 96c817bb..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/platform_lib.h +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************ - * - * - * Copyright 2014 Big Switch Networks, Inc. - * Copyright 2014 Accton Technology Corporation. - * - * Licensed under the Eclipse Public License, Version 1.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.eclipse.org/legal/epl-v10.html - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - * - * - ************************************************************ - * - * - * - ***********************************************************/ -#ifndef __PLATFORM_LIB_H__ -#define __PLATFORM_LIB_H__ - -#include -#include "x86_64_accton_as7726_32x_log.h" - -#define CHASSIS_FAN_COUNT 6 -#define CHASSIS_THERMAL_COUNT 6 -#define CHASSIS_PSU_COUNT 2 -#define CHASSIS_LED_COUNT 5 - -#define PSU1_ID 1 -#define PSU2_ID 2 - -#define PSU_NODE_MAX_INT_LEN 8 -#define PSU_NODE_MAX_PATH_LEN 64 - -#define PSU1_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/50-005b/" -#define PSU2_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/49-0058/" - -#define PSU1_AC_PMBUS_NODE(node) PSU1_AC_PMBUS_PREFIX#node -#define PSU2_AC_PMBUS_NODE(node) PSU2_AC_PMBUS_PREFIX#node - -#define PSU1_AC_HWMON_PREFIX "/sys/bus/i2c/devices/50-0053/" -#define PSU2_AC_HWMON_PREFIX "/sys/bus/i2c/devices/49-0050/" - - -#define PSU1_AC_HWMON_NODE(node) PSU1_AC_HWMON_PREFIX#node -#define PSU2_AC_HWMON_NODE(node) PSU2_AC_HWMON_PREFIX#node - -#define FAN_BOARD_PATH "/sys/bus/i2c/devices/54-0066/" -#define FAN_NODE(node) FAN_BOARD_PATH#node - -#define IDPROM_PATH "/sys/class/i2c-adapter/i2c-0/0-0056/eeprom" - -int onlp_file_write_integer(char *filename, int value); -int onlp_file_read_binary(char *filename, char *buffer, int buf_size, int data_len); -int onlp_file_read_string(char *filename, char *buffer, int buf_size, int data_len); - - -int psu_ym2651y_pmbus_info_get(int id, char *node, int *value); -int psu_ym2651y_pmbus_info_set(int id, char *node, int value); - -typedef enum psu_type { - PSU_TYPE_UNKNOWN, - PSU_TYPE_AC_F2B, - PSU_TYPE_AC_B2F -} psu_type_t; - -psu_type_t get_psu_type(int id, char* modelname, int modelname_len); -int psu_serial_number_get(int id, char *serial, int serial_len); - -//#define DEBUG_MODE 1 - -#if (DEBUG_MODE == 1) - #define DEBUG_PRINT(format, ...) printf(format, __VA_ARGS__) -#else - #define DEBUG_PRINT(format, ...) -#endif - -#endif /* __PLATFORM_LIB_H__ */ - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/psui.c b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/psui.c deleted file mode 100755 index 5185a145..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/psui.c +++ /dev/null @@ -1,185 +0,0 @@ -/************************************************************ - * - * - * Copyright 2014 Big Switch Networks, Inc. - * Copyright 2014 Accton Technology Corporation. - * - * Licensed under the Eclipse Public License, Version 1.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.eclipse.org/legal/epl-v10.html - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - * - * - ************************************************************ - * - * - * - ***********************************************************/ -#include -#include -//#include -#include -#include "platform_lib.h" - -#define PSU_STATUS_PRESENT 1 -#define PSU_STATUS_POWER_GOOD 1 - - - -#define VALIDATE(_id) \ - do { \ - if(!ONLP_OID_IS_PSU(_id)) { \ - return ONLP_STATUS_E_INVALID; \ - } \ - } while(0) - -static int -psu_status_info_get(int id, char *node, int *value) -{ - int ret = 0; - char path[PSU_NODE_MAX_PATH_LEN] = {0}; - - *value = 0; - - - if (PSU1_ID == id) { - sprintf(path, "%s%s", PSU1_AC_HWMON_PREFIX, node); - } - else if (PSU2_ID == id) { - sprintf(path, "%s%s", PSU2_AC_HWMON_PREFIX, node); - } - if (onlp_file_read_int(value, path) < 0) { - AIM_LOG_ERROR("Unable to read status from file(%s)\r\n", path); - return ONLP_STATUS_E_INTERNAL; - } - - return ret; -} - -int -onlp_psui_init(void) -{ - return ONLP_STATUS_OK; -} - -static int -psu_ym2651y_info_get(onlp_psu_info_t* info) -{ - int val = 0; - int index = ONLP_OID_ID_GET(info->hdr.id); - - /* Set capability - */ - info->caps = ONLP_PSU_CAPS_AC; - - if (info->status & ONLP_PSU_STATUS_FAILED) { - return ONLP_STATUS_OK; - } - - /* Set the associated oid_table */ - info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT); - info->hdr.coids[1] = ONLP_THERMAL_ID_CREATE(index + CHASSIS_THERMAL_COUNT); - - /* Read voltage, current and power */ - if (psu_ym2651y_pmbus_info_get(index, "psu_v_out", &val) == 0) { - info->mvout = val; - info->caps |= ONLP_PSU_CAPS_VOUT; - } - - if (psu_ym2651y_pmbus_info_get(index, "psu_i_out", &val) == 0) { - info->miout = val; - info->caps |= ONLP_PSU_CAPS_IOUT; - } - - if (psu_ym2651y_pmbus_info_get(index, "psu_p_out", &val) == 0) { - info->mpout = val; - info->caps |= ONLP_PSU_CAPS_POUT; - } - - psu_serial_number_get(index, info->serial, sizeof(info->serial)); - - return ONLP_STATUS_OK; -} - -/* - * Get all information about the given PSU oid. - */ -static onlp_psu_info_t pinfo[] = -{ - { }, /* Not used */ - { - { ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0 }, - }, - { - { ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0 }, - } -}; - -int -onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) -{ - int val = 0; - int ret = ONLP_STATUS_OK; - int index = ONLP_OID_ID_GET(id); - psu_type_t psu_type; - - VALIDATE(id); - - memset(info, 0, sizeof(onlp_psu_info_t)); - *info = pinfo[index]; /* Set the onlp_oid_hdr_t */ - /* Get the present state */ - if (psu_status_info_get(index, "psu_present", &val) != 0) { - AIM_LOG_ERROR("Unable to read PSU(%d) node(psu_present)\r\n", index); - } - if (val != PSU_STATUS_PRESENT) { - info->status &= ~ONLP_PSU_STATUS_PRESENT; - return ONLP_STATUS_OK; - } - info->status |= ONLP_PSU_STATUS_PRESENT; - - - /* Get power good status */ - if (psu_status_info_get(index, "psu_power_good", &val) != 0) { - AIM_LOG_ERROR("Unable to read PSU(%d) node(psu_power_good)\r\n", index); - } - - if (val != PSU_STATUS_POWER_GOOD) { - info->status |= ONLP_PSU_STATUS_FAILED; - } - - - /* Get PSU type - */ - psu_type = get_psu_type(index, info->model, sizeof(info->model)); - switch (psu_type) { - case PSU_TYPE_AC_F2B: - case PSU_TYPE_AC_B2F: - ret = psu_ym2651y_info_get(info); - break; - case PSU_TYPE_UNKNOWN: /* User insert a unknown PSU or unplugged.*/ - info->status |= ONLP_PSU_STATUS_UNPLUGGED; - info->status &= ~ONLP_PSU_STATUS_FAILED; - ret = ONLP_STATUS_OK; - break; - default: - ret = ONLP_STATUS_E_UNSUPPORTED; - break; - } - - return ret; -} - -int -onlp_psui_ioctl(onlp_oid_t pid, va_list vargs) -{ - return ONLP_STATUS_E_UNSUPPORTED; -} - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/sfpi.c b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/sfpi.c deleted file mode 100755 index f9d671b0..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/sfpi.c +++ /dev/null @@ -1,422 +0,0 @@ -/************************************************************ - * - * - * Copyright 2014 Big Switch Networks, Inc. - * Copyright 2013 Accton Technology Corporation. - * - * Licensed under the Eclipse Public License, Version 1.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.eclipse.org/legal/epl-v10.html - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - * - * - ************************************************************ - * - * - * - ***********************************************************/ -#include -#include -#include -#include "x86_64_accton_as7726_32x_int.h" -#include "x86_64_accton_as7726_32x_log.h" - -#define PORT_BUS_INDEX(port) (port+18) - -#define PORT_EEPROM_FORMAT "/sys/bus/i2c/devices/%d-0050/eeprom" -#define MODULE_PRESENT_FORMAT "/sys/bus/i2c/devices/%d-00%d/module_present_%d" -#define MODULE_RXLOS_FORMAT "/sys/bus/i2c/devices/%d-00%d/module_rx_los_%d" -#define MODULE_TXFAULT_FORMAT "/sys/bus/i2c/devices/%d-00%d/module_tx_fault_%d" -#define MODULE_TXDISABLE_FORMAT "/sys/bus/i2c/devices/%d-00%d/module_tx_disable_%d" -#define MODULE_PRESENT_ALL_ATTR "/sys/bus/i2c/devices/%d-00%d/module_present_all" -#define MODULE_RXLOS_ALL_ATTR_CPLD "/sys/bus/i2c/devices/11-0060/module_rx_los_all" -#define MODULE_RXLOS_ALL_ATTR_CPLD3 "/sys/bus/i2c/devices/6-0064/module_rx_los_all" - - -int sfp_map_bus[] ={21, 22, 23, 24, 26, 25, 28, 27, - 17, 18, 19, 20, 29, 30, 31, 32, - 33, 34, 35, 36, 45, 46, 47, 48, - 37, 38, 39, 40, 41, 42, 43, 44, - 15, 16}; - -/************************************************************ - * - * SFPI Entry Points - * - ***********************************************************/ - -int -onlp_sfpi_init(void) -{ - /* Called at initialization time */ - return ONLP_STATUS_OK; -} -int -onlp_sfpi_map_bus_index(int port) -{ - if(port < 0 || port >=34) - return ONLP_STATUS_E_INTERNAL; - return sfp_map_bus[port]; -} - -int -onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap) -{ - /* - * Ports {0, 34} - */ - int p; - - for(p = 0; p < 34; p++) { - AIM_BITMAP_SET(bmap, p); - } - - return ONLP_STATUS_OK; -} - -int -onlp_sfpi_is_present(int port) -{ - /* - * Return 1 if present. - * Return 0 if not present. - * Return < 0 if error. - */ - int present; - int bus, addr; - - if(port <0 || port > 34) - return ONLP_STATUS_E_INTERNAL; - - addr = 60; - bus = 11; - - if (onlp_file_read_int(&present, MODULE_PRESENT_FORMAT, bus, addr, (port+1)) < 0) { - AIM_LOG_ERROR("Unable to read present status from port(%d)\r\n", port); - return ONLP_STATUS_E_INTERNAL; - } - - return present; -} - -int -onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst) -{ - uint32_t bytes[5], *ptr = NULL; - FILE* fp; - int addr=60; - int bus=11; - char file[64] = {0}; - int count; - - ptr = bytes; - sprintf(file, MODULE_PRESENT_ALL_ATTR, bus, addr); - fp = fopen(file, "r"); - if(fp == NULL) { - AIM_LOG_ERROR("Unable to open the module_present_all device file of CPLD3."); - return ONLP_STATUS_E_INTERNAL; - } - - count = fscanf(fp, "%x %x %x %x %x", ptr+0, ptr+1, ptr+2, ptr+3, ptr+4); - fclose(fp); - if(count != 5) { - /* Likely a CPLD read timeout. */ - AIM_LOG_ERROR("Unable to read all fields the module_present_all device file of CPLD3."); - return ONLP_STATUS_E_INTERNAL; - } - - /* Convert to 64 bit integer in port order */ - uint64_t presence_all = 0 ; - int i = 0; - for(i = AIM_ARRAYSIZE(bytes)-1; i >= 0; i--) { - presence_all <<= 8; - presence_all |= bytes[i]; - } - - /* Populate bitmap */ - for(i = 0; presence_all; i++) { - AIM_BITMAP_MOD(dst, i, (presence_all & 1)); - presence_all >>= 1; - } - - return ONLP_STATUS_OK; -} - -int -onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst) -{ - uint32_t bytes[5]; - uint32_t *ptr = bytes; - FILE* fp; - - int addr=60, i = 0; - - fp = fopen(MODULE_RXLOS_ALL_ATTR_CPLD, "r"); - if(fp == NULL) { - AIM_LOG_ERROR("Unable to open the module_rx_los_all device file of CPLD(0x%d)", addr); - return ONLP_STATUS_E_INTERNAL; - } - - int count = fscanf(fp, "%x %x %x %x %x", ptr+0, ptr+1, ptr+2, ptr+3, ptr+4); - fclose(fp); - if(count != 5) { - /* Likely a CPLD read timeout. */ - AIM_LOG_ERROR("Unable to read all fields from the module_rx_los_all device file of CPLD(0x%d)", addr); - return ONLP_STATUS_E_INTERNAL; - } - - uint64_t rx_los_all = 0; - bytes[0]=bytes[1]=bytes[2]=bytes[3]=0xff; - for(i = AIM_ARRAYSIZE(bytes)-1; i >= 0; i--) { - rx_los_all <<= 8; - rx_los_all |= bytes[i]; - } - - /* Populate bitmap */ - for(i = 0; rx_los_all; i++) { - AIM_BITMAP_MOD(dst, i, (rx_los_all & 1)); - rx_los_all >>= 1; - } - - return ONLP_STATUS_OK; -} - -int -onlp_sfpi_eeprom_read(int port, uint8_t data[256]) -{ - /* - * Read the SFP eeprom into data[] - * - * Return MISSING if SFP is missing. - * Return OK if eeprom is read - */ - int size = 0; - if(port <0 || port > 34) - return ONLP_STATUS_E_INTERNAL; - memset(data, 0, 256); - - if(onlp_file_read(data, 256, &size, PORT_EEPROM_FORMAT, onlp_sfpi_map_bus_index(port)) != ONLP_STATUS_OK) { - AIM_LOG_ERROR("Unable to read eeprom from port(%d)\r\n", port); - return ONLP_STATUS_E_INTERNAL; - } - - if (size != 256) { - AIM_LOG_ERROR("Unable to read eeprom from port(%d), size is different!\r\n", port); - return ONLP_STATUS_E_INTERNAL; - } - - return ONLP_STATUS_OK; -} - -int -onlp_sfpi_dom_read(int port, uint8_t data[256]) -{ - FILE* fp; - char file[64] = {0}; - - sprintf(file, PORT_EEPROM_FORMAT, onlp_sfpi_map_bus_index(port)); - fp = fopen(file, "r"); - if(fp == NULL) { - AIM_LOG_ERROR("Unable to open the eeprom device file of port(%d)", port); - return ONLP_STATUS_E_INTERNAL; - } - - if (fseek(fp, 256, SEEK_CUR) != 0) { - fclose(fp); - AIM_LOG_ERROR("Unable to set the file position indicator of port(%d)", port); - return ONLP_STATUS_E_INTERNAL; - } - - int ret = fread(data, 1, 256, fp); - fclose(fp); - if (ret != 256) { - AIM_LOG_ERROR("Unable to read the module_eeprom device file of port(%d)", port); - return ONLP_STATUS_E_INTERNAL; - } - - return ONLP_STATUS_OK; -} - -int -onlp_sfpi_dev_readb(int port, uint8_t devaddr, uint8_t addr) -{ - int bus = onlp_sfpi_map_bus_index(port); - return onlp_i2c_readb(bus, devaddr, addr, ONLP_I2C_F_FORCE); -} - -int -onlp_sfpi_dev_writeb(int port, uint8_t devaddr, uint8_t addr, uint8_t value) -{ - int bus = onlp_sfpi_map_bus_index(port); - return onlp_i2c_writeb(bus, devaddr, addr, value, ONLP_I2C_F_FORCE); -} - -int -onlp_sfpi_dev_readw(int port, uint8_t devaddr, uint8_t addr) -{ - int bus = onlp_sfpi_map_bus_index(port); - return onlp_i2c_readw(bus, devaddr, addr, ONLP_I2C_F_FORCE); -} - -int -onlp_sfpi_dev_writew(int port, uint8_t devaddr, uint8_t addr, uint16_t value) -{ - int bus = onlp_sfpi_map_bus_index(port); - return onlp_i2c_writew(bus, devaddr, addr, value, ONLP_I2C_F_FORCE); -} - -int -onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value) -{ - int rv; - int addr = 60; - int bus = 11; - - if(port <0 || port > 34) - return ONLP_STATUS_E_INTERNAL; - - switch(control) - { - case ONLP_SFP_CONTROL_TX_DISABLE: - { - if(port==32 || port==33) - { - if (onlp_file_write_int(0, MODULE_TXDISABLE_FORMAT, bus, addr, (port+1)) < 0) { - AIM_LOG_ERROR("Unable to set tx_disable status to port(%d)\r\n", port); - rv = ONLP_STATUS_E_INTERNAL; - } - else { - rv = ONLP_STATUS_OK; - } - } - else if(port >=0) - { - if(!onlp_sfpi_is_present(port)) - return ONLP_STATUS_OK; - rv=onlp_sfpi_dev_writeb(port, 0x50, 86, 1); - if(rv < 0) - { - AIM_LOG_ERROR("Fail to read onlp_sfpi_dev_writeb, port=%d\r\n", port); - rv = ONLP_STATUS_E_INTERNAL; - } - else - { - rv = ONLP_STATUS_OK; - } - } - break; - } - - default: - rv = ONLP_STATUS_E_UNSUPPORTED; - break; - } - - return rv; -} - -int -onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value) -{ - int rv; - int addr = 60; - int bus = 11; - - if(port <0 || port > 34) - return ONLP_STATUS_E_INTERNAL; - - switch(control) - { - case ONLP_SFP_CONTROL_RX_LOS: - { - if(port==32 || port==33) - { - if (onlp_file_read_int(value, MODULE_RXLOS_FORMAT, bus, addr, (port+1)) < 0) { - AIM_LOG_ERROR("Unable to read rx_loss status from port(%d)\r\n", port); - rv = ONLP_STATUS_E_INTERNAL; - } - else { - rv = ONLP_STATUS_OK; - } - } - else - return ONLP_STATUS_E_UNSUPPORTED; - - break; - } - - case ONLP_SFP_CONTROL_TX_FAULT: - { - if(port==32 || port==33) - { - if (onlp_file_read_int(value, MODULE_TXFAULT_FORMAT, bus, addr, (port+1)) < 0) { - AIM_LOG_ERROR("Unable to read tx_fault status from port(%d)\r\n", port); - rv = ONLP_STATUS_E_INTERNAL; - } - else { - rv = ONLP_STATUS_OK; - } - } - else - return ONLP_STATUS_E_UNSUPPORTED; - break; - } - - case ONLP_SFP_CONTROL_TX_DISABLE: - { - if(port==32 || port==33) - { - if (onlp_file_read_int(value, MODULE_TXDISABLE_FORMAT, bus, addr, (port+1)) < 0) { - AIM_LOG_ERROR("Unable to read tx_disabled status from port(%d)\r\n", port); - rv = ONLP_STATUS_E_INTERNAL; - } - else { - rv = ONLP_STATUS_OK; - } - } - else - { - if(port >= 0) - { - if(!onlp_sfpi_is_present(port)) - { - *value=0; - return ONLP_STATUS_OK; - } - rv=onlp_sfpi_dev_readb(port, 0x50, 86); - if(rv < 0) - { - AIM_LOG_ERROR("Unable to read tx_disabled status from port(%d)\r\n", port); - rv = ONLP_STATUS_E_INTERNAL; - } - else - { - *value= (rv & 0x1); - rv = ONLP_STATUS_OK; - } - } - } - break; - } - - default: - rv = ONLP_STATUS_E_UNSUPPORTED; - } - - return rv; -} - -int -onlp_sfpi_denit(void) -{ - return ONLP_STATUS_OK; -} - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/sysi.c b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/sysi.c deleted file mode 100755 index 4e16b3ad..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/sysi.c +++ /dev/null @@ -1,490 +0,0 @@ -/************************************************************ - * - * - * Copyright 2014 Big Switch Networks, Inc. - * Copyright 2014 Accton Technology Corporation. - * - * Licensed under the Eclipse Public License, Version 1.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.eclipse.org/legal/epl-v10.html - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - * - * - ************************************************************ - * - * - * - ***********************************************************/ -#include -#include -#include - -#include -#include -#include -#include -#include -#include "platform_lib.h" -#include "x86_64_accton_as7726_32x_int.h" -#include "x86_64_accton_as7726_32x_log.h" - - -#define PREFIX_PATH_ON_CPLD_DEV "/sys/bus/i2c/devices/" -#define NUM_OF_CPLD 3 -#define FAN_DUTY_CYCLE_MAX (100) -#define FAN_DUTY_CYCLE_DEFAULT (32) -#define FAN_DUTY_PLUS_FOR_DIR (13) -/* Note, all chassis fans share 1 single duty setting. - * Here use fan 1 to represent global fan duty value.*/ -#define FAN_ID_FOR_SET_FAN_DUTY (1) -#define CELSIUS_RECORD_NUMBER (2) /*Must >= 2*/ - -typedef struct fan_ctrl_policy { - int duty_cycle; /* In percetage */ - int step_up_thermal; /* In mini-Celsius */ - int step_dn_thermal; /* In mini-Celsius */ -} fan_ctrl_policy_t; - -static char arr_cplddev_name[NUM_OF_CPLD][10] = -{ - "4-0060", - "5-0062", - "6-0064" -}; - -const char* -onlp_sysi_platform_get(void) -{ - return "x86-64-accton-as7726-32x-r0"; -} - -int -onlp_sysi_onie_data_get(uint8_t** data, int* size) -{ - uint8_t* rdata = aim_zmalloc(256); - - if(onlp_file_read(rdata, 256, size, IDPROM_PATH) == ONLP_STATUS_OK) { - if(*size == 256) { - *data = rdata; - return ONLP_STATUS_OK; - } - } - - aim_free(rdata); - *size = 0; - return ONLP_STATUS_E_INTERNAL; -} - -int -onlp_sysi_oids_get(onlp_oid_t* table, int max) -{ - int i; - onlp_oid_t* e = table; - memset(table, 0, max*sizeof(onlp_oid_t)); - - /* 6 Thermal sensors on the chassis */ - for (i = 1; i <= CHASSIS_THERMAL_COUNT; i++) { - *e++ = ONLP_THERMAL_ID_CREATE(i); - } - - /* 5 LEDs on the chassis */ - for (i = 1; i <= CHASSIS_LED_COUNT; i++) { - *e++ = ONLP_LED_ID_CREATE(i); - } - - /* 2 PSUs on the chassis */ - for (i = 1; i <= CHASSIS_PSU_COUNT; i++) { - *e++ = ONLP_PSU_ID_CREATE(i); - } - - /* 6 Fans on the chassis */ - for (i = 1; i <= CHASSIS_FAN_COUNT; i++) { - *e++ = ONLP_FAN_ID_CREATE(i); - } - - return 0; -} - -int -onlp_sysi_platform_info_get(onlp_platform_info_t* pi) -{ - int i, v[NUM_OF_CPLD]={0}; - - for (i = 0; i < NUM_OF_CPLD; i++) { - v[i] = 0; - - if(onlp_file_read_int(v+i, "%s%s/version", PREFIX_PATH_ON_CPLD_DEV, arr_cplddev_name[i]) < 0) { - return ONLP_STATUS_E_INTERNAL; - } - } - pi->cpld_versions = aim_fstrdup("%d.%d.%d", v[0], v[1], v[2]); - - return 0; -} - -void -onlp_sysi_platform_info_free(onlp_platform_info_t* pi) -{ - aim_free(pi->cpld_versions); -} - -/* Thermal plan: - * $TMP = (CPU_core + LM75_1+ LM75_2 + LM75_3 + LM75_4)/5 - * 1. If any FAN failed, set all the other fans as full speed, 100%. - * 2. If any sensor is high than 45 degrees, set fan speed to duty 62.5%. - * 3. If any sensor is high than 50 degrees, set fan speed to duty 100%. - * 4. When $TMP >= 40 C, set fan speed to duty 62.5%. - * 5. When $TMP >= 45 C, set fan speed to duty 100%. - * 6. When $TMP < 35 C, set fan speed to duty 31.25%. - * 7. Direction factor, when B2F, duty + 12.5%. - * - * Note, all chassis fans share 1 single duty setting. - */ -fan_ctrl_policy_t fan_ctrl_policy_avg[] = { -{FAN_DUTY_CYCLE_MAX , 45000, INT_MIN}, -{63 , 40000, INT_MIN}, -{32 , INT_MAX, 35000}, -}; - -fan_ctrl_policy_t fan_ctrl_policy_single[] = { -{FAN_DUTY_CYCLE_MAX , 50000, INT_MIN}, -{63 , 45000, INT_MIN}, -}; - -struct fan_control_data_s { - int duty_cycle; - int dir_plus; - int mc_avg_pre[CELSIUS_RECORD_NUMBER]; - int mc_high_pre[CELSIUS_RECORD_NUMBER]; - -} fan_control_data_pre = -{ - .duty_cycle = FAN_DUTY_CYCLE_DEFAULT, - .dir_plus = 0, - .mc_avg_pre = {INT_MIN+1, INT_MIN}, /*init as thermal rising to avoid full speed.*/ - .mc_high_pre = {INT_MIN+1, INT_MIN}, /*init as thermal rising to avoid full speed.*/ - -}; - -static int -sysi_check_fan(uint32_t *fan_dir){ - int i, present; - - for (i = 1; i <= CHASSIS_FAN_COUNT; i++) - { - onlp_fan_info_t fan_info; - - if (onlp_fani_info_get(ONLP_FAN_ID_CREATE(i), &fan_info) != ONLP_STATUS_OK) { - AIM_LOG_ERROR("Unable to get fan(%d) status\r\n", i); - return ONLP_STATUS_E_INTERNAL; - } - - present = fan_info.status & ONLP_FAN_STATUS_PRESENT; - if ((fan_info.status & ONLP_FAN_STATUS_FAILED) || !present) { - AIM_LOG_WARN("Fan(%d) is not working, set the other fans as full speed\r\n", i); - int ret = onlp_fani_percentage_set( - ONLP_FAN_ID_CREATE(FAN_ID_FOR_SET_FAN_DUTY), FAN_DUTY_CYCLE_MAX); - if (ret != ONLP_STATUS_OK) - return ret; - else - return ONLP_STATUS_E_MISSING; - } - - /* Get fan direction (Only get the first one since all fan direction are the same) - */ - if (i == 1) { - *fan_dir = fan_info.status & (ONLP_FAN_STATUS_F2B|ONLP_FAN_STATUS_B2F); - } - } - - return ONLP_STATUS_OK; -} - -static int -sysi_get_fan_duty(int *cur_duty_cycle){ - int fd, len; - char buf[10] = {0}; - char *node = FAN_NODE(fan_duty_cycle_percentage); - - /* Get current fan duty*/ - fd = open(node, O_RDONLY); - if (fd == -1){ - AIM_LOG_ERROR("Unable to open fan speed control node (%s)", node); - return ONLP_STATUS_E_INTERNAL; - } - - len = read(fd, buf, sizeof(buf)); - close(fd); - if (len <= 0) { - AIM_LOG_ERROR("Unable to read fan speed from (%s)", node); - return ONLP_STATUS_E_INTERNAL; - } - *cur_duty_cycle = atoi(buf); - - return ONLP_STATUS_OK; -} - -static int -sysi_get_thermal_sum(int *mcelsius){ - onlp_thermal_info_t thermal_info; - int i; - - *mcelsius = 0; - for (i = 1; i <= CHASSIS_THERMAL_COUNT; i++) { - if (onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(i), &thermal_info) - != ONLP_STATUS_OK) { - AIM_LOG_ERROR("Unable to read thermal status"); - return ONLP_STATUS_E_INTERNAL; - } - *mcelsius += thermal_info.mcelsius; - - DEBUG_PRINT("Thermal %d: %d \n ", i, thermal_info.mcelsius); - - } - - return ONLP_STATUS_OK; - -} - -static int -sysi_get_highest_thermal(int *mcelsius){ - onlp_thermal_info_t thermal_info; - int i, highest; - - highest = 0; - for (i = 1; i <= CHASSIS_THERMAL_COUNT; i++) { - if (onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(i), &thermal_info) - != ONLP_STATUS_OK) { - AIM_LOG_ERROR("Unable to read thermal status"); - return ONLP_STATUS_E_INTERNAL; - } - highest = (thermal_info.mcelsius > highest)? - thermal_info.mcelsius : highest; - } - *mcelsius = highest; - return ONLP_STATUS_OK; -} - -/* Anaylze thermal changing history to judge if the change is a stable trend. */ -static int _is_thermal_a_trend(int *mc_history){ - int i, trend, trended; - - if (mc_history == NULL) { - AIM_LOG_ERROR("Unable to get history of thermal\n"); - return 0; - } - - /* Get heat up/down trend. */ - trend = 0; - for (i = 0; i < CELSIUS_RECORD_NUMBER; i++) { - if (( mc_history[i+1] < mc_history[i])){ - trend++; - }else if (( mc_history[i+1] > mc_history[i])){ - trend--; - } - } - - trended = (abs(trend) >= ((CELSIUS_RECORD_NUMBER+1)/2))? 1:0; -#if (DEBUG_MODE == 1) - DEBUG_PRINT("[INFO]%s#%d, trended: %d, UP/DW: %d mcelsius:", - __func__, __LINE__, trended, trend ); - for (i = 0; i <= CELSIUS_RECORD_NUMBER; i++) { - DEBUG_PRINT(" %d =>", mc_history[i]); - } - DEBUG_PRINT("%c\n", ' '); -#endif - - /*For more than half changes are same direction, it's a firm trend.*/ - return trended; -} - - -/* Decide duty by highest value of thermal sensors.*/ -static int -sysi_get_duty_by_highest(int *duty_cycle){ - int i, ret, maxtrix_len; - int new_duty_cycle = 0 ; - int mc_history[CELSIUS_RECORD_NUMBER+1] = {0}; - int *mcelsius_pre_p = &mc_history[1]; - int *mcelsius_now_p = &mc_history[0]; - - /* Fill up mcelsius array, - * [0] is current temperature, others are history. - */ - ret = sysi_get_highest_thermal(mcelsius_now_p); - if(ONLP_STATUS_OK != ret){ - return ret; - } - memcpy (mcelsius_pre_p, fan_control_data_pre.mc_high_pre, - sizeof(fan_control_data_pre.mc_high_pre)); - - DEBUG_PRINT("[INFO]%s#%d, highest mcelsius:%d!\n", - __func__, __LINE__, *mcelsius_now_p); - - /* Shift records to the right */ - for (i = 0; i < CELSIUS_RECORD_NUMBER; i++) { - fan_control_data_pre.mc_high_pre[i] = mc_history[i]; - } - - /* Only change duty on consecutive heat rising or falling.*/ - maxtrix_len = AIM_ARRAYSIZE(fan_ctrl_policy_single); - - /* Only change duty when the thermal changing are firm. */ - if (_is_thermal_a_trend(mc_history)) - { - int matched = 0; - for (i = 0; i < maxtrix_len; i++) { - if ((*mcelsius_now_p > fan_ctrl_policy_single[i].step_up_thermal)) { - new_duty_cycle = fan_ctrl_policy_single[i].duty_cycle; - matched = !matched; - break; - } - } -/* if (!matched) { - DEBUG_PRINT("%s#%d, celsius(%d) falls into undefined range!!\n", - __func__, __LINE__, *mcelsius_now_p); - } */ - } - *duty_cycle = new_duty_cycle; - return ONLP_STATUS_OK; -} - -/* Decide duty by average value of thermal sensors.*/ -static int -sysi_get_duty_by_average(int *duty_cycle){ - int i, mcelsius_avg, ret, maxtrix_len; - int new_duty_cycle=0; - int mc_history[CELSIUS_RECORD_NUMBER+1] = {0}; - int *mcelsius_pre_p = &mc_history[1]; - int *mcelsius_now_p = &mc_history[0]; - - /* Fill up mcelsius array, - * [0] is current temperature, others are history. - */ - *mcelsius_now_p = 0; - ret = sysi_get_thermal_sum(mcelsius_now_p); - if(ONLP_STATUS_OK != ret){ - return ret; - } - mcelsius_avg = (*mcelsius_now_p)/CHASSIS_THERMAL_COUNT; - - memcpy (mcelsius_pre_p, fan_control_data_pre.mc_avg_pre, - sizeof(fan_control_data_pre.mc_avg_pre)); - - DEBUG_PRINT("[INFO]%s#%d, mcelsius:%d!\n", __func__, __LINE__, mcelsius_avg); - - /* Shift records to the right */ - for (i = 0; i < CELSIUS_RECORD_NUMBER; i++) { - fan_control_data_pre.mc_avg_pre[i] = mc_history[i]; - } - - /* Only change duty on consecutive heat rising or falling.*/ - maxtrix_len = AIM_ARRAYSIZE(fan_ctrl_policy_avg); - - /* Only change duty when the thermal changing are firm. */ - if (_is_thermal_a_trend(mc_history)) - { - int matched = 0; - for (i = 0; i < maxtrix_len; i++) { - if ((mcelsius_avg >= fan_ctrl_policy_avg[i].step_up_thermal)) { - new_duty_cycle = fan_ctrl_policy_avg[i].duty_cycle; - matched = !matched; - break; - } - } - for (i = maxtrix_len-1; i>=0; i--) { - if ((mcelsius_avg < fan_ctrl_policy_avg[i].step_dn_thermal)) { - new_duty_cycle = fan_ctrl_policy_avg[i].duty_cycle; - matched = !matched; - break; - } - } - /*if (!matched) { - DEBUG_PRINT("%s#%d, celsius(%d) falls into undefined range!!\n", - __func__, __LINE__, mcelsius_avg); - } */ - } - - *duty_cycle = new_duty_cycle; - return ONLP_STATUS_OK; -} - -int -onlp_sysi_platform_manage_fans(void) -{ - uint32_t fan_dir; - int ret; - int cur_duty_cycle, new_duty_cycle, tmp; - int direct_addon = 0; - onlp_oid_t fan_duty_oid = ONLP_FAN_ID_CREATE(FAN_ID_FOR_SET_FAN_DUTY); - - /********************************************************** - * Decision 1: Set fan as full speed if any fan is failed. - **********************************************************/ - ret = sysi_check_fan(&fan_dir); - if(ONLP_STATUS_OK != ret){ - return ret; - } - - if (fan_dir & ONLP_FAN_STATUS_B2F) { - direct_addon = FAN_DUTY_PLUS_FOR_DIR; - } - - /********************************************************** - * Decision 2: If no matched fan speed is found from the policy, - * use FAN_DUTY_CYCLE_MIN as default speed - **********************************************************/ - ret = sysi_get_fan_duty(&cur_duty_cycle); - if(ONLP_STATUS_OK != ret){ - return ret; - } - - /********************************************************** - * Decision 3: Decide new fan speed depend on fan direction and temperature - **********************************************************/ - ret = sysi_get_duty_by_average(&new_duty_cycle); - if (ONLP_STATUS_OK != ret){ - return ret; - } - ret = sysi_get_duty_by_highest(&tmp); - if (ONLP_STATUS_OK != ret){ - return ret; - } - - new_duty_cycle = (tmp > new_duty_cycle)? tmp : new_duty_cycle; - if (new_duty_cycle == 0) - { - new_duty_cycle = fan_control_data_pre.duty_cycle; - } else { - fan_control_data_pre.duty_cycle = new_duty_cycle; - } - fan_control_data_pre.dir_plus = direct_addon; - DEBUG_PRINT("[INFO]%s#%d, new duty: %d = %d + %d (%d)!\n", __func__, __LINE__, - new_duty_cycle + direct_addon, new_duty_cycle, direct_addon, cur_duty_cycle); - - new_duty_cycle += direct_addon; - new_duty_cycle = (new_duty_cycle > FAN_DUTY_CYCLE_MAX)? - FAN_DUTY_CYCLE_MAX : new_duty_cycle; - - if (new_duty_cycle == cur_duty_cycle) { - /* Duty cycle does not change, just return */ - return ONLP_STATUS_OK; - } - - return onlp_fani_percentage_set(fan_duty_oid, new_duty_cycle); -} - -int -onlp_sysi_platform_manage_leds(void) -{ - return ONLP_STATUS_E_UNSUPPORTED; -} - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/thermali.c b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/thermali.c deleted file mode 100755 index c3c548cd..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/thermali.c +++ /dev/null @@ -1,174 +0,0 @@ -/************************************************************ - * - * - * Copyright 2014 Big Switch Networks, Inc. - * Copyright 2014 Accton Technology Corporation. - * - * Licensed under the Eclipse Public License, Version 1.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.eclipse.org/legal/epl-v10.html - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - * - * - ************************************************************ - * - * Thermal Sensor Platform Implementation. - * - ***********************************************************/ -//#include -#include -#include -#include "platform_lib.h" - -#define THERMAL_PATH_FORMAT "/sys/bus/i2c/devices/%s/*temp1_input" -#define PSU_THERMAL_PATH_FORMAT "/sys/bus/i2c/devices/%s/*psu_temp1_input" - -#define VALIDATE(_id) \ - do { \ - if(!ONLP_OID_IS_THERMAL(_id)) { \ - return ONLP_STATUS_E_INVALID; \ - } \ - } while(0) - -enum onlp_thermal_id -{ - THERMAL_RESERVED = 0, - THERMAL_CPU_CORE, - THERMAL_1_ON_MAIN_BROAD, - THERMAL_2_ON_MAIN_BROAD, - THERMAL_3_ON_MAIN_BROAD, - THERMAL_4_ON_MAIN_BROAD, - THERMAL_5_ON_MAIN_BROAD, - THERMAL_1_ON_PSU1, - THERMAL_1_ON_PSU2, -}; - -static char* directory[] = /* must map with onlp_thermal_id */ -{ - NULL, - NULL, /* CPU_CORE files */ - "55-0048", - "55-0049", - "55-004a", - "55-004b", - "54-004c", - "50-005b", - "49-0058", -}; - -static char* cpu_coretemp_files[] = - { - "/sys/devices/platform/coretemp.0*temp2_input", - "/sys/devices/platform/coretemp.0*temp3_input", - "/sys/devices/platform/coretemp.0*temp4_input", - "/sys/devices/platform/coretemp.0*temp5_input", - NULL, - }; - -/* Static values */ -static onlp_thermal_info_t linfo[] = { - { }, /* Not used */ - { { ONLP_THERMAL_ID_CREATE(THERMAL_CPU_CORE), "CPU Core", 0}, - ONLP_THERMAL_STATUS_PRESENT, - ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS - }, - { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_MAIN_BROAD), "LM75-1-48", 0}, - ONLP_THERMAL_STATUS_PRESENT, - ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS - }, - { { ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_MAIN_BROAD), "LM75-2-49", 0}, - ONLP_THERMAL_STATUS_PRESENT, - ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS - }, - { { ONLP_THERMAL_ID_CREATE(THERMAL_3_ON_MAIN_BROAD), "LM75-3-4A", 0}, - ONLP_THERMAL_STATUS_PRESENT, - ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS - }, - { { ONLP_THERMAL_ID_CREATE(THERMAL_4_ON_MAIN_BROAD), "LM75-4-4B", 0}, - ONLP_THERMAL_STATUS_PRESENT, - ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS - }, - { { ONLP_THERMAL_ID_CREATE(THERMAL_5_ON_MAIN_BROAD), "LM75-5-4C", 0}, - ONLP_THERMAL_STATUS_PRESENT, - ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS - }, - { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU1), "PSU-1 Thermal Sensor 1", ONLP_PSU_ID_CREATE(PSU1_ID)}, - ONLP_THERMAL_STATUS_PRESENT, - ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS - }, - { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU2), "PSU-2 Thermal Sensor 1", ONLP_PSU_ID_CREATE(PSU2_ID)}, - ONLP_THERMAL_STATUS_PRESENT, - ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS - } -}; - -/* - * This will be called to intiialize the thermali subsystem. - */ -int -onlp_thermali_init(void) -{ - return ONLP_STATUS_OK; -} - -/* - * Retrieve the information structure for the given thermal OID. - * - * If the OID is invalid, return ONLP_E_STATUS_INVALID. - * If an unexpected error occurs, return ONLP_E_STATUS_INTERNAL. - * Otherwise, return ONLP_STATUS_OK with the OID's information. - * - * Note -- it is expected that you fill out the information - * structure even if the sensor described by the OID is not present. - */ -int -onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) -{ - int tid; - char *format = NULL; - char path[64] = {0}; - VALIDATE(id); - - tid = ONLP_OID_ID_GET(id); - - /* Set the onlp_oid_hdr_t and capabilities */ - *info = linfo[tid]; - if(tid == THERMAL_CPU_CORE) { - return onlp_file_read_int_max(&info->mcelsius, cpu_coretemp_files); - } - - switch (tid) { - case THERMAL_1_ON_MAIN_BROAD: - case THERMAL_2_ON_MAIN_BROAD: - case THERMAL_3_ON_MAIN_BROAD: - case THERMAL_4_ON_MAIN_BROAD: - case THERMAL_5_ON_MAIN_BROAD: - format = THERMAL_PATH_FORMAT; - break; - case THERMAL_1_ON_PSU1: - case THERMAL_1_ON_PSU2: - format = PSU_THERMAL_PATH_FORMAT; - break; - default: - return ONLP_STATUS_E_INVALID; - }; - - /* get path */ - sprintf(path, format, directory[tid], tid); - if (onlp_file_read_int(&info->mcelsius, path) < 0) { - AIM_LOG_ERROR("Unable to read status from file (%s)\r\n", path); - return ONLP_STATUS_E_INTERNAL; - } - - return ONLP_STATUS_OK; -} - - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_config.c b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_config.c deleted file mode 100755 index 5f01b6d9..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_config.c +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************//** - * - * - * - *****************************************************************************/ -#include - -/* */ -#define __x86_64_accton_as7726_32x_config_STRINGIFY_NAME(_x) #_x -#define __x86_64_accton_as7726_32x_config_STRINGIFY_VALUE(_x) __x86_64_accton_as7726_32x_config_STRINGIFY_NAME(_x) -x86_64_accton_as7726_32x_config_settings_t x86_64_accton_as7726_32x_config_settings[] = -{ -#ifdef X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_LOGGING - { __x86_64_accton_as7726_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_LOGGING), __x86_64_accton_as7726_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_LOGGING) }, -#else -{ X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_LOGGING(__x86_64_accton_as7726_32x_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef X86_64_ACCTON_AS7726_32X_CONFIG_LOG_OPTIONS_DEFAULT - { __x86_64_accton_as7726_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS7726_32X_CONFIG_LOG_OPTIONS_DEFAULT), __x86_64_accton_as7726_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS7726_32X_CONFIG_LOG_OPTIONS_DEFAULT) }, -#else -{ X86_64_ACCTON_AS7726_32X_CONFIG_LOG_OPTIONS_DEFAULT(__x86_64_accton_as7726_32x_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef X86_64_ACCTON_AS7726_32X_CONFIG_LOG_BITS_DEFAULT - { __x86_64_accton_as7726_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS7726_32X_CONFIG_LOG_BITS_DEFAULT), __x86_64_accton_as7726_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS7726_32X_CONFIG_LOG_BITS_DEFAULT) }, -#else -{ X86_64_ACCTON_AS7726_32X_CONFIG_LOG_BITS_DEFAULT(__x86_64_accton_as7726_32x_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef X86_64_ACCTON_AS7726_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT - { __x86_64_accton_as7726_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS7726_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __x86_64_accton_as7726_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS7726_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, -#else -{ X86_64_ACCTON_AS7726_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__x86_64_accton_as7726_32x_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB - { __x86_64_accton_as7726_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB), __x86_64_accton_as7726_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB) }, -#else -{ X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB(__x86_64_accton_as7726_32x_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS - { __x86_64_accton_as7726_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __x86_64_accton_as7726_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, -#else -{ X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__x86_64_accton_as7726_32x_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_UCLI - { __x86_64_accton_as7726_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_UCLI), __x86_64_accton_as7726_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_UCLI) }, -#else -{ X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_UCLI(__x86_64_accton_as7726_32x_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION - { __x86_64_accton_as7726_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION), __x86_64_accton_as7726_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION) }, -#else -{ X86_64_ACCTON_AS7726_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION(__x86_64_accton_as7726_32x_config_STRINGIFY_NAME), "__undefined__" }, -#endif - { NULL, NULL } -}; -#undef __x86_64_accton_as7726_32x_config_STRINGIFY_VALUE -#undef __x86_64_accton_as7726_32x_config_STRINGIFY_NAME - -const char* -x86_64_accton_as7726_32x_config_lookup(const char* setting) -{ - int i; - for(i = 0; x86_64_accton_as7726_32x_config_settings[i].name; i++) { - if(!strcmp(x86_64_accton_as7726_32x_config_settings[i].name, setting)) { - return x86_64_accton_as7726_32x_config_settings[i].value; - } - } - return NULL; -} - -int -x86_64_accton_as7726_32x_config_show(struct aim_pvs_s* pvs) -{ - int i; - for(i = 0; x86_64_accton_as7726_32x_config_settings[i].name; i++) { - aim_printf(pvs, "%s = %s\n", x86_64_accton_as7726_32x_config_settings[i].name, x86_64_accton_as7726_32x_config_settings[i].value); - } - return i; -} - -/* */ - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_enums.c b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_enums.c deleted file mode 100755 index 3230f78d..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_enums.c +++ /dev/null @@ -1,10 +0,0 @@ -/**************************************************************************//** - * - * - * - *****************************************************************************/ -#include - -/* <--auto.start.enum(ALL).source> */ -/* */ - diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_int.h b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_int.h deleted file mode 100755 index a4568088..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_int.h +++ /dev/null @@ -1,12 +0,0 @@ -/**************************************************************************//** - * - * x86_64_accton_as7726_32x Internal Header - * - *****************************************************************************/ -#ifndef __x86_64_accton_as7726_32x_INT_H__ -#define __x86_64_accton_as7726_32x_INT_H__ - -#include - - -#endif /* __x86_64_accton_as7726_32x_INT_H__ */ diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_log.c b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_log.c deleted file mode 100755 index c2eb34e4..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_log.c +++ /dev/null @@ -1,17 +0,0 @@ -/**************************************************************************//** - * - * - * - *****************************************************************************/ -#include - -#include "x86_64_accton_as7726_32x_log.h" -/* - * x86_64_accton_as7726_32x log struct. - */ -AIM_LOG_STRUCT_DEFINE( - X86_64_ACCTON_AS7726_32X_CONFIG_LOG_OPTIONS_DEFAULT, - X86_64_ACCTON_AS7726_32X_CONFIG_LOG_BITS_DEFAULT, - NULL, /* Custom log map */ - X86_64_ACCTON_AS7726_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT - ); diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_log.h b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_log.h deleted file mode 100755 index ae099f84..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_log.h +++ /dev/null @@ -1,12 +0,0 @@ -/**************************************************************************//** - * - * - * - *****************************************************************************/ -#ifndef __x86_64_accton_as7726_32x_LOG_H__ -#define __x86_64_accton_as7726_32x_LOG_H__ - -#define AIM_LOG_MODULE_NAME x86_64_accton_as7726_32x -#include - -#endif /* __x86_64_accton_as7726_32x_LOG_H__ */ diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_module.c b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_module.c deleted file mode 100755 index 3b434422..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_module.c +++ /dev/null @@ -1,24 +0,0 @@ -/**************************************************************************//** - * - * - * - *****************************************************************************/ -#include - -#include "x86_64_accton_as7726_32x_log.h" - -static int -datatypes_init__(void) -{ -#define x86_64_accton_as7726_32x_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); -#include - return 0; -} - -void __x86_64_accton_as7726_32x_module_init__(void) -{ - AIM_LOG_STRUCT_REGISTER(); - datatypes_init__(); -} - -int __onlp_platform_version__ = 1; diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_ucli.c b/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_ucli.c deleted file mode 100755 index 3786e3e6..00000000 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7726-32x/onlp/builds/src/module/src/x86_64_accton_as7726_32x_ucli.c +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************//** - * - * - * - *****************************************************************************/ -#include - -#if x86_64_accton_as7726_32x_CONFIG_INCLUDE_UCLI == 1 - -#include -#include -#include - -static ucli_status_t -x86_64_accton_as7726_32x_ucli_ucli__config__(ucli_context_t* uc) -{ - UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_accton_as7726_32x) -} - -/* */ -/* */ - -static ucli_module_t -x86_64_accton_as7726_32x_ucli_module__ = - { - "x86_64_accton_as7726_32x_ucli", - NULL, - x86_64_accton_as7726_32x_ucli_ucli_handlers__, - NULL, - NULL, - }; - -ucli_node_t* -x86_64_accton_as7726_32x_ucli_node_create(void) -{ - ucli_node_t* n; - ucli_module_init(&x86_64_accton_as7726_32x_ucli_module__); - n = ucli_node_create("x86_64_accton_as7726_32x", NULL, &x86_64_accton_as7726_32x_ucli_module__); - ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_accton_as7726_32x")); - return n; -} - -#else -void* -x86_64_accton_as7726_32x_ucli_node_create(void) -{ - return NULL; -} -#endif -