mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-25 01:07:01 +00:00
platforms: netberg: Add Aurora 420 switch
It is very similar to Aurora 420, even onlp shared object part from Aurora 620 considered as example when porting support for 420 (see the diff between 620 and 420 to find differences if necessary). Main difference in onlp is that we have four LEDs (1 SYS STAT, 2 PSU and 1 for FAN), 7 thermal (4 for two PSU, 1 for MAC, 1 for front and 1 for rear) and 6 fans (4 for board, 2 for PSU). New 420, as well as 620 and 720 requires upstream ONIE to install correctly. Install and boot tested with ONIE "master-201805301609". Signed-off-by: Sergey Popovich <sergey.popovich@ordnance.co>
This commit is contained in:
2
packages/platforms/netberg/x86-64/x86-64-netberg-aurora-420-rangeley/.gitignore
vendored
Executable file
2
packages/platforms/netberg/x86-64/x86-64-netberg-aurora-420-rangeley/.gitignore
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
*x86*64*netberg*aurora*420*rangeley*.mk
|
||||
onlpdump.mk
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/no-platform-modules.yml ARCH=amd64 VENDOR=netberg BASENAME=x86-64-netberg-aurora-420-rangeley
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=x86-64-netberg-aurora-420-rangeley ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu
|
||||
@@ -0,0 +1,2 @@
|
||||
FILTER=src
|
||||
include $(ONL)/make/subdirs.mk
|
||||
@@ -0,0 +1,45 @@
|
||||
############################################################
|
||||
# <bsn.cl fy=2014 v=onl>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# </bsn.cl>
|
||||
############################################################
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
include $(ONL)/make/config.amd64.mk
|
||||
|
||||
MODULE := libonlp-x86-64-netberg-aurora-420-rangeley
|
||||
include $(BUILDER)/standardinit.mk
|
||||
|
||||
DEPENDMODULES := AIM IOF x86_64_netberg_aurora_420_rangeley onlplib
|
||||
DEPENDMODULE_HEADERS := sff
|
||||
|
||||
include $(BUILDER)/dependmodules.mk
|
||||
|
||||
SHAREDLIB := libonlp-x86-64-netberg-aurora-420-rangeley.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
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
############################################################
|
||||
# <bsn.cl fy=2014 v=onl>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# </bsn.cl>
|
||||
############################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
include $(ONL)/make/config.amd64.mk
|
||||
|
||||
.DEFAULT_GOAL := onlpdump
|
||||
|
||||
MODULE := onlpdump
|
||||
include $(BUILDER)/standardinit.mk
|
||||
|
||||
DEPENDMODULES := AIM IOF onlp x86_64_netberg_aurora_420_rangeley 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
|
||||
@@ -0,0 +1 @@
|
||||
*.mk
|
||||
@@ -0,0 +1 @@
|
||||
name: x86_64_netberg_aurora_420_rangeley
|
||||
@@ -0,0 +1,9 @@
|
||||
###############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
include $(ONL)/make/config.mk
|
||||
MODULE := x86_64_netberg_aurora_420_rangeley
|
||||
AUTOMODULE := x86_64_netberg_aurora_420_rangeley
|
||||
include $(BUILDER)/definemodule.mk
|
||||
@@ -0,0 +1,119 @@
|
||||
###############################################################################
|
||||
#
|
||||
# x86_64_netberg_aurora_420_rangeley Autogeneration Definitions.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
cdefs: &cdefs
|
||||
- X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_LOGGING:
|
||||
doc: "Include or exclude logging."
|
||||
default: 1
|
||||
- X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT:
|
||||
doc: "Default enabled log options."
|
||||
default: AIM_LOG_OPTIONS_DEFAULT
|
||||
- X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_BITS_DEFAULT:
|
||||
doc: "Default enabled log bits."
|
||||
default: AIM_LOG_BITS_DEFAULT
|
||||
- X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
|
||||
doc: "Default enabled custom log bits."
|
||||
default: 0
|
||||
- X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB:
|
||||
doc: "Default all porting macros to use the C standard libraries."
|
||||
default: 1
|
||||
- X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
|
||||
doc: "Include standard library headers for stdlib porting macros."
|
||||
default: X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
- X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_UCLI:
|
||||
doc: "Include generic uCli support."
|
||||
default: 0
|
||||
- X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD:
|
||||
doc: "RPM Threshold at which the fan is considered to have failed."
|
||||
default: 3000
|
||||
|
||||
definitions:
|
||||
cdefs:
|
||||
X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_HEADER:
|
||||
defs: *cdefs
|
||||
basename: x86_64_netberg_aurora_420_rangeley_config
|
||||
|
||||
enum: &enums
|
||||
|
||||
fan_id:
|
||||
members:
|
||||
- FAN1 : 1
|
||||
- FAN2 : 2
|
||||
- FAN3 : 3
|
||||
- FAN4 : 4
|
||||
- FAN5 : 5
|
||||
- FAN6 : 6
|
||||
- FAN7 : 7
|
||||
- FAN8 : 8
|
||||
- FAN9 : 9
|
||||
- FAN10 : 10
|
||||
|
||||
fan_oid:
|
||||
members:
|
||||
- FAN1 : ONLP_FAN_ID_CREATE(1)
|
||||
- FAN2 : ONLP_FAN_ID_CREATE(2)
|
||||
- FAN3 : ONLP_FAN_ID_CREATE(3)
|
||||
- FAN4 : ONLP_FAN_ID_CREATE(4)
|
||||
- FAN5 : ONLP_FAN_ID_CREATE(5)
|
||||
- FAN6 : ONLP_FAN_ID_CREATE(6)
|
||||
- FAN7 : ONLP_FAN_ID_CREATE(7)
|
||||
- FAN8 : ONLP_FAN_ID_CREATE(8)
|
||||
- FAN9 : ONLP_FAN_ID_CREATE(9)
|
||||
- FAN10 : ONLP_FAN_ID_CREATE(10)
|
||||
|
||||
psu_id:
|
||||
members:
|
||||
- PSU1 : 1
|
||||
- PSU2 : 2
|
||||
|
||||
psu_oid:
|
||||
members:
|
||||
- PSU1 : ONLP_PSU_ID_CREATE(1)
|
||||
- PSU2 : ONLP_PSU_ID_CREATE(2)
|
||||
|
||||
thermal_id:
|
||||
members:
|
||||
- THERMAL1 : 1
|
||||
- THERMAL2 : 2
|
||||
- THERMAL3 : 3
|
||||
- THERMAL4 : 4
|
||||
- THERMAL5 : 5
|
||||
- THERMAL6 : 6
|
||||
- THERMAL7 : 7
|
||||
|
||||
thermal_oid:
|
||||
members:
|
||||
- THERMAL1 : ONLP_THERMAL_ID_CREATE(1)
|
||||
- THERMAL2 : ONLP_THERMAL_ID_CREATE(2)
|
||||
- THERMAL3 : ONLP_THERMAL_ID_CREATE(3)
|
||||
- THERMAL4 : ONLP_THERMAL_ID_CREATE(4)
|
||||
- THERMAL5 : ONLP_THERMAL_ID_CREATE(5)
|
||||
- THERMAL6 : ONLP_THERMAL_ID_CREATE(6)
|
||||
- THERMAL7 : ONLP_THERMAL_ID_CREATE(7)
|
||||
|
||||
led_id:
|
||||
members:
|
||||
- STAT : 1
|
||||
- FAN : 2
|
||||
- PSU1 : 3
|
||||
- PSU2 : 4
|
||||
|
||||
led_oid:
|
||||
members:
|
||||
- STAT : ONLP_LED_ID_CREATE(1)
|
||||
- FAN : ONLP_LED_ID_CREATE(2)
|
||||
- PSU1 : ONLP_LED_ID_CREATE(3)
|
||||
- PSU2 : ONLP_LED_ID_CREATE(4)
|
||||
|
||||
portingmacro:
|
||||
X86_64_NETBERG_AURORA_420_RANGELEY:
|
||||
macros:
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
@@ -0,0 +1,14 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_config.h>
|
||||
|
||||
/* <--auto.start.xmacro(ALL).define> */
|
||||
/* <auto.end.xmacro(ALL).define> */
|
||||
|
||||
/* <--auto.start.xenum(ALL).define> */
|
||||
/* <auto.end.xenum(ALL).define> */
|
||||
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* @file
|
||||
* @brief x86_64_netberg_aurora_420_rangeley Configuration Header
|
||||
*
|
||||
* @addtogroup x86_64_netberg_aurora_420_rangeley-config
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_H__
|
||||
#define __X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_H__
|
||||
|
||||
#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG
|
||||
#include <global_custom_config.h>
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_420_RANGELEY_INCLUDE_CUSTOM_CONFIG
|
||||
#include <x86_64_netberg_aurora_420_rangeley_custom_config.h>
|
||||
#endif
|
||||
|
||||
/* <auto.start.cdefs(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_HEADER).header> */
|
||||
#include <AIM/aim.h>
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_LOGGING
|
||||
*
|
||||
* Include or exclude logging. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_LOGGING
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_LOGGING 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
*
|
||||
* Default enabled log options. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_BITS_DEFAULT
|
||||
*
|
||||
* Default enabled log bits. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_BITS_DEFAULT
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
*
|
||||
* Default enabled custom log bits. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
*
|
||||
* Default all porting macros to use the C standard libraries. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
*
|
||||
* Include standard library headers for stdlib porting macros. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_UCLI
|
||||
*
|
||||
* Include generic uCli support. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_UCLI
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_UCLI 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD
|
||||
*
|
||||
* RPM Threshold at which the fan is considered to have failed. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD 3000
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* All compile time options can be queried or displayed
|
||||
*/
|
||||
|
||||
/** Configuration settings structure. */
|
||||
typedef struct x86_64_netberg_aurora_420_rangeley_config_settings_s {
|
||||
/** name */
|
||||
const char* name;
|
||||
/** value */
|
||||
const char* value;
|
||||
} x86_64_netberg_aurora_420_rangeley_config_settings_t;
|
||||
|
||||
/** Configuration settings table. */
|
||||
/** x86_64_netberg_aurora_420_rangeley_config_settings table. */
|
||||
extern x86_64_netberg_aurora_420_rangeley_config_settings_t x86_64_netberg_aurora_420_rangeley_config_settings[];
|
||||
|
||||
/**
|
||||
* @brief Lookup a configuration setting.
|
||||
* @param setting The name of the configuration option to lookup.
|
||||
*/
|
||||
const char* x86_64_netberg_aurora_420_rangeley_config_lookup(const char* setting);
|
||||
|
||||
/**
|
||||
* @brief Show the compile-time configuration.
|
||||
* @param pvs The output stream.
|
||||
*/
|
||||
int x86_64_netberg_aurora_420_rangeley_config_show(struct aim_pvs_s* pvs);
|
||||
|
||||
/* <auto.end.cdefs(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_HEADER).header> */
|
||||
|
||||
#include "x86_64_netberg_aurora_420_rangeley_porting.h"
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_H__ */
|
||||
/* @} */
|
||||
@@ -0,0 +1,26 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* x86_64_netberg_aurora_420_rangeley Doxygen Header
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_420_RANGELEY_DOX_H__
|
||||
#define __X86_64_NETBERG_AURORA_420_RANGELEY_DOX_H__
|
||||
|
||||
/**
|
||||
* @defgroup x86_64_netberg_aurora_420_rangeley x86_64_netberg_aurora_420_rangeley - x86_64_netberg_aurora_420_rangeley Description
|
||||
*
|
||||
|
||||
The documentation overview for this module should go here.
|
||||
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @defgroup x86_64_netberg_aurora_420_rangeley-x86_64_netberg_aurora_420_rangeley Public Interface
|
||||
* @defgroup x86_64_netberg_aurora_420_rangeley-config Compile Time Configuration
|
||||
* @defgroup x86_64_netberg_aurora_420_rangeley-porting Porting Macros
|
||||
*
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_420_RANGELEY_DOX_H__ */
|
||||
@@ -0,0 +1,87 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* @file
|
||||
* @brief x86_64_netberg_aurora_420_rangeley Porting Macros.
|
||||
*
|
||||
* @addtogroup x86_64_netberg_aurora_420_rangeley-porting
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_420_RANGELEY_PORTING_H__
|
||||
#define __X86_64_NETBERG_AURORA_420_RANGELEY_PORTING_H__
|
||||
|
||||
|
||||
/* <auto.start.portingmacro(ALL).define> */
|
||||
#if X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <memory.h>
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_MEMSET
|
||||
#if defined(GLOBAL_MEMSET)
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_MEMSET GLOBAL_MEMSET
|
||||
#elif X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_MEMSET memset
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_420_RANGELEY_MEMSET is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_MEMCPY
|
||||
#if defined(GLOBAL_MEMCPY)
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_MEMCPY GLOBAL_MEMCPY
|
||||
#elif X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_MEMCPY memcpy
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_420_RANGELEY_MEMCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_STRNCPY GLOBAL_STRNCPY
|
||||
#elif X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_420_RANGELEY_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
#elif X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_VSNPRINTF vsnprintf
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_420_RANGELEY_VSNPRINTF is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_SNPRINTF
|
||||
#if defined(GLOBAL_SNPRINTF)
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_SNPRINTF GLOBAL_SNPRINTF
|
||||
#elif X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_SNPRINTF snprintf
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_420_RANGELEY_SNPRINTF is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_STRLEN
|
||||
#if defined(GLOBAL_STRLEN)
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_STRLEN GLOBAL_STRLEN
|
||||
#elif X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_STRLEN strlen
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_420_RANGELEY_STRLEN is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* <auto.end.portingmacro(ALL).define> */
|
||||
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_420_RANGELEY_PORTING_H__ */
|
||||
/* @} */
|
||||
@@ -0,0 +1,10 @@
|
||||
###############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
x86_64_netberg_aurora_420_rangeley_INCLUDES := -I $(THIS_DIR)inc
|
||||
x86_64_netberg_aurora_420_rangeley_INTERNAL_INCLUDES := -I $(THIS_DIR)src
|
||||
x86_64_netberg_aurora_420_rangeley_DEPENDMODULE_ENTRIES := init:x86_64_netberg_aurora_420_rangeley ucli:x86_64_netberg_aurora_420_rangeley
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
###############################################################################
|
||||
#
|
||||
# Local source generation targets.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
ucli:
|
||||
@../../../../tools/uclihandlers.py x86_64_netberg_aurora_420_rangeley_ucli.c
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch 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.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_config.h>
|
||||
#include <onlp/platformi/fani.h>
|
||||
|
||||
#include "x86_64_netberg_aurora_420_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_420_rangeley_log.h"
|
||||
|
||||
#include <onlplib/file.h>
|
||||
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_FAN(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static int
|
||||
sys_fan_info_get__(onlp_fan_info_t* info, int id)
|
||||
{
|
||||
int value = 0;
|
||||
int rv;
|
||||
|
||||
rv = onlp_file_read_int(&value, SYS_HWMON2_PREFIX "/fan%d_abs", ((id/2)+1));
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
return rv;
|
||||
|
||||
if (value == 0)
|
||||
{
|
||||
info->status = ONLP_FAN_STATUS_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->status = ONLP_FAN_STATUS_PRESENT;
|
||||
|
||||
rv = onlp_file_read_int(&value, SYS_HWMON2_PREFIX "/fan%d_dir", ((id/2)+1));
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
return rv;
|
||||
|
||||
if (value == 1)
|
||||
{
|
||||
info->status |= ONLP_FAN_STATUS_B2F;
|
||||
info->caps |= ONLP_FAN_CAPS_B2F;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->status |= ONLP_FAN_STATUS_F2B;
|
||||
info->caps |= ONLP_FAN_CAPS_F2B;
|
||||
}
|
||||
|
||||
rv = onlp_file_read_int(&(info->rpm), SYS_HWMON1_PREFIX "/fan%d_rpm", (id+1));
|
||||
if (rv == ONLP_STATUS_E_INTERNAL)
|
||||
return rv;
|
||||
|
||||
if (rv == ONLP_STATUS_E_MISSING)
|
||||
{
|
||||
info->status &= ~1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (info->rpm <= X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD)
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
|
||||
|
||||
rv = onlp_file_read_int(&(info->percentage), SYS_HWMON1_PREFIX "/fan%d_duty", (id+1));
|
||||
if (rv == ONLP_STATUS_E_INTERNAL)
|
||||
return rv;
|
||||
|
||||
if (rv == ONLP_STATUS_E_MISSING)
|
||||
{
|
||||
info->status &= ~1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
psu_fan_info_get__(onlp_fan_info_t* info, int id)
|
||||
{
|
||||
return onlp_file_read_int(&(info->rpm), SYS_HWMON2_PREFIX "/psu%d_fan_speed", id);
|
||||
}
|
||||
|
||||
/* Onboard Fans */
|
||||
static onlp_fan_info_t fans__[] = {
|
||||
{ }, /* Not used */
|
||||
{ { FAN_OID_FAN1, "Fan1_rotor1", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN2, "Fan1_rotor2", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN3, "Fan2_rotor1", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN4, "Fan2_rotor2", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN5, "Fan3_rotor1", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN6, "Fan3_rotor2", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN7, "Fan4_rotor1", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN8, "Fan4_rotor2", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN9, "PSU-1 Fan", 0 }, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN10, "PSU-2 Fan", 0 }, ONLP_FAN_STATUS_PRESENT },
|
||||
};
|
||||
|
||||
/*
|
||||
* 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 fid;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
memset(info, 0, sizeof(onlp_fan_info_t));
|
||||
fid = ONLP_OID_ID_GET(id);
|
||||
*info = fans__[fid];
|
||||
|
||||
info->caps |= ONLP_FAN_CAPS_GET_RPM;
|
||||
|
||||
switch(fid)
|
||||
{
|
||||
case FAN_ID_FAN1:
|
||||
case FAN_ID_FAN2:
|
||||
case FAN_ID_FAN3:
|
||||
case FAN_ID_FAN4:
|
||||
case FAN_ID_FAN5:
|
||||
case FAN_ID_FAN6:
|
||||
case FAN_ID_FAN7:
|
||||
case FAN_ID_FAN8:
|
||||
return sys_fan_info_get__(info, (fid - 1));
|
||||
break;
|
||||
|
||||
case FAN_ID_FAN9:
|
||||
case FAN_ID_FAN10:
|
||||
return psu_fan_info_get__(info, (fid - FAN_ID_FAN9 + 1));
|
||||
break;
|
||||
|
||||
default:
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
break;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function sets the speed of the given fan in RPM.
|
||||
*
|
||||
* This function will only be called if the fan supprots the RPM_SET
|
||||
* capability.
|
||||
*
|
||||
* It is optional if you have no fans at all with this feature.
|
||||
*/
|
||||
int
|
||||
onlp_fani_rpm_set(onlp_oid_t id, int rpm)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function sets the fan speed of the given OID as a percentage.
|
||||
*
|
||||
* This will only be called if the OID has the PERCENTAGE_SET
|
||||
* capability.
|
||||
*
|
||||
* It is optional if you have no fans at all with this feature.
|
||||
*/
|
||||
int
|
||||
onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function sets the fan speed of the given OID as per
|
||||
* the predefined ONLP fan speed modes: off, slow, normal, fast, max.
|
||||
*
|
||||
* Interpretation of these modes is up to the platform.
|
||||
*
|
||||
*/
|
||||
int
|
||||
onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function sets the fan direction of the given OID.
|
||||
*
|
||||
* This function is only relevant if the fan OID supports both direction
|
||||
* capabilities.
|
||||
*
|
||||
* This function is optional unless the functionality is available.
|
||||
*/
|
||||
int
|
||||
onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic fan ioctl. Optional.
|
||||
*/
|
||||
int
|
||||
onlp_fani_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
* Copyright 2013 Accton Technology Corporation.
|
||||
*
|
||||
* Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <onlp/platformi/ledi.h>
|
||||
#include <onlplib/file.h>
|
||||
#include "x86_64_netberg_aurora_420_rangeley_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_AMBER,
|
||||
LED_MODE_GREEN,
|
||||
};
|
||||
|
||||
int led_light_map_mode[][2] =
|
||||
{
|
||||
{LED_MODE_OFF, ONLP_LED_MODE_OFF},
|
||||
{LED_MODE_AMBER, ONLP_LED_MODE_ORANGE},
|
||||
{LED_MODE_GREEN, ONLP_LED_MODE_GREEN},
|
||||
};
|
||||
|
||||
/*
|
||||
* Get the information for the given LED OID.
|
||||
*/
|
||||
static onlp_led_info_t linfo[] =
|
||||
{
|
||||
{ }, /* Not used */
|
||||
{
|
||||
{ LED_OID_LED1, "Chassis LED 1 (STAT LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN,
|
||||
ONLP_LED_MODE_OFF,
|
||||
},
|
||||
{
|
||||
{ LED_OID_LED2, "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_MODE_OFF,
|
||||
},
|
||||
{
|
||||
{ LED_OID_LED3, "Chassis LED 3 (PSU1 LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN,
|
||||
ONLP_LED_MODE_OFF,
|
||||
},
|
||||
{
|
||||
{ LED_OID_LED4, "Chassis LED 4 (PSU2 LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN,
|
||||
ONLP_LED_MODE_OFF,
|
||||
},
|
||||
};
|
||||
|
||||
static int conver_led_light_mode_to_driver(int led_ligth_mode)
|
||||
{
|
||||
int i, nsize = sizeof(led_light_map_mode)/sizeof(led_light_map_mode[0]);
|
||||
for(i=0; i<nsize; i++)
|
||||
{
|
||||
if (led_ligth_mode == led_light_map_mode[i][1])
|
||||
{
|
||||
return led_light_map_mode[i][0];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int conver_driver_to_led_light_mode(int driver_mode)
|
||||
{
|
||||
int i, nsize = sizeof(led_light_map_mode)/sizeof(led_light_map_mode[0]);
|
||||
for(i=0; i<nsize; i++)
|
||||
{
|
||||
if (driver_mode == led_light_map_mode[i][0])
|
||||
{
|
||||
return led_light_map_mode[i][1];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will be called prior to any other onlp_ledi_* functions.
|
||||
*/
|
||||
int
|
||||
onlp_ledi_init(void)
|
||||
{
|
||||
/*
|
||||
* Turn on the STAT LEDs at startup
|
||||
*/
|
||||
onlp_ledi_mode_set(LED_OID_LED1, ONLP_LED_MODE_GREEN);
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
{
|
||||
const char *file;
|
||||
int local_id;
|
||||
int value = 0;
|
||||
int rv;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
switch(local_id)
|
||||
{
|
||||
case LED_ID_LED1: /* STAT LED */
|
||||
file = "system_led";
|
||||
break;
|
||||
case LED_ID_LED2: /* FAN LED */
|
||||
file = "fan_led";
|
||||
break;
|
||||
case LED_ID_LED3: /* PSU1 LED */
|
||||
file = "psu1_led";
|
||||
break;
|
||||
case LED_ID_LED4: /* PSU2 LED */
|
||||
file = "psu2_led";
|
||||
break;
|
||||
default:
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
rv = onlp_file_read_int(&value, SYS_HWMON2_PREFIX "/%s", file);
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
return rv;
|
||||
|
||||
*info = linfo[local_id];
|
||||
linfo[local_id].mode = conver_driver_to_led_light_mode(value);
|
||||
|
||||
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;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
switch(local_id)
|
||||
{
|
||||
case LED_ID_LED1:
|
||||
linfo[local_id].status = ONLP_LED_STATUS_PRESENT;
|
||||
if (mode != ONLP_LED_MODE_OFF)
|
||||
linfo[local_id].status |= ONLP_LED_STATUS_ON;
|
||||
linfo[local_id].mode = mode;
|
||||
return onlp_file_write_int(conver_led_light_mode_to_driver(mode), SYS_HWMON2_PREFIX "/system_led");
|
||||
break;
|
||||
|
||||
default:
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
break;
|
||||
}
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic LED ioctl interface.
|
||||
*/
|
||||
int
|
||||
onlp_ledi_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
###############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
LIBRARY := x86_64_netberg_aurora_420_rangeley
|
||||
$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
include $(BUILDER)/lib.mk
|
||||
@@ -0,0 +1,201 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_config.h>
|
||||
#include <onlp/platformi/psui.h>
|
||||
#include <onlplib/file.h>
|
||||
#include "x86_64_netberg_aurora_420_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_420_rangeley_log.h"
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_PSU(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static onlp_psu_info_t psus__[] = {
|
||||
{ }, /* Not used */
|
||||
{
|
||||
{
|
||||
PSU_OID_PSU1,
|
||||
"PSU-1",
|
||||
0,
|
||||
{
|
||||
FAN_OID_FAN9,
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
PSU_OID_PSU2,
|
||||
"PSU-2",
|
||||
0,
|
||||
{
|
||||
FAN_OID_FAN10,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* This function will be called prior to any other onlp_psui functions.
|
||||
*/
|
||||
int
|
||||
onlp_psui_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
|
||||
{
|
||||
int rv;
|
||||
int pid;
|
||||
uint8_t data[256];
|
||||
int value = -1;
|
||||
int len;
|
||||
double dvalue;
|
||||
int i;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
memset(info, 0, sizeof(onlp_psu_info_t));
|
||||
pid = ONLP_OID_ID_GET(id);
|
||||
*info = psus__[pid];
|
||||
|
||||
rv = onlp_file_read_int(&value, SYS_HWMON1_PREFIX "/psu%d_abs", pid);
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
return rv;
|
||||
if (value == 0)
|
||||
{
|
||||
info->status = ONLP_PSU_STATUS_UNPLUGGED;
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/* PSU is present. */
|
||||
info->status = ONLP_PSU_STATUS_PRESENT;
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_eeprom", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
i = 11;
|
||||
|
||||
/* Manufacturer Name */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
i += len;
|
||||
|
||||
/* Product Name */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
memcpy(info->model, (char *) &(data[i]), len);
|
||||
i += len;
|
||||
|
||||
/* Product part,model number */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
i += len;
|
||||
|
||||
/* Product Version */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
i += len;
|
||||
|
||||
/* Product Serial Number */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
memcpy(info->serial, (char *) &(data[i]), len);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(info->model, "Missing");
|
||||
strcpy(info->serial, "Missing");
|
||||
}
|
||||
|
||||
info->caps |= ONLP_PSU_CAPS_AC;
|
||||
|
||||
#if 0
|
||||
/* PSU is powered. */
|
||||
rv = onlp_file_read_int(&value, SYS_HWMON1_PREFIX "/psu%d_pg", pid);
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
return rv;
|
||||
if (value == 0)
|
||||
{
|
||||
info->status |= ONLP_PSU_STATUS_FAILED;
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_iout", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)data);
|
||||
if (dvalue > 0.0)
|
||||
{
|
||||
info->caps |= ONLP_PSU_CAPS_IOUT;
|
||||
info->miout = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_vout", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)data);
|
||||
if (dvalue > 0.0)
|
||||
{
|
||||
info->caps |= ONLP_PSU_CAPS_VOUT;
|
||||
info->mvout = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_pin", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)data);
|
||||
if (dvalue > 0.0)
|
||||
{
|
||||
info->caps |= ONLP_PSU_CAPS_PIN;
|
||||
info->mpin = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_pout", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)data);
|
||||
if (dvalue > 0.0)
|
||||
{
|
||||
info->caps |= ONLP_PSU_CAPS_POUT;
|
||||
info->mpout = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is an optional generic ioctl() interface.
|
||||
* Its purpose is to allow future expansion and
|
||||
* custom functionality that is not otherwise exposed
|
||||
* in the standard interface.
|
||||
*
|
||||
* The semantics of this function are platform specific.
|
||||
* This function is completely optional.
|
||||
*/
|
||||
int
|
||||
onlp_psui_ioctl(onlp_oid_t pid, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,451 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch 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.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
* SFPI Interface for the Aurora 420 Platform
|
||||
*
|
||||
***********************************************************/
|
||||
#include <x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_config.h>
|
||||
#include <onlp/oids.h>
|
||||
#include <onlp/platformi/sfpi.h>
|
||||
#include <onlplib/file.h>
|
||||
#include <onlplib/sfp.h>
|
||||
#include "x86_64_netberg_aurora_420_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_420_rangeley_log.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/* Model ID Definition */
|
||||
typedef enum
|
||||
{
|
||||
HURACAN_WITH_BMC = 0x0,
|
||||
HURACAN_WITHOUT_BMC,
|
||||
CABRERAIII_WITH_BMC,
|
||||
CABRERAIII_WITHOUT_BMC,
|
||||
SESTO_WITH_BMC,
|
||||
SESTO_WITHOUT_BMC,
|
||||
NCIIX_WITH_BMC,
|
||||
NCIIX_WITHOUT_BMC,
|
||||
ASTERION_WITH_BMC,
|
||||
ASTERION_WITHOUT_BMC,
|
||||
HURACAN_A_WITH_BMC,
|
||||
HURACAN_A_WITHOUT_BMC,
|
||||
|
||||
MODEL_ID_LAST
|
||||
} modelId_t;
|
||||
|
||||
static int
|
||||
onlp_board_model_id_get(void)
|
||||
{
|
||||
static int board_model_id = MODEL_ID_LAST;
|
||||
|
||||
if (board_model_id == MODEL_ID_LAST)
|
||||
{
|
||||
if (onlp_file_read_int(&board_model_id, SYS_HWMON1_PREFIX "/board_model_id") != ONLP_STATUS_OK)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return board_model_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will be called prior to all other onlp_sfpi_* functions.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function should populate the give bitmap with
|
||||
* all valid, SFP-capable port numbers.
|
||||
*
|
||||
* Only port numbers in this bitmap will be queried by the the
|
||||
* ONLP framework.
|
||||
*
|
||||
* No SFPI functions will be called with ports that are
|
||||
* not in this bitmap. You can ignore all error checking
|
||||
* on the incoming ports defined in this interface.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap)
|
||||
{
|
||||
int p;
|
||||
int total_port = 0;
|
||||
int board_model_id = onlp_board_model_id_get();
|
||||
|
||||
switch (board_model_id)
|
||||
{
|
||||
case HURACAN_WITH_BMC:
|
||||
case HURACAN_WITHOUT_BMC:
|
||||
case HURACAN_A_WITH_BMC:
|
||||
case HURACAN_A_WITHOUT_BMC:
|
||||
total_port = 32;
|
||||
break;
|
||||
|
||||
case SESTO_WITH_BMC:
|
||||
case SESTO_WITHOUT_BMC:
|
||||
case NCIIX_WITH_BMC:
|
||||
case NCIIX_WITHOUT_BMC:
|
||||
total_port = 54;
|
||||
break;
|
||||
|
||||
case ASTERION_WITH_BMC:
|
||||
case ASTERION_WITHOUT_BMC:
|
||||
total_port = 64;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
AIM_BITMAP_CLR_ALL(bmap);
|
||||
for(p = 0; p < total_port; p++)
|
||||
AIM_BITMAP_SET(bmap, p);
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function should return whether an SFP is inserted on the given
|
||||
* port.
|
||||
*
|
||||
* Returns 1 if the SFP is present.
|
||||
* Returns 0 if the SFP is not present.
|
||||
* Returns ONLP_E_* if there was an error determining the status.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_is_present(int port)
|
||||
{
|
||||
int value = 0;
|
||||
|
||||
onlp_file_read_int(&value, SYS_HWMON2_PREFIX "/port_%d_abs", (port+1));
|
||||
return value;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_port_map(int port, int* rport)
|
||||
{
|
||||
int board_model_id = onlp_board_model_id_get();
|
||||
|
||||
switch (board_model_id)
|
||||
{
|
||||
case HURACAN_WITH_BMC:
|
||||
case HURACAN_WITHOUT_BMC:
|
||||
case HURACAN_A_WITH_BMC:
|
||||
case HURACAN_A_WITHOUT_BMC:
|
||||
/* odd <=> even */
|
||||
if (port & 0x1)
|
||||
*rport = (port - 1);
|
||||
else
|
||||
*rport = (port + 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
*rport = port; break;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* bmap)
|
||||
{
|
||||
int p;
|
||||
int total_port = 0;
|
||||
int board_model_id = onlp_board_model_id_get();
|
||||
|
||||
switch (board_model_id)
|
||||
{
|
||||
case HURACAN_WITH_BMC:
|
||||
case HURACAN_WITHOUT_BMC:
|
||||
case HURACAN_A_WITH_BMC:
|
||||
case HURACAN_A_WITHOUT_BMC:
|
||||
total_port = 32;
|
||||
break;
|
||||
|
||||
case SESTO_WITH_BMC:
|
||||
case SESTO_WITHOUT_BMC:
|
||||
case NCIIX_WITH_BMC:
|
||||
case NCIIX_WITHOUT_BMC:
|
||||
total_port = 54;
|
||||
break;
|
||||
|
||||
case ASTERION_WITH_BMC:
|
||||
case ASTERION_WITHOUT_BMC:
|
||||
total_port = 64;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
AIM_BITMAP_CLR_ALL(bmap);
|
||||
for(p = 0; p < total_port; p++)
|
||||
AIM_BITMAP_SET(bmap, p);
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function reads the SFPs idrom and returns in
|
||||
* in the data buffer provided.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_eeprom_read(int port, uint8_t data[256])
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
char fname[128];
|
||||
|
||||
memset(data, 0, 256);
|
||||
memset(fname, 0, sizeof(fname));
|
||||
sprintf(fname, SYS_HWMON2_PREFIX "/port_%d_data_a0", (port+1));
|
||||
rv = onlplib_sfp_eeprom_read_file(fname, data);
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
AIM_LOG_INFO("Unable to read eeprom from port(%d)\r\n", port);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_dom_read(int port, uint8_t data[256])
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
char fname[128];
|
||||
|
||||
memset(data, 0, 256);
|
||||
memset(fname, 0, sizeof(fname));
|
||||
sprintf(fname, SYS_HWMON2_PREFIX "/port_%d_data_a2", (port+1));
|
||||
rv = onlplib_sfp_eeprom_read_file(fname, data);
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
AIM_LOG_INFO("Unable to read eeprom from port(%d)\r\n", port);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* Manually enable or disable the given SFP.
|
||||
*
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_enable_set(int port, int enable)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns whether the SFP is currently enabled or disabled.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_enable_get(int port, int* enable)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the platform requires any setup or equalizer modifications
|
||||
* based on the actual SFP that was inserted then that custom
|
||||
* setup should be performed here.
|
||||
*
|
||||
* After a new SFP is detected by the ONLP framework this
|
||||
* function will be called to perform the (optional) setup.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_post_insert(int port, sff_info_t* sff_info)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the current status of the SFP.
|
||||
* See onlp_sfp_status_t;
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_status_get(int port, uint32_t* status)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int onlp_sfpi_control_supported(int port, onlp_sfp_control_t control, int* supported)
|
||||
{
|
||||
if (supported == NULL)
|
||||
return ONLP_STATUS_E_PARAM;
|
||||
|
||||
*supported = 0;
|
||||
switch (control)
|
||||
{
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
case ONLP_SFP_CONTROL_RX_LOS:
|
||||
case ONLP_SFP_CONTROL_TX_FAULT:
|
||||
{
|
||||
int board_model_id = onlp_board_model_id_get();
|
||||
|
||||
switch (board_model_id)
|
||||
{
|
||||
case HURACAN_WITH_BMC:
|
||||
case HURACAN_WITHOUT_BMC:
|
||||
case HURACAN_A_WITH_BMC:
|
||||
case HURACAN_A_WITHOUT_BMC:
|
||||
case SESTO_WITH_BMC:
|
||||
case SESTO_WITHOUT_BMC:
|
||||
case NCIIX_WITH_BMC:
|
||||
case NCIIX_WITHOUT_BMC:
|
||||
case ASTERION_WITH_BMC:
|
||||
case ASTERION_WITHOUT_BMC:
|
||||
*supported = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value)
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
int supported = 0;
|
||||
|
||||
if ((onlp_sfpi_control_supported(port, control, &supported) == ONLP_STATUS_OK) && (supported == 0))
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
|
||||
switch (control)
|
||||
{
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
rv = onlp_file_write_int(value, SYS_HWMON2_PREFIX "/port_%d_tx_disable", (port+1));
|
||||
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 = ONLP_STATUS_OK;
|
||||
int supported = 0;
|
||||
|
||||
if (value == NULL)
|
||||
return ONLP_STATUS_E_PARAM;
|
||||
|
||||
if ((onlp_sfpi_control_supported(port, control, &supported) == ONLP_STATUS_OK) && (supported == 0))
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
|
||||
*value = 0;
|
||||
switch (control)
|
||||
{
|
||||
case ONLP_SFP_CONTROL_RX_LOS:
|
||||
rv = onlp_file_read_int(value, SYS_HWMON2_PREFIX "/port_%d_rxlos", (port+1));
|
||||
break;
|
||||
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
rv = onlp_file_read_int(value, SYS_HWMON2_PREFIX "/port_%d_tx_disable", (port+1));
|
||||
break;
|
||||
|
||||
case ONLP_SFP_CONTROL_TX_FAULT:
|
||||
rv = onlp_file_read_int(value, SYS_HWMON2_PREFIX "/port_%d_tx_fault", (port+1));
|
||||
break;
|
||||
|
||||
default:
|
||||
rv = ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_dev_readw(int port, uint8_t devaddr, uint8_t addr)
|
||||
{
|
||||
int value = 0;
|
||||
char fname[128];
|
||||
char data[512];
|
||||
|
||||
memset(data, 0, 512);
|
||||
memset(fname, 0, sizeof(fname));
|
||||
sprintf(fname, SYS_HWMON2_PREFIX "/port_%d_sfp_copper", (port+1));
|
||||
|
||||
int fd = open(fname, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
AIM_LOG_INFO("Unable to read devaddr(0xAC) from port(%d)\r\n", port);
|
||||
return value;
|
||||
}
|
||||
|
||||
int nrd = read(fd, data, 512);
|
||||
close(fd);
|
||||
|
||||
if (nrd != 512) {
|
||||
AIM_LOG_INTERNAL("Failed to read EEPROM file '%s'", fname);
|
||||
return value;
|
||||
}
|
||||
|
||||
value = (((data[addr*2 + 1] & 0xff) << 8) | (data[addr*2] & 0xff)) & 0xffff;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_dev_writew(int port, uint8_t devaddr, uint8_t addr, uint16_t value)
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
int data = 0;
|
||||
|
||||
data = ((addr << 16) | (value & 0xffff)) & 0x00ffffff;
|
||||
rv = onlp_file_write_int(data, SYS_HWMON2_PREFIX "/port_%d_sfp_copper", (port+1));
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a generic ioctl interface.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_ioctl(int port, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* De-initialize the SFPI subsystem.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_denit(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <onlp/platformi/sysi.h>
|
||||
#include <onlplib/file.h>
|
||||
#include "x86_64_netberg_aurora_420_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_420_rangeley_log.h"
|
||||
|
||||
/*
|
||||
* This is the first function called by the ONLP framework.
|
||||
*
|
||||
* It should return the name of your platform driver.
|
||||
*
|
||||
* If the name of your platform driver is the same as the
|
||||
* current platform then this driver will be used.
|
||||
*
|
||||
* If the name of the driver is different from the current
|
||||
* platform, or the driver is capable of supporting multiple
|
||||
* platform variants, see onlp_sysi_platform_set() below.
|
||||
*/
|
||||
const char*
|
||||
onlp_sysi_platform_get(void)
|
||||
{
|
||||
return "x86-64-netberg-aurora-420-rangeley-r0";
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the first function the ONLP framework will call
|
||||
* after it has validated the the platform is supported using the mechanisms
|
||||
* described above.
|
||||
*
|
||||
* If this function does not return ONL_STATUS_OK
|
||||
* then platform initialization is aborted.
|
||||
*/
|
||||
int
|
||||
onlp_sysi_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sysi_onie_info_get(onlp_onie_info_t* onie)
|
||||
{
|
||||
int rv;
|
||||
uint8_t data[256];
|
||||
int len;
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/eeprom");
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
rv = onlp_onie_decode(onie, (uint8_t*)data, sizeof(data));
|
||||
if(rv >= 0)
|
||||
{
|
||||
onie->platform_name = aim_strdup("x86-64-netberg-aurora-420-rangeley-r0");
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
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;
|
||||
int n_thermal=7, n_fan=10, n_led=4;
|
||||
|
||||
/* 2 PSUs */
|
||||
*e++ = ONLP_PSU_ID_CREATE(1);
|
||||
*e++ = ONLP_PSU_ID_CREATE(2);
|
||||
|
||||
/* LEDs Item */
|
||||
for (i=1; i<=n_led; i++)
|
||||
{
|
||||
*e++ = ONLP_LED_ID_CREATE(i);
|
||||
}
|
||||
|
||||
/* THERMALs Item */
|
||||
for (i=1; i<=n_thermal; i++)
|
||||
{
|
||||
*e++ = ONLP_THERMAL_ID_CREATE(i);
|
||||
}
|
||||
|
||||
/* Fans Item */
|
||||
for (i=1; i<=n_fan; i++)
|
||||
{
|
||||
*e++ = ONLP_FAN_ID_CREATE(i);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch 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.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <onlp/platformi/thermali.h>
|
||||
#include <onlplib/file.h>
|
||||
#include "x86_64_netberg_aurora_420_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_420_rangeley_log.h"
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_THERMAL(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static int
|
||||
sys_thermal_info_get__(onlp_thermal_info_t* info, int id)
|
||||
{
|
||||
int rv;
|
||||
|
||||
if (id == THERMAL_ID_THERMAL3)
|
||||
{
|
||||
rv = onlp_file_read_int(&info->mcelsius, SYS_HWMON1_PREFIX "/mac_temp");
|
||||
info->mcelsius *= 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t buffer[64];
|
||||
double dvalue;
|
||||
int len;
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
rv = onlp_file_read(buffer, sizeof(buffer), &len, SYS_HWMON1_PREFIX "/remote_temp%d", id);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)buffer);
|
||||
info->mcelsius = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
if(rv == ONLP_STATUS_E_INTERNAL)
|
||||
return rv;
|
||||
|
||||
if(rv == ONLP_STATUS_E_MISSING)
|
||||
{
|
||||
info->status &= ~(ONLP_THERMAL_STATUS_PRESENT);
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
psu1_thermal_info_get__(onlp_thermal_info_t* info, int id)
|
||||
{
|
||||
int rv;
|
||||
uint8_t buffer[64];
|
||||
double dvalue;
|
||||
int len;
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
rv = onlp_file_read(buffer, sizeof(buffer), &len, SYS_HWMON2_PREFIX "/psu1_temp_%d", id);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)buffer);
|
||||
info->mcelsius = (int)(dvalue * 1000);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
psu2_thermal_info_get__(onlp_thermal_info_t* info, int id)
|
||||
{
|
||||
int rv;
|
||||
uint8_t buffer[64];
|
||||
double dvalue;
|
||||
int len;
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
rv = onlp_file_read(buffer, sizeof(buffer), &len, SYS_HWMON2_PREFIX "/psu2_temp_%d", id);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)buffer);
|
||||
info->mcelsius = (int)(dvalue * 1000);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static onlp_thermal_info_t temps__[] =
|
||||
{
|
||||
{ }, /* Not used */
|
||||
{ { THERMAL_OID_THERMAL1, "Chassis Thermal 1 (Front of MAC)", 0}, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
{ { THERMAL_OID_THERMAL2, "Chassis Thermal 2 (Rear of MAC)", 0}, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
{ { THERMAL_OID_THERMAL3, "Chassis Thermal 3 (MAC)", 0}, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
|
||||
{ { THERMAL_OID_THERMAL4, "PSU-1 Thermal 1", PSU_OID_PSU1 }, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
{ { THERMAL_OID_THERMAL5, "PSU-1 Thermal 2", PSU_OID_PSU1 }, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
|
||||
{ { THERMAL_OID_THERMAL6, "PSU-2 Thermal 1", PSU_OID_PSU2 }, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
{ { THERMAL_OID_THERMAL7, "PSU-2 Thermal 2", PSU_OID_PSU2 }, 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 tid;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
memset(info, 0, sizeof(onlp_thermal_info_t));
|
||||
tid = ONLP_OID_ID_GET(id);
|
||||
*info = temps__[tid];
|
||||
|
||||
switch(tid)
|
||||
{
|
||||
case THERMAL_ID_THERMAL1:
|
||||
case THERMAL_ID_THERMAL2:
|
||||
case THERMAL_ID_THERMAL3:
|
||||
return sys_thermal_info_get__(info, tid);
|
||||
|
||||
case THERMAL_ID_THERMAL4:
|
||||
case THERMAL_ID_THERMAL5:
|
||||
return psu1_thermal_info_get__(info, (tid - THERMAL_ID_THERMAL4 + 1));
|
||||
|
||||
case THERMAL_ID_THERMAL6:
|
||||
case THERMAL_ID_THERMAL7:
|
||||
return psu2_thermal_info_get__(info, (tid - THERMAL_ID_THERMAL6 + 1));
|
||||
}
|
||||
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_config.h>
|
||||
|
||||
/* <auto.start.cdefs(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_HEADER).source> */
|
||||
#define __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME(_x) #_x
|
||||
#define __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_VALUE(_x) __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME(_x)
|
||||
x86_64_netberg_aurora_420_rangeley_config_settings_t x86_64_netberg_aurora_420_rangeley_config_settings[] =
|
||||
{
|
||||
#ifdef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_LOGGING
|
||||
{ __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_LOGGING), __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_LOGGING) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_LOGGING(__x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
{ __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT), __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT(__x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_BITS_DEFAULT
|
||||
{ __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_BITS_DEFAULT), __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_BITS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_BITS_DEFAULT(__x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
{ __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
{ __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB), __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB(__x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
{ __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_UCLI
|
||||
{ __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_UCLI), __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_UCLI) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_UCLI(__x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD
|
||||
{ __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD), __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD(__x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
#undef __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_VALUE
|
||||
#undef __x86_64_netberg_aurora_420_rangeley_config_STRINGIFY_NAME
|
||||
|
||||
const char*
|
||||
x86_64_netberg_aurora_420_rangeley_config_lookup(const char* setting)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; x86_64_netberg_aurora_420_rangeley_config_settings[i].name; i++) {
|
||||
if(!strcmp(x86_64_netberg_aurora_420_rangeley_config_settings[i].name, setting)) {
|
||||
return x86_64_netberg_aurora_420_rangeley_config_settings[i].value;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
x86_64_netberg_aurora_420_rangeley_config_show(struct aim_pvs_s* pvs)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; x86_64_netberg_aurora_420_rangeley_config_settings[i].name; i++) {
|
||||
aim_printf(pvs, "%s = %s\n", x86_64_netberg_aurora_420_rangeley_config_settings[i].name, x86_64_netberg_aurora_420_rangeley_config_settings[i].value);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/* <auto.end.cdefs(X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_HEADER).source> */
|
||||
@@ -0,0 +1,10 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_config.h>
|
||||
|
||||
/* <--auto.start.enum(ALL).source> */
|
||||
/* <auto.end.enum(ALL).source> */
|
||||
|
||||
@@ -0,0 +1,271 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* x86_64_netberg_aurora_420_rangeley Internal Header
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_420_RANGELEY_INT_H__
|
||||
#define __X86_64_NETBERG_AURORA_420_RANGELEY_INT_H__
|
||||
|
||||
#include <x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_config.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* <auto.start.enum(ALL).header> */
|
||||
/** fan_id */
|
||||
typedef enum fan_id_e {
|
||||
FAN_ID_FAN1 = 1,
|
||||
FAN_ID_FAN2 = 2,
|
||||
FAN_ID_FAN3 = 3,
|
||||
FAN_ID_FAN4 = 4,
|
||||
FAN_ID_FAN5 = 5,
|
||||
FAN_ID_FAN6 = 6,
|
||||
FAN_ID_FAN7 = 7,
|
||||
FAN_ID_FAN8 = 8,
|
||||
FAN_ID_FAN9 = 9,
|
||||
FAN_ID_FAN10 = 10,
|
||||
} fan_id_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* fan_id_name(fan_id_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int fan_id_value(const char* str, fan_id_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* fan_id_desc(fan_id_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int fan_id_valid(fan_id_t e);
|
||||
|
||||
/** validator */
|
||||
#define FAN_ID_VALID(_e) \
|
||||
(fan_id_valid((_e)))
|
||||
|
||||
/** fan_id_map table. */
|
||||
extern aim_map_si_t fan_id_map[];
|
||||
/** fan_id_desc_map table. */
|
||||
extern aim_map_si_t fan_id_desc_map[];
|
||||
|
||||
/** fan_oid */
|
||||
typedef enum fan_oid_e {
|
||||
FAN_OID_FAN1 = ONLP_FAN_ID_CREATE(1),
|
||||
FAN_OID_FAN2 = ONLP_FAN_ID_CREATE(2),
|
||||
FAN_OID_FAN3 = ONLP_FAN_ID_CREATE(3),
|
||||
FAN_OID_FAN4 = ONLP_FAN_ID_CREATE(4),
|
||||
FAN_OID_FAN5 = ONLP_FAN_ID_CREATE(5),
|
||||
FAN_OID_FAN6 = ONLP_FAN_ID_CREATE(6),
|
||||
FAN_OID_FAN7 = ONLP_FAN_ID_CREATE(7),
|
||||
FAN_OID_FAN8 = ONLP_FAN_ID_CREATE(8),
|
||||
FAN_OID_FAN9 = ONLP_FAN_ID_CREATE(9),
|
||||
FAN_OID_FAN10 = ONLP_FAN_ID_CREATE(10),
|
||||
} fan_oid_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* fan_oid_name(fan_oid_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int fan_oid_value(const char* str, fan_oid_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* fan_oid_desc(fan_oid_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int fan_oid_valid(fan_oid_t e);
|
||||
|
||||
/** validator */
|
||||
#define FAN_OID_VALID(_e) \
|
||||
(fan_oid_valid((_e)))
|
||||
|
||||
/** fan_oid_map table. */
|
||||
extern aim_map_si_t fan_oid_map[];
|
||||
/** fan_oid_desc_map table. */
|
||||
extern aim_map_si_t fan_oid_desc_map[];
|
||||
|
||||
/** led_id */
|
||||
typedef enum led_id_e {
|
||||
LED_ID_LED1 = 1,
|
||||
LED_ID_LED2 = 2,
|
||||
LED_ID_LED3 = 3,
|
||||
LED_ID_LED4 = 4,
|
||||
} led_id_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* led_id_name(led_id_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int led_id_value(const char* str, led_id_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* led_id_desc(led_id_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int led_id_valid(led_id_t e);
|
||||
|
||||
/** validator */
|
||||
#define LED_ID_VALID(_e) \
|
||||
(led_id_valid((_e)))
|
||||
|
||||
/** led_id_map table. */
|
||||
extern aim_map_si_t led_id_map[];
|
||||
/** led_id_desc_map table. */
|
||||
extern aim_map_si_t led_id_desc_map[];
|
||||
|
||||
/** led_oid */
|
||||
typedef enum led_oid_e {
|
||||
LED_OID_LED1 = ONLP_LED_ID_CREATE(1),
|
||||
LED_OID_LED2 = ONLP_LED_ID_CREATE(2),
|
||||
LED_OID_LED3 = ONLP_LED_ID_CREATE(3),
|
||||
LED_OID_LED4 = ONLP_LED_ID_CREATE(4),
|
||||
} led_oid_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* led_oid_name(led_oid_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int led_oid_value(const char* str, led_oid_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* led_oid_desc(led_oid_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int led_oid_valid(led_oid_t e);
|
||||
|
||||
/** validator */
|
||||
#define LED_OID_VALID(_e) \
|
||||
(led_oid_valid((_e)))
|
||||
|
||||
/** led_oid_map table. */
|
||||
extern aim_map_si_t led_oid_map[];
|
||||
/** led_oid_desc_map table. */
|
||||
extern aim_map_si_t led_oid_desc_map[];
|
||||
|
||||
/** psu_id */
|
||||
typedef enum psu_id_e {
|
||||
PSU_ID_PSU1 = 1,
|
||||
PSU_ID_PSU2 = 2,
|
||||
} psu_id_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* psu_id_name(psu_id_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int psu_id_value(const char* str, psu_id_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* psu_id_desc(psu_id_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int psu_id_valid(psu_id_t e);
|
||||
|
||||
/** validator */
|
||||
#define PSU_ID_VALID(_e) \
|
||||
(psu_id_valid((_e)))
|
||||
|
||||
/** psu_id_map table. */
|
||||
extern aim_map_si_t psu_id_map[];
|
||||
/** psu_id_desc_map table. */
|
||||
extern aim_map_si_t psu_id_desc_map[];
|
||||
|
||||
/** psu_oid */
|
||||
typedef enum psu_oid_e {
|
||||
PSU_OID_PSU1 = ONLP_PSU_ID_CREATE(1),
|
||||
PSU_OID_PSU2 = ONLP_PSU_ID_CREATE(2),
|
||||
} psu_oid_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* psu_oid_name(psu_oid_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int psu_oid_value(const char* str, psu_oid_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* psu_oid_desc(psu_oid_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int psu_oid_valid(psu_oid_t e);
|
||||
|
||||
/** validator */
|
||||
#define PSU_OID_VALID(_e) \
|
||||
(psu_oid_valid((_e)))
|
||||
|
||||
/** psu_oid_map table. */
|
||||
extern aim_map_si_t psu_oid_map[];
|
||||
/** psu_oid_desc_map table. */
|
||||
extern aim_map_si_t psu_oid_desc_map[];
|
||||
|
||||
/** thermal_id */
|
||||
typedef enum thermal_id_e {
|
||||
THERMAL_ID_THERMAL1 = 1,
|
||||
THERMAL_ID_THERMAL2 = 2,
|
||||
THERMAL_ID_THERMAL3 = 3,
|
||||
THERMAL_ID_THERMAL4 = 4,
|
||||
THERMAL_ID_THERMAL5 = 5,
|
||||
THERMAL_ID_THERMAL6 = 6,
|
||||
THERMAL_ID_THERMAL7 = 7,
|
||||
} thermal_id_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* thermal_id_name(thermal_id_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int thermal_id_value(const char* str, thermal_id_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* thermal_id_desc(thermal_id_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int thermal_id_valid(thermal_id_t e);
|
||||
|
||||
/** validator */
|
||||
#define THERMAL_ID_VALID(_e) \
|
||||
(thermal_id_valid((_e)))
|
||||
|
||||
/** thermal_id_map table. */
|
||||
extern aim_map_si_t thermal_id_map[];
|
||||
/** thermal_id_desc_map table. */
|
||||
extern aim_map_si_t thermal_id_desc_map[];
|
||||
|
||||
/** thermal_oid */
|
||||
typedef enum thermal_oid_e {
|
||||
THERMAL_OID_THERMAL1 = ONLP_THERMAL_ID_CREATE(1),
|
||||
THERMAL_OID_THERMAL2 = ONLP_THERMAL_ID_CREATE(2),
|
||||
THERMAL_OID_THERMAL3 = ONLP_THERMAL_ID_CREATE(3),
|
||||
THERMAL_OID_THERMAL4 = ONLP_THERMAL_ID_CREATE(4),
|
||||
THERMAL_OID_THERMAL5 = ONLP_THERMAL_ID_CREATE(5),
|
||||
THERMAL_OID_THERMAL6 = ONLP_THERMAL_ID_CREATE(6),
|
||||
THERMAL_OID_THERMAL7 = ONLP_THERMAL_ID_CREATE(7),
|
||||
} thermal_oid_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* thermal_oid_name(thermal_oid_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int thermal_oid_value(const char* str, thermal_oid_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* thermal_oid_desc(thermal_oid_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int thermal_oid_valid(thermal_oid_t e);
|
||||
|
||||
/** validator */
|
||||
#define THERMAL_OID_VALID(_e) \
|
||||
(thermal_oid_valid((_e)))
|
||||
|
||||
/** thermal_oid_map table. */
|
||||
extern aim_map_si_t thermal_oid_map[];
|
||||
/** thermal_oid_desc_map table. */
|
||||
extern aim_map_si_t thermal_oid_desc_map[];
|
||||
/* <auto.end.enum(ALL).header> */
|
||||
|
||||
/* psu info table */
|
||||
struct psu_info_s {
|
||||
char path[PATH_MAX];
|
||||
int present;
|
||||
int busno;
|
||||
int addr;
|
||||
};
|
||||
|
||||
#define SYS_HWMON1_PREFIX "/sys/class/hwmon/hwmon1/device"
|
||||
#define SYS_HWMON2_PREFIX "/sys/class/hwmon/hwmon2/device"
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_420_RANGELEY_INT_H__ */
|
||||
@@ -0,0 +1,18 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_config.h>
|
||||
|
||||
#include "x86_64_netberg_aurora_420_rangeley_log.h"
|
||||
/*
|
||||
* x86_64_netberg_aurora_420_rangeley log struct.
|
||||
*/
|
||||
AIM_LOG_STRUCT_DEFINE(
|
||||
X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT,
|
||||
X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_BITS_DEFAULT,
|
||||
NULL, /* Custom log map */
|
||||
X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_420_RANGELEY_LOG_H__
|
||||
#define __X86_64_NETBERG_AURORA_420_RANGELEY_LOG_H__
|
||||
|
||||
#define AIM_LOG_MODULE_NAME x86_64_netberg_aurora_420_rangeley
|
||||
#include <AIM/aim_log.h>
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_420_RANGELEY_LOG_H__ */
|
||||
@@ -0,0 +1,24 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_config.h>
|
||||
|
||||
#include "x86_64_netberg_aurora_420_rangeley_log.h"
|
||||
|
||||
static int
|
||||
datatypes_init__(void)
|
||||
{
|
||||
#define X86_64_NETBERG_AURORA_420_RANGELEY_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
|
||||
#include <x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley.x>
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __x86_64_netberg_aurora_420_rangeley_module_init__(void)
|
||||
{
|
||||
AIM_LOG_STRUCT_REGISTER();
|
||||
datatypes_init__();
|
||||
}
|
||||
|
||||
int __onlp_platform_version__ = 1;
|
||||
@@ -0,0 +1,50 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_config.h>
|
||||
|
||||
#if X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_INCLUDE_UCLI == 1
|
||||
|
||||
#include <uCli/ucli.h>
|
||||
#include <uCli/ucli_argparse.h>
|
||||
#include <uCli/ucli_handler_macros.h>
|
||||
|
||||
static ucli_status_t
|
||||
x86_64_netberg_aurora_420_rangeley_ucli_ucli__config__(ucli_context_t* uc)
|
||||
{
|
||||
UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_netberg_aurora_420_rangeley)
|
||||
}
|
||||
|
||||
/* <auto.ucli.handlers.start> */
|
||||
/* <auto.ucli.handlers.end> */
|
||||
|
||||
static ucli_module_t
|
||||
x86_64_netberg_aurora_420_rangeley_ucli_module__ =
|
||||
{
|
||||
"x86_64_netberg_aurora_420_rangeley_ucli",
|
||||
NULL,
|
||||
x86_64_netberg_aurora_420_rangeley_ucli_ucli_handlers__,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
ucli_node_t*
|
||||
x86_64_netberg_aurora_420_rangeley_ucli_node_create(void)
|
||||
{
|
||||
ucli_node_t* n;
|
||||
ucli_module_init(&x86_64_netberg_aurora_420_rangeley_ucli_module__);
|
||||
n = ucli_node_create("x86_64_netberg_aurora_420_rangeley", NULL, &x86_64_netberg_aurora_420_rangeley_ucli_module__);
|
||||
ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_netberg_aurora_420_rangeley"));
|
||||
return n;
|
||||
}
|
||||
|
||||
#else
|
||||
void*
|
||||
x86_64_netberg_aurora_420_rangeley_ucli_node_create(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=netberg BASENAME=x86-64-netberg-aurora-420-rangeley REVISION=r0
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# platform-config for AURORA 420
|
||||
#
|
||||
######################################################################
|
||||
|
||||
x86-64-netberg-aurora-420-rangeley-r0:
|
||||
|
||||
grub:
|
||||
|
||||
serial: >-
|
||||
--port=0x2f8
|
||||
--speed=115200
|
||||
--word=8
|
||||
--parity=no
|
||||
--stop=1
|
||||
|
||||
kernel:
|
||||
<<: *kernel-3-16
|
||||
|
||||
args: >-
|
||||
console=ttyS1,115200n8
|
||||
|
||||
##network:
|
||||
## interfaces:
|
||||
## ma1:
|
||||
## name: ~
|
||||
## syspath: pci0000:00/0000:00:14.0
|
||||
@@ -0,0 +1,12 @@
|
||||
from onl.platform.base import *
|
||||
from onl.platform.netberg import *
|
||||
|
||||
class OnlPlatform_x86_64_netberg_aurora_420_rangeley_r0(OnlPlatformNetberg,
|
||||
OnlPlatformPortConfig_48x10_6x40):
|
||||
PLATFORM='x86-64-netberg-aurora-420-rangeley-r0'
|
||||
MODEL="AURORA420"
|
||||
SYS_OBJECT_ID=".420.1"
|
||||
|
||||
def baseconfig(self):
|
||||
self.insmod("hardware_monitor")
|
||||
return True
|
||||
Reference in New Issue
Block a user