Initial support for the Wedge100s.

This commit is contained in:
Jeffrey Townsend
2018-02-27 19:59:52 +00:00
parent 9436f404dc
commit db5237de9f
38 changed files with 2102 additions and 33 deletions

View File

@@ -0,0 +1,3 @@
*x86*64*accton*wedge100*32x*.mk
onlpdump.mk

View File

@@ -1,16 +1 @@
variables:
platform: x86-64-accton-wedge100s-32x-r0
install: /lib/platform-config/${platform}/onl
common:
version: 1.0.0
arch: amd64
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
support: opennetworklinux@googlegroups.com
comment: dummy package for ONLP on Wedge
packages:
- name: onlp-${platform}
summary: ONLP Package for the ${platform} platform.
changelog: initial version
!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=x86-64-accton-wedge100s-32x 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,44 @@
############################################################
# <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-accton-wedge100s-32x
include $(BUILDER)/standardinit.mk
DEPENDMODULES := AIM IOF x86_64_accton_wedge100s_32x onlplib
DEPENDMODULE_HEADERS := sff
include $(BUILDER)/dependmodules.mk
SHAREDLIB := libonlp-x86-64-accton-wedge100s-32x.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

View File

@@ -0,0 +1,46 @@
############################################################
# <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_accton_wedge100s_32x onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS
include $(BUILDER)/dependmodules.mk
BINARY := onlpdump
$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS)
include $(BUILDER)/bin.mk
GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
GLOBAL_LINK_LIBS += -lpthread -lm
include $(BUILDER)/targets.mk

View File

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

View File

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

View File

@@ -0,0 +1,9 @@
###############################################################################
#
#
#
###############################################################################
include $(ONL)/make/config.mk
MODULE := x86_64_accton_wedge100s_32x
AUTOMODULE := x86_64_accton_wedge100s_32x
include $(BUILDER)/definemodule.mk

View File

@@ -0,0 +1,6 @@
###############################################################################
#
# x86_64_accton_wedge100s_32x README
#
###############################################################################

View File

@@ -0,0 +1,9 @@
###############################################################################
#
# x86_64_accton_wedge100s_32x Autogeneration
#
###############################################################################
x86_64_accton_wedge100s_32x_AUTO_DEFS := module/auto/x86_64_accton_wedge100s_32x.yml
x86_64_accton_wedge100s_32x_AUTO_DIRS := module/inc/x86_64_accton_wedge100s_32x module/src
include $(BUILDER)/auto.mk

View File

@@ -0,0 +1,47 @@
###############################################################################
#
# x86_64_accton_wedge100s_32x Autogeneration Definitions.
#
###############################################################################
cdefs: &cdefs
- X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_LOGGING:
doc: "Include or exclude logging."
default: 1
- X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_OPTIONS_DEFAULT:
doc: "Default enabled log options."
default: AIM_LOG_OPTIONS_DEFAULT
- X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_BITS_DEFAULT:
doc: "Default enabled log bits."
default: AIM_LOG_BITS_DEFAULT
- X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
doc: "Default enabled custom log bits."
default: 0
- X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB:
doc: "Default all porting macros to use the C standard libraries."
default: 1
- X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
doc: "Include standard library headers for stdlib porting macros."
default: X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB
- X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_UCLI:
doc: "Include generic uCli support."
default: 0
definitions:
cdefs:
X86_64_ACCTON_WEDGE100S_32X_CONFIG_HEADER:
defs: *cdefs
basename: x86_64_accton_wedge100s_32x_config
portingmacro:
X86_64_ACCTON_WEDGE100S_32X:
macros:
- malloc
- free
- memset
- memcpy
- strncpy
- vsnprintf
- snprintf
- strlen

View File

@@ -0,0 +1,14 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_accton_wedge100s_32x/x86_64_accton_wedge100s_32x_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,127 @@
/**************************************************************************//**
*
* @file
* @brief x86_64_accton_wedge100s_32x Configuration Header
*
* @addtogroup x86_64_accton_wedge100s_32x-config
* @{
*
*****************************************************************************/
#ifndef __X86_64_ACCTON_WEDGE100S_32X_CONFIG_H__
#define __X86_64_ACCTON_WEDGE100S_32X_CONFIG_H__
#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG
#include <global_custom_config.h>
#endif
#ifdef X86_64_ACCTON_WEDGE100S_32X_INCLUDE_CUSTOM_CONFIG
#include <x86_64_accton_wedge100s_32x_custom_config.h>
#endif
/* <auto.start.cdefs(X86_64_ACCTON_WEDGE100S_32X_CONFIG_HEADER).header> */
#include <AIM/aim.h>
/**
* X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_LOGGING
*
* Include or exclude logging. */
#ifndef X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_LOGGING
#define X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_LOGGING 1
#endif
/**
* X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_OPTIONS_DEFAULT
*
* Default enabled log options. */
#ifndef X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_OPTIONS_DEFAULT
#define X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT
#endif
/**
* X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_BITS_DEFAULT
*
* Default enabled log bits. */
#ifndef X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_BITS_DEFAULT
#define X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT
#endif
/**
* X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT
*
* Default enabled custom log bits. */
#ifndef X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT
#define X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0
#endif
/**
* X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB
*
* Default all porting macros to use the C standard libraries. */
#ifndef X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB
#define X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB 1
#endif
/**
* X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
*
* Include standard library headers for stdlib porting macros. */
#ifndef X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
#define X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB
#endif
/**
* X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_UCLI
*
* Include generic uCli support. */
#ifndef X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_UCLI
#define X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_UCLI 0
#endif
/**
* All compile time options can be queried or displayed
*/
/** Configuration settings structure. */
typedef struct x86_64_accton_wedge100s_32x_config_settings_s {
/** name */
const char* name;
/** value */
const char* value;
} x86_64_accton_wedge100s_32x_config_settings_t;
/** Configuration settings table. */
/** x86_64_accton_wedge100s_32x_config_settings table. */
extern x86_64_accton_wedge100s_32x_config_settings_t x86_64_accton_wedge100s_32x_config_settings[];
/**
* @brief Lookup a configuration setting.
* @param setting The name of the configuration option to lookup.
*/
const char* x86_64_accton_wedge100s_32x_config_lookup(const char* setting);
/**
* @brief Show the compile-time configuration.
* @param pvs The output stream.
*/
int x86_64_accton_wedge100s_32x_config_show(struct aim_pvs_s* pvs);
/* <auto.end.cdefs(X86_64_ACCTON_WEDGE100S_32X_CONFIG_HEADER).header> */
#include "x86_64_accton_wedge100s_32x_porting.h"
#endif /* __X86_64_ACCTON_WEDGE100S_32X_CONFIG_H__ */
/* @} */

