Merge pull request #354 from mlxnataliyay/upstream_part3

3/4 - MSN2010 platform support
This commit is contained in:
Jeffrey Townsend
2018-04-16 13:15:45 -07:00
committed by GitHub
42 changed files with 1157 additions and 0 deletions

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/no-platform-modules.yml ARCH=amd64 VENDOR=mellanox BASENAME=x86-64-mlnx-msn2010

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=x86-64-mlnx-msn2010 ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu

View File

@@ -0,0 +1,2 @@
FILTER=src
include $(ONL)/make/subdirs.mk

View File

@@ -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-mlnx-msn2010
include $(BUILDER)/standardinit.mk
DEPENDMODULES := AIM IOF mlnx_common x86_64_mlnx_msn2010 onlplib
DEPENDMODULE_HEADERS := sff
include $(BUILDER)/dependmodules.mk
SHAREDLIB := libonlp-x86-64-mlnx-msn2010.so
$(SHAREDLIB)_TARGETS := $(ALL_TARGETS)
include $(BUILDER)/so.mk
.DEFAULT_GOAL := $(SHAREDLIB)
GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc
GLOBAL_CFLAGS += -I$(mlnx_common_BASEDIR)/module/inc
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
GLOBAL_CFLAGS += -fPIC
GLOBAL_LINK_LIBS += -lpthread
include $(BUILDER)/targets.mk

View File

@@ -0,0 +1,9 @@
###############################################################################
#
# Inclusive Makefile for the libonlp-x86-64-mlnx-msn2010-r0 module.
#
# Autogenerated 2015-12-23 23:45:22.249911
#
###############################################################################
libonlp-x86-64-mlnx-msn2010-r0_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

View File

@@ -0,0 +1,9 @@
###############################################################################
#
# Inclusive Makefile for the libonlp-x86-64-mlnx-msn2010 module.
#
# Autogenerated 2016-10-13 22:58:39.095824
#
###############################################################################
libonlp-x86-64-mlnx-msn2010_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

View File

@@ -0,0 +1,9 @@
###############################################################################
#
# Inclusive Makefile for the x86_64_mlnx_msn2010 module.
#
# Autogenerated 2015-12-23 23:45:22.262891
#
###############################################################################
x86_64_mlnx_msn2010_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

View File

@@ -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 mlnx_common x86_64_mlnx_msn2010 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

View File

@@ -0,0 +1,9 @@
###############################################################################
#
# Inclusive Makefile for the onlpdump module.
#
# Autogenerated 2016-10-13 22:58:37.393320
#
###############################################################################
onlpdump_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

View File

@@ -0,0 +1 @@
name: x86_64_mlnx_msn2010

View File

@@ -0,0 +1,9 @@
###############################################################################
#
#
#
###############################################################################
include ../../init.mk
MODULE := x86_64_mlnx_msn2010
AUTOMODULE := x86_64_mlnx_msn2010
include $(BUILDER)/definemodule.mk

View File

@@ -0,0 +1,5 @@
###############################################################################
#
# x86_64_mlnx_msn2010 README
#
###############################################################################

View File

@@ -0,0 +1,8 @@
###############################################################################
#
# x86_64_mlnx_msn2010 Autogeneration
#
###############################################################################
x86_64_mlnx_msn2010_AUTO_DEFS := module/auto/x86_64_mlnx_msn2010.yml
x86_64_mlnx_msn2010_AUTO_DIRS := module/inc/x86_64_mlnx_msn2010 module/src
include $(BUILDER)/auto.mk

View File

