diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/.gitignore b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/.gitignore new file mode 100644 index 00000000..212475c8 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/.gitignore @@ -0,0 +1,2 @@ +*x86*64*inventec*d10064*.mk +onlpdump.mk diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/Makefile b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/Makefile new file mode 120000 index 00000000..50dfefab --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/Makefile @@ -0,0 +1 @@ +../x86-64-inventec-d5264q28b/Makefile \ No newline at end of file diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/Makefile b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/Makefile new file mode 120000 index 00000000..ec172d65 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/Makefile @@ -0,0 +1 @@ +../x86-64-inventec-d5264q28b/modules/Makefile \ No newline at end of file diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/PKG.yml b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/PKG.yml new file mode 100644 index 00000000..150f727c --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-modules.yml VENDOR=inventec BASENAME=x86-64-inventec-d10064 ARCH=amd64 KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64" diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/builds/.gitignore b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/builds/.gitignore new file mode 120000 index 00000000..a0579ed2 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/builds/.gitignore @@ -0,0 +1 @@ +../../../x86-64-inventec-d5264q28b/modules/builds/.gitignore \ No newline at end of file diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/builds/Makefile b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/builds/Makefile new file mode 100644 index 00000000..0e7e506b --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/builds/Makefile @@ -0,0 +1,6 @@ +KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64 +KMODULES := src +VENDOR := inventec +BASENAME := x86-64-inventec-d10064 +ARCH := x86_64 +include $(ONL)/make/kmodule.mk diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/builds/src b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/builds/src new file mode 120000 index 00000000..b75cb44c --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/modules/builds/src @@ -0,0 +1 @@ +../../../x86-64-inventec-d5264q28b/modules/builds/src/ \ No newline at end of file diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/Makefile b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/Makefile new file mode 120000 index 00000000..d70323e9 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/Makefile @@ -0,0 +1 @@ +../../x86-64-inventec-d5264q28b/onlp/Makefile \ No newline at end of file diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/PKG.yml b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/PKG.yml new file mode 100644 index 00000000..df0e98bc --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=x86-64-inventec-d10064 ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/Makefile b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/Makefile new file mode 120000 index 00000000..99230419 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/Makefile @@ -0,0 +1 @@ +../../../x86-64-inventec-d5264q28b/onlp/builds/Makefile \ No newline at end of file diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/lib/Makefile b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/lib/Makefile new file mode 100644 index 00000000..f0d6b886 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/lib/Makefile @@ -0,0 +1,45 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# 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 $(ONL)/make/config.amd64.mk + +MODULE := libonlp-x86-64-inventec-d10064 +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF x86_64_inventec_d10064 onlplib +DEPENDMODULE_HEADERS := sff + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := libonlp-x86-64-inventec-d10064.so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk +.DEFAULT_GOAL := $(SHAREDLIB) + +GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/onlpdump/Makefile b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/onlpdump/Makefile new file mode 100644 index 00000000..95d351f0 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/onlpdump/Makefile @@ -0,0 +1,46 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# 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 $(ONL)/make/config.amd64.mk + +.DEFAULT_GOAL := onlpdump + +MODULE := onlpdump +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF onlp x86_64_inventec_d10064 onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS + +include $(BUILDER)/dependmodules.mk + +BINARY := onlpdump +$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS) +include $(BUILDER)/bin.mk + +GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1 +GLOBAL_LINK_LIBS += -lpthread -lm + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/.module b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/.module new file mode 100644 index 00000000..2103b3d9 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/.module @@ -0,0 +1 @@ +name: x86_64_inventec_d10064 diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/Makefile b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/Makefile new file mode 100644 index 00000000..fdfc6566 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### +include ../../init.mk +MODULE := x86_64_inventec_d10064 +AUTOMODULE := x86_64_inventec_d10064 +include $(BUILDER)/definemodule.mk diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/auto/make.mk b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/auto/make.mk new file mode 100644 index 00000000..f2f7d3d9 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/auto/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# x86_64_inventec_d10064 Autogeneration +# +############################################################################### +x86_64_inventec_d10064_AUTO_DEFS := module/auto/x86_64_inventec_d10064.yml +x86_64_inventec_d10064_AUTO_DIRS := module/inc/x86_64_inventec_d10064 module/src +include $(BUILDER)/auto.mk + diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/auto/x86_64_inventec_d10064.yml b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/auto/x86_64_inventec_d10064.yml new file mode 100644 index 00000000..6788797f --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/auto/x86_64_inventec_d10064.yml @@ -0,0 +1,50 @@ +############################################################################### +# +# x86_64_inventec_d10064 Autogeneration Definitions. +# +############################################################################### + +cdefs: &cdefs +- x86_64_inventec_d10064_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- x86_64_inventec_d10064_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- x86_64_inventec_d10064_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- x86_64_inventec_d10064_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- x86_64_inventec_d10064_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- x86_64_inventec_d10064_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: x86_64_inventec_d10064_CONFIG_PORTING_STDLIB +- x86_64_inventec_d10064_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 +- x86_64_inventec_d10064_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION: + doc: "Assume chassis fan direction is the same as the PSU fan direction." + default: 0 + + +definitions: + cdefs: + x86_64_inventec_d10064_CONFIG_HEADER: + defs: *cdefs + basename: x86_64_inventec_d10064_config + + portingmacro: + x86_64_inventec_d10064: + macros: + - malloc + - free + - memset + - memcpy + - strncpy + - vsnprintf + - snprintf + - strlen diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064.x b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064.x new file mode 100644 index 00000000..33ee570e --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064.x @@ -0,0 +1,14 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064_config.h b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064_config.h new file mode 100644 index 00000000..fd72d20f --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064_config.h @@ -0,0 +1,137 @@ +/**************************************************************************//** + * + * @file + * @brief x86_64_inventec_d10064 Configuration Header + * + * @addtogroup x86_64_inventec_d10064-config + * @{ + * + *****************************************************************************/ +#ifndef __x86_64_inventec_d10064_CONFIG_H__ +#define __x86_64_inventec_d10064_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef x86_64_inventec_d10064_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * x86_64_inventec_d10064_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef x86_64_inventec_d10064_CONFIG_INCLUDE_LOGGING +#define x86_64_inventec_d10064_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * x86_64_inventec_d10064_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef x86_64_inventec_d10064_CONFIG_LOG_OPTIONS_DEFAULT +#define x86_64_inventec_d10064_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * x86_64_inventec_d10064_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef x86_64_inventec_d10064_CONFIG_LOG_BITS_DEFAULT +#define x86_64_inventec_d10064_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * x86_64_inventec_d10064_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef x86_64_inventec_d10064_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define x86_64_inventec_d10064_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * x86_64_inventec_d10064_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef x86_64_inventec_d10064_CONFIG_PORTING_STDLIB +#define x86_64_inventec_d10064_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * x86_64_inventec_d10064_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef x86_64_inventec_d10064_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define x86_64_inventec_d10064_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS x86_64_inventec_d10064_CONFIG_PORTING_STDLIB +#endif + +/** + * x86_64_inventec_d10064_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef x86_64_inventec_d10064_CONFIG_INCLUDE_UCLI +#define x86_64_inventec_d10064_CONFIG_INCLUDE_UCLI 0 +#endif + +/** + * x86_64_inventec_d10064_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION + * + * Assume chassis fan direction is the same as the PSU fan direction. */ + + +#ifndef x86_64_inventec_d10064_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION +#define x86_64_inventec_d10064_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION 0 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct x86_64_inventec_d10064_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} x86_64_inventec_d10064_config_settings_t; + +/** Configuration settings table. */ +/** x86_64_inventec_d10064_config_settings table. */ +extern x86_64_inventec_d10064_config_settings_t x86_64_inventec_d10064_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* x86_64_inventec_d10064_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int x86_64_inventec_d10064_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "x86_64_inventec_d10064_porting.h" + +#endif /* __x86_64_inventec_d10064_CONFIG_H__ */ +/* @} */ diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064_dox.h b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064_dox.h new file mode 100644 index 00000000..f70e7aae --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064_dox.h @@ -0,0 +1,26 @@ +/**************************************************************************//** + * + * x86_64_inventec_d10064 Doxygen Header + * + *****************************************************************************/ +#ifndef __x86_64_inventec_d10064_DOX_H__ +#define __x86_64_inventec_d10064_DOX_H__ + +/** + * @defgroup x86_64_inventec_d10064 x86_64_inventec_d10064 - x86_64_inventec_d10064 Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup x86_64_inventec_d10064-x86_64_inventec_d10064 Public Interface + * @defgroup x86_64_inventec_d10064-config Compile Time Configuration + * @defgroup x86_64_inventec_d10064-porting Porting Macros + * + * @} + * + */ + +#endif /* __x86_64_inventec_d10064_DOX_H__ */ diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064_porting.h b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064_porting.h new file mode 100644 index 00000000..5f1fb0b6 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064_porting.h @@ -0,0 +1,107 @@ +/**************************************************************************//** + * + * @file + * @brief x86_64_inventec_d10064 Porting Macros. + * + * @addtogroup x86_64_inventec_d10064-porting + * @{ + * + *****************************************************************************/ +#ifndef __x86_64_inventec_d10064_PORTING_H__ +#define __x86_64_inventec_d10064_PORTING_H__ + + +/* */ +#if x86_64_inventec_d10064_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef x86_64_inventec_d10064_MALLOC + #if defined(GLOBAL_MALLOC) + #define x86_64_inventec_d10064_MALLOC GLOBAL_MALLOC + #elif x86_64_inventec_d10064_CONFIG_PORTING_STDLIB == 1 + #define x86_64_inventec_d10064_MALLOC malloc + #else + #error The macro x86_64_inventec_d10064_MALLOC is required but cannot be defined. + #endif +#endif + +#ifndef x86_64_inventec_d10064_FREE + #if defined(GLOBAL_FREE) + #define x86_64_inventec_d10064_FREE GLOBAL_FREE + #elif x86_64_inventec_d10064_CONFIG_PORTING_STDLIB == 1 + #define x86_64_inventec_d10064_FREE free + #else + #error The macro x86_64_inventec_d10064_FREE is required but cannot be defined. + #endif +#endif + +#ifndef x86_64_inventec_d10064_MEMSET + #if defined(GLOBAL_MEMSET) + #define x86_64_inventec_d10064_MEMSET GLOBAL_MEMSET + #elif x86_64_inventec_d10064_CONFIG_PORTING_STDLIB == 1 + #define x86_64_inventec_d10064_MEMSET memset + #else + #error The macro x86_64_inventec_d10064_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef x86_64_inventec_d10064_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define x86_64_inventec_d10064_MEMCPY GLOBAL_MEMCPY + #elif x86_64_inventec_d10064_CONFIG_PORTING_STDLIB == 1 + #define x86_64_inventec_d10064_MEMCPY memcpy + #else + #error The macro x86_64_inventec_d10064_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef x86_64_inventec_d10064_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define x86_64_inventec_d10064_STRNCPY GLOBAL_STRNCPY + #elif x86_64_inventec_d10064_CONFIG_PORTING_STDLIB == 1 + #define x86_64_inventec_d10064_STRNCPY strncpy + #else + #error The macro x86_64_inventec_d10064_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef x86_64_inventec_d10064_VSNPRINTF + #if defined(GLOBAL_VSNPRINTF) + #define x86_64_inventec_d10064_VSNPRINTF GLOBAL_VSNPRINTF + #elif x86_64_inventec_d10064_CONFIG_PORTING_STDLIB == 1 + #define x86_64_inventec_d10064_VSNPRINTF vsnprintf + #else + #error The macro x86_64_inventec_d10064_VSNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef x86_64_inventec_d10064_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define x86_64_inventec_d10064_SNPRINTF GLOBAL_SNPRINTF + #elif x86_64_inventec_d10064_CONFIG_PORTING_STDLIB == 1 + #define x86_64_inventec_d10064_SNPRINTF snprintf + #else + #error The macro x86_64_inventec_d10064_SNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef x86_64_inventec_d10064_STRLEN + #if defined(GLOBAL_STRLEN) + #define x86_64_inventec_d10064_STRLEN GLOBAL_STRLEN + #elif x86_64_inventec_d10064_CONFIG_PORTING_STDLIB == 1 + #define x86_64_inventec_d10064_STRLEN strlen + #else + #error The macro x86_64_inventec_d10064_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __x86_64_inventec_d10064_PORTING_H__ */ +/* @} */ diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/make.mk b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/make.mk new file mode 100644 index 00000000..3792147e --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/make.mk @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +x86_64_inventec_d10064_INCLUDES := -I $(THIS_DIR)inc +x86_64_inventec_d10064_INTERNAL_INCLUDES := -I $(THIS_DIR)src +x86_64_inventec_d10064_DEPENDMODULE_ENTRIES := init:x86_64_inventec_d10064 ucli:x86_64_inventec_d10064 + diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/Makefile b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/Makefile new file mode 100644 index 00000000..2809ae48 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# Local source generation targets. +# +############################################################################### + +ucli: + @../../../../tools/uclihandlers.py x86_64_inventec_d10064_ucli.c + diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/debug.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/debug.c new file mode 100644 index 00000000..1ead6543 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/debug.c @@ -0,0 +1,45 @@ +#include "x86_64_inventec_d10064_int.h" + +#if x86_64_inventec_d10064_CONFIG_INCLUDE_DEBUG == 1 + +#include + +static char help__[] = + "Usage: debug [options]\n" + " -c CPLD Versions\n" + " -h Help\n" + ; + +int +x86_64_inventec_d10064_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/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/fani.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/fani.c new file mode 100644 index 00000000..bc6a0bbd --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/fani.c @@ -0,0 +1,398 @@ +/************************************************************ + * + * + * 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 +#include +#include +#include +#include "platform_lib.h" + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_FAN(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + + +#define SLOW_PWM 100 +#define NORMAL_PWM 175 +#define MAX_PWM 255 +#define STEP_SIZE 100 +#define FAN_ON_MAIN_BOARD_COUNT 4 +#define LOCAL_ID_TO_PSU_ID(id) (id-FAN_ON_MAIN_BOARD_COUNT) + +#define FAN_CAPS ONLP_FAN_CAPS_GET_RPM|ONLP_FAN_CAPS_GET_PERCENTAGE + +static int _fani_status_failed_check(uint32_t* status, int local_id); +static int _fani_status_present_check(uint32_t* status, int local_id); + +#define MAKE_FAN_INFO_NODE_ON_FAN_BOARD(id) \ + { \ + { \ + ONLP_FAN_ID_CREATE(ONLP_FAN_##id), "Fan "#id, 0, \ + { \ + ONLP_LED_ID_CREATE(ONLP_LED_FAN##id), \ + } \ + }, \ + 0, 0 \ + } + +#define MAKE_FAN_INFO_NODE_ON_PSU(psu_id) \ + { \ + { ONLP_FAN_ID_CREATE(ONLP_FAN_PSU_##psu_id), "PSU-"#psu_id" Fan", ONLP_PSU_ID_CREATE(ONLP_PSU_##psu_id)}, \ + 0, 0 \ + } + + +/* Static values */ +static onlp_fan_info_t __onlp_fan_info[ONLP_FAN_COUNT] = { + MAKE_FAN_INFO_NODE_ON_FAN_BOARD(1), + MAKE_FAN_INFO_NODE_ON_FAN_BOARD(2), + MAKE_FAN_INFO_NODE_ON_FAN_BOARD(3), + MAKE_FAN_INFO_NODE_ON_FAN_BOARD(4), + MAKE_FAN_INFO_NODE_ON_PSU(1), + MAKE_FAN_INFO_NODE_ON_PSU(2), +}; + + +/* + * 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 rv = ONLP_STATUS_OK; + int local_id; + int lrpm, rrpm, pwm, psu_id; + VALIDATE(id); + pwm = 0; + + local_id = ONLP_OID_ID_GET(id); + if(local_id >= ONLP_FAN_MAX) { + rv = ONLP_STATUS_E_INVALID; + } + if(rv ==ONLP_STATUS_OK) { + *info = __onlp_fan_info[LOCAL_ID_TO_INFO_IDX(local_id)]; + rv = onlp_fani_status_get(id, &info->status); + } + + if(rv == ONLP_STATUS_OK) { + if(info->status & ONLP_FAN_STATUS_PRESENT){ + switch(local_id){ + case ONLP_FAN_1: + case ONLP_FAN_2: + case ONLP_FAN_3: + case ONLP_FAN_4: + if(info->status & ONLP_FAN_STATUS_F2B){ + info->caps = FAN_CAPS|ONLP_FAN_CAPS_F2B; + }else if(info->status & ONLP_FAN_STATUS_B2F){ + info->caps = FAN_CAPS|ONLP_FAN_CAPS_B2F; + }else{ + info->caps = FAN_CAPS; + } + + rv = onlp_file_read_int(&lrpm, INV_HWMON_PREFIX"fan%d_input", local_id*2-1); + if(rv != ONLP_STATUS_OK ){ return rv; } + rv = onlp_file_read_int(&rrpm, INV_HWMON_PREFIX"fan%d_input", local_id*2); + if(rv != ONLP_STATUS_OK ){ return rv; } + rv = onlp_file_read_int(&pwm,INV_HWMON_PREFIX"pwm%d", local_id); + if(rv != ONLP_STATUS_OK ){ return rv; } + + if(lrpm <=0 && rrpm <=0){ + info->rpm = 0; + }else if(lrpm <= 0){ + info->rpm = rrpm; + }else if(rrpm <= 0){ + info->rpm = lrpm; + }else{ + info->rpm = (lrpm+rrpm)/2; + } + + break; + case ONLP_FAN_PSU_1: + case ONLP_FAN_PSU_2: + info->caps = FAN_CAPS|ONLP_FAN_CAPS_F2B; + psu_id = LOCAL_ID_TO_PSU_ID(local_id); + rv = onlp_file_read_int(&info->rpm,INV_HWMON_PREFIX"rpm_psu%d", psu_id); + if(rv != ONLP_STATUS_OK) { return rv; } + rv = onlp_file_read_int(&pwm, INV_HWMON_PREFIX"pwm_psu%d", psu_id); + if(rv != ONLP_STATUS_OK) { return rv; } + break; + default: + rv = ONLP_STATUS_E_INVALID; + break; + } + if(rv == ONLP_STATUS_OK) { + if(info->rpm <= 0) { + info->mode = ONLP_FAN_MODE_OFF; + info->percentage = 0; + } else { + info->percentage = (pwm*100)/MAX_PWM; + if(pwm < SLOW_PWM) { + info->mode = ONLP_FAN_MODE_SLOW; + } else if(pwm < NORMAL_PWM) { + info->mode = ONLP_FAN_MODE_NORMAL; + } else if(pwm < MAX_PWM) { + info->mode = ONLP_FAN_MODE_FAST; + } else { + info->mode = ONLP_FAN_MODE_MAX; + } + } + } + }else{ + info->caps = 0; + info->rpm = 0; + info->percentage = 0; + info->mode = ONLP_FAN_MODE_OFF; + } + snprintf(info->model, ONLP_CONFIG_INFO_STR_MAX, "NA"); + snprintf(info->serial, ONLP_CONFIG_INFO_STR_MAX, "NA"); + } + return rv; +} +static int _fani_status_failed_check(uint32_t* status, int local_id) +{ + int rv; + int lrpm, rrpm, rpm, pwm, psu_id; + switch(local_id){ + case ONLP_FAN_1: + case ONLP_FAN_2: + case ONLP_FAN_3: + case ONLP_FAN_4: + rv = onlp_file_read_int(&lrpm, INV_HWMON_PREFIX"fan%d_input", local_id*2-1); + if(rv != ONLP_STATUS_OK ){ return rv; } + rv = onlp_file_read_int(&rrpm, INV_HWMON_PREFIX"fan%d_input", local_id*2); + if(rv != ONLP_STATUS_OK ){ return rv; } + rv = onlp_file_read_int(&pwm,INV_HWMON_PREFIX"pwm%d", local_id); + if(rv != ONLP_STATUS_OK ){ return rv; } + + if( lrpm <= 0 || rrpm <=0 || pwm <=0 || pwm > MAX_PWM){ + *status |= ONLP_FAN_STATUS_FAILED; + *status &= (~ONLP_FAN_STATUS_B2F); + *status &= (~ONLP_FAN_STATUS_F2B); + }else{ + *status &= (~ONLP_FAN_STATUS_FAILED); + } + break; + case ONLP_FAN_PSU_1: + case ONLP_FAN_PSU_2: + psu_id = LOCAL_ID_TO_PSU_ID(local_id); + rv = onlp_file_read_int(&rpm, INV_HWMON_PREFIX"rpm_psu%d", psu_id); + if(rv != ONLP_STATUS_OK ){ return rv; } + rv = onlp_file_read_int(&pwm, INV_HWMON_PREFIX"pwm_psu%d", psu_id); + if(rv != ONLP_STATUS_OK ){ return rv; } + + if( rpm <= 0 || pwm <=0 || pwm > MAX_PWM){ + *status |= ONLP_FAN_STATUS_FAILED; + *status &= (~ONLP_FAN_STATUS_B2F); + *status &= (~ONLP_FAN_STATUS_F2B); + }else{ + *status &= (~ONLP_FAN_STATUS_FAILED); + } + break; + default: + rv = ONLP_STATUS_E_INVALID; + break; + } + return rv; +} + +static int _fani_status_present_check(uint32_t* status, int local_id) +{ + int rv; + int gpi; + int info_idx; + int len; + char buf[ONLP_CONFIG_INFO_STR_MAX]; + info_idx = LOCAL_ID_TO_INFO_IDX(local_id); + rv = onlp_file_read((uint8_t*)buf,ONLP_CONFIG_INFO_STR_MAX, &len, INV_HWMON_PREFIX"fan_gpi"); + if( rv == ONLP_STATUS_OK ){ + sscanf( buf, "0x%x\n", &gpi); + /* B[0-3] installed(0)/uninstalled(1) + B[4-7] FRtype(0)/RFtype(1) */ + if (!((gpi>>info_idx) & 1)){ + *status |= ONLP_FAN_STATUS_PRESENT; + if (!((gpi>>(info_idx+4)) & 1)){ + *status |= ONLP_FAN_STATUS_F2B; + }else{ + *status |= ONLP_FAN_STATUS_B2F; + } + } else { + *status = 0; + } + } + return rv; +} + + +/** + * @brief Retrieve the fan's operational status. + * @param id The fan OID. + * @param rv [out] Receives the fan's operations status flags. + * @notes Only operational state needs to be returned - + * PRESENT/FAILED + */ +int onlp_fani_status_get(onlp_oid_t id, uint32_t* rv) +{ + int result = ONLP_STATUS_OK; + onlp_fan_info_t* info; + int local_id; + VALIDATE(id); + uint32_t psu_status; + + local_id = ONLP_OID_ID_GET(id); + if(local_id >= ONLP_FAN_MAX) { + result = ONLP_STATUS_E_INVALID; + } else { + info = &__onlp_fan_info[LOCAL_ID_TO_INFO_IDX(local_id)]; + switch(local_id){ + case ONLP_FAN_1: + case ONLP_FAN_2: + case ONLP_FAN_3: + case ONLP_FAN_4: + result = _fani_status_present_check(&info->status, local_id); + if (result == ONLP_STATUS_OK ){ + if (info->status & ONLP_FAN_STATUS_PRESENT){ + result = _fani_status_failed_check(&info->status, local_id); + } + } + break; + case ONLP_FAN_PSU_1: + case ONLP_FAN_PSU_2: + result = onlp_psui_status_get((&info->hdr)->poid, &psu_status); + if(result != ONLP_STATUS_OK){ return result; } + + if(psu_status & ONLP_PSU_STATUS_PRESENT){ + info->status |= ONLP_FAN_STATUS_PRESENT; + result = _fani_status_failed_check(&info->status, local_id); + }else{ + info->status = 0; + } + break; + default: + result = ONLP_STATUS_E_INVALID; + break; + } + *rv = info->status; + } + return result; +} + +/** + * @brief Retrieve the fan's OID hdr. + * @param id The fan OID. + * @param rv [out] Receives the OID header. + */ +int onlp_fani_hdr_get(onlp_oid_t id, onlp_oid_hdr_t* hdr) +{ + int result = ONLP_STATUS_OK; + onlp_fan_info_t* info; + int local_id; + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + if(local_id >= ONLP_FAN_MAX) { + result = ONLP_STATUS_E_INVALID; + } else { + info = &__onlp_fan_info[LOCAL_ID_TO_INFO_IDX(local_id)]; + *hdr = info->hdr; + } + return result; +} + + +/* + * 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) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + +/* + * 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/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/ledi.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/ledi.c new file mode 100644 index 00000000..bda4629c --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/ledi.c @@ -0,0 +1,441 @@ +/************************************************************ + * + * + * 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 "platform_lib.h" + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_LED(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +/* LED related data + */ + +/* CAPS*/ +#define SYS_LED_CAPS ONLP_LED_CAPS_ON_OFF|ONLP_LED_CAPS_GREEN|ONLP_LED_CAPS_GREEN_BLINKING|ONLP_LED_CAPS_RED|ONLP_LED_CAPS_RED_BLINKING +#define FAN_LED_CAPS ONLP_LED_CAPS_RED|ONLP_LED_CAPS_GREEN + +#define LOCAL_ID_TO_FAN_ID(id) (id-1) + +typedef enum sys_led_mode_e { + SYS_LED_MODE_OFF = 0, + SYS_LED_MODE_0_5_HZ = 1, + SYS_LED_MODE_1_HZ = 2, + SYS_LED_MODE_2_HZ = 3, + SYS_LED_MODE_ON = 7 +} sys_led_mode_t; + +/* function declarations*/ +static int _sys_onlp_led_mode_convert(sys_led_mode_t grn_mode, sys_led_mode_t red_mode, onlp_led_mode_t* pmode); +static int _sys_onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info); +static int _fan_onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info); +static int _sys_onlp_ledi_mode_set(onlp_led_mode_t onlp_mode); + +/* + * Get the information for the given LED OID. + */ +#define MAKE_MGMT_LED_INFO_NODE \ + { \ + { ONLP_LED_ID_CREATE(ONLP_LED_MGMT), "MGMT LED" , 0 }, \ + ONLP_LED_STATUS_PRESENT, \ + SYS_LED_CAPS, \ + } + +#define MAKE_LED_INFO_NODE_ON_FAN(fan_id) \ + { \ + { ONLP_LED_ID_CREATE(ONLP_LED_FAN##fan_id), \ + "FAN LED "#fan_id, \ + ONLP_FAN_ID_CREATE(ONLP_FAN_##fan_id) \ + }, \ + 0, \ + 0, \ + } + +static onlp_led_info_t __onlp_led_info[ONLP_LED_COUNT] = { + MAKE_MGMT_LED_INFO_NODE, + MAKE_LED_INFO_NODE_ON_FAN(1), + MAKE_LED_INFO_NODE_ON_FAN(2), + MAKE_LED_INFO_NODE_ON_FAN(3), + MAKE_LED_INFO_NODE_ON_FAN(4), +}; + + + +/* convert platform led type to onlp_led_mode type*/ +static int _sys_onlp_led_mode_convert(sys_led_mode_t grn_mode, sys_led_mode_t red_mode, onlp_led_mode_t* pmode) +{ + int rv = ONLP_STATUS_OK; + *pmode = ONLP_LED_MODE_OFF; + + switch(grn_mode) { + case SYS_LED_MODE_0_5_HZ: + case SYS_LED_MODE_1_HZ: + case SYS_LED_MODE_2_HZ: + *pmode = ONLP_LED_MODE_GREEN_BLINKING; + break; + case SYS_LED_MODE_ON: + *pmode = ONLP_LED_MODE_GREEN; + break; + case SYS_LED_MODE_OFF: + *pmode = ONLP_LED_MODE_OFF; + break; + default: + return ONLP_STATUS_E_INVALID; + break; + } + switch(red_mode) { + case SYS_LED_MODE_0_5_HZ: + case SYS_LED_MODE_1_HZ: + case SYS_LED_MODE_2_HZ: + if(grn_mode == SYS_LED_MODE_OFF){ + *pmode = ONLP_LED_MODE_RED_BLINKING; + }else{ + return ONLP_STATUS_E_INVALID; + } + break; + case SYS_LED_MODE_ON: + if(grn_mode == SYS_LED_MODE_OFF){ + *pmode = ONLP_LED_MODE_RED; + }else{ + return ONLP_STATUS_E_INVALID; + } + break; + case SYS_LED_MODE_OFF: + if(grn_mode == SYS_LED_MODE_OFF){ + *pmode = ONLP_LED_MODE_OFF; + } + break; + default: + return ONLP_STATUS_E_INVALID; + break; + } + return rv; +} + + +static int _sys_onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) +{ + int local_id; + int rv = ONLP_STATUS_OK; + sys_led_mode_t grn_mode, red_mode; + local_id = ONLP_OID_ID_GET(id); + int idx = LOCAL_ID_TO_INFO_IDX(local_id); + /* Set the onlp_oid_hdr_t and capabilities */ + *info = __onlp_led_info[idx]; + + rv = onlp_file_read_int((int*)&grn_mode, INV_SYSLED_PREFIX"grn_led"); + if(rv != ONLP_STATUS_OK){ return rv; } + rv = onlp_file_read_int((int*)&red_mode, INV_SYSLED_PREFIX"red_led"); + if(rv != ONLP_STATUS_OK){ return rv; } + + rv = _sys_onlp_led_mode_convert(grn_mode, red_mode, &info->mode); + if(rv != ONLP_STATUS_OK){ return rv; } + + /* Set the on/off status */ + if (info->mode != ONLP_LED_MODE_OFF) { + info->status |= ONLP_LED_STATUS_ON; + } else { + info->status &= (~ONLP_LED_STATUS_ON); + } + + + return rv; +} + +static int _fan_onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) +{ + int local_id; + int rv = ONLP_STATUS_OK; + int grn_mode, red_mode; + + local_id = ONLP_OID_ID_GET(id); + int fan_id = LOCAL_ID_TO_FAN_ID(local_id); + int idx = LOCAL_ID_TO_INFO_IDX(local_id); + /* Set the onlp_oid_hdr_t and capabilities */ + *info = __onlp_led_info[idx]; + + rv = onlp_ledi_status_get(id, &info->status); + if( rv != ONLP_STATUS_OK ){ return rv; } + + if( info->status & ONLP_LED_STATUS_PRESENT){ + info->caps = FAN_LED_CAPS; + rv = onlp_file_read_int((int*)&grn_mode, INV_HWMON_PREFIX"fan_led_grn%d", fan_id); + if(rv != ONLP_STATUS_OK ){ return rv; } + rv = onlp_file_read_int((int*)&red_mode, INV_HWMON_PREFIX"fan_led_red%d", fan_id); + if(rv != ONLP_STATUS_OK ){ return rv; } + + if(grn_mode == 1 && red_mode == 0){ + info->mode = ONLP_LED_MODE_GREEN; + }else if(grn_mode == 0 && red_mode == 1){ + info->mode = ONLP_LED_MODE_RED; + }else if(grn_mode == 0 && red_mode == 0){ + info->mode = ONLP_LED_MODE_OFF; + }else{ + rv = ONLP_STATUS_E_INVALID; + } + }else{ + info->mode = ONLP_LED_MODE_OFF; + } + return rv; +} + +static int _sys_onlp_ledi_mode_set(onlp_led_mode_t onlp_mode) +{ + int rv = ONLP_STATUS_OK; + + if( onlp_mode == ONLP_LED_MODE_OFF){ + rv = onlp_file_write_int(SYS_LED_MODE_OFF, INV_SYSLED_PREFIX"grn_led"); + if(rv != ONLP_STATUS_OK ){ return rv; } + rv = onlp_file_write_int(SYS_LED_MODE_OFF, INV_SYSLED_PREFIX"red_led"); + }else{ + rv = ONLP_STATUS_E_UNSUPPORTED; + } + return rv; +} + + + +/* + * This function will be called prior to any other onlp_ledi_* functions. + */ +int +onlp_ledi_init(void) +{ + return ONLP_STATUS_OK; +} + +int +onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) +{ + int rv = ONLP_STATUS_OK; + VALIDATE(id); + int local_id; + local_id = ONLP_OID_ID_GET(id); + if(local_id >= ONLP_LED_MAX) { + return ONLP_STATUS_E_INVALID; + } + + switch(local_id) { + case ONLP_LED_MGMT: + rv = _sys_onlp_ledi_info_get(id, info); + break; + case ONLP_LED_FAN1: + case ONLP_LED_FAN2: + case ONLP_LED_FAN3: + case ONLP_LED_FAN4: + rv = _fan_onlp_ledi_info_get(id, info); + break; + default: + rv = ONLP_STATUS_E_INVALID; + break; + } + return rv; +} + +/** + * @brief Get the LED operational status. + * @param id The LED OID + * @param rv [out] Receives the operational status. + */ +int onlp_ledi_status_get(onlp_oid_t id, uint32_t* rv) +{ + int result = ONLP_STATUS_OK; + onlp_led_info_t* info; + + VALIDATE(id); + int local_id = ONLP_OID_ID_GET(id); + int info_idx = LOCAL_ID_TO_INFO_IDX(local_id); + int fan_id = LOCAL_ID_TO_FAN_ID(local_id); + int mode, grn_mode, red_mode; + onlp_led_mode_t pmode; + uint32_t fan_status; + + if(local_id >= ONLP_LED_MAX) { + result = ONLP_STATUS_E_INVALID; + } + if(result == ONLP_STATUS_OK) { + info = &__onlp_led_info[info_idx]; + switch(local_id) { + case ONLP_LED_MGMT: + result = onlp_file_read_int((int*)&grn_mode, INV_SYSLED_PREFIX"grn_led"); + if(result != ONLP_STATUS_OK){ return result; } + result = onlp_file_read_int((int*)&red_mode, INV_SYSLED_PREFIX"red_led"); + if(result != ONLP_STATUS_OK){ return result; } + + result = _sys_onlp_led_mode_convert(grn_mode, red_mode, &pmode); + if(result != ONLP_STATUS_OK){ return result; } + + if( pmode != ONLP_LED_MODE_OFF){ + info->status |= ONLP_LED_STATUS_ON; + }else{ + info->status &= (~ONLP_LED_STATUS_ON); + } + + *rv = info->status; + break; + case ONLP_LED_FAN1: + case ONLP_LED_FAN2: + case ONLP_LED_FAN3: + case ONLP_LED_FAN4: + result = onlp_fani_status_get((&info->hdr)->poid, &fan_status); + if(result != ONLP_STATUS_OK){ return result; } + + if(fan_status & ONLP_FAN_STATUS_PRESENT){ + info->status |= ONLP_LED_STATUS_PRESENT; + info->status &= (~ONLP_LED_STATUS_ON); + + result = onlp_file_read_int((int*)&mode, INV_HWMON_PREFIX"fan_led_grn%d", fan_id); + if(result != ONLP_STATUS_OK){ return result; } + if(mode){ + info->status |= ONLP_LED_STATUS_ON; + } + + result = onlp_file_read_int((int*)&mode, INV_HWMON_PREFIX"fan_led_red%d", fan_id); + if(result != ONLP_STATUS_OK){ return result; } + if(mode){ + info->status |= ONLP_LED_STATUS_ON; + } + } else { + info->status = 0; + } + *rv = info->status; + break; + default: + result = ONLP_STATUS_E_INVALID; + break; + } + } + + return result; +} + +/** + * @brief Get the LED header. + * @param id The LED OID + * @param rv [out] Receives the header. + */ +int onlp_ledi_hdr_get(onlp_oid_t id, onlp_oid_hdr_t* rv) +{ + int result = ONLP_STATUS_OK; + onlp_led_info_t* info; + + VALIDATE(id); + + int local_id; + local_id = ONLP_OID_ID_GET(id); + int idx = LOCAL_ID_TO_INFO_IDX(local_id); + if(local_id >= ONLP_LED_MAX) { + result = ONLP_STATUS_E_INVALID; + } else { + info = &__onlp_led_info[idx]; + *rv = info->hdr; + } + return result; +} + +/* + * 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) +{ + onlp_led_mode_t mode; + VALIDATE(id); + int local_id; + local_id = ONLP_OID_ID_GET(id); + int idx = LOCAL_ID_TO_INFO_IDX(local_id); + + if(local_id >= ONLP_LED_MAX) { + return ONLP_STATUS_E_INVALID; + } + + if (__onlp_led_info[idx].caps & ONLP_LED_CAPS_ON_OFF) { + mode = on_or_off?ONLP_LED_MODE_ON:ONLP_LED_MODE_OFF; + return onlp_ledi_mode_set(id, mode); + } + + 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 rv = ONLP_STATUS_OK; + VALIDATE(id); + int local_id; + local_id = ONLP_OID_ID_GET(id); + + if(local_id >= ONLP_LED_MAX) { + return ONLP_STATUS_E_INVALID; + } + switch(local_id) { + case ONLP_LED_MGMT: + rv = _sys_onlp_ledi_mode_set(mode); + break; + case ONLP_LED_FAN1: + case ONLP_LED_FAN2: + case ONLP_LED_FAN3: + case ONLP_LED_FAN4: + rv = ONLP_STATUS_E_UNSUPPORTED; + break; + default: + rv = ONLP_STATUS_E_INVALID; + break; + } + + return rv; +} + +/* + * 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/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/make.mk b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/make.mk new file mode 100644 index 00000000..9f3ff1eb --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### + +LIBRARY := x86_64_inventec_d10064 +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/platform_lib.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/platform_lib.c new file mode 100644 index 00000000..bb04678b --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/platform_lib.c @@ -0,0 +1,50 @@ +/************************************************************ + * + * + * 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" + + +int platform_hwmon_diag_enable_read(int *enable) +{ + int rv = ONLP_STATUS_OK; + rv = onlp_file_read_int((int*)enable, INV_HWMON_PREFIX"diag"); + return rv; +} + + +int platform_hwmon_diag_enable_write(int enable) +{ + int rv = ONLP_STATUS_OK; + rv = onlp_file_write_int(enable, INV_HWMON_PREFIX"diag"); + return rv; +} diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/platform_lib.h b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/platform_lib.h new file mode 100644 index 00000000..003589d5 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/platform_lib.h @@ -0,0 +1,141 @@ +/************************************************************ + * + * + * 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 "x86_64_inventec_d10064_log.h" + +/* This is definitions for x86-64-inventec-d10064*/ +/* OID map*/ +/* + * SYS---------ONLP_THERMAL_CPU_PHY + * |----ONLP_THERMAL_CPU_CORE0 + * |----ONLP_THERMAL_CPU_CORE1 + * |----ONLP_THERMAL_CPU_CORE2 + * |----ONLP_THERMAL_CPU_CORE3 + * |----ONLP_THERMAL_1_ON_MAIN_BROAD + * |----ONLP_THERMAL_2_ON_MAIN_BROAD + * |----ONLP_THERMAL_3_ON_MAIN_BROAD + * |----ONLP_THERMAL_4_ON_MAIN_BROAD + * |----ONLP_THERMAL_5_ON_MAIN_BROAD + * |----ONLP_FAN_1--------ONLP_LED_FAN1 + * | + * |----ONLP_FAN_2--------ONLP_LED_FAN2 + * | + * |----ONLP_FAN_3--------ONLP_LED_FAN3 + * | + * |----ONLP_FAN_4--------ONLP_LED_FAN4 + * | + * |----ONLP_PSU_1--------ONLP_THERMAL_1_ON_PSU1 + * | |--ONLP_THERMAL_2_ON_PSU1 + * | |--ONLP_FAN_PSU_1 + * | + * |----ONLP_PSU_2--------ONLP_THERMAL_1_ON_PSU2 + * | |--ONLP_THERMAL_2_ON_PSU2 + * | |--ONLP_FAN_PSU_2 + * | + * |----ONLP_LED_MGMT + */ + +#define INV_SYSLED_PREFIX "/sys/class/hwmon/hwmon2/device/" +#define INV_HWMON_PREFIX "/sys/class/hwmon/hwmon1/device/" +#define INV_CTMP_PREFIX "/sys/class/hwmon/hwmon0/" +#define INV_SFP_PREFIX "/sys/class/swps/" +#define INV_SYS_PREFIX "/sys/class/eeprom/vpd/" + +#define OID_MAP_TO_INFO_IDX(oid) ONLP_OID_ID_GET(oid)-1 +#define LOCAL_ID_TO_INFO_IDX(id) (id-1) + +/* Thermal definitions*/ +enum onlp_thermal_id { + ONLP_THERMAL_CPU_PHY = 1, + ONLP_THERMAL_CPU_CORE0, + ONLP_THERMAL_CPU_CORE1, + ONLP_THERMAL_CPU_CORE2, + ONLP_THERMAL_CPU_CORE3, + ONLP_THERMAL_1_ON_MAIN_BROAD, + ONLP_THERMAL_2_ON_MAIN_BROAD, + ONLP_THERMAL_3_ON_MAIN_BROAD, + ONLP_THERMAL_4_ON_MAIN_BROAD, + ONLP_THERMAL_5_ON_MAIN_BROAD, + ONLP_THERMAL_1_ON_PSU1, + ONLP_THERMAL_2_ON_PSU1, + ONLP_THERMAL_1_ON_PSU2, + ONLP_THERMAL_2_ON_PSU2, + ONLP_THERMAL_MAX +}; + +#define ONLP_THERMAL_COUNT 14 /*include "reserved"*/ +#define THERMAL_ON_CHASSIS 10 + +/* Fan definitions*/ +enum onlp_fan_id { + ONLP_FAN_1 = 1, + ONLP_FAN_2, + ONLP_FAN_3, + ONLP_FAN_4, + ONLP_FAN_PSU_1, + ONLP_FAN_PSU_2, + ONLP_FAN_MAX +}; + +#define ONLP_FAN_COUNT 6 /*include "reserved"*/ +#define FAN_ON_CHASSIS 4 + +/* PSU definitions*/ +enum onlp_psu_id { + ONLP_PSU_1 = 1, + ONLP_PSU_2, + ONLP_PSU_MAX +}; + +#define ONLP_PSU_COUNT 2 /*include "reserved"*/ +#define PSU_ON_CHASSIS 2 + +/* LED definitions*/ +enum onlp_led_id { + ONLP_LED_MGMT = 1, + ONLP_LED_FAN1, + ONLP_LED_FAN2, + ONLP_LED_FAN3, + ONLP_LED_FAN4, + ONLP_LED_MAX +}; + +#define ONLP_LED_COUNT 5 /*include "reserved"*/ +#define LED_ON_CHASSIS 1 + +/* platform functions*/ +#define PLATFORM_HWMON_DIAG_LOCK platform_hwmon_diag_enable_write(0) +#define PLATFORM_HWMON_DIAG_UNLOCK platform_hwmon_diag_enable_write(1) +int platform_hwmon_diag_enable_read(int *enable); +int platform_hwmon_diag_enable_write(int enable); + + + + +#endif /* __PLATFORM_LIB_H__ */ + diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/psui.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/psui.c new file mode 120000 index 00000000..a822b389 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/psui.c @@ -0,0 +1 @@ +../../../../../../x86-64-inventec-d5264q28b/onlp/builds/src/module/src/psui.c \ No newline at end of file diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/sfpi.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/sfpi.c new file mode 120000 index 00000000..95b5445a --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/sfpi.c @@ -0,0 +1 @@ +../../../../../../x86-64-inventec-d5264q28b/onlp/builds/src/module/src/sfpi.c \ No newline at end of file diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/sysi.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/sysi.c new file mode 100644 index 00000000..09348aeb --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/sysi.c @@ -0,0 +1,426 @@ +/************************************************************ + * + * + * 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 +#include +#include + +#include "x86_64_inventec_d10064_int.h" +#include "x86_64_inventec_d10064_log.h" + +#include "platform_lib.h" + +#define SYSI_ONIE_TYPE_SUPPORT_NUM 17 +#define SYSI_PLATFORM_INFO_TYPE_STR_MAX 10 +#define SYSI_PLATFORM_INFO_NUM 2 + +/** + * The TLV Types. + */ +#define TLV_CODE_PRODUCT_NAME 0x21 +#define TLV_CODE_PART_NUMBER 0x22 +#define TLV_CODE_SERIAL_NUMBER 0x23 +#define TLV_CODE_MAC_BASE 0x24 +#define TLV_CODE_MANUF_DATE 0x25 +#define TLV_CODE_DEVICE_VERSION 0x26 +#define TLV_CODE_LABEL_REVISION 0x27 +#define TLV_CODE_PLATFORM_NAME 0x28 +#define TLV_CODE_ONIE_VERSION 0x29 +#define TLV_CODE_MAC_SIZE 0x2A +#define TLV_CODE_MANUF_NAME 0x2B +#define TLV_CODE_MANUF_COUNTRY 0x2C +#define TLV_CODE_VENDOR_NAME 0x2D +#define TLV_CODE_DIAG_VERSION 0x2E +#define TLV_CODE_SERVICE_TAG 0x2F +#define TLV_CODE_VENDOR_EXT 0xFD +#define TLV_CODE_CRC_32 0xFE + +static uint8_t __tlv_code_list[SYSI_ONIE_TYPE_SUPPORT_NUM] = { + TLV_CODE_PRODUCT_NAME, + TLV_CODE_PART_NUMBER, + TLV_CODE_SERIAL_NUMBER, + TLV_CODE_MAC_BASE, + TLV_CODE_MANUF_DATE, + TLV_CODE_DEVICE_VERSION, + TLV_CODE_LABEL_REVISION, + TLV_CODE_PLATFORM_NAME, + TLV_CODE_ONIE_VERSION, + TLV_CODE_MAC_SIZE, + TLV_CODE_MANUF_NAME, + TLV_CODE_MANUF_COUNTRY, + TLV_CODE_VENDOR_NAME, + TLV_CODE_DIAG_VERSION, + TLV_CODE_SERVICE_TAG, + TLV_CODE_VENDOR_EXT, + TLV_CODE_CRC_32 +}; + + +static int _sysi_version_parsing(char* file_str, char* str_buf, char* version); +static void _case_tlv_code_string(onlp_onie_info_t* info, char** member, char* path); +static int _parse_tlv(onlp_onie_info_t* info, uint8_t type); + +static int _sysi_version_parsing(char* file_str, char* str_buf, char* version) +{ + int rv = ONLP_STATUS_OK; + int len; + char buf[ONLP_CONFIG_INFO_STR_MAX*4]; + char *temp; + + rv = onlp_file_read((uint8_t*)buf,ONLP_CONFIG_INFO_STR_MAX*4, &len, file_str); + if( rv != ONLP_STATUS_OK ) { return rv; } + + temp = strstr(buf, str_buf); + if(temp) { + temp += strlen(str_buf); + snprintf(version,ONLP_CONFIG_INFO_STR_MAX, temp); + /*remove '\n'*/ + version[strlen(version)-1] = '\0'; + } else { + rv = ONLP_STATUS_E_MISSING; + } + return rv; +} + +static void _case_tlv_code_string(onlp_onie_info_t* info, char** member, char* path) +{ + int rv = ONLP_STATUS_OK; + int len; + char buf[ONLP_CONFIG_INFO_STR_MAX]; + rv = onlp_file_read((uint8_t*)buf,ONLP_CONFIG_INFO_STR_MAX, &len, path); + if( rv == ONLP_STATUS_OK ) { + info->_hdr_length += 2; + buf[strlen(buf)-1] = '\0'; + *member = aim_fstrdup("%s",buf); + info->_hdr_length += strlen(*member); + } else { + *member = aim_zmalloc(1); + rv = ONLP_STATUS_OK; + } + return; +} + + +static int _parse_tlv(onlp_onie_info_t* info, uint8_t type) +{ + int rv = ONLP_STATUS_OK; + int len; + char buf[ONLP_CONFIG_INFO_STR_MAX]; + switch(type) + { + case TLV_CODE_PRODUCT_NAME: + _case_tlv_code_string(info, &(info->product_name), INV_SYS_PREFIX"product_name"); + break; + case TLV_CODE_PART_NUMBER: + _case_tlv_code_string(info, &(info->part_number), INV_SYS_PREFIX"pn"); + break; + case TLV_CODE_SERIAL_NUMBER: + _case_tlv_code_string(info, &(info->serial_number), INV_SYS_PREFIX"sn"); + break; + case TLV_CODE_MANUF_DATE: + _case_tlv_code_string(info, &(info->manufacture_date), INV_SYS_PREFIX"man_date"); + break; + case TLV_CODE_LABEL_REVISION: + _case_tlv_code_string(info, &(info->label_revision), INV_SYS_PREFIX"label_rev"); + break; + case TLV_CODE_PLATFORM_NAME: + _case_tlv_code_string(info, &(info->platform_name), INV_SYS_PREFIX"plat_name"); + break; + case TLV_CODE_ONIE_VERSION: + _case_tlv_code_string(info, &(info->onie_version), INV_SYS_PREFIX"ldr_ver"); + break; + case TLV_CODE_MANUF_NAME: + _case_tlv_code_string(info, &(info->manufacturer), INV_SYS_PREFIX"manufacturer"); + break; + case TLV_CODE_MANUF_COUNTRY: + _case_tlv_code_string(info, &(info->country_code), INV_SYS_PREFIX"country_code"); + break; + case TLV_CODE_VENDOR_NAME: + _case_tlv_code_string(info, &(info->vendor), INV_SYS_PREFIX"vendor_name"); + break; + case TLV_CODE_SERVICE_TAG: + _case_tlv_code_string(info, &(info->service_tag), INV_SYS_PREFIX"service_tag"); + break; + case TLV_CODE_DIAG_VERSION: + _case_tlv_code_string(info, &(info->diag_version), INV_SYS_PREFIX"diag_ver"); + break; + + case TLV_CODE_MAC_BASE: + rv = onlp_file_read((uint8_t*)buf,ONLP_CONFIG_INFO_STR_MAX, &len, INV_SYS_PREFIX"base_mac_addr" ); + if( rv == ONLP_STATUS_OK ) { + if(sscanf( buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx\n", + &info->mac[0], &info->mac[1], &info->mac[2], + &info->mac[3], &info->mac[4], &info->mac[5]) == 6) { + info->_hdr_length += 2; + info->_hdr_length += 6; + } else { + /*parsing fail*/ + memset(info->mac, 0, 6); + } + } else { + memset(info->mac, 0, 6); + rv = ONLP_STATUS_OK; + } + break; + + case TLV_CODE_DEVICE_VERSION: + rv = onlp_file_read((uint8_t*)buf,ONLP_CONFIG_INFO_STR_MAX, &len, INV_SYS_PREFIX"dev_ver"); + if( rv == ONLP_STATUS_OK ) { + info->_hdr_length += 2; + info->device_version= (uint8_t)strtoul(buf, NULL, 0); + info->_hdr_length += 1; + }else{ + info->device_version = 0; + rv = ONLP_STATUS_OK; + } + break; + case TLV_CODE_MAC_SIZE: + rv = onlp_file_read((uint8_t*)buf,ONLP_CONFIG_INFO_STR_MAX, &len, INV_SYS_PREFIX"mac_addr"); + if( rv == ONLP_STATUS_OK ) { + info->_hdr_length += 2; + info->mac_range = (uint16_t)strtoul(buf, NULL, 0); + info->_hdr_length += 2; + }else{ + info->mac_range = 0; + rv = ONLP_STATUS_OK; + } + break; + + case TLV_CODE_VENDOR_EXT: + list_init(&info->vx_list); + rv = onlp_file_read((uint8_t*)buf,ONLP_CONFIG_INFO_STR_MAX, &len, INV_SYS_PREFIX"vendor_ext"); + if( rv == ONLP_STATUS_OK ) { + /*TODO*/ + } + rv = ONLP_STATUS_OK; + break; + + case TLV_CODE_CRC_32: + rv = onlp_file_read((uint8_t*)buf,ONLP_CONFIG_INFO_STR_MAX, &len, INV_SYS_PREFIX"crc32"); + if( rv == ONLP_STATUS_OK ) { + info->_hdr_length += 2; + info->crc = (uint32_t)strtoul(buf, NULL, 0); + info->_hdr_length += 4; + }else{ + info->crc = 0; + rv = ONLP_STATUS_OK; + } + break; + + default: + break; + } + return rv; +} + + +const char* +onlp_sysi_platform_get(void) +{ + return "x86-64-inventec-d10064-r0"; +} + + +/* + * This function is called to return the physical base address + * of the ONIE boot rom. + * + * The ONLP framework will mmap() and parse the ONIE TLV structure + * from the given data. + * + * If you platform does not support a mappable address for the ONIE + * eeprom then you should not provide this function at all. + * + * For the purposes of this example we will provide it but + * return UNSUPPORTED (which is all the default implementation does). + * + */ +int +onlp_sysi_onie_data_phys_addr_get(void** pa) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + +/* + * If you cannot provide a base address you must provide the ONLP + * framework the raw ONIE data through whatever means necessary. + * + * This function will be called as a backup in the event that + * onlp_sysi_onie_data_phys_addr_get() fails. + */ +int +onlp_sysi_onie_data_get(uint8_t** data, int* size) +{ +#if 0 + int rv; + int i; + + /* + * This represents the example ONIE data. + */ + static uint8_t onie_data[] = { + 'T', 'l', 'v','I','n','f','o', 0, + 0x1, 0x0, 0x0, + 0x21, 0x8, 'O', 'N', 'L', 'P', 'I', 'E', 0, 0, + 0x22, 0x3, 'O', 'N', 'L', + 0xFE, 0x4, 0x4b, 0x1b, 0x1d, 0xde, + }; + + + memcpy(*data, onie_data, ONLPLIB_CONFIG_I2C_BLOCK_SIZE); + return 0; +#endif + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * IF the ONLP frame calles onlp_sysi_onie_data_get(), + * if will call this function to free the data when it + * is finished with it. + * + * This function is optional, and depends on the data + * you return in onlp_sysi_onie_data_get(). + */ +void +onlp_sysi_onie_data_free(uint8_t* data) +{ + /* + * We returned a static array in onlp_sysi_onie_data_get() + * so no free operation is required. + */ + if(data) { + aim_free(data); + } +} + + +int +onlp_sysi_onie_info_get (onlp_onie_info_t *onie) +{ + int rv = ONLP_STATUS_OK; + int i; + onie->_hdr_length = 0; + for(i = 0; i < SYSI_ONIE_TYPE_SUPPORT_NUM; i++) + { + if( rv != ONLP_STATUS_OK ) { return rv; } + rv = _parse_tlv(onie, (__tlv_code_list[i])); + + } + + onie->_hdr_id_string = aim_fstrdup("TlvInfo"); + onie->_hdr_version = 0x1; + return rv; +} + + +int +onlp_sysi_platform_info_get(onlp_platform_info_t* pi) +{ + int rv = ONLP_STATUS_OK; + char cpld_str[ONLP_CONFIG_INFO_STR_MAX]= {0}; + char other_str[ONLP_CONFIG_INFO_STR_MAX]= {0}; + char version[ONLP_CONFIG_INFO_STR_MAX]; + + rv = _sysi_version_parsing(INV_SYSLED_PREFIX"info", "The CPLD version is ", version); + if( rv != ONLP_STATUS_OK ) { return rv; } + snprintf(cpld_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s ", cpld_str, version); + rv = _sysi_version_parsing(INV_HWMON_PREFIX"version", "ver: ", version); + if( rv != ONLP_STATUS_OK ) { return rv; } + snprintf(other_str, ONLP_CONFIG_INFO_STR_MAX, "%s%s.%s " + ,other_str, "psoc", version); + + /*cpld version*/ + if(strlen(cpld_str) > 0) { + pi->cpld_versions = aim_fstrdup("%s",cpld_str); + } + + /*other version*/ + if(strlen(other_str) > 0) { + pi->other_versions = aim_fstrdup("%s",other_str); + } + return rv; +} + +void +onlp_sysi_platform_info_free(onlp_platform_info_t* pi) +{ + if(pi->cpld_versions) { + aim_free(pi->cpld_versions); + } + if(pi->other_versions) { + aim_free(pi->other_versions); + } + return; +} + + +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)); + + for(i=1;i<=THERMAL_ON_CHASSIS; i++){ + *e++ = ONLP_THERMAL_ID_CREATE(i); + } + for(i=1; i<=FAN_ON_CHASSIS; i++){ + *e++ = ONLP_FAN_ID_CREATE(i); + } + for(i=1; i<=PSU_ON_CHASSIS; i++){ + *e++ = ONLP_PSU_ID_CREATE(i); + } + for(i=1; i<=LED_ON_CHASSIS; i++){ + *e++ = ONLP_LED_ID_CREATE(i); + } + return ONLP_STATUS_OK; +} + +int +onlp_sysi_platform_manage_fans(void) +{ + /*Ensure switch manager is working*/ + PLATFORM_HWMON_DIAG_LOCK; + return ONLP_STATUS_OK; +} + +int +onlp_sysi_platform_manage_leds(void) +{ + /*Ensure switch manager is working*/ + PLATFORM_HWMON_DIAG_LOCK; + return ONLP_STATUS_OK; +} + diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/thermali.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/thermali.c new file mode 120000 index 00000000..01d2126a --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/thermali.c @@ -0,0 +1 @@ +../../../../../../x86-64-inventec-d5264q28b/onlp/builds/src/module/src/thermali.c \ No newline at end of file diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_config.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_config.c new file mode 100644 index 00000000..a5d88764 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_config.c @@ -0,0 +1,81 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* */ +#define __x86_64_inventec_d10064_config_STRINGIFY_NAME(_x) #_x +#define __x86_64_inventec_d10064_config_STRINGIFY_VALUE(_x) __x86_64_inventec_d10064_config_STRINGIFY_NAME(_x) +x86_64_inventec_d10064_config_settings_t x86_64_inventec_d10064_config_settings[] = +{ +#ifdef x86_64_inventec_d10064_CONFIG_INCLUDE_LOGGING + { __x86_64_inventec_d10064_config_STRINGIFY_NAME(x86_64_inventec_d10064_CONFIG_INCLUDE_LOGGING), __x86_64_inventec_d10064_config_STRINGIFY_VALUE(x86_64_inventec_d10064_CONFIG_INCLUDE_LOGGING) }, +#else +{ x86_64_inventec_d10064_CONFIG_INCLUDE_LOGGING(__x86_64_inventec_d10064_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef x86_64_inventec_d10064_CONFIG_LOG_OPTIONS_DEFAULT + { __x86_64_inventec_d10064_config_STRINGIFY_NAME(x86_64_inventec_d10064_CONFIG_LOG_OPTIONS_DEFAULT), __x86_64_inventec_d10064_config_STRINGIFY_VALUE(x86_64_inventec_d10064_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ x86_64_inventec_d10064_CONFIG_LOG_OPTIONS_DEFAULT(__x86_64_inventec_d10064_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef x86_64_inventec_d10064_CONFIG_LOG_BITS_DEFAULT + { __x86_64_inventec_d10064_config_STRINGIFY_NAME(x86_64_inventec_d10064_CONFIG_LOG_BITS_DEFAULT), __x86_64_inventec_d10064_config_STRINGIFY_VALUE(x86_64_inventec_d10064_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ x86_64_inventec_d10064_CONFIG_LOG_BITS_DEFAULT(__x86_64_inventec_d10064_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef x86_64_inventec_d10064_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __x86_64_inventec_d10064_config_STRINGIFY_NAME(x86_64_inventec_d10064_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __x86_64_inventec_d10064_config_STRINGIFY_VALUE(x86_64_inventec_d10064_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ x86_64_inventec_d10064_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__x86_64_inventec_d10064_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef x86_64_inventec_d10064_CONFIG_PORTING_STDLIB + { __x86_64_inventec_d10064_config_STRINGIFY_NAME(x86_64_inventec_d10064_CONFIG_PORTING_STDLIB), __x86_64_inventec_d10064_config_STRINGIFY_VALUE(x86_64_inventec_d10064_CONFIG_PORTING_STDLIB) }, +#else +{ x86_64_inventec_d10064_CONFIG_PORTING_STDLIB(__x86_64_inventec_d10064_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef x86_64_inventec_d10064_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __x86_64_inventec_d10064_config_STRINGIFY_NAME(x86_64_inventec_d10064_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __x86_64_inventec_d10064_config_STRINGIFY_VALUE(x86_64_inventec_d10064_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ x86_64_inventec_d10064_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__x86_64_inventec_d10064_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef x86_64_inventec_d10064_CONFIG_INCLUDE_UCLI + { __x86_64_inventec_d10064_config_STRINGIFY_NAME(x86_64_inventec_d10064_CONFIG_INCLUDE_UCLI), __x86_64_inventec_d10064_config_STRINGIFY_VALUE(x86_64_inventec_d10064_CONFIG_INCLUDE_UCLI) }, +#else +{ x86_64_inventec_d10064_CONFIG_INCLUDE_UCLI(__x86_64_inventec_d10064_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef x86_64_inventec_d10064_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION + { __x86_64_inventec_d10064_config_STRINGIFY_NAME(x86_64_inventec_d10064_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION), __x86_64_inventec_d10064_config_STRINGIFY_VALUE(x86_64_inventec_d10064_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION) }, +#else +{ x86_64_inventec_d10064_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION(__x86_64_inventec_d10064_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __x86_64_inventec_d10064_config_STRINGIFY_VALUE +#undef __x86_64_inventec_d10064_config_STRINGIFY_NAME + +const char* +x86_64_inventec_d10064_config_lookup(const char* setting) +{ + int i; + for(i = 0; x86_64_inventec_d10064_config_settings[i].name; i++) { + if(strcmp(x86_64_inventec_d10064_config_settings[i].name, setting)) { + return x86_64_inventec_d10064_config_settings[i].value; + } + } + return NULL; +} + +int +x86_64_inventec_d10064_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; x86_64_inventec_d10064_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", x86_64_inventec_d10064_config_settings[i].name, x86_64_inventec_d10064_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_enums.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_enums.c new file mode 100644 index 00000000..ae03e691 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_enums.c @@ -0,0 +1,10 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.enum(ALL).source> */ +/* */ + diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_int.h b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_int.h new file mode 100644 index 00000000..c3bc463a --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_int.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * x86_64_inventec_d10064 Internal Header + * + *****************************************************************************/ +#ifndef __x86_64_inventec_d10064_INT_H__ +#define __x86_64_inventec_d10064_INT_H__ + +#include + + +#endif /* __x86_64_inventec_d10064_INT_H__ */ diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_log.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_log.c new file mode 100644 index 00000000..3a2865e5 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_log.c @@ -0,0 +1,18 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "x86_64_inventec_d10064_log.h" +/* + * x86_64_inventec_d10064 log struct. + */ +AIM_LOG_STRUCT_DEFINE( + x86_64_inventec_d10064_CONFIG_LOG_OPTIONS_DEFAULT, + x86_64_inventec_d10064_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + x86_64_inventec_d10064_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_log.h b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_log.h new file mode 100644 index 00000000..dddfc886 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_log.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#ifndef __x86_64_inventec_d10064_LOG_H__ +#define __x86_64_inventec_d10064_LOG_H__ + +#define AIM_LOG_MODULE_NAME x86_64_inventec_d10064 +#include + +#endif /* __x86_64_inventec_d100064_LOG_H__ */ diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_module.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_module.c new file mode 100644 index 00000000..d9ef7ec9 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_module.c @@ -0,0 +1,24 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "x86_64_inventec_d10064_log.h" + +static int +datatypes_init__(void) +{ +#define x86_64_inventec_d10064_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __x86_64_inventec_d10064_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + +int __onlp_platform_version__ = 1; diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_ucli.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_ucli.c new file mode 100644 index 00000000..fe70213c --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/onlp/builds/src/module/src/x86_64_inventec_d10064_ucli.c @@ -0,0 +1,50 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#if x86_64_inventec_d10064_CONFIG_INCLUDE_UCLI == 1 + +#include +#include +#include + +static ucli_status_t +x86_64_inventec_d10064_ucli_ucli__config__(ucli_context_t* uc) +{ + UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_inventec_d10064) +} + +/* */ +/* */ + +static ucli_module_t +x86_64_inventec_d10064_ucli_module__ = + { + "x86_64_inventec_d10064_ucli", + NULL, + x86_64_inventec_d10064_ucli_ucli_handlers__, + NULL, + NULL, + }; + +ucli_node_t* +x86_64_inventec_d10064_ucli_node_create(void) +{ + ucli_node_t* n; + ucli_module_init(&x86_64_inventec_d10064_ucli_module__); + n = ucli_node_create("x86_64_inventec_d10064", NULL, &x86_64_inventec_d10064_ucli_module__); + ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_inventec_d10064")); + return n; +} + +#else +void* +x86_64_inventec_d10064_ucli_node_create(void) +{ + return NULL; +} +#endif + diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/Makefile b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/Makefile b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/PKG.yml b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/PKG.yml new file mode 100644 index 00000000..dd6955aa --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=inventec BASENAME=x86-64-inventec-d10064 REVISION=r0 diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/src/lib/healthstatus.sh b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/src/lib/healthstatus.sh new file mode 120000 index 00000000..ed70d39b --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/src/lib/healthstatus.sh @@ -0,0 +1 @@ +../../../../../x86-64-inventec-d5264q28b/platform-config/r0/src/lib/healthstatus.sh \ No newline at end of file diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/src/lib/x86-64-inventec-d10064-r0.yml b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/src/lib/x86-64-inventec-d10064-r0.yml new file mode 100644 index 00000000..ee6b5129 --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/src/lib/x86-64-inventec-d10064-r0.yml @@ -0,0 +1,31 @@ +--- + +###################################################################### +# +# platform-config for d10064 +# +###################################################################### + +x86-64-inventec-d10064-r0: + + grub: + + serial: >- + --port=0x3f8 + --speed=115200 + --word=8 + --parity=no + --stop=1 + + kernel: + <<: *kernel-3-16 + + args: >- + nopat + console=ttyS0,115200n8 + + ##network + ## interfaces: + ## ma1: + ## name: ~ + ## syspath: pci0000:00/0000:00:14.0 diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/src/python/x86_64_inventec_d10064_r0/__init__.py b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/src/python/x86_64_inventec_d10064_r0/__init__.py new file mode 100644 index 00000000..6d72e12e --- /dev/null +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d10064/platform-config/r0/src/python/x86_64_inventec_d10064_r0/__init__.py @@ -0,0 +1,43 @@ +from onl.platform.base import * +from onl.platform.inventec import * + +class OnlPlatform_x86_64_inventec_d10064_r0(OnlPlatformInventec, + OnlPlatformPortConfig_64x100): + PLATFORM='x86-64-inventec-d10064-r0' + MODEL="D10064" + SYS_OBJECT_ID=".1.32" + + def baseconfig(self): + os.system("insmod /lib/modules/`uname -r`/kernel/drivers/gpio/gpio-ich.ko") + + #self.insmod('inv_platform') + os.system("echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-0/new_device") + os.system("sleep 1") + os.system("echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-8/new_device") + os.system("sleep 1") + #Upper + os.system("echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-1/new_device") + os.system("echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-2/new_device") + os.system("echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-3/new_device") + os.system("echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-4/new_device") + os.system("sleep 1") + #Lower + os.system("echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-9/new_device") + os.system("echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-10/new_device") + os.system("echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-11/new_device") + os.system("echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-12/new_device") + + self.insmod('inv_psoc') + os.system("echo inv_cpld 0x55 > /sys/bus/i2c/devices/i2c-0/new_device") + os.system("echo inv_cpld 0x77 > /sys/bus/i2c/devices/i2c-0/new_device") + self.insmod('inv_cpld') + self.insmod('inv_mux') + self.insmod('io_expander') + self.insmod('transceiver') + self.insmod('inv_swps') + self.insmod('onie_tlvinfo') + self.insmod('inv_vpd') + + os.system("/lib/platform-config/x86-64-inventec-d10064-r0/onl/healthstatus.sh &") + + return True diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/inv_psoc.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/inv_psoc.c index 85bcdd78..e0adad51 100644 --- a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/inv_psoc.c +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/inv_psoc.c @@ -15,8 +15,13 @@ #include #include #include +#include +#include +#include +#include +#define SWITCH_TEMPERATURE_SOCK "/proc/switch/temp" +#define PSOC_POLLING_PERIOD 1000 -//================================= #include #include #include @@ -27,19 +32,26 @@ #define CMD_GETDATA 0x31 #define CMD_SETDATA 0x32 #define FAN_NUM 4 -#define PSU_NUM 2 +#define PSU_NUM 2 + +#define FAN_CLEI_SUPPORT 0 +#define PSU_CLEI_SUPPORT 0 #define PSU1 0x5800 #define PSU2 0x5900 #define BMC_PMBusNumber 3 -#define PMBus_Vender 0x99 +#define PMBus_Vendor 0x99 #define PMBus_Serial 0x9E #define PMBus_Temp2 0x8E #define PMBus_Version 0x9B -#define MaxLeng_Result 0x20 +#define MaxLeng_Result 0x40 + +#define BMC_FanCLEIBusNumber 9 +#define DEVICE_CLEI_ADDR 0x52,0x53,0x54,0x55,0x56,0x50,0x51 #define MAX_IPMI_RECV_LENGTH 0xff - +static char CLEI_ADDR[]={DEVICE_CLEI_ADDR}; +struct task_struct *kthread_auto_update; static long pmbus_reg2data_linear(int data, int linear16); struct ipmi_result{ char result[MAX_IPMI_RECV_LENGTH]; @@ -88,18 +100,31 @@ struct __attribute__ ((__packed__)) psoc_psu_layout { u16 psu2_vout; }; +struct __attribute__ ((__packed__)) clei { + u8 issue_number[3]; + u8 abbreviation_number[9]; + u8 fc_number[10]; + u8 clei_code[10]; + u8 product_year_and_month[5]; + u8 label_location_code[2]; + u8 serial_number[5]; + u8 pcb_revision[5]; + u8 vendor_name[10]; + u8 reserved[5]; +}; + struct __attribute__ ((__packed__)) psoc_layout { u8 ctl; //offset: 0 u16 switch_temp; //offset: 1 - u8 reserve0; //offset: 3 - u8 fw_upgrade; //offset: 4 + // BYTE[03:20] - voltage + u16 voltage[15]; //offset: 0x03-0x20 - //i2c bridge - u8 i2c_st; //offset: 5 - u8 i2c_ctl; //offset: 6 - u8 i2c_addr; //offset: 7 - u8 i2c_data[0x20]; //offset: 8 + // BYTE[21:27] - ExtFan + u8 led_ctl2; //offset: 21 + u8 ext_pwm; //offset: 22 + u16 ext_rpm[2]; //offset: 23 + u8 gpi_fan2; //offset: 27 //gpo u8 led_ctl; //offset: 28 @@ -107,11 +132,11 @@ struct __attribute__ ((__packed__)) psoc_layout { u8 gpio; //offset: 29 //pwm duty - u8 pwm[FAN_NUM]; //offset: 2a - u8 pwm_psu[PSU_NUM]; //offset: 2e + u8 pwm[4]; //offset: 2a + u8 pwm_psu[2]; //offset: 2e //fan rpm - u16 fan[FAN_NUM*2]; //offset: 30 + u16 fan[4*2]; //offset: 30 u8 reserve1[4]; //offset: 40 @@ -123,7 +148,7 @@ struct __attribute__ ((__packed__)) psoc_layout { //temperature u16 temp[5]; //offset: 46 - u16 temp_psu[PSU_NUM]; //offset: 50 + u16 temp_psu[2]; //offset: 50 //version u8 version[2]; //offset: 54 @@ -132,7 +157,6 @@ struct __attribute__ ((__packed__)) psoc_layout { struct psoc_psu_layout psu_info; //offset: 5a }; -/* definition */ /* definition */ #define PSOC_OFF(m) offsetof(struct psoc_layout, m) #define PSOC_PSU_OFF(m) offsetof(struct psoc_psu_layout, m) @@ -148,15 +172,27 @@ struct __attribute__ ((__packed__)) psoc_layout { #define VERSION_OFFSET PSOC_OFF(version) #define PSU_INFO_OFFSET PSOC_OFF(psu_info) +#define PWM2_OFFSET PSOC_OFF(ext_pwm) +#define RPM2_OFFSET PSOC_OFF(ext_rpm) +#define FAN_LED2_OFFSET PSOC_OFF(led_ctl2) +#define FAN_GPI2_OFFSET PSOC_OFF(gpi_fan2) + +#define CLEI_OFF(m) offsetof(struct clei, m) +#define FAN1_CLEI_INDEX 0 +#define FAN2_CLEI_INDEX 1 +#define FAN3_CLEI_INDEX 2 +#define FAN4_CLEI_INDEX 3 +#define FAN5_CLEI_INDEX 4 +#define PSU1_CLEI_INDEX 5 +#define PSU2_CLEI_INDEX 6 static void msg_handler(struct ipmi_recv_msg *recv_msg,void* handler_data) { struct ipmi_result *msg_result = recv_msg->user_msg_data; - if(recv_msg->msg.data[0]==0 && recv_msg->msg.data_len>0) { - msg_result->result_length=recv_msg->msg.data_len-1; - memcpy(msg_result->result, &recv_msg->msg.data[1], recv_msg->msg.data_len-1); - } + msg_result->result_length=recv_msg->msg.data_len-1; + memcpy(msg_result->result, &recv_msg->msg.data[1], recv_msg->msg.data_len-1); + ipmi_free_recv_msg(recv_msg); mutex_unlock(&ipmi_mutex); @@ -333,10 +369,14 @@ static ssize_t show_ipmi_pmbus(struct device *dev, struct device_attribute *da, { if(data[3]==PMBus_Temp2) { - return sprintf(buf, "%ld \n", pmbus_reg2data_linear(result[0] | (result[1]<<8), 0 )); + return sprintf(buf, "%ld \n", ((result_len==2)?(pmbus_reg2data_linear(result[0] | (result[1]<<8), 0 )):0)); + } + else + { + if(result_len==0) result[0]=0; + result[result[0]+1]='\0'; + return sprintf(buf, "%s\n",&result[1]); } - result[result[0]+1]='\0'; - return sprintf(buf, "%s\n",&result[1] ); } else { @@ -344,6 +384,41 @@ static ssize_t show_ipmi_pmbus(struct device *dev, struct device_attribute *da, } } +static ssize_t show_clei(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 device_index = attr->index & 0xFF; + + uint8_t data[5],result[MaxLeng_Result]; + int result_len=0; + + data[0] = (device_index<=FAN5_CLEI_INDEX) ? BMC_FanCLEIBusNumber:BMC_PMBusNumber; + data[1] = CLEI_ADDR[device_index]<<1; + data[2] = sizeof(struct clei); + data[3] = (device_index<=FAN5_CLEI_INDEX) ? 0x00 : 0x01; //PSU CLEI will start from 0x0100 + data[4] = 0; + + if(start_ipmi_command(0x06, 0x52,data,5, result, &result_len)==0) + { + if(result_len < sizeof(struct clei)) memset(result, 0, sizeof(struct clei)); + sprintf (buf, "Issue Number: %.3s\n", &result[CLEI_OFF(issue_number)]); + sprintf (buf, "%sAbbreviation Number: %.9s\n", buf, &result[CLEI_OFF(abbreviation_number)]); + sprintf (buf, "%sFC Number: %.10s\n", buf, &result[CLEI_OFF(fc_number)]); + sprintf (buf, "%sCLEI Code: %.10s\n", buf, &result[CLEI_OFF(clei_code)]); + sprintf (buf, "%sProduct Year and Month: %.5s\n", buf, &result[CLEI_OFF(product_year_and_month)]); + sprintf (buf, "%s2D Label Location Code: %.2s\n", buf, &result[CLEI_OFF(label_location_code)]); + sprintf (buf, "%sSerial Number: %.5s\n", buf, &result[CLEI_OFF(serial_number)]); + sprintf (buf, "%sPCB Revision: %.5s\n", buf, &result[CLEI_OFF(pcb_revision)]); + sprintf (buf, "%sVendor Name: %.10s\n", buf, &result[CLEI_OFF(vendor_name)]); + return strlen(buf); + } + else + { + return sprintf(buf, "NONE\n"); + } +} + static ssize_t show_thermal(struct device *dev, struct device_attribute *da, char *buf) { @@ -362,7 +437,7 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *da, { int status=0; struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - u8 offset = attr->index + PWM_OFFSET; + u8 offset = attr->index; status = psoc_read8(offset); @@ -375,13 +450,11 @@ static ssize_t set_pwm(struct device *dev, const char *buf, size_t count) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - u8 offset = attr->index + PWM_OFFSET; - + u8 offset = attr->index; u8 pwm = simple_strtol(buf, NULL, 10); - if(pwm > 255) pwm = 255; - - psoc_ipmi_write(&pwm, offset, 1); - + if(pwm > 255) pwm = 255; + psoc_ipmi_write(&pwm, offset, 1); + return count; } @@ -391,8 +464,7 @@ static ssize_t show_rpm(struct device *dev, struct device_attribute *da, { int status=0; struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - u8 offset = attr->index*2 + RPM_OFFSET; - + u8 offset = attr->index; status = psoc_read16(offset); return sprintf(buf, "%d\n", @@ -405,7 +477,7 @@ static ssize_t show_switch_tmp(struct device *dev, struct device_attribute *da, u16 status=0; u16 temp = 0; - status = psoc_ipmi_read((u8*)&temp, SWITCH_TMP_OFFSET, 2); + status = psoc_ipmi_read((u8*)&temp, SWITCH_TMP_OFFSET, 2); status = sprintf (buf, "%d\n", (s8)(temp>>8) * 1000 ); @@ -417,9 +489,8 @@ static ssize_t set_switch_tmp(struct device *dev, const char *buf, size_t count) { long temp = simple_strtol(buf, NULL, 10); - u16 temp2 = ( (temp/1000) <<8 ) & 0xFF00 ; + u16 temp2 = ( (temp/1000) <<8 ) & 0xFF00 ; - //printk("set_switch_tmp temp=%d, temp2=0x%x (%x,%x)\n", temp, temp2, ( ( (temp/1000) <<8 ) & 0xFF00 ), (( (temp%1000) / 10 ) & 0xFF)); psoc_ipmi_write((u8*)&temp2, SWITCH_TMP_OFFSET, 2); @@ -432,7 +503,7 @@ static ssize_t show_diag(struct device *dev, struct device_attribute *da, u16 status=0; u8 diag_flag = 0; - status = psoc_ipmi_read((u8*)&diag_flag, DIAG_FLAG_OFFSET, 1); + status = psoc_ipmi_read((u8*)&diag_flag, DIAG_FLAG_OFFSET, 1); status = sprintf (buf, "%d\n", ((diag_flag & 0x80)?1:0)); @@ -446,7 +517,7 @@ static ssize_t set_diag(struct device *dev, u8 value = 0; u8 diag = simple_strtol(buf, NULL, 10); - diag = diag?1:0; + diag = diag?1:0; psoc_ipmi_read((u8*)&value, DIAG_FLAG_OFFSET, 1); if(diag) value |= (1<<7); @@ -473,8 +544,11 @@ static ssize_t show_fan_led(struct device *dev, struct device_attribute *da, int status=0; struct sensor_device_attribute *attr = to_sensor_dev_attr(da); u8 bit = attr->index; - - status = psoc_read8(FAN_LED_OFFSET); + + if(bit < 8) { status = psoc_read8(FAN_LED_OFFSET); } +#if FAN_NUM>4 + if(bit >= 8) { status = psoc_read8(FAN_LED2_OFFSET); bit-=8; } +#endif return sprintf(buf, "%d\n", (status & (1<index < 8) { led_state = psoc_read8(FAN_LED_OFFSET ); } +#if FAN_NUM>4 + if(attr->index >= 8) { led_state = psoc_read8(FAN_LED2_OFFSET); bit-=8; } +#endif + if(v) led_state |= (1<index < 8) { psoc_ipmi_write(&led_state, FAN_LED_OFFSET, 1);} +#if FAN_NUM>4 + if(attr->index >= 8) { psoc_ipmi_write(&led_state, FAN_LED2_OFFSET,1);} +#endif return count; } @@ -547,41 +627,69 @@ static ssize_t show_psu_psoc(struct device *dev, struct device_attribute *da, u8 offset = attr->index + PSU_INFO_OFFSET; status = psoc_read16(offset); - - return sprintf(buf, "%ld \n", pmbus_reg2data_linear(status, strstr(attr->dev_attr.attr.name, "vout")? 1:0 )); + + if((strstr(attr->dev_attr.attr.name, "vout")!=NULL)|(strstr(attr->dev_attr.attr.name, "in3")!=NULL)|(strstr(attr->dev_attr.attr.name, "in4")!=NULL)) { + offset=1; + } + else { + offset=0; + } + + return sprintf(buf, "%ld \n", pmbus_reg2data_linear(status, offset )); } +static ssize_t show_name(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + return sprintf(buf, "inv_psoc\n"); +} +static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_thermal, 0, 0); static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_thermal, 0, 1); static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_thermal, 0, 2); static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_thermal, 0, 3); static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_thermal, 0, 4); -static SENSOR_DEVICE_ATTR(thermal_psu1, S_IRUGO, show_thermal, 0, 5); -static SENSOR_DEVICE_ATTR(thermal_psu2, S_IRUGO, show_thermal, 0, 6); +static SENSOR_DEVICE_ATTR(thermal_psu1, S_IRUGO, show_thermal, 0, 5); +static SENSOR_DEVICE_ATTR(thermal_psu2, S_IRUGO, show_thermal, 0, 6); +static SENSOR_DEVICE_ATTR(temp7_input, S_IRUGO, show_thermal, 0, 5); +static SENSOR_DEVICE_ATTR(temp8_input, S_IRUGO, show_thermal, 0, 6); -static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 0); -static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 1); -static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 2); -static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 3); -static SENSOR_DEVICE_ATTR(pwm_psu1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 4); -static SENSOR_DEVICE_ATTR(pwm_psu2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 5); +static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 0 + PWM_OFFSET); +static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 1 + PWM_OFFSET); +static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 2 + PWM_OFFSET); +static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 3 + PWM_OFFSET); +#if FAN_NUM > 4 +static SENSOR_DEVICE_ATTR(pwm5, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 0 + PWM2_OFFSET); +#endif +static SENSOR_DEVICE_ATTR(pwm_psu1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 4 + PWM_OFFSET); +static SENSOR_DEVICE_ATTR(pwm_psu2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 5 + PWM_OFFSET); +static SENSOR_DEVICE_ATTR(pwm6, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 4 + PWM_OFFSET); +static SENSOR_DEVICE_ATTR(pwm7, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 5 + PWM_OFFSET); -static SENSOR_DEVICE_ATTR(psu0, S_IRUGO, show_psu_st, 0, 0); -static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu_st, 0, 1); +static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu_st, 0, 0); +static SENSOR_DEVICE_ATTR(psu2, S_IRUGO, show_psu_st, 0, 1); -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_rpm, 0, 0); -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_rpm, 0, 1); -static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_rpm, 0, 2); -static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_rpm, 0, 3); -static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_rpm, 0, 4); -static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_rpm, 0, 5); -static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_rpm, 0, 6); -static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_rpm, 0, 7); -static SENSOR_DEVICE_ATTR(rpm_psu1, S_IRUGO, show_rpm, 0, 8); -static SENSOR_DEVICE_ATTR(rpm_psu2, S_IRUGO, show_rpm, 0, 9); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_rpm, 0, 0*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_rpm, 0, 1*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_rpm, 0, 2*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_rpm, 0, 3*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_rpm, 0, 4*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_rpm, 0, 5*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_rpm, 0, 6*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_rpm, 0, 7*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(rpm_psu1, S_IRUGO, show_rpm, 0, 8*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(rpm_psu2, S_IRUGO, show_rpm, 0, 9*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan11_input, S_IRUGO, show_rpm, 0, 8*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan12_input, S_IRUGO, show_rpm, 0, 9*2 + RPM_OFFSET); + +#if FAN_NUM > 4 +static SENSOR_DEVICE_ATTR(fan9_input , S_IRUGO, show_rpm, 0,0*2 + RPM2_OFFSET); +static SENSOR_DEVICE_ATTR(fan10_input, S_IRUGO, show_rpm, 0,1*2 + RPM2_OFFSET); +#endif static SENSOR_DEVICE_ATTR(switch_tmp, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); +static SENSOR_DEVICE_ATTR(temp6_input, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); static SENSOR_DEVICE_ATTR(diag, S_IWUSR|S_IRUGO, show_diag, set_diag, 0); static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, 0, 0); @@ -595,6 +703,12 @@ static SENSOR_DEVICE_ATTR(fan_led_red2, S_IWUSR|S_IRUGO, show_fan_led, set_fan static SENSOR_DEVICE_ATTR(fan_led_red3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 6); static SENSOR_DEVICE_ATTR(fan_led_red4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 7); +#if FAN_NUM>4 +static SENSOR_DEVICE_ATTR(fan_led_grn5, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 8); +static SENSOR_DEVICE_ATTR(fan_led_red5, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 12); +static SENSOR_DEVICE_ATTR(fan_gpi2, S_IRUGO, show_value8, 0, FAN_GPI2_OFFSET); +#endif + static SENSOR_DEVICE_ATTR(fan_gpi, S_IRUGO, show_value8, 0, FAN_GPI_OFFSET); static SENSOR_DEVICE_ATTR(psoc_psu1_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vin)); static SENSOR_DEVICE_ATTR(psoc_psu1_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vout)); @@ -603,6 +717,12 @@ static SENSOR_DEVICE_ATTR(psoc_psu1_iout, S_IRUGO, show_psu_psoc, static SENSOR_DEVICE_ATTR(psoc_psu1_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pin)); static SENSOR_DEVICE_ATTR(psoc_psu1_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pout)); +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vin)); +static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iin)); +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pin)); +static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vout)); +static SENSOR_DEVICE_ATTR(curr3_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iout)); +static SENSOR_DEVICE_ATTR(power3_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pout)); static SENSOR_DEVICE_ATTR(psoc_psu2_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vin)); static SENSOR_DEVICE_ATTR(psoc_psu2_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vout)); @@ -611,37 +731,70 @@ static SENSOR_DEVICE_ATTR(psoc_psu2_iout, S_IRUGO, show_psu_psoc, static SENSOR_DEVICE_ATTR(psoc_psu2_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); static SENSOR_DEVICE_ATTR(psoc_psu2_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pout)); +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vin)); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iin)); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); +static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vout)); +static SENSOR_DEVICE_ATTR(curr4_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iout)); +static SENSOR_DEVICE_ATTR(power4_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pout)); + //IPMI static SENSOR_DEVICE_ATTR(thermal2_psu1, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Temp2); -static SENSOR_DEVICE_ATTR(psoc_psu1_vender, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Vender); +static SENSOR_DEVICE_ATTR(temp9_input, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Temp2); + +static SENSOR_DEVICE_ATTR(psoc_psu1_vendor, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Vendor); static SENSOR_DEVICE_ATTR(psoc_psu1_serial, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Serial); static SENSOR_DEVICE_ATTR(psoc_psu1_version, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Version); -static SENSOR_DEVICE_ATTR(thermal2_psu2, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Temp2); -static SENSOR_DEVICE_ATTR(psoc_psu2_vender, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Vender); +static SENSOR_DEVICE_ATTR(thermal2_psu2, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Temp2); +static SENSOR_DEVICE_ATTR(temp10_input, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Temp2); +static SENSOR_DEVICE_ATTR(psoc_psu2_vendor, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Vendor); static SENSOR_DEVICE_ATTR(psoc_psu2_serial, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Serial); static SENSOR_DEVICE_ATTR(psoc_psu2_version, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Version); - +//CLEI +#if FAN_CLEI_SUPPORT +static SENSOR_DEVICE_ATTR(fan1_clei, S_IRUGO, show_clei, 0, FAN1_CLEI_INDEX ); +static SENSOR_DEVICE_ATTR(fan2_clei, S_IRUGO, show_clei, 0, FAN2_CLEI_INDEX ); +static SENSOR_DEVICE_ATTR(fan3_clei, S_IRUGO, show_clei, 0, FAN3_CLEI_INDEX ); +static SENSOR_DEVICE_ATTR(fan4_clei, S_IRUGO, show_clei, 0, FAN4_CLEI_INDEX ); +#if FAN_NUM > 4 +static SENSOR_DEVICE_ATTR(fan5_clei, S_IRUGO, show_clei, 0, FAN5_CLEI_INDEX ); +#endif +#endif + +#if PSU_CLEI_SUPPORT +static SENSOR_DEVICE_ATTR(psu1_clei, S_IRUGO, show_clei, 0, PSU1_CLEI_INDEX ); +static SENSOR_DEVICE_ATTR(psu2_clei, S_IRUGO, show_clei, 0, PSU2_CLEI_INDEX ); +#endif + static struct attribute *psoc_attributes[] = { + //name + &dev_attr_name.attr, //thermal &sensor_dev_attr_temp1_input.dev_attr.attr, &sensor_dev_attr_temp2_input.dev_attr.attr, &sensor_dev_attr_temp3_input.dev_attr.attr, &sensor_dev_attr_temp4_input.dev_attr.attr, &sensor_dev_attr_temp5_input.dev_attr.attr, - - &sensor_dev_attr_thermal_psu1.dev_attr.attr, - &sensor_dev_attr_thermal_psu2.dev_attr.attr, + &sensor_dev_attr_thermal_psu1.dev_attr.attr, + &sensor_dev_attr_thermal_psu2.dev_attr.attr, + &sensor_dev_attr_temp7_input.dev_attr.attr, + &sensor_dev_attr_temp8_input.dev_attr.attr, //pwm &sensor_dev_attr_pwm1.dev_attr.attr, &sensor_dev_attr_pwm2.dev_attr.attr, &sensor_dev_attr_pwm3.dev_attr.attr, &sensor_dev_attr_pwm4.dev_attr.attr, +#if FAN_NUM > 4 + &sensor_dev_attr_pwm5.dev_attr.attr, +#endif &sensor_dev_attr_pwm_psu1.dev_attr.attr, &sensor_dev_attr_pwm_psu2.dev_attr.attr, + &sensor_dev_attr_pwm6.dev_attr.attr, + &sensor_dev_attr_pwm7.dev_attr.attr, //rpm &sensor_dev_attr_fan1_input.dev_attr.attr, @@ -652,12 +805,17 @@ static struct attribute *psoc_attributes[] = { &sensor_dev_attr_fan6_input.dev_attr.attr, &sensor_dev_attr_fan7_input.dev_attr.attr, &sensor_dev_attr_fan8_input.dev_attr.attr, - +#if FAN_NUM > 4 + &sensor_dev_attr_fan9_input.dev_attr.attr, + &sensor_dev_attr_fan10_input.dev_attr.attr, +#endif &sensor_dev_attr_rpm_psu1.dev_attr.attr, &sensor_dev_attr_rpm_psu2.dev_attr.attr, - + &sensor_dev_attr_fan11_input.dev_attr.attr, + &sensor_dev_attr_fan12_input.dev_attr.attr, //switch temperature &sensor_dev_attr_switch_tmp.dev_attr.attr, + &sensor_dev_attr_temp6_input.dev_attr.attr, //diag flag &sensor_dev_attr_diag.dev_attr.attr, @@ -674,11 +832,15 @@ static struct attribute *psoc_attributes[] = { &sensor_dev_attr_fan_led_red2.dev_attr.attr, &sensor_dev_attr_fan_led_red3.dev_attr.attr, &sensor_dev_attr_fan_led_red4.dev_attr.attr, - +#if FAN_NUM >4 + &sensor_dev_attr_fan_led_grn5.dev_attr.attr, + &sensor_dev_attr_fan_led_red5.dev_attr.attr, + &sensor_dev_attr_fan_gpi2.dev_attr.attr, +#endif //fan GPI &sensor_dev_attr_fan_gpi.dev_attr.attr, - &sensor_dev_attr_psu0.dev_attr.attr, &sensor_dev_attr_psu1.dev_attr.attr, + &sensor_dev_attr_psu2.dev_attr.attr, //psu_psoc @@ -695,18 +857,47 @@ static struct attribute *psoc_attributes[] = { &sensor_dev_attr_psoc_psu2_pin.dev_attr.attr, &sensor_dev_attr_psoc_psu2_pout.dev_attr.attr, + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_in3_input.dev_attr.attr, + &sensor_dev_attr_curr3_input.dev_attr.attr, + &sensor_dev_attr_power3_input.dev_attr.attr, + &sensor_dev_attr_in4_input.dev_attr.attr, + &sensor_dev_attr_curr4_input.dev_attr.attr, + &sensor_dev_attr_power4_input.dev_attr.attr, + //ipmi_i2c_command &sensor_dev_attr_thermal2_psu1.dev_attr.attr, - &sensor_dev_attr_psoc_psu1_vender.dev_attr.attr, + &sensor_dev_attr_temp9_input.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_vendor.dev_attr.attr, &sensor_dev_attr_psoc_psu1_serial.dev_attr.attr, &sensor_dev_attr_psoc_psu1_version.dev_attr.attr, &sensor_dev_attr_thermal2_psu2.dev_attr.attr, - &sensor_dev_attr_psoc_psu2_vender.dev_attr.attr, + &sensor_dev_attr_temp10_input.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vendor.dev_attr.attr, &sensor_dev_attr_psoc_psu2_serial.dev_attr.attr, &sensor_dev_attr_psoc_psu2_version.dev_attr.attr, + //clei +#if FAN_CLEI_SUPPORT + &sensor_dev_attr_fan1_clei.dev_attr.attr, + &sensor_dev_attr_fan2_clei.dev_attr.attr, + &sensor_dev_attr_fan3_clei.dev_attr.attr, + &sensor_dev_attr_fan4_clei.dev_attr.attr, +#if FAN_NUM > 4 + &sensor_dev_attr_fan5_clei.dev_attr.attr, +#endif +#endif +#if PSU_CLEI_SUPPORT + &sensor_dev_attr_psu1_clei.dev_attr.attr, + &sensor_dev_attr_psu2_clei.dev_attr.attr, +#endif NULL }; @@ -714,17 +905,54 @@ static const struct attribute_group psoc_group = { .attrs = psoc_attributes, }; +//================================= +static void check_switch_temp(void) +{ + static struct file *f; + mm_segment_t old_fs; + + set_fs(get_ds()); + f = filp_open(SWITCH_TEMPERATURE_SOCK,O_RDONLY,0644); + if(IS_ERR(f)) { + return; + } + else { + char temp_str[]={0,0,0,0,0,0,0}; + loff_t pos = 0; + u16 temp2 = 0; + old_fs = get_fs(); + set_fs(KERNEL_DS); + vfs_read(f, temp_str,6,&pos); + temp2 = ((simple_strtoul(temp_str,NULL,10)/1000) <<8 ) & 0xFF00 ; + psoc_ipmi_write((u8*)&temp2, SWITCH_TMP_OFFSET, 2); + } + filp_close(f,NULL); + set_fs(old_fs); +} + +static int psoc_polling_thread(void *p) +{ + while (!kthread_should_stop()) + { + check_switch_temp(); + set_current_state(TASK_INTERRUPTIBLE); + if(kthread_should_stop()) + break; + + schedule_timeout(msecs_to_jiffies(PSOC_POLLING_PERIOD)); + } + return 0; +} + static int __init inv_psoc_init(void) { int ret; - printk("+%s\n", __func__); - hwmon_dev = hwmon_device_register(NULL); if (IS_ERR(hwmon_dev)) { goto fail_hwmon_device_register; } - + device_kobj = kobject_create_and_add("device", &hwmon_dev->kobj); if(!device_kobj) { goto fail_hwmon_device_register; @@ -735,7 +963,15 @@ static int __init inv_psoc_init(void) goto fail_create_group_hwmon; } - printk(" Enable IPMI PSoC protocol.\n"); + ret = sysfs_create_group(&hwmon_dev->kobj, &psoc_group); + if (ret) { + goto fail_create_group_hwmon; + } + + kthread_auto_update = kthread_run(psoc_polling_thread,NULL,"BMC_DRIVER"); + if (IS_ERR(kthread_auto_update)) { + goto fail_create_group_hwmon; + } return ret; fail_create_group_hwmon: @@ -746,9 +982,10 @@ fail_hwmon_device_register: static void __exit inv_psoc_exit(void) { + kthread_stop(kthread_auto_update); if(ipmi_mh_user!=NULL) {ipmi_destroy_user(ipmi_mh_user);} - if(hwmon_dev != NULL) hwmon_device_unregister(hwmon_dev); sysfs_remove_group(device_kobj, &psoc_group); + if(hwmon_dev != NULL) hwmon_device_unregister(hwmon_dev); } MODULE_AUTHOR("Ting.Jack "); diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/inv_swps.h b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/inv_swps.h index 3a937f04..936c9c43 100644 --- a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/inv_swps.h +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/inv_swps.h @@ -39,6 +39,7 @@ #define PLATFORM_TYPE_SPRUCE (141) #define PLATFORM_TYPE_CYPRESS_GA1 (151) /* Up -> Down */ #define PLATFORM_TYPE_CYPRESS_GA2 (152) /* Down -> Up */ +#define PLATFORM_TYPE_CYPRESS_BAI (153) /* Down -> Up */ #define PLATFORM_TYPE_LAVENDER (161) /* Current running platfrom */ #define PLATFORM_SETTINGS PLATFORM_TYPE_LAVENDER @@ -68,6 +69,9 @@ #elif (PLATFORM_SETTINGS == PLATFORM_TYPE_CYPRESS_GA2) #define SWPS_CYPRESS_GA2 (1) #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_CYPRESS_BAI) + #define SWPS_CYPRESS_BAI (1) + #define SWPS_KERN_VER_AF_3_10 (1) #elif (PLATFORM_SETTINGS == PLATFORM_TYPE_LAVENDER) #define SWPS_LAVENDER (1) #define SWPS_KERN_VER_BF_3_8 (1) @@ -110,6 +114,7 @@ struct inv_platform_s platform_map[] = { {PLATFORM_TYPE_SPRUCE, "Spruce" }, {PLATFORM_TYPE_CYPRESS_GA1, "Cypress_GA1" }, {PLATFORM_TYPE_CYPRESS_GA2, "Cypress_GA2" }, + {PLATFORM_TYPE_CYPRESS_BAI, "Cypress_BAI" }, {PLATFORM_TYPE_LAVENDER, "Lavender" }, }; @@ -147,61 +152,61 @@ struct inv_ioexp_layout_s magnolia_ioexp_layout[] = { }; struct inv_port_layout_s magnolia_port_layout[] = { - /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ - { 0, 10, 0, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 16} }, - { 1, 11, 0, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 15} }, - { 2, 12, 0, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 14} }, - { 3, 13, 0, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 13} }, - { 4, 14, 0, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 24} }, - { 5, 15, 0, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 23} }, - { 6, 16, 0, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 22} }, - { 7, 17, 0, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 21} }, - { 8, 18, 1, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 28} }, - { 9, 19, 1, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 27} }, - {10, 20, 1, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 26} }, - {11, 21, 1, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 25} }, - {12, 22, 1, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 32} }, - {13, 23, 1, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 31} }, - {14, 24, 1, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 30} }, - {15, 25, 1, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 29} }, - {16, 26, 2, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 48} }, - {17, 27, 2, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 47} }, - {18, 28, 2, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 46} }, - {19, 29, 2, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 45} }, - {20, 30, 2, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 52} }, - {21, 31, 2, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 51} }, - {22, 32, 2, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 50} }, - {23, 33, 2, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 49} }, - {24, 34, 3, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 56} }, - {25, 35, 3, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 55} }, - {26, 36, 3, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 54} }, - {27, 37, 3, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 53} }, - {28, 38, 3, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 60} }, - {29, 39, 3, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 59} }, - {30, 40, 3, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 58} }, - {31, 41, 3, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 57} }, - {32, 42, 4, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 64} }, - {33, 43, 4, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 63} }, - {34, 44, 4, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 62} }, - {35, 45, 4, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 61} }, - {36, 46, 4, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 68} }, - {37, 47, 4, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 67} }, - {38, 48, 4, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 66} }, - {39, 49, 4, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 65} }, - {40, 50, 5, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 72} }, - {41, 51, 5, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 71} }, - {42, 52, 5, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 70} }, - {43, 53, 5, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 69} }, - {44, 54, 5, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 76} }, - {45, 55, 5, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 75} }, - {46, 56, 5, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 74} }, - {47, 57, 5, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 73} }, - {48, 58, 6, 0, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, { 81, 82, 83, 84} }, - {49, 59, 6, 1, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, { 77, 78, 79, 80} }, - {50, 60, 6, 2, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, { 97, 98, 99,100} }, - {51, 61, 6, 3, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, {101,102,103,104} }, - {52, 62, 6, 4, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, {105,106,107,108} }, - {53, 63, 6, 5, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, {109,110,111,112} }, + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / CHIP_TYPE / LANE_ID */ + { 0, 10, 0, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 16} }, + { 1, 11, 0, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 15} }, + { 2, 12, 0, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 14} }, + { 3, 13, 0, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 13} }, + { 4, 14, 0, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 24} }, + { 5, 15, 0, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 23} }, + { 6, 16, 0, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 22} }, + { 7, 17, 0, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 21} }, + { 8, 18, 1, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 28} }, + { 9, 19, 1, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 27} }, + {10, 20, 1, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 26} }, + {11, 21, 1, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 25} }, + {12, 22, 1, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 32} }, + {13, 23, 1, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 31} }, + {14, 24, 1, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 30} }, + {15, 25, 1, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 29} }, + {16, 26, 2, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 48} }, + {17, 27, 2, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 47} }, + {18, 28, 2, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 46} }, + {19, 29, 2, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 45} }, + {20, 30, 2, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 52} }, + {21, 31, 2, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 51} }, + {22, 32, 2, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 50} }, + {23, 33, 2, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 49} }, + {24, 34, 3, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 56} }, + {25, 35, 3, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 55} }, + {26, 36, 3, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 54} }, + {27, 37, 3, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 53} }, + {28, 38, 3, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 60} }, + {29, 39, 3, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 59} }, + {30, 40, 3, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 58} }, + {31, 41, 3, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 57} }, + {32, 42, 4, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 64} }, + {33, 43, 4, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 63} }, + {34, 44, 4, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 62} }, + {35, 45, 4, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 61} }, + {36, 46, 4, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 68} }, + {37, 47, 4, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 67} }, + {38, 48, 4, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 66} }, + {39, 49, 4, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 65} }, + {40, 50, 5, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 72} }, + {41, 51, 5, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 71} }, + {42, 52, 5, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 70} }, + {43, 53, 5, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 69} }, + {44, 54, 5, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 76} }, + {45, 55, 5, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 75} }, + {46, 56, 5, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 74} }, + {47, 57, 5, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_MAGNOLIA, { 73} }, + {48, 58, 6, 0, TRANSVR_TYPE_QSFP, CHIP_TYPE_MAGNOLIA, { 81, 82, 83, 84} }, + {49, 59, 6, 1, TRANSVR_TYPE_QSFP, CHIP_TYPE_MAGNOLIA, { 77, 78, 79, 80} }, + {50, 60, 6, 2, TRANSVR_TYPE_QSFP, CHIP_TYPE_MAGNOLIA, { 97, 98, 99,100} }, + {51, 61, 6, 3, TRANSVR_TYPE_QSFP, CHIP_TYPE_MAGNOLIA, {101,102,103,104} }, + {52, 62, 6, 4, TRANSVR_TYPE_QSFP, CHIP_TYPE_MAGNOLIA, {105,106,107,108} }, + {53, 63, 6, 5, TRANSVR_TYPE_QSFP, CHIP_TYPE_MAGNOLIA, {109,110,111,112} }, }; #endif @@ -234,39 +239,39 @@ struct inv_ioexp_layout_s redwood_ioexp_layout[] = { }; struct inv_port_layout_s redwood_port_layout[] = { - /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ - { 0, 22, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 1, 2, 3, 4} }, - { 1, 23, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 5, 6, 7, 8} }, - { 2, 24, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 9, 10, 11, 12} }, - { 3, 25, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 13, 14, 15, 16} }, - { 4, 26, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 17, 18, 19, 20} }, - { 5, 27, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 21, 22, 23, 24} }, - { 6, 28, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 25, 26, 27, 28} }, - { 7, 29, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 29, 30, 31, 32} }, - { 8, 30, 1, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 33, 34, 35, 36} }, - { 9, 31, 1, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 37, 38, 39, 40} }, - {10, 32, 1, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 41, 42, 43, 44} }, - {11, 33, 1, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 45, 46, 47, 48} }, - {12, 34, 1, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 49, 50, 51, 52} }, - {13, 35, 1, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 53, 54, 55, 56} }, - {14, 36, 1, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 57, 58, 59, 60} }, - {15, 37, 1, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 61, 62, 63, 64} }, - {16, 6, 2, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 65, 66, 67, 68} }, - {17, 7, 2, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 69, 70, 71, 72} }, - {18, 8, 2, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 73, 74, 75, 76} }, - {19, 9, 2, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 77, 78, 79, 80} }, - {20, 10, 2, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 81, 82, 83, 84} }, - {21, 11, 2, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, - {22, 12, 2, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 89, 90, 91, 92} }, - {23, 13, 2, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 93, 94, 95, 96} }, - {24, 14, 3, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, - {25, 15, 3, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, - {26, 16, 3, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, - {27, 17, 3, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, - {28, 18, 3, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {113,114,115,116} }, - {29, 19, 3, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, - {30, 20, 3, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {121,122,123,124} }, - {31, 21, 3, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {125,126,127,128} }, + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / CHIP_TYPE / LANE_ID */ + { 0, 22, 0, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 1, 2, 3, 4} }, + { 1, 23, 0, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 5, 6, 7, 8} }, + { 2, 24, 0, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 9, 10, 11, 12} }, + { 3, 25, 0, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 13, 14, 15, 16} }, + { 4, 26, 0, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 17, 18, 19, 20} }, + { 5, 27, 0, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 21, 22, 23, 24} }, + { 6, 28, 0, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 25, 26, 27, 28} }, + { 7, 29, 0, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 29, 30, 31, 32} }, + { 8, 30, 1, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 33, 34, 35, 36} }, + { 9, 31, 1, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 37, 38, 39, 40} }, + {10, 32, 1, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 41, 42, 43, 44} }, + {11, 33, 1, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 45, 46, 47, 48} }, + {12, 34, 1, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 49, 50, 51, 52} }, + {13, 35, 1, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 53, 54, 55, 56} }, + {14, 36, 1, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 57, 58, 59, 60} }, + {15, 37, 1, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 61, 62, 63, 64} }, + {16, 6, 2, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 65, 66, 67, 68} }, + {17, 7, 2, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 69, 70, 71, 72} }, + {18, 8, 2, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 73, 74, 75, 76} }, + {19, 9, 2, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 77, 78, 79, 80} }, + {20, 10, 2, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 81, 82, 83, 84} }, + {21, 11, 2, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 85, 86, 87, 88} }, + {22, 12, 2, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 89, 90, 91, 92} }, + {23, 13, 2, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 93, 94, 95, 96} }, + {24, 14, 3, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 97, 98, 99,100} }, + {25, 15, 3, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {101,102,103,104} }, + {26, 16, 3, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {105,106,107,108} }, + {27, 17, 3, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {109,110,111,112} }, + {28, 18, 3, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {113,114,115,116} }, + {29, 19, 3, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {117,118,119,120} }, + {30, 20, 3, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {121,122,123,124} }, + {31, 21, 3, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {125,126,127,128} }, }; #endif @@ -299,39 +304,39 @@ struct inv_ioexp_layout_s hudson32iga_ioexp_layout[] = { }; struct inv_port_layout_s hudson32iga_port_layout[] = { - /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ - { 0, 6, 0, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 1, 2, 3, 4} }, - { 1, 7, 0, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 5, 6, 7, 8} }, - { 2, 8, 0, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 9, 10, 11, 12} }, - { 3, 9, 0, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 13, 14, 15, 16} }, - { 4, 10, 0, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 17, 18, 19, 20} }, - { 5, 11, 0, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 21, 22, 23, 24} }, - { 6, 12, 0, 6, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 25, 26, 27, 28} }, - { 7, 13, 0, 7, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 29, 30, 31, 32} }, - { 8, 14, 1, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 33, 34, 35, 36} }, - { 9, 15, 1, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 37, 38, 39, 40} }, - {10, 16, 1, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 41, 42, 43, 44} }, - {11, 17, 1, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 45, 46, 47, 48} }, - {12, 18, 1, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 49, 50, 51, 52} }, - {13, 19, 1, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 53, 54, 55, 56} }, - {14, 20, 1, 6, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 57, 58, 59, 60} }, - {15, 21, 1, 7, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 61, 62, 63, 64} }, - {16, 22, 2, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 65, 66, 67, 68} }, - {17, 23, 2, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 69, 70, 71, 72} }, - {18, 24, 2, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 73, 74, 75, 76} }, - {19, 25, 2, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 77, 78, 79, 80} }, - {20, 26, 2, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 81, 82, 83, 84} }, - {21, 27, 2, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 85, 86, 87, 88} }, - {22, 28, 2, 6, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 89, 90, 91, 92} }, - {23, 29, 2, 7, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 93, 94, 95, 96} }, - {24, 30, 3, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 97, 98, 99,100} }, - {25, 31, 3, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {101,102,103,104} }, - {26, 32, 3, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {105,106,107,108} }, - {27, 33, 3, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {109,110,111,112} }, - {28, 34, 3, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {113,114,115,116} }, - {29, 35, 3, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {117,118,119,120} }, - {30, 36, 3, 6, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {121,122,123,124} }, - {31, 37, 3, 7, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {125,126,127,128} }, + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / CHIP_TYPE / LANE_ID */ + { 0, 6, 0, 0, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 1, 2, 3, 4} }, + { 1, 7, 0, 1, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 5, 6, 7, 8} }, + { 2, 8, 0, 2, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 9, 10, 11, 12} }, + { 3, 9, 0, 3, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 13, 14, 15, 16} }, + { 4, 10, 0, 4, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 17, 18, 19, 20} }, + { 5, 11, 0, 5, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 21, 22, 23, 24} }, + { 6, 12, 0, 6, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 25, 26, 27, 28} }, + { 7, 13, 0, 7, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 29, 30, 31, 32} }, + { 8, 14, 1, 0, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 33, 34, 35, 36} }, + { 9, 15, 1, 1, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 37, 38, 39, 40} }, + {10, 16, 1, 2, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 41, 42, 43, 44} }, + {11, 17, 1, 3, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 45, 46, 47, 48} }, + {12, 18, 1, 4, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 49, 50, 51, 52} }, + {13, 19, 1, 5, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 53, 54, 55, 56} }, + {14, 20, 1, 6, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 57, 58, 59, 60} }, + {15, 21, 1, 7, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 61, 62, 63, 64} }, + {16, 22, 2, 0, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 65, 66, 67, 68} }, + {17, 23, 2, 1, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 69, 70, 71, 72} }, + {18, 24, 2, 2, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 73, 74, 75, 76} }, + {19, 25, 2, 3, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 77, 78, 79, 80} }, + {20, 26, 2, 4, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 81, 82, 83, 84} }, + {21, 27, 2, 5, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 85, 86, 87, 88} }, + {22, 28, 2, 6, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 89, 90, 91, 92} }, + {23, 29, 2, 7, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 93, 94, 95, 96} }, + {24, 30, 3, 0, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 97, 98, 99,100} }, + {25, 31, 3, 1, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, {101,102,103,104} }, + {26, 32, 3, 2, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, {105,106,107,108} }, + {27, 33, 3, 3, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, {109,110,111,112} }, + {28, 34, 3, 4, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, {113,114,115,116} }, + {29, 35, 3, 5, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, {117,118,119,120} }, + {30, 36, 3, 6, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, {121,122,123,124} }, + {31, 37, 3, 7, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, {125,126,127,128} }, }; #endif @@ -351,13 +356,13 @@ struct inv_ioexp_layout_s spruce_ioexp_layout[] = { }; struct inv_port_layout_s spruce_port_layout[] = { - /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ - { 0, 6, 0, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 81, 82, 83, 84} }, - { 1, 7, 0, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 77, 78, 79, 80} }, - { 2, 8, 0, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 97, 98, 99,100} }, - { 3, 9, 0, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {101,102,103,104} }, - { 4, 10, 0, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {105,106,107,108} }, - { 5, 11, 0, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {109,110,111,112} }, + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / CHIP_TYPE / LANE_ID */ + { 0, 6, 0, 0, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 81, 82, 83, 84} }, + { 1, 7, 0, 1, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 77, 78, 79, 80} }, + { 2, 8, 0, 2, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, { 97, 98, 99,100} }, + { 3, 9, 0, 3, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, {101,102,103,104} }, + { 4, 10, 0, 4, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, {105,106,107,108} }, + { 5, 11, 0, 5, TRANSVR_TYPE_QSFP_PLUS, CHIP_TYPE_MAGNOLIA, {109,110,111,112} }, }; #endif @@ -402,61 +407,61 @@ struct inv_ioexp_layout_s cypress_ga1_ioexp_layout[] = { }; struct inv_port_layout_s cypress_ga1_port_layout[] = { - /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ - { 0, 10, 0, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 1} }, - { 1, 11, 0, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 2} }, - { 2, 12, 0, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 3} }, - { 3, 13, 0, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 4} }, - { 4, 14, 0, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 5} }, - { 5, 15, 0, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 6} }, - { 6, 16, 0, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 7} }, - { 7, 17, 0, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 8} }, - { 8, 18, 1, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 9} }, - { 9, 19, 1, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 10} }, - {10, 20, 1, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 11} }, - {11, 21, 1, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 12} }, - {12, 22, 1, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 21} }, - {13, 23, 1, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 22} }, - {14, 24, 1, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 23} }, - {15, 25, 1, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 24} }, - {16, 26, 2, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 33} }, - {17, 27, 2, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 34} }, - {18, 28, 2, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 35} }, - {19, 29, 2, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 36} }, - {20, 30, 2, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 37} }, - {21, 31, 2, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 38} }, - {22, 32, 2, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 39} }, - {23, 33, 2, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 40} }, - {24, 34, 3, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 41} }, - {25, 35, 3, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 42} }, - {26, 36, 3, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 43} }, - {27, 37, 3, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 44} }, - {28, 38, 3, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 49} }, - {29, 39, 3, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 50} }, - {30, 40, 3, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 51} }, - {31, 41, 3, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 52} }, - {32, 42, 4, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 53} }, - {33, 43, 4, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 54} }, - {34, 44, 4, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 55} }, - {35, 45, 4, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 56} }, - {36, 46, 4, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 65} }, - {37, 47, 4, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 66} }, - {38, 48, 4, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 67} }, - {39, 49, 4, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 68} }, - {40, 50, 5, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 69} }, - {41, 51, 5, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 70} }, - {42, 52, 5, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 71} }, - {43, 53, 5, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 72} }, - {44, 54, 5, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 81} }, - {45, 55, 5, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 82} }, - {46, 56, 5, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 83} }, - {47, 57, 5, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 84} }, - {48, 58, 6, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, - {49, 59, 6, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, - {50, 60, 6, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, - {51, 61, 6, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, - {52, 62, 6, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, - {53, 63, 6, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / CHIP_TYPE / LANE_ID */ + { 0, 10, 0, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 1} }, + { 1, 11, 0, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 2} }, + { 2, 12, 0, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 3} }, + { 3, 13, 0, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 4} }, + { 4, 14, 0, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 5} }, + { 5, 15, 0, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 6} }, + { 6, 16, 0, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 7} }, + { 7, 17, 0, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 8} }, + { 8, 18, 1, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 9} }, + { 9, 19, 1, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 10} }, + {10, 20, 1, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 11} }, + {11, 21, 1, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 12} }, + {12, 22, 1, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 21} }, + {13, 23, 1, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 22} }, + {14, 24, 1, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 23} }, + {15, 25, 1, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 24} }, + {16, 26, 2, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 33} }, + {17, 27, 2, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 34} }, + {18, 28, 2, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 35} }, + {19, 29, 2, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 36} }, + {20, 30, 2, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 37} }, + {21, 31, 2, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 38} }, + {22, 32, 2, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 39} }, + {23, 33, 2, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 40} }, + {24, 34, 3, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 41} }, + {25, 35, 3, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 42} }, + {26, 36, 3, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 43} }, + {27, 37, 3, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 44} }, + {28, 38, 3, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 49} }, + {29, 39, 3, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 50} }, + {30, 40, 3, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 51} }, + {31, 41, 3, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 52} }, + {32, 42, 4, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 53} }, + {33, 43, 4, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 54} }, + {34, 44, 4, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 55} }, + {35, 45, 4, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 56} }, + {36, 46, 4, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 65} }, + {37, 47, 4, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 66} }, + {38, 48, 4, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 67} }, + {39, 49, 4, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 68} }, + {40, 50, 5, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 69} }, + {41, 51, 5, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 70} }, + {42, 52, 5, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 71} }, + {43, 53, 5, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 72} }, + {44, 54, 5, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 81} }, + {45, 55, 5, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 82} }, + {46, 56, 5, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 83} }, + {47, 57, 5, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 84} }, + {48, 58, 6, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 97, 98, 99,100} }, + {49, 59, 6, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 85, 86, 87, 88} }, + {50, 60, 6, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {101,102,103,104} }, + {51, 61, 6, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {105,106,107,108} }, + {52, 62, 6, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {109,110,111,112} }, + {53, 63, 6, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {117,118,119,120} }, }; #endif @@ -501,65 +506,163 @@ struct inv_ioexp_layout_s cypress_ga2_ioexp_layout[] = { }; struct inv_port_layout_s cypress_ga2_port_layout[] = { - /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ - { 0, 11, 0, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 2} }, - { 1, 10, 0, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 1} }, - { 2, 13, 0, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 4} }, - { 3, 12, 0, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 3} }, - { 4, 15, 0, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 6} }, - { 5, 14, 0, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 5} }, - { 6, 17, 0, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 8} }, - { 7, 16, 0, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 7} }, - { 8, 19, 1, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 10} }, - { 9, 18, 1, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 9} }, - {10, 21, 1, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 12} }, - {11, 20, 1, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 11} }, - {12, 23, 1, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 22} }, - {13, 22, 1, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 21} }, - {14, 25, 1, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 24} }, - {15, 24, 1, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 23} }, - {16, 27, 2, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 34} }, - {17, 26, 2, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 33} }, - {18, 29, 2, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 36} }, - {19, 28, 2, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 35} }, - {20, 31, 2, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 38} }, - {21, 30, 2, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 37} }, - {22, 33, 2, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 40} }, - {23, 32, 2, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 39} }, - {24, 35, 3, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 42} }, - {25, 34, 3, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 41} }, - {26, 37, 3, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 44} }, - {27, 36, 3, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 43} }, - {28, 39, 3, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 50} }, - {29, 38, 3, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 49} }, - {30, 41, 3, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 52} }, - {31, 40, 3, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 51} }, - {32, 43, 4, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 54} }, - {33, 42, 4, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 53} }, - {34, 45, 4, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 56} }, - {35, 44, 4, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 55} }, - {36, 47, 4, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 66} }, - {37, 46, 4, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 65} }, - {38, 49, 4, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 68} }, - {39, 48, 4, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 67} }, - {40, 51, 5, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 70} }, - {41, 50, 5, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 69} }, - {42, 53, 5, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 72} }, - {43, 52, 5, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 71} }, - {44, 55, 5, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 82} }, - {45, 54, 5, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 81} }, - {46, 57, 5, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 84} }, - {47, 56, 5, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 83} }, - {48, 59, 6, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, - {49, 58, 6, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, - {50, 61, 6, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, - {51, 60, 6, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, - {52, 63, 6, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, - {53, 62, 6, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / CHIP_TYPE / LANE_ID */ + { 0, 11, 0, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 2} }, + { 1, 10, 0, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 1} }, + { 2, 13, 0, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 4} }, + { 3, 12, 0, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 3} }, + { 4, 15, 0, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 6} }, + { 5, 14, 0, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 5} }, + { 6, 17, 0, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 8} }, + { 7, 16, 0, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 7} }, + { 8, 19, 1, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 10} }, + { 9, 18, 1, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 9} }, + {10, 21, 1, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 12} }, + {11, 20, 1, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 11} }, + {12, 23, 1, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 22} }, + {13, 22, 1, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 21} }, + {14, 25, 1, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 24} }, + {15, 24, 1, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 23} }, + {16, 27, 2, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 34} }, + {17, 26, 2, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 33} }, + {18, 29, 2, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 36} }, + {19, 28, 2, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 35} }, + {20, 31, 2, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 38} }, + {21, 30, 2, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 37} }, + {22, 33, 2, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 40} }, + {23, 32, 2, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 39} }, + {24, 35, 3, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 42} }, + {25, 34, 3, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 41} }, + {26, 37, 3, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 44} }, + {27, 36, 3, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 43} }, + {28, 39, 3, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 50} }, + {29, 38, 3, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 49} }, + {30, 41, 3, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 52} }, + {31, 40, 3, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 51} }, + {32, 43, 4, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 54} }, + {33, 42, 4, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 53} }, + {34, 45, 4, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 56} }, + {35, 44, 4, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 55} }, + {36, 47, 4, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 66} }, + {37, 46, 4, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 65} }, + {38, 49, 4, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 68} }, + {39, 48, 4, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 67} }, + {40, 51, 5, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 70} }, + {41, 50, 5, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 69} }, + {42, 53, 5, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 72} }, + {43, 52, 5, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 71} }, + {44, 55, 5, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 82} }, + {45, 54, 5, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 81} }, + {46, 57, 5, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 84} }, + {47, 56, 5, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 83} }, + {48, 59, 6, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 85, 86, 87, 88} }, + {49, 58, 6, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 97, 98, 99,100} }, + {50, 61, 6, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {105,106,107,108} }, + {51, 60, 6, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {101,102,103,104} }, + {52, 63, 6, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {117,118,119,120} }, + {53, 62, 6, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {109,110,111,112} }, }; #endif +/* ========================================== + * Cypress Layout configuration (BaiDu version) + * ========================================== + */ +#ifdef SWPS_CYPRESS_BAI +unsigned cypress_b_gpio_rest_mux = MUX_RST_GPIO_FORCE_HEDERA; + +struct inv_ioexp_layout_s cypress_b_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_CYPRESS_NABC, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {1, IOEXP_TYPE_CYPRESS_NABC, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {2, IOEXP_TYPE_CYPRESS_NABC, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {3, IOEXP_TYPE_CYPRESS_NABC, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {4, IOEXP_TYPE_CYPRESS_NABC, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {6, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {5, IOEXP_TYPE_CYPRESS_NABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {6, IOEXP_TYPE_CYPRESS_7ABC, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xc0, 0xc0}, }, /* addr[0] = I/O Expander 7 A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xc0, 0xc0}, {0xff, 0xc0}, }, /* addr[1] = I/O Expander 7 B */ + {8, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 7 C */ + }, +}; + +struct inv_port_layout_s cypress_b_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / CHIP_TYPE / LANE_ID */ + { 1, 11, 0, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 2} }, + { 2, 10, 0, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 1} }, + { 3, 13, 0, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 4} }, + { 4, 12, 0, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 3} }, + { 5, 15, 0, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 6} }, + { 6, 14, 0, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 5} }, + { 7, 17, 0, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 8} }, + { 8, 16, 0, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 7} }, + { 9, 19, 1, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 10} }, + {10, 18, 1, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 9} }, + {11, 21, 1, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 12} }, + {12, 20, 1, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 11} }, + {13, 23, 1, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 22} }, + {14, 22, 1, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 21} }, + {15, 25, 1, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 24} }, + {16, 24, 1, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 23} }, + {17, 27, 2, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 34} }, + {18, 26, 2, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 33} }, + {19, 29, 2, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 36} }, + {20, 28, 2, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 35} }, + {21, 31, 2, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 38} }, + {22, 30, 2, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 37} }, + {23, 33, 2, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 40} }, + {24, 32, 2, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 39} }, + {25, 35, 3, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 42} }, + {26, 34, 3, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 41} }, + {27, 37, 3, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 44} }, + {28, 36, 3, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 43} }, + {29, 39, 3, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 50} }, + {30, 38, 3, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 49} }, + {31, 41, 3, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 52} }, + {32, 40, 3, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 51} }, + {33, 43, 4, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 54} }, + {34, 42, 4, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 53} }, + {35, 45, 4, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 56} }, + {36, 44, 4, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 55} }, + {37, 47, 4, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 66} }, + {38, 46, 4, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 65} }, + {39, 49, 4, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 68} }, + {40, 48, 4, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 67} }, + {41, 51, 5, 1, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 70} }, + {42, 50, 5, 0, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 69} }, + {43, 53, 5, 3, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 72} }, + {44, 52, 5, 2, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 71} }, + {45, 55, 5, 5, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 82} }, + {46, 54, 5, 4, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 81} }, + {47, 57, 5, 7, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 84} }, + {48, 56, 5, 6, TRANSVR_TYPE_SFP, CHIP_TYPE_REDWOOD, { 83} }, + {49, 59, 6, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 85, 86, 87, 88} }, + {50, 58, 6, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 97, 98, 99,100} }, + {51, 61, 6, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {105,106,107,108} }, + {52, 60, 6, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {101,102,103,104} }, + {53, 63, 6, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {117,118,119,120} }, + {54, 62, 6, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {109,110,111,112} }, +}; +#endif + /* ========================================== * Redwood_fsl Layout configuration @@ -590,39 +693,39 @@ struct inv_ioexp_layout_s redwood_fsl_ioexp_layout[] = { struct inv_port_layout_s redwood_fsl_port_layout[] = { - /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ - { 0, 22, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 1, 2, 3, 4} }, - { 1, 23, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 5, 6, 7, 8} }, - { 2, 24, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 9, 10, 11, 12} }, - { 3, 25, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 13, 14, 15, 16} }, - { 4, 26, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 17, 18, 19, 20} }, - { 5, 27, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 21, 22, 23, 24} }, - { 6, 28, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 25, 26, 27, 28} }, - { 7, 29, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 29, 30, 31, 32} }, - { 8, 30, 1, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 33, 34, 35, 36} }, - { 9, 31, 1, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 37, 38, 39, 40} }, - {10, 32, 1, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 41, 42, 43, 44} }, - {11, 33, 1, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 45, 46, 47, 48} }, - {12, 34, 1, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 49, 50, 51, 52} }, - {13, 35, 1, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 53, 54, 55, 56} }, - {14, 36, 1, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 57, 58, 59, 60} }, - {15, 37, 1, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 61, 62, 63, 64} }, - {16, 6, 2, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 65, 66, 67, 68} }, - {17, 7, 2, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 69, 70, 71, 72} }, - {18, 8, 2, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 73, 74, 75, 76} }, - {19, 9, 2, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 77, 78, 79, 80} }, - {20, 10, 2, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 81, 82, 83, 84} }, - {21, 11, 2, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, - {22, 12, 2, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 89, 90, 91, 92} }, - {23, 13, 2, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 93, 94, 95, 96} }, - {24, 14, 3, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, - {25, 15, 3, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, - {26, 16, 3, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, - {27, 17, 3, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, - {28, 18, 3, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {113,114,115,116} }, - {29, 19, 3, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, - {30, 20, 3, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {121,122,123,124} }, - {31, 21, 3, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {125,126,127,128} }, + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / CHIP_TYPE / LANE_ID */ + { 0, 22, 0, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 1, 2, 3, 4} }, + { 1, 23, 0, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 5, 6, 7, 8} }, + { 2, 24, 0, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 9, 10, 11, 12} }, + { 3, 25, 0, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 13, 14, 15, 16} }, + { 4, 26, 0, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 17, 18, 19, 20} }, + { 5, 27, 0, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 21, 22, 23, 24} }, + { 6, 28, 0, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 25, 26, 27, 28} }, + { 7, 29, 0, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 29, 30, 31, 32} }, + { 8, 30, 1, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 33, 34, 35, 36} }, + { 9, 31, 1, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 37, 38, 39, 40} }, + {10, 32, 1, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 41, 42, 43, 44} }, + {11, 33, 1, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 45, 46, 47, 48} }, + {12, 34, 1, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 49, 50, 51, 52} }, + {13, 35, 1, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 53, 54, 55, 56} }, + {14, 36, 1, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 57, 58, 59, 60} }, + {15, 37, 1, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 61, 62, 63, 64} }, + {16, 6, 2, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 65, 66, 67, 68} }, + {17, 7, 2, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 69, 70, 71, 72} }, + {18, 8, 2, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 73, 74, 75, 76} }, + {19, 9, 2, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 77, 78, 79, 80} }, + {20, 10, 2, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 81, 82, 83, 84} }, + {21, 11, 2, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 85, 86, 87, 88} }, + {22, 12, 2, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 89, 90, 91, 92} }, + {23, 13, 2, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 93, 94, 95, 96} }, + {24, 14, 3, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, { 97, 98, 99,100} }, + {25, 15, 3, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {101,102,103,104} }, + {26, 16, 3, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {105,106,107,108} }, + {27, 17, 3, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {109,110,111,112} }, + {28, 18, 3, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {113,114,115,116} }, + {29, 19, 3, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {117,118,119,120} }, + {30, 20, 3, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {121,122,123,124} }, + {31, 21, 3, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_REDWOOD, {125,126,127,128} }, }; #endif @@ -682,76 +785,76 @@ struct inv_ioexp_layout_s lavender_ioexp_layout[] = { }; struct inv_port_layout_s lavender_port_layout[] = { - /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ - { 0, 17, 0, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 1, 2, 3, 4} }, - { 1, 18, 0, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 5, 6, 7, 8} }, - { 2, 19, 0, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 9, 10, 11, 12} }, - { 3, 20, 0, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 13, 14, 15, 16} }, - { 4, 21, 0, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 17, 18, 19, 20} }, - { 5, 22, 0, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 21, 22, 23, 24} }, - { 6, 23, 0, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 25, 26, 27, 28} }, - { 7, 24, 0, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 29, 30, 31, 32} }, - { 8, 25, 1, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 33, 34, 35, 36} }, - { 9, 26, 1, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 37, 38, 39, 40} }, - {10, 27, 1, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 41, 42, 43, 44} }, - {11, 28, 1, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 45, 46, 47, 48} }, - {12, 29, 1, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 49, 50, 51, 52} }, - {13, 30, 1, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 53, 54, 55, 56} }, - {14, 31, 1, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 57, 58, 59, 60} }, - {15, 32, 1, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 61, 62, 63, 64} }, - {16, 33, 2, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 65, 66, 67, 68} }, - {17, 34, 2, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 69, 70, 71, 72} }, - {18, 35, 2, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 73, 74, 75, 76} }, - {19, 36, 2, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 77, 78, 79, 80} }, - {20, 37, 2, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 81, 82, 83, 84} }, - {21, 38, 2, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 85, 86, 87, 88} }, - {22, 39, 2, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 89, 90, 91, 92} }, - {23, 40, 2, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 93, 94, 95, 96} }, - {24, 41, 3, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, { 97, 98, 99,100} }, - {25, 42, 3, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {101,102,103,104} }, - {26, 43, 3, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {105,106,107,108} }, - {27, 44, 3, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {109,110,111,112} }, - {28, 45, 3, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {113,114,115,116} }, - {29, 46, 3, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {117,118,119,120} }, - {30, 47, 3, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {121,122,123,124} }, - {31, 48, 3, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {125,126,127,128} }, + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / CHIP_TYPE / LANE_ID */ + { 0, 17, 0, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 1, 2, 3, 4} }, + { 1, 18, 0, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 5, 6, 7, 8} }, + { 2, 19, 0, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 9, 10, 11, 12} }, + { 3, 20, 0, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 13, 14, 15, 16} }, + { 4, 21, 0, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 17, 18, 19, 20} }, + { 5, 22, 0, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 21, 22, 23, 24} }, + { 6, 23, 0, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 25, 26, 27, 28} }, + { 7, 24, 0, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 29, 30, 31, 32} }, + { 8, 25, 1, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 33, 34, 35, 36} }, + { 9, 26, 1, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 37, 38, 39, 40} }, + {10, 27, 1, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 41, 42, 43, 44} }, + {11, 28, 1, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 45, 46, 47, 48} }, + {12, 29, 1, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 49, 50, 51, 52} }, + {13, 30, 1, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 53, 54, 55, 56} }, + {14, 31, 1, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 57, 58, 59, 60} }, + {15, 32, 1, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 61, 62, 63, 64} }, + {16, 33, 2, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 65, 66, 67, 68} }, + {17, 34, 2, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 69, 70, 71, 72} }, + {18, 35, 2, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 73, 74, 75, 76} }, + {19, 36, 2, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 77, 78, 79, 80} }, + {20, 37, 2, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 81, 82, 83, 84} }, + {21, 38, 2, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 85, 86, 87, 88} }, + {22, 39, 2, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 89, 90, 91, 92} }, + {23, 40, 2, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 93, 94, 95, 96} }, + {24, 41, 3, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, { 97, 98, 99,100} }, + {25, 42, 3, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {101,102,103,104} }, + {26, 43, 3, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {105,106,107,108} }, + {27, 44, 3, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {109,110,111,112} }, + {28, 45, 3, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {113,114,115,116} }, + {29, 46, 3, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {117,118,119,120} }, + {30, 47, 3, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {121,122,123,124} }, + {31, 48, 3, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {125,126,127,128} }, - {32, 49, 4, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {129,130,131,132} }, - {33, 50, 4, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {133,134,135,136} }, - {34, 51, 4, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {137,138,139,140} }, - {35, 52, 4, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {141,142,143,144} }, - {36, 53, 4, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {145,146,147,148} }, - {37, 54, 4, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {149,150,151,152} }, - {38, 55, 4, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {153,154,155,156} }, - {39, 56, 4, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {157,158,159,160} }, + {32, 49, 4, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {129,130,131,132} }, + {33, 50, 4, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {133,134,135,136} }, + {34, 51, 4, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {137,138,139,140} }, + {35, 52, 4, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {141,142,143,144} }, + {36, 53, 4, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {145,146,147,148} }, + {37, 54, 4, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {149,150,151,152} }, + {38, 55, 4, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {153,154,155,156} }, + {39, 56, 4, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {157,158,159,160} }, - {40, 57, 5, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {161,162,163,164} }, - {41, 58, 5, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {165,166,167,168} }, - {42, 59, 5, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {169,170,171,172} }, - {43, 60, 5, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {173,174,175,176} }, - {44, 61, 5, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {177,178,179,180} }, - {45, 62, 5, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {181,182,183,184} }, - {46, 63, 5, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {185,186,187,188} }, - {47, 64, 5, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {189,190,191,192} }, + {40, 57, 5, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {161,162,163,164} }, + {41, 58, 5, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {165,166,167,168} }, + {42, 59, 5, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {169,170,171,172} }, + {43, 60, 5, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {173,174,175,176} }, + {44, 61, 5, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {177,178,179,180} }, + {45, 62, 5, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {181,182,183,184} }, + {46, 63, 5, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {185,186,187,188} }, + {47, 64, 5, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {189,190,191,192} }, - {48, 65, 6, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {193,194,195,196} }, - {49, 66, 6, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {197,198,199,200} }, - {50, 67, 6, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {201,202,203,204} }, - {51, 68, 6, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {205,206,207,208} }, - {52, 69, 6, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {209,210,211,212} }, - {53, 70, 6, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {213,214,215,216} }, - {54, 71, 6, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {217,218,219,220} }, - {55, 72, 6, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {221,222,223,224} }, + {48, 65, 6, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {193,194,195,196} }, + {49, 66, 6, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {197,198,199,200} }, + {50, 67, 6, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {201,202,203,204} }, + {51, 68, 6, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {205,206,207,208} }, + {52, 69, 6, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {209,210,211,212} }, + {53, 70, 6, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {213,214,215,216} }, + {54, 71, 6, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {217,218,219,220} }, + {55, 72, 6, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {221,222,223,224} }, - {56, 73, 7, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {225,226,227,228} }, - {57, 74, 7, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {229,230,231,232} }, - {58, 75, 7, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {233,234,235,236} }, - {59, 76, 7, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {237,238,239,240} }, - {60, 77, 7, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {241,242,243,244} }, - {61, 78, 7, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {245,246,247,248} }, - {62, 79, 7, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {249,250,251,252} }, - {63, 80, 7, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {253,254,255,256} }, - {64, 5, 8, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_D5264Q28B, {257,258,259,260} }, + {56, 73, 7, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {225,226,227,228} }, + {57, 74, 7, 1, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {229,230,231,232} }, + {58, 75, 7, 2, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {233,234,235,236} }, + {59, 76, 7, 3, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {237,238,239,240} }, + {60, 77, 7, 4, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {241,242,243,244} }, + {61, 78, 7, 5, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {245,246,247,248} }, + {62, 79, 7, 6, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {249,250,251,252} }, + {63, 80, 7, 7, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {253,254,255,256} }, + {64, 5, 8, 0, TRANSVR_TYPE_QSFP_28, CHIP_TYPE_LAVENDER, {257,258,259,260} }, }; #endif diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/transceiver.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/transceiver.c index a4a509a8..dbfaabce 100644 --- a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/transceiver.c +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/transceiver.c @@ -4693,7 +4693,7 @@ err_taskfunc_sfp_handle_1g_rj45_2: * => In this case, SWPS will stop external Link state monitor features * and keeps transvr_p->info on TRANSVR_CLASS_BASE_T_1000_up. * Upper layer will see it always Linkup that because of these type of - * transceiver has external phy, BCM chip see it as Loopback transceiver. + * transceiver has external phy, chip see it as Loopback transceiver. */ SWPS_WARN("%s can not access external PHY of Base-T SFP transceiver\n", task_p->transvr_p->swp_name); @@ -5638,7 +5638,7 @@ err_sft_detect_transceiver_class_1: int -_sfp_set_trident2_if_type(struct transvr_obj_s* self, +_sfp_set_magnolia_if_type(struct transvr_obj_s* self, int transvr_cls, char *result){ @@ -5689,13 +5689,13 @@ _sfp_set_trident2_if_type(struct transvr_obj_s* self, snprintf(err_msg, sizeof(err_msg), "Detect undefined value:%d", transvr_cls); - goto err_sfp_set_trident2_if_type_1; + goto err_sfp_set_magnolia_if_type_1; } /* Exception case: Can't verify */ snprintf(err_msg, sizeof(err_msg), "Can not identify!"); - goto err_sfp_set_trident2_if_type_1; + goto err_sfp_set_magnolia_if_type_1; -err_sfp_set_trident2_if_type_1: +err_sfp_set_magnolia_if_type_1: snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); return ERR_TRANSVR_ABNORMAL; @@ -5703,7 +5703,7 @@ err_sfp_set_trident2_if_type_1: int -_sfp_set_tomahawk_if_type(struct transvr_obj_s* self, +_sfp_set_redwood_if_type(struct transvr_obj_s* self, int transvr_cls, char *result) { @@ -5754,13 +5754,13 @@ _sfp_set_tomahawk_if_type(struct transvr_obj_s* self, snprintf(err_msg, sizeof(err_msg), "Detect undefined value:%d", transvr_cls); - goto err_sfp_set_tomahawk_if_type_1; + goto err_sfp_set_redwood_if_type_1; } /* Exception case: Can't verify */ snprintf(err_msg, sizeof(err_msg), "Can not identify!"); - goto err_sfp_set_tomahawk_if_type_1; + goto err_sfp_set_redwood_if_type_1; -err_sfp_set_tomahawk_if_type_1: +err_sfp_set_redwood_if_type_1: snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); return ERR_TRANSVR_ABNORMAL; @@ -5776,11 +5776,11 @@ _sfp_detect_if_type(struct transvr_obj_s* self, detect_cls = sft_detect_transvr_class(self); switch (self->chipset_type) { - case BCM_CHIP_TYPE_TRIDENT_2: - return _sfp_set_trident2_if_type(self, detect_cls, result); + case CHIP_TYPE_MAGNOLIA: + return _sfp_set_magnolia_if_type(self, detect_cls, result); - case BCM_CHIP_TYPE_TOMAHAWK: - return _sfp_set_tomahawk_if_type(self, detect_cls, result); + case CHIP_TYPE_REDWOOD: + return _sfp_set_redwood_if_type(self, detect_cls, result); default: SWPS_INFO("%s: non-defined chipset_type:%d :%s\n", @@ -6255,7 +6255,7 @@ err_qsft_detect_transvr_class_1: int -_qsfp_set_trident2_if_type(struct transvr_obj_s* self, +_qsfp_set_magnolia_if_type(struct transvr_obj_s* self, int transvr_cls, char *result){ @@ -6304,13 +6304,13 @@ _qsfp_set_trident2_if_type(struct transvr_obj_s* self, snprintf(err_msg, sizeof(err_msg), "Detect undefined value:%d", transvr_cls); - goto err_qsfp_set_trident2_if_type_1; + goto err_qsfp_set_magnolia_if_type_1; } /* Exception case: Can't verify */ snprintf(err_msg, sizeof(err_msg), "Can not identify!"); - goto err_qsfp_set_trident2_if_type_1; + goto err_qsfp_set_magnolia_if_type_1; -err_qsfp_set_trident2_if_type_1: +err_qsfp_set_magnolia_if_type_1: snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); return ERR_TRANSVR_ABNORMAL; @@ -6318,7 +6318,7 @@ err_qsfp_set_trident2_if_type_1: int -_qsfp_set_tomahawk_if_type(struct transvr_obj_s* self, +_qsfp_set_redwood_if_type(struct transvr_obj_s* self, int transvr_cls, char *result){ @@ -6367,13 +6367,13 @@ _qsfp_set_tomahawk_if_type(struct transvr_obj_s* self, snprintf(err_msg, sizeof(err_msg), "Detect undefined value:%d", transvr_cls); - goto err_qsfp_set_trident2_if_type_1; + goto err_qsfp_set_magnolia_if_type_1; } /* Exception case: Can't verify */ snprintf(err_msg, sizeof(err_msg), "Can not identify!"); - goto err_qsfp_set_trident2_if_type_1; + goto err_qsfp_set_magnolia_if_type_1; -err_qsfp_set_trident2_if_type_1: +err_qsfp_set_magnolia_if_type_1: snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); return ERR_TRANSVR_ABNORMAL; @@ -6389,11 +6389,11 @@ _qsfp_detect_if_type(struct transvr_obj_s* self, detect_cls = qsft_detect_transvr_class(self); switch (self->chipset_type) { - case BCM_CHIP_TYPE_TRIDENT_2: - return _qsfp_set_trident2_if_type(self, detect_cls, result); + case CHIP_TYPE_MAGNOLIA: + return _qsfp_set_magnolia_if_type(self, detect_cls, result); - case BCM_CHIP_TYPE_TOMAHAWK: - return _qsfp_set_tomahawk_if_type(self, detect_cls, result); + case CHIP_TYPE_REDWOOD: + return _qsfp_set_redwood_if_type(self, detect_cls, result); default: SWPS_INFO("%s: non-defined chipset_type:%d :%s\n", diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/transceiver.h b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/transceiver.h index 5eee7db2..aaeb8543 100644 --- a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/transceiver.h +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/modules/builds/src/transceiver.h @@ -202,12 +202,10 @@ #define VAL_OPTICAL_WAVELENGTH_LR (1310) #define VAL_OPTICAL_WAVELENGTH_ER (1550) -/* BCM chip type define */ -#define BCM_CHIP_TYPE_TRIDENT_2 (31001) /* Magnolia, Hudson32i, Spruce */ -#define BCM_CHIP_TYPE_TOMAHAWK (31002) /* Redwood, Cypress */ +#define CHIP_TYPE_MAGNOLIA (31001) /* Magnolia, Hudson32i, Spruce */ +#define CHIP_TYPE_REDWOOD (31002) /* Redwood, Cypress */ -/* Lavender chip type define */ -#define CHIP_TYPE_D5264Q28B (31003) /* Lavender */ +#define CHIP_TYPE_LAVENDER (31003) /* Lavender */ /* Info from transceiver EEPROM */ struct eeprom_map_s { diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/onlp/builds/src/module/src/platform_lib.h b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/onlp/builds/src/module/src/platform_lib.h index a3405d8c..face6407 100644 --- a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/onlp/builds/src/module/src/platform_lib.h +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/onlp/builds/src/module/src/platform_lib.h @@ -89,6 +89,7 @@ enum onlp_thermal_id { }; #define ONLP_THERMAL_COUNT 14 /*include "reserved"*/ +#define THERMAL_ON_CHASSIS 10 /* Fan definitions*/ enum onlp_fan_id { @@ -102,6 +103,7 @@ enum onlp_fan_id { }; #define ONLP_FAN_COUNT 6 /*include "reserved"*/ +#define FAN_ON_CHASSIS 4 /* PSU definitions*/ enum onlp_psu_id { @@ -111,6 +113,7 @@ enum onlp_psu_id { }; #define ONLP_PSU_COUNT 2 /*include "reserved"*/ +#define PSU_ON_CHASSIS 2 /* LED definitions*/ enum onlp_led_id { @@ -123,7 +126,7 @@ enum onlp_led_id { }; #define ONLP_LED_COUNT 5 /*include "reserved"*/ - +#define LED_ON_CHASSIS 1 /* platform functions*/ #define PLATFORM_HWMON_DIAG_LOCK platform_hwmon_diag_enable_write(0) diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/onlp/builds/src/module/src/psui.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/onlp/builds/src/module/src/psui.c index 1c260d22..8c8e2245 100644 --- a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/onlp/builds/src/module/src/psui.c +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/onlp/builds/src/module/src/psui.c @@ -86,10 +86,9 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) return ONLP_STATUS_E_INVALID; } - *info = __onlp_psu_info[LOCAL_ID_TO_INFO_IDX(local_id)]; /* Set the onlp_oid_hdr_t */ - ret = onlp_file_read(temp, ONLP_CONFIG_INFO_STR_MAX, &len, INV_HWMON_PREFIX"psoc_psu%d_vender", local_id); + ret = onlp_file_read(temp, ONLP_CONFIG_INFO_STR_MAX, &len, INV_HWMON_PREFIX"psoc_psu%d_vendor", local_id); if(ret != ONLP_STATUS_OK){ return ret; } /*remove the '\n'*/ temp[strlen((char*)temp)-1] = 0; @@ -166,7 +165,7 @@ int onlp_psui_status_get(onlp_oid_t id, uint32_t* rv) if(local_id >= ONLP_PSU_MAX) { result = ONLP_STATUS_E_INVALID; } else { - result = onlp_file_read((uint8_t*)&buf, ONLP_CONFIG_INFO_STR_MAX, &len, "%s""psu%d", INV_HWMON_PREFIX, local_id-1); + result = onlp_file_read((uint8_t*)&buf, ONLP_CONFIG_INFO_STR_MAX, &len, "%s""psu%d", INV_HWMON_PREFIX, local_id); if( result != ONLP_STATUS_OK ){return result;} psu_state = (uint8_t)strtoul(buf, NULL, 0); if( psu_state == HWMON_PSU_UNPOWERED) { diff --git a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/onlp/builds/src/module/src/sysi.c b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/onlp/builds/src/module/src/sysi.c index 602f9632..9054d377 100644 --- a/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/onlp/builds/src/module/src/sysi.c +++ b/packages/platforms/inventec/x86-64/x86-64-inventec-d5264q28b/onlp/builds/src/module/src/sysi.c @@ -385,7 +385,6 @@ onlp_sysi_platform_info_free(onlp_platform_info_t* pi) return; } - int onlp_sysi_oids_get(onlp_oid_t* table, int max) { @@ -393,21 +392,22 @@ onlp_sysi_oids_get(onlp_oid_t* table, int max) onlp_oid_t* e = table; memset(table, 0, max*sizeof(onlp_oid_t)); - for(i=1; i $CPLD_ADDR/ctl while true do - psu0var=$(cat /sys/bus/i2c/devices/i2c-0/0-0055/psu0) # bottom PSU - psu1var=$(cat /sys/bus/i2c/devices/i2c-0/0-0055/psu1) # top PSU - fan1in=$(cat /sys/class/hwmon/hwmon1/device/fan1_input) # fanmodule1, far right, back view - fan2in=$(cat /sys/class/hwmon/hwmon1/device/fan2_input) # fanmodule1, far right, back view - fan3in=$(cat /sys/class/hwmon/hwmon1/device/fan3_input) # fanmodule2 - fan4in=$(cat /sys/class/hwmon/hwmon1/device/fan4_input) # fanmodule2 - fan5in=$(cat /sys/class/hwmon/hwmon1/device/fan5_input) # fanmodule3 - fan6in=$(cat /sys/class/hwmon/hwmon1/device/fan6_input) # fanmodule3 - fan7in=$(cat /sys/class/hwmon/hwmon1/device/fan7_input) # fanmodule4, far left, back view - fan8in=$(cat /sys/class/hwmon/hwmon1/device/fan8_input) # fanmodule4, far left, back view - if [ "$psu0var" = "$normal" ] && - [ "$psu1var" = "$normal" ] && # PSU normal operation - [ "$fan1in" -gt 0 ] && [ "$fan2in" -gt 0 ] && # fan on - [ "$fan3in" -gt 0 ] && [ "$fan4in" -gt 0 ] && - [ "$fan5in" -gt 0 ] && [ "$fan6in" -gt 0 ] && - [ "$fan7in" -gt 0 ] && [ "$fan8in" -gt 0 ] - then - echo 1 > /sys/bus/i2c/devices/i2c-0/0-0055/ctl - echo 0 > /sys/bus/i2c/devices/i2c-0/0-0055/red_led # red off - echo 7 > /sys/bus/i2c/devices/i2c-0/0-0055/grn_led # grn solid +#monitor how many fan modules are unplugged - elif [ "$psu0var" = "$unpowered" ] || - [ "$psu1var" = "$unpowered" ] || # PSU unpowered - [ "$fan1in" -eq 0 ] || [ "$fan2in" -eq 0 ] || # fan off - [ "$fan3in" -eq 0 ] || [ "$fan4in" -eq 0 ] || - [ "$fan5in" -eq 0 ] || [ "$fan6in" -eq 0 ] || - [ "$fan7in" -eq 0 ] || [ "$fan8in" -eq 0 ] - then - echo 1 > /sys/bus/i2c/devices/i2c-0/0-0055/ctl - echo 0 > /sys/bus/i2c/devices/i2c-0/0-0055/red_led # red off - echo 3 > /sys/bus/i2c/devices/i2c-0/0-0055/grn_led # grn @2Hz - elif [ "$psu0var" = "$fault" ] || - [ "$psu0var" = "$notinstalled" ] || - [ "$psu1var" = "$fault" ] || - [ "$psu1var" = "$notinstalled" ] # PSU fault or PSU not installed - then - echo 1 > /sys/bus/i2c/devices/i2c-0/0-0055/ctl - echo 0 > /sys/bus/i2c/devices/i2c-0/0-0055/grn_led # grn off - echo 7 > /sys/bus/i2c/devices/i2c-0/0-0055/red_led # red solid - fi +#first check +FAN_UNPLUG_NUM=0 +FAN_ARR=$(cat $PSOC_PATH/$FAN_LED_RED?) + +while read -r line; do + fan_led_red_check=$(echo "$line") + if [ $fan_led_red_check -eq 1 ] + then + let FAN_UNPLUG_NUM=FAN_UNPLUG_NUM+1 + fi +done <<< "$FAN_ARR" +FIRST_READ=$FAN_UNPLUG_NUM + +#second check +FAN_UNPLUG_NUM=0 +FAN_ARR=$(cat $PSOC_PATH/$FAN_LED_RED?) + +while read -r line; do + fan_led_red_check=$(echo "$line") + if [ $fan_led_red_check -eq 1 ] + then + let FAN_UNPLUG_NUM=FAN_UNPLUG_NUM+1 + fi +done <<< "$FAN_ARR" +SECOND_READ=$FAN_UNPLUG_NUM + +if [ $FIRST_READ -ne $SECOND_READ ] +then + #echo "not equl:$FIRST_READ != $SECOND_READ" + continue +fi + +if [ $FAN_UNPLUG_NUM -ge 2 ] +then + #echo "red @2Hz" + echo 7 > $CPLD_ADDR/red_led + echo 0 > $CPLD_ADDR/grn_led sleep 1 + continue +elif [ $FAN_UNPLUG_NUM -eq 1 ] +then + #echo "solid red" + echo 3 > $CPLD_ADDR/red_led + echo 0 > $CPLD_ADDR/grn_led + sleep 1 + continue +fi + + #echo "normal" + psu0var=$(cat $CPLD_ADDR/psu0) # bottom PSU + psu1var=$(cat $CPLD_ADDR/psu1) # top PSU + + if [ "$psu0var" = "$normal" ] && + [ "$psu1var" = "$normal" ] # PSU normal operatio + then + #echo "solid green" + echo 7 > $CPLD_ADDR/grn_led + echo 0 > $CPLD_ADDR/red_led + else + if [ "$psu0var" = "$unpowered" ] || + [ "$psu1var" = "$unpowered" ] + then + #echo "grn @2Hz" + echo 3 > $CPLD_ADDR/grn_led + echo 0 > $CPLD_ADDR/red_led + fi + + fi + + +sleep 1 done +