View File

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

View File

@@ -0,0 +1,107 @@
/**************************************************************************//**
*
* @file
* @brief x86_64_accton_wedge100s_32x Porting Macros.
*
* @addtogroup x86_64_accton_wedge100s_32x-porting
* @{
*
*****************************************************************************/
#ifndef __X86_64_ACCTON_WEDGE100S_32X_PORTING_H__
#define __X86_64_ACCTON_WEDGE100S_32X_PORTING_H__
/* <auto.start.portingmacro(ALL).define> */
#if X86_64_ACCTON_WEDGE100S_32X_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_ACCTON_WEDGE100S_32X_MALLOC
#if defined(GLOBAL_MALLOC)
#define X86_64_ACCTON_WEDGE100S_32X_MALLOC GLOBAL_MALLOC
#elif X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB == 1
#define X86_64_ACCTON_WEDGE100S_32X_MALLOC malloc
#else
#error The macro X86_64_ACCTON_WEDGE100S_32X_MALLOC is required but cannot be defined.
#endif
#endif
#ifndef X86_64_ACCTON_WEDGE100S_32X_FREE
#if defined(GLOBAL_FREE)
#define X86_64_ACCTON_WEDGE100S_32X_FREE GLOBAL_FREE
#elif X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB == 1
#define X86_64_ACCTON_WEDGE100S_32X_FREE free
#else
#error The macro X86_64_ACCTON_WEDGE100S_32X_FREE is required but cannot be defined.
#endif
#endif
#ifndef X86_64_ACCTON_WEDGE100S_32X_MEMSET
#if defined(GLOBAL_MEMSET)
#define X86_64_ACCTON_WEDGE100S_32X_MEMSET GLOBAL_MEMSET
#elif X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB == 1
#define X86_64_ACCTON_WEDGE100S_32X_MEMSET memset
#else
#error The macro X86_64_ACCTON_WEDGE100S_32X_MEMSET is required but cannot be defined.
#endif
#endif
#ifndef X86_64_ACCTON_WEDGE100S_32X_MEMCPY
#if defined(GLOBAL_MEMCPY)
#define X86_64_ACCTON_WEDGE100S_32X_MEMCPY GLOBAL_MEMCPY
#elif X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB == 1
#define X86_64_ACCTON_WEDGE100S_32X_MEMCPY memcpy
#else
#error The macro X86_64_ACCTON_WEDGE100S_32X_MEMCPY is required but cannot be defined.
#endif
#endif
#ifndef X86_64_ACCTON_WEDGE100S_32X_STRNCPY
#if defined(GLOBAL_STRNCPY)
#define X86_64_ACCTON_WEDGE100S_32X_STRNCPY GLOBAL_STRNCPY
#elif X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB == 1
#define X86_64_ACCTON_WEDGE100S_32X_STRNCPY strncpy
#else
#error The macro X86_64_ACCTON_WEDGE100S_32X_STRNCPY is required but cannot be defined.
#endif
#endif
#ifndef X86_64_ACCTON_WEDGE100S_32X_VSNPRINTF
#if defined(GLOBAL_VSNPRINTF)
#define X86_64_ACCTON_WEDGE100S_32X_VSNPRINTF GLOBAL_VSNPRINTF
#elif X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB == 1
#define X86_64_ACCTON_WEDGE100S_32X_VSNPRINTF vsnprintf
#else
#error The macro X86_64_ACCTON_WEDGE100S_32X_VSNPRINTF is required but cannot be defined.
#endif
#endif
#ifndef X86_64_ACCTON_WEDGE100S_32X_SNPRINTF
#if defined(GLOBAL_SNPRINTF)
#define X86_64_ACCTON_WEDGE100S_32X_SNPRINTF GLOBAL_SNPRINTF
#elif X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB == 1
#define X86_64_ACCTON_WEDGE100S_32X_SNPRINTF snprintf
#else
#error The macro X86_64_ACCTON_WEDGE100S_32X_SNPRINTF is required but cannot be defined.
#endif
#endif
#ifndef X86_64_ACCTON_WEDGE100S_32X_STRLEN
#if defined(GLOBAL_STRLEN)
#define X86_64_ACCTON_WEDGE100S_32X_STRLEN GLOBAL_STRLEN
#elif X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB == 1
#define X86_64_ACCTON_WEDGE100S_32X_STRLEN strlen
#else
#error The macro X86_64_ACCTON_WEDGE100S_32X_STRLEN is required but cannot be defined.
#endif
#endif
/* <auto.end.portingmacro(ALL).define> */
#endif /* __X86_64_ACCTON_WEDGE100S_32X_PORTING_H__ */
/* @} */

View File

@@ -0,0 +1,10 @@
###############################################################################
#
#
#
###############################################################################
THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
x86_64_accton_wedge100s_32x_INCLUDES := -I $(THIS_DIR)inc
x86_64_accton_wedge100s_32x_INTERNAL_INCLUDES := -I $(THIS_DIR)src
x86_64_accton_wedge100s_32x_DEPENDMODULE_ENTRIES := init:x86_64_accton_wedge100s_32x ucli:x86_64_accton_wedge100s_32x

View File

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

View File