@@ -0,0 +1,50 @@
###############################################################################
#
# x86_64_mlnx_msn2010 Autogeneration Definitions.
#
###############################################################################
cdefs: &cdefs
- X86_64_MLNX_MSN2010_CONFIG_INCLUDE_LOGGING:
doc: "Include or exclude logging."
default: 1
- X86_64_MLNX_MSN2010_CONFIG_LOG_OPTIONS_DEFAULT:
doc: "Default enabled log options."
default: AIM_LOG_OPTIONS_DEFAULT
- X86_64_MLNX_MSN2010_CONFIG_LOG_BITS_DEFAULT:
doc: "Default enabled log bits."
default: AIM_LOG_BITS_DEFAULT
- X86_64_MLNX_MSN2010_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
doc: "Default enabled custom log bits."
default: 0
- X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB:
doc: "Default all porting macros to use the C standard libraries."
default: 1
- X86_64_MLNX_MSN2010_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
doc: "Include standard library headers for stdlib porting macros."
default: x86_64_mlnx_msn2010_CONFIG_PORTING_STDLIB
- X86_64_MLNX_MSN2010_CONFIG_INCLUDE_UCLI:
doc: "Include generic uCli support."
default: 0
- X86_64_MLNX_MSN2010_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION:
doc: "Assume chassis fan direction is the same as the PSU fan direction."
default: 0
definitions:
cdefs:
X86_64_MLNX_MSN2010_CONFIG_HEADER:
defs: *cdefs
basename: x86_64_mlnx_msn2010_config
portingmacro:
x86_64_mlnx_msn2010:
macros:
- malloc
- free
- memset
- memcpy
- strncpy
- vsnprintf
- snprintf
- strlen

View File

@@ -0,0 +1,12 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_mlnx_msn2010/x86_64_mlnx_msn2010_config.h>
/* <--auto.start.xmacro(ALL).define> */
/* <auto.end.xmacro(ALL).define> */
/* <--auto.start.xenum(ALL).define> */
/* <auto.end.xenum(ALL).define> */

View File

@@ -0,0 +1,137 @@
/**************************************************************************//**
*
* @file
* @brief x86_64_mlnx_msn2010 Configuration Header
*
* @addtogroup x86_64_mlnx_msn2010-config
* @{
*
*****************************************************************************/
#ifndef __X86_64_MLNX_MSN2010_CONFIG_H__
#define __X86_64_MLNX_MSN2010_CONFIG_H__
#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG
#include <global_custom_config.h>
#endif
#ifdef X86_64_MLNX_MSN2010_INCLUDE_CUSTOM_CONFIG
#include <x86_64_mlnx_msn2010_custom_config.h>
#endif
/* <auto.start.cdefs(X86_64_MLNX_MSN2010_CONFIG_HEADER).header> */
#include <AIM/aim.h>
/**
* X86_64_MLNX_MSN2010_CONFIG_INCLUDE_LOGGING
*
* Include or exclude logging. */
#ifndef X86_64_MLNX_MSN2010_CONFIG_INCLUDE_LOGGING
#define X86_64_MLNX_MSN2010_CONFIG_INCLUDE_LOGGING 1
#endif
/**
* X86_64_MLNX_MSN2010_CONFIG_LOG_OPTIONS_DEFAULT
*
* Default enabled log options. */
#ifndef X86_64_MLNX_MSN2010_CONFIG_LOG_OPTIONS_DEFAULT
#define X86_64_MLNX_MSN2010_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT
#endif
/**
* X86_64_MLNX_MSN2010_CONFIG_LOG_BITS_DEFAULT
*
* Default enabled log bits. */
#ifndef X86_64_MLNX_MSN2010_CONFIG_LOG_BITS_DEFAULT
#define X86_64_MLNX_MSN2010_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT
#endif
/**
* X86_64_MLNX_MSN2010_CONFIG_LOG_CUSTOM_BITS_DEFAULT
*
* Default enabled custom log bits. */
#ifndef X86_64_MLNX_MSN2010_CONFIG_LOG_CUSTOM_BITS_DEFAULT
#define X86_64_MLNX_MSN2010_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0
#endif
/**
* X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB
*
* Default all porting macros to use the C standard libraries. */
#ifndef X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB
#define X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB 1
#endif
/**
* X86_64_MLNX_MSN2010_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
*
* Include standard library headers for stdlib porting macros. */
#ifndef X86_64_MLNX_MSN2010_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
#define X86_64_MLNX_MSN2010_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB
#endif
/**
* X86_64_MLNX_MSN2010_CONFIG_INCLUDE_UCLI
*
* Include generic uCli support. */
#ifndef X86_64_MLNX_MSN2010_CONFIG_INCLUDE_UCLI
#define X86_64_MLNX_MSN2010_CONFIG_INCLUDE_UCLI 0
#endif
/**
* X86_64_MLNX_MSN2010_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
*
* Assume chassis fan direction is the same as the PSU fan direction. */
#ifndef X86_64_MLNX_MSN2010_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
#define X86_64_MLNX_MSN2010_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION 0
#endif
/**
* All compile time options can be queried or displayed
*/
/** Configuration settings structure. */
typedef struct x86_64_mlnx_msn2010_config_settings_s {
/** name */
const char* name;
/** value */
const char* value;
} x86_64_mlnx_msn2010_config_settings_t;
/** Configuration settings table. */
/** x86_64_mlnx_msn2010_config_settings table. */
extern x86_64_mlnx_msn2010_config_settings_t x86_64_mlnx_msn2010_config_settings[];
/**
* @brief Lookup a configuration setting.
* @param setting The name of the configuration option to lookup.
*/
const char* x86_64_mlnx_msn2010_config_lookup(const char* setting);
/**
* @brief Show the compile-time configuration.
* @param pvs The output stream.
*/
int x86_64_mlnx_msn2010_config_show(struct aim_pvs_s* pvs);
/* <auto.end.cdefs(X86_64_MLNX_MSN2010_CONFIG_HEADER).header> */
#include "x86_64_mlnx_msn2010_porting.h"
#endif /* __X86_64_MLNX_MSN2010_CONFIG_H__ */
/* @} */

