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