@@ -0,0 +1,222 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 2014 Big Switch Networks, Inc.
* Copyright 2014 Accton Technology Corporation.
*
* Licensed under the Eclipse Public License, Version 1.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*
* </bsn.cl>
************************************************************
*
* Fan Platform Implementation Defaults.
*
***********************************************************/
#include <onlplib/file.h>
#include <onlp/platformi/fani.h>
#include "platform_lib.h"
#define VALIDATE(_id) \
do { \
if(!ONLP_OID_IS_FAN(_id)) { \
return ONLP_STATUS_E_INVALID; \
} \
} while(0)
#define MAX_FAN_SPEED 15400
#define BIT(i) (1 << (i))
enum fan_id {
FAN_1_ON_FAN_BOARD = 1,
FAN_2_ON_FAN_BOARD,
FAN_3_ON_FAN_BOARD,
FAN_4_ON_FAN_BOARD,
FAN_5_ON_FAN_BOARD,
};
#define FAN_BOARD_PATH "/sys/bus/i2c/devices/8-0033/"
#define CHASSIS_FAN_INFO(fid) \
{ \
{ ONLP_FAN_ID_CREATE(FAN_##fid##_ON_FAN_BOARD), "Chassis Fan - "#fid, 0 },\
0x0,\
ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE,\
0,\
0,\
ONLP_FAN_MODE_INVALID,\
}
/* Static fan information */
onlp_fan_info_t finfo[] = {
{ }, /* Not used */
CHASSIS_FAN_INFO(1),
CHASSIS_FAN_INFO(2),
CHASSIS_FAN_INFO(3),
CHASSIS_FAN_INFO(4),
CHASSIS_FAN_INFO(5)
};
/*
* 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 value = 0, fid;
char path[64] = {0};
VALIDATE(id);
fid = ONLP_OID_ID_GET(id);
*info = finfo[fid];
/* get fan present status
*/
sprintf(path, "%s""fantray_present", FAN_BOARD_PATH);
if (bmc_file_read_int(&value, path, 16) < 0) {
AIM_LOG_ERROR("Unable to read status from file (%s)\r\n", path);
return ONLP_STATUS_E_INTERNAL;
}
if (value & BIT(fid-1)) {
return ONLP_STATUS_OK;
}
info->status |= ONLP_FAN_STATUS_PRESENT;
/* get front fan rpm
*/
sprintf(path, "%s""fan%d_input", FAN_BOARD_PATH, fid*2 - 1);
if (bmc_file_read_int(&value, path, 10) < 0) {
AIM_LOG_ERROR("Unable to read status from file (%s)\r\n", path);
return ONLP_STATUS_E_INTERNAL;
}
info->rpm = value;
/* get rear fan rpm
*/
sprintf(path, "%s""fan%d_input", FAN_BOARD_PATH, fid*2);
if (bmc_file_read_int(&value, path, 10) < 0) {
AIM_LOG_ERROR("Unable to read status from file (%s)\r\n", path);
return ONLP_STATUS_E_INTERNAL;
}
/* take the min value from front/rear fan speed
*/
if (info->rpm > value) {
info->rpm = value;
}
/* set fan status based on rpm
*/
if (!info->rpm) {
info->status |= ONLP_FAN_STATUS_FAILED;
return ONLP_STATUS_OK;
}
/* get speed percentage from rpm
*/
info->percentage = (info->rpm * 100)/MAX_FAN_SPEED;
/* set fan direction
*/
info->status |= ONLP_FAN_STATUS_F2B;
return ONLP_STATUS_OK;
}
/*
* 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)
{
char cmd[32] = {0};
sprintf(cmd, "set_fan_speed.sh %d", p);
if (bmc_send_command(cmd) < 0) {
AIM_LOG_ERROR("Unable to send command to bmc(%s)\r\n", cmd);
return ONLP_STATUS_E_INTERNAL;
}
return ONLP_STATUS_OK;
}
/*
* This function sets the fan speed of the given OID as per
* the predefined ONLP fan speed modes: off, slow, normal, fast, max.
*
* Interpretation of these modes is up to the platform.
*
*/
int
onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode)
{
return ONLP_STATUS_E_UNSUPPORTED;
}
/*
* This function sets the fan direction of the given OID.
*
* This function is only relevant if the fan OID supports both direction
* capabilities.
*
* This function is optional unless the functionality is available.
*/
int
onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir)
{
return ONLP_STATUS_E_UNSUPPORTED;
}
/*
* Generic fan ioctl. Optional.
*/
int
onlp_fani_ioctl(onlp_oid_t id, va_list vargs)
{
return ONLP_STATUS_E_UNSUPPORTED;
}

View File