View File

@@ -0,0 +1,26 @@
/**************************************************************************//**
*
* x86_64_mlnx_msn2010 Doxygen Header
*
*****************************************************************************/
#ifndef __X86_64_MLNX_MSN2010_DOX_H__
#define __X86_64_MLNX_MSN2010_DOX_H__
/**
* @defgroup x86_64_mlnx_msn2010 x86_64_mlnx_msn2010 - x86_64_mlnx_msn2010 Description
*
The documentation overview for this module should go here.
*
* @{
*
* @defgroup x86_64_mlnx_msn2010-x86_64_mlnx_msn2010 Public Interface
* @defgroup x86_64_mlnx_msn2010-config Compile Time Configuration
* @defgroup x86_64_mlnx_msn2010-porting Porting Macros
*
* @}
*
*/
#endif /* __X86_64_MLNX_MSN2010_DOX_H__ */

View File

@@ -0,0 +1,107 @@
/**************************************************************************//**
*
* @file
* @brief x86_64_mlnx_msn2010 Porting Macros.
*
* @addtogroup x86_64_mlnx_msn2010-porting
* @{
*
*****************************************************************************/
#ifndef __X86_64_MLNX_MSN2010_PORTING_H__
#define __X86_64_MLNX_MSN2010_PORTING_H__
/* <auto.start.portingmacro(ALL).define> */
#if X86_64_MLNX_MSN2010_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_MLNX_MSN2010_MALLOC
#if defined(GLOBAL_MALLOC)
#define X86_64_MLNX_MSN2010_MALLOC GLOBAL_MALLOC
#elif X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB == 1
#define X86_64_MLNX_MSN2010_MALLOC malloc
#else
#error The macro X86_64_MLNX_MSN2010_MALLOC is required but cannot be defined.
#endif
#endif
#ifndef X86_64_MLNX_MSN2010_FREE
#if defined(GLOBAL_FREE)
#define X86_64_MLNX_MSN2010_FREE GLOBAL_FREE
#elif X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB == 1
#define X86_64_MLNX_MSN2010_FREE free
#else
#error The macro X86_64_MLNX_MSN2010_FREE is required but cannot be defined.
#endif
#endif
#ifndef X86_64_MLNX_MSN2010_MEMSET
#if defined(GLOBAL_MEMSET)
#define X86_64_MLNX_MSN2010_MEMSET GLOBAL_MEMSET
#elif X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB == 1
#define X86_64_MLNX_MSN2010_MEMSET memset
#else
#error The macro X86_64_MLNX_MSN2010_MEMSET is required but cannot be defined.
#endif
#endif
#ifndef X86_64_MLNX_MSN2010_MEMCPY
#if defined(GLOBAL_MEMCPY)
#define X86_64_MLNX_MSN2010_MEMCPY GLOBAL_MEMCPY
#elif X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB == 1
#define X86_64_MLNX_MSN2010_MEMCPY memcpy
#else
#error The macro X86_64_MLNX_MSN2010_MEMCPY is required but cannot be defined.
#endif
#endif
#ifndef X86_64_MLNX_MSN2010_STRNCPY
#if defined(GLOBAL_STRNCPY)
#define X86_64_MLNX_MSN2010_STRNCPY GLOBAL_STRNCPY
#elif X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB == 1
#define X86_64_MLNX_MSN2010_STRNCPY strncpy
#else
#error The macro X86_64_MLNX_MSN2010_STRNCPY is required but cannot be defined.
#endif
#endif
#ifndef X86_64_MLNX_MSN2010_VSNPRINTF
#if defined(GLOBAL_VSNPRINTF)
#define X86_64_MLNX_MSN2010_VSNPRINTF GLOBAL_VSNPRINTF
#elif X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB == 1
#define X86_64_MLNX_MSN2010_VSNPRINTF vsnprintf
#else
#error The macro X86_64_MLNX_MSN2010_VSNPRINTF is required but cannot be defined.
#endif
#endif
#ifndef X86_64_MLNX_MSN2010_SNPRINTF
#if defined(GLOBAL_SNPRINTF)
#define X86_64_MLNX_MSN2010_SNPRINTF GLOBAL_SNPRINTF
#elif X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB == 1
#define X86_64_MLNX_MSN2010_SNPRINTF snprintf
#else
#error The macro X86_64_MLNX_MSN2010_SNPRINTF is required but cannot be defined.
#endif
#endif
#ifndef X86_64_MLNX_MSN2010_STRLEN
#if defined(GLOBAL_STRLEN)
#define X86_64_MLNX_MSN2010_STRLEN GLOBAL_STRLEN
#elif X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB == 1
#define X86_64_MLNX_MSN2010_STRLEN strlen
#else
#error The macro X86_64_MLNX_MSN2010_STRLEN is required but cannot be defined.
#endif
#endif
/* <auto.end.portingmacro(ALL).define> */
#endif /* __X86_64_MLNX_MSN2010_PORTING_H__ */
/* @} */

