diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/.gitignore b/packages/platforms/accton/x86-64-accton-as5812-54x/.gitignore
new file mode 100644
index 00000000..746e8f06
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/.gitignore
@@ -0,0 +1,3 @@
+libonlp-x86-64-accton-as5812-54x-r0.mk
+onlpdump.mk
+x86_64_accton_as5812_54x.mk
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/Makefile b/packages/platforms/accton/x86-64-accton-as5812-54x/Makefile
new file mode 100644
index 00000000..003238cf
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/Makefile
@@ -0,0 +1 @@
+include $(ONL)/make/pkg.mk
\ No newline at end of file
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/Makefile b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/Makefile
new file mode 100644
index 00000000..003238cf
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/Makefile
@@ -0,0 +1 @@
+include $(ONL)/make/pkg.mk
\ No newline at end of file
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/PKG.yml b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/PKG.yml
new file mode 100644
index 00000000..1e58a225
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/PKG.yml
@@ -0,0 +1,19 @@
+variables:
+ platform: x86-64-accton-as5812-54x-r0
+ install: /lib/platform-config/${platform}/onl
+
+common:
+ version: 1.0.0
+ arch: amd64
+ copyright: Copyright 2013, 2014, 2015 Big Switch Networks
+ maintainer: support@bigswitch.com
+
+packages:
+ - name: onlp-${platform}
+ summary: ONLP Package for the ${platform} platform.
+
+ files:
+ builds/lib/$BUILD_DIR/x86_64-linux-gnu/bin/libonlp-${platform}.so : ${install}/lib/
+ builds/onlpdump/$BUILD_DIR/x86_64-linux-gnu/bin/onlpdump : ${install}/lib/bin/
+
+ changelog: Change changes changes.,
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/.gitignore b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/.gitignore
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/.gitignore
@@ -0,0 +1 @@
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/Makefile b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/Makefile
new file mode 100644
index 00000000..e7437cb2
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/Makefile
@@ -0,0 +1,2 @@
+FILTER=src
+include $(ONL)/make/subdirs.mk
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/lib/Makefile b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/lib/Makefile
new file mode 100644
index 00000000..aa93ee3f
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/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-accton-as5812-54x-r0
+include $(BUILDER)/standardinit.mk
+
+DEPENDMODULES := AIM IOF x86_64_accton_as5812_54x onlplib
+DEPENDMODULE_HEADERS := sff
+
+include $(BUILDER)/dependmodules.mk
+
+SHAREDLIB := libonlp-x86-64-accton-as5812-54x-r0.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/accton/x86-64-accton-as5812-54x/onlp/builds/onlpdump/Makefile b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/onlpdump/Makefile
new file mode 100644
index 00000000..5e95fa3c
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/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_accton_as5812_54x 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/accton/x86-64-accton-as5812-54x/onlp/builds/src/Makefile b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/Makefile
new file mode 100644
index 00000000..b59ead24
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/Makefile
@@ -0,0 +1,9 @@
+###############################################################################
+#
+#
+#
+###############################################################################
+include ../../init.mk
+MODULE := x86_64_accton_as5812_54x
+AUTOMODULE := x86_64_accton_as5812_54x
+include $(BUILDER)/definemodule.mk
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/README b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/README
new file mode 100644
index 00000000..72089c9a
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/README
@@ -0,0 +1,6 @@
+###############################################################################
+#
+# x86_64_accton_as5712_54x README
+#
+###############################################################################
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/auto/make.mk b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/auto/make.mk
new file mode 100644
index 00000000..83022f21
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/auto/make.mk
@@ -0,0 +1,9 @@
+###############################################################################
+#
+# x86_64_accton_as5812_54x Autogeneration
+#
+###############################################################################
+x86_64_accton_as5812_54x_AUTO_DEFS := module/auto/x86_64_accton_as5812_54x.yml
+x86_64_accton_as5812_54x_AUTO_DIRS := module/inc/x86_64_accton_as5812_54x module/src
+include $(BUILDER)/auto.mk
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/auto/x86_64_accton_as5812_54x.yml b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/auto/x86_64_accton_as5812_54x.yml
new file mode 100644
index 00000000..bf7902d1
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/auto/x86_64_accton_as5812_54x.yml
@@ -0,0 +1,50 @@
+###############################################################################
+#
+# x86_64_accton_as5812_54x Autogeneration Definitions.
+#
+###############################################################################
+
+cdefs: &cdefs
+- x86_64_accton_as5812_54x_CONFIG_INCLUDE_LOGGING:
+ doc: "Include or exclude logging."
+ default: 1
+- x86_64_accton_as5812_54x_CONFIG_LOG_OPTIONS_DEFAULT:
+ doc: "Default enabled log options."
+ default: AIM_LOG_OPTIONS_DEFAULT
+- x86_64_accton_as5812_54x_CONFIG_LOG_BITS_DEFAULT:
+ doc: "Default enabled log bits."
+ default: AIM_LOG_BITS_DEFAULT
+- x86_64_accton_as5812_54x_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
+ doc: "Default enabled custom log bits."
+ default: 0
+- x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB:
+ doc: "Default all porting macros to use the C standard libraries."
+ default: 1
+- x86_64_accton_as5812_54x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
+ doc: "Include standard library headers for stdlib porting macros."
+ default: x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB
+- x86_64_accton_as5812_54x_CONFIG_INCLUDE_UCLI:
+ doc: "Include generic uCli support."
+ default: 0
+- x86_64_accton_as5812_54x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION:
+ doc: "Assume chassis fan direction is the same as the PSU fan direction."
+ default: 0
+
+
+definitions:
+ cdefs:
+ x86_64_accton_as5812_54x_CONFIG_HEADER:
+ defs: *cdefs
+ basename: x86_64_accton_as5812_54x_config
+
+ portingmacro:
+ x86_64_accton_as5812_54x:
+ macros:
+ - malloc
+ - free
+ - memset
+ - memcpy
+ - strncpy
+ - vsnprintf
+ - snprintf
+ - strlen
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x.x b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x.x
new file mode 100644
index 00000000..6fd76f6c
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x.x
@@ -0,0 +1,14 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#include
+
+/* <--auto.start.xmacro(ALL).define> */
+/* */
+
+/* <--auto.start.xenum(ALL).define> */
+/* */
+
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_config.h b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_config.h
new file mode 100644
index 00000000..cd3d1110
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_config.h
@@ -0,0 +1,137 @@
+/**************************************************************************//**
+ *
+ * @file
+ * @brief x86_64_accton_as5812_54x Configuration Header
+ *
+ * @addtogroup x86_64_accton_as5812_54x-config
+ * @{
+ *
+ *****************************************************************************/
+#ifndef __x86_64_accton_as5812_54x_CONFIG_H__
+#define __x86_64_accton_as5812_54x_CONFIG_H__
+
+#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG
+#include
+#endif
+#ifdef x86_64_accton_as5812_54x_INCLUDE_CUSTOM_CONFIG
+#include
+#endif
+
+/* */
+#include
+/**
+ * x86_64_accton_as5812_54x_CONFIG_INCLUDE_LOGGING
+ *
+ * Include or exclude logging. */
+
+
+#ifndef x86_64_accton_as5812_54x_CONFIG_INCLUDE_LOGGING
+#define x86_64_accton_as5812_54x_CONFIG_INCLUDE_LOGGING 1
+#endif
+
+/**
+ * x86_64_accton_as5812_54x_CONFIG_LOG_OPTIONS_DEFAULT
+ *
+ * Default enabled log options. */
+
+
+#ifndef x86_64_accton_as5812_54x_CONFIG_LOG_OPTIONS_DEFAULT
+#define x86_64_accton_as5812_54x_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT
+#endif
+
+/**
+ * x86_64_accton_as5812_54x_CONFIG_LOG_BITS_DEFAULT
+ *
+ * Default enabled log bits. */
+
+
+#ifndef x86_64_accton_as5812_54x_CONFIG_LOG_BITS_DEFAULT
+#define x86_64_accton_as5812_54x_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT
+#endif
+
+/**
+ * x86_64_accton_as5812_54x_CONFIG_LOG_CUSTOM_BITS_DEFAULT
+ *
+ * Default enabled custom log bits. */
+
+
+#ifndef x86_64_accton_as5812_54x_CONFIG_LOG_CUSTOM_BITS_DEFAULT
+#define x86_64_accton_as5812_54x_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0
+#endif
+
+/**
+ * x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB
+ *
+ * Default all porting macros to use the C standard libraries. */
+
+
+#ifndef x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB
+#define x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB 1
+#endif
+
+/**
+ * x86_64_accton_as5812_54x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
+ *
+ * Include standard library headers for stdlib porting macros. */
+
+
+#ifndef x86_64_accton_as5812_54x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
+#define x86_64_accton_as5812_54x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB
+#endif
+
+/**
+ * x86_64_accton_as5812_54x_CONFIG_INCLUDE_UCLI
+ *
+ * Include generic uCli support. */
+
+
+#ifndef x86_64_accton_as5812_54x_CONFIG_INCLUDE_UCLI
+#define x86_64_accton_as5812_54x_CONFIG_INCLUDE_UCLI 0
+#endif
+
+/**
+ * x86_64_accton_as5812_54x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
+ *
+ * Assume chassis fan direction is the same as the PSU fan direction. */
+
+
+#ifndef x86_64_accton_as5812_54x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
+#define x86_64_accton_as5812_54x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION 0
+#endif
+
+
+
+/**
+ * All compile time options can be queried or displayed
+ */
+
+/** Configuration settings structure. */
+typedef struct x86_64_accton_as5812_54x_config_settings_s {
+ /** name */
+ const char* name;
+ /** value */
+ const char* value;
+} x86_64_accton_as5812_54x_config_settings_t;
+
+/** Configuration settings table. */
+/** x86_64_accton_as5812_54x_config_settings table. */
+extern x86_64_accton_as5812_54x_config_settings_t x86_64_accton_as5812_54x_config_settings[];
+
+/**
+ * @brief Lookup a configuration setting.
+ * @param setting The name of the configuration option to lookup.
+ */
+const char* x86_64_accton_as5812_54x_config_lookup(const char* setting);
+
+/**
+ * @brief Show the compile-time configuration.
+ * @param pvs The output stream.
+ */
+int x86_64_accton_as5812_54x_config_show(struct aim_pvs_s* pvs);
+
+/* */
+
+#include "x86_64_accton_as5812_54x_porting.h"
+
+#endif /* __x86_64_accton_as5812_54x_CONFIG_H__ */
+/* @} */
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_dox.h b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_dox.h
new file mode 100644
index 00000000..a77b8612
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_dox.h
@@ -0,0 +1,26 @@
+/**************************************************************************//**
+ *
+ * x86_64_accton_as5812_54x Doxygen Header
+ *
+ *****************************************************************************/
+#ifndef __x86_64_accton_as5812_54x_DOX_H__
+#define __x86_64_accton_as5812_54x_DOX_H__
+
+/**
+ * @defgroup x86_64_accton_as5812_54x x86_64_accton_as5812_54x - x86_64_accton_as5812_54x Description
+ *
+
+The documentation overview for this module should go here.
+
+ *
+ * @{
+ *
+ * @defgroup x86_64_accton_as5812_54x-x86_64_accton_as5812_54x Public Interface
+ * @defgroup x86_64_accton_as5812_54x-config Compile Time Configuration
+ * @defgroup x86_64_accton_as5812_54x-porting Porting Macros
+ *
+ * @}
+ *
+ */
+
+#endif /* __x86_64_accton_as5812_54x_DOX_H__ */
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_porting.h b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_porting.h
new file mode 100644
index 00000000..8377f863
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_porting.h
@@ -0,0 +1,107 @@
+/**************************************************************************//**
+ *
+ * @file
+ * @brief x86_64_accton_as5812_54x Porting Macros.
+ *
+ * @addtogroup x86_64_accton_as5812_54x-porting
+ * @{
+ *
+ *****************************************************************************/
+#ifndef __x86_64_accton_as5812_54x_PORTING_H__
+#define __x86_64_accton_as5812_54x_PORTING_H__
+
+
+/* */
+#if x86_64_accton_as5812_54x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1
+#include
+#include
+#include
+#include
+#include
+#endif
+
+#ifndef x86_64_accton_as5812_54x_MALLOC
+ #if defined(GLOBAL_MALLOC)
+ #define x86_64_accton_as5812_54x_MALLOC GLOBAL_MALLOC
+ #elif x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as5812_54x_MALLOC malloc
+ #else
+ #error The macro x86_64_accton_as5812_54x_MALLOC is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as5812_54x_FREE
+ #if defined(GLOBAL_FREE)
+ #define x86_64_accton_as5812_54x_FREE GLOBAL_FREE
+ #elif x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as5812_54x_FREE free
+ #else
+ #error The macro x86_64_accton_as5812_54x_FREE is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as5812_54x_MEMSET
+ #if defined(GLOBAL_MEMSET)
+ #define x86_64_accton_as5812_54x_MEMSET GLOBAL_MEMSET
+ #elif x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as5812_54x_MEMSET memset
+ #else
+ #error The macro x86_64_accton_as5812_54x_MEMSET is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as5812_54x_MEMCPY
+ #if defined(GLOBAL_MEMCPY)
+ #define x86_64_accton_as5812_54x_MEMCPY GLOBAL_MEMCPY
+ #elif x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as5812_54x_MEMCPY memcpy
+ #else
+ #error The macro x86_64_accton_as5812_54x_MEMCPY is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as5812_54x_STRNCPY
+ #if defined(GLOBAL_STRNCPY)
+ #define x86_64_accton_as5812_54x_STRNCPY GLOBAL_STRNCPY
+ #elif x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as5812_54x_STRNCPY strncpy
+ #else
+ #error The macro x86_64_accton_as5812_54x_STRNCPY is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as5812_54x_VSNPRINTF
+ #if defined(GLOBAL_VSNPRINTF)
+ #define x86_64_accton_as5812_54x_VSNPRINTF GLOBAL_VSNPRINTF
+ #elif x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as5812_54x_VSNPRINTF vsnprintf
+ #else
+ #error The macro x86_64_accton_as5812_54x_VSNPRINTF is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as5812_54x_SNPRINTF
+ #if defined(GLOBAL_SNPRINTF)
+ #define x86_64_accton_as5812_54x_SNPRINTF GLOBAL_SNPRINTF
+ #elif x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as5812_54x_SNPRINTF snprintf
+ #else
+ #error The macro x86_64_accton_as5812_54x_SNPRINTF is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as5812_54x_STRLEN
+ #if defined(GLOBAL_STRLEN)
+ #define x86_64_accton_as5812_54x_STRLEN GLOBAL_STRLEN
+ #elif x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as5812_54x_STRLEN strlen
+ #else
+ #error The macro x86_64_accton_as5812_54x_STRLEN is required but cannot be defined.
+ #endif
+#endif
+
+/* */
+
+
+#endif /* __x86_64_accton_as5812_54x_PORTING_H__ */
+/* @} */
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/make.mk b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/make.mk
new file mode 100644
index 00000000..cab358d8
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/make.mk
@@ -0,0 +1,10 @@
+###############################################################################
+#
+#
+#
+###############################################################################
+THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+x86_64_accton_as5812_54x_INCLUDES := -I $(THIS_DIR)inc
+x86_64_accton_as5812_54x_INTERNAL_INCLUDES := -I $(THIS_DIR)src
+x86_64_accton_as5812_54x_DEPENDMODULE_ENTRIES := init:x86_64_accton_as5812_54x ucli:x86_64_accton_as5812_54x
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/Makefile b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/Makefile
new file mode 100644
index 00000000..f1cddba9
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/Makefile
@@ -0,0 +1,9 @@
+###############################################################################
+#
+# Local source generation targets.
+#
+###############################################################################
+
+ucli:
+ @../../../../tools/uclihandlers.py x86_64_accton_as5812_54x_ucli.c
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/debug.c b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/debug.c
new file mode 100644
index 00000000..882f13bc
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/debug.c
@@ -0,0 +1,45 @@
+#include "x86_64_accton_as5812_54x_int.h"
+
+#if x86_64_accton_as5812_54x_CONFIG_INCLUDE_DEBUG == 1
+
+#include
+
+static char help__[] =
+ "Usage: debug [options]\n"
+ " -c CPLD Versions\n"
+ " -h Help\n"
+ ;
+
+int
+x86_64_accton_as5812_54x_debug_main(int argc, char* argv[])
+{
+ int c = 0;
+ int help = 0;
+ int rv = 0;
+
+ while( (c = getopt(argc, argv, "ch")) != -1) {
+ switch(c)
+ {
+ case 'c': c = 1; break;
+ case 'h': help = 1; rv = 0; break;
+ default: help = 1; rv = 1; break;
+ }
+
+ }
+
+ if(help || argc == 1) {
+ printf("%s", help__);
+ return rv;
+ }
+
+ if(c) {
+ printf("Not implemented.\n");
+ }
+
+
+ return 0;
+}
+
+#endif
+
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/fani.c b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/fani.c
new file mode 100644
index 00000000..fa1e588e
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/fani.c
@@ -0,0 +1,420 @@
+/************************************************************
+ *
+ *
+ * Copyright 2014 Big Switch Networks, Inc.
+ * Copyright 2015 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 "platform_lib.h"
+
+#define PREFIX_PATH_ON_MAIN_BOARD "/sys/devices/platform/as5812_54x_fan/"
+#define PREFIX_PATH_ON_PSU "/sys/bus/i2c/devices/"
+#define LOCAL_DEBUG 0
+
+
+#define FAN_RESERVED 0
+#define FAN_1_ON_MAIN_BOARD 1
+#define FAN_2_ON_MAIN_BOARD 2
+#define FAN_3_ON_MAIN_BOARD 3
+#define FAN_4_ON_MAIN_BOARD 4
+#define FAN_5_ON_MAIN_BOARD 5
+#define FAN_1_ON_PSU1 6
+#define FAN_1_ON_PSU2 7
+
+#define PROJECT_NAME
+
+#define LEN_FILE_NAME 50
+
+typedef struct last_path_S
+{
+ char status[LEN_FILE_NAME];
+ char speed[LEN_FILE_NAME];
+ char direction[LEN_FILE_NAME];
+ char ctrl_speed[LEN_FILE_NAME];
+ char r_status[LEN_FILE_NAME];
+ char r_speed[LEN_FILE_NAME];
+}last_path_T;
+
+#define _MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(prj,id) \
+ { #prj"fan"#id"_fault", #prj"fan"#id"_speed_rpm", #prj"fan"#id"_direction",\
+ #prj"fan"#id"_duty_cycle_percentage", #prj"fanr"#id"_fault", #prj"fanr"#id"_speed_rpm" }
+
+#define MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(prj,id) _MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(prj,id)
+
+
+#define MAKE_FAN_LAST_PATH_ON_PSU(folder) \
+ {#folder"/psu_fan1_fault", #folder"/psu_fan1_speed_rpm", "",\
+ #folder"/psu_fan1_duty_cycle_percentage", "", "" }
+
+static last_path_T last_path[] = /* must map with onlp_fan_id */
+{
+ MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_RESERVED),
+ MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_1_ON_MAIN_BOARD),
+ MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_2_ON_MAIN_BOARD),
+ MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_3_ON_MAIN_BOARD),
+ MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_4_ON_MAIN_BOARD),
+ MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_5_ON_MAIN_BOARD),
+
+ MAKE_FAN_LAST_PATH_ON_PSU(57-003c),
+ MAKE_FAN_LAST_PATH_ON_PSU(58-003f),
+};
+
+#define MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(id) \
+ { \
+ { ONLP_FAN_ID_CREATE(FAN_##id##_ON_MAIN_BOARD), "Chassis Fan "#id, 0 }, \
+ 0x0, \
+ ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE, \
+ 0, \
+ 0, \
+ ONLP_FAN_MODE_INVALID, \
+ }
+
+#define MAKE_FAN_INFO_NODE_ON_PSU(psu_id, fan_id) \
+ { \
+ { ONLP_FAN_ID_CREATE(FAN_##fan_id##_ON_PSU##psu_id), "Chassis PSU-"#psu_id " Fan "#fan_id, 0 }, \
+ 0x0, \
+ 0, \
+ 0, \
+ 0, \
+ ONLP_FAN_MODE_INVALID, \
+ }
+
+
+/* Static fan information */
+onlp_fan_info_t linfo[] = {
+ { }, /* Not used */
+ MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(1),
+ MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(2),
+ MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(3),
+ MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(4),
+ MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(5),
+ MAKE_FAN_INFO_NODE_ON_PSU(1,1),
+ MAKE_FAN_INFO_NODE_ON_PSU(2,1),
+};
+
+#define VALIDATE(_id) \
+ do { \
+ if(!ONLP_OID_IS_FAN(_id)) { \
+ return ONLP_STATUS_E_INVALID; \
+ } \
+ } while(0)
+
+#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \
+ if (LOCAL_DEBUG) \
+ printf("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \
+ if ((fd = open(fullpath, O_RDONLY)) == -1) \
+ return ONLP_STATUS_E_INTERNAL; \
+ if ((len = read(fd, r_data, nbytes)) <= 0){ \
+ close(fd); \
+ return ONLP_STATUS_E_INTERNAL;} \
+ if (LOCAL_DEBUG) \
+ printf("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \
+ if (close(fd) == -1) \
+ return ONLP_STATUS_E_INTERNAL
+
+
+/* PSU relative marco */
+#define SET_PSU_TYPE_CPR_4011_F2B_FAN(info) \
+ info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B); \
+ info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE
+
+#define SET_PSU_TYPE_CPR_4011_B2F_FAN(info) \
+ info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F); \
+ info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE
+
+#define SET_PSU_TYPE_UM400D_F2B_FAN(info) \
+ info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B)
+
+#define SET_PSU_TYPE_UM400D_B2F_FAN(info) \
+ info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F)
+
+
+static int
+_onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info)
+{
+ int fd, len, nbytes = 10;
+ char r_data[10] = {0};
+ char fullpath[65] = {0};
+
+ /* get fan/fanr fault status (turn on when any one fails)
+ */
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].status);
+ OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
+ if (atoi(r_data) > 0)
+ info->status |= ONLP_FAN_STATUS_FAILED;
+
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_status);
+ OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
+ if (atoi(r_data) > 0)
+ info->status |= ONLP_FAN_STATUS_FAILED;
+
+ /* get fan/fanr direction (both : the same)
+ */
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].direction);
+ OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
+
+ if (atoi(r_data) == 0) /*F2B*/
+ info->status |= ONLP_FAN_STATUS_F2B;
+ else
+ info->status |= ONLP_FAN_STATUS_B2F;
+
+ /* get fan/fanr speed (take the average of two speeds)
+ */
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].speed);
+ OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
+ info->rpm = atoi(r_data);
+
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_speed);
+ OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
+ info->rpm = (info->rpm + atoi(r_data))/2;
+
+ /* get speed percentage from rpm */
+ info->percentage = (info->rpm * 100)/16800;
+
+ /* check present */
+ if (info->rpm > 0)
+ info->status |= ONLP_FAN_STATUS_PRESENT;
+
+ return ONLP_STATUS_OK;
+}
+
+static int
+_onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info)
+{
+ int psu_id, is_ac=0;
+ int fd, len, nbytes = 10;
+ char r_data[10] = {0};
+ char fullpath[50] = {0};
+ psu_type_t psu_type;
+
+ /* get fan other cap status according to psu type
+ */
+ psu_id = (local_id-FAN_1_ON_PSU1) + 1;
+
+ if (LOCAL_DEBUG)
+ printf("[Debug][%s][%d][psu_id: %d]\n", __FUNCTION__, __LINE__, psu_id);
+
+ psu_type = get_psu_type(psu_id, NULL, 0); /* psu_id = 1 , present PSU1. pus_id =2 , present PSU2 */
+
+ if (LOCAL_DEBUG)
+ printf("[Debug][%s][%d][psu_type: %d]\n", __FUNCTION__, __LINE__, psu_type);
+
+
+ switch (psu_type) {
+ case PSU_TYPE_AC_F2B:
+ SET_PSU_TYPE_CPR_4011_F2B_FAN(info);
+ is_ac = 1;
+ break;
+ case PSU_TYPE_AC_B2F:
+ SET_PSU_TYPE_CPR_4011_B2F_FAN(info);
+ is_ac = 1;
+ break;
+ case PSU_TYPE_DC_48V_F2B:
+ SET_PSU_TYPE_UM400D_F2B_FAN(info);
+ break;
+ case PSU_TYPE_DC_48V_B2F:
+ SET_PSU_TYPE_UM400D_B2F_FAN(info);
+ break;
+ default:
+ if (LOCAL_DEBUG)
+ printf("[Debug][%s][%d][psu_type=%d]\n", __FUNCTION__, __LINE__, psu_type);
+
+ break;
+ }
+
+ if (1 == is_ac)
+ {
+ /* get fan fault status
+ */
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].status);
+ OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
+ if (atoi(r_data) > 0)
+ info->status |= ONLP_FAN_STATUS_FAILED;
+
+ /* get fan speed
+ */
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].speed);
+ OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
+ info->rpm = atoi(r_data);
+
+ /* get speed percentage from rpm */
+ info->percentage = (info->rpm * 100)/19328;
+
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+
+/*
+ * This function will be called prior to all of onlp_fani_* functions.
+ */
+int
+onlp_fani_init(void)
+{
+ return ONLP_STATUS_OK;
+}
+
+
+int
+onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info)
+{
+ int rc = 0;
+ int local_id;
+
+ VALIDATE(id);
+
+ local_id = ONLP_OID_ID_GET(id);
+
+ *info = linfo[local_id];
+
+ if (LOCAL_DEBUG)
+ printf("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id);
+
+ switch (local_id)
+ {
+ case FAN_1_ON_PSU1:
+ case FAN_1_ON_PSU2:
+ rc = _onlp_fani_info_get_fan_on_psu(local_id, info);
+ break;
+
+ default:
+ rc =_onlp_fani_info_get_fan(local_id, info);
+ break;
+ }
+
+ return rc;
+}
+
+/*
+ * This function sets the speed of the given fan in RPM.
+ *
+ * This function will only be called if the fan supprots the RPM_SET
+ * capability.
+ *
+ * It is optional if you have no fans at all with this feature.
+ */
+int
+onlp_fani_rpm_set(onlp_oid_t id, int rpm)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
+
+/*
+ * This function sets the fan speed of the given OID as a percentage.
+ *
+ * This will only be called if the OID has the PERCENTAGE_SET
+ * capability.
+ *
+ * It is optional if you have no fans at all with this feature.
+ */
+int
+onlp_fani_percentage_set(onlp_oid_t id, int p)
+{
+ int fd, len, nbytes=10, local_id;
+ char data[10] = {0};
+ char fullpath[70] = {0};
+
+ VALIDATE(id);
+
+ local_id = ONLP_OID_ID_GET(id);
+
+ /* reject p=0 (p=0, stop fan) */
+ if (p == 0){
+ return ONLP_STATUS_E_INVALID;
+ }
+
+ /* get fullpath */
+ switch (local_id)
+ {
+ case FAN_1_ON_PSU1:
+ case FAN_1_ON_PSU2:
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].ctrl_speed);
+ break;
+ default:
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].ctrl_speed);
+ break;
+ }
+
+ sprintf(data, "%d", p);
+
+ if (LOCAL_DEBUG)
+ printf("[Debug][%s][%d][openfile: %s][data=%s]\n", __FUNCTION__, __LINE__, fullpath, data);
+
+ /* Create output file descriptor */
+ fd = open(fullpath, O_WRONLY, 0644);
+ if(fd == -1){
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ len = write (fd, data, (ssize_t) nbytes);
+ if(len != nbytes){
+ close(fd);
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ close(fd);
+ return ONLP_STATUS_OK;
+}
+
+
+
+/*
+ * This function sets the fan speed of the given OID as per
+ * the predefined ONLP fan speed modes: off, slow, normal, fast, max.
+ *
+ * Interpretation of these modes is up to the platform.
+ *
+ */
+int
+onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
+/*
+ * This function sets the fan direction of the given OID.
+ *
+ * This function is only relevant if the fan OID supports both direction
+ * capabilities.
+ *
+ * This function is optional unless the functionality is available.
+ */
+int
+onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
+/*
+ * Generic fan ioctl. Optional.
+ */
+int
+onlp_fani_ioctl(onlp_oid_t id, va_list vargs)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/ledi.c b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/ledi.c
new file mode 100644
index 00000000..c84ebe5a
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/ledi.c
@@ -0,0 +1,325 @@
+/************************************************************
+ *
+ *
+ * Copyright 2014 Big Switch Networks, Inc.
+ * Copyright 2015 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 "onlpie_int.h"
+
+#define VALIDATE(_id) \
+ do { \
+ if(!ONLP_OID_IS_LED(_id)) { \
+ return ONLP_STATUS_E_INVALID; \
+ } \
+ } while(0)
+
+/* LED related data
+ */
+enum led_light_mode { /*must be the same with the definition @ kernel driver */
+ LED_MODE_OFF = 0,
+ LED_MODE_GREEN,
+ LED_MODE_AMBER,
+ LED_MODE_RED,
+ LED_MODE_GREEN_BLINK,
+ LED_MODE_AMBER_BLINK,
+ LED_MODE_RED_BLINK,
+ LED_MODE_AUTO,
+};
+
+int led_light_map_mode[][2] =
+{
+ {LED_MODE_OFF, ONLP_LED_MODE_OFF},
+ {LED_MODE_GREEN, ONLP_LED_MODE_GREEN},
+ {LED_MODE_AMBER, ONLP_LED_MODE_ORANGE},
+ {LED_MODE_RED, ONLP_LED_MODE_RED},
+ {LED_MODE_GREEN_BLINK, ONLP_LED_MODE_GREEN_BLINKING},
+ {LED_MODE_AMBER_BLINK, ONLP_LED_MODE_ORANGE_BLINKING},
+ {LED_MODE_RED_BLINK, ONLP_LED_MODE_RED_BLINKING},
+ {LED_MODE_AUTO, ONLP_LED_MODE_AUTO},
+};
+
+
+#define prefix_path "/sys/class/leds/accton_as5812_54x_led::"
+#define filename "brightness"
+
+enum onlp_led_id
+{
+ LED_RESERVED = 0,
+ LED_DIAG,
+ LED_FAN,
+ LED_LOC,
+ LED_PSU1,
+ LED_PSU2,
+ LED_FAN1,
+ LED_FAN2,
+ LED_FAN3,
+ LED_FAN4,
+ LED_FAN5,
+};
+
+static char last_path[][10] = /* must map with onlp_led_id */
+{
+ "reserved",
+ "diag",
+ "fan",
+ "loc",
+ "psu1",
+ "psu2",
+ "fan1",
+ "fan2",
+ "fan3",
+ "fan4",
+ "fan5",
+};
+
+/*
+ * Get the information for the given LED OID.
+ */
+static onlp_led_info_t linfo[] =
+{
+ { }, /* Not used */
+ {
+ { ONLP_LED_ID_CREATE(LED_DIAG), "Chassis LED 1 (DIAG LED)", 0 },
+ ONLP_LED_STATUS_PRESENT,
+ ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN,
+ },
+ {
+ { ONLP_LED_ID_CREATE(LED_FAN), "Chassis LED 2 (FAN LED)", 0 },
+ ONLP_LED_STATUS_PRESENT,
+ ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
+ },
+ {
+ { ONLP_LED_ID_CREATE(LED_LOC), "Chassis LED 3 (LOC LED)", 0 },
+ ONLP_LED_STATUS_PRESENT,
+ ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING,
+ },
+ {
+ { ONLP_LED_ID_CREATE(LED_PSU1), "Chassis LED 4 (PSU1 LED)", 0 },
+ ONLP_LED_STATUS_PRESENT,
+ ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
+ },
+ {
+ { ONLP_LED_ID_CREATE(LED_PSU2), "Chassis LED 5 (PSU2 LED)", 0 },
+ ONLP_LED_STATUS_PRESENT,
+ ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
+ },
+ {
+ { ONLP_LED_ID_CREATE(LED_FAN1), "Chassis LED 6 (FAN1 LED)", 0 },
+ ONLP_LED_STATUS_PRESENT, 0,
+ },
+ {
+ { ONLP_LED_ID_CREATE(LED_FAN2), "Chassis LED 7 (FAN2 LED)", 0 },
+ ONLP_LED_STATUS_PRESENT, 0,
+ },
+ {
+ { ONLP_LED_ID_CREATE(LED_FAN3), "Chassis LED 8 (FAN3 LED)", 0 },
+ ONLP_LED_STATUS_PRESENT, 0,
+ },
+ {
+ { ONLP_LED_ID_CREATE(LED_FAN4), "Chassis LED 9 (FAN4 LED)", 0 },
+ ONLP_LED_STATUS_PRESENT, 0,
+ },
+ {
+ { ONLP_LED_ID_CREATE(LED_FAN5), "Chassis LED 10 (FAN5 LED)", 0 },
+ ONLP_LED_STATUS_PRESENT, 0,
+ },
+};
+
+
+static int conver_led_light_mode_to_onl(int led_ligth_mode)
+{
+ int i, nsize = sizeof(led_light_map_mode)/sizeof(led_light_map_mode[0]);
+ for(i=0; imode = conver_led_light_mode_to_onl(atoi(data));
+
+ /* Set the on/off status */
+ if (info->mode != ONLP_LED_MODE_OFF) {
+ info->status |= ONLP_LED_STATUS_ON;
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+/*
+ * Turn an LED on or off.
+ *
+ * This function will only be called if the LED OID supports the ONOFF
+ * capability.
+ *
+ * What 'on' means in terms of colors or modes for multimode LEDs is
+ * up to the platform to decide. This is intended as baseline toggle mechanism.
+ */
+int
+onlp_ledi_set(onlp_oid_t id, int on_or_off)
+{
+ VALIDATE(id);
+
+ if (!on_or_off) {
+ return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF);
+ }
+
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
+/*
+ * This function puts the LED into the given mode. It is a more functional
+ * interface for multimode LEDs.
+ *
+ * Only modes reported in the LED's capabilities will be attempted.
+ */
+int
+onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
+{
+ int fd, len, driver_mode, nbytes=1, local_id;
+ char data[2] = {0};
+ char fullpath[50] = {0};
+
+ VALIDATE(id);
+
+ local_id = ONLP_OID_ID_GET(id);
+
+ /* get fullpath */
+ if (strchr(last_path[local_id], '/') != NULL)
+ {
+ sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]);
+ }
+ else
+ {
+ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
+ }
+
+ driver_mode = conver_led_light_mode_to_driver(mode);
+ sprintf(data, "%d", driver_mode);
+
+ /* Create output file descriptor */
+ fd = open(fullpath, O_WRONLY, 0644);
+ if(fd == -1){
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ len = write (fd, data, (ssize_t) nbytes);
+ if(len != nbytes){
+ close(fd);
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ close(fd);
+ return ONLP_STATUS_OK;
+}
+
+/*
+ * Generic LED ioctl interface.
+ */
+int
+onlp_ledi_ioctl(onlp_oid_t id, va_list vargs)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/make.mk b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/make.mk
new file mode 100644
index 00000000..263c3731
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/make.mk
@@ -0,0 +1,9 @@
+###############################################################################
+#
+#
+#
+###############################################################################
+
+LIBRARY := x86_64_accton_as5812_54x
+$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
+include $(BUILDER)/lib.mk
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/platform_lib.c b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/platform_lib.c
new file mode 100644
index 00000000..7c28f95b
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/platform_lib.c
@@ -0,0 +1,169 @@
+/************************************************************
+ *
+ *
+ * Copyright 2014 Big Switch Networks, Inc.
+ * Copyright 2015 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"
+
+int deviceNodeWrite(char *filename, char *buffer, int buf_size, int data_len)
+{
+ int fd;
+ int len;
+
+ if ((buffer == NULL) || (buf_size < 0)) {
+ return -1;
+ }
+
+ if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) {
+ return -1;
+ }
+
+ if ((len = write(fd, buffer, buf_size)) < 0) {
+ close(fd);
+ return -1;
+ }
+
+ if ((close(fd) == -1)) {
+ return -1;
+ }
+
+ if ((len > buf_size) || (data_len != 0 && len != data_len)) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int deviceNodeWriteInt(char *filename, int value, int data_len)
+{
+ char buf[8] = {0};
+ sprintf(buf, "%d", value);
+
+ return deviceNodeWrite(filename, buf, sizeof(buf)-1, data_len);
+}
+
+int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len)
+ {
+ int fd;
+ int len;
+
+ if ((buffer == NULL) || (buf_size < 0)) {
+ return -1;
+ }
+
+ if ((fd = open(filename, O_RDONLY)) == -1) {
+ return -1;
+ }
+
+ if ((len = read(fd, buffer, buf_size)) < 0) {
+ close(fd);
+ return -1;
+ }
+
+ if ((close(fd) == -1)) {
+ return -1;
+ }
+
+ if ((len > buf_size) || (data_len != 0 && len != data_len)) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len)
+{
+ int ret;
+
+ if (data_len >= buf_size || data_len < 0) {
+ return -1;
+ }
+
+ ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len);
+
+ if (ret == 0) {
+ if (data_len) {
+ buffer[data_len] = '\0';
+ }
+ else {
+ buffer[buf_size-1] = '\0';
+ }
+ }
+
+ return ret;
+}
+
+#define I2C_PSU_MODEL_NAME_LEN 13
+
+psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
+{
+ char *node = NULL;
+ char model_name[I2C_PSU_MODEL_NAME_LEN + 1] = {0};
+
+ /* Check AC model name */
+ node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_model_name) : PSU2_AC_HWMON_NODE(psu_model_name);
+
+ if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
+ if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) {
+ if (modelname) {
+ strncpy(modelname, model_name, modelname_len-1);
+ }
+ return PSU_TYPE_AC_F2B;
+ }
+ else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) {
+ if (modelname) {
+ strncpy(modelname, model_name, modelname_len-1);
+ }
+ return PSU_TYPE_AC_B2F;
+ }
+ }
+
+ /* Check DC model name */
+ memset(model_name, 0, sizeof(model_name));
+ node = (id == PSU1_ID) ? PSU1_DC_HWMON_NODE(psu_model_name) : PSU2_DC_HWMON_NODE(psu_model_name);
+
+ if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) {
+ if (strncmp(model_name, "um400d01G", strlen("um400d01G")) == 0) {
+ if (modelname) {
+ strncpy(modelname, model_name, modelname_len-1);
+ }
+ return PSU_TYPE_DC_48V_B2F;
+ }
+ else if (strncmp(model_name, "um400d01-01G", strlen("um400d01-01G")) == 0) {
+ if (modelname) {
+ strncpy(modelname, model_name, modelname_len-1);
+ }
+ return PSU_TYPE_DC_48V_F2B;
+ }
+ }
+
+ return PSU_TYPE_UNKNOWN;
+}
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/platform_lib.h b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/platform_lib.h
new file mode 100644
index 00000000..1c8d033c
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/platform_lib.h
@@ -0,0 +1,70 @@
+/************************************************************
+ *
+ *
+ * Copyright 2014 Big Switch Networks, Inc.
+ * Copyright 2015 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_accton_as5812_54x_log.h"
+
+#define PSU1_ID 1
+#define PSU2_ID 2
+
+#define CHASSIS_FAN_COUNT 5
+#define CHASSIS_THERMAL_COUNT 4
+#define CHASSIS_LED_COUNT 10
+
+#define PSU1_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/57-003c/"
+#define PSU2_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/58-003f/"
+
+#define PSU1_AC_HWMON_PREFIX "/sys/bus/i2c/devices/57-0038/"
+#define PSU1_DC_HWMON_PREFIX "/sys/bus/i2c/devices/57-0050/"
+#define PSU2_AC_HWMON_PREFIX "/sys/bus/i2c/devices/58-003b/"
+#define PSU2_DC_HWMON_PREFIX "/sys/bus/i2c/devices/58-0053/"
+
+#define PSU1_AC_HWMON_NODE(node) PSU1_AC_HWMON_PREFIX#node
+#define PSU1_DC_HWMON_NODE(node) PSU1_DC_HWMON_PREFIX#node
+#define PSU2_AC_HWMON_NODE(node) PSU2_AC_HWMON_PREFIX#node
+#define PSU2_DC_HWMON_NODE(node) PSU2_DC_HWMON_PREFIX#node
+
+//#define SFP_HWMON_PREFIX "/sys/bus/i2c/devices/3-0050/"
+//#define SFP_HWMON_NODE(node) SFP_HWMON_PREFIX#node
+
+#define IDPROM_PATH "/sys/devices/pci0000:00/0000:00:13.0/i2c-1/1-0057/eeprom"
+
+int deviceNodeWriteInt(char *filename, int value, int data_len);
+int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len);
+int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len);
+
+typedef enum psu_type {
+ PSU_TYPE_UNKNOWN,
+ PSU_TYPE_AC_F2B,
+ PSU_TYPE_AC_B2F,
+ PSU_TYPE_DC_48V_F2B,
+ PSU_TYPE_DC_48V_B2F
+} psu_type_t;
+
+psu_type_t get_psu_type(int id, char* modelname, int modelname_len);
+
+#endif /* __PLATFORM_LIB_H__ */
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/psui.c b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/psui.c
new file mode 100644
index 00000000..0d59bd1a
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/psui.c
@@ -0,0 +1,247 @@
+/************************************************************
+ *
+ *
+ * Copyright 2014 Big Switch Networks, Inc.
+ * Copyright 2015 Accton Technology Corporation.
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the
+ * License.
+ *
+ *
+ ************************************************************
+ *
+ *
+ *
+ ***********************************************************/
+#include
+#include
+#include
+#include
+#include "platform_lib.h"
+
+#define PSU_STATUS_PRESENT 1
+#define PSU_STATUS_POWER_GOOD 1
+
+#define PSU_NODE_MAX_INT_LEN 8
+#define PSU_NODE_MAX_PATH_LEN 64
+
+#define VALIDATE(_id) \
+ do { \
+ if(!ONLP_OID_IS_PSU(_id)) { \
+ return ONLP_STATUS_E_INVALID; \
+ } \
+ } while(0)
+
+static int
+psu_status_info_get(int id, int is_ac, char *node, int *value)
+{
+ int ret = 0;
+ char buf[PSU_NODE_MAX_INT_LEN + 1] = {0};
+ char node_path[PSU_NODE_MAX_PATH_LEN] = {0};
+
+ *value = 0;
+
+ if (PSU1_ID == id) {
+ sprintf(node_path, "%s%s", is_ac ? PSU1_AC_HWMON_PREFIX : PSU1_DC_HWMON_PREFIX, node);
+ }
+ else if (PSU2_ID == id) {
+ sprintf(node_path, "%s%s", is_ac ? PSU2_AC_HWMON_PREFIX : PSU2_DC_HWMON_PREFIX, node);
+ }
+
+ ret = deviceNodeReadString(node_path, buf, sizeof(buf), 0);
+
+ if (ret == 0) {
+ *value = atoi(buf);
+ }
+
+ return ret;
+}
+
+static int
+psu_cpr_4011_pmbus_info_get(int id, char *node, int *value)
+{
+ int ret = 0;
+ char buf[PSU_NODE_MAX_INT_LEN + 1] = {0};
+ char node_path[PSU_NODE_MAX_PATH_LEN] = {0};
+
+ *value = 0;
+
+ if (PSU1_ID == id) {
+ sprintf(node_path, "%s%s", PSU1_AC_PMBUS_PREFIX, node);
+ }
+ else {
+ sprintf(node_path, "%s%s", PSU2_AC_PMBUS_PREFIX, node);
+ }
+
+ ret = deviceNodeReadString(node_path, buf, sizeof(buf), 0);
+
+ if (ret == 0) {
+ *value = atoi(buf);
+ }
+
+ return ret;
+}
+
+int
+onlp_psui_init(void)
+{
+ return ONLP_STATUS_OK;
+}
+
+static int
+psu_cpr_4011_info_get(onlp_psu_info_t* info)
+{
+ int val = 0;
+ int index = ONLP_OID_ID_GET(info->hdr.id);
+
+ /* Set capability
+ */
+ info->caps = ONLP_PSU_CAPS_AC;
+
+ if (info->status & ONLP_PSU_STATUS_FAILED) {
+ return ONLP_STATUS_OK;
+ }
+
+ /* Set the associated oid_table */
+ info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT);
+ info->hdr.coids[1] = ONLP_THERMAL_ID_CREATE(index + CHASSIS_THERMAL_COUNT);
+
+ /* Read voltage, current and power */
+ if (psu_cpr_4011_pmbus_info_get(index, "psu_v_out", &val) == 0) {
+ info->mvout = val;
+ info->caps |= ONLP_PSU_CAPS_VOUT;
+ }
+
+ if (psu_cpr_4011_pmbus_info_get(index, "psu_v_in", &val) == 0) {
+ info->mvin = val;
+ info->caps |= ONLP_PSU_CAPS_VIN;
+ }
+
+ if (psu_cpr_4011_pmbus_info_get(index, "psu_i_out", &val) == 0) {
+ info->miout = val;
+ info->caps |= ONLP_PSU_CAPS_IOUT;
+ }
+
+ if (psu_cpr_4011_pmbus_info_get(index, "psu_i_in", &val) == 0) {
+ info->miin = val;
+ info->caps |= ONLP_PSU_CAPS_IIN;
+ }
+
+ if (psu_cpr_4011_pmbus_info_get(index, "psu_p_out", &val) == 0) {
+ info->mpout = val;
+ info->caps |= ONLP_PSU_CAPS_POUT;
+ }
+
+ if (psu_cpr_4011_pmbus_info_get(index, "psu_p_in", &val) == 0) {
+ info->mpin = val;
+ info->caps |= ONLP_PSU_CAPS_PIN;
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+int
+psu_um400d_info_get(onlp_psu_info_t* info)
+{
+ int index = ONLP_OID_ID_GET(info->hdr.id);
+
+ /* Set capability
+ */
+ info->caps = ONLP_PSU_CAPS_DC48;
+
+ if (info->status & ONLP_PSU_STATUS_FAILED) {
+ return ONLP_STATUS_OK;
+ }
+
+ /* Set the associated oid_table */
+ info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT);
+
+ return ONLP_STATUS_OK;
+}
+
+/*
+ * Get all information about the given PSU oid.
+ */
+static onlp_psu_info_t pinfo[] =
+{
+ { }, /* Not used */
+ {
+ { ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0 },
+ },
+ {
+ { ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0 },
+ }
+};
+
+int
+onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
+{
+ int val = 0;
+ int ret = ONLP_STATUS_OK;
+ int index = ONLP_OID_ID_GET(id);
+ psu_type_t psu_type;
+
+ VALIDATE(id);
+
+ memset(info, 0, sizeof(onlp_psu_info_t));
+ *info = pinfo[index]; /* Set the onlp_oid_hdr_t */
+
+ /* Get the present state */
+ if (psu_status_info_get(index, 1, "psu_present", &val) != 0) {
+ printf("Unable to read PSU(%d) node(psu_present)\r\n", index);
+ }
+
+ if (val != PSU_STATUS_PRESENT) {
+ info->status &= ~ONLP_PSU_STATUS_PRESENT;
+ return ONLP_STATUS_OK;
+ }
+ info->status |= ONLP_PSU_STATUS_PRESENT;
+
+
+ /* Get power good status */
+ if (psu_status_info_get(index, 1, "psu_power_good", &val) != 0) {
+ printf("Unable to read PSU(%d) node(psu_power_good)\r\n", index);
+ }
+
+ if (val != PSU_STATUS_POWER_GOOD) {
+ info->status |= ONLP_PSU_STATUS_FAILED;
+ }
+
+
+ /* Get PSU type
+ */
+ psu_type = get_psu_type(index, info->model, sizeof(info->model));
+
+ switch (psu_type) {
+ case PSU_TYPE_AC_F2B:
+ case PSU_TYPE_AC_B2F:
+ ret = psu_cpr_4011_info_get(info);
+ break;
+ case PSU_TYPE_DC_48V_F2B:
+ case PSU_TYPE_DC_48V_B2F:
+ ret = psu_um400d_info_get(info);
+ break;
+ default:
+ ret = ONLP_STATUS_E_UNSUPPORTED;
+ break;
+ }
+
+ return ret;
+}
+
+int
+onlp_psui_ioctl(onlp_oid_t pid, va_list vargs)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/sfpi.c b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/sfpi.c
new file mode 100644
index 00000000..fc1000b2
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/sfpi.c
@@ -0,0 +1,449 @@
+/************************************************************
+ *
+ *
+ * Copyright 2014 Big Switch Networks, Inc.
+ * Copyright 2015 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 /* For O_RDWR && open */
+#include
+#include
+#include
+#include
+
+#include "platform_lib.h"
+
+#define MAX_SFP_PATH 64
+static char sfp_node_path[MAX_SFP_PATH] = {0};
+#define CPLD_MUX_BUS_START_INDEX 2
+
+static int front_port_to_cpld_mux_index(int port)
+{
+ int rport = 0;
+
+ switch (port)
+ {
+ case 49:
+ rport = 50;
+ break;
+ case 50:
+ rport = 52;
+ break;
+ case 51:
+ rport = 49;
+ break;
+ case 52:
+ rport = 51;
+ break;
+ default:
+ rport = port;
+ break;
+ }
+
+ return (rport + CPLD_MUX_BUS_START_INDEX);
+}
+
+static int
+as5812_54x_sfp_node_read_int(char *node_path, int *value, int data_len)
+{
+ int ret = 0;
+ char buf[8] = {0};
+ *value = 0;
+
+ ret = deviceNodeReadString(node_path, buf, sizeof(buf), data_len);
+
+ if (ret == 0) {
+ *value = atoi(buf);
+ }
+
+ return ret;
+}
+
+static char*
+as5812_54x_sfp_get_port_path_addr(int port, int addr, char *node_name)
+{
+ sprintf(sfp_node_path, "/sys/bus/i2c/devices/%d-00%d/%s",
+ front_port_to_cpld_mux_index(port), addr,
+ node_name);
+ return sfp_node_path;
+}
+
+static char*
+as5812_54x_sfp_get_port_path(int port, char *node_name)
+{
+ return as5812_54x_sfp_get_port_path_addr(port, 50, node_name);
+}
+
+
+/************************************************************
+ *
+ * SFPI Entry Points
+ *
+ ***********************************************************/
+int
+onlp_sfpi_init(void)
+{
+ /* Called at initialization time */
+ return ONLP_STATUS_OK;
+}
+
+int
+onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap)
+{
+ /*
+ * Ports {0, 54}
+ */
+ int p;
+
+ for(p = 0; p < 54; p++) {
+ AIM_BITMAP_SET(bmap, p);
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+int
+onlp_sfpi_port_map(int port, int* rport)
+{
+ /*
+ * The QSFP port numbering on the powerpc-as5812-54x-r0b platform
+ * differs from the numbering on the production
+ * powerpc-accton-as5812-54x-r0 platform.
+ *
+ * The R0B box numbers the front panel QSFP ports as follows:
+ *
+ * 49 50
+ * 51 52
+ * 53 54
+ *
+ * The production box numbers the front panel QSFP ports as follows:
+ *
+ * 49 52
+ * 50 53
+ * 51 54
+ *
+ * The kernel SFP driver for all 5710 platforms uses the production
+ * portmapping. When running on the R0B platform we need to convert
+ * the logical SFP port number (from the front panel) to the physical
+ * SFP port number used by the kernel driver.
+ *
+ * SFP port numbers here are 0-based.
+ */
+ switch(port)
+ {
+ case 48:
+ case 53:
+ /* These QSFP ports are numbered the same on both platforms */
+ *rport = port; break;
+ case 50:
+ *rport = 49; break;
+ case 52:
+ *rport = 50; break;
+ case 49:
+ *rport = 51; break;
+ case 51:
+ *rport = 52; break;
+ default:
+ /* All others are identical */
+ *rport = port; break;
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+/**
+ * The CPLD registers on the as5812 use the original R0B QSFP (horizontal)
+ * portmapping.
+ *
+ * While the SFP driver handles the remap correctly for sfp_active_port()
+ * for both the R0 and R0B. When we have to interpret the CPLD register
+ * values directly, however, we need to apply the correct mapping from R0B -> R0.
+ */
+static void
+port_qsfp_cpld_map__(int port, int* rport)
+{
+ switch(port)
+ {
+ case 53:
+ case 48: /* The same */ *rport = port; break;
+ case 50: *rport = 49; break;
+ case 52: *rport = 50; break;
+ case 49: *rport = 51; break;
+ case 51: *rport = 52; break;
+ default: *rport = port; break;
+ }
+}
+
+int
+onlp_sfpi_is_present(int port)
+{
+ /*
+ * Return 1 if present.
+ * Return 0 if not present.
+ * Return < 0 if error.
+ */
+ int present;
+ char* path = as5812_54x_sfp_get_port_path(port, "sfp_is_present");
+
+ if (as5812_54x_sfp_node_read_int(path, &present, 1) != 0) {
+ AIM_LOG_INFO("Unable to read present status from port(%d)\r\n", port);
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ return present;
+}
+
+int
+onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)
+{
+ uint32_t bytes[7];
+ char* path;
+ FILE* fp;
+
+ path = as5812_54x_sfp_get_port_path(0, "sfp_is_present_all");
+ fp = fopen(path, "r");
+
+ if(fp == NULL) {
+ AIM_LOG_ERROR("Unable to open the sfp_is_present_all device file.");
+ return ONLP_STATUS_E_INTERNAL;
+ }
+ int count = fscanf(fp, "%x %x %x %x %x %x %x",
+ bytes+0,
+ bytes+1,
+ bytes+2,
+ bytes+3,
+ bytes+4,
+ bytes+5,
+ bytes+6
+ );
+ fclose(fp);
+ if(count != AIM_ARRAYSIZE(bytes)) {
+ /* Likely a CPLD read timeout. */
+ AIM_LOG_ERROR("Unable to read all fields from the sfp_is_present_all device file.");
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ /* Mask out non-existant QSFP ports */
+ bytes[6] &= 0x3F;
+
+ /* Convert to 64 bit integer in port order */
+ int i = 0;
+ uint64_t presence_all = 0 ;
+ for(i = AIM_ARRAYSIZE(bytes)-1; i >= 0; i--) {
+ presence_all <<= 8;
+ presence_all |= bytes[i];
+ }
+
+ /* Populate bitmap */
+ for(i = 0; presence_all; i++) {
+ int p;
+ port_qsfp_cpld_map__(i, &p);
+ AIM_BITMAP_MOD(dst, p, (presence_all & 1));
+ presence_all >>= 1;
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+int
+onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst)
+{
+ uint32_t bytes[7];
+ char* path;
+ FILE* fp;
+
+ path = as5812_54x_sfp_get_port_path(0, "sfp_rx_los_all");
+ fp = fopen(path, "r");
+
+ if(fp == NULL) {
+ AIM_LOG_ERROR("Unable to open the sfp_rx_los_all device file.");
+ return ONLP_STATUS_E_INTERNAL;
+ }
+ int count = fscanf(fp, "%x %x %x %x %x %x",
+ bytes+0,
+ bytes+1,
+ bytes+2,
+ bytes+3,
+ bytes+4,
+ bytes+5
+ );
+ fclose(fp);
+ if(count != 6) {
+ AIM_LOG_ERROR("Unable to read all fields from the sfp_rx_los_all device file.");
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ /* Convert to 64 bit integer in port order */
+ int i = 0;
+ uint64_t rx_los_all = 0 ;
+ for(i = 5; i >= 0; i--) {
+ rx_los_all <<= 8;
+ rx_los_all |= bytes[i];
+ }
+
+ /* Populate bitmap */
+ for(i = 0; rx_los_all; i++) {
+ int p;
+ port_qsfp_cpld_map__(i, &p);
+ AIM_BITMAP_MOD(dst, p, (rx_los_all & 1));
+ rx_los_all >>= 1;
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+int
+onlp_sfpi_eeprom_read(int port, uint8_t data[256])
+{
+ char* path = as5812_54x_sfp_get_port_path(port, "sfp_eeprom");
+
+ /*
+ * Read the SFP eeprom into data[]
+ *
+ * Return MISSING if SFP is missing.
+ * Return OK if eeprom is read
+ */
+ memset(data, 0, 256);
+
+ if (deviceNodeReadBinary(path, (char*)data, 256, 256) != 0) {
+ AIM_LOG_INFO("Unable to read eeprom from port(%d)\r\n", port);
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+int
+onlp_sfpi_dom_read(int port, uint8_t data[256])
+{
+ char* path = as5812_54x_sfp_get_port_path_addr(port, 51, "sfp_eeprom");
+ memset(data, 0, 256);
+
+ if (deviceNodeReadBinary(path, (char*)data, 256, 256) != 0) {
+ AIM_LOG_INFO("Unable to read eeprom from port(%d)\r\n", port);
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+int
+onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value)
+{
+ int rv;
+
+ if (port < 0 || port >= 48) {
+ return ONLP_STATUS_E_UNSUPPORTED;
+ }
+
+ switch(control)
+ {
+ case ONLP_SFP_CONTROL_TX_DISABLE:
+ {
+ char* path = as5812_54x_sfp_get_port_path(port, "sfp_tx_disable");
+
+ if (deviceNodeWriteInt(path, value, 0) != 0) {
+ AIM_LOG_ERROR("Unable to set tx_disable status to port(%d)\r\n", port);
+ rv = ONLP_STATUS_E_INTERNAL;
+ }
+ else {
+ rv = ONLP_STATUS_OK;
+ }
+ break;
+ }
+
+ default:
+ rv = ONLP_STATUS_E_UNSUPPORTED;
+ break;
+ }
+
+ return rv;
+}
+
+int
+onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value)
+{
+ int rv;
+ char* path = NULL;
+
+ if (port < 0 || port >= 48) {
+ return ONLP_STATUS_E_UNSUPPORTED;
+ }
+
+ switch(control)
+ {
+ case ONLP_SFP_CONTROL_RX_LOS:
+ {
+ path = as5812_54x_sfp_get_port_path(port, "sfp_rx_loss");
+
+ if (as5812_54x_sfp_node_read_int(path, value, 1) != 0) {
+ AIM_LOG_ERROR("Unable to read rx_loss status from port(%d)\r\n", port);
+ rv = ONLP_STATUS_E_INTERNAL;
+ }
+ else {
+ rv = ONLP_STATUS_OK;
+ }
+ break;
+ }
+
+ case ONLP_SFP_CONTROL_TX_FAULT:
+ {
+ path = as5812_54x_sfp_get_port_path(port, "sfp_tx_fault");
+
+ if (as5812_54x_sfp_node_read_int(path, value, 1) != 0) {
+ AIM_LOG_ERROR("Unable to read tx_fault status from port(%d)\r\n", port);
+ rv = ONLP_STATUS_E_INTERNAL;
+ }
+ else {
+ rv = ONLP_STATUS_OK;
+ }
+ break;
+ }
+
+ case ONLP_SFP_CONTROL_TX_DISABLE:
+ {
+ path = as5812_54x_sfp_get_port_path(port, "sfp_tx_disable");
+
+ if (as5812_54x_sfp_node_read_int(path, value, 0) != 0) {
+ AIM_LOG_ERROR("Unable to read tx_disabled status from port(%d)\r\n", port);
+ rv = ONLP_STATUS_E_INTERNAL;
+ }
+ else {
+ rv = ONLP_STATUS_OK;
+ }
+ break;
+ }
+
+ default:
+ rv = ONLP_STATUS_E_UNSUPPORTED;
+ }
+
+ return rv;
+}
+
+int
+onlp_sfpi_denit(void)
+{
+ return ONLP_STATUS_OK;
+}
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/sysi.c b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/sysi.c
new file mode 100644
index 00000000..156fc771
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/sysi.c
@@ -0,0 +1,274 @@
+/************************************************************
+ *
+ *
+ * Copyright 2014 Big Switch Networks, Inc.
+ * Copyright 2015 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 "x86_64_accton_as5812_54x_int.h"
+#include "x86_64_accton_as5812_54x_log.h"
+#include "platform_lib.h"
+#include
+#include
+
+#define LOCAL_DEBUG 0
+
+#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \
+ if (LOCAL_DEBUG) \
+ printf("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \
+ if ((fd = open(fullpath, O_RDONLY)) == -1) \
+ return ONLP_STATUS_E_INTERNAL; \
+ if ((len = read(fd, r_data, nbytes)) <= 0){ \
+ close(fd); \
+ return ONLP_STATUS_E_INTERNAL;} \
+ if (LOCAL_DEBUG) \
+ printf("[Debug][%s][%d][read data: %s][len:%d]\n", __FUNCTION__, __LINE__, r_data, len); \
+ if (close(fd) == -1) \
+ return ONLP_STATUS_E_INTERNAL
+
+
+#define PREFIX_PATH_ON_CPLD_DEV "/sys/bus/i2c/devices/"
+#define NUM_OF_CPLD 3
+static char arr_cplddev_name[NUM_OF_CPLD][10] =
+{
+ "0-0060",
+ "0-0061",
+ "0-0062"
+};
+
+const char*
+onlp_sysi_platform_get(void)
+{
+ return "x86-64-accton-as5812-54x-r0";
+}
+
+int
+onlp_sysi_onie_data_get(uint8_t** data, int* size)
+{
+ uint8_t* rdata = aim_zmalloc(256);
+ if(onlp_file_read(rdata, 256, size, IDPROM_PATH) == ONLP_STATUS_OK) {
+ if(*size == 256) {
+ *data = rdata;
+ return ONLP_STATUS_OK;
+ }
+ }
+
+ aim_free(rdata);
+ *size = 0;
+ return ONLP_STATUS_E_INTERNAL;
+}
+
+int
+onlp_sysi_platform_info_get(onlp_platform_info_t* pi)
+{
+ int i, siz=NUM_OF_CPLD, v[NUM_OF_CPLD]={0};
+ int fd, len, nbytes = 10;
+ char r_data[10] = {0};
+ char fullpath[65] = {0};
+
+ for (i=0; icpld_versions = aim_fstrdup("%d.%d.%d", v[0], v[1], v[2]);
+ else
+ printf("This CPLD numbers are wrong !! \n");
+
+ return 0;
+}
+
+void
+onlp_sysi_platform_info_free(onlp_platform_info_t* pi)
+{
+ aim_free(pi->cpld_versions);
+}
+
+
+int
+onlp_sysi_oids_get(onlp_oid_t* table, int max)
+{
+ onlp_oid_t* e = table;
+ memset(table, 0, max*sizeof(onlp_oid_t));
+ int i;
+
+ /* 2 PSUs */
+ *e++ = ONLP_PSU_ID_CREATE(1);
+ *e++ = ONLP_PSU_ID_CREATE(2);
+
+ /* LEDs Item */
+ for (i=1; i<=CHASSIS_LED_COUNT; i++)
+ {
+ *e++ = ONLP_LED_ID_CREATE(i);
+ }
+
+ /* THERMALs Item */
+ for (i=1; i<=CHASSIS_THERMAL_COUNT; i++)
+ {
+ *e++ = ONLP_THERMAL_ID_CREATE(i);
+ }
+
+ /* Fans Item */
+ for (i=1; i<=CHASSIS_FAN_COUNT; i++)
+ {
+ *e++ = ONLP_FAN_ID_CREATE(i);
+ }
+
+ return 0;
+}
+
+/*
+ * 1. If any FAN failed, set all the other fans as full speed (100%)
+ * 2. When (LM75-1 + LM75-2)/2 >= 49.5 C, set fan speed from 40% to 65%.
+ * 3. When (LM75-1 + LM75-2)/2 >= 53C, set fan speed from 65% to 80%
+ * 4. When (LM75-1 + LM75-2)/2 >= 57.7C, set fan speed from 80% to 100%
+
+ * 5. When (LM75-1 + LM75-2)/2 <= 52.7C, set fan speed from 100% to 80%
+ * 6. When (LM75-1 + LM75-2)/2 <= 47.7C, set fan speed from 80% to 65%
+ * 7. When (LM75-1 + LM75-2)/2 <= 42.7C, set fan speed from 65% to 40%
+ * 8. The default FAN speed is 40%
+ */
+int
+onlp_sysi_platform_manage_fans(void)
+{
+#define LEV1_UP_TEMP 57500 /*temperature*/
+#define LEV1_DOWN_TEMP NULL /* unused */
+#define LEV1_SPEED_PERC 100 /*percentage*/
+
+#define LEV2_UP_TEMP 53000
+#define LEV2_DOWN_TEMP 52700
+#define LEV2_SPEED_PERC 80
+
+#define LEV3_UP_TEMP 49500
+#define LEV3_DOWN_TEMP 47700
+#define LEV3_SPEED_PERC 65
+
+#define LEV4_UP_TEMP NULL /* unused */
+#define LEV4_DOWN_TEMP 42700
+#define LEV4_SPEED_PERC 40
+
+#define FAN_NUM_ON_MAIN_BROAD 5
+
+
+ int rc, i;
+ int is_up;
+ int new_temp, temp1, temp2, diff;
+ static int new_perc = 0, ori_perc = 0;
+ static int ori_temp = 0;
+ onlp_thermal_info_t thermal_info;
+ onlp_fan_info_t fan_info;
+
+ /* get new temperature */
+ if ((rc = onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(1), &thermal_info)) != ONLP_STATUS_OK)
+ goto _EXIT;
+
+ temp1 = thermal_info.mcelsius;
+
+ if ((rc = onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(2), &thermal_info)) != ONLP_STATUS_OK)
+ goto _EXIT;
+
+ temp2 = thermal_info.mcelsius;
+
+ new_temp = (temp1+temp2)/2;
+
+ /* check fan status */
+ for (i=1; i<=FAN_NUM_ON_MAIN_BROAD; i++)
+ {
+ if ((rc = onlp_fani_info_get(ONLP_FAN_ID_CREATE(i), &fan_info)) != ONLP_STATUS_OK)
+ goto _EXIT;
+
+ if (fan_info.status & ONLP_FAN_STATUS_FAILED)
+ {
+ new_perc = LEV1_SPEED_PERC;
+ goto _CTRL;
+ }
+ }
+
+ diff = new_temp - ori_temp;
+
+ if (diff == 0)
+ goto _EXIT;
+ else
+ is_up = (diff > 0 ? 1 : 0);
+
+ if (is_up)
+ {
+ if (new_temp >= LEV1_UP_TEMP)
+ new_perc = LEV1_SPEED_PERC;
+ else if (new_temp >= LEV2_UP_TEMP)
+ new_perc = LEV2_SPEED_PERC;
+ else if (new_temp >= LEV3_UP_TEMP)
+ new_perc = LEV3_SPEED_PERC;
+ else
+ new_perc = LEV4_SPEED_PERC;
+ }
+ else
+ {
+ if (new_temp <= LEV4_DOWN_TEMP)
+ new_perc = LEV4_SPEED_PERC;
+ else if (new_temp <= LEV3_DOWN_TEMP)
+ new_perc = LEV3_SPEED_PERC;
+ else if (new_temp <= LEV2_DOWN_TEMP)
+ new_perc = LEV2_SPEED_PERC;
+ else
+ new_perc = LEV1_SPEED_PERC;
+ }
+
+_CTRL :
+
+ if (LOCAL_DEBUG)
+ printf("\n[DEBUG][%s][%d]{ori:temp=%d, perc=%d} {new:temp=%d, perc=%d}\n", __FUNCTION__, __LINE__,
+ ori_temp, ori_perc, new_temp, new_perc);
+
+ if (ori_perc == new_perc)
+ goto _EXIT;
+
+ /* ctrl fans */
+ AIM_LOG_INFO("Fan Speeds are now at %d%%", new_perc);
+
+ if ((rc = onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), new_perc)) != ONLP_STATUS_OK)
+ goto _EXIT;
+
+ /* update om */
+ ori_perc = new_perc;
+ ori_temp = new_temp;
+
+_EXIT :
+
+ return rc;
+}
+
+int
+onlp_sysi_platform_manage_leds(void)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/thermali.c b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/thermali.c
new file mode 100644
index 00000000..fcaddb08
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/thermali.c
@@ -0,0 +1,171 @@
+/************************************************************
+ *
+ *
+ * Copyright 2014 Big Switch Networks, Inc.
+ * Copyright 2015 Accton Technology Corporation.
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the
+ * License.
+ *
+ *
+ ************************************************************
+ *
+ * Thermal Sensor Platform Implementation.
+ *
+ ***********************************************************/
+#include
+#include
+#include
+#include
+#include
+
+#define prefix_path "/sys/bus/i2c/devices/"
+#define filename "temp1_input"
+#define LOCAL_DEBUG 0
+
+#define VALIDATE(_id) \
+ do { \
+ if(!ONLP_OID_IS_THERMAL(_id)) { \
+ return ONLP_STATUS_E_INVALID; \
+ } \
+ } while(0)
+
+
+#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \
+ if (LOCAL_DEBUG) \
+ printf("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \
+ if ((fd = open(fullpath, O_RDONLY)) == -1) \
+ return ONLP_STATUS_E_INTERNAL; \
+ if ((len = read(fd, r_data, nbytes)) <= 0){ \
+ close(fd); \
+ return ONLP_STATUS_E_INTERNAL;} \
+ if (LOCAL_DEBUG) \
+ printf("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \
+ if (close(fd) == -1) \
+ return ONLP_STATUS_E_INTERNAL
+
+
+enum onlp_thermal_id
+{
+ THERMAL_RESERVED = 0,
+ THERMAL_CPU_CORE,
+ THERMAL_1_ON_MAIN_BROAD,
+ THERMAL_2_ON_MAIN_BROAD,
+ THERMAL_3_ON_MAIN_BROAD,
+ THERMAL_1_ON_PSU1,
+ THERMAL_1_ON_PSU2,
+};
+
+static char* last_path[] = /* must map with onlp_thermal_id */
+{
+ "reserved",
+ NULL, /* CPU_CORE files */
+ "61-0048/",
+ "62-0049/",
+ "63-004a/",
+ "57-003c/psu_",
+ "58-003f/psu_",
+};
+
+#if 0 /* Temprarily comment below function to avoid compiler error
+ "implicit declaration of function 'onlp_file_read_int_max'" */
+static char* cpu_coretemp_files[] =
+ {
+ "/sys/devices/platform/coretemp.0/temp2_input",
+ "/sys/devices/platform/coretemp.0/temp3_input",
+ "/sys/devices/platform/coretemp.0/temp4_input",
+ "/sys/devices/platform/coretemp.0/temp5_input",
+ NULL,
+ };
+#endif
+
+/* Static values */
+static onlp_thermal_info_t linfo[] = {
+ { }, /* Not used */
+ { { ONLP_THERMAL_ID_CREATE(THERMAL_CPU_CORE), "CPU Core", 0},
+ ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 },
+ { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_MAIN_BROAD), "Chassis Thermal Sensor 1 (Front middle)", 0},
+ ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 },
+ { { ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_MAIN_BROAD), "Chassis Thermal Sensor 2 (Rear right)", 0},
+ ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 },
+ { { ONLP_THERMAL_ID_CREATE(THERMAL_3_ON_MAIN_BROAD), "Chassis Thermal Sensor 3 (Front right)", 0},
+ ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 },
+ { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU1), "PSU-1 Thermal Sensor 1", ONLP_PSU_ID_CREATE(1)},
+ ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 },
+ { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU2), "PSU-2 Thermal Sensor 1", ONLP_PSU_ID_CREATE(2)},
+ ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }
+};
+
+
+
+
+/*
+ * This will be called to intiialize the thermali subsystem.
+ */
+int
+onlp_thermali_init(void)
+{
+ return ONLP_STATUS_OK;
+}
+
+
+/*
+ * Retrieve the information structure for the given thermal OID.
+ *
+ * If the OID is invalid, return ONLP_E_STATUS_INVALID.
+ * If an unexpected error occurs, return ONLP_E_STATUS_INTERNAL.
+ * Otherwise, return ONLP_STATUS_OK with the OID's information.
+ *
+ * Note -- it is expected that you fill out the information
+ * structure even if the sensor described by the OID is not present.
+ */
+int
+onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info)
+{
+ int fd, len, nbytes = 10, temp_base=1, local_id;
+ char r_data[10] = {0};
+ char fullpath[50] = {0};
+ VALIDATE(id);
+
+ local_id = ONLP_OID_ID_GET(id);
+
+ if (LOCAL_DEBUG)
+ printf("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id);
+
+ /* Set the onlp_oid_hdr_t and capabilities */
+ *info = linfo[local_id];
+
+ if(local_id == THERMAL_CPU_CORE) {
+ #if 0 /* Temprarily comment below function to avoid compiler error
+ "implicit declaration of function 'onlp_file_read_int_max'" */
+ int rv = onlp_file_read_int_max(&info->mcelsius, cpu_coretemp_files);
+ return rv;
+ #else
+ return ONLP_STATUS_OK;
+ #endif
+ }
+
+ /* get fullpath */
+ sprintf(fullpath, "%s%s%s", prefix_path, last_path[local_id], filename);
+
+ OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
+
+ info->mcelsius = atoi(r_data)/temp_base;
+
+ if (LOCAL_DEBUG)
+ printf("\n[Debug][%s][%d][save data: %d]\n", __FUNCTION__, __LINE__, info->mcelsius);
+
+ return ONLP_STATUS_OK;
+}
+
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_config.c b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_config.c
new file mode 100644
index 00000000..66c6800b
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_config.c
@@ -0,0 +1,81 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#include
+
+/* */
+#define __x86_64_accton_as5812_54x_config_STRINGIFY_NAME(_x) #_x
+#define __x86_64_accton_as5812_54x_config_STRINGIFY_VALUE(_x) __x86_64_accton_as5812_54x_config_STRINGIFY_NAME(_x)
+x86_64_accton_as5812_54x_config_settings_t x86_64_accton_as5812_54x_config_settings[] =
+{
+#ifdef x86_64_accton_as5812_54x_CONFIG_INCLUDE_LOGGING
+ { __x86_64_accton_as5812_54x_config_STRINGIFY_NAME(x86_64_accton_as5812_54x_CONFIG_INCLUDE_LOGGING), __x86_64_accton_as5812_54x_config_STRINGIFY_VALUE(x86_64_accton_as5812_54x_CONFIG_INCLUDE_LOGGING) },
+#else
+{ x86_64_accton_as5812_54x_CONFIG_INCLUDE_LOGGING(__x86_64_accton_as5812_54x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as5812_54x_CONFIG_LOG_OPTIONS_DEFAULT
+ { __x86_64_accton_as5812_54x_config_STRINGIFY_NAME(x86_64_accton_as5812_54x_CONFIG_LOG_OPTIONS_DEFAULT), __x86_64_accton_as5812_54x_config_STRINGIFY_VALUE(x86_64_accton_as5812_54x_CONFIG_LOG_OPTIONS_DEFAULT) },
+#else
+{ x86_64_accton_as5812_54x_CONFIG_LOG_OPTIONS_DEFAULT(__x86_64_accton_as5812_54x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as5812_54x_CONFIG_LOG_BITS_DEFAULT
+ { __x86_64_accton_as5812_54x_config_STRINGIFY_NAME(x86_64_accton_as5812_54x_CONFIG_LOG_BITS_DEFAULT), __x86_64_accton_as5812_54x_config_STRINGIFY_VALUE(x86_64_accton_as5812_54x_CONFIG_LOG_BITS_DEFAULT) },
+#else
+{ x86_64_accton_as5812_54x_CONFIG_LOG_BITS_DEFAULT(__x86_64_accton_as5812_54x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as5812_54x_CONFIG_LOG_CUSTOM_BITS_DEFAULT
+ { __x86_64_accton_as5812_54x_config_STRINGIFY_NAME(x86_64_accton_as5812_54x_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __x86_64_accton_as5812_54x_config_STRINGIFY_VALUE(x86_64_accton_as5812_54x_CONFIG_LOG_CUSTOM_BITS_DEFAULT) },
+#else
+{ x86_64_accton_as5812_54x_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__x86_64_accton_as5812_54x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB
+ { __x86_64_accton_as5812_54x_config_STRINGIFY_NAME(x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB), __x86_64_accton_as5812_54x_config_STRINGIFY_VALUE(x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB) },
+#else
+{ x86_64_accton_as5812_54x_CONFIG_PORTING_STDLIB(__x86_64_accton_as5812_54x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as5812_54x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
+ { __x86_64_accton_as5812_54x_config_STRINGIFY_NAME(x86_64_accton_as5812_54x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __x86_64_accton_as5812_54x_config_STRINGIFY_VALUE(x86_64_accton_as5812_54x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) },
+#else
+{ x86_64_accton_as5812_54x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__x86_64_accton_as5812_54x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as5812_54x_CONFIG_INCLUDE_UCLI
+ { __x86_64_accton_as5812_54x_config_STRINGIFY_NAME(x86_64_accton_as5812_54x_CONFIG_INCLUDE_UCLI), __x86_64_accton_as5812_54x_config_STRINGIFY_VALUE(x86_64_accton_as5812_54x_CONFIG_INCLUDE_UCLI) },
+#else
+{ x86_64_accton_as5812_54x_CONFIG_INCLUDE_UCLI(__x86_64_accton_as5812_54x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as5812_54x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
+ { __x86_64_accton_as5812_54x_config_STRINGIFY_NAME(x86_64_accton_as5812_54x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION), __x86_64_accton_as5812_54x_config_STRINGIFY_VALUE(x86_64_accton_as5812_54x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION) },
+#else
+{ x86_64_accton_as5812_54x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION(__x86_64_accton_as5812_54x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+ { NULL, NULL }
+};
+#undef __x86_64_accton_as5812_54x_config_STRINGIFY_VALUE
+#undef __x86_64_accton_as5812_54x_config_STRINGIFY_NAME
+
+const char*
+x86_64_accton_as5812_54x_config_lookup(const char* setting)
+{
+ int i;
+ for(i = 0; x86_64_accton_as5812_54x_config_settings[i].name; i++) {
+ if(strcmp(x86_64_accton_as5812_54x_config_settings[i].name, setting)) {
+ return x86_64_accton_as5812_54x_config_settings[i].value;
+ }
+ }
+ return NULL;
+}
+
+int
+x86_64_accton_as5812_54x_config_show(struct aim_pvs_s* pvs)
+{
+ int i;
+ for(i = 0; x86_64_accton_as5812_54x_config_settings[i].name; i++) {
+ aim_printf(pvs, "%s = %s\n", x86_64_accton_as5812_54x_config_settings[i].name, x86_64_accton_as5812_54x_config_settings[i].value);
+ }
+ return i;
+}
+
+/* */
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_enums.c b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_enums.c
new file mode 100644
index 00000000..378b00a8
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_enums.c
@@ -0,0 +1,10 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#include
+
+/* <--auto.start.enum(ALL).source> */
+/* */
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_int.h b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_int.h
new file mode 100644
index 00000000..25f7e681
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_int.h
@@ -0,0 +1,12 @@
+/**************************************************************************//**
+ *
+ * x86_64_accton_as5812_54x Internal Header
+ *
+ *****************************************************************************/
+#ifndef __x86_64_accton_as5812_54x_INT_H__
+#define __x86_64_accton_as5812_54x_INT_H__
+
+#include
+
+
+#endif /* __x86_64_accton_as5812_54x_INT_H__ */
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_log.c b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_log.c
new file mode 100644
index 00000000..4e03c942
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_log.c
@@ -0,0 +1,18 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#include
+
+#include "x86_64_accton_as5812_54x_log.h"
+/*
+ * x86_64_accton_as5812_54x log struct.
+ */
+AIM_LOG_STRUCT_DEFINE(
+ x86_64_accton_as5812_54x_CONFIG_LOG_OPTIONS_DEFAULT,
+ x86_64_accton_as5812_54x_CONFIG_LOG_BITS_DEFAULT,
+ NULL, /* Custom log map */
+ x86_64_accton_as5812_54x_CONFIG_LOG_CUSTOM_BITS_DEFAULT
+ );
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_log.h b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_log.h
new file mode 100644
index 00000000..5c0f6fbf
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_log.h
@@ -0,0 +1,12 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#ifndef __x86_64_accton_as5812_54x_LOG_H__
+#define __x86_64_accton_as5812_54x_LOG_H__
+
+#define AIM_LOG_MODULE_NAME x86_64_accton_as5812_54x
+#include
+
+#endif /* __x86_64_accton_as5812_54x_LOG_H__ */
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_module.c b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_module.c
new file mode 100644
index 00000000..0d3a2f99
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_module.c
@@ -0,0 +1,24 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#include
+
+#include "x86_64_accton_as5812_54x_log.h"
+
+static int
+datatypes_init__(void)
+{
+#define x86_64_accton_as5812_54x_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
+#include
+ return 0;
+}
+
+void __x86_64_accton_as5812_54x_module_init__(void)
+{
+ AIM_LOG_STRUCT_REGISTER();
+ datatypes_init__();
+}
+
+int __onlp_platform_version__ = 1;
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_ucli.c b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_ucli.c
new file mode 100644
index 00000000..a5df3595
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/onlp/builds/src/module/src/x86_64_accton_as5812_54x_ucli.c
@@ -0,0 +1,50 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#include
+
+#if x86_64_accton_as5812_54x_CONFIG_INCLUDE_UCLI == 1
+
+#include
+#include
+#include
+
+static ucli_status_t
+x86_64_accton_as5812_54x_ucli_ucli__config__(ucli_context_t* uc)
+{
+ UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_accton_as5812_54x)
+}
+
+/* */
+/* */
+
+static ucli_module_t
+x86_64_accton_as5812_54x_ucli_module__ =
+ {
+ "x86_64_accton_as5812_54x_ucli",
+ NULL,
+ x86_64_accton_as5812_54x_ucli_ucli_handlers__,
+ NULL,
+ NULL,
+ };
+
+ucli_node_t*
+x86_64_accton_as5812_54x_ucli_node_create(void)
+{
+ ucli_node_t* n;
+ ucli_module_init(&x86_64_accton_as5812_54x_ucli_module__);
+ n = ucli_node_create("x86_64_accton_as5812_54x", NULL, &x86_64_accton_as5812_54x_ucli_module__);
+ ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_accton_as5812_54x"));
+ return n;
+}
+
+#else
+void*
+x86_64_accton_as5812_54x_ucli_node_create(void)
+{
+ return NULL;
+}
+#endif
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/Makefile b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/Makefile
new file mode 100644
index 00000000..003238cf
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/Makefile
@@ -0,0 +1 @@
+include $(ONL)/make/pkg.mk
\ No newline at end of file
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/Makefile b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/Makefile
new file mode 100644
index 00000000..003238cf
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/Makefile
@@ -0,0 +1 @@
+include $(ONL)/make/pkg.mk
\ No newline at end of file
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/PKG.yml b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/PKG.yml
new file mode 100644
index 00000000..ebd6029f
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/PKG.yml
@@ -0,0 +1 @@
+!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=accton PLATFORM=x86-64-accton-as5812-54x-r0
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/src/lib/boot/grub.cfg b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/src/lib/boot/grub.cfg
new file mode 100644
index 00000000..37ee3ba1
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/src/lib/boot/grub.cfg
@@ -0,0 +1,21 @@
+serial --port=0x2f8 --speed=115200 --word=8 --parity=no --stop=1
+terminal_input serial
+terminal_output serial
+set timeout=5
+
+# boot switch light
+menuentry OpenNetworkLinux {
+ search --no-floppy --label --set=root ONL-BOOT
+ echo 'Loading Open Network Linux ...'
+ insmod gzio
+ insmod part_msdos
+ linux /kernel-3.2-deb7-x86_64-all nopat console=ttyS1,115200n8 onl_platform=x86-64-accton-as5812-54x-r0
+ initrd /initrd-amd64
+}
+
+# Menu entry to chainload ONIE
+menuentry ONIE {
+ search --no-floppy --label --set=root ONIE-BOOT
+ echo 'Loading ONIE ...'
+ chainloader +1
+}
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/src/lib/boot/x86-64-accton-as5812-54x-r0 b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/src/lib/boot/x86-64-accton-as5812-54x-r0
new file mode 100644
index 00000000..1d035c23
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/src/lib/boot/x86-64-accton-as5812-54x-r0
@@ -0,0 +1,7 @@
+echo "pci0000:00/0000:00:14.0 ma1" >/etc/onl/net
+
+echo "LABEL=FLASH * flash" > /etc/onl/mounts
+echo "LABEL=FLASH2 * flash2" >> /etc/onl/mounts
+
+
+
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/src/lib/install/x86-64-accton-as5812-54x-r0.sh b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/src/lib/install/x86-64-accton-as5812-54x-r0.sh
new file mode 100644
index 00000000..e62ede0a
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/src/lib/install/x86-64-accton-as5812-54x-r0.sh
@@ -0,0 +1,15 @@
+############################################################
+#
+#
+# Copyright 2013, 2014 BigSwitch Networks, Inc.
+#
+#
+#
+#
+############################################################
+# Platform data goes here.
+
+platform_installer() {
+ # Standard isntallation to an available GPT partition
+ installer_standard_gpt_install /dev/sda
+}
diff --git a/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/src/python/x86_64_accton_as5812_54x_r0/__init__.py b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/src/python/x86_64_accton_as5812_54x_r0/__init__.py
new file mode 100644
index 00000000..a6e42e20
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as5812-54x/platform-config/r0/src/python/x86_64_accton_as5812_54x_r0/__init__.py
@@ -0,0 +1,21 @@
+from onl.platform.base import *
+from onl.platform.accton import *
+
+class OnlPlatform_x86_64_accton_as5812_54x_r0(OnlPlatformAccton):
+
+
+ def model(self):
+ return "AS5812-54X"
+
+ def platform(self):
+ return "x86-64-accton-as5812-54x-r0"
+
+ def sys_init(self):
+ pass
+
+ def sys_oid_platform(self):
+ return ".5812.54"
+
+ def baseconfig(self):
+ return os.system(os.path.join(self.platform_basedir(), "boot", "x86-64-accton-as5812-54x-r0-devices.sh")) == 0
+ return True
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/Makefile b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/Makefile
new file mode 100644
index 00000000..003238cf
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/Makefile
@@ -0,0 +1 @@
+include $(ONL)/make/pkg.mk
\ No newline at end of file
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/Makefile b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/Makefile
new file mode 100644
index 00000000..e7437cb2
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/Makefile
@@ -0,0 +1,2 @@
+FILTER=src
+include $(ONL)/make/subdirs.mk
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/lib/Makefile b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/lib/Makefile
new file mode 100644
index 00000000..26e44cef
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/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-accton-as7512-32x-r0
+include $(BUILDER)/standardinit.mk
+
+DEPENDMODULES := AIM IOF x86_64_accton_as7512_32x onlplib
+DEPENDMODULE_HEADERS := sff
+
+include $(BUILDER)/dependmodules.mk
+
+SHAREDLIB := libonlp-x86-64-accton-as7512-32x-r0.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/accton/x86-64-accton-as7512-32x/onlp/builds/lib/libonlp-x86-64-accton-as7512-32x-r0.mk b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/lib/libonlp-x86-64-accton-as7512-32x-r0.mk
new file mode 100644
index 00000000..8d586f08
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/lib/libonlp-x86-64-accton-as7512-32x-r0.mk
@@ -0,0 +1,10 @@
+
+###############################################################################
+#
+# Inclusive Makefile for the libonlp-x86-64-accton-as7512-32x-r0 module.
+#
+# Autogenerated 2015-12-23 00:41:39.666568
+#
+###############################################################################
+libonlp-x86-64-accton-as7512-32x-r0_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/lib/x86_64_accton_as7512_32x.mk b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/lib/x86_64_accton_as7512_32x.mk
new file mode 100644
index 00000000..d71a854d
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/lib/x86_64_accton_as7512_32x.mk
@@ -0,0 +1,10 @@
+
+###############################################################################
+#
+# Inclusive Makefile for the x86_64_accton_as7512_32x module.
+#
+# Autogenerated 2015-12-23 17:22:12.128275
+#
+###############################################################################
+x86_64_accton_as7512_32x_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/onlpdump/Makefile b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/onlpdump/Makefile
new file mode 100644
index 00000000..12a4b780
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/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_accton_as7512_32x 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/accton/x86-64-accton-as7512-32x/onlp/builds/onlpdump/onlpdump.mk b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/onlpdump/onlpdump.mk
new file mode 100644
index 00000000..7c13a8d5
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/onlpdump/onlpdump.mk
@@ -0,0 +1,10 @@
+
+###############################################################################
+#
+# Inclusive Makefile for the onlpdump module.
+#
+# Autogenerated 2015-12-22 23:17:07.303835
+#
+###############################################################################
+onlpdump_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/Makefile b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/Makefile
new file mode 100644
index 00000000..0feeb639
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/Makefile
@@ -0,0 +1,9 @@
+###############################################################################
+#
+#
+#
+###############################################################################
+include ../../init.mk
+MODULE := x86_64_accton_as7512_32x
+AUTOMODULE := x86_64_accton_as7512_32x
+include $(BUILDER)/definemodule.mk
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/README b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/README
new file mode 100644
index 00000000..72089c9a
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/README
@@ -0,0 +1,6 @@
+###############################################################################
+#
+# x86_64_accton_as5712_54x README
+#
+###############################################################################
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/auto/make.mk b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/auto/make.mk
new file mode 100644
index 00000000..cf66fee0
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/auto/make.mk
@@ -0,0 +1,9 @@
+###############################################################################
+#
+# x86_64_accton_as7512_32x Autogeneration
+#
+###############################################################################
+x86_64_accton_as7512_32x_AUTO_DEFS := module/auto/x86_64_accton_as7512_32x.yml
+x86_64_accton_as7512_32x_AUTO_DIRS := module/inc/x86_64_accton_as7512_32x module/src
+include $(BUILDER)/auto.mk
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/auto/x86_64_accton_as7512_32x.yml b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/auto/x86_64_accton_as7512_32x.yml
new file mode 100644
index 00000000..ce39b017
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/auto/x86_64_accton_as7512_32x.yml
@@ -0,0 +1,50 @@
+###############################################################################
+#
+# x86_64_accton_as7512_32x Autogeneration Definitions.
+#
+###############################################################################
+
+cdefs: &cdefs
+- x86_64_accton_as7512_32x_CONFIG_INCLUDE_LOGGING:
+ doc: "Include or exclude logging."
+ default: 1
+- x86_64_accton_as7512_32x_CONFIG_LOG_OPTIONS_DEFAULT:
+ doc: "Default enabled log options."
+ default: AIM_LOG_OPTIONS_DEFAULT
+- x86_64_accton_as7512_32x_CONFIG_LOG_BITS_DEFAULT:
+ doc: "Default enabled log bits."
+ default: AIM_LOG_BITS_DEFAULT
+- x86_64_accton_as7512_32x_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
+ doc: "Default enabled custom log bits."
+ default: 0
+- x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB:
+ doc: "Default all porting macros to use the C standard libraries."
+ default: 1
+- x86_64_accton_as7512_32x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
+ doc: "Include standard library headers for stdlib porting macros."
+ default: x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB
+- x86_64_accton_as7512_32x_CONFIG_INCLUDE_UCLI:
+ doc: "Include generic uCli support."
+ default: 0
+- x86_64_accton_as7512_32x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION:
+ doc: "Assume chassis fan direction is the same as the PSU fan direction."
+ default: 0
+
+
+definitions:
+ cdefs:
+ x86_64_accton_as7512_32x_CONFIG_HEADER:
+ defs: *cdefs
+ basename: x86_64_accton_as7512_32x_config
+
+ portingmacro:
+ x86_64_accton_as7512_32x:
+ macros:
+ - malloc
+ - free
+ - memset
+ - memcpy
+ - strncpy
+ - vsnprintf
+ - snprintf
+ - strlen
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x.x b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x.x
new file mode 100644
index 00000000..de1d622c
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x.x
@@ -0,0 +1,14 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#include
+
+/* <--auto.start.xmacro(ALL).define> */
+/* */
+
+/* <--auto.start.xenum(ALL).define> */
+/* */
+
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x_config.h b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x_config.h
new file mode 100644
index 00000000..50021425
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x_config.h
@@ -0,0 +1,137 @@
+/**************************************************************************//**
+ *
+ * @file
+ * @brief x86_64_accton_as7512_32x Configuration Header
+ *
+ * @addtogroup x86_64_accton_as7512_32x-config
+ * @{
+ *
+ *****************************************************************************/
+#ifndef __x86_64_accton_as7512_32x_CONFIG_H__
+#define __x86_64_accton_as7512_32x_CONFIG_H__
+
+#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG
+#include
+#endif
+#ifdef x86_64_accton_as7512_32x_INCLUDE_CUSTOM_CONFIG
+#include
+#endif
+
+/* */
+#include
+/**
+ * x86_64_accton_as7512_32x_CONFIG_INCLUDE_LOGGING
+ *
+ * Include or exclude logging. */
+
+
+#ifndef x86_64_accton_as7512_32x_CONFIG_INCLUDE_LOGGING
+#define x86_64_accton_as7512_32x_CONFIG_INCLUDE_LOGGING 1
+#endif
+
+/**
+ * x86_64_accton_as7512_32x_CONFIG_LOG_OPTIONS_DEFAULT
+ *
+ * Default enabled log options. */
+
+
+#ifndef x86_64_accton_as7512_32x_CONFIG_LOG_OPTIONS_DEFAULT
+#define x86_64_accton_as7512_32x_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT
+#endif
+
+/**
+ * x86_64_accton_as7512_32x_CONFIG_LOG_BITS_DEFAULT
+ *
+ * Default enabled log bits. */
+
+
+#ifndef x86_64_accton_as7512_32x_CONFIG_LOG_BITS_DEFAULT
+#define x86_64_accton_as7512_32x_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT
+#endif
+
+/**
+ * x86_64_accton_as7512_32x_CONFIG_LOG_CUSTOM_BITS_DEFAULT
+ *
+ * Default enabled custom log bits. */
+
+
+#ifndef x86_64_accton_as7512_32x_CONFIG_LOG_CUSTOM_BITS_DEFAULT
+#define x86_64_accton_as7512_32x_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0
+#endif
+
+/**
+ * x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB
+ *
+ * Default all porting macros to use the C standard libraries. */
+
+
+#ifndef x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB
+#define x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB 1
+#endif
+
+/**
+ * x86_64_accton_as7512_32x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
+ *
+ * Include standard library headers for stdlib porting macros. */
+
+
+#ifndef x86_64_accton_as7512_32x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
+#define x86_64_accton_as7512_32x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB
+#endif
+
+/**
+ * x86_64_accton_as7512_32x_CONFIG_INCLUDE_UCLI
+ *
+ * Include generic uCli support. */
+
+
+#ifndef x86_64_accton_as7512_32x_CONFIG_INCLUDE_UCLI
+#define x86_64_accton_as7512_32x_CONFIG_INCLUDE_UCLI 0
+#endif
+
+/**
+ * x86_64_accton_as7512_32x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
+ *
+ * Assume chassis fan direction is the same as the PSU fan direction. */
+
+
+#ifndef x86_64_accton_as7512_32x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
+#define x86_64_accton_as7512_32x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION 0
+#endif
+
+
+
+/**
+ * All compile time options can be queried or displayed
+ */
+
+/** Configuration settings structure. */
+typedef struct x86_64_accton_as7512_32x_config_settings_s {
+ /** name */
+ const char* name;
+ /** value */
+ const char* value;
+} x86_64_accton_as7512_32x_config_settings_t;
+
+/** Configuration settings table. */
+/** x86_64_accton_as7512_32x_config_settings table. */
+extern x86_64_accton_as7512_32x_config_settings_t x86_64_accton_as7512_32x_config_settings[];
+
+/**
+ * @brief Lookup a configuration setting.
+ * @param setting The name of the configuration option to lookup.
+ */
+const char* x86_64_accton_as7512_32x_config_lookup(const char* setting);
+
+/**
+ * @brief Show the compile-time configuration.
+ * @param pvs The output stream.
+ */
+int x86_64_accton_as7512_32x_config_show(struct aim_pvs_s* pvs);
+
+/* */
+
+#include "x86_64_accton_as7512_32x_porting.h"
+
+#endif /* __x86_64_accton_as7512_32x_CONFIG_H__ */
+/* @} */
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x_dox.h b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x_dox.h
new file mode 100644
index 00000000..cd5afb37
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x_dox.h
@@ -0,0 +1,26 @@
+/**************************************************************************//**
+ *
+ * x86_64_accton_as7512_32x Doxygen Header
+ *
+ *****************************************************************************/
+#ifndef __x86_64_accton_as7512_32x_DOX_H__
+#define __x86_64_accton_as7512_32x_DOX_H__
+
+/**
+ * @defgroup x86_64_accton_as7512_32x x86_64_accton_as7512_32x - x86_64_accton_as7512_32x Description
+ *
+
+The documentation overview for this module should go here.
+
+ *
+ * @{
+ *
+ * @defgroup x86_64_accton_as7512_32x-x86_64_accton_as7512_32x Public Interface
+ * @defgroup x86_64_accton_as7512_32x-config Compile Time Configuration
+ * @defgroup x86_64_accton_as7512_32x-porting Porting Macros
+ *
+ * @}
+ *
+ */
+
+#endif /* __x86_64_accton_as7512_32x_DOX_H__ */
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x_porting.h b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x_porting.h
new file mode 100644
index 00000000..a1382c54
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x_porting.h
@@ -0,0 +1,107 @@
+/**************************************************************************//**
+ *
+ * @file
+ * @brief x86_64_accton_as7512_32x Porting Macros.
+ *
+ * @addtogroup x86_64_accton_as7512_32x-porting
+ * @{
+ *
+ *****************************************************************************/
+#ifndef __x86_64_accton_as7512_32x_PORTING_H__
+#define __x86_64_accton_as7512_32x_PORTING_H__
+
+
+/* */
+#if x86_64_accton_as7512_32x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1
+#include
+#include
+#include
+#include
+#include
+#endif
+
+#ifndef x86_64_accton_as7512_32x_MALLOC
+ #if defined(GLOBAL_MALLOC)
+ #define x86_64_accton_as7512_32x_MALLOC GLOBAL_MALLOC
+ #elif x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as7512_32x_MALLOC malloc
+ #else
+ #error The macro x86_64_accton_as7512_32x_MALLOC is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as7512_32x_FREE
+ #if defined(GLOBAL_FREE)
+ #define x86_64_accton_as7512_32x_FREE GLOBAL_FREE
+ #elif x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as7512_32x_FREE free
+ #else
+ #error The macro x86_64_accton_as7512_32x_FREE is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as7512_32x_MEMSET
+ #if defined(GLOBAL_MEMSET)
+ #define x86_64_accton_as7512_32x_MEMSET GLOBAL_MEMSET
+ #elif x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as7512_32x_MEMSET memset
+ #else
+ #error The macro x86_64_accton_as7512_32x_MEMSET is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as7512_32x_MEMCPY
+ #if defined(GLOBAL_MEMCPY)
+ #define x86_64_accton_as7512_32x_MEMCPY GLOBAL_MEMCPY
+ #elif x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as7512_32x_MEMCPY memcpy
+ #else
+ #error The macro x86_64_accton_as7512_32x_MEMCPY is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as7512_32x_STRNCPY
+ #if defined(GLOBAL_STRNCPY)
+ #define x86_64_accton_as7512_32x_STRNCPY GLOBAL_STRNCPY
+ #elif x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as7512_32x_STRNCPY strncpy
+ #else
+ #error The macro x86_64_accton_as7512_32x_STRNCPY is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as7512_32x_VSNPRINTF
+ #if defined(GLOBAL_VSNPRINTF)
+ #define x86_64_accton_as7512_32x_VSNPRINTF GLOBAL_VSNPRINTF
+ #elif x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as7512_32x_VSNPRINTF vsnprintf
+ #else
+ #error The macro x86_64_accton_as7512_32x_VSNPRINTF is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as7512_32x_SNPRINTF
+ #if defined(GLOBAL_SNPRINTF)
+ #define x86_64_accton_as7512_32x_SNPRINTF GLOBAL_SNPRINTF
+ #elif x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as7512_32x_SNPRINTF snprintf
+ #else
+ #error The macro x86_64_accton_as7512_32x_SNPRINTF is required but cannot be defined.
+ #endif
+#endif
+
+#ifndef x86_64_accton_as7512_32x_STRLEN
+ #if defined(GLOBAL_STRLEN)
+ #define x86_64_accton_as7512_32x_STRLEN GLOBAL_STRLEN
+ #elif x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB == 1
+ #define x86_64_accton_as7512_32x_STRLEN strlen
+ #else
+ #error The macro x86_64_accton_as7512_32x_STRLEN is required but cannot be defined.
+ #endif
+#endif
+
+/* */
+
+
+#endif /* __x86_64_accton_as7512_32x_PORTING_H__ */
+/* @} */
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/make.mk b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/make.mk
new file mode 100644
index 00000000..29ab895c
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/make.mk
@@ -0,0 +1,10 @@
+###############################################################################
+#
+#
+#
+###############################################################################
+THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+x86_64_accton_as7512_32x_INCLUDES := -I $(THIS_DIR)inc
+x86_64_accton_as7512_32x_INTERNAL_INCLUDES := -I $(THIS_DIR)src
+x86_64_accton_as7512_32x_DEPENDMODULE_ENTRIES := init:x86_64_accton_as7512_32x ucli:x86_64_accton_as7512_32x
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/Makefile b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/Makefile
new file mode 100644
index 00000000..93bbe933
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/Makefile
@@ -0,0 +1,9 @@
+###############################################################################
+#
+# Local source generation targets.
+#
+###############################################################################
+
+ucli:
+ @../../../../tools/uclihandlers.py x86_64_accton_as7512_32x_ucli.c
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/debug.c b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/debug.c
new file mode 100644
index 00000000..ec9ddd8f
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/debug.c
@@ -0,0 +1,45 @@
+#include "x86_64_accton_as7512_32x_int.h"
+
+#if x86_64_accton_as7512_32x_CONFIG_INCLUDE_DEBUG == 1
+
+#include
+
+static char help__[] =
+ "Usage: debug [options]\n"
+ " -c CPLD Versions\n"
+ " -h Help\n"
+ ;
+
+int
+x86_64_accton_as7512_32x_debug_main(int argc, char* argv[])
+{
+ int c = 0;
+ int help = 0;
+ int rv = 0;
+
+ while( (c = getopt(argc, argv, "ch")) != -1) {
+ switch(c)
+ {
+ case 'c': c = 1; break;
+ case 'h': help = 1; rv = 0; break;
+ default: help = 1; rv = 1; break;
+ }
+
+ }
+
+ if(help || argc == 1) {
+ printf("%s", help__);
+ return rv;
+ }
+
+ if(c) {
+ printf("Not implemented.\n");
+ }
+
+
+ return 0;
+}
+
+#endif
+
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/fani.c b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/fani.c
new file mode 100644
index 00000000..d81a89fc
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/fani.c
@@ -0,0 +1,387 @@
+/************************************************************
+ *
+ *
+ * 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 "platform_lib.h"
+
+#define PREFIX_PATH_ON_MAIN_BOARD "/sys/bus/i2c/devices/2-0066/"
+#define PREFIX_PATH_ON_PSU "/sys/bus/i2c/devices/"
+
+#define MAX_FAN_SPEED 18000
+#define MAX_PSU_FAN_SPEED 25500
+
+#define PROJECT_NAME
+#define LEN_FILE_NAME 80
+
+#define FAN_RESERVED 0
+#define FAN_1_ON_MAIN_BOARD 1
+#define FAN_2_ON_MAIN_BOARD 2
+#define FAN_3_ON_MAIN_BOARD 3
+#define FAN_4_ON_MAIN_BOARD 4
+#define FAN_5_ON_MAIN_BOARD 5
+#define FAN_6_ON_MAIN_BOARD 6
+#define FAN_1_ON_PSU1 7
+#define FAN_1_ON_PSU2 8
+
+typedef struct fan_path_S
+{
+ char status[LEN_FILE_NAME];
+ char speed[LEN_FILE_NAME];
+ char ctrl_speed[LEN_FILE_NAME];
+ char r_speed[LEN_FILE_NAME];
+}fan_path_T;
+
+#define _MAKE_FAN_PATH_ON_MAIN_BOARD(prj,id) \
+ { #prj"fan"#id"_fault", #prj"fan"#id"_front_speed_rpm", \
+ #prj"fan"#id"_duty_cycle_percentage", #prj"fan"#id"_rear_speed_rpm" }
+
+#define MAKE_FAN_PATH_ON_MAIN_BOARD(prj,id) _MAKE_FAN_PATH_ON_MAIN_BOARD(prj,id)
+
+#define MAKE_FAN_PATH_ON_PSU(folder) \
+ {#folder"/psu_fan1_fault", #folder"/psu_fan1_speed_rpm", \
+ #folder"/psu_fan1_duty_cycle_percentage", "" }
+
+static fan_path_T fan_path[] = /* must map with onlp_fan_id */
+{
+ MAKE_FAN_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_RESERVED),
+ MAKE_FAN_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_1_ON_MAIN_BOARD),
+ MAKE_FAN_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_2_ON_MAIN_BOARD),
+ MAKE_FAN_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_3_ON_MAIN_BOARD),
+ MAKE_FAN_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_4_ON_MAIN_BOARD),
+ MAKE_FAN_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_5_ON_MAIN_BOARD),
+ MAKE_FAN_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_6_ON_MAIN_BOARD),
+ MAKE_FAN_PATH_ON_PSU(10-0058),
+ MAKE_FAN_PATH_ON_PSU(11-005b)
+};
+
+#define MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(id) \
+ { \
+ { ONLP_FAN_ID_CREATE(FAN_##id##_ON_MAIN_BOARD), "Chassis Fan "#id, 0 }, \
+ 0x0, \
+ (ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE), \
+ 0, \
+ 0, \
+ ONLP_FAN_MODE_INVALID, \
+ }
+
+#define MAKE_FAN_INFO_NODE_ON_PSU(psu_id, fan_id) \
+ { \
+ { ONLP_FAN_ID_CREATE(FAN_##fan_id##_ON_PSU##psu_id), "Chassis PSU-"#psu_id " Fan "#fan_id, 0 }, \
+ 0x0, \
+ (ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE), \
+ 0, \
+ 0, \
+ ONLP_FAN_MODE_INVALID, \
+ }
+
+/* Static fan information */
+onlp_fan_info_t linfo[] = {
+ { }, /* Not used */
+ MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(1),
+ MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(2),
+ MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(3),
+ MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(4),
+ MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(5),
+ MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(6),
+ MAKE_FAN_INFO_NODE_ON_PSU(1,1),
+ MAKE_FAN_INFO_NODE_ON_PSU(2,1),
+};
+
+#define VALIDATE(_id) \
+ do { \
+ if(!ONLP_OID_IS_FAN(_id)) { \
+ return ONLP_STATUS_E_INVALID; \
+ } \
+ } while(0)
+
+#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \
+ DEBUG_PRINT("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \
+ if ((fd = open(fullpath, O_RDONLY)) == -1) \
+ return ONLP_STATUS_E_INTERNAL; \
+ if ((len = read(fd, r_data, nbytes)) <= 0){ \
+ close(fd); \
+ return ONLP_STATUS_E_INTERNAL;} \
+ DEBUG_PRINT("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \
+ if (close(fd) == -1) \
+ return ONLP_STATUS_E_INTERNAL
+
+/* There is no CPLD register for reading fan direction on this platform,
+ * to read fan direction, we need to read from PSU-fan,
+ * the direction of PSU-fan and chassis-fan are the same.
+ */
+static uint32_t
+_onlp_fani_info_get_fan_direction(void)
+{
+ /* Try to read direction from PSU1.
+ * If PSU1 is not valid, read from PSU2
+ */
+ int i = 0;
+
+ for (i = PSU1_ID; i <= PSU2_ID; i++) {
+ psu_type_t psu_type;
+ psu_type = get_psu_type(i, NULL, 0);
+
+ if (psu_type == PSU_TYPE_UNKNOWN) {
+ continue;
+ }
+
+ if (PSU_TYPE_AC_F2B == psu_type) {
+ return ONLP_FAN_STATUS_F2B;
+ }
+ else {
+ return ONLP_FAN_STATUS_B2F;
+ }
+ }
+
+ return 0;
+}
+
+static int
+_onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info)
+{
+ int fd, len, nbytes = 10;
+ char r_data[10] = {0};
+ char fullpath[65] = {0};
+
+ /* get fan fault status (turn on when any one fails)
+ */
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].status);
+ OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
+ if (atoi(r_data) > 0) {
+ info->status |= ONLP_FAN_STATUS_FAILED;
+ }
+
+ /* get fan direction (both : the same)
+ */
+ info->status |= _onlp_fani_info_get_fan_direction();
+
+ /* get fan speed (take the min from two speeds)
+ */
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].speed);
+ OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
+ info->rpm = atoi(r_data);
+
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].r_speed);
+ OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
+ if (info->rpm > atoi(r_data)) {
+ info->rpm = atoi(r_data);
+ }
+
+ /* get speed percentage from rpm */
+ info->percentage = (info->rpm * 100)/MAX_FAN_SPEED;
+
+ /* check present */
+ if (info->rpm > 0) {
+ info->status |= ONLP_FAN_STATUS_PRESENT;
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+static int
+_onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info)
+{
+ int fd, len, nbytes = 10;
+ char r_data[10] = {0};
+ char fullpath[80] = {0};
+
+ /* get fan direction
+ */
+ info->status |= _onlp_fani_info_get_fan_direction();
+
+ /* get fan fault status
+ */
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].status);
+ OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
+ info->status |= (atoi(r_data) > 0) ? ONLP_FAN_STATUS_FAILED : 0;
+
+ /* get fan speed
+ */
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].speed);
+ OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len);
+ info->rpm = atoi(r_data);
+
+ /* get speed percentage from rpm */
+ info->percentage = (info->rpm * 100) / MAX_PSU_FAN_SPEED;
+ info->status |= ONLP_FAN_STATUS_PRESENT;
+
+ return ONLP_STATUS_OK;
+}
+
+/*
+ * This function will be called prior to all of onlp_fani_* functions.
+ */
+int
+onlp_fani_init(void)
+{
+ return ONLP_STATUS_OK;
+}
+
+int
+onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info)
+{
+ int rc = 0;
+ int local_id;
+ VALIDATE(id);
+
+ local_id = ONLP_OID_ID_GET(id);
+ *info = linfo[local_id];
+
+ switch (local_id)
+ {
+ case FAN_1_ON_PSU1:
+ case FAN_1_ON_PSU2:
+ rc = _onlp_fani_info_get_fan_on_psu(local_id, info);
+ break;
+ case FAN_1_ON_MAIN_BOARD:
+ case FAN_2_ON_MAIN_BOARD:
+ case FAN_3_ON_MAIN_BOARD:
+ case FAN_4_ON_MAIN_BOARD:
+ case FAN_5_ON_MAIN_BOARD:
+ case FAN_6_ON_MAIN_BOARD:
+ rc =_onlp_fani_info_get_fan(local_id, info);
+ break;
+ default:
+ rc = ONLP_STATUS_E_INVALID;
+ break;
+ }
+
+ return rc;
+}
+
+/*
+ * This function sets the speed of the given fan in RPM.
+ *
+ * This function will only be called if the fan supprots the RPM_SET
+ * capability.
+ *
+ * It is optional if you have no fans at all with this feature.
+ */
+int
+onlp_fani_rpm_set(onlp_oid_t id, int rpm)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
+/*
+ * This function sets the fan speed of the given OID as a percentage.
+ *
+ * This will only be called if the OID has the PERCENTAGE_SET
+ * capability.
+ *
+ * It is optional if you have no fans at all with this feature.
+ */
+int
+onlp_fani_percentage_set(onlp_oid_t id, int p)
+{
+ int fd, len, nbytes=10, local_id;
+ char data[10] = {0};
+ char fullpath[70] = {0};
+
+ VALIDATE(id);
+
+ local_id = ONLP_OID_ID_GET(id);
+
+ /* reject p=0 (p=0, stop fan) */
+ if (p == 0){
+ return ONLP_STATUS_E_INVALID;
+ }
+
+ /* get fullpath */
+ switch (local_id)
+ {
+ case FAN_1_ON_PSU1:
+ case FAN_1_ON_PSU2:
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].ctrl_speed);
+ break;
+ case FAN_1_ON_MAIN_BOARD:
+ case FAN_2_ON_MAIN_BOARD:
+ case FAN_3_ON_MAIN_BOARD:
+ case FAN_4_ON_MAIN_BOARD:
+ case FAN_5_ON_MAIN_BOARD:
+ case FAN_6_ON_MAIN_BOARD:
+ sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].ctrl_speed);
+ break;
+ default:
+ return ONLP_STATUS_E_INVALID;
+ }
+ sprintf(data, "%d", p);
+ DEBUG_PRINT("[Debug][%s][%d][openfile: %s][data=%s]\n", __FUNCTION__, __LINE__, fullpath, data);
+
+ /* Create output file descriptor */
+ fd = open(fullpath, O_WRONLY, 0644);
+ if (fd == -1){
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ len = write (fd, data, (ssize_t) nbytes);
+ if (len != nbytes) {
+ close(fd);
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ close(fd);
+ return ONLP_STATUS_OK;
+}
+
+
+/*
+ * This function sets the fan speed of the given OID as per
+ * the predefined ONLP fan speed modes: off, slow, normal, fast, max.
+ *
+ * Interpretation of these modes is up to the platform.
+ *
+ */
+int
+onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
+/*
+ * This function sets the fan direction of the given OID.
+ *
+ * This function is only relevant if the fan OID supports both direction
+ * capabilities.
+ *
+ * This function is optional unless the functionality is available.
+ */
+int
+onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
+/*
+ * Generic fan ioctl. Optional.
+ */
+int
+onlp_fani_ioctl(onlp_oid_t id, va_list vargs)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/ledi.c b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/ledi.c
new file mode 100644
index 00000000..03f0a1e5
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/ledi.c
@@ -0,0 +1,258 @@
+/************************************************************
+ *
+ *
+ * Copyright 2014 Big Switch Networks, Inc.
+ * Copyright 2014 Accton Technology Corporation.
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the
+ * License.
+ *
+ *
+ ************************************************************
+ *
+ *
+ *
+ ***********************************************************/
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "platform_lib.h"
+
+#define prefix_path "/sys/class/leds/accton_as7512_32x_led::"
+#define filename "brightness"
+
+#define VALIDATE(_id) \
+ do { \
+ if(!ONLP_OID_IS_LED(_id)) { \
+ return ONLP_STATUS_E_INVALID; \
+ } \
+ } while(0)
+
+/* LED related data
+ */
+enum onlp_led_id
+{
+ LED_RESERVED = 0,
+ LED_DIAG,
+ LED_LOC,
+ LED_FAN,
+ LED_PSU1,
+ LED_PSU2
+};
+
+enum led_light_mode {
+ LED_MODE_OFF = 0,
+ LED_MODE_GREEN,
+ LED_MODE_AMBER,
+ LED_MODE_RED,
+ LED_MODE_BLUE,
+ LED_MODE_GREEN_BLINK,
+ LED_MODE_AMBER_BLINK,
+ LED_MODE_RED_BLINK,
+ LED_MODE_BLUE_BLINK,
+ LED_MODE_AUTO,
+ LED_MODE_UNKNOWN
+};
+
+typedef struct led_light_mode_map {
+ enum onlp_led_id id;
+ enum led_light_mode driver_led_mode;
+ enum onlp_led_mode_e onlp_led_mode;
+} led_light_mode_map_t;
+
+led_light_mode_map_t led_map[] = {
+{LED_DIAG, LED_MODE_OFF, ONLP_LED_MODE_OFF},
+{LED_DIAG, LED_MODE_GREEN, ONLP_LED_MODE_GREEN},
+{LED_DIAG, LED_MODE_AMBER, ONLP_LED_MODE_ORANGE},
+{LED_DIAG, LED_MODE_RED, ONLP_LED_MODE_RED},
+{LED_LOC, LED_MODE_OFF, ONLP_LED_MODE_OFF},
+{LED_LOC, LED_MODE_BLUE, ONLP_LED_MODE_BLUE},
+{LED_FAN, LED_MODE_AUTO, ONLP_LED_MODE_AUTO},
+{LED_PSU1, LED_MODE_AUTO, ONLP_LED_MODE_AUTO},
+{LED_PSU2, LED_MODE_AUTO, ONLP_LED_MODE_AUTO}
+};
+
+static char last_path[][10] = /* must map with onlp_led_id */
+{
+ "reserved",
+ "diag",
+ "loc",
+ "fan",
+ "psu1",
+ "psu2"
+};
+
+/*
+ * Get the information for the given LED OID.
+ */
+static onlp_led_info_t linfo[] =
+{
+ { }, /* Not used */
+ {
+ { ONLP_LED_ID_CREATE(LED_DIAG), "Chassis LED 1 (DIAG LED)", 0 },
+ ONLP_LED_STATUS_PRESENT,
+ ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_ORANGE,
+ },
+ {
+ { ONLP_LED_ID_CREATE(LED_LOC), "Chassis LED 2 (LOC LED)", 0 },
+ ONLP_LED_STATUS_PRESENT,
+ ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_BLUE,
+ },
+ {
+ { ONLP_LED_ID_CREATE(LED_FAN), "Chassis LED 3 (FAN LED)", 0 },
+ ONLP_LED_STATUS_PRESENT,
+ ONLP_LED_CAPS_AUTO,
+ },
+ {
+ { ONLP_LED_ID_CREATE(LED_PSU1), "Chassis LED 4 (PSU1 LED)", 0 },
+ ONLP_LED_STATUS_PRESENT,
+ ONLP_LED_CAPS_AUTO,
+ },
+ {
+ { ONLP_LED_ID_CREATE(LED_PSU2), "Chassis LED 4 (PSU2 LED)", 0 },
+ ONLP_LED_STATUS_PRESENT,
+ ONLP_LED_CAPS_AUTO,
+ },
+};
+
+static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode)
+{
+ int i, nsize = sizeof(led_map)/sizeof(led_map[0]);
+
+ for (i = 0; i < nsize; i++)
+ {
+ if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode)
+ {
+ return led_map[i].onlp_led_mode;
+ }
+ }
+
+ return 0;
+}
+
+static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode)
+{
+ int i, nsize = sizeof(led_map)/sizeof(led_map[0]);
+
+ for(i = 0; i < nsize; i++)
+ {
+ if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode)
+ {
+ return led_map[i].driver_led_mode;
+ }
+ }
+
+ return 0;
+}
+
+/*
+ * This function will be called prior to any other onlp_ledi_* functions.
+ */
+int
+onlp_ledi_init(void)
+{
+ return ONLP_STATUS_OK;
+}
+
+int
+onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
+{
+ int local_id;
+ char data[2] = {0};
+ char fullpath[50] = {0};
+
+ VALIDATE(id);
+
+ local_id = ONLP_OID_ID_GET(id);
+
+ /* get fullpath */
+ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
+
+ /* Set the onlp_oid_hdr_t and capabilities */
+ *info = linfo[ONLP_OID_ID_GET(id)];
+
+ /* Set LED mode */
+ if (deviceNodeReadString(fullpath, data, sizeof(data), 0) != 0) {
+ DEBUG_PRINT("%s(%d)\r\n", __FUNCTION__, __LINE__);
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ info->mode = driver_to_onlp_led_mode(local_id, atoi(data));
+
+ /* Set the on/off status */
+ if (info->mode != ONLP_LED_MODE_OFF) {
+ info->status |= ONLP_LED_STATUS_ON;
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+/*
+ * Turn an LED on or off.
+ *
+ * This function will only be called if the LED OID supports the ONOFF
+ * capability.
+ *
+ * What 'on' means in terms of colors or modes for multimode LEDs is
+ * up to the platform to decide. This is intended as baseline toggle mechanism.
+ */
+int
+onlp_ledi_set(onlp_oid_t id, int on_or_off)
+{
+ VALIDATE(id);
+
+ if (!on_or_off) {
+ return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF);
+ }
+
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
+/*
+ * This function puts the LED into the given mode. It is a more functional
+ * interface for multimode LEDs.
+ *
+ * Only modes reported in the LED's capabilities will be attempted.
+ */
+int
+onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
+{
+ int local_id;
+ char fullpath[50] = {0};
+
+ VALIDATE(id);
+
+ local_id = ONLP_OID_ID_GET(id);
+ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename);
+
+ if (deviceNodeWriteInt(fullpath, onlp_to_driver_led_mode(local_id, mode), 0) != 0)
+ {
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+/*
+ * Generic LED ioctl interface.
+ */
+int
+onlp_ledi_ioctl(onlp_oid_t id, va_list vargs)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/make.mk b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/make.mk
new file mode 100644
index 00000000..49d470ff
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/make.mk
@@ -0,0 +1,9 @@
+###############################################################################
+#
+#
+#
+###############################################################################
+
+LIBRARY := x86_64_accton_as7512_32x
+$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
+include $(BUILDER)/lib.mk
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/platform_lib.c b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/platform_lib.c
new file mode 100644
index 00000000..f0aff7a2
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/platform_lib.c
@@ -0,0 +1,158 @@
+/************************************************************
+ *
+ *
+ * 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"
+
+int deviceNodeWrite(char *filename, char *buffer, int buf_size, int data_len)
+{
+ int fd;
+ int len;
+
+ if ((buffer == NULL) || (buf_size < 0)) {
+ return -1;
+ }
+
+ if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) {
+ return -1;
+ }
+
+ if ((len = write(fd, buffer, buf_size)) < 0) {
+ close(fd);
+ return -1;
+ }
+
+ if ((close(fd) == -1)) {
+ return -1;
+ }
+
+ if ((len > buf_size) || (data_len != 0 && len != data_len)) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int deviceNodeWriteInt(char *filename, int value, int data_len)
+{
+ char buf[8] = {0};
+ sprintf(buf, "%d", value);
+
+ return deviceNodeWrite(filename, buf, sizeof(buf)-1, data_len);
+}
+
+int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len)
+{
+ int fd;
+ int len;
+
+ if ((buffer == NULL) || (buf_size < 0)) {
+ return -1;
+ }
+
+ if ((fd = open(filename, O_RDONLY)) == -1) {
+ return -1;
+ }
+
+ if ((len = read(fd, buffer, buf_size)) < 0) {
+ close(fd);
+ return -1;
+ }
+
+ if ((close(fd) == -1)) {
+ return -1;
+ }
+
+ if ((len > buf_size) || (data_len != 0 && len != data_len)) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len)
+{
+ int ret;
+
+ if (data_len >= buf_size) {
+ return -1;
+ }
+
+ ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len);
+
+ if (ret == 0) {
+ buffer[buf_size-1] = '\0';
+ }
+
+ return ret;
+}
+
+#define I2C_PSU_MODEL_NAME_LEN 9
+#define I2C_PSU_FAN_DIR_LEN 3
+
+psu_type_t get_psu_type(int id, char* modelname, int modelname_len)
+{
+ char *node = NULL;
+ char model_name[I2C_PSU_MODEL_NAME_LEN + 1] = {0};
+ char fan_dir[I2C_PSU_FAN_DIR_LEN + 1] = {0};
+
+
+ /* Check AC model name */
+ node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_model_name) : PSU2_AC_HWMON_NODE(psu_model_name);
+
+ if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) != 0) {
+ return PSU_TYPE_UNKNOWN;
+ }
+
+ if (strncmp(model_name, "YM-2651Y", strlen("YM-2651Y")) != 0) {
+ return PSU_TYPE_UNKNOWN;
+ }
+
+ if (modelname) {
+ strncpy(modelname, model_name, modelname_len-1);
+ }
+
+ node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir);
+
+ if (deviceNodeReadString(node, fan_dir, sizeof(fan_dir), 0) != 0) {
+ return PSU_TYPE_UNKNOWN;
+ }
+
+ if (strncmp(fan_dir, "F2B", strlen("F2B")) == 0) {
+ return PSU_TYPE_AC_F2B;
+ }
+
+ if (strncmp(fan_dir, "B2F", strlen("B2F")) == 0) {
+ return PSU_TYPE_AC_B2F;
+ }
+
+ return PSU_TYPE_UNKNOWN;
+}
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/platform_lib.h b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/platform_lib.h
new file mode 100644
index 00000000..de3b6f85
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/platform_lib.h
@@ -0,0 +1,70 @@
+/************************************************************
+ *
+ *
+ * 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_accton_as7512_32x_log.h"
+
+#define CHASSIS_FAN_COUNT 6
+#define CHASSIS_THERMAL_COUNT 5
+
+#define PSU1_ID 1
+#define PSU2_ID 2
+
+#define PSU1_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/10-0058/"
+#define PSU2_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/11-005b/"
+
+#define PSU1_AC_PMBUS_NODE(node) PSU1_AC_PMBUS_PREFIX#node
+#define PSU2_AC_PMBUS_NODE(node) PSU2_AC_PMBUS_PREFIX#node
+
+#define PSU1_AC_HWMON_PREFIX "/sys/bus/i2c/devices/10-0050/"
+#define PSU2_AC_HWMON_PREFIX "/sys/bus/i2c/devices/11-0053/"
+
+#define PSU1_AC_HWMON_NODE(node) PSU1_AC_HWMON_PREFIX#node
+#define PSU2_AC_HWMON_NODE(node) PSU2_AC_HWMON_PREFIX#node
+
+int deviceNodeWriteInt(char *filename, int value, int data_len);
+int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len);
+int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len);
+
+typedef enum psu_type {
+ PSU_TYPE_UNKNOWN,
+ PSU_TYPE_AC_F2B,
+ PSU_TYPE_AC_B2F
+} psu_type_t;
+
+psu_type_t get_psu_type(int id, char* modelname, int modelname_len);
+
+#define DEBUG_MODE 0
+
+#if (DEBUG_MODE == 1)
+ #define DEBUG_PRINT(format, ...) printf(format, __VA_ARGS__)
+#else
+ #define DEBUG_PRINT(format, ...)
+#endif
+
+#endif /* __PLATFORM_LIB_H__ */
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/psui.c b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/psui.c
new file mode 100644
index 00000000..7335fe22
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/psui.c
@@ -0,0 +1,209 @@
+/************************************************************
+ *
+ *
+ * Copyright 2014 Big Switch Networks, Inc.
+ * Copyright 2014 Accton Technology Corporation.
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the
+ * License.
+ *
+ *
+ ************************************************************
+ *
+ *
+ *
+ ***********************************************************/
+#include
+#include
+#include
+#include
+#include "platform_lib.h"
+
+#define PSU_STATUS_PRESENT 1
+#define PSU_STATUS_POWER_GOOD 1
+
+#define PSU_NODE_MAX_INT_LEN 8
+#define PSU_NODE_MAX_PATH_LEN 64
+
+#define VALIDATE(_id) \
+ do { \
+ if(!ONLP_OID_IS_PSU(_id)) { \
+ return ONLP_STATUS_E_INVALID; \
+ } \
+ } while(0)
+
+static int
+psu_status_info_get(int id, char *node, int *value)
+{
+ int ret = 0;
+ char buf[PSU_NODE_MAX_INT_LEN + 1] = {0};
+ char node_path[PSU_NODE_MAX_PATH_LEN] = {0};
+
+ *value = 0;
+
+ if (PSU1_ID == id) {
+ sprintf(node_path, "%s%s", PSU1_AC_HWMON_PREFIX, node);
+ }
+ else if (PSU2_ID == id) {
+ sprintf(node_path, "%s%s", PSU2_AC_HWMON_PREFIX, node);
+ }
+
+ ret = deviceNodeReadString(node_path, buf, sizeof(buf), 0);
+
+ if (ret == 0) {
+ *value = atoi(buf);
+ }
+
+ return ret;
+}
+
+static int
+psu_ym2651y_pmbus_info_get(int id, char *node, int *value)
+{
+ int ret = 0;
+ char buf[PSU_NODE_MAX_INT_LEN + 1] = {0};
+ char node_path[PSU_NODE_MAX_PATH_LEN] = {0};
+
+ *value = 0;
+
+ if (PSU1_ID == id) {
+ sprintf(node_path, "%s%s", PSU1_AC_PMBUS_PREFIX, node);
+ }
+ else {
+ sprintf(node_path, "%s%s", PSU2_AC_PMBUS_PREFIX, node);
+ }
+
+ ret = deviceNodeReadString(node_path, buf, sizeof(buf), 0);
+
+ if (ret == 0) {
+ *value = atoi(buf);
+ }
+
+ return ret;
+}
+
+int
+onlp_psui_init(void)
+{
+ return ONLP_STATUS_OK;
+}
+
+static int
+psu_ym2651y_info_get(onlp_psu_info_t* info)
+{
+ int val = 0;
+ int index = ONLP_OID_ID_GET(info->hdr.id);
+
+ /* Set capability
+ */
+ info->caps = ONLP_PSU_CAPS_AC;
+
+ if (info->status & ONLP_PSU_STATUS_FAILED) {
+ return ONLP_STATUS_OK;
+ }
+
+ /* Set the associated oid_table */
+ info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT);
+ info->hdr.coids[1] = ONLP_THERMAL_ID_CREATE(index + CHASSIS_THERMAL_COUNT);
+
+ /* Read voltage, current and power */
+ if (psu_ym2651y_pmbus_info_get(index, "psu_v_out", &val) == 0) {
+ info->mvout = val;
+ info->caps |= ONLP_PSU_CAPS_VOUT;
+ }
+
+ if (psu_ym2651y_pmbus_info_get(index, "psu_i_out", &val) == 0) {
+ info->miout = val;
+ info->caps |= ONLP_PSU_CAPS_IOUT;
+ }
+
+ if (psu_ym2651y_pmbus_info_get(index, "psu_p_out", &val) == 0) {
+ info->mpout = val;
+ info->caps |= ONLP_PSU_CAPS_POUT;
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+/*
+ * Get all information about the given PSU oid.
+ */
+static onlp_psu_info_t pinfo[] =
+{
+ { }, /* Not used */
+ {
+ { ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0 },
+ },
+ {
+ { ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0 },
+ }
+};
+
+int
+onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
+{
+ int val = 0;
+ int ret = ONLP_STATUS_OK;
+ int index = ONLP_OID_ID_GET(id);
+ psu_type_t psu_type;
+
+ VALIDATE(id);
+
+ memset(info, 0, sizeof(onlp_psu_info_t));
+ *info = pinfo[index]; /* Set the onlp_oid_hdr_t */
+
+ /* Get the present state */
+ if (psu_status_info_get(index, "psu_present", &val) != 0) {
+ printf("Unable to read PSU(%d) node(psu_present)\r\n", index);
+ }
+
+ if (val != PSU_STATUS_PRESENT) {
+ info->status &= ~ONLP_PSU_STATUS_PRESENT;
+ return ONLP_STATUS_OK;
+ }
+ info->status |= ONLP_PSU_STATUS_PRESENT;
+
+
+ /* Get power good status */
+ if (psu_status_info_get(index, "psu_power_good", &val) != 0) {
+ printf("Unable to read PSU(%d) node(psu_power_good)\r\n", index);
+ }
+
+ if (val != PSU_STATUS_POWER_GOOD) {
+ info->status |= ONLP_PSU_STATUS_FAILED;
+ }
+
+
+ /* Get PSU type
+ */
+ psu_type = get_psu_type(index, info->model, sizeof(info->model));
+
+ switch (psu_type) {
+ case PSU_TYPE_AC_F2B:
+ case PSU_TYPE_AC_B2F:
+ ret = psu_ym2651y_info_get(info);
+ break;
+ default:
+ ret = ONLP_STATUS_E_UNSUPPORTED;
+ break;
+ }
+
+ return ret;
+}
+
+int
+onlp_psui_ioctl(onlp_oid_t pid, va_list vargs)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/sfpi.c b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/sfpi.c
new file mode 100644
index 00000000..b61f6e5a
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/sfpi.c
@@ -0,0 +1,190 @@
+/************************************************************
+ *
+ *
+ * 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 /* For O_RDWR && open */
+#include
+#include
+#include
+#include
+
+#include "platform_lib.h"
+
+#define MAX_SFP_PATH 64
+static char sfp_node_path[MAX_SFP_PATH] = {0};
+#define FRONT_PORT_TO_CPLD_MUX_INDEX(port) (port+18)
+
+static int
+as7512_32x_sfp_node_read_int(char *node_path, int *value, int data_len)
+{
+ int ret = 0;
+ char buf[8];
+ *value = 0;
+
+ ret = deviceNodeReadString(node_path, buf, sizeof(buf), data_len);
+
+ if (ret == 0) {
+ *value = atoi(buf);
+ }
+
+ return ret;
+}
+
+static char*
+as7512_32x_sfp_get_port_path(int port, char *node_name)
+{
+ sprintf(sfp_node_path, "/sys/bus/i2c/devices/%d-0050/%s",
+ FRONT_PORT_TO_CPLD_MUX_INDEX(port),
+ node_name);
+
+ return sfp_node_path;
+}
+
+/************************************************************
+ *
+ * SFPI Entry Points
+ *
+ ***********************************************************/
+int
+onlp_sfpi_init(void)
+{
+ /* Called at initialization time */
+ return ONLP_STATUS_OK;
+}
+
+int
+onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap)
+{
+ /*
+ * Ports {0, 32}
+ */
+ int p;
+ AIM_BITMAP_INIT(bmap, 64);
+ AIM_BITMAP_CLR_ALL(bmap);
+
+ for(p = 0; p < 32; p++) {
+ AIM_BITMAP_SET(bmap, p);
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+int
+onlp_sfpi_is_present(int port)
+{
+ /*
+ * Return 1 if present.
+ * Return 0 if not present.
+ * Return < 0 if error.
+ */
+ int present;
+ char* path = as7512_32x_sfp_get_port_path(port, "sfp_is_present");
+
+ if (as7512_32x_sfp_node_read_int(path, &present, 0) != 0) {
+ AIM_LOG_ERROR("Unable to read present status from port(%d)\r\n", port);
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ return present;
+}
+
+int
+onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)
+{
+ uint32_t bytes[4];
+ char* path;
+ FILE* fp;
+
+ path = as7512_32x_sfp_get_port_path(0, "sfp_is_present_all");
+ fp = fopen(path, "r");
+
+ if(fp == NULL) {
+ AIM_LOG_ERROR("Unable to open the sfp_is_present_all device file.");
+ return ONLP_STATUS_E_INTERNAL;
+ }
+ int count = fscanf(fp, "%x %x %x %x",
+ bytes+0,
+ bytes+1,
+ bytes+2,
+ bytes+3
+ );
+ fclose(fp);
+ if(count != AIM_ARRAYSIZE(bytes)) {
+ /* Likely a CPLD read timeout. */
+ AIM_LOG_ERROR("Unable to read all fields from the sfp_is_present_all device file.");
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ /* Convert to 64 bit integer in port order */
+ int i = 0;
+ uint32_t presence_all = 0 ;
+ for(i = AIM_ARRAYSIZE(bytes)-1; i >= 0; i--) {
+ presence_all <<= 8;
+ presence_all |= bytes[i];
+ }
+
+ /* Populate bitmap */
+ for(i = 0; presence_all; i++) {
+ AIM_BITMAP_MOD(dst, i, (presence_all & 1));
+ presence_all >>= 1;
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+int
+onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst)
+{
+ return ONLP_STATUS_OK;
+}
+
+int
+onlp_sfpi_eeprom_read(int port, uint8_t data[256])
+{
+ char* path = as7512_32x_sfp_get_port_path(port, "sfp_eeprom");
+
+ /*
+ * Read the SFP eeprom into data[]
+ *
+ * Return MISSING if SFP is missing.
+ * Return OK if eeprom is read
+ */
+ memset(data, 0, 256);
+
+ if (deviceNodeReadBinary(path, (char*)data, 256, 256) != 0) {
+ AIM_LOG_ERROR("Unable to read eeprom from port(%d)\r\n", port);
+ return ONLP_STATUS_E_INTERNAL;
+ }
+
+ return ONLP_STATUS_OK;
+}
+
+int
+onlp_sfpi_denit(void)
+{
+ return ONLP_STATUS_OK;
+}
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/sysi.c b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/sysi.c
new file mode 100644
index 00000000..60412764
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/sysi.c
@@ -0,0 +1,94 @@
+/************************************************************
+ *
+ *
+ * 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 "x86_64_accton_as7512_32x_int.h"
+#include "x86_64_accton_as7512_32x_log.h"
+
+#define NUM_OF_THERMAL_ON_MAIN_BROAD 5
+#define NUM_OF_FAN_ON_MAIN_BROAD 6
+#define NUM_OF_PSU_ON_MAIN_BROAD 2
+#define NUM_OF_LED_ON_MAIN_BROAD 5
+
+const char*
+onlp_sysi_platform_get(void)
+{
+ return "x86-64-accton-as7512-32x-r0";
+}
+
+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));
+
+ /* 4 Thermal sensors on the chassis */
+ for (i = 1; i <= NUM_OF_THERMAL_ON_MAIN_BROAD; i++)
+ {
+ *e++ = ONLP_THERMAL_ID_CREATE(i);
+ }
+
+ /* 5 LEDs on the chassis */
+ for (i = 1; i <= NUM_OF_LED_ON_MAIN_BROAD; i++)
+ {
+ *e++ = ONLP_LED_ID_CREATE(i);
+ }
+
+ /* 2 PSUs on the chassis */
+ for (i = 1; i <= NUM_OF_PSU_ON_MAIN_BROAD; i++)
+ {
+ *e++ = ONLP_PSU_ID_CREATE(i);
+ }
+
+ /* 4 Fans on the chassis */
+ for (i = 1; i <= NUM_OF_FAN_ON_MAIN_BROAD; i++)
+ {
+ *e++ = ONLP_FAN_ID_CREATE(i);
+ }
+
+ return 0;
+}
+
+int
+onlp_sysi_platform_manage_fans(void)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
+int
+onlp_sysi_platform_manage_leds(void)
+{
+ return ONLP_STATUS_E_UNSUPPORTED;
+}
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/thermali.c b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/thermali.c
new file mode 100644
index 00000000..36660537
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/thermali.c
@@ -0,0 +1,137 @@
+/************************************************************
+ *
+ *
+ * Copyright 2014 Big Switch Networks, Inc.
+ * Copyright 2014 Accton Technology Corporation.
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the
+ * License.
+ *
+ *
+ ************************************************************
+ *
+ * Thermal Sensor Platform Implementation.
+ *
+ ***********************************************************/
+#include
+#include
+#include
+#include
+#include "platform_lib.h"
+
+#define prefix_path "/sys/bus/i2c/devices/"
+
+#define VALIDATE(_id) \
+ do { \
+ if(!ONLP_OID_IS_THERMAL(_id)) { \
+ return ONLP_STATUS_E_INVALID; \
+ } \
+ } while(0)
+
+#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \
+ DEBUG_PRINT("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \
+ if ((fd = open(fullpath, O_RDONLY)) == -1) \
+ return ONLP_STATUS_E_INTERNAL; \
+ if ((len = read(fd, r_data, nbytes)) <= 0){ \
+ close(fd); \
+ return ONLP_STATUS_E_INTERNAL;} \
+ DEBUG_PRINT("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \
+ if (close(fd) == -1) \
+ return ONLP_STATUS_E_INTERNAL
+
+enum onlp_thermal_id
+{
+ THERMAL_RESERVED = 0,
+ THERMAL_1_ON_MAIN_BROAD,
+ THERMAL_2_ON_MAIN_BROAD,
+ THERMAL_3_ON_MAIN_BROAD,
+ THERMAL_4_ON_MAIN_BROAD,
+ THERMAL_5_ON_MAIN_BROAD,
+ THERMAL_1_ON_PSU1,
+ THERMAL_1_ON_PSU2,
+};
+
+static char last_path[][30] = /* must map with onlp_thermal_id */
+{
+ "reserved",
+ "3-0048/temp1_input",
+ "3-0049/temp1_input",
+ "3-004a/temp1_input",
+ "15-004c/temp1_input",
+ "15-004c/temp2_input",
+ "10-0058/psu_temp1_input",
+ "11-005b/psu_temp1_input",
+};
+
+/* Static values */
+static onlp_thermal_info_t linfo[] = {
+ { }, /* Not used */
+ { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_MAIN_BROAD), "Chassis Thermal Sensor 1", 0},
+ ONLP_THERMAL_STATUS_PRESENT, 0 },
+ { { ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_MAIN_BROAD), "Chassis Thermal Sensor 2", 0},
+ ONLP_THERMAL_STATUS_PRESENT, 0 },
+ { { ONLP_THERMAL_ID_CREATE(THERMAL_3_ON_MAIN_BROAD), "Chassis Thermal Sensor 3", 0},
+ ONLP_THERMAL_STATUS_PRESENT, 0 },
+ { { ONLP_THERMAL_ID_CREATE(THERMAL_4_ON_MAIN_BROAD), "Chassis Thermal Sensor 4", 0},
+ ONLP_THERMAL_STATUS_PRESENT, 0 },
+ { { ONLP_THERMAL_ID_CREATE(THERMAL_5_ON_MAIN_BROAD), "Chassis Thermal Sensor 5", 0},
+ ONLP_THERMAL_STATUS_PRESENT, 0 },
+ { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU1), "PSU-1 Thermal Sensor 1", ONLP_PSU_ID_CREATE(PSU1_ID)},
+ ONLP_THERMAL_STATUS_PRESENT, 0 },
+ { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU2), "PSU-2 Thermal Sensor 1", ONLP_PSU_ID_CREATE(PSU2_ID)},
+ ONLP_THERMAL_STATUS_PRESENT, 0 }
+};
+
+/*
+ * This will be called to intiialize the thermali subsystem.
+ */
+int
+onlp_thermali_init(void)
+{
+ return ONLP_STATUS_OK;
+}
+
+/*
+ * Retrieve the information structure for the given thermal OID.
+ *
+ * If the OID is invalid, return ONLP_E_STATUS_INVALID.
+ * If an unexpected error occurs, return ONLP_E_STATUS_INTERNAL.
+ * Otherwise, return ONLP_STATUS_OK with the OID's information.
+ *
+ * Note -- it is expected that you fill out the information
+ * structure even if the sensor described by the OID is not present.
+ */
+int
+onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info)
+{
+ int fd, len, nbytes = 10, temp_base=1, local_id;
+ char r_data[10] = {0};
+ char fullpath[50] = {0};
+ VALIDATE(id);
+
+ local_id = ONLP_OID_ID_GET(id);
+ DEBUG_PRINT("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id);
+
+ /* get fullpath */
+ sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]);
+
+ /* Set the onlp_oid_hdr_t and capabilities */
+ *info = linfo[local_id];
+
+ OPEN_READ_FILE(fd, fullpath, r_data, nbytes, len);
+ info->mcelsius = atoi(r_data) / temp_base;
+ DEBUG_PRINT("\n[Debug][%s][%d][save data: %d]\n", __FUNCTION__, __LINE__, info->mcelsius);
+
+ return ONLP_STATUS_OK;
+}
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_config.c b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_config.c
new file mode 100644
index 00000000..815faf7f
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_config.c
@@ -0,0 +1,81 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#include
+
+/* */
+#define __x86_64_accton_as7512_32x_config_STRINGIFY_NAME(_x) #_x
+#define __x86_64_accton_as7512_32x_config_STRINGIFY_VALUE(_x) __x86_64_accton_as7512_32x_config_STRINGIFY_NAME(_x)
+x86_64_accton_as7512_32x_config_settings_t x86_64_accton_as7512_32x_config_settings[] =
+{
+#ifdef x86_64_accton_as7512_32x_CONFIG_INCLUDE_LOGGING
+ { __x86_64_accton_as7512_32x_config_STRINGIFY_NAME(x86_64_accton_as7512_32x_CONFIG_INCLUDE_LOGGING), __x86_64_accton_as7512_32x_config_STRINGIFY_VALUE(x86_64_accton_as7512_32x_CONFIG_INCLUDE_LOGGING) },
+#else
+{ x86_64_accton_as7512_32x_CONFIG_INCLUDE_LOGGING(__x86_64_accton_as7512_32x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as7512_32x_CONFIG_LOG_OPTIONS_DEFAULT
+ { __x86_64_accton_as7512_32x_config_STRINGIFY_NAME(x86_64_accton_as7512_32x_CONFIG_LOG_OPTIONS_DEFAULT), __x86_64_accton_as7512_32x_config_STRINGIFY_VALUE(x86_64_accton_as7512_32x_CONFIG_LOG_OPTIONS_DEFAULT) },
+#else
+{ x86_64_accton_as7512_32x_CONFIG_LOG_OPTIONS_DEFAULT(__x86_64_accton_as7512_32x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as7512_32x_CONFIG_LOG_BITS_DEFAULT
+ { __x86_64_accton_as7512_32x_config_STRINGIFY_NAME(x86_64_accton_as7512_32x_CONFIG_LOG_BITS_DEFAULT), __x86_64_accton_as7512_32x_config_STRINGIFY_VALUE(x86_64_accton_as7512_32x_CONFIG_LOG_BITS_DEFAULT) },
+#else
+{ x86_64_accton_as7512_32x_CONFIG_LOG_BITS_DEFAULT(__x86_64_accton_as7512_32x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as7512_32x_CONFIG_LOG_CUSTOM_BITS_DEFAULT
+ { __x86_64_accton_as7512_32x_config_STRINGIFY_NAME(x86_64_accton_as7512_32x_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __x86_64_accton_as7512_32x_config_STRINGIFY_VALUE(x86_64_accton_as7512_32x_CONFIG_LOG_CUSTOM_BITS_DEFAULT) },
+#else
+{ x86_64_accton_as7512_32x_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__x86_64_accton_as7512_32x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB
+ { __x86_64_accton_as7512_32x_config_STRINGIFY_NAME(x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB), __x86_64_accton_as7512_32x_config_STRINGIFY_VALUE(x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB) },
+#else
+{ x86_64_accton_as7512_32x_CONFIG_PORTING_STDLIB(__x86_64_accton_as7512_32x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as7512_32x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
+ { __x86_64_accton_as7512_32x_config_STRINGIFY_NAME(x86_64_accton_as7512_32x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __x86_64_accton_as7512_32x_config_STRINGIFY_VALUE(x86_64_accton_as7512_32x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) },
+#else
+{ x86_64_accton_as7512_32x_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__x86_64_accton_as7512_32x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as7512_32x_CONFIG_INCLUDE_UCLI
+ { __x86_64_accton_as7512_32x_config_STRINGIFY_NAME(x86_64_accton_as7512_32x_CONFIG_INCLUDE_UCLI), __x86_64_accton_as7512_32x_config_STRINGIFY_VALUE(x86_64_accton_as7512_32x_CONFIG_INCLUDE_UCLI) },
+#else
+{ x86_64_accton_as7512_32x_CONFIG_INCLUDE_UCLI(__x86_64_accton_as7512_32x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+#ifdef x86_64_accton_as7512_32x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
+ { __x86_64_accton_as7512_32x_config_STRINGIFY_NAME(x86_64_accton_as7512_32x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION), __x86_64_accton_as7512_32x_config_STRINGIFY_VALUE(x86_64_accton_as7512_32x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION) },
+#else
+{ x86_64_accton_as7512_32x_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION(__x86_64_accton_as7512_32x_config_STRINGIFY_NAME), "__undefined__" },
+#endif
+ { NULL, NULL }
+};
+#undef __x86_64_accton_as7512_32x_config_STRINGIFY_VALUE
+#undef __x86_64_accton_as7512_32x_config_STRINGIFY_NAME
+
+const char*
+x86_64_accton_as7512_32x_config_lookup(const char* setting)
+{
+ int i;
+ for(i = 0; x86_64_accton_as7512_32x_config_settings[i].name; i++) {
+ if(strcmp(x86_64_accton_as7512_32x_config_settings[i].name, setting)) {
+ return x86_64_accton_as7512_32x_config_settings[i].value;
+ }
+ }
+ return NULL;
+}
+
+int
+x86_64_accton_as7512_32x_config_show(struct aim_pvs_s* pvs)
+{
+ int i;
+ for(i = 0; x86_64_accton_as7512_32x_config_settings[i].name; i++) {
+ aim_printf(pvs, "%s = %s\n", x86_64_accton_as7512_32x_config_settings[i].name, x86_64_accton_as7512_32x_config_settings[i].value);
+ }
+ return i;
+}
+
+/* */
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_enums.c b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_enums.c
new file mode 100644
index 00000000..c0c6515b
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_enums.c
@@ -0,0 +1,10 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#include
+
+/* <--auto.start.enum(ALL).source> */
+/* */
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_int.h b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_int.h
new file mode 100644
index 00000000..dd8f95ad
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_int.h
@@ -0,0 +1,12 @@
+/**************************************************************************//**
+ *
+ * x86_64_accton_as7512_32x Internal Header
+ *
+ *****************************************************************************/
+#ifndef __x86_64_accton_as7512_32x_INT_H__
+#define __x86_64_accton_as7512_32x_INT_H__
+
+#include
+
+
+#endif /* __x86_64_accton_as7512_32x_INT_H__ */
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_log.c b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_log.c
new file mode 100644
index 00000000..6de85a90
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_log.c
@@ -0,0 +1,18 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#include
+
+#include "x86_64_accton_as7512_32x_log.h"
+/*
+ * x86_64_accton_as7512_32x log struct.
+ */
+AIM_LOG_STRUCT_DEFINE(
+ x86_64_accton_as7512_32x_CONFIG_LOG_OPTIONS_DEFAULT,
+ x86_64_accton_as7512_32x_CONFIG_LOG_BITS_DEFAULT,
+ NULL, /* Custom log map */
+ x86_64_accton_as7512_32x_CONFIG_LOG_CUSTOM_BITS_DEFAULT
+ );
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_log.h b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_log.h
new file mode 100644
index 00000000..ed875173
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_log.h
@@ -0,0 +1,12 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#ifndef __x86_64_accton_as7512_32x_LOG_H__
+#define __x86_64_accton_as7512_32x_LOG_H__
+
+#define AIM_LOG_MODULE_NAME x86_64_accton_as7512_32x
+#include
+
+#endif /* __x86_64_accton_as7512_32x_LOG_H__ */
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_module.c b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_module.c
new file mode 100644
index 00000000..5d028291
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_module.c
@@ -0,0 +1,24 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#include
+
+#include "x86_64_accton_as7512_32x_log.h"
+
+static int
+datatypes_init__(void)
+{
+#define x86_64_accton_as7512_32x_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
+#include
+ return 0;
+}
+
+void __x86_64_accton_as7512_32x_module_init__(void)
+{
+ AIM_LOG_STRUCT_REGISTER();
+ datatypes_init__();
+}
+
+int __onlp_platform_version__ = 1;
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_ucli.c b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_ucli.c
new file mode 100644
index 00000000..b9368350
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/module/src/x86_64_accton_as7512_32x_ucli.c
@@ -0,0 +1,50 @@
+/**************************************************************************//**
+ *
+ *
+ *
+ *****************************************************************************/
+#include
+
+#if x86_64_accton_as7512_32x_CONFIG_INCLUDE_UCLI == 1
+
+#include
+#include
+#include
+
+static ucli_status_t
+x86_64_accton_as7512_32x_ucli_ucli__config__(ucli_context_t* uc)
+{
+ UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_accton_as7512_32x)
+}
+
+/* */
+/* */
+
+static ucli_module_t
+x86_64_accton_as7512_32x_ucli_module__ =
+ {
+ "x86_64_accton_as7512_32x_ucli",
+ NULL,
+ x86_64_accton_as7512_32x_ucli_ucli_handlers__,
+ NULL,
+ NULL,
+ };
+
+ucli_node_t*
+x86_64_accton_as7512_32x_ucli_node_create(void)
+{
+ ucli_node_t* n;
+ ucli_module_init(&x86_64_accton_as7512_32x_ucli_module__);
+ n = ucli_node_create("x86_64_accton_as7512_32x", NULL, &x86_64_accton_as7512_32x_ucli_module__);
+ ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_accton_as7512_32x"));
+ return n;
+}
+
+#else
+void*
+x86_64_accton_as7512_32x_ucli_node_create(void)
+{
+ return NULL;
+}
+#endif
+
diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/x86_64_accton_as7512_32x.mk b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/x86_64_accton_as7512_32x.mk
new file mode 100644
index 00000000..1c0f78f8
--- /dev/null
+++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/builds/src/x86_64_accton_as7512_32x.mk
@@ -0,0 +1,13 @@
+
+###############################################################################
+#
+# Inclusive Makefile for the x86_64_accton_as7512_32x module.
+#
+# Autogenerated 2015-12-23 20:42:53.224637
+#
+###############################################################################
+x86_64_accton_as7512_32x_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
+include $(x86_64_accton_as7512_32x_BASEDIR)/module/make.mk
+include $(x86_64_accton_as7512_32x_BASEDIR)/module/auto/make.mk
+include $(x86_64_accton_as7512_32x_BASEDIR)/module/src/make.mk
+