@@ -0,0 +1,219 @@
/************************************************************
* <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 <onlplib/i2c.h>
#include <onlplib/file.h>
#include <onlp/platformi/ledi.h>
#include "platform_lib.h"
#define VALIDATE(_id) \
do { \
if(!ONLP_OID_IS_LED(_id)) { \
return ONLP_STATUS_E_INVALID; \
} \
} while(0)
/* LED related data
*/
enum onlp_led_id
{
LED_RESERVED = 0,
LED_SYS1,
LED_SYS2
};
typedef struct led_address_s {
enum onlp_led_id id;
uint8_t bus;
uint8_t devaddr;
uint8_t offset;
} led_address_t;
typedef struct led_mode_info_s {
onlp_led_mode_t mode;
uint8_t regval;
} led_mode_info_t;
static led_address_t led_addr[] =
{
{ }, /* Not used */
{LED_SYS1, 1, 0x32, 0x3e},
{LED_SYS2, 1, 0x32, 0x3f},
};
static led_mode_info_t led_mode_info[] =
{
{ONLP_LED_MODE_OFF, 0x0},
{ONLP_LED_MODE_OFF, 0x8},
{ONLP_LED_MODE_RED, 0x1},
{ONLP_LED_MODE_RED_BLINKING, 0x9},
{ONLP_LED_MODE_GREEN, 0x2},
{ONLP_LED_MODE_GREEN_BLINKING, 0xa},
{ONLP_LED_MODE_BLUE, 0x4},
{ONLP_LED_MODE_BLUE_BLINKING, 0xc},
};
/*
* Get the information for the given LED OID.
*/
static onlp_led_info_t linfo[] =
{
{ }, /* Not used */
{
{ ONLP_LED_ID_CREATE(LED_SYS1), "Chassis LED 1 (SYS LED 1)", 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_BLUE | ONLP_LED_CAPS_BLUE_BLINKING,
},
{
{ ONLP_LED_ID_CREATE(LED_SYS2), "Chassis LED 1 (SYS LED 2)", 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_BLUE | ONLP_LED_CAPS_BLUE_BLINKING,
},
};
/*
* This function will be called prior to any other onlp_ledi_* functions.
*/
int
onlp_ledi_init(void)
{
return ONLP_STATUS_OK;
}
static int
reg_value_to_onlp_led_mode(enum onlp_led_id id, int value)
{
int i;
for (i = 0; i < AIM_ARRAYSIZE(led_mode_info); i++) {
if (value != led_mode_info[i].regval) {
continue;
}
return led_mode_info[i].mode;
}
return ONLP_LED_MODE_AUTO;
}
static int
onlp_led_mode_to_reg_value(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode)
{
int i;
for (i = 0; i < AIM_ARRAYSIZE(led_mode_info); i++) {
if (onlp_led_mode != led_mode_info[i].mode) {
continue;
}
return led_mode_info[i].regval;
}
return 0;
}
int
onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
{
int lid, value;
VALIDATE(id);
lid = ONLP_OID_ID_GET(id);
/* Set the onlp_oid_hdr_t and capabilities */
*info = linfo[ONLP_OID_ID_GET(id)];
value = onlp_i2c_readb(led_addr[lid].bus, led_addr[lid].devaddr, led_addr[lid].offset, ONLP_I2C_F_FORCE);
if (value < 0) {
return ONLP_STATUS_E_INTERNAL;
}
info->mode = reg_value_to_onlp_led_mode(lid, value);
/* Set the on/off status */
if (info->mode != ONLP_LED_MODE_OFF) {
info->status |= ONLP_LED_STATUS_ON;
}
return ONLP_STATUS_OK;
}
/*
* Turn an LED on or off.
*
* This function will only be called if the LED OID supports the ONOFF
* capability.
*
* What 'on' means in terms of colors or modes for multimode LEDs is
* up to the platform to decide. This is intended as baseline toggle mechanism.
*/
int
onlp_ledi_set(onlp_oid_t id, int on_or_off)
{
VALIDATE(id);
if (!on_or_off) {
return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF);
}
return ONLP_STATUS_E_UNSUPPORTED;
}
/*
* This function puts the LED into the given mode. It is a more functional
* interface for multimode LEDs.
*
* Only modes reported in the LED's capabilities will be attempted.
*/
int
onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
{
int lid, value;
VALIDATE(id);
lid = ONLP_OID_ID_GET(id);
value = onlp_led_mode_to_reg_value(lid, mode);
if (onlp_i2c_writeb(led_addr[lid].bus, led_addr[lid].devaddr, led_addr[lid].offset, value, ONLP_I2C_F_FORCE) < 0) {
return ONLP_STATUS_E_INTERNAL;
}
return ONLP_STATUS_OK;
}
/*
* Generic LED ioctl interface.
*/
int
onlp_ledi_ioctl(onlp_oid_t id, va_list vargs)
{
return ONLP_STATUS_E_UNSUPPORTED;
}

View File

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

View File

@@ -0,0 +1,250 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 2017 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 <termios.h>
#include <unistd.h>
#include <fcntl.h>
#include <onlplib/file.h>
#include <onlp/onlp.h>
#include "platform_lib.h"
#define TTY_DEVICE "/dev/ttyACM0"
#define TTY_PROMPT "@bmc:"
#define TTY_I2C_TIMEOUT 60000
#define TTY_BMC_LOGIN_TIMEOUT 1000000
#define TTY_RETRY 10
#define MAXIMUM_TTY_BUFFER_LENGTH 1024
#define MAXIMUM_TTY_STRING_LENGTH (MAXIMUM_TTY_BUFFER_LENGTH - 1)
static int tty_fd = -1;
static char tty_buf[MAXIMUM_TTY_BUFFER_LENGTH] = {0};
static int tty_open(void)
{
int i = 20;
struct termios attr;
if (tty_fd > -1) {
return 0;
}
do {
if ((tty_fd = open(TTY_DEVICE, O_RDWR | O_NOCTTY | O_NDELAY)) > -1) {
tcgetattr(tty_fd, &attr);
attr.c_cflag = B57600 | CS8 | CLOCAL | CREAD;
attr.c_iflag = IGNPAR;
attr.c_oflag = 0;
attr.c_lflag = 0;
attr.c_cc[VMIN] = (unsigned char)
((MAXIMUM_TTY_STRING_LENGTH > 0xFF) ? 0xFF : MAXIMUM_TTY_STRING_LENGTH);
attr.c_cc[VTIME] = 0;
cfsetospeed(&attr, B57600);
cfsetispeed(&attr, B57600);
tcsetattr(tty_fd, TCSANOW, &attr);
return 0;
}
i--;
usleep(100000);
} while (i > 0);
return -1;
}
static int tty_close(void)
{
close(tty_fd);
tty_fd = -1;
return 0;
}
static int tty_exec_buf(unsigned long udelay, const char *str)
{
if (tty_fd < 0)
return -1;
write(tty_fd, tty_buf, strlen(tty_buf)+1);
usleep(udelay);
read(tty_fd, tty_buf, MAXIMUM_TTY_BUFFER_LENGTH);
return (strstr(tty_buf, str) != NULL) ? 0 : -1;
}
static int tty_login(void)
{
int i = 10;
for (i = 1; i <= TTY_RETRY; i++) {
snprintf(tty_buf, MAXIMUM_TTY_BUFFER_LENGTH, "\r\r");
if (!tty_exec_buf(0, TTY_PROMPT)) {
return 0;
}
if (strstr(tty_buf, "bmc login:") != NULL)
{
snprintf(tty_buf, MAXIMUM_TTY_BUFFER_LENGTH, "root\r");
if (!tty_exec_buf(TTY_BMC_LOGIN_TIMEOUT, "Password:")) {
snprintf(tty_buf, MAXIMUM_TTY_BUFFER_LENGTH, "0penBmc\r");
if (!tty_exec_buf(TTY_BMC_LOGIN_TIMEOUT, TTY_PROMPT)) {
return 0;
}
}
}
usleep(50000);
}
return -1;
}
int bmc_send_command(char *cmd)
{
int i, ret = 0;
for (i = 1; i <= TTY_RETRY; i++) {
if (tty_open() != 0) {
printf("ERROR: Cannot open TTY device\n");
continue;
}
if (tty_login() != 0) {
//printf("ERROR: Cannot login TTY device\n");
tty_close();
continue;
}
snprintf(tty_buf, MAXIMUM_TTY_BUFFER_LENGTH, "%s", cmd);
ret = tty_exec_buf(TTY_I2C_TIMEOUT * i, TTY_PROMPT);
tty_close();
if (ret != 0) {
printf("ERROR: bmc_send_command timed out\n");
continue;
}
return 0;
}
AIM_LOG_ERROR("Unable to send command to bmc(%s)\r\n", cmd);
return -1;
}
int
bmc_command_read_int(int* value, char *cmd, int base)
{
int len;
int i;
char *prev_str = NULL;
char *current_str= NULL;
if (bmc_send_command(cmd) < 0) {
return ONLP_STATUS_E_INTERNAL;
}
len = (int)strlen(cmd);
prev_str = strstr(tty_buf, cmd);
if (prev_str == NULL) {
return -1;
}
for (i = 1; i <= TTY_RETRY; i++) {
current_str = strstr(prev_str + len, cmd);
if(current_str == NULL) {
*value = strtoul(prev_str + len, NULL, base);
break;
}else {
prev_str = current_str;
continue;
}
}
return 0;
}
int
bmc_file_read_int(int* value, char *file, int base)
{
char cmd[64] = {0};
snprintf(cmd, sizeof(cmd), "cat %s\r\n", file);
return bmc_command_read_int(value, cmd, base);
}
int
bmc_i2c_readb(uint8_t bus, uint8_t devaddr, uint8_t addr)
{
int ret = 0, value;
char cmd[64] = {0};
snprintf(cmd, sizeof(cmd), "i2cget -f -y %d 0x%x 0x%02x\r\n", bus, devaddr, addr);
ret = bmc_command_read_int(&value, cmd, 16);
return (ret < 0) ? ret : value;
}
int
bmc_i2c_writeb(uint8_t bus, uint8_t devaddr, uint8_t addr, uint8_t value)
{
char cmd[64] = {0};
snprintf(cmd, sizeof(cmd), "i2cset -f -y %d 0x%x 0x%02x 0x%x\r\n", bus, devaddr, addr, value);
return bmc_send_command(cmd);
}
int
bmc_i2c_readw(uint8_t bus, uint8_t devaddr, uint8_t addr)
{
int ret = 0, value;
char cmd[64] = {0};
snprintf(cmd, sizeof(cmd), "i2cget -f -y %d 0x%x 0x%02x w\r\n", bus, devaddr, addr);
ret = bmc_command_read_int(&value, cmd, 16);
return (ret < 0) ? ret : value;
}
int
bmc_i2c_readraw(uint8_t bus, uint8_t devaddr, uint8_t addr, char* data, int data_size)
{
int data_len, i = 0;
char cmd[64] = {0};
char *str = NULL;
snprintf(cmd, sizeof(cmd), "i2craw -w 0x%x -r 0 %d 0x%02x\r\n", addr, bus, devaddr);
if (bmc_send_command(cmd) < 0) {
AIM_LOG_ERROR("Unable to send command to bmc(%s)\r\n", cmd);
return ONLP_STATUS_E_INTERNAL;
}
str = strstr(tty_buf, "Received:\r\n ");
if (str == NULL) {
return -1;
}
/* first byte is data length */
str += strlen("Received:\r\n ");;
data_len = strtoul(str, NULL, 16);
if (data_size < data_len) {
data_len = data_size;
}
for (i = 0; (i < data_len) && (str != NULL); i++) {
str = strstr(str, " ") + 1; /* Jump to next token */
data[i] = strtoul(str, NULL, 16);
}
data[i] = 0;
return 0;
}

View File

@@ -0,0 +1,69 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 2014 Big Switch Networks, Inc.
* Copyright 2014 Accton Technology Corporation.
*
* Licensed under the Eclipse Public License, Version 1.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*
* </bsn.cl>
************************************************************
*
*
*
***********************************************************/
#ifndef __PLATFORM_LIB_H__
#define __PLATFORM_LIB_H__
#include "x86_64_accton_wedge100s_32x_log.h"
#define DEBUG_MODE 0
#if (DEBUG_MODE == 1)
#define DEBUG_PRINT(fmt, args...) \
printf("%s:%s[%d]: " fmt "\r\n", __FILE__, __FUNCTION__, __LINE__, ##args)
#else
#define DEBUG_PRINT(fmt, args...)
#endif
#define CHASSIS_FAN_COUNT 5
#define CHASSIS_THERMAL_COUNT 8
#define CHASSIS_LED_COUNT 2
#define CHASSIS_PSU_COUNT 2
#define IDPROM_PATH "/sys/class/i2c-adapter/i2c-40/40-0050/eeprom"
enum onlp_thermal_id
{
THERMAL_RESERVED = 0,
THERMAL_CPU_CORE,
THERMAL_1_ON_MAIN_BROAD,
THERMAL_2_ON_MAIN_BROAD,
THERMAL_3_ON_MAIN_BROAD,
THERMAL_4_ON_MAIN_BROAD,
THERMAL_5_ON_MAIN_BROAD,
THERMAL_6_ON_MAIN_BROAD,
THERMAL_7_ON_MAIN_BROAD,
};
int bmc_send_command(char *cmd);
int bmc_file_read_int(int* value, char *file, int base);
int bmc_i2c_readb(uint8_t bus, uint8_t devaddr, uint8_t addr);
int bmc_i2c_writeb(uint8_t bus, uint8_t devaddr, uint8_t addr, uint8_t value);
int bmc_i2c_readw(uint8_t bus, uint8_t devaddr, uint8_t addr);
int bmc_i2c_readraw(uint8_t bus, uint8_t devaddr, uint8_t addr, char* data, int data_size);
#endif /* __PLATFORM_LIB_H__ */

View File

@@ -0,0 +1,174 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 2014 Big Switch Networks, Inc.
* Copyright 2014 Accton Technology Corporation.
*
* Licensed under the Eclipse Public License, Version 1.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*
* </bsn.cl>
************************************************************
*
*
*
***********************************************************/
#include <onlplib/i2c.h>
#include <onlplib/file.h>
#include <onlp/platformi/psui.h>
#include "platform_lib.h"
#define VALIDATE(_id) \
do { \
if(!ONLP_OID_IS_PSU(_id)) { \
return ONLP_STATUS_E_INVALID; \
} \
} while(0)
#define PSU1_ID 1
#define PSU2_ID 2
/*
* Get all information about the given PSU oid.
*/
static onlp_psu_info_t pinfo[] =
{
{ }, /* Not used */
{
{ ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0 },
},
{
{ ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0 },
}
};
int
onlp_psui_init(void)
{
return ONLP_STATUS_OK;
}
static int
twos_complement_to_int(uint16_t data, uint8_t valid_bit, int mask)
{
uint16_t valid_data = data & mask;
bool is_negative = valid_data >> (valid_bit - 1);
return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data;
}
static int
pmbus_parse_literal_format(uint16_t value)
{
int exponent, mantissa, multiplier = 1000;
exponent = twos_complement_to_int(value >> 11, 5, 0x1f);
mantissa = twos_complement_to_int(value & 0x7ff, 11, 0x7ff);
return (exponent >= 0) ? (mantissa << exponent) * multiplier :
(mantissa * multiplier) / (1 << -exponent);
}
int
onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
{
int pid, value, addr;
uint8_t mask = 0;
VALIDATE(id);
pid = ONLP_OID_ID_GET(id);
*info = pinfo[pid]; /* Set the onlp_oid_hdr_t */
/* Get the present status
*/
mask = 1 << ((pid-1) * 4);
value = onlp_i2c_readb(1, 0x32, 0x10, ONLP_I2C_F_FORCE);
if (value < 0) {
return ONLP_STATUS_E_INTERNAL;
}
if (value & mask) {
info->status &= ~ONLP_PSU_STATUS_PRESENT;
return ONLP_STATUS_OK;
}
info->status |= ONLP_PSU_STATUS_PRESENT;
info->caps = ONLP_PSU_CAPS_AC;
/* Get power good status
*/
mask = 1 << ((pid-1) * 4 + 1);
if (!(value & mask)) {
info->status |= ONLP_PSU_STATUS_FAILED;
return ONLP_STATUS_OK;
}
/* Get input output power status
*/
value = (pid == PSU1_ID) ? 0x2 : 0x1; /* mux channel for psu */
if (bmc_i2c_writeb(7, 0x70, 0, value) < 0) {
return ONLP_STATUS_E_INTERNAL;
}
/* Read vin */
addr = (pid == PSU1_ID) ? 0x59 : 0x5a;
value = bmc_i2c_readw(7, addr, 0x88);
if (value >= 0) {
info->mvin = pmbus_parse_literal_format(value);
info->caps |= ONLP_PSU_CAPS_VIN;
}
/* Read iin */
value = bmc_i2c_readw(7, addr, 0x89);
if (value >= 0) {
info->miin = pmbus_parse_literal_format(value);
info->caps |= ONLP_PSU_CAPS_IIN;
}
/* Get pin */
if ((info->caps & ONLP_PSU_CAPS_VIN) && (info->caps & ONLP_PSU_CAPS_IIN)) {
info->mpin = info->mvin * info->miin / 1000;
info->caps |= ONLP_PSU_CAPS_PIN;
}
/* Read iout */
value = bmc_i2c_readw(7, addr, 0x8c);
if (value >= 0) {
info->miout = pmbus_parse_literal_format(value);
info->caps |= ONLP_PSU_CAPS_IOUT;
}
/* Read pout */
value = bmc_i2c_readw(7, addr, 0x96);
if (value >= 0) {
info->mpout = pmbus_parse_literal_format(value);
info->caps |= ONLP_PSU_CAPS_POUT;
}
/* Get vout */
if ((info->caps & ONLP_PSU_CAPS_IOUT) && (info->caps & ONLP_PSU_CAPS_POUT) && info->miout != 0) {
info->mvout = info->mpout / info->miout * 1000;
info->caps |= ONLP_PSU_CAPS_VOUT;
}
/* Get model name */
return bmc_i2c_readraw(7, addr, 0x9a, info->model, sizeof(info->model));
}
int
onlp_psui_ioctl(onlp_oid_t pid, va_list vargs)
{
return ONLP_STATUS_E_UNSUPPORTED;
}

View File

@@ -0,0 +1,196 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 2014 Big Switch Networks, Inc.
* Copyright 2016 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 <onlplib/i2c.h>
#include <onlp/platformi/sfpi.h>
#include <onlplib/file.h>
#include "platform_lib.h"
#include "x86_64_accton_wedge100s_32x_log.h"
#define BIT(i) (1 << (i))
#define NUM_OF_SFP_PORT 32
static const int sfp_bus_index[] = {
3, 2, 5, 4, 7, 6, 9, 8,
11, 10, 13, 12, 15, 14, 17, 16,
19, 18, 21, 20, 23, 22, 25, 24,
27, 26, 29, 28, 31, 30, 33, 32
};
/************************************************************
*
* SFPI Entry Points
*
***********************************************************/
int
onlp_sfpi_init(void)
{
/* Called at initialization time */
return ONLP_STATUS_OK;
}
int
onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap)
{
/*
* Ports {0, 32}
*/
int p;
AIM_BITMAP_CLR_ALL(bmap);
for(p = 0; p < NUM_OF_SFP_PORT; p++) {
AIM_BITMAP_SET(bmap, p);
}
return ONLP_STATUS_OK;
}
static uint8_t
onlp_sfpi_reg_val_to_port_sequence(uint8_t value, int revert)
{
int i;
uint8_t ret = 0;
for (i = 0; i < 8; i++) {
if (i % 2) {
ret |= (value & BIT(i)) >> 1;
}
else {
ret |= (value & BIT(i)) << 1;
}
}
return revert ? ~ret : ret;
}
int
onlp_sfpi_is_present(int port)
{
/*
* Return 1 if present.
* Return 0 if not present.
* Return < 0 if error.
*/
int present;
int bus = (port < 16) ? 36 : 37;
int addr = (port < 16) ? 0x22 : 0x23; /* pca9535 slave address */
int offset;
if (port < 8 || (port >= 16 && port <= 23)) {
offset = 0;
}
else {
offset = 1;
}
present = onlp_i2c_readb(bus, addr, offset, ONLP_I2C_F_FORCE);
if (present < 0) {
return ONLP_STATUS_E_INTERNAL;
}
present = onlp_sfpi_reg_val_to_port_sequence(present, 0);
return !(present & BIT(port % 8));
}
int
onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)
{
int i;
uint8_t bytes[4] = {0};
for (i = 0; i < AIM_ARRAYSIZE(bytes); i++) {
int bus = (i < 2) ? 36 : 37;
int addr = (i < 2) ? 0x22 : 0x23; /* pca9535 slave address */
int offset = (i % 2);
bytes[i] = onlp_i2c_readb(bus, addr, offset, ONLP_I2C_F_FORCE);
if (bytes[i] < 0) {
return ONLP_STATUS_E_INTERNAL;
}
bytes[i] = onlp_sfpi_reg_val_to_port_sequence(bytes[i], 1);
}
/* Convert to 32 bit integer in port order */
i = 0;
uint32_t presence_all = 0 ;
for(i = AIM_ARRAYSIZE(bytes)-1; i >= 0; i--) {
presence_all <<= 8;
presence_all |= bytes[i];
}
/* Populate bitmap */
for(i = 0; presence_all; i++) {
AIM_BITMAP_MOD(dst, i, (presence_all & 1));
presence_all >>= 1;
}
return ONLP_STATUS_OK;
}
int
onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst)
{
return ONLP_STATUS_OK;
}
static int
sfpi_eeprom_read(int port, uint8_t devaddr, uint8_t data[256])
{
memset(data, 0, 256);
int bus = sfp_bus_index[port];
return onlp_i2c_read(bus, devaddr, 0, 256, data, ONLP_I2C_F_FORCE);
return ONLP_STATUS_OK;
}
int
onlp_sfpi_eeprom_read(int port, uint8_t data[256])
{
return sfpi_eeprom_read(port, 0x50, data);
}
int
onlp_sfpi_dom_read(int port, uint8_t data[256])
{
return sfpi_eeprom_read(port, 0x51, data);
}
int
onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value)
{
return ONLP_STATUS_E_UNSUPPORTED;
}
int
onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value)
{
return ONLP_STATUS_E_UNSUPPORTED;
}
int
onlp_sfpi_denit(void)
{
return ONLP_STATUS_OK;
}

