mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-25 17:27:01 +00:00
Add new Delta platform: AG9032V2.
Add ipmitool to jessie builds. Add support for AG9032V2 on kernel 4.9-lts config. Signed-off-by: Stanley Chi <stanley.chi@deltaww.com>
This commit is contained in:
@@ -393,10 +393,13 @@ CONFIG_ZONE_DMA=y
|
||||
CONFIG_SMP=y
|
||||
CONFIG_X86_FEATURE_NAMES=y
|
||||
CONFIG_X86_FAST_FEATURE_TESTS=y
|
||||
CONFIG_X86_X2APIC=y
|
||||
CONFIG_X86_MPPARSE=y
|
||||
# CONFIG_GOLDFISH is not set
|
||||
CONFIG_X86_EXTENDED_PLATFORM=y
|
||||
# CONFIG_X86_NUMACHIP is not set
|
||||
# CONFIG_X86_VSMP is not set
|
||||
# CONFIG_X86_UV is not set
|
||||
# CONFIG_X86_GOLDFISH is not set
|
||||
# CONFIG_X86_INTEL_MID is not set
|
||||
# CONFIG_X86_INTEL_LPSS is not set
|
||||
@@ -404,7 +407,8 @@ CONFIG_X86_EXTENDED_PLATFORM=y
|
||||
# CONFIG_IOSF_MBI is not set
|
||||
CONFIG_X86_SUPPORTS_MEMORY_FAILURE=y
|
||||
CONFIG_SCHED_OMIT_FRAME_POINTER=y
|
||||
# CONFIG_HYPERVISOR_GUEST is not set
|
||||
CONFIG_HYPERVISOR_GUEST=y
|
||||
# CONFIG_PARAVIRT is not set
|
||||
CONFIG_NO_BOOTMEM=y
|
||||
# CONFIG_MK8 is not set
|
||||
# CONFIG_MPSC is not set
|
||||
@@ -600,6 +604,7 @@ CONFIG_ACPI_CPU_FREQ_PSS=y
|
||||
CONFIG_ACPI_PROCESSOR_CSTATE=y
|
||||
CONFIG_ACPI_PROCESSOR_IDLE=y
|
||||
CONFIG_ACPI_PROCESSOR=y
|
||||
# CONFIG_ACPI_IPMI is not set
|
||||
CONFIG_ACPI_HOTPLUG_CPU=y
|
||||
# CONFIG_ACPI_PROCESSOR_AGGREGATOR is not set
|
||||
CONFIG_ACPI_THERMAL=y
|
||||
@@ -1874,6 +1879,7 @@ CONFIG_MOUSE_PS2_TRACKPOINT=y
|
||||
# CONFIG_MOUSE_PS2_SENTELIC is not set
|
||||
# CONFIG_MOUSE_PS2_TOUCHKIT is not set
|
||||
CONFIG_MOUSE_PS2_FOCALTECH=y
|
||||
# CONFIG_MOUSE_PS2_VMMOUSE is not set
|
||||
# CONFIG_MOUSE_SERIAL is not set
|
||||
# CONFIG_MOUSE_APPLETOUCH is not set
|
||||
# CONFIG_MOUSE_BCM5974 is not set
|
||||
@@ -2072,7 +2078,14 @@ CONFIG_SERIAL_CORE_CONSOLE=y
|
||||
# CONFIG_SERIAL_FSL_LPUART is not set
|
||||
CONFIG_HVC_DRIVER=y
|
||||
CONFIG_VIRTIO_CONSOLE=y
|
||||
# CONFIG_IPMI_HANDLER is not set
|
||||
CONFIG_IPMI_HANDLER=y
|
||||
CONFIG_IPMI_PANIC_EVENT=y
|
||||
CONFIG_IPMI_PANIC_STRING=y
|
||||
CONFIG_IPMI_DEVICE_INTERFACE=y
|
||||
CONFIG_IPMI_SI=y
|
||||
CONFIG_IPMI_SSIF=y
|
||||
# CONFIG_IPMI_WATCHDOG is not set
|
||||
CONFIG_IPMI_POWEROFF=y
|
||||
CONFIG_HW_RANDOM=y
|
||||
# CONFIG_HW_RANDOM_TIMERIOMEM is not set
|
||||
# CONFIG_HW_RANDOM_INTEL is not set
|
||||
@@ -2133,8 +2146,8 @@ CONFIG_I2C_ALGOBIT=y
|
||||
# CONFIG_I2C_AMD756 is not set
|
||||
# CONFIG_I2C_AMD8111 is not set
|
||||
CONFIG_I2C_I801=y
|
||||
# CONFIG_I2C_ISCH is not set
|
||||
# CONFIG_I2C_ISMT is not set
|
||||
CONFIG_I2C_ISCH=y
|
||||
CONFIG_I2C_ISMT=y
|
||||
# CONFIG_I2C_PIIX4 is not set
|
||||
# CONFIG_I2C_NFORCE2 is not set
|
||||
# CONFIG_I2C_SIS5595 is not set
|
||||
@@ -2296,6 +2309,8 @@ CONFIG_HWMON=y
|
||||
# CONFIG_SENSORS_G760A is not set
|
||||
# CONFIG_SENSORS_G762 is not set
|
||||
# CONFIG_SENSORS_HIH6130 is not set
|
||||
# CONFIG_SENSORS_IBMAEM is not set
|
||||
# CONFIG_SENSORS_IBMPEX is not set
|
||||
CONFIG_SENSORS_IIO_HWMON=y
|
||||
# CONFIG_SENSORS_I5500 is not set
|
||||
CONFIG_SENSORS_CORETEMP=y
|
||||
@@ -2512,7 +2527,7 @@ CONFIG_BCMA_POSSIBLE=y
|
||||
#
|
||||
# Multifunction device drivers
|
||||
#
|
||||
# CONFIG_MFD_CORE is not set
|
||||
CONFIG_MFD_CORE=y
|
||||
# CONFIG_MFD_AS3711 is not set
|
||||
# CONFIG_PMIC_ADP5520 is not set
|
||||
# CONFIG_MFD_BCM590XX is not set
|
||||
@@ -2531,7 +2546,7 @@ CONFIG_BCMA_POSSIBLE=y
|
||||
# CONFIG_MFD_MC13XXX_I2C is not set
|
||||
# CONFIG_HTC_PASIC3 is not set
|
||||
# CONFIG_LPC_ICH is not set
|
||||
# CONFIG_LPC_SCH is not set
|
||||
CONFIG_LPC_SCH=y
|
||||
# CONFIG_MFD_INTEL_LPSS_ACPI is not set
|
||||
# CONFIG_MFD_INTEL_LPSS_PCI is not set
|
||||
# CONFIG_MFD_JANZ_CMODIO is not set
|
||||
@@ -3353,6 +3368,7 @@ CONFIG_VIRTIO_MMIO=y
|
||||
#
|
||||
# Microsoft Hyper-V guest support
|
||||
#
|
||||
# CONFIG_HYPERV is not set
|
||||
# CONFIG_STAGING is not set
|
||||
CONFIG_X86_PLATFORM_DEVICES=y
|
||||
# CONFIG_ACERHDF is not set
|
||||
|
||||
3
packages/platforms/delta/x86-64/x86-64-delta-ag9032v2/.gitignore
vendored
Normal file
3
packages/platforms/delta/x86-64/x86-64-delta-ag9032v2/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*x86*64*delta*ag9032v2.mk
|
||||
onlpdump.mk
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/no-platform-modules.yml ARCH=amd64 VENDOR=delta BASENAME=x86-64-delta-ag9032v2
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=x86-64-delta-ag9032v2 ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu
|
||||
@@ -0,0 +1,2 @@
|
||||
FILTER=src
|
||||
include $(ONL)/make/subdirs.mk
|
||||
@@ -0,0 +1,45 @@
|
||||
############################################################
|
||||
# <bsn.cl fy=2014 v=onl>
|
||||
#
|
||||
# Copyright 2014 BigSwitch Networks, Inc.
|
||||
#
|
||||
# Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
# either express or implied. See the License for the specific
|
||||
# language governing permissions and limitations under the
|
||||
# License.
|
||||
#
|
||||
# </bsn.cl>
|
||||
############################################################
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
include $(ONL)/make/config.amd64.mk
|
||||
|
||||
MODULE := libonlp-x86-64-delta-ag9032v2
|
||||
include $(BUILDER)/standardinit.mk
|
||||
|
||||
DEPENDMODULES := AIM IOF x86_64_delta_ag9032v2 onlplib
|
||||
DEPENDMODULE_HEADERS := sff
|
||||
|
||||
include $(BUILDER)/dependmodules.mk
|
||||
|
||||
SHAREDLIB := libonlp-x86-64-delta-ag9032v2.so
|
||||
$(SHAREDLIB)_TARGETS := $(ALL_TARGETS)
|
||||
include $(BUILDER)/so.mk
|
||||
.DEFAULT_GOAL := $(SHAREDLIB)
|
||||
|
||||
GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc
|
||||
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
|
||||
GLOBAL_CFLAGS += -fPIC
|
||||
GLOBAL_LINK_LIBS += -lpthread
|
||||
|
||||
include $(BUILDER)/targets.mk
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Inclusive Makefile for the libonlp-x86-64-delta-ag9032v2-r0 module.
|
||||
#
|
||||
# Autogenerated 2016-03-16 22:11:47.698846
|
||||
#
|
||||
###############################################################################
|
||||
libonlp-x86-64-delta-ag9032v2-r0_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
@@ -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_delta_ag9032v2 onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS
|
||||
|
||||
include $(BUILDER)/dependmodules.mk
|
||||
|
||||
BINARY := onlpdump
|
||||
$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS)
|
||||
include $(BUILDER)/bin.mk
|
||||
|
||||
GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main
|
||||
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
|
||||
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
|
||||
GLOBAL_LINK_LIBS += -lpthread -lm
|
||||
|
||||
include $(BUILDER)/targets.mk
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
name: x86_64_delta_ag9032v2
|
||||
@@ -0,0 +1,10 @@
|
||||
############################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
include $(ONL)/make/config.mk
|
||||
|
||||
MODULE := x86_64_delta_ag9032v2
|
||||
AUTOMODULE := x86_64_delta_ag9032v2
|
||||
include $(BUILDER)/definemodule.mk
|
||||
@@ -0,0 +1,10 @@
|
||||
###############################################################################
|
||||
#
|
||||
# x86_64_delta_ag9032v2 Autogeneration
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
x86_64_delta_ag9032v2_AUTO_DEFS := module/auto/x86_64_delta_ag9032v2.yml
|
||||
x86_64_delta_ag9032v2_AUTO_DIRS := module/inc/x86_64_delta_ag9032v2 module/src
|
||||
include $(BUILDER)/auto.mk
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
###############################################################################
|
||||
#
|
||||
# x86_64_delta_ag9032v2 Autogeneration Definitions.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
cdefs: &cdefs
|
||||
- X86_64_DELTA_ag9032v2_CONFIG_INCLUDE_LOGGING:
|
||||
doc: "Include or exclude logging."
|
||||
default: 1
|
||||
- X86_64_DELTA_ag9032v2_CONFIG_LOG_OPTIONS_DEFAULT:
|
||||
doc: "Default enabled log options."
|
||||
default: AIM_LOG_OPTIONS_DEFAULT
|
||||
- X86_64_DELTA_ag9032v2_CONFIG_LOG_BITS_DEFAULT:
|
||||
doc: "Default enabled log bits."
|
||||
default: AIM_LOG_BITS_DEFAULT
|
||||
- X86_64_DELTA_ag9032v2_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
|
||||
doc: "Default enabled custom log bits."
|
||||
default: 0
|
||||
- X86_64_DELTA_ag9032v2_CONFIG_PORTING_STDLIB:
|
||||
doc: "Default all porting macros to use the C standard libraries."
|
||||
default: 1
|
||||
- X86_64_DELTA_ag9032v2_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
|
||||
doc: "Include standard library headers for stdlib porting macros."
|
||||
default: X86_64_DELTA_ag9032v2_CONFIG_PORTING_STDLIB
|
||||
- X86_64_DELTA_ag9032v2_CONFIG_INCLUDE_UCLI:
|
||||
doc: "Include generic uCli support."
|
||||
default: 0
|
||||
- X86_64_DELTA_ag9032v2_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION:
|
||||
doc: "Assume chassis fan direction is the same as the PSU fan direction."
|
||||
default: 0
|
||||
- X86_64_DELTA_ag9032v2_CONFIG_SFP_COUNT:
|
||||
doc: "SFP port numbers."
|
||||
default: 4
|
||||
- X86_64_DELTA_ag9032v2_CONFIG_FAN_RPM_MAX:
|
||||
doc: "Max fan speed."
|
||||
default: 18000
|
||||
|
||||
definitions:
|
||||
cdefs:
|
||||
X86_64_DELTA_ag9032v2_CONFIG_HEADER:
|
||||
defs: *cdefs
|
||||
basename: x86_64_delta_ag9032v2_config
|
||||
|
||||
portingmacro:
|
||||
X86_64_DELTA_ag9032v2:
|
||||
macros:
|
||||
- malloc
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
@@ -0,0 +1,16 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <x86_64_delta_ag9032v2/x86_64_delta_ag9032v2_config.h>
|
||||
|
||||
/* <--auto.start.xmacro(ALL).define> */
|
||||
/* <auto.end.xmacro(ALL).define> */
|
||||
|
||||
/* <--auto.start.xenum(ALL).define> */
|
||||
/* <auto.end.xenum(ALL).define> */
|
||||
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* @file
|
||||
* @brief x86_64_delta_ag9032v2 Configuration Header
|
||||
*
|
||||
* @addtogroup x86_64_delta_ag9032v2-config
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_DELTA_AG9032V2_CONFIG_H__
|
||||
#define __X86_64_DELTA_AG9032V2_CONFIG_H__
|
||||
|
||||
#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG
|
||||
#include <global_custom_config.h>
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_AG9032V2_INCLUDE_CUSTOM_CONFIG
|
||||
#include <x86_64_delta_ag9032v2_custom_config.h>
|
||||
#endif
|
||||
|
||||
/* <auto.start.cdefs(x86_64_delta_ag9032v2_CONFIG_HEADER).header> */
|
||||
#include <AIM/aim.h>
|
||||
/**
|
||||
* X86_64_DELTA_ag9032v2_CONFIG_INCLUDE_LOGGING
|
||||
*
|
||||
* Include or exclude logging. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_LOGGING
|
||||
#define X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_LOGGING 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_ag9032v2_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
*
|
||||
* Default enabled log options. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_AG9032V2_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
#define X86_64_DELTA_AG9032V2_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_ag9032v2_CONFIG_LOG_BITS_DEFAULT
|
||||
*
|
||||
* Default enabled log bits. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_AG9032V2_CONFIG_LOG_BITS_DEFAULT
|
||||
#define X86_64_DELTA_AG9032V2_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_ag9032v2_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
*
|
||||
* Default enabled custom log bits. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_AG9032V2_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
#define X86_64_DELTA_AG9032V2_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_ag9032v2_CONFIG_PORTING_STDLIB
|
||||
*
|
||||
* Default all porting macros to use the C standard libraries. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB
|
||||
#define X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_ag9032v2_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
*
|
||||
* Include standard library headers for stdlib porting macros. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_AG9032V2_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
#define X86_64_DELTA_AG9032V2_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_ag9032v2_CONFIG_INCLUDE_UCLI
|
||||
*
|
||||
* Include generic uCli support. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_UCLI
|
||||
#define X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_UCLI 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_ag9032v2_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
|
||||
*
|
||||
* Assume chassis fan direction is the same as the PSU fan direction. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
|
||||
#define X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_ag9032v2_CONFIG_SFP_COUNT
|
||||
*
|
||||
* SFP port numbers. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_AG9032V2_CONFIG_SFP_COUNT
|
||||
#define X86_64_DELTA_AG9032V2_CONFIG_SFP_COUNT 4
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_ag9032v2_CONFIG_FAN_RPM_MAX
|
||||
*
|
||||
* Max fan speed. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_AG9032V2_CONFIG_FAN_RPM_MAX
|
||||
#define X86_64_DELTA_AG9032V2_CONFIG_FAN_RPM_MAX 18000
|
||||
#endif
|
||||
|
||||
/**
|
||||
* All compile time options can be queried or displayed
|
||||
*/
|
||||
|
||||
/** Configuration settings structure. */
|
||||
typedef struct x86_64_delta_ag9032v2_config_settings_s {
|
||||
/** name */
|
||||
const char* name;
|
||||
/** value */
|
||||
const char* value;
|
||||
} x86_64_delta_ag9032v2_config_settings_t;
|
||||
|
||||
/** Configuration settings table. */
|
||||
/** x86_64_delta_ag9032v2_config_settings table. */
|
||||
extern x86_64_delta_ag9032v2_config_settings_t x86_64_delta_ag9032v2_config_settings[];
|
||||
|
||||
/**
|
||||
* @brief Lookup a configuration setting.
|
||||
* @param setting The name of the configuration option to lookup.
|
||||
*/
|
||||
const char* x86_64_delta_ag9032v2_config_lookup(const char* setting);
|
||||
|
||||
/**
|
||||
* @brief Show the compile-time configuration.
|
||||
* @param pvs The output stream.
|
||||
*/
|
||||
int x86_64_delta_ag9032v2_config_show(struct aim_pvs_s* pvs);
|
||||
|
||||
/* <auto.end.cdefs(x86_64_delta_ag9032v2_CONFIG_HEADER).header> */
|
||||
|
||||
#include "x86_64_delta_ag9032v2_porting.h"
|
||||
|
||||
#endif /* __x86_64_delta_ag9032v2_CONFIG_H__ */
|
||||
/* @} */
|
||||
@@ -0,0 +1,26 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* x86_64_delta_ag9032v2 Doxygen Header
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_DELTA_ag9032v2_DOX_H__
|
||||
#define _X86_64_DELTA_ag9032v2_DOX_H__
|
||||
|
||||
/**
|
||||
* @defgroup x86_64_delta_ag9032v2 x86_64_delta_ag9032v2 - x86_64_delta_ag9032v2 Description
|
||||
*
|
||||
|
||||
The documentation overview for this module should go here.
|
||||
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @defgroup x86_64_delta_ag9032v2-x86_64_delta_ag9032v2 Public Interface
|
||||
* @defgroup x86_64_delta_ag9032v2-config Compile Time Configuration
|
||||
* @defgroup x86_64_delta_ag9032v2-porting Porting Macros
|
||||
*
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#endif /* __X86_64_DELTA_ag9032v2_DOX_H__ */
|
||||
@@ -0,0 +1,107 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* @file
|
||||
* @brief x86_64_delta_ag9032v2 Porting Macros.
|
||||
*
|
||||
* @addtogroup x86_64_delta_ag9032v2-porting
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_DELTA_AG9032V2_PORTING_H__
|
||||
#define __X86_64_DELTA_AG9032V2_PORTING_H__
|
||||
|
||||
|
||||
/* <auto.start.portingmacro(ALL).define> */
|
||||
#if X86_64_DELTA_AG9032V2_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_delta_ag9032v2_MALLOC
|
||||
#if defined(GLOBAL_MALLOC)
|
||||
#define x86_64_delta_ag9032v2_MALLOC GLOBAL_MALLOC
|
||||
#elif X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB == 1
|
||||
#define x86_64_delta_ag9032v2_MALLOC malloc
|
||||
#else
|
||||
#error The macro x86_64_delta_ag9032v2_MALLOC is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef x86_64_delta_ag9032v2_FREE
|
||||
#if defined(GLOBAL_FREE)
|
||||
#define x86_64_delta_ag9032v2_FREE GLOBAL_FREE
|
||||
#elif X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB == 1
|
||||
#define x86_64_delta_ag9032v2_FREE free
|
||||
#else
|
||||
#error The macro x86_64_delta_ag9032v2_FREE is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef x86_64_delta_ag9032v2_MEMSET
|
||||
#if defined(GLOBAL_MEMSET)
|
||||
#define x86_64_delta_ag9032v2_MEMSET GLOBAL_MEMSET
|
||||
#elif X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB == 1
|
||||
#define x86_64_delta_ag9032v2_MEMSET memset
|
||||
#else
|
||||
#error The macro x86_64_delta_ag9032v2_MEMSET is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef x86_64_delta_ag9032v2_MEMCPY
|
||||
#if defined(GLOBAL_MEMCPY)
|
||||
#define x86_64_delta_ag9032v2_MEMCPY GLOBAL_MEMCPY
|
||||
#elif X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB == 1
|
||||
#define x86_64_delta_ag9032v2_MEMCPY memcpy
|
||||
#else
|
||||
#error The macro x86_64_delta_ag9032v2_MEMCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef x86_64_delta_ag9032v2_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define x86_64_delta_ag9032v2_STRNCPY GLOBAL_STRNCPY
|
||||
#elif X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB == 1
|
||||
#define x86_64_delta_ag9032v2_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro x86_64_delta_ag9032v2_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef x86_64_delta_ag9032v2_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define x86_64_delta_ag9032v2_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
#elif X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB == 1
|
||||
#define x86_64_delta_ag9032v2_VSNPRINTF vsnprintf
|
||||
#else
|
||||
#error The macro x86_64_delta_ag9032v2_VSNPRINTF is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef x86_64_delta_ag9032v2_SNPRINTF
|
||||
#if defined(GLOBAL_SNPRINTF)
|
||||
#define x86_64_delta_ag9032v2_SNPRINTF GLOBAL_SNPRINTF
|
||||
#elif X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB == 1
|
||||
#define x86_64_delta_ag9032v2_SNPRINTF snprintf
|
||||
#else
|
||||
#error The macro x86_64_delta_ag9032v2_SNPRINTF is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef x86_64_delta_ag9032v2_STRLEN
|
||||
#if defined(GLOBAL_STRLEN)
|
||||
#define x86_64_delta_ag9032v2_STRLEN GLOBAL_STRLEN
|
||||
#elif X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB == 1
|
||||
#define x86_64_delta_ag9032v2_STRLEN strlen
|
||||
#else
|
||||
#error The macro x86_64_delta_ag9032v2_STRLEN is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* <auto.end.portingmacro(ALL).define> */
|
||||
|
||||
|
||||
#endif /* _X86_64_DELTA_AG9032V2_PORTING_H__ */
|
||||
/* @} */
|
||||
@@ -0,0 +1,10 @@
|
||||
###############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
x86_64_delta_ag9032v2_INCLUDES := -I $(THIS_DIR)inc
|
||||
x86_64_delta_ag9032v2_INTERNAL_INCLUDES := -I $(THIS_DIR)src
|
||||
x86_64_delta_ag9032v2_DEPENDMODULE_ENTRIES := init:x86_64_delta_ag9032v2 ucli:x86_64_delta_ag9032v2
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
###############################################################################
|
||||
#
|
||||
# Local source generation targets.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
ucli:
|
||||
@../../../../tools/uclihandlers.py x86_64_delta_ag9032v2_ucli.c
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
* Copyright (C) 2017 Delta 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 "platform_lib.h"
|
||||
#include <onlplib/i2c.h>
|
||||
#include <onlp/platformi/fani.h>
|
||||
|
||||
#define MAKE_FAN_INFO_NODE_ON_FAN_BOARD(id) \
|
||||
{ \
|
||||
{ ONLP_FAN_ID_CREATE(FAN_##id##_ON_FAN_BOARD), "Chassis Fan "#id, 0 }, \
|
||||
0x0, \
|
||||
(ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE), \
|
||||
0, \
|
||||
0, \
|
||||
ONLP_FAN_MODE_INVALID, \
|
||||
}
|
||||
|
||||
#define MAKE_FAN_INFO_NODE_ON_PSU(psu_id, fan_id) \
|
||||
{ \
|
||||
{ ONLP_FAN_ID_CREATE(FAN_##fan_id##_ON_PSU##psu_id), "Chassis PSU-"#psu_id " Fan "#fan_id, 0 }, \
|
||||
0x0, \
|
||||
(ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE), \
|
||||
0, \
|
||||
0, \
|
||||
ONLP_FAN_MODE_INVALID, \
|
||||
}
|
||||
|
||||
/* Static fan information */
|
||||
onlp_fan_info_t linfo[] = {
|
||||
{ }, // Not used
|
||||
MAKE_FAN_INFO_NODE_ON_FAN_BOARD(1),
|
||||
MAKE_FAN_INFO_NODE_ON_FAN_BOARD(2),
|
||||
MAKE_FAN_INFO_NODE_ON_FAN_BOARD(3),
|
||||
MAKE_FAN_INFO_NODE_ON_FAN_BOARD(4),
|
||||
MAKE_FAN_INFO_NODE_ON_FAN_BOARD(5),
|
||||
MAKE_FAN_INFO_NODE_ON_PSU(1,1),
|
||||
MAKE_FAN_INFO_NODE_ON_PSU(2,1),
|
||||
};
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_FAN(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static int
|
||||
dni_fani_info_get_fan(int local_id, onlp_fan_info_t* info, char *dev_name)
|
||||
{
|
||||
int bit_data = 0;
|
||||
int rv = ONLP_STATUS_OK;
|
||||
uint8_t present_bit = 0x00;
|
||||
uint8_t bit = 0x00;
|
||||
UINT4 multiplier = 1;
|
||||
UINT4 u4Data = 0;
|
||||
|
||||
if(dni_get_bmc_data(dev_name, &u4Data, multiplier) == ONLP_STATUS_OK)
|
||||
{
|
||||
info->rpm = u4Data;
|
||||
info->percentage = (info->rpm * 100) / MAX_FAN_SPEED;
|
||||
}
|
||||
|
||||
rv = dni_fanpresent_info_get(&bit_data);
|
||||
|
||||
if(rv == ONLP_STATUS_OK && bit_data != 0)
|
||||
{
|
||||
present_bit = bit_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
|
||||
switch(local_id)
|
||||
{
|
||||
case FAN_1_ON_FAN_BOARD:
|
||||
if((present_bit & ((bit+1) << 4)) == 0)
|
||||
info->status |= ONLP_FAN_STATUS_PRESENT;
|
||||
else
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
break;
|
||||
case FAN_2_ON_FAN_BOARD:
|
||||
if((present_bit & ((bit+1) << 3)) == 0)
|
||||
info->status |= ONLP_FAN_STATUS_PRESENT;
|
||||
else
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
break;
|
||||
case FAN_3_ON_FAN_BOARD:
|
||||
if((present_bit & ((bit+1) << 2)) == 0)
|
||||
info->status |= ONLP_FAN_STATUS_PRESENT;
|
||||
else
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
break;
|
||||
case FAN_4_ON_FAN_BOARD:
|
||||
if((present_bit & ((bit+1) << 1)) == 0)
|
||||
info->status |= ONLP_FAN_STATUS_PRESENT;
|
||||
else
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
break;
|
||||
case FAN_5_ON_FAN_BOARD:
|
||||
if((present_bit & (bit+1)) == 0)
|
||||
info->status |= ONLP_FAN_STATUS_PRESENT;
|
||||
else
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
dni_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info, char *dev_name)
|
||||
{
|
||||
int rpm_data = 0;
|
||||
int rv = ONLP_STATUS_OK;
|
||||
int psu_present = 0;
|
||||
char module_name[20] = {0};
|
||||
UINT4 multiplier = 1;
|
||||
UINT4 u4Data = 0;
|
||||
|
||||
psu_present = dni_psui_eeprom_info_get(module_name, local_id - CHASSIS_FAN_COUNT, PSU_MODEL_REG);
|
||||
rv = dni_get_bmc_data(dev_name, &u4Data, multiplier);
|
||||
rpm_data = (int)u4Data;
|
||||
|
||||
if( psu_present == ONLP_STATUS_OK )
|
||||
{
|
||||
info->rpm = rpm_data;
|
||||
info->percentage = (info->rpm * 100) / MAX_FAN_SPEED;
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
switch(local_id)
|
||||
{
|
||||
case FAN_1_ON_PSU1:
|
||||
case FAN_1_ON_PSU2:
|
||||
if( psu_present == ONLP_STATUS_OK )
|
||||
info->status |= ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F;
|
||||
else
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
|
||||
}
|
||||
/*
|
||||
* 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 local_id;
|
||||
int rv = ONLP_STATUS_OK;
|
||||
|
||||
VALIDATE(id);
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
*info = linfo[ONLP_OID_ID_GET(id)];
|
||||
|
||||
switch(local_id)
|
||||
{
|
||||
case FAN_1_ON_FAN_BOARD:
|
||||
rv = dni_fani_info_get_fan(local_id, info, "Fantray_1");
|
||||
break;
|
||||
case FAN_2_ON_FAN_BOARD:
|
||||
rv = dni_fani_info_get_fan(local_id, info, "Fantray_2");
|
||||
break;
|
||||
case FAN_3_ON_FAN_BOARD:
|
||||
rv = dni_fani_info_get_fan(local_id, info, "Fantray_3");
|
||||
break;
|
||||
case FAN_4_ON_FAN_BOARD:
|
||||
rv = dni_fani_info_get_fan(local_id, info, "Fantray_4");
|
||||
break;
|
||||
case FAN_5_ON_FAN_BOARD:
|
||||
rv = dni_fani_info_get_fan(local_id, info, "Fantray_5");
|
||||
break;
|
||||
case FAN_1_ON_PSU1:
|
||||
rv = dni_fani_info_get_fan_on_psu(local_id, info, "PSU1_Fan");
|
||||
break;
|
||||
case FAN_1_ON_PSU2:
|
||||
rv = dni_fani_info_get_fan_on_psu(local_id, info, "PSU2_Fan");
|
||||
break;
|
||||
default:
|
||||
rv = ONLP_STATUS_E_INVALID;
|
||||
break;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function sets the fan speed of the given OID as a percentage.
|
||||
*
|
||||
* This will only be called if the OID has the PERCENTAGE_SET
|
||||
* capability.
|
||||
*
|
||||
* It is optional if you have no fans at all with this feature.
|
||||
*/
|
||||
int
|
||||
onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
{
|
||||
return ONLP_STATUS_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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
* Copyright (C) 2017 Delta 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 "platform_lib.h"
|
||||
#include <onlplib/i2c.h>
|
||||
#include <onlp/platformi/ledi.h>
|
||||
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_LED(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* Get the information for the given LED OID.
|
||||
*/
|
||||
|
||||
static onlp_led_info_t linfo[] =
|
||||
{
|
||||
{ }, // Not used
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FRONT_FAN), "FRONT LED (FAN LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FRONT_SYS), "FRONT LED (SYS 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_ID_CREATE(LED_FRONT_PWR1), "FRONT LED (PWR1 LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE_BLINKING,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FRONT_PWR2), "FRONT LED (PWR2 LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE_BLINKING,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_1), "FAN TRAY 1 LED", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_2), "FAN TRAY 2 LED", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_3), "FAN TRAY 3 LED", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_4), "FAN TRAY 4 LED", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_5), "FAN TRAY 5 LED", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_GREEN,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* This function will be called prior to any other onlp_ledi_* functions.
|
||||
*/
|
||||
int
|
||||
onlp_ledi_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
int local_id;
|
||||
int r_data = 0;
|
||||
int bit_data = 0;
|
||||
uint8_t present_bit = 0x00;
|
||||
uint8_t bit = 0x00;
|
||||
dev_info_t dev_info;
|
||||
|
||||
VALIDATE(id);
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
*info = linfo[ONLP_OID_ID_GET(id)];
|
||||
|
||||
dev_info.bus = I2C_BUS_1;
|
||||
dev_info.addr = SWPLD_1_ADDR;
|
||||
dev_info.offset = SYS_LED1_REGISTER;
|
||||
dev_info.flags = ONLP_I2C_F_FORCE;
|
||||
r_data = onlp_i2c_readb(dev_info.bus, dev_info.addr, dev_info.offset, dev_info.flags);
|
||||
|
||||
rv = dni_fanpresent_info_get(&bit_data);
|
||||
|
||||
if(rv == ONLP_STATUS_OK)
|
||||
{
|
||||
present_bit = bit_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
switch(local_id)
|
||||
{
|
||||
case LED_FRONT_FAN:
|
||||
if((r_data & 0x03) == 0x01)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0x03) == 0x02)
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
else if ((r_data & 0x03) == 0x03 || (r_data & 0x03) == 0x00)
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
else
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
break;
|
||||
|
||||
case LED_FRONT_SYS:
|
||||
if((r_data & 0x0c) == 0x04)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0x0c) == 0x08)
|
||||
info->mode = ONLP_LED_MODE_GREEN_BLINKING;
|
||||
else if((r_data & 0x0c) == 0x0c)
|
||||
info->mode = ONLP_LED_MODE_RED;
|
||||
else if ((r_data & 0x0c) == 0x00)
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
else
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
break;
|
||||
|
||||
case LED_FRONT_PWR1:
|
||||
if((r_data & 0xc0) == 0x40)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0xc0) == 0x80)
|
||||
info->mode = ONLP_LED_MODE_ORANGE_BLINKING;
|
||||
else if ((r_data & 0xc0) == 0xc0 || (r_data & 0xc0) == 0x00)
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
else
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
break;
|
||||
|
||||
case LED_FRONT_PWR2:
|
||||
if((r_data & 0x30) == 0x10)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0x30) == 0x20)
|
||||
info->mode = ONLP_LED_MODE_ORANGE_BLINKING;
|
||||
else if ((r_data & 0x30) == 0x30 || (r_data & 0x30) == 0x00)
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
else
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
break;
|
||||
|
||||
case LED_REAR_FAN_TRAY_1:
|
||||
dev_info.offset = SYS_FANLED1_REGISTER;
|
||||
r_data = onlp_i2c_readb(dev_info.bus, dev_info.addr, dev_info.offset, dev_info.flags);
|
||||
|
||||
if((present_bit & ((bit+1) << 4)) == 0)
|
||||
{
|
||||
if((r_data & 0xc0) == 0x40)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0xc0) == 0x80)
|
||||
info->mode = ONLP_LED_MODE_RED;
|
||||
}
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
break;
|
||||
|
||||
case LED_REAR_FAN_TRAY_2:
|
||||
dev_info.offset = SYS_FANLED2_REGISTER;
|
||||
r_data = onlp_i2c_readb(dev_info.bus, dev_info.addr, dev_info.offset, dev_info.flags);
|
||||
|
||||
if((present_bit & ((bit+1) << 3)) == 0)
|
||||
{
|
||||
if((r_data & 0x03) == 0x01)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0x03) == 0x02)
|
||||
info->mode = ONLP_LED_MODE_RED;
|
||||
}
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
break;
|
||||
|
||||
case LED_REAR_FAN_TRAY_3:
|
||||
dev_info.offset = SYS_FANLED2_REGISTER;
|
||||
r_data = onlp_i2c_readb(dev_info.bus, dev_info.addr, dev_info.offset, dev_info.flags);
|
||||
|
||||
if((present_bit & ((bit+1) << 2)) == 0)
|
||||
{
|
||||
if((r_data & 0x0c) == 0x04)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0x0c) == 0x08)
|
||||
info->mode = ONLP_LED_MODE_RED;
|
||||
}
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
break;
|
||||
|
||||
case LED_REAR_FAN_TRAY_4:
|
||||
dev_info.offset = SYS_FANLED2_REGISTER;
|
||||
r_data = onlp_i2c_readb(dev_info.bus, dev_info.addr, dev_info.offset, dev_info.flags);
|
||||
|
||||
if((present_bit & ((bit+1) << 1)) == 0)
|
||||
{
|
||||
if((r_data & 0x30) == 0x10)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0x30) == 0x20)
|
||||
info->mode = ONLP_LED_MODE_RED;
|
||||
}
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
break;
|
||||
|
||||
case LED_REAR_FAN_TRAY_5:
|
||||
dev_info.offset = SYS_FANLED2_REGISTER;
|
||||
r_data = onlp_i2c_readb(dev_info.bus, dev_info.addr, dev_info.offset, dev_info.flags);
|
||||
|
||||
if((present_bit & (bit+1)) == 0)
|
||||
{
|
||||
if((r_data & 0xc0) == 0x40)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0xc0) == 0x80)
|
||||
info->mode = ONLP_LED_MODE_RED;
|
||||
}
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set the on/off status */
|
||||
if (info->mode == ONLP_LED_MODE_OFF)
|
||||
info->status |= ONLP_LED_STATUS_FAILED;
|
||||
else
|
||||
info->status |=ONLP_LED_STATUS_PRESENT;
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic LED ioctl interface.
|
||||
*/
|
||||
int
|
||||
onlp_ledi_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
###############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
LIBRARY := x86_64_delta_ag9032v2
|
||||
$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
include $(BUILDER)/lib.mk
|
||||
@@ -0,0 +1,139 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
* Copyright (C) 2017 Delta 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 "platform_lib.h"
|
||||
#include <onlp/onlp.h>
|
||||
#include <time.h>
|
||||
|
||||
int dni_get_bmc_data(char *device_name, UINT4 *num, UINT4 multiplier)
|
||||
{
|
||||
FILE *fpRead;
|
||||
char Buf[ 10 ]={0};
|
||||
char ipmi_command[120] = {0};
|
||||
int lenth=10;
|
||||
float num_f;
|
||||
|
||||
sprintf(ipmi_command, "ipmitool sdr get %s |grep 'Sensor Reading'| awk -F':' '{print $2}'| awk -F' ' '{ print $1}'", device_name);
|
||||
fpRead = popen(ipmi_command, "r");
|
||||
|
||||
if(fpRead == NULL){
|
||||
pclose(fpRead);
|
||||
return ONLP_STATUS_E_GENERIC;
|
||||
}
|
||||
fgets(Buf, lenth , fpRead);
|
||||
num_f = atof( Buf );
|
||||
*num = num_f * multiplier;
|
||||
pclose(fpRead);
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
dni_fanpresent_info_get(int *r_data)
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
char cmd[30] = {0};
|
||||
char str_data[100] = {0};
|
||||
FILE *fptr = NULL;
|
||||
|
||||
sprintf(cmd, "ipmitool raw 0x38 0x0e");
|
||||
fptr = popen(cmd, "r");
|
||||
if(fptr != NULL)
|
||||
{
|
||||
if(fgets(str_data, sizeof(str_data), fptr) != NULL)
|
||||
{
|
||||
*r_data = strtol(str_data, NULL, 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
pclose(fptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
pclose(fptr);
|
||||
rv = ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int hex_to_int(char hex_input){
|
||||
int first = hex_input / 16 - 3;
|
||||
int second = hex_input % 16;
|
||||
int result = first*10 + second;
|
||||
if(result > 9) result--;
|
||||
return result;
|
||||
}
|
||||
|
||||
int hex_to_ascii(char hex_high, char hex_low){
|
||||
int high = hex_to_int(hex_high) * 16;
|
||||
int low = hex_to_int(hex_low);
|
||||
return high+low;
|
||||
}
|
||||
|
||||
int
|
||||
dni_psui_eeprom_info_get(char *r_data, int psu_id, int psu_reg)
|
||||
{
|
||||
int i = 0;
|
||||
int rv = ONLP_STATUS_OK;
|
||||
FILE *fptr = NULL;
|
||||
char buf;
|
||||
char cmd[35] = {0};
|
||||
char str_data[50] = {0};
|
||||
|
||||
sprintf(cmd, "ipmitool raw 0x38 0x12 %d %d", psu_id, psu_reg);
|
||||
fptr = popen(cmd, "r");
|
||||
|
||||
if(fptr != NULL)
|
||||
{
|
||||
while( (buf = fgetc(fptr)) != EOF) {
|
||||
if( buf != ' '){
|
||||
str_data[i] = buf;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if(i == 0){
|
||||
pclose(fptr);
|
||||
rv = ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
else{
|
||||
/* "str_data" :psu model name or serial number in hex code
|
||||
* str_data(hex) ex:0e 44 50 53 2d 38 30 30 41 42 2d 31 36 20 44
|
||||
*/
|
||||
for(i = 1; i < PSU_NUM_LENGTH; i++)
|
||||
{
|
||||
r_data[i] = hex_to_ascii(str_data[2*i], str_data[2*i+1]);
|
||||
}
|
||||
pclose(fptr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pclose(fptr);
|
||||
rv = ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
* Copyright (C) 2017 Delta 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_delta_ag9032v2_log.h"
|
||||
|
||||
typedef unsigned int UINT4;
|
||||
|
||||
/* CPLD numbrt & peripherals */
|
||||
#define NUM_OF_THERMAL_ON_MAIN_BROAD (6)
|
||||
#define NUM_OF_LED_ON_MAIN_BROAD (9)
|
||||
#define NUM_OF_FAN_ON_MAIN_BROAD (5)
|
||||
#define NUM_OF_PSU_ON_MAIN_BROAD (2)
|
||||
#define NUM_OF_SENSORS (47)
|
||||
#define CHASSIS_FAN_COUNT (5)
|
||||
#define CHASSIS_THERMAL_COUNT (6)
|
||||
#define I2C_BUS_1 (1)
|
||||
#define PSU1_ID (1)
|
||||
#define PSU2_ID (2)
|
||||
#define NUM_OF_SFP_PORT (2)
|
||||
#define NUM_OF_QSFP_PORT (32)
|
||||
#define NUM_OF_ALL_PORT (34)
|
||||
#define PSU_NUM_LENGTH (15)
|
||||
#define UPDATE_THRESHOLD (2) //second
|
||||
#define MAX_FAN_SPEED (23000)
|
||||
#define IDPROM_PATH "/sys/class/i2c-adapter/i2c-1/1-0053/eeprom"
|
||||
|
||||
/* REG define*/
|
||||
#define SWPLD_1_ADDR (0x6A)
|
||||
#define SWPLD_2_ADDR (0x73)
|
||||
#define SWPLD_3_ADDR (0x75)
|
||||
#define DEFAULT_FLAG (0x00)
|
||||
#define CPUCPLD (0x31)
|
||||
#define CPUPLD_VERSION_ADDR (0x01)
|
||||
#define SWPLD (0x31)
|
||||
#define SWPLD_VERSION_ADDR (0x01)
|
||||
#define DEFAULT_FLAG (0x00)
|
||||
#define POWER_STAT_REGISTER (0x03)
|
||||
#define SYS_LED1_REGISTER (0x21)
|
||||
#define SYS_FANLED2_REGISTER (0x20)
|
||||
#define SYS_FANLED1_REGISTER (0x23)
|
||||
#define PSU_I2C_SEL_PSU1_EEPROM (0x00)
|
||||
#define PSU_I2C_SEL_PSU2_EEPROM (0x20)
|
||||
#define PSU_FAN_MUX_REG (0x1E)
|
||||
#define PSU_MODEL_REG (0x9A)
|
||||
#define PSU_SERIAL_REG (0x9E)
|
||||
|
||||
/*SFP REG define*/
|
||||
#define SFP_SIGNAL_REG (0x02)
|
||||
#define SFP_MODULE_EEPROM (0x50)
|
||||
#define SFP_I2C_MUX_REG (0x1F)
|
||||
#define SFP_RESET_1 (0x16)
|
||||
#define SFP_RESET_2 (0x17)
|
||||
#define SFP_RESET_3 (0x18)
|
||||
#define SFP_RESET_4 (0x19)
|
||||
#define SFP_LP_MODE_1 (0x0E)
|
||||
#define SFP_LP_MODE_2 (0x0F)
|
||||
#define SFP_LP_MODE_3 (0x10)
|
||||
#define SFP_LP_MODE_4 (0x11)
|
||||
#define SFP_RESPOND_1 (0x0A)
|
||||
#define SFP_RESPOND_2 (0x0B)
|
||||
#define SFP_RESPOND_3 (0x0C)
|
||||
#define SFP_RESPOND_4 (0x0D)
|
||||
#define SFP_PRESENT_1 (0x12)
|
||||
#define SFP_PRESENT_2 (0x13)
|
||||
#define SFP_PRESENT_3 (0x14)
|
||||
#define SFP_PRESENT_4 (0x15)
|
||||
|
||||
int dni_get_bmc_data(char *device_name, UINT4 *num, UINT4 multiplier);
|
||||
int dni_fanpresent_info_get(int *r_data);
|
||||
int dni_psui_eeprom_info_get(char *r_data, int psu_id, int psu_reg);
|
||||
|
||||
char dev_name[50][32];
|
||||
float dev_sensor[50];
|
||||
|
||||
typedef struct dev_info_s
|
||||
{
|
||||
int bus;
|
||||
int size;
|
||||
uint8_t addr;
|
||||
uint8_t data_8;
|
||||
uint16_t data_16;
|
||||
uint8_t offset;
|
||||
uint32_t flags;
|
||||
}dev_info_t;
|
||||
|
||||
enum onlp_thermal_id
|
||||
{
|
||||
THERMAL_RESERVED = 0,
|
||||
THERMAL_CPU_CORE,
|
||||
THERMAL_1_ON_CPU_BOARD,
|
||||
THERMAL_2_ON_FAN_BOARD,
|
||||
THERMAL_3_ON_MAIN_BOARD,
|
||||
THERMAL_4_ON_MAIN_BOARD,
|
||||
THERMAL_5_ON_MAIN_BOARD,
|
||||
THERMAL_6_ON_PSU1,
|
||||
THERMAL_7_ON_PSU2
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FAN_RESERVED = 0,
|
||||
FAN_1_ON_FAN_BOARD,
|
||||
FAN_2_ON_FAN_BOARD,
|
||||
FAN_3_ON_FAN_BOARD,
|
||||
FAN_4_ON_FAN_BOARD,
|
||||
FAN_5_ON_FAN_BOARD,
|
||||
FAN_1_ON_PSU1,
|
||||
FAN_1_ON_PSU2
|
||||
} onlp_fan_id;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LED_RESERVED = 0,
|
||||
LED_FRONT_FAN,
|
||||
LED_FRONT_SYS,
|
||||
LED_FRONT_PWR1,
|
||||
LED_FRONT_PWR2,
|
||||
LED_REAR_FAN_TRAY_1,
|
||||
LED_REAR_FAN_TRAY_2,
|
||||
LED_REAR_FAN_TRAY_3,
|
||||
LED_REAR_FAN_TRAY_4,
|
||||
LED_REAR_FAN_TRAY_5
|
||||
}onlp_led_id;
|
||||
|
||||
#endif /* __PLATFORM_LIB_H__ */
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
* Copyright 2017 (C) Delta Networks, Inc.
|
||||
*
|
||||
* Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <onlp/platformi/psui.h>
|
||||
#include "x86_64_delta_ag9032v2_int.h"
|
||||
#include <onlplib/i2c.h>
|
||||
#include "platform_lib.h"
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_PSU(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
|
||||
{
|
||||
int i;
|
||||
int local_id;
|
||||
UINT4 multiplier = 1000;
|
||||
UINT4 u4Data = 0;
|
||||
|
||||
char device_name[10] = {0};
|
||||
char module_name[20] = {0};
|
||||
char *module_name_ptr = module_name;
|
||||
|
||||
VALIDATE(id);
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
*info = pinfo[ONLP_OID_ID_GET(id)];
|
||||
|
||||
/* Set the associated oid_table
|
||||
* Set PSU's fan and thermal to child OID
|
||||
*/
|
||||
info->hdr.coids[0] = ONLP_FAN_ID_CREATE(local_id + CHASSIS_FAN_COUNT);
|
||||
info->hdr.coids[1] = ONLP_THERMAL_ID_CREATE(local_id + CHASSIS_THERMAL_COUNT);
|
||||
|
||||
switch (local_id) {
|
||||
case PSU1_ID:
|
||||
case PSU2_ID:
|
||||
//check PSU is present or not
|
||||
if ( dni_psui_eeprom_info_get(module_name, local_id, PSU_MODEL_REG) == ONLP_STATUS_E_INVALID ){
|
||||
info->status = ONLP_PSU_STATUS_FAILED;
|
||||
break;
|
||||
}
|
||||
//get psu Pin/Pout
|
||||
sprintf(device_name, "PSU%d_Pin",local_id);
|
||||
if(dni_get_bmc_data(device_name, &u4Data, multiplier) == 0){
|
||||
info->mpin = u4Data ;
|
||||
info->status = ONLP_PSU_STATUS_PRESENT;
|
||||
info->caps |= ONLP_PSU_CAPS_PIN;
|
||||
}
|
||||
else{
|
||||
info->caps |= ONLP_PSU_STATUS_UNPLUGGED;
|
||||
}
|
||||
|
||||
sprintf(device_name, "PSU%d_Pout",local_id);
|
||||
if(dni_get_bmc_data(device_name, &u4Data, multiplier) == 0){
|
||||
info->mpout = u4Data ;
|
||||
info->status = ONLP_PSU_STATUS_PRESENT;
|
||||
info->caps |= ONLP_PSU_CAPS_POUT;
|
||||
}
|
||||
else{
|
||||
info->caps |= ONLP_PSU_STATUS_UNPLUGGED;
|
||||
}
|
||||
//get psu Iin/Iout
|
||||
sprintf(device_name, "PSU%d_Iin",local_id);
|
||||
if(dni_get_bmc_data(device_name, &u4Data, multiplier) == ONLP_STATUS_OK){
|
||||
info->miin = u4Data ;
|
||||
info->status = ONLP_PSU_STATUS_PRESENT;
|
||||
info->caps |= ONLP_PSU_CAPS_IIN;
|
||||
}
|
||||
else{
|
||||
info->caps |= ONLP_PSU_STATUS_UNPLUGGED;
|
||||
}
|
||||
sprintf(device_name, "PSU%d_Iout",local_id);
|
||||
if(dni_get_bmc_data(device_name, &u4Data, multiplier) == ONLP_STATUS_OK){
|
||||
info->miout = u4Data;
|
||||
info->status = ONLP_PSU_STATUS_PRESENT;
|
||||
info->caps |= ONLP_PSU_CAPS_IOUT;
|
||||
}
|
||||
else{
|
||||
info->caps |= ONLP_PSU_STATUS_UNPLUGGED;
|
||||
}
|
||||
//get psu Vin/Vout
|
||||
sprintf(device_name, "PSU%d_Vin",local_id);
|
||||
if(dni_get_bmc_data(device_name, &u4Data, multiplier) == ONLP_STATUS_OK){
|
||||
info->mvin = u4Data;
|
||||
info->status = ONLP_PSU_STATUS_PRESENT;
|
||||
info->caps |= ONLP_PSU_CAPS_VIN;
|
||||
}
|
||||
else{
|
||||
info->caps |= ONLP_PSU_STATUS_UNPLUGGED;
|
||||
}
|
||||
|
||||
sprintf(device_name, "PSU%d_Vout",local_id);
|
||||
if(dni_get_bmc_data(device_name, &u4Data, multiplier) == ONLP_STATUS_OK){
|
||||
info->mvout = u4Data;
|
||||
info->status = ONLP_PSU_STATUS_PRESENT;
|
||||
info->caps |= ONLP_PSU_CAPS_VOUT;
|
||||
}
|
||||
else{
|
||||
info->caps |= ONLP_PSU_STATUS_UNPLUGGED;
|
||||
}
|
||||
//get psu model name
|
||||
if(dni_psui_eeprom_info_get(module_name, local_id, PSU_MODEL_REG) == ONLP_STATUS_OK){
|
||||
for(i = 0; i< PSU_NUM_LENGTH; i++){
|
||||
module_name[i]=*(module_name_ptr + i + 1);
|
||||
}
|
||||
strcpy(info->model, module_name_ptr);
|
||||
}
|
||||
else{
|
||||
strcpy(info->model, "ONLP_STATUS_E_UNSUPPORTED");
|
||||
}
|
||||
//get psu serial number
|
||||
module_name[1] = '\0';
|
||||
if(dni_psui_eeprom_info_get(module_name_ptr, local_id, PSU_SERIAL_REG) == ONLP_STATUS_OK){
|
||||
for(i = 0; i < PSU_NUM_LENGTH; i++){
|
||||
module_name[i]=*(module_name_ptr + i + 1);
|
||||
}
|
||||
strcpy(info->serial, module_name_ptr);
|
||||
}
|
||||
else{
|
||||
strcpy(info->serial, "ONLP_STATUS_E_UNSUPPORTED");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_psui_ioctl(onlp_oid_t pid, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
@@ -0,0 +1,552 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
* Copyright 2017 (C) Delta Networks, Inc.
|
||||
*
|
||||
* Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <onlp/platformi/sfpi.h>
|
||||
#include <onlplib/i2c.h>
|
||||
#include "platform_lib.h"
|
||||
|
||||
static inline int ag9032v2_sfp_get_lp_mode_reg(int port) {
|
||||
uint8_t reg_offset = 0x00;
|
||||
if (port < 8) /* port 0-7 */
|
||||
reg_offset = SFP_LP_MODE_1;
|
||||
else if (port > 7 && port < 16) /* port 8-15 */
|
||||
reg_offset = SFP_LP_MODE_2;
|
||||
else if (port > 15 && port < 24) /* port 16-23 */
|
||||
reg_offset = SFP_LP_MODE_3;
|
||||
else if (port > 23 && port < 32) /* port 24-31 */
|
||||
reg_offset = SFP_LP_MODE_4;
|
||||
|
||||
return reg_offset;
|
||||
}
|
||||
|
||||
static inline int ag9032v2_sfp_get_reset_reg(int port) {
|
||||
uint8_t reg_offset = 0x00;
|
||||
if (port < 8) /* port 0-7 */
|
||||
reg_offset = SFP_RESET_1;
|
||||
else if (port > 7 && port < 16) /* port 8-15 */
|
||||
reg_offset = SFP_RESET_2;
|
||||
else if (port > 15 && port < 24) /* port 16-23 */
|
||||
reg_offset = SFP_RESET_3;
|
||||
else if (port > 23 && port < 32) /* port 24-31 */
|
||||
reg_offset = SFP_RESET_4;
|
||||
|
||||
return reg_offset;
|
||||
}
|
||||
|
||||
static inline int ag9032v2_sfp_get_present_reg(int port) {
|
||||
uint8_t reg_offset = 0x00;
|
||||
if (port < 8) /* port 0-7 */
|
||||
reg_offset = SFP_PRESENT_1;
|
||||
else if (port > 7 && port < 16) /* port 8-15 */
|
||||
reg_offset = SFP_PRESENT_2;
|
||||
else if (port > 15 && port < 24) /* port 16-23 */
|
||||
reg_offset = SFP_PRESENT_3;
|
||||
else if (port > 23 && port < 32) /* port 24-31 */
|
||||
reg_offset = SFP_PRESENT_4;
|
||||
|
||||
return reg_offset;
|
||||
}
|
||||
|
||||
static inline int ag9032v2_sfp_get_respond_reg(int port) {
|
||||
uint8_t reg_offset = 0x00;
|
||||
if (port < 8) /* port 0-7 */
|
||||
reg_offset = SFP_RESPOND_1;
|
||||
else if (port > 7 && port < 16) /* port 8-15 */
|
||||
reg_offset = SFP_RESPOND_2;
|
||||
else if (port > 15 && port < 24) /* port 16-23 */
|
||||
reg_offset = SFP_RESPOND_3;
|
||||
else if (port > 23 && port < 32) /* port 24-31 */
|
||||
reg_offset = SFP_RESPOND_4;
|
||||
|
||||
return reg_offset;
|
||||
}
|
||||
|
||||
static inline int ag9032v2_sfp_get_mux_reg(int port) {
|
||||
uint8_t sel_channel = 0x00;
|
||||
if (port >= 0 && port < NUM_OF_QSFP_PORT) /* port 0-31 ,reg : 0x01 - 0x32 */
|
||||
sel_channel = port;
|
||||
else if (port == NUM_OF_QSFP_PORT){ /* port 32 */
|
||||
sel_channel = 0x20;
|
||||
}
|
||||
else if (port == NUM_OF_QSFP_PORT + 1){ /* port 333 */
|
||||
sel_channel = 0x21;
|
||||
}
|
||||
else
|
||||
AIM_LOG_ERROR("qsfp port range is 0-33");
|
||||
|
||||
return sel_channel;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
*
|
||||
* 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 port;
|
||||
AIM_BITMAP_CLR_ALL(bmap);
|
||||
|
||||
for(port = 0; port < NUM_OF_ALL_PORT; port++) {
|
||||
AIM_BITMAP_SET(bmap, port);
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_is_present(int port)
|
||||
{
|
||||
uint8_t present = 0;
|
||||
uint8_t present_bit = 0;
|
||||
UINT4 byte_get;
|
||||
|
||||
/* Read QSFP MODULE is present or not */
|
||||
if(port < NUM_OF_QSFP_PORT){ //port: QSFP(0-31)
|
||||
byte_get = onlp_i2c_readb(I2C_BUS_1, SWPLD_1_ADDR, ag9032v2_sfp_get_present_reg(port), ONLP_I2C_F_TENBIT);
|
||||
if(byte_get < 0){
|
||||
AIM_LOG_ERROR("Error to present status from port(%d)\r\n", port);
|
||||
present = ONLP_STATUS_E_GENERIC;
|
||||
return present;
|
||||
}
|
||||
present_bit = byte_get & (1 << (7 - (port % 8)));
|
||||
present_bit = present_bit >> (7 - (port % 8));
|
||||
}
|
||||
else if((port > (NUM_OF_QSFP_PORT-1)) && (port < NUM_OF_ALL_PORT)){ //port: SFP(32-33)
|
||||
byte_get = onlp_i2c_readb(I2C_BUS_1, SWPLD_2_ADDR, SFP_SIGNAL_REG, ONLP_I2C_F_TENBIT);
|
||||
if(byte_get < 0){
|
||||
AIM_LOG_ERROR("Error to present status from port(%d)\r\n", port);
|
||||
present = ONLP_STATUS_E_GENERIC;
|
||||
return present;
|
||||
}
|
||||
if(port == NUM_OF_ALL_PORT-2){
|
||||
byte_get=byte_get >> 4;
|
||||
present_bit=((byte_get & 0x08) >> 3) & 1;
|
||||
}
|
||||
else if(port == NUM_OF_ALL_PORT-1){
|
||||
present_bit = (byte_get & 0x08) >> 3;
|
||||
present_bit = present_bit & 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read from sfp presence register value,
|
||||
* return 0 = The module is preset
|
||||
* return 1 = The module is NOT present
|
||||
*/
|
||||
if(present_bit == 0) {
|
||||
present = 1;
|
||||
} else if (present_bit == 1) {
|
||||
present = 0;
|
||||
AIM_LOG_ERROR("Unble to present status from port(%d)\r\n", port);
|
||||
} else {
|
||||
/* Port range over 0-31 and 32-33, return -1 */
|
||||
AIM_LOG_ERROR("Error to present status from port(%d)\r\n", port);
|
||||
present = ONLP_STATUS_E_GENERIC;
|
||||
}
|
||||
return present;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)
|
||||
{
|
||||
char present_all_data[12] = {'\0'};
|
||||
char *r_byte;
|
||||
char *r_array[4];
|
||||
int count = 0;
|
||||
int i = 0;
|
||||
int j = NUM_OF_QSFP_PORT - 1;
|
||||
uint8_t bytes[4];
|
||||
uint8_t byte_get;
|
||||
uint8_t sfp1;
|
||||
uint8_t sfp2;
|
||||
uint32_t presence_all = 0 ;
|
||||
|
||||
/* Read presence bitmap from SWPLD QSFP28 Presence Register
|
||||
* if only port 0 is present, return 7F FF FF FF
|
||||
* if only port 0 and 1 present, return 3F FF FF FF
|
||||
*/
|
||||
byte_get = onlp_i2c_readb(I2C_BUS_1, SWPLD_1_ADDR, SFP_PRESENT_1, ONLP_I2C_F_TENBIT);
|
||||
if(byte_get < 0)return ONLP_STATUS_E_GENERIC;
|
||||
bytes[0] = (~byte_get) & 0xFF;
|
||||
sprintf(present_all_data, "%x%c", byte_get, ' ');
|
||||
|
||||
byte_get = onlp_i2c_readb(I2C_BUS_1, SWPLD_1_ADDR, SFP_PRESENT_2, ONLP_I2C_F_TENBIT);
|
||||
if(byte_get < 0)return ONLP_STATUS_E_GENERIC;
|
||||
bytes[1] = (~byte_get) & 0xFF;
|
||||
sprintf(present_all_data + 3, "%x%c", byte_get, ' ');
|
||||
|
||||
byte_get = onlp_i2c_readb(I2C_BUS_1, SWPLD_1_ADDR, SFP_PRESENT_3, ONLP_I2C_F_TENBIT);
|
||||
if(byte_get < 0)return ONLP_STATUS_E_GENERIC;
|
||||
bytes[2] = (~byte_get) & 0xFF;
|
||||
sprintf(present_all_data + 6, "%x%c", byte_get, ' ');
|
||||
|
||||
byte_get = onlp_i2c_readb(I2C_BUS_1, SWPLD_1_ADDR, SFP_PRESENT_4, ONLP_I2C_F_TENBIT);
|
||||
if(byte_get < 0)return ONLP_STATUS_E_GENERIC;
|
||||
bytes[3] = (~byte_get) & 0xFF;
|
||||
sprintf(present_all_data + 9, "%x%c", byte_get, '\0');
|
||||
|
||||
/* String split */
|
||||
r_byte = strtok(present_all_data, " ");
|
||||
count = 0;
|
||||
while (r_byte != NULL) {
|
||||
r_array[count++] = r_byte;
|
||||
r_byte = strtok(NULL, " ");
|
||||
}
|
||||
|
||||
/* Convert a string to long integer
|
||||
* and saved into bytes[]
|
||||
*/
|
||||
for (count = 0; count < 4; count++) {
|
||||
bytes[count] = ~strtol(r_array[count], NULL, 16);
|
||||
}
|
||||
|
||||
/* Convert to 64 bit integer in port order */
|
||||
for(i = AIM_ARRAYSIZE(bytes)-1; i >= 0; i--) {
|
||||
presence_all <<= 8;
|
||||
presence_all |= bytes[i];
|
||||
}
|
||||
/* Populate QSFP bitmap & remap*/
|
||||
for(i = 0; presence_all; i++)
|
||||
{
|
||||
if(23 < j)
|
||||
AIM_BITMAP_MOD(dst, j - 24,(presence_all & 1));
|
||||
else if(15 < j && j < 24)
|
||||
AIM_BITMAP_MOD(dst, j - 8,(presence_all & 1));
|
||||
else if(7 < j && j < 16)
|
||||
AIM_BITMAP_MOD(dst, j + 8,(presence_all & 1));
|
||||
else
|
||||
AIM_BITMAP_MOD(dst, j + 24,(presence_all & 1));
|
||||
presence_all >>= 1;
|
||||
j--;
|
||||
}
|
||||
|
||||
/* Populate SFP bitmap */
|
||||
byte_get = onlp_i2c_readb(I2C_BUS_1, SWPLD_2_ADDR, SFP_SIGNAL_REG, ONLP_I2C_F_TENBIT);
|
||||
if(byte_get < 0)return ONLP_STATUS_E_GENERIC;
|
||||
sfp2 = (byte_get & 0x08) >> 3; //get sfp2 present bit
|
||||
byte_get = byte_get >> 4;
|
||||
sfp1 = (byte_get & 0x08) >> 3; //get sfp1 present bit
|
||||
|
||||
AIM_BITMAP_MOD(dst, 32, !(sfp1 & 1));
|
||||
AIM_BITMAP_MOD(dst, 33, !(sfp2 & 1));
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
onlp_sfpi_eeprom_read(int port, uint8_t data[256])
|
||||
{
|
||||
uint8_t sfp_response_reg = 0x00;
|
||||
uint8_t sfp_mux_reg = 0x00;
|
||||
uint8_t backup_response_data = 0x00;
|
||||
uint8_t response_data = 0x00;
|
||||
|
||||
/* Get port respond register offset */
|
||||
sfp_response_reg = ag9032v2_sfp_get_respond_reg(port);
|
||||
sfp_mux_reg = ag9032v2_sfp_get_mux_reg(port);
|
||||
|
||||
/* Select qsfp port to response mode */
|
||||
backup_response_data = onlp_i2c_readb(I2C_BUS_1, SWPLD_1_ADDR, sfp_response_reg, ONLP_I2C_F_TENBIT);
|
||||
if(backup_response_data < 0)return ONLP_STATUS_E_GENERIC;
|
||||
response_data = ~(1 << (7 - (port % 8)));
|
||||
onlp_i2c_write(I2C_BUS_1, SWPLD_1_ADDR, sfp_response_reg, 1, &response_data, ONLP_I2C_F_TENBIT);
|
||||
|
||||
/* Select QSFP port */
|
||||
onlp_i2c_write(I2C_BUS_1, SWPLD_1_ADDR, SFP_I2C_MUX_REG, 1, &sfp_mux_reg, ONLP_I2C_F_TENBIT);
|
||||
memset(data, 0, 256);
|
||||
|
||||
/* Read qsfp eeprom information into data[] */
|
||||
if (onlp_i2c_read(I2C_BUS_1, SFP_MODULE_EEPROM, 0, 256, data, ONLP_I2C_F_DISABLE_READ_RETRIES)) {
|
||||
AIM_LOG_INFO("Unable to read eeprom from port(%d)\r\n", port);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
onlp_i2c_write(I2C_BUS_1, SWPLD_1_ADDR, sfp_response_reg, 1, &backup_response_data, ONLP_I2C_F_TENBIT);
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int onlp_sfpi_port_map(int port, int* rport)
|
||||
{
|
||||
*rport = port;
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
onlp_sfpi_control_supported(int port, onlp_sfp_control_t control, int* rv)
|
||||
{
|
||||
uint8_t sfp_mux_reg = 0x00;
|
||||
sfp_mux_reg = ag9032v2_sfp_get_mux_reg(port);
|
||||
/* Select QSFP port */
|
||||
|
||||
onlp_i2c_write(I2C_BUS_1, SWPLD_1_ADDR, SFP_I2C_MUX_REG, 1, &sfp_mux_reg, ONLP_I2C_F_TENBIT);
|
||||
|
||||
if(port < NUM_OF_QSFP_PORT){ //port: QSFP(0-31)
|
||||
switch (control) {
|
||||
case ONLP_SFP_CONTROL_RESET_STATE:
|
||||
case ONLP_SFP_CONTROL_LP_MODE:
|
||||
*rv = 1;
|
||||
break;
|
||||
case ONLP_SFP_CONTROL_RX_LOS:
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
*rv = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(port >= (NUM_OF_ALL_PORT - NUM_OF_SFP_PORT) && port < NUM_OF_ALL_PORT ){ //port: SFP(32,33)
|
||||
switch (control) {
|
||||
case ONLP_SFP_CONTROL_RESET_STATE:
|
||||
case ONLP_SFP_CONTROL_LP_MODE:
|
||||
*rv = 0;
|
||||
break;
|
||||
case ONLP_SFP_CONTROL_RX_LOS:
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
*rv = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value)
|
||||
{
|
||||
uint8_t value_t = 0;
|
||||
uint8_t value_backup = 0;
|
||||
uint8_t value_u8 =(uint8_t)value;
|
||||
uint8_t sfp_mux_reg = 0x00;
|
||||
|
||||
sfp_mux_reg = ag9032v2_sfp_get_mux_reg(port);
|
||||
|
||||
/* Select QSFP port */
|
||||
onlp_i2c_write(I2C_BUS_1, SWPLD_1_ADDR, SFP_I2C_MUX_REG, 1, &sfp_mux_reg, ONLP_I2C_F_TENBIT);
|
||||
|
||||
if(port < NUM_OF_QSFP_PORT){ //port: QSFP(0-31)
|
||||
switch (control) {
|
||||
case ONLP_SFP_CONTROL_RESET_STATE:
|
||||
onlp_i2c_write(I2C_BUS_1, SWPLD_1_ADDR, ag9032v2_sfp_get_reset_reg(port), 1, &value_u8, ONLP_I2C_F_TENBIT);
|
||||
value_t = ONLP_STATUS_OK;
|
||||
break;
|
||||
case ONLP_SFP_CONTROL_LP_MODE:
|
||||
onlp_i2c_write(I2C_BUS_1, SWPLD_1_ADDR, ag9032v2_sfp_get_lp_mode_reg(port), 1, &value_u8, ONLP_I2C_F_TENBIT);
|
||||
value_t = ONLP_STATUS_OK;
|
||||
break;
|
||||
case ONLP_SFP_CONTROL_RX_LOS:
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
value_t = ONLP_STATUS_E_INTERNAL;
|
||||
break;
|
||||
default:
|
||||
value_t = ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(port >= (NUM_OF_ALL_PORT - NUM_OF_SFP_PORT) && port < NUM_OF_ALL_PORT ){ //port: SFP(32,33)
|
||||
switch (control) {
|
||||
case ONLP_SFP_CONTROL_RESET_STATE:
|
||||
case ONLP_SFP_CONTROL_LP_MODE:
|
||||
value_t = ONLP_STATUS_E_INTERNAL;
|
||||
break;
|
||||
case ONLP_SFP_CONTROL_RX_LOS:
|
||||
value_backup = onlp_i2c_readb(I2C_BUS_1, SWPLD_2_ADDR, SFP_SIGNAL_REG, ONLP_I2C_F_TENBIT);
|
||||
if(value_backup < 0)return ONLP_STATUS_E_GENERIC;
|
||||
if(port == (NUM_OF_ALL_PORT - NUM_OF_SFP_PORT) && value_backup >= 0){
|
||||
value_u8 = (value_backup | (1 << 6)) & (value << 6);
|
||||
}else if(port == ( NUM_OF_ALL_PORT - 1) && value_backup >= 0){
|
||||
value_u8 = (value_backup | (1 << 2)) & (value << 2);
|
||||
}
|
||||
else{
|
||||
value_t = ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
onlp_i2c_write(I2C_BUS_1, SWPLD_2_ADDR, SFP_SIGNAL_REG, 1, &value_u8, ONLP_I2C_F_TENBIT);
|
||||
value_t = ONLP_STATUS_OK;
|
||||
break;
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
value_backup = onlp_i2c_readb(I2C_BUS_1, SWPLD_2_ADDR, SFP_SIGNAL_REG, ONLP_I2C_F_TENBIT);
|
||||
if(value_backup < 0)return ONLP_STATUS_E_GENERIC;
|
||||
if(port == (NUM_OF_ALL_PORT - NUM_OF_SFP_PORT) && value_backup >= 0){
|
||||
value_u8 = (value_backup | (1 << 5)) & (value << 5);
|
||||
}else if(port == (NUM_OF_ALL_PORT - 1) && value_backup >= 0){
|
||||
value_u8 = (value_backup | (1 << 1)) & (value << 1);
|
||||
}
|
||||
else{
|
||||
value_t = ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
onlp_i2c_write(I2C_BUS_1, SWPLD_2_ADDR, SFP_SIGNAL_REG, 1, &value_u8, ONLP_I2C_F_TENBIT);
|
||||
value_t = ONLP_STATUS_OK;
|
||||
break;
|
||||
default:
|
||||
value_t = ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
value_t = ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
return value_t;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value)
|
||||
{
|
||||
uint8_t value_t = 0;
|
||||
uint8_t sfp_mux_reg = 0x00;
|
||||
sfp_mux_reg = ag9032v2_sfp_get_mux_reg(port);
|
||||
/* Select QSFP port */
|
||||
onlp_i2c_write(I2C_BUS_1, SWPLD_1_ADDR, SFP_I2C_MUX_REG, 1, &sfp_mux_reg, ONLP_I2C_F_TENBIT);
|
||||
|
||||
if(port < NUM_OF_QSFP_PORT){ //port: QSFP(0-31)
|
||||
switch (control) {
|
||||
case ONLP_SFP_CONTROL_RESET_STATE:
|
||||
*value = onlp_i2c_readb(I2C_BUS_1, SWPLD_1_ADDR, ag9032v2_sfp_get_reset_reg(port), ONLP_I2C_F_TENBIT);
|
||||
if(*value < 0){
|
||||
value_t = ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
*value = (1 << (7 - (*value % 8))) & 1 ;
|
||||
/* From sfp_reset value,
|
||||
* return 0 = The module is in Reset
|
||||
* return 1 = The module is NOT in Reset
|
||||
*/
|
||||
if (*value == 0)
|
||||
*value = 1;
|
||||
else if (*value == 1)
|
||||
*value = 0;
|
||||
value_t = ONLP_STATUS_OK;
|
||||
break;
|
||||
case ONLP_SFP_CONTROL_LP_MODE:
|
||||
/* From sfp_lp_mode value,
|
||||
* return 0 = The module is NOT in LP mode
|
||||
* return 1 = The moduel is in LP mode */
|
||||
*value = onlp_i2c_readb(I2C_BUS_1, SWPLD_1_ADDR, ag9032v2_sfp_get_lp_mode_reg(port), ONLP_I2C_F_TENBIT);
|
||||
if(*value < 0){
|
||||
value_t = ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
*value = (1 << (7 - (*value % 8))) & 1 ;
|
||||
value_t = ONLP_STATUS_OK;
|
||||
break;
|
||||
case ONLP_SFP_CONTROL_RX_LOS:
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
*value = 0;
|
||||
value_t = ONLP_STATUS_OK;
|
||||
break;
|
||||
default:
|
||||
value_t = ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(port >= (NUM_OF_ALL_PORT - NUM_OF_SFP_PORT) && port < NUM_OF_ALL_PORT ){ //port: SFP(32,33)
|
||||
switch (control) {
|
||||
case ONLP_SFP_CONTROL_RESET_STATE:
|
||||
case ONLP_SFP_CONTROL_LP_MODE:
|
||||
value_t = ONLP_STATUS_OK;
|
||||
break;
|
||||
case ONLP_SFP_CONTROL_RX_LOS:
|
||||
value_t = onlp_i2c_readb(I2C_BUS_1, SWPLD_2_ADDR, SFP_SIGNAL_REG, ONLP_I2C_F_TENBIT);
|
||||
if(port == (NUM_OF_ALL_PORT - NUM_OF_SFP_PORT) && value_t >= 0){
|
||||
*value = (value_t >> 6) & 0x01;
|
||||
}
|
||||
else if(port == (NUM_OF_ALL_PORT - 1) && value_t >= 0){
|
||||
*value = (value_t >> 2) & 0x01;
|
||||
}
|
||||
else{
|
||||
value_t = ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
value_t = ONLP_STATUS_OK;
|
||||
break;
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
value_t = onlp_i2c_readb(I2C_BUS_1, SWPLD_2_ADDR, SFP_SIGNAL_REG, ONLP_I2C_F_TENBIT);
|
||||
if(port == (NUM_OF_ALL_PORT - NUM_OF_SFP_PORT) && value_t >= 0){
|
||||
*value = (value_t >> 5) & 0x01;
|
||||
}
|
||||
else if(port == (NUM_OF_ALL_PORT - 1) && value_t >= 0){
|
||||
*value = (value_t >> 1) & 0x01;
|
||||
}
|
||||
else{
|
||||
value_t = ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
value_t = ONLP_STATUS_OK;
|
||||
break;
|
||||
default:
|
||||
value_t = ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
value_t = ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
return value_t;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_denit(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_dom_read(int port, uint8_t data[256])
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_post_insert(int port, sff_info_t* info)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
void
|
||||
onlp_sfpi_debug(int port, aim_pvs_t* pvs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_ioctl(int port, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
* Copyright 2017 (C) Delta 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 <onlplib/file.h>
|
||||
#include <onlplib/i2c.h>
|
||||
#include <onlp/platformi/sysi.h>
|
||||
#include "x86_64_delta_ag9032v2_int.h"
|
||||
#include "x86_64_delta_ag9032v2_log.h"
|
||||
#include "platform_lib.h"
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
const char*
|
||||
onlp_sysi_platform_get(void)
|
||||
{
|
||||
return "x86-64-delta-ag9032v2-r0";
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sysi_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
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_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sysi_platform_info_get(onlp_platform_info_t* pi)
|
||||
{
|
||||
int cpld_version = 0;
|
||||
int swpld1_version = 0;
|
||||
int swpld2_version = 0;
|
||||
int swpld3_version = 0;
|
||||
|
||||
cpld_version = onlp_i2c_readb(I2C_BUS_1, CPUCPLD, 0x00, DEFAULT_FLAG);
|
||||
swpld1_version = onlp_i2c_readb(I2C_BUS_1, SWPLD_1_ADDR, 0x27, DEFAULT_FLAG);
|
||||
swpld2_version = onlp_i2c_readb(I2C_BUS_1, SWPLD_2_ADDR, 0x01, DEFAULT_FLAG);
|
||||
swpld3_version = onlp_i2c_readb(I2C_BUS_1, SWPLD_3_ADDR, 0x01, DEFAULT_FLAG);
|
||||
|
||||
pi->cpld_versions = aim_fstrdup("%d , SWPLD1_Versions: %d , SWPLD2_Versions: %d , SWPLD3_Versions: %d", cpld_version, swpld1_version, swpld2_version, swpld3_version);
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
onlp_sysi_onie_data_free(uint8_t* data)
|
||||
{
|
||||
aim_free(data);
|
||||
}
|
||||
|
||||
void
|
||||
onlp_sysi_platform_info_free(onlp_platform_info_t* pi)
|
||||
{
|
||||
aim_free(pi->cpld_versions);
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sysi_oids_get(onlp_oid_t* table, int max)
|
||||
{
|
||||
int i = 0;
|
||||
onlp_oid_t* e = table;
|
||||
memset(table, 0, max*sizeof(onlp_oid_t));
|
||||
|
||||
for (i = 1; i <= NUM_OF_THERMAL_ON_MAIN_BROAD; i++)
|
||||
{
|
||||
*e++ = ONLP_THERMAL_ID_CREATE(i);
|
||||
}
|
||||
|
||||
for (i = 1; i <= NUM_OF_LED_ON_MAIN_BROAD; i++)
|
||||
{
|
||||
*e++ = ONLP_LED_ID_CREATE(i);
|
||||
}
|
||||
|
||||
for (i = 1; i <= NUM_OF_PSU_ON_MAIN_BROAD; i++)
|
||||
{
|
||||
*e++ = ONLP_PSU_ID_CREATE(i);
|
||||
}
|
||||
|
||||
for (i = 1; i <= NUM_OF_FAN_ON_MAIN_BROAD; i++)
|
||||
{
|
||||
*e++ = ONLP_FAN_ID_CREATE(i);
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
* Copyright 2017 (C) Delta 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 "platform_lib.h"
|
||||
#include <onlplib/file.h>
|
||||
#include <onlp/platformi/thermali.h>
|
||||
#include "x86_64_delta_ag9032v2_log.h"
|
||||
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_THERMAL(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define dni_onlp_thermal_threshold(WARNING_DEFAULT, ERROR_DEFAULT, SHUTDOWN_DEFAULT){ \
|
||||
WARNING_DEFAULT, \
|
||||
ERROR_DEFAULT, \
|
||||
SHUTDOWN_DEFAULT, \
|
||||
}
|
||||
|
||||
static char* cpu_coretemp_files[] =
|
||||
{
|
||||
"/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input",
|
||||
"/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp4_input",
|
||||
"/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp8_input",
|
||||
"/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp10_input",
|
||||
"/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp14_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_CPU_BOARD), "CPU below side thermal sensor (U12, Below of CPU)", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, dni_onlp_thermal_threshold(45000,55000,60000)
|
||||
},
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_FAN_BOARD), "Wind thermal sensor (U334, Near FAN)", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, dni_onlp_thermal_threshold(50000,60000,65000)
|
||||
},
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_3_ON_MAIN_BOARD), "MAC up side thermal sersor (U38, up side of MAC)", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, dni_onlp_thermal_threshold(65000,75000,80000)
|
||||
},
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_4_ON_MAIN_BOARD), "MAC down side thermal sensor (U40, down side of MAC)", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, dni_onlp_thermal_threshold(60000,70000,75000)
|
||||
},
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_5_ON_MAIN_BOARD), "Surroundings thermal sensor (U240, Near front panel)", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, dni_onlp_thermal_threshold(50000,60000,65000)
|
||||
},
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_6_ON_PSU1), "PSU-1 Thermal Sensor 1", ONLP_PSU_ID_CREATE(PSU1_ID)},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
|
||||
},
|
||||
{ { ONLP_THERMAL_ID_CREATE(THERMAL_7_ON_PSU2), "PSU-2 Thermal Sensor 1", ONLP_PSU_ID_CREATE(PSU2_ID)},
|
||||
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)
|
||||
{
|
||||
uint8_t local_id = 0;
|
||||
UINT4 multiplier = 1000;
|
||||
UINT4 u4Data = 0;
|
||||
char device_buf[20] = {0};
|
||||
int rv;
|
||||
|
||||
VALIDATE(id);
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
*info = linfo[ONLP_OID_ID_GET(id)];
|
||||
if(local_id == THERMAL_CPU_CORE) {
|
||||
rv = onlp_file_read_int_max(&info->mcelsius, cpu_coretemp_files);
|
||||
return rv;
|
||||
}
|
||||
switch(local_id)
|
||||
{
|
||||
case THERMAL_1_ON_CPU_BOARD:
|
||||
case THERMAL_2_ON_FAN_BOARD:
|
||||
case THERMAL_3_ON_MAIN_BOARD:
|
||||
case THERMAL_4_ON_MAIN_BOARD:
|
||||
case THERMAL_5_ON_MAIN_BOARD:
|
||||
sprintf(device_buf, "Sensor_Temp_%d", local_id-1);
|
||||
rv = dni_get_bmc_data(device_buf, &u4Data, multiplier);
|
||||
break;
|
||||
case THERMAL_6_ON_PSU1:
|
||||
sprintf(device_buf, "PSU1_Temp_1");
|
||||
rv = dni_get_bmc_data(device_buf, &u4Data, multiplier);
|
||||
break;
|
||||
case THERMAL_7_ON_PSU2:
|
||||
sprintf(device_buf, "PSU2_Temp_1");
|
||||
rv = dni_get_bmc_data(device_buf, &u4Data, multiplier);
|
||||
break;
|
||||
default:
|
||||
AIM_LOG_ERROR("Invalid Thermal ID!!\n");
|
||||
return ONLP_STATUS_E_PARAM;
|
||||
}
|
||||
|
||||
if (u4Data == 0 || rv == ONLP_STATUS_E_GENERIC){
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
else{
|
||||
info->mcelsius = u4Data;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_delta_ag9032v2/x86_64_delta_ag9032v2_config.h>
|
||||
|
||||
/* <auto.start.cdefs(X86_64_DELTA_AG9032V2_CONFIG_HEADER).source> */
|
||||
#define __x86_64_delta_ag9032v2_config_STRINGIFY_NAME(_x) #_x
|
||||
#define __x86_64_delta_ag9032v2_config_STRINGIFY_VALUE(_x) __x86_64_delta_ag9032v2_config_STRINGIFY_NAME(_x)
|
||||
x86_64_delta_ag9032v2_config_settings_t x86_64_delta_ag9032v2_config_settings[] =
|
||||
{
|
||||
#ifdef X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_LOGGING
|
||||
{ __x86_64_delta_ag9032v2_config_STRINGIFY_NAME(X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_LOGGING), __x86_64_delta_ag9032v2_config_STRINGIFY_VALUE(X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_LOGGING) },
|
||||
#else
|
||||
{ X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_LOGGING(__x86_64_delta_ag9032v2_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_AG9032V2_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
{ __x86_64_delta_ag9032v2_config_STRINGIFY_NAME(X86_64_DELTA_AG9032V2_CONFIG_LOG_OPTIONS_DEFAULT), __x86_64_delta_ag9032v2_config_STRINGIFY_VALUE(X86_64_DELTA_AG9032V2_CONFIG_LOG_OPTIONS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_DELTA_AG9032V2_CONFIG_LOG_OPTIONS_DEFAULT(__x86_64_delta_ag9032v2_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_AG9032V2_CONFIG_LOG_BITS_DEFAULT
|
||||
{ __x86_64_delta_ag9032v2_config_STRINGIFY_NAME(X86_64_DELTA_AG9032V2_CONFIG_LOG_BITS_DEFAULT), __x86_64_delta_ag9032v2_config_STRINGIFY_VALUE(X86_64_DELTA_AG9032V2_CONFIG_LOG_BITS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_DELTA_AG9032V2_CONFIG_LOG_BITS_DEFAULT(__x86_64_delta_ag9032v2_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_AG9032V2_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
{ __x86_64_delta_ag9032v2_config_STRINGIFY_NAME(X86_64_DELTA_AG9032V2_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __x86_64_delta_ag9032v2_config_STRINGIFY_VALUE(X86_64_DELTA_AG9032V2_CONFIG_LOG_CUSTOM_BITS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_DELTA_AG9032V2_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__x86_64_delta_ag9032v2_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB
|
||||
{ __x86_64_delta_ag9032v2_config_STRINGIFY_NAME(X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB), __x86_64_delta_ag9032v2_config_STRINGIFY_VALUE(X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB) },
|
||||
#else
|
||||
{ X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB(__x86_64_delta_ag9032v2_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_AG9032V2_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
{ __x86_64_delta_ag9032v2_config_STRINGIFY_NAME(X86_64_DELTA_AG9032V2_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __x86_64_delta_ag9032v2_config_STRINGIFY_VALUE(X86_64_DELTA_AG9032V2_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) },
|
||||
#else
|
||||
{ X86_64_DELTA_AG9032V2_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__x86_64_delta_ag9032v2_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_UCLI
|
||||
{ __x86_64_delta_ag9032v2_config_STRINGIFY_NAME(X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_UCLI), __x86_64_delta_ag9032v2_config_STRINGIFY_VALUE(X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_UCLI) },
|
||||
#else
|
||||
{ X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_UCLI(__x86_64_delta_ag9032v2_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
|
||||
{ __x86_64_delta_ag9032v2_config_STRINGIFY_NAME(X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION), __x86_64_delta_ag9032v2_config_STRINGIFY_VALUE(X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION) },
|
||||
#else
|
||||
{ X86_64_DELTA_AG9032V2_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION(__x86_64_delta_ag9032v2_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
#undef __x86_64_delta_ag9032v2_config_STRINGIFY_VALUE
|
||||
#undef __x86_64_delta_ag9032v2_config_STRINGIFY_NAME
|
||||
|
||||
const char*
|
||||
x86_64_delta_ag9032v2_config_lookup(const char* setting)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; x86_64_delta_ag9032v2_config_settings[i].name; i++) {
|
||||
if(strcmp(x86_64_delta_ag9032v2_config_settings[i].name, setting)) {
|
||||
return x86_64_delta_ag9032v2_config_settings[i].value;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
x86_64_delta_ag9032v2_config_show(struct aim_pvs_s* pvs)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; x86_64_delta_ag9032v2_config_settings[i].name; i++) {
|
||||
aim_printf(pvs, "%s = %s\n", x86_64_delta_ag9032v2_config_settings[i].name, x86_64_delta_ag9032v2_config_settings[i].value);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/* <auto.end.cdefs(X86_64_DELTA_AG9032V2_CONFIG_HEADER).source> */
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_delta_ag9032v2/x86_64_delta_ag9032v2_config.h>
|
||||
|
||||
/* <--auto.start.enum(ALL).source> */
|
||||
/* <auto.end.enum(ALL).source> */
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* x86_64_delta_ag9032v2 Internal Header
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __x86_64_delta_ag9032v2_INT_H__
|
||||
#define __x86_64_delta_ag9032v2_INT_H__
|
||||
|
||||
#include <x86_64_delta_ag9032v2/x86_64_delta_ag9032v2_config.h>
|
||||
|
||||
|
||||
#endif /* __x86_64_delta_ag9032v2_INT_H__ */
|
||||
@@ -0,0 +1,18 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_delta_ag9032v2/x86_64_delta_ag9032v2_config.h>
|
||||
|
||||
#include "x86_64_delta_ag9032v2_log.h"
|
||||
/*
|
||||
* x86_64_delta_ag9032v2 log struct.
|
||||
*/
|
||||
AIM_LOG_STRUCT_DEFINE(
|
||||
X86_64_DELTA_AG9032V2_CONFIG_LOG_OPTIONS_DEFAULT,
|
||||
X86_64_DELTA_AG9032V2_CONFIG_LOG_BITS_DEFAULT,
|
||||
NULL, /* Custom log map */
|
||||
X86_64_DELTA_AG9032V2_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __x86_64_delta_ag9032v2_LOG_H__
|
||||
#define __x86_64_delta_ag9032v2_LOG_H__
|
||||
|
||||
#define AIM_LOG_MODULE_NAME x86_64_delta_ag9032v2
|
||||
#include <AIM/aim_log.h>
|
||||
|
||||
#endif /* __x86_64_delta_ag9032v2_LOG_H__ */
|
||||
@@ -0,0 +1,24 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_delta_ag9032v2/x86_64_delta_ag9032v2_config.h>
|
||||
|
||||
#include "x86_64_delta_ag9032v2_log.h"
|
||||
|
||||
static int
|
||||
datatypes_init__(void)
|
||||
{
|
||||
#define x86_64_delta_ag9032v2_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
|
||||
#include <x86_64_delta_ag9032v2/x86_64_delta_ag9032v2.x>
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __x86_64_delta_ag9032v2_module_init__(void)
|
||||
{
|
||||
AIM_LOG_STRUCT_REGISTER();
|
||||
datatypes_init__();
|
||||
}
|
||||
|
||||
int __onlp_platform_version__ = 1;
|
||||
@@ -0,0 +1,50 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_delta_ag9032v2/x86_64_delta_ag9032v2_config.h>
|
||||
|
||||
#if X86_64_DELTA_AG9032V2_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_delta_ag9032v2_ucli_ucli__config__(ucli_context_t* uc)
|
||||
{
|
||||
UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_delta_ag9032v2)
|
||||
}
|
||||
|
||||
/* <auto.ucli.handlers.start> */
|
||||
/* <auto.ucli.handlers.end> */
|
||||
|
||||
static ucli_module_t
|
||||
x86_64_delta_ag9032v2_ucli_module__ =
|
||||
{
|
||||
"x86_64_delta_ag9032v2_ucli",
|
||||
NULL,
|
||||
x86_64_delta_ag9032v2_ucli_ucli_handlers__,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
ucli_node_t*
|
||||
x86_64_delta_ag9032v2_ucli_node_create(void)
|
||||
{
|
||||
ucli_node_t* n;
|
||||
ucli_module_init(&x86_64_delta_ag9032v2_ucli_module__);
|
||||
n = ucli_node_create("x86_64_delta_ag9032v2", NULL, &x86_64_delta_ag9032v2_ucli_module__);
|
||||
ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_delta_ag9032v2"));
|
||||
return n;
|
||||
}
|
||||
|
||||
#else
|
||||
void*
|
||||
x86_64_delta_ag9032v2_ucli_node_create(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1,2 @@
|
||||
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=delta BASENAME=x86-64-delta-ag9032v2 REVISION=r0
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# platform-config for AG9032V2
|
||||
#
|
||||
######################################################################
|
||||
|
||||
x86-64-delta-ag9032v2-r0:
|
||||
grub:
|
||||
|
||||
serial: >-
|
||||
--port=0x3f8
|
||||
--speed=115200
|
||||
--word=8
|
||||
--parity=no
|
||||
--stop=1
|
||||
|
||||
kernel:
|
||||
<<: *kernel-4-9
|
||||
|
||||
args: >-
|
||||
nopat
|
||||
console=ttyS0,115200n8
|
||||
|
||||
##network
|
||||
## interfaces:
|
||||
## ma1:
|
||||
## name: ~
|
||||
## syspath: pci0000:00/0000:00:14.0
|
||||
@@ -0,0 +1,18 @@
|
||||
from onl.platform.base import *
|
||||
from onl.platform.delta import *
|
||||
|
||||
class OnlPlatform_x86_64_delta_ag9032v2_r0(OnlPlatformDelta,
|
||||
OnlPlatformPortConfig_32x100):
|
||||
PLATFORM='x86-64-delta-ag9032v2-r0'
|
||||
MODEL="AG9032V2"
|
||||
SYS_OBJECT_ID=".9032.2"
|
||||
|
||||
|
||||
def baseconfig(self):
|
||||
|
||||
#IDEEPROM modulize
|
||||
self.new_i2c_device('24c02', 0x53, 1)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user