View File

@@ -0,0 +1,9 @@
###############################################################################
#
#
#
###############################################################################
THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
x86_64_mlnx_msn2010_INCLUDES := -I $(THIS_DIR)inc
x86_64_mlnx_msn2010_INTERNAL_INCLUDES := -I $(THIS_DIR)src
x86_64_mlnx_msn2010_DEPENDMODULE_ENTRIES := init:x86_64_mlnx_msn2010 ucli:x86_64_mlnx_msn2010

View File

@@ -0,0 +1,8 @@
###############################################################################
#
# Local source generation targets.
#
###############################################################################
ucli:
@../../../../tools/uclihandlers.py x86_64_mlnx_msn2010_ucli.c

View File

@@ -0,0 +1,75 @@
/************************************************************
* <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>
************************************************************
*
* Fan Platform Implementation Defaults.
*
***********************************************************/
#include <fcntl.h>
#include <onlplib/file.h>
#include <onlplib/mmap.h>
#include <onlp/platformi/fani.h>
#include "platform_lib.h"
#include "mlnx_common/mlnx_common.h"
#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
/* No PSU with fan, set to bigger then last fan id*/
#define FIRST_PSU_FAN_ID 5
static int min_fan_speed[CHASSIS_FAN_COUNT+1] = {0};
static int max_fan_speed[CHASSIS_FAN_COUNT+1] = {0};
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)
};
/* Static fan information */
onlp_fan_info_t finfo[] = {
{ }, /* 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)
};
/*
* This function will be called prior to all of onlp_fani_* functions.
*/
int
onlp_fani_init(void)
{
mlnx_platform_info_t* mlnx_platform_info = get_platform_info();
mlnx_platform_info->min_fan_speed = min_fan_speed;
mlnx_platform_info->max_fan_speed = max_fan_speed;
mlnx_platform_info->finfo = finfo;
mlnx_platform_info->fan_fnames = fan_path;
mlnx_platform_info->fan_type = FAN_TYPE_NO_EEPROM;
mlnx_platform_info->first_psu_fan_id = FIRST_PSU_FAN_ID;
return ONLP_STATUS_OK;
}

View File

@@ -0,0 +1,93 @@
/************************************************************
* <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 <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <onlplib/mmap.h>
#include <onlplib/file.h>
#include <onlp/platformi/ledi.h>
#include "platform_lib.h"
#include <mlnx_common/mlnx_common.h>
static char* file_names[] = /* must map with onlp_led_id */
{
"reserved",
"status",
"fan",
"psu1",
"psu2",
"uid"
};
/*
* Get the information for the given LED OID.
*/
static onlp_led_info_t linfo[] =
{
{ }, /* Not used */
{
{ ONLP_LED_ID_CREATE(LED_SYSTEM), "Chassis LED 1 (SYSTEM LED)", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_GREEN_BLINKING |
ONLP_LED_CAPS_RED | ONLP_LED_CAPS_RED_BLINKING | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_FAN), "Chassis LED 2 (FAN LED)", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_GREEN_BLINKING |
ONLP_LED_CAPS_RED | ONLP_LED_CAPS_RED_BLINKING | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_PSU1), "Chassis LED 3 (PSU1 LED)", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_GREEN_BLINKING |
ONLP_LED_CAPS_RED | ONLP_LED_CAPS_RED_BLINKING | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_PSU2), "Chassis LED 4 (PSU2 LED)", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_GREEN_BLINKING |
ONLP_LED_CAPS_RED | ONLP_LED_CAPS_RED_BLINKING | ONLP_LED_CAPS_AUTO,
},
{
{ ONLP_LED_ID_CREATE(LED_UID), "Chassis LED 5 (UID LED)", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_BLUE | ONLP_LED_CAPS_BLUE_BLINKING |
ONLP_LED_CAPS_AUTO,
}
};
/*
* This function will be called prior to any other onlp_ledi_* functions.
*/
int
onlp_ledi_init(void)
{
mlnx_platform_info_t* mlnx_platform_info = get_platform_info();
mlnx_platform_info->linfo = linfo;
mlnx_platform_info->led_fnames = file_names;
return ONLP_STATUS_OK;
}