View File

@@ -0,0 +1,113 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 2014 Big Switch Networks, Inc.
* Copyright 2014 Accton Technology Corporation.
*
* Licensed under the Eclipse Public License, Version 1.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*
* </bsn.cl>
************************************************************
*
*
*
***********************************************************/
#include <unistd.h>
#include <fcntl.h>
#include <onlplib/file.h>
#include <onlp/platformi/sysi.h>
#include <onlp/platformi/ledi.h>
#include <onlp/platformi/thermali.h>
#include <onlp/platformi/fani.h>
#include <onlp/platformi/psui.h>
#include "platform_lib.h"
#include "x86_64_accton_wedge100s_32x_int.h"
#include "x86_64_accton_wedge100s_32x_log.h"
const char*
onlp_sysi_platform_get(void)
{
return "x86-64-accton-wedge100s-32x-r0";
}
int
onlp_sysi_onie_data_get(uint8_t** data, int* size)
{
uint8_t* rdata = aim_zmalloc(256);
if(onlp_file_read(rdata, 256, size, IDPROM_PATH) == ONLP_STATUS_OK) {
if(*size == 256) {
*data = rdata;
return ONLP_STATUS_OK;
}
}
aim_free(rdata);
*size = 0;
return ONLP_STATUS_E_INTERNAL;
}
int
onlp_sysi_oids_get(onlp_oid_t* table, int max)
{
int i;
onlp_oid_t* e = table;
memset(table, 0, max*sizeof(onlp_oid_t));
/* 8 Thermal sensors on the chassis */
for (i = 1; i <= CHASSIS_THERMAL_COUNT; i++) {
*e++ = ONLP_THERMAL_ID_CREATE(i);
}
/* 2 LEDs on the chassis */
for (i = 1; i <= CHASSIS_LED_COUNT; i++) {
*e++ = ONLP_LED_ID_CREATE(i);
}
/* 2 PSUs on the chassis */
for (i = 1; i <= CHASSIS_PSU_COUNT; i++) {
*e++ = ONLP_PSU_ID_CREATE(i);
}
/* 5 Fans on the chassis */
for (i = 1; i <= CHASSIS_FAN_COUNT; i++) {
*e++ = ONLP_FAN_ID_CREATE(i);
}
return 0;
}
int
onlp_sysi_platform_info_get(onlp_platform_info_t* pi)
{
return ONLP_STATUS_OK;
}
void
onlp_sysi_platform_info_free(onlp_platform_info_t* pi)
{
}
int
onlp_sysi_platform_manage_fans(void)
{
return ONLP_STATUS_OK;
}
int
onlp_sysi_platform_manage_leds(void)
{
return ONLP_STATUS_E_UNSUPPORTED;
}

View File

@@ -0,0 +1,140 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 2014 Big Switch Networks, Inc.
* Copyright 2014 Accton Technology Corporation.
*
* Licensed under the Eclipse Public License, Version 1.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*
* </bsn.cl>
************************************************************
*
* Thermal Sensor Platform Implementation.
*
***********************************************************/
#include <onlplib/file.h>
#include <onlp/platformi/thermali.h>
#include "platform_lib.h"
#define VALIDATE(_id) \
do { \
if(!ONLP_OID_IS_THERMAL(_id)) { \
return ONLP_STATUS_E_INVALID; \
} \
} while(0)
#define THERMAL_PATH_FORMAT "/sys/bus/i2c/drivers/lm75/%s/temp1_input"
static char* directory[] = /* must map with onlp_thermal_id */
{
NULL,
NULL, /* CPU_CORE files */
"3-0048",
"3-0049",
"3-004a",
"3-004b",
"3-004c",
"8-0048",
"8-0049",
};
static char* cpu_coretemp_files[] =
{
"/sys/devices/platform/coretemp.0*temp1_input",
"/sys/devices/platform/coretemp.0*temp2_input",
"/sys/devices/platform/coretemp.0*temp3_input",
NULL,
};
/* Static values */
static onlp_thermal_info_t linfo[] = {
{ }, /* Not used */
{ { ONLP_THERMAL_ID_CREATE(THERMAL_CPU_CORE), "CPU Core", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_MAIN_BROAD), "TMP75-1", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_MAIN_BROAD), "TMP75-2", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_3_ON_MAIN_BROAD), "TMP75-3", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_4_ON_MAIN_BROAD), "TMP75-4", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_5_ON_MAIN_BROAD), "TMP75-5", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_6_ON_MAIN_BROAD), "TMP75-6", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
},
{ { ONLP_THERMAL_ID_CREATE(THERMAL_7_ON_MAIN_BROAD), "TMP75-7", 0},
ONLP_THERMAL_STATUS_PRESENT,
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
},
};
/*
* 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;
char path[64] = {0};
VALIDATE(id);
tid = ONLP_OID_ID_GET(id);
/* Set the onlp_oid_hdr_t and capabilities */
*info = linfo[tid];
if (THERMAL_CPU_CORE == tid) {
return onlp_file_read_int_max(&info->mcelsius, cpu_coretemp_files);
}
/* get path */
sprintf(path, THERMAL_PATH_FORMAT, directory[tid]);
if (bmc_file_read_int(&info->mcelsius, path, 10) < 0) {
AIM_LOG_ERROR("Unable to read status from file (%s)\r\n", path);
return ONLP_STATUS_E_INTERNAL;
}
return ONLP_STATUS_OK;
}