View File

@@ -0,0 +1,9 @@
###############################################################################
#
#
#
###############################################################################
LIBRARY := x86_64_mlnx_msn2010
$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(BUILDER)/lib.mk

View File

@@ -0,0 +1,37 @@
/************************************************************
* <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>
************************************************************
*
*
*
***********************************************************/
#ifndef __PLATFORM_LIB_H__
#define __PLATFORM_LIB_H__
#include "x86_64_mlnx_msn2010_log.h"
#define CHASSIS_LED_COUNT 5
#define CHASSIS_PSU_COUNT 2
#define CHASSIS_FAN_COUNT 4
#define CHASSIS_THERMAL_COUNT 7
#define SFP_PORT_COUNT 22
#define CPLD_COUNT 2
#endif /* __PLATFORM_LIB_H__ */

View File

@@ -0,0 +1,65 @@
/************************************************************
* <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 <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <onlplib/file.h>
#include <onlp/platformi/fani.h>
#include <onlp/platformi/ledi.h>
#include <onlp/platformi/psui.h>
#include <onlp/platformi/sysi.h>
#include <onlp/platformi/thermali.h>
#include "platform_lib.h"
#include "x86_64_mlnx_msn2010_int.h"
#include "x86_64_mlnx_msn2010_log.h"
#include <mlnx_common/mlnx_common.h>
#define ONL_PLATFORM_NAME "x86-64-mlnx-msn2010-r0"
#define COMMAND_OUTPUT_BUFFER 256
int mc_get_platform_info(mlnx_platform_info_t* mlnx_platform)
{
strncpy(mlnx_platform->onl_platform_name, ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN);
mlnx_platform->sfp_num = SFP_PORT_COUNT;
mlnx_platform->led_num = CHASSIS_LED_COUNT;
mlnx_platform->psu_num = CHASSIS_PSU_COUNT;
mlnx_platform->fan_num = CHASSIS_FAN_COUNT;
mlnx_platform->thermal_num = CHASSIS_THERMAL_COUNT;
mlnx_platform->cpld_num = CPLD_COUNT;
mlnx_platform->psu_fixed = true;
mlnx_platform->fan_fixed = true;
mlnx_platform->psu_type = PSU_TYPE_1;
mlnx_platform->led_type = LED_TYPE_1;
return ONLP_STATUS_OK;
}
int
onlp_sysi_init(void)
{
return ONLP_STATUS_OK;
}

View File

@@ -0,0 +1,101 @@
/************************************************************
* <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>
************************************************************
*
* Thermal Sensor Platform Implementation.
*
***********************************************************/
#include <fcntl.h>
#include <unistd.h>
#include <AIM/aim_log.h>
#include <onlplib/file.h>
#include <onlplib/mmap.h>
#include <onlp/platformi/thermali.h>
#include "platform_lib.h"
#include "mlnx_common/mlnx_common.h"
enum onlp_thermal_id
{
THERMAL_RESERVED = 0,
THERMAL_CPU_CORE_0,
THERMAL_CPU_CORE_1,
THERMAL_CPU_CORE_2,
THERMAL_CPU_CORE_3,
THERMAL_ASIC,
THERMAL_BOARD_AMB,
THERMAL_PORT
};
static char* thermal_fnames[] = /* must map with onlp_thermal_id */
{
"reserved",
"cpu_core0",
"cpu_core1",
"cpu_core2",
"cpu_core3",
"asic",
"board_amb",
"port_amb"
};
/* Static values */
static onlp_thermal_info_t tinfo[] = {
{ }, /* Not used */
{ { ONLP_THERMAL_ID_CREATE(THERMAL_CPU_CORE_0), "CPU Core 0", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, CPU_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_CPU_CORE_1), "CPU Core 1", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, CPU_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_CPU_CORE_2), "CPU Core 2", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, CPU_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_CPU_CORE_3), "CPU Core 3", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, CPU_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_ASIC), "Asic Thermal Sensor", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, ASIC_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_BOARD_AMB), "Board AMB Thermal Sensor", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0, {0,0,0}
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_PORT), "Port AMB Thermal Sensor", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0, {0,0,0}
}
};
/*
* This will be called to intiialize the thermali subsystem.
*/
int
onlp_thermali_init(void)
{
mlnx_platform_info_t* mlnx_platform_info = get_platform_info();
mlnx_platform_info->tinfo=tinfo;
mlnx_platform_info->thermal_fnames=thermal_fnames;
return ONLP_STATUS_OK;
}