View File

@@ -0,0 +1,76 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_accton_wedge100s_32x/x86_64_accton_wedge100s_32x_config.h>
/* <auto.start.cdefs(X86_64_ACCTON_WEDGE100S_32X_CONFIG_HEADER).source> */
#define __x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME(_x) #_x
#define __x86_64_accton_wedge100s_32x_config_STRINGIFY_VALUE(_x) __x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME(_x)
x86_64_accton_wedge100s_32x_config_settings_t x86_64_accton_wedge100s_32x_config_settings[] =
{
#ifdef X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_LOGGING
{ __x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME(X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_LOGGING), __x86_64_accton_wedge100s_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_LOGGING) },
#else
{ X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_LOGGING(__x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_OPTIONS_DEFAULT
{ __x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME(X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_OPTIONS_DEFAULT), __x86_64_accton_wedge100s_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_OPTIONS_DEFAULT) },
#else
{ X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_OPTIONS_DEFAULT(__x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_BITS_DEFAULT
{ __x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME(X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_BITS_DEFAULT), __x86_64_accton_wedge100s_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_BITS_DEFAULT) },
#else
{ X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_BITS_DEFAULT(__x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT
{ __x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME(X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __x86_64_accton_wedge100s_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT) },
#else
{ X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB
{ __x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME(X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB), __x86_64_accton_wedge100s_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB) },
#else
{ X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB(__x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
{ __x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME(X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __x86_64_accton_wedge100s_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) },
#else
{ X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_UCLI
{ __x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME(X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_UCLI), __x86_64_accton_wedge100s_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_UCLI) },
#else
{ X86_64_ACCTON_WEDGE100S_32X_CONFIG_INCLUDE_UCLI(__x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME), "__undefined__" },
#endif
{ NULL, NULL }
};
#undef __x86_64_accton_wedge100s_32x_config_STRINGIFY_VALUE
#undef __x86_64_accton_wedge100s_32x_config_STRINGIFY_NAME
const char*
x86_64_accton_wedge100s_32x_config_lookup(const char* setting)
{
int i;
for(i = 0; x86_64_accton_wedge100s_32x_config_settings[i].name; i++) {
if(!strcmp(x86_64_accton_wedge100s_32x_config_settings[i].name, setting)) {
return x86_64_accton_wedge100s_32x_config_settings[i].value;
}
}
return NULL;
}
int
x86_64_accton_wedge100s_32x_config_show(struct aim_pvs_s* pvs)
{
int i;
for(i = 0; x86_64_accton_wedge100s_32x_config_settings[i].name; i++) {
aim_printf(pvs, "%s = %s\n", x86_64_accton_wedge100s_32x_config_settings[i].name, x86_64_accton_wedge100s_32x_config_settings[i].value);
}
return i;
}
/* <auto.end.cdefs(X86_64_ACCTON_WEDGE100S_32X_CONFIG_HEADER).source> */

View File

@@ -0,0 +1,10 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_accton_wedge100s_32x/x86_64_accton_wedge100s_32x_config.h>
/* <--auto.start.enum(ALL).source> */
/* <auto.end.enum(ALL).source> */

View File

@@ -0,0 +1,12 @@
/**************************************************************************//**
*
* x86_64_accton_wedge100s_32x Internal Header
*
*****************************************************************************/
#ifndef __X86_64_ACCTON_WEDGE100S_32X_INT_H__
#define __X86_64_ACCTON_WEDGE100S_32X_INT_H__
#include <x86_64_accton_wedge100s_32x/x86_64_accton_wedge100s_32x_config.h>
#endif /* __X86_64_ACCTON_WEDGE100S_32X_INT_H__ */

View File

@@ -0,0 +1,18 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_accton_wedge100s_32x/x86_64_accton_wedge100s_32x_config.h>
#include "x86_64_accton_wedge100s_32x_log.h"
/*
* x86_64_accton_wedge100s_32x log struct.
*/
AIM_LOG_STRUCT_DEFINE(
X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_OPTIONS_DEFAULT,
X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_BITS_DEFAULT,
NULL, /* Custom log map */
X86_64_ACCTON_WEDGE100S_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT
);

View File

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

View File

@@ -0,0 +1,24 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_accton_wedge100s_32x/x86_64_accton_wedge100s_32x_config.h>
#include "x86_64_accton_wedge100s_32x_log.h"
static int
datatypes_init__(void)
{
#define X86_64_ACCTON_WEDGE100S_32X_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
#include <x86_64_accton_wedge100s_32x/x86_64_accton_wedge100s_32x.x>
return 0;
}
void __x86_64_accton_wedge100s_32x_module_init__(void)
{
AIM_LOG_STRUCT_REGISTER();
datatypes_init__();
}
int __onlp_platform_version__ = 1;

View File

@@ -0,0 +1,50 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_accton_wedge100s_32x/x86_64_accton_wedge100s_32x_config.h>
#if X86_64_ACCTON_WEDGE100S_32X_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_accton_wedge100s_32x_ucli_ucli__config__(ucli_context_t* uc)
{
UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_accton_wedge100s_32x)
}
/* <auto.ucli.handlers.start> */
/* <auto.ucli.handlers.end> */
static ucli_module_t
x86_64_accton_wedge100s_32x_ucli_module__ =
{
"x86_64_accton_wedge100s_32x_ucli",
NULL,
x86_64_accton_wedge100s_32x_ucli_ucli_handlers__,
NULL,
NULL,
};
ucli_node_t*
x86_64_accton_wedge100s_32x_ucli_node_create(void)
{
ucli_node_t* n;
ucli_module_init(&x86_64_accton_wedge100s_32x_ucli_module__);
n = ucli_node_create("x86_64_accton_wedge100s_32x", NULL, &x86_64_accton_wedge100s_32x_ucli_module__);
ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_accton_wedge100s_32x"));
return n;
}
#else
void*
x86_64_accton_wedge100s_32x_ucli_node_create(void)
{
return NULL;
}
#endif

View File

@@ -0,0 +1,8 @@
###############################################################################
#
# x86_64_accton_wedge100s_32x Unit Test Makefile.
#
###############################################################################
UMODULE := x86_64_accton_wedge100s_32x
UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(BUILDER)/utest.mk

View File

@@ -0,0 +1,19 @@
/**************************************************************************//**
*
*
*
*****************************************************************************/
#include <x86_64_accton_wedge100s_32x/x86_64_accton_wedge100s_32x_config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <AIM/aim.h>
int aim_main(int argc, char* argv[])
{
printf("x86_64_accton_wedge100s_32x Utest Is Empty\n");
x86_64_accton_wedge100s_32x_config_show(&aim_pvs_stdout);
return 0;
}

View File

@@ -1,11 +1,5 @@
---
######################################################################
#
# platform-config for WEDGE
#
######################################################################
x86-64-accton-wedge100s-32x-r0:
grub:
@@ -17,8 +11,8 @@ x86-64-accton-wedge100s-32x-r0:
--parity=0
--stop=1
kernel:
<<: *kernel-4-9
kernel:
<<: *kernel-3-16
args: >-
nopat
@@ -26,9 +20,4 @@ x86-64-accton-wedge100s-32x-r0:
rd_NO_MD
rd_NO_LUKS
intel_iommu=off
##network
## interfaces:
## ma1:
## name: ~
## syspath: pci0000:00/0000:00:14.0
noapic

View File

@@ -2,7 +2,20 @@ from onl.platform.base import *
from onl.platform.accton import *
class OnlPlatform_x86_64_accton_wedge100s_32x_r0(OnlPlatformAccton,
OnlPlatformPortConfig_32x100):
MODEL="Wedge-100s-32x"
OnlPlatformPortConfig_32x100):
MODEL="Wedge-100s-32X"
PLATFORM="x86-64-accton-wedge100s-32x-r0"
SYS_OBJECT_ID=".100.2"
SYS_OBJECT_ID=".100.2.32.1"
def baseconfig(self):
self.new_i2c_devices([
('pca9548', 0x70, 1),
('pca9548', 0x71, 1),
('pca9548', 0x72, 1),
('pca9548', 0x73, 1),
('pca9548', 0x74, 1),
('24c64', 0x50, 40),
])
return True