View File

@@ -0,0 +1,80 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_mlnx_msn2010/x86_64_mlnx_msn2010_config.h>
/* <auto.start.cdefs(x86_64_mlnx_msn2010_CONFIG_HEADER).source> */
#define __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME(_x) #_x
#define __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_VALUE(_x) __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME(_x)
x86_64_mlnx_msn2010_config_settings_t x86_64_mlnx_msn2010_config_settings[] =
{
#ifdef X86_64_MLNX_MSN2010_CONFIG_INCLUDE_LOGGING
{ __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME(X86_64_MLNX_MSN2010_CONFIG_INCLUDE_LOGGING), __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_VALUE(X86_64_MLNX_MSN2010_CONFIG_INCLUDE_LOGGING) },
#else
{ X86_64_MLNX_MSN2010_CONFIG_INCLUDE_LOGGING(__X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_MLNX_MSN2010_CONFIG_LOG_OPTIONS_DEFAULT
{ __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME(X86_64_MLNX_MSN2010_CONFIG_LOG_OPTIONS_DEFAULT), __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_VALUE(X86_64_MLNX_MSN2010_CONFIG_LOG_OPTIONS_DEFAULT) },
#else
{ X86_64_MLNX_MSN2010_CONFIG_LOG_OPTIONS_DEFAULT(__X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_MLNX_MSN2010_CONFIG_LOG_BITS_DEFAULT
{ __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME(X86_64_MLNX_MSN2010_CONFIG_LOG_BITS_DEFAULT), __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_VALUE(X86_64_MLNX_MSN2010_CONFIG_LOG_BITS_DEFAULT) },
#else
{ X86_64_MLNX_MSN2010_CONFIG_LOG_BITS_DEFAULT(__X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_MLNX_MSN2010_CONFIG_LOG_CUSTOM_BITS_DEFAULT
{ __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME(X86_64_MLNX_MSN2010_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_VALUE(X86_64_MLNX_MSN2010_CONFIG_LOG_CUSTOM_BITS_DEFAULT) },
#else
{ X86_64_MLNX_MSN2010_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB
{ __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME(X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB), __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_VALUE(X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB) },
#else
{ X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB(__X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_MLNX_MSN2010_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
{ __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME(X86_64_MLNX_MSN2010_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_VALUE(X86_64_MLNX_MSN2010_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) },
#else
{ X86_64_MLNX_MSN2010_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_MLNX_MSN2010_CONFIG_INCLUDE_UCLI
{ __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME(X86_64_MLNX_MSN2010_CONFIG_INCLUDE_UCLI), __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_VALUE(X86_64_MLNX_MSN2010_CONFIG_INCLUDE_UCLI) },
#else
{ X86_64_MLNX_MSN2010_CONFIG_INCLUDE_UCLI(__X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_MLNX_MSN2010_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
{ __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME(X86_64_MLNX_MSN2010_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION), __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_VALUE(X86_64_MLNX_MSN2010_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION) },
#else
{ X86_64_MLNX_MSN2010_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION(__X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME), "__undefined__" },
#endif
{ NULL, NULL }
};
#undef __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_VALUE
#undef __X86_64_MLNX_MSN2010_CONFIG_STRINGIFY_NAME
const char*
x86_64_mlnx_msn2010_config_lookup(const char* setting)
{
int i;
for(i = 0; x86_64_mlnx_msn2010_config_settings[i].name; i++) {
if(strcmp(x86_64_mlnx_msn2010_config_settings[i].name, setting)) {
return x86_64_mlnx_msn2010_config_settings[i].value;
}
}
return NULL;
}
int
x86_64_mlnx_msn2010_config_show(struct aim_pvs_s* pvs)
{
int i;
for(i = 0; x86_64_mlnx_msn2010_config_settings[i].name; i++) {
aim_printf(pvs, "%s = %s\n", x86_64_mlnx_msn2010_config_settings[i].name, x86_64_mlnx_msn2010_config_settings[i].value);
}
return i;
}
/* <auto.end.cdefs(x86_64_mlnx_msn2010_CONFIG_HEADER).source> */

View File

@@ -0,0 +1,9 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_mlnx_msn2010/x86_64_mlnx_msn2010_config.h>
/* <--auto.start.enum(ALL).source> */
/* <auto.end.enum(ALL).source> */

View File

@@ -0,0 +1,13 @@
/**************************************************************************//**
*
* x86_64_mlnx_msn
Internal Header
*
*****************************************************************************/
#ifndef __X86_64_MLNX_MSN2010_INT_H__
#define __X86_64_MLNX_MSN2010_INT_H__
#include <x86_64_mlnx_msn2010/x86_64_mlnx_msn2010_config.h>
#endif /* __X86_64_MLNX_MSN2010_INT_H__ */

View File

@@ -0,0 +1,17 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_mlnx_msn2010/x86_64_mlnx_msn2010_config.h>
#include "x86_64_mlnx_msn2010_log.h"
/*
* x86_64_mlnx_msn2010 log struct.
*/
AIM_LOG_STRUCT_DEFINE(
X86_64_MLNX_MSN2010_CONFIG_LOG_OPTIONS_DEFAULT,
X86_64_MLNX_MSN2010_CONFIG_LOG_BITS_DEFAULT,
NULL, /* Custom log map */
X86_64_MLNX_MSN2010_CONFIG_LOG_CUSTOM_BITS_DEFAULT
);

View File

@@ -0,0 +1,12 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#ifndef __X86_64_MLNX_MSN2010_LOG_H__
#define __X86_64_MLNX_MSN2010_LOG_H__
#define AIM_LOG_MODULE_NAME x86_64_mlnx_msn2010
#include <AIM/aim_log.h>
#endif /* __X86_64_MLNX_MSN2010_LOG_H__ */

View File

@@ -0,0 +1,24 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_mlnx_msn2010/x86_64_mlnx_msn2010_config.h>
#include "x86_64_mlnx_msn2010_log.h"
static int
datatypes_init__(void)
{
#define x86_64_mlnx_msn2010_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
#include <x86_64_mlnx_msn2010/x86_64_mlnx_msn2010.x>
return 0;
}
void __x86_64_mlnx_msn2010_module_init__(void)
{
AIM_LOG_STRUCT_REGISTER();
datatypes_init__();
}
int __onlp_platform_version__ = 1;

View File

@@ -0,0 +1,49 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_mlnx_msn2010/x86_64_mlnx_msn2010_config.h>
#if x86_64_mlnx_msn2010_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_mlnx_msn2010_ucli_ucli__config__(ucli_context_t* uc)
{
UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_mlnx_msn2010)
}
/* <auto.ucli.handlers.start> */
/* <auto.ucli.handlers.end> */
static ucli_module_t
x86_64_mlnx_msn2010_ucli_module__ =
{
"x86_64_mlnx_msn2010_ucli",
NULL,
x86_64_mlnx_msn2010_ucli_ucli_handlers__,
NULL,
NULL,
};
ucli_node_t*
x86_64_mlnx_msn2010_ucli_node_create(void)
{
ucli_node_t* n;
ucli_module_init(&x86_64_mlnx_msn2010_ucli_module__);
n = ucli_node_create("x86_64_mlnx_msn2010", NULL, &x86_64_mlnx_msn2010_ucli_module__);
ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_mlnx_msn2010"));
return n;
}
#else
void*
x86_64_mlnx_msn2010_ucli_node_create(void)
{
return NULL;
}
#endif

View File

@@ -0,0 +1,12 @@
###############################################################################
#
# Inclusive Makefile for the x86_64_mlnx_msn2010 module.
#
# Autogenerated 2015-12-23 23:45:56.754200
#
###############################################################################
x86_64_mlnx_msn2010_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
include $(x86_64_mlnx_msn2010_BASEDIR)/module/make.mk
include $(x86_64_mlnx_msn2010_BASEDIR)/module/auto/make.mk
include $(x86_64_mlnx_msn2010_BASEDIR)/module/src/make.mk

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1 @@
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=mellanox BASENAME=x86-64-mlnx-msn2010 REVISION=r0

View File

@@ -0,0 +1,36 @@
---
######################################################################
#
# platform-config for Mellanox msn2010
#
######################################################################
x86-64-mlnx-msn2010-r0:
grub:
serial: >-
--unit=0
--speed=115200
--word=8
--parity=0
--stop=1
kernel:
<<: *kernel-4-9
args: >-
nopat
console=ttyS0,115200n8
rd_NO_MD
rd_NO_LUKS
acpi_enforce_resources=lax
acpi=noirq
i2c-ismt.enable=0
##network
## interfaces:
## ma1:
## name: ~
## syspath: pci0000:00/0000:00:14.0

View File

@@ -0,0 +1,17 @@
from onl.platform.base import *
from onl.platform.mellanox import *
class OnlPlatform_x86_64_mlnx_msn2010_r0(OnlPlatformMellanox,
OnlPlatformPortConfig_32x100):
PLATFORM='x86-64-mlnx-msn2010-r0'
MODEL="SN2010"
SYS_OBJECT_ID=".2010.1"
def baseconfig(self):
# load modules
import os
# necessary if there are issues with the install
# os.system("/usr/bin/apt-get install")
os.system("/etc/mlnx/mlnx-hw-management start")
self.syseeprom_export();
return True