mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-25 17:27:01 +00:00
Merge branch 'master' of github.com:vincent0083/OpenNetworkLinux
Conflicts: packages/platforms/delta/Makefile packages/platforms/delta/vendor-config/Makefile packages/platforms/delta/vendor-config/PKG.yml packages/platforms/delta/vendor-config/src/python/delta/__init__.py packages/platforms/delta/x86-64/Makefile packages/platforms/delta/x86-64/modules/Makefile packages/platforms/delta/x86-64/modules/PKG.yml
This commit is contained in:
@@ -507,6 +507,7 @@ CONFIG_ACPI_BUTTON=y
|
||||
CONFIG_ACPI_FAN=y
|
||||
# CONFIG_ACPI_DOCK is not set
|
||||
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
|
||||
@@ -1823,7 +1824,13 @@ CONFIG_SERIAL_JSM=y
|
||||
# CONFIG_TTY_PRINTK 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 is not set
|
||||
CONFIG_IPMI_DEVICE_INTERFACE=y
|
||||
CONFIG_IPMI_SI=y
|
||||
CONFIG_IPMI_SI_PROBE_DEFAULTS=y
|
||||
CONFIG_IPMI_WATCHDOG=y
|
||||
CONFIG_IPMI_POWEROFF=y
|
||||
CONFIG_HW_RANDOM=y
|
||||
CONFIG_HW_RANDOM_TIMERIOMEM=y
|
||||
CONFIG_HW_RANDOM_INTEL=y
|
||||
@@ -2101,6 +2108,8 @@ CONFIG_SENSORS_ADM1021=y
|
||||
# CONFIG_SENSORS_G762 is not set
|
||||
CONFIG_SENSORS_GPIO_FAN=y
|
||||
# CONFIG_SENSORS_HIH6130 is not set
|
||||
# CONFIG_SENSORS_IBMAEM is not set
|
||||
# CONFIG_SENSORS_IBMPEX is not set
|
||||
CONFIG_SENSORS_CORETEMP=y
|
||||
# CONFIG_SENSORS_IT87 is not set
|
||||
# CONFIG_SENSORS_JC42 is not set
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
|
||||
index d65a0b1..e070d26 100644
|
||||
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
|
||||
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
|
||||
@@ -104,6 +104,7 @@ static void e1000_raise_i2c_clk(struct e1000_hw *hw, u32 *i2cctl);
|
||||
static void e1000_lower_i2c_clk(struct e1000_hw *hw, u32 *i2cctl);
|
||||
static s32 e1000_set_i2c_data(struct e1000_hw *hw, u32 *i2cctl, bool data);
|
||||
static bool e1000_get_i2c_data(u32 *i2cctl);
|
||||
+static s32 e1000_set_phy_mode_external_50210(struct e1000_hw *hw, struct e1000_phy_info *phy, u32 ctrl_ext);
|
||||
|
||||
static const u16 e1000_82580_rxpbs_table[] = {
|
||||
36, 72, 144, 1, 2, 4, 8, 16, 35, 70, 140 };
|
||||
@@ -215,6 +216,11 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw)
|
||||
/* Set phy->phy_addr and phy->id. */
|
||||
ret_val = e1000_get_phy_id_82575(hw);
|
||||
|
||||
+ if(phy->id == NULL)
|
||||
+ {
|
||||
+ ret_val = e1000_set_phy_mode_external_50210(hw, phy, ctrl_ext);
|
||||
+ }
|
||||
+
|
||||
/* Verify phy id and set remaining function pointers */
|
||||
switch (phy->id) {
|
||||
case M88E1543_E_PHY_ID:
|
||||
@@ -312,6 +318,8 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw)
|
||||
case BCM54616_E_PHY_ID:
|
||||
phy->type = e1000_phy_bcm54616;
|
||||
break;
|
||||
+ case BCM50210S_E_PHY_ID:
|
||||
+ break;
|
||||
default:
|
||||
ret_val = -E1000_ERR_PHY;
|
||||
goto out;
|
||||
@@ -3934,3 +3942,47 @@ s32 e1000_init_thermal_sensor_thresh_generic(struct e1000_hw *hw)
|
||||
}
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
+
|
||||
+static s32 e1000_set_phy_mode_external_50210(struct e1000_hw *hw, struct e1000_phy_info *phy, u32 ctrl_ext)
|
||||
+{
|
||||
+ u32 u32Data = 0;
|
||||
+ s32 ret_val = E1000_SUCCESS;
|
||||
+
|
||||
+ u32Data = E1000_READ_REG(hw, E1000_MDICNFG);
|
||||
+ u32Data |= 0x80000000;
|
||||
+ E1000_WRITE_REG(hw, E1000_MDICNFG, u32Data);
|
||||
+
|
||||
+ E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext);
|
||||
+ e1000_reset_mdicnfg_82580(hw);
|
||||
+
|
||||
+ if (e1000_sgmii_active_82575(hw) && !e1000_sgmii_uses_mdio_82575(hw))
|
||||
+ {
|
||||
+ phy->ops.read_reg = e1000_read_phy_reg_sgmii_82575;
|
||||
+ phy->ops.write_reg = e1000_write_phy_reg_sgmii_82575;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ switch (hw->mac.type)
|
||||
+ {
|
||||
+ case e1000_82580:
|
||||
+ case e1000_i350:
|
||||
+ case e1000_i354:
|
||||
+ phy->ops.read_reg = e1000_read_phy_reg_82580;
|
||||
+ phy->ops.write_reg = e1000_write_phy_reg_82580;
|
||||
+ break;
|
||||
+ case e1000_i210:
|
||||
+ case e1000_i211:
|
||||
+ phy->ops.read_reg = e1000_read_phy_reg_gs40g;
|
||||
+ phy->ops.write_reg = e1000_write_phy_reg_gs40g;
|
||||
+ break;
|
||||
+ default:
|
||||
+ phy->ops.read_reg = e1000_read_phy_reg_igp;
|
||||
+ phy->ops.write_reg = e1000_write_phy_reg_igp;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Set phy->phy_addr and phy->id. */
|
||||
+ ret_val = e1000_get_phy_id_82575(hw);
|
||||
+
|
||||
+ return ret_val;
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h
|
||||
index c21f0be..29d8933 100644
|
||||
--- a/drivers/net/ethernet/intel/igb/e1000_defines.h
|
||||
+++ b/drivers/net/ethernet/intel/igb/e1000_defines.h
|
||||
@@ -1186,7 +1186,8 @@
|
||||
#define IGP04E1000_E_PHY_ID 0x02A80391
|
||||
#define BCM54616_E_PHY_ID 0x3625D10
|
||||
#define BCM5461S_PHY_ID 0x002060C0
|
||||
-#define M88_VENDOR 0x0141
|
||||
+#define M88_VENDOR 0x0141
|
||||
+#define BCM50210S_E_PHY_ID 0x600d8590
|
||||
|
||||
/* M88E1000 Specific Registers */
|
||||
#define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Reg */
|
||||
@@ -24,3 +24,4 @@ drivers-net-ethernet-broadcom-tg3-preamble-reset.patch
|
||||
platform-powerpc-85xx-Makefile.patch
|
||||
platform-powerpc-dni-7448-r0.patch
|
||||
platform-powerpc-quanta-lb9-r0.patch
|
||||
driver-support-intel-igb-bcm50210-phy.patch
|
||||
|
||||
3
packages/platforms/delta/x86-64/x86-64-delta-wb2448/.gitignore
vendored
Executable file
3
packages/platforms/delta/x86-64/x86-64-delta-wb2448/.gitignore
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
*x86*64*delta*wb2448.mk
|
||||
onlpdump.mk
|
||||
|
||||
1
packages/platforms/delta/x86-64/x86-64-delta-wb2448/Makefile
Executable file
1
packages/platforms/delta/x86-64/x86-64-delta-wb2448/Makefile
Executable file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
1
packages/platforms/delta/x86-64/x86-64-delta-wb2448/modules/Makefile
Executable file
1
packages/platforms/delta/x86-64/x86-64-delta-wb2448/modules/Makefile
Executable file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
1
packages/platforms/delta/x86-64/x86-64-delta-wb2448/modules/PKG.yml
Executable file
1
packages/platforms/delta/x86-64/x86-64-delta-wb2448/modules/PKG.yml
Executable file
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/no-platform-modules.yml ARCH=amd64 VENDOR=delta BASENAME=x86-64-delta-wb2448
|
||||
1
packages/platforms/delta/x86-64/x86-64-delta-wb2448/onlp/Makefile
Executable file
1
packages/platforms/delta/x86-64/x86-64-delta-wb2448/onlp/Makefile
Executable file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
1
packages/platforms/delta/x86-64/x86-64-delta-wb2448/onlp/PKG.yml
Executable file
1
packages/platforms/delta/x86-64/x86-64-delta-wb2448/onlp/PKG.yml
Executable file
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=x86-64-delta-wb2448 ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu
|
||||
2
packages/platforms/delta/x86-64/x86-64-delta-wb2448/onlp/builds/Makefile
Executable file
2
packages/platforms/delta/x86-64/x86-64-delta-wb2448/onlp/builds/Makefile
Executable file
@@ -0,0 +1,2 @@
|
||||
FILTER=src
|
||||
include $(ONL)/make/subdirs.mk
|
||||
45
packages/platforms/delta/x86-64/x86-64-delta-wb2448/onlp/builds/lib/Makefile
Executable file
45
packages/platforms/delta/x86-64/x86-64-delta-wb2448/onlp/builds/lib/Makefile
Executable file
@@ -0,0 +1,45 @@
|
||||
############################################################
|
||||
# <bsn.cl fy=2014 v=onl>
|
||||
#
|
||||
# Copyright 2014 BigSwitch Networks, Inc.
|
||||
#
|
||||
# Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
# either express or implied. See the License for the specific
|
||||
# language governing permissions and limitations under the
|
||||
# License.
|
||||
#
|
||||
# </bsn.cl>
|
||||
############################################################
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
include $(ONL)/make/config.amd64.mk
|
||||
|
||||
MODULE := libonlp-x86-64-delta-wb2448
|
||||
include $(BUILDER)/standardinit.mk
|
||||
|
||||
DEPENDMODULES := AIM IOF x86_64_delta_wb2448 onlplib
|
||||
DEPENDMODULE_HEADERS := sff
|
||||
|
||||
include $(BUILDER)/dependmodules.mk
|
||||
|
||||
SHAREDLIB := libonlp-x86-64-delta-wb2448.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-wb2448-r0 module.
|
||||
#
|
||||
# Autogenerated 2016-03-16 22:11:47.698846
|
||||
#
|
||||
###############################################################################
|
||||
libonlp-x86-64-delta-wb2448-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_wb2448 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_wb2448
|
||||
10
packages/platforms/delta/x86-64/x86-64-delta-wb2448/onlp/builds/src/Makefile
Executable file
10
packages/platforms/delta/x86-64/x86-64-delta-wb2448/onlp/builds/src/Makefile
Executable file
@@ -0,0 +1,10 @@
|
||||
############################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
include $(ONL)/make/config.mk
|
||||
|
||||
MODULE := x86_64_delta_wb2448
|
||||
AUTOMODULE := x86_64_delta_wb2448
|
||||
include $(BUILDER)/definemodule.mk
|
||||
@@ -0,0 +1,10 @@
|
||||
###############################################################################
|
||||
#
|
||||
# x86_64_delta_wb2448 Autogeneration
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
x86_64_delta_wb2448_AUTO_DEFS := module/auto/x86_64_delta_wb2448.yml
|
||||
x86_64_delta_wb2448_AUTO_DIRS := module/inc/x86_64_delta_wb2448 module/src
|
||||
include $(BUILDER)/auto.mk
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
###############################################################################
|
||||
#
|
||||
# x86_64_delta_wb2448 Autogeneration Definitions.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
cdefs: &cdefs
|
||||
- X86_64_DELTA_WB2448_CONFIG_INCLUDE_LOGGING:
|
||||
doc: "Include or exclude logging."
|
||||
default: 1
|
||||
- X86_64_DELTA_WB2448_CONFIG_LOG_OPTIONS_DEFAULT:
|
||||
doc: "Default enabled log options."
|
||||
default: AIM_LOG_OPTIONS_DEFAULT
|
||||
- X86_64_DELTA_WB2448_CONFIG_LOG_BITS_DEFAULT:
|
||||
doc: "Default enabled log bits."
|
||||
default: AIM_LOG_BITS_DEFAULT
|
||||
- X86_64_DELTA_WB2448_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
|
||||
doc: "Default enabled custom log bits."
|
||||
default: 0
|
||||
- X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB:
|
||||
doc: "Default all porting macros to use the C standard libraries."
|
||||
default: 1
|
||||
- X86_64_DELTA_WB2448_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
|
||||
doc: "Include standard library headers for stdlib porting macros."
|
||||
default: X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB
|
||||
- X86_64_DELTA_WB2448_CONFIG_INCLUDE_UCLI:
|
||||
doc: "Include generic uCli support."
|
||||
default: 0
|
||||
- X86_64_DELTA_WB2448_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION:
|
||||
doc: "Assume chassis fan direction is the same as the PSU fan direction."
|
||||
default: 0
|
||||
- X86_64_DELTA_WB2448_CONFIG_SFP_COUNT:
|
||||
doc: "SFP port numbers."
|
||||
default: 4
|
||||
- X86_64_DELTA_WB2448_CONFIG_FAN_RPM_MAX:
|
||||
doc: "Max fan speed."
|
||||
default: 18000
|
||||
|
||||
definitions:
|
||||
cdefs:
|
||||
X86_64_DELTA_WB2448_CONFIG_HEADER:
|
||||
defs: *cdefs
|
||||
basename: x86_64_delta_wb2448_config
|
||||
|
||||
portingmacro:
|
||||
X86_64_DELTA_WB2448:
|
||||
macros:
|
||||
- malloc
|
||||
- free
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
@@ -0,0 +1,16 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <x86_64_delta_wb2448/x86_64_delta_wb2448_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_wb2448 Configuration Header
|
||||
*
|
||||
* @addtogroup x86_64_delta_wb2448-config
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_DELTA_WB2448_CONFIG_H__
|
||||
#define __X86_64_DELTA_WB2448_CONFIG_H__
|
||||
|
||||
#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG
|
||||
#include <global_custom_config.h>
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_WB2448_INCLUDE_CUSTOM_CONFIG
|
||||
#include <x86_64_delta_wb2448_custom_config.h>
|
||||
#endif
|
||||
|
||||
/* <auto.start.cdefs(x86_64_delta_wb2448_CONFIG_HEADER).header> */
|
||||
#include <AIM/aim.h>
|
||||
/**
|
||||
* X86_64_DELTA_WB2448_CONFIG_INCLUDE_LOGGING
|
||||
*
|
||||
* Include or exclude logging. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_CONFIG_INCLUDE_LOGGING
|
||||
#define X86_64_DELTA_WB2448_CONFIG_INCLUDE_LOGGING 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_WB2448_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
*
|
||||
* Default enabled log options. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
#define X86_64_DELTA_WB2448_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_WB2448_CONFIG_LOG_BITS_DEFAULT
|
||||
*
|
||||
* Default enabled log bits. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_CONFIG_LOG_BITS_DEFAULT
|
||||
#define X86_64_DELTA_WB2448_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_WB2448_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
*
|
||||
* Default enabled custom log bits. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
#define X86_64_DELTA_WB2448_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB
|
||||
*
|
||||
* Default all porting macros to use the C standard libraries. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB
|
||||
#define X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_WB2448_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
*
|
||||
* Include standard library headers for stdlib porting macros. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
#define X86_64_DELTA_WB2448_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_WB2448_CONFIG_INCLUDE_UCLI
|
||||
*
|
||||
* Include generic uCli support. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_CONFIG_INCLUDE_UCLI
|
||||
#define X86_64_DELTA_WB2448_CONFIG_INCLUDE_UCLI 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_WB2448_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
|
||||
*
|
||||
* Assume chassis fan direction is the same as the PSU fan direction. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
|
||||
#define X86_64_DELTA_WB2448_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_WB2448_CONFIG_SFP_COUNT
|
||||
*
|
||||
* SFP port numbers. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_CONFIG_SFP_COUNT
|
||||
#define X86_64_DELTA_WB2448_CONFIG_SFP_COUNT 4
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_DELTA_WB2448_CONFIG_FAN_RPM_MAX
|
||||
*
|
||||
* Max fan speed. */
|
||||
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_CONFIG_FAN_RPM_MAX
|
||||
#define X86_64_DELTA_WB2448_CONFIG_FAN_RPM_MAX 18000
|
||||
#endif
|
||||
|
||||
/**
|
||||
* All compile time options can be queried or displayed
|
||||
*/
|
||||
|
||||
/** Configuration settings structure. */
|
||||
typedef struct x86_64_delta_wb2448_config_settings_s {
|
||||
/** name */
|
||||
const char* name;
|
||||
/** value */
|
||||
const char* value;
|
||||
} x86_64_delta_wb2448_config_settings_t;
|
||||
|
||||
/** Configuration settings table. */
|
||||
/** x86_64_delta_wb2448_config_settings table. */
|
||||
extern x86_64_delta_wb2448_config_settings_t x86_64_delta_wb2448_config_settings[];
|
||||
|
||||
/**
|
||||
* @brief Lookup a configuration setting.
|
||||
* @param setting The name of the configuration option to lookup.
|
||||
*/
|
||||
const char* x86_64_delta_wb2448_config_lookup(const char* setting);
|
||||
|
||||
/**
|
||||
* @brief Show the compile-time configuration.
|
||||
* @param pvs The output stream.
|
||||
*/
|
||||
int x86_64_delta_wb2448_config_show(struct aim_pvs_s* pvs);
|
||||
|
||||
/* <auto.end.cdefs(x86_64_delta_wb2448_CONFIG_HEADER).header> */
|
||||
|
||||
#include "x86_64_delta_wb2448_porting.h"
|
||||
|
||||
#endif /* __x86_64_delta_wb2448_CONFIG_H__ */
|
||||
/* @} */
|
||||
@@ -0,0 +1,26 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* x86_64_delta_wb2448 Doxygen Header
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_DELTA_WB2448_DOX_H__
|
||||
#define _X86_64_DELTA_WB2448_DOX_H__
|
||||
|
||||
/**
|
||||
* @defgroup x86_64_delta_wb2448 x86_64_delta_wb2448 - x86_64_delta_wb2448 Description
|
||||
*
|
||||
|
||||
The documentation overview for this module should go here.
|
||||
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @defgroup x86_64_delta_wb2448-x86_64_delta_wb2448 Public Interface
|
||||
* @defgroup x86_64_delta_wb2448-config Compile Time Configuration
|
||||
* @defgroup x86_64_delta_wb2448-porting Porting Macros
|
||||
*
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#endif /* __X86_64_DELTA_WB2448_DOX_H__ */
|
||||
@@ -0,0 +1,107 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* @file
|
||||
* @brief x86_64_delta_wb2448 Porting Macros.
|
||||
*
|
||||
* @addtogroup x86_64_delta_wb2448-porting
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_DELTA_WB2448_PORTING_H__
|
||||
#define __X86_64_DELTA_WB2448_PORTING_H__
|
||||
|
||||
|
||||
/* <auto.start.portingmacro(ALL).define> */
|
||||
#if X86_64_DELTA_WB2448_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_WB2448_MALLOC
|
||||
#if defined(GLOBAL_MALLOC)
|
||||
#define X86_64_DELTA_WB2448_MALLOC GLOBAL_MALLOC
|
||||
#elif X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_DELTA_WB2448_MALLOC malloc
|
||||
#else
|
||||
#error The macro X86_64_DELTA_WB2448_MALLOC is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_FREE
|
||||
#if defined(GLOBAL_FREE)
|
||||
#define X86_64_DELTA_WB2448_FREE GLOBAL_FREE
|
||||
#elif X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_DELTA_WB2448_FREE free
|
||||
#else
|
||||
#error The macro X86_64_DELTA_WB2448_FREE is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_MEMSET
|
||||
#if defined(GLOBAL_MEMSET)
|
||||
#define X86_64_DELTA_WB2448_MEMSET GLOBAL_MEMSET
|
||||
#elif X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_DELTA_WB2448_MEMSET memset
|
||||
#else
|
||||
#error The macro X86_64_DELTA_WB2448_MEMSET is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_MEMCPY
|
||||
#if defined(GLOBAL_MEMCPY)
|
||||
#define X86_64_DELTA_WB2448_MEMCPY GLOBAL_MEMCPY
|
||||
#elif X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_DELTA_WB2448_MEMCPY memcpy
|
||||
#else
|
||||
#error The macro X86_64_DELTA_WB2448_MEMCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define X86_64_DELTA_WB2448_STRNCPY GLOBAL_STRNCPY
|
||||
#elif X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_DELTA_WB2448_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro X86_64_DELTA_WB2448_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define X86_64_DELTA_WB2448_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
#elif X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_DELTA_WB2448_VSNPRINTF vsnprintf
|
||||
#else
|
||||
#error The macro X86_64_DELTA_WB2448_VSNPRINTF is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_SNPRINTF
|
||||
#if defined(GLOBAL_SNPRINTF)
|
||||
#define X86_64_DELTA_WB2448_SNPRINTF GLOBAL_SNPRINTF
|
||||
#elif X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_DELTA_WB2448_SNPRINTF snprintf
|
||||
#else
|
||||
#error The macro X86_64_DELTA_WB2448_SNPRINTF is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_DELTA_WB2448_STRLEN
|
||||
#if defined(GLOBAL_STRLEN)
|
||||
#define X86_64_DELTA_WB2448_STRLEN GLOBAL_STRLEN
|
||||
#elif X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_DELTA_WB2448_STRLEN strlen
|
||||
#else
|
||||
#error The macro X86_64_DELTA_WB2448_STRLEN is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* <auto.end.portingmacro(ALL).define> */
|
||||
|
||||
|
||||
#endif /* __X86_64_DELTA_WB2448_PORTING_H__ */
|
||||
/* @} */
|
||||
@@ -0,0 +1,10 @@
|
||||
###############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
x86_64_delta_wb2448_INCLUDES := -I $(THIS_DIR)inc
|
||||
x86_64_delta_wb2448_INTERNAL_INCLUDES := -I $(THIS_DIR)src
|
||||
x86_64_delta_wb2448_DEPENDMODULE_ENTRIES := init:x86_64_delta_wb2448 ucli:x86_64_delta_wb2448
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
###############################################################################
|
||||
#
|
||||
# Local source generation targets.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
|
||||
include ../../../../init.mk
|
||||
|
||||
ucli:
|
||||
$(SUBMODULE_BIGCODE)/tools/uclihandlers.py x86_64_delta_wb2448_ucli.c
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014, 2015 Big Switch Networks, Inc.
|
||||
* Copyright 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 <onlp/platformi/fani.h>
|
||||
#include "x86_64_delta_wb2448_int.h"
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <onlplib/mmap.h>
|
||||
|
||||
#include "platform_lib.h"
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do \
|
||||
{ \
|
||||
if(!ONLP_OID_IS_FAN(_id)) \
|
||||
{ \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
enum onlp_fan_id
|
||||
{
|
||||
FAN_RESERVED = 0,
|
||||
SYSTEM_FAN_1,
|
||||
SYSTEM_FAN_2,
|
||||
};
|
||||
|
||||
/* Static values */
|
||||
static onlp_fan_info_t linfo[] =
|
||||
{
|
||||
{ }, /* Not used */
|
||||
{
|
||||
{ ONLP_FAN_ID_CREATE(SYSTEM_FAN_1), "Chassis System FAN 1", 0},
|
||||
ONLP_FAN_STATUS_PRESENT,
|
||||
ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE, 0, 0, ONLP_FAN_MODE_INVALID,
|
||||
},
|
||||
{
|
||||
{ ONLP_FAN_ID_CREATE(SYSTEM_FAN_2), "Chassis System FAN 2", 0},
|
||||
ONLP_FAN_STATUS_PRESENT,
|
||||
ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE, 0, 0, ONLP_FAN_MODE_INVALID,
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
INT4 rv = ONLP_STATUS_OK;
|
||||
INT4 local_id = 0;
|
||||
UINT4 u4Data = 0;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
|
||||
*info = linfo[ONLP_OID_ID_GET(id)];
|
||||
|
||||
switch(local_id)
|
||||
{
|
||||
case SYSTEM_FAN_1:
|
||||
rv = ifnBmcFanSpeedGet("FanPWM_1", &u4Data);
|
||||
break;
|
||||
|
||||
case SYSTEM_FAN_2:
|
||||
rv = ifnBmcFanSpeedGet("FanPWM_2", &u4Data);
|
||||
break;
|
||||
|
||||
default:
|
||||
AIM_LOG_ERROR("Invalid Fan ID!!\n");
|
||||
rv = ONLP_STATUS_E_PARAM;
|
||||
}
|
||||
|
||||
if(rv == ONLP_STATUS_OK)
|
||||
{
|
||||
info->rpm = u4Data;
|
||||
info->percentage = (info->rpm * 100) / X86_64_DELTA_WB2448_CONFIG_FAN_RPM_MAX;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
{
|
||||
INT4 local_id;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
|
||||
if ( p < 0 || p > 100)
|
||||
{
|
||||
AIM_LOG_ERROR("Invalid fan percentage !!");
|
||||
return ONLP_STATUS_E_PARAM;
|
||||
}
|
||||
|
||||
if (ifnBmcFanSpeedSet(local_id - 1, p) != ONLP_STATUS_OK)
|
||||
{
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_fani_rpm_set(onlp_oid_t id, int rpm)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_fani_ioctl(onlp_oid_t fid, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014, 2015 Big Switch Networks, Inc.
|
||||
* Copyright 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 <onlp/platformi/ledi.h>
|
||||
#include "x86_64_delta_wb2448_int.h"
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <onlplib/mmap.h>
|
||||
|
||||
#include "platform_lib.h"
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do \
|
||||
{ \
|
||||
if(!ONLP_OID_IS_LED(_id)) \
|
||||
{ \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define I2C_BUS 0x04
|
||||
#define CPLD_ADDR 0x28
|
||||
#define SYS_LED_REGISTER 0x09
|
||||
#define TEMP_LED_REGISTER 0x09
|
||||
#define FAN_LED_REGISTER 0x09
|
||||
#define LED_ADDR_LEN 0x01
|
||||
#define LED_DATA_LEN 0x01
|
||||
|
||||
/* LED related data
|
||||
*/
|
||||
enum onlp_led_id
|
||||
{
|
||||
LED_RESERVED = 0,
|
||||
LED_SYSTEM,
|
||||
LED_FAN,
|
||||
LED_TEMP
|
||||
};
|
||||
|
||||
enum led_light_mode
|
||||
{
|
||||
LED_MODE_OFF = 0,
|
||||
LED_MODE_GREEN,
|
||||
LED_MODE_RED,
|
||||
LED_MODE_AMBER,
|
||||
LED_MODE_BLUE,
|
||||
LED_MODE_GREEN_BLINK =0 ,
|
||||
LED_MODE_AMBER_BLINK,
|
||||
LED_MODE_RED_BLINK = 3,
|
||||
LED_MODE_BLUE_BLINK,
|
||||
LED_MODE_AUTO,
|
||||
LED_MODE_UNKNOWN
|
||||
};
|
||||
|
||||
typedef struct led_light_mode_map
|
||||
{
|
||||
enum onlp_led_id id;
|
||||
enum led_light_mode driver_led_mode;
|
||||
enum onlp_led_mode_e onlp_led_mode;
|
||||
} led_light_mode_map_t;
|
||||
|
||||
led_light_mode_map_t led_map[] =
|
||||
{
|
||||
{LED_SYSTEM, LED_MODE_GREEN_BLINK, ONLP_LED_MODE_GREEN_BLINKING},
|
||||
{LED_SYSTEM, LED_MODE_GREEN, ONLP_LED_MODE_GREEN},
|
||||
{LED_SYSTEM, LED_MODE_RED, ONLP_LED_MODE_RED},
|
||||
{LED_SYSTEM, LED_MODE_RED_BLINK, ONLP_LED_MODE_RED_BLINKING},
|
||||
{LED_FAN, LED_MODE_GREEN, ONLP_LED_MODE_GREEN},
|
||||
{LED_FAN, LED_MODE_RED, ONLP_LED_MODE_RED},
|
||||
{LED_TEMP, LED_MODE_OFF, ONLP_LED_MODE_OFF},
|
||||
{LED_TEMP, LED_MODE_GREEN, ONLP_LED_MODE_GREEN},
|
||||
{LED_TEMP, LED_MODE_RED, ONLP_LED_MODE_RED}
|
||||
};
|
||||
|
||||
/*
|
||||
* Get the information for the given LED OID.
|
||||
*/
|
||||
|
||||
static onlp_led_info_t linfo[] =
|
||||
{
|
||||
{ },
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_SYSTEM), "Chassis LED 1 (SYSTEM)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_GREEN_BLINKING | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_RED_BLINKING,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FAN), "Chassis LED 2 (FAN)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_TEMP), "Chassis LED 3 (TEMP)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED,
|
||||
},
|
||||
};
|
||||
|
||||
static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode)
|
||||
{
|
||||
int i, nsize = sizeof(led_map)/sizeof(led_map[0]);
|
||||
|
||||
for (i = 0; i < nsize; i++)
|
||||
{
|
||||
if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode)
|
||||
{
|
||||
return led_map[i].onlp_led_mode;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode)
|
||||
{
|
||||
int i, nsize = sizeof(led_map)/sizeof(led_map[0]);
|
||||
|
||||
for(i = 0; i < nsize; i++)
|
||||
{
|
||||
if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode)
|
||||
{
|
||||
return led_map[i].driver_led_mode;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_ledi_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
{
|
||||
INT4 rv = ONLP_STATUS_OK;
|
||||
INT4 local_id = 0;
|
||||
UINT4 u4LedMode = 0;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
|
||||
*info = linfo[ONLP_OID_ID_GET(id)];
|
||||
|
||||
/* Get LED mode */
|
||||
switch(local_id)
|
||||
{
|
||||
case LED_SYSTEM:
|
||||
rv = ifnOS_LINUX_BmcI2CGet(I2C_BUS, CPLD_ADDR, SYS_LED_REGISTER, LED_ADDR_LEN, &u4LedMode, LED_DATA_LEN);
|
||||
u4LedMode = u4LedMode >> 6;
|
||||
break;
|
||||
|
||||
case LED_FAN:
|
||||
rv = ifnOS_LINUX_BmcI2CGet(I2C_BUS, CPLD_ADDR, TEMP_LED_REGISTER, LED_ADDR_LEN, &u4LedMode, LED_DATA_LEN);
|
||||
u4LedMode = (u4LedMode >> 2) & 0x03;
|
||||
break;
|
||||
|
||||
case LED_TEMP:
|
||||
rv = ifnOS_LINUX_BmcI2CGet(I2C_BUS, CPLD_ADDR, FAN_LED_REGISTER, LED_ADDR_LEN, &u4LedMode, LED_DATA_LEN);
|
||||
u4LedMode = (u4LedMode >> 4) & 0x03;
|
||||
break;
|
||||
|
||||
default:
|
||||
AIM_LOG_ERROR("Invalid LED ID!!\n");
|
||||
rv = ONLP_STATUS_E_PARAM;
|
||||
}
|
||||
|
||||
if( rv == ONLP_STATUS_OK)
|
||||
{
|
||||
info->mode = driver_to_onlp_led_mode(local_id, u4LedMode);
|
||||
|
||||
/* Set the on/off status */
|
||||
if (info->mode != ONLP_LED_MODE_OFF)
|
||||
{
|
||||
info->status |= ONLP_LED_STATUS_ON;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief Turn an LED on or off.
|
||||
* @param id The LED OID
|
||||
* @param on_or_off Led on (1) or LED off (0)
|
||||
* @param Relevant if the LED has the ON_OFF capability.
|
||||
* @note For the purposes of this function the
|
||||
* interpretation of "on" for multi-mode or multi-color LEDs
|
||||
* is up to the platform implementation.
|
||||
*/
|
||||
int
|
||||
onlp_ledi_set(onlp_oid_t id, int on_or_off)
|
||||
{
|
||||
VALIDATE(id);
|
||||
|
||||
if (!on_or_off)
|
||||
{
|
||||
return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF);
|
||||
}
|
||||
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_ledi_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
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)
|
||||
{
|
||||
INT4 rv = ONLP_STATUS_OK;
|
||||
INT4 local_id = 0;
|
||||
UINT4 u4Addr = 0;
|
||||
UINT4 u4NewLedMode = 0;
|
||||
UINT4 u4OldLedMode = 0;
|
||||
onlp_led_mode_t driver_led_mode = 0;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
driver_led_mode = onlp_to_driver_led_mode(local_id, mode);
|
||||
|
||||
switch(local_id)
|
||||
{
|
||||
case LED_SYSTEM:
|
||||
u4Addr = SYS_LED_REGISTER;
|
||||
rv = ifnOS_LINUX_BmcI2CGet(I2C_BUS, CPLD_ADDR, u4Addr, LED_ADDR_LEN, &u4OldLedMode, LED_DATA_LEN);
|
||||
u4NewLedMode = ( (u4OldLedMode & 0x3C) | ((driver_led_mode << 6) & 0xC0) );
|
||||
break;
|
||||
|
||||
case LED_FAN:
|
||||
u4Addr = FAN_LED_REGISTER;
|
||||
rv = ifnOS_LINUX_BmcI2CGet(I2C_BUS, CPLD_ADDR, u4Addr, LED_ADDR_LEN, &u4OldLedMode, LED_DATA_LEN);
|
||||
u4NewLedMode = ( (u4OldLedMode & 0xF0) | ((driver_led_mode << 2) & 0x0C) );
|
||||
break;
|
||||
|
||||
case LED_TEMP:
|
||||
u4Addr = TEMP_LED_REGISTER;
|
||||
rv = ifnOS_LINUX_BmcI2CGet(I2C_BUS, CPLD_ADDR, u4Addr, LED_ADDR_LEN, &u4OldLedMode, LED_DATA_LEN);
|
||||
u4NewLedMode = ( (u4OldLedMode & 0xCC) | ((driver_led_mode << 4) & 0x30) );
|
||||
break;
|
||||
|
||||
default:
|
||||
rv = ONLP_STATUS_E_PARAM;
|
||||
AIM_LOG_ERROR("Invalid LED ID!!\n");
|
||||
}
|
||||
|
||||
if(rv == ONLP_STATUS_OK)
|
||||
{
|
||||
rv = ifnOS_LINUX_BmcI2CSet(I2C_BUS, CPLD_ADDR, u4Addr, LED_ADDR_LEN, u4NewLedMode, LED_DATA_LEN);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
###############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
|
||||
LIBRARY := x86_64_delta_wb2448
|
||||
$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
#$(LIBRARY)_LAST := 1
|
||||
include $(BUILDER)/lib.mk
|
||||
@@ -0,0 +1,311 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2017 v=onl>
|
||||
*
|
||||
* Copyright 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 <sys/mman.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <AIM/aim.h>
|
||||
#include <onlp/onlp.h>
|
||||
|
||||
#include "platform_lib.h"
|
||||
|
||||
/****************************************************************************
|
||||
* FUNCTION : ifnOS_LINUX_BmcI2CGet
|
||||
* DESCRIPTION : To read data through BMC I2C
|
||||
* INPUT : u1Bus
|
||||
* u1Dev
|
||||
* u4Addr
|
||||
* u1AddrLen
|
||||
* u1DataLen
|
||||
* OUTPUT : pu4RetData
|
||||
* RETURN : ONLP_STATUS_OK
|
||||
****************************************************************************/
|
||||
INT4 ifnOS_LINUX_BmcI2CGet(UINT1 u1Bus, UINT1 u1Dev, UINT4 u4Addr, UINT1 u1AddrLen, UINT4 *pu4RetData, UINT1 u1DataLen)
|
||||
{
|
||||
INT4 i = 0;
|
||||
INT4 i4Cnt = 1;
|
||||
INT4 i4Ret = ONLP_STATUS_OK;
|
||||
UINT4 u4Data = 0;
|
||||
FILE *pFd = NULL;
|
||||
UINT1 au1Temp[2] = {0};
|
||||
INT1 ai1Cmd [OS_MAX_MSG_SIZE] = {0};
|
||||
INT1 ai1Data[OS_MAX_MSG_SIZE] = {0};
|
||||
|
||||
sprintf(ai1Cmd, "ipmitool raw 0x38 0x2 %d %d %d %d", u1Bus, u1Dev, u4Addr, u1DataLen);
|
||||
|
||||
pFd = popen(ai1Cmd, "r");
|
||||
|
||||
if(pFd != NULL)
|
||||
{
|
||||
if (fgets(ai1Data, OS_MAX_MSG_SIZE, pFd) != NULL)
|
||||
{
|
||||
while (i < u1DataLen)
|
||||
{
|
||||
au1Temp[0] = ai1Data[i4Cnt++];
|
||||
au1Temp[1] = ai1Data[i4Cnt++];
|
||||
|
||||
i4Cnt++;
|
||||
|
||||
u4Data <<= (i*8);
|
||||
u4Data += (UINT1)MMI_XTOI(au1Temp);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
*pu4RetData = u4Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
i4Ret = ONLP_STATUS_E_INTERNAL;
|
||||
AIM_LOG_ERROR("Command \"%s\": Get Data Failed (ret: %d)", ai1Cmd, i4Ret);
|
||||
}
|
||||
|
||||
pclose(pFd);
|
||||
}
|
||||
else
|
||||
{
|
||||
i4Ret = ONLP_STATUS_E_INTERNAL;
|
||||
AIM_LOG_ERROR("Execute command \"%s\" failed (ret: %d)", ai1Cmd, i4Ret);
|
||||
}
|
||||
|
||||
return i4Ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* FUNCTION : ifnOS_LINUX_BmcI2CSet
|
||||
* DESCRIPTION : To write data through BMC I2C
|
||||
* INPUT : u1Bus
|
||||
* u1Dev
|
||||
* u4Addr
|
||||
* u1AddrLen
|
||||
* u4Data
|
||||
* u1DataLen
|
||||
* OUTPUT : N/A
|
||||
* RETURN : ONLP_STATUS_OK
|
||||
****************************************************************************/
|
||||
INT4 ifnOS_LINUX_BmcI2CSet(UINT1 u1Bus, UINT1 u1Dev, UINT4 u4Addr, UINT1 u1AddrLen, UINT4 u4Data, UINT1 u1DataLen)
|
||||
{
|
||||
INT4 i4Ret = ONLP_STATUS_OK;
|
||||
FILE *pFd = NULL;
|
||||
INT1 ai1Cmd[OS_MAX_MSG_SIZE] = {0};
|
||||
|
||||
switch (u1DataLen)
|
||||
{
|
||||
case 1:
|
||||
sprintf(ai1Cmd, "ipmitool raw 0x38 0x3 %d %d %d %d", u1Bus, u1Dev, u4Addr, u4Data);
|
||||
break;
|
||||
case 2:
|
||||
sprintf(ai1Cmd, "ipmitool raw 0x38 0x4 %d %d %d %d %d", u1Bus, u1Dev, u4Addr, ((u4Data&0xFF00)>>8), (u4Data&0xFF));
|
||||
break;
|
||||
case 4:
|
||||
sprintf(ai1Cmd, "ipmitool raw 0x38 0x5 %d %d %d %d %d %d %d", u1Bus, u1Dev, u4Addr, ((u4Data&0xFF000000)>>24), ((u4Data&0xFF0000)>>16), ((u4Data&0xFF00)>>8), (u4Data&0xFF));
|
||||
break;
|
||||
default:
|
||||
AIM_LOG_ERROR("ERR: Unsupported data length: %d", u1DataLen);
|
||||
}
|
||||
|
||||
pFd = popen(ai1Cmd, "r");
|
||||
|
||||
if (pFd != NULL)
|
||||
{
|
||||
pclose(pFd);
|
||||
}
|
||||
else
|
||||
{
|
||||
i4Ret = ONLP_STATUS_E_INTERNAL;
|
||||
AIM_LOG_ERROR("Execute command \"%s\" failed (ret: %d)", ai1Cmd, i4Ret);
|
||||
}
|
||||
|
||||
return i4Ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* FUNCTION : ifnOS_LINUX_BmcI2CProbe
|
||||
* DESCRIPTION : To probe device through BMC I2C
|
||||
* INPUT : u1Bus
|
||||
* u1Dev
|
||||
* OUTPUT :
|
||||
* RETURN : ONLP_STATUS_OK
|
||||
****************************************************************************/
|
||||
INT4 ifnOS_LINUX_BmcI2CProbe(UINT1 u1Bus, UINT1 u1Dev)
|
||||
{
|
||||
INT4 i4Ret = ONLP_STATUS_OK;
|
||||
INT4 i4Cnt = 1;
|
||||
UINT4 u4Data = 0;
|
||||
UINT1 au1Temp[2] = {0};
|
||||
INT1 ai1Cmd [OS_MAX_MSG_SIZE] = {0};
|
||||
INT1 ai1Data[OS_MAX_MSG_SIZE] = {0};
|
||||
FILE *pFd = NULL;
|
||||
|
||||
sprintf(ai1Cmd, "ipmitool raw 0x38 0x1 %d %d", u1Bus, u1Dev);
|
||||
|
||||
pFd = popen(ai1Cmd, "r");
|
||||
|
||||
if(pFd != NULL)
|
||||
{
|
||||
if (fgets(ai1Data, OS_MAX_MSG_SIZE, pFd) != NULL)
|
||||
{
|
||||
au1Temp[0] = ai1Data[i4Cnt++];
|
||||
au1Temp[1] = ai1Data[i4Cnt++];
|
||||
|
||||
u4Data += (UINT1)MMI_XTOI(au1Temp);
|
||||
|
||||
if (u4Data != 0x00)
|
||||
AIM_LOG_ERROR("Probe failed (ret: %d)", i4Ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
i4Ret = ONLP_STATUS_E_INTERNAL;
|
||||
AIM_LOG_ERROR("Command \"%s\": Get Data Failed (ret: %d)", ai1Cmd, i4Ret);
|
||||
}
|
||||
|
||||
pclose(pFd);
|
||||
}
|
||||
else
|
||||
{
|
||||
i4Ret = ONLP_STATUS_E_INTERNAL;
|
||||
AIM_LOG_ERROR("Execute command \"%s\" failed (ret: %d)", ai1Cmd, i4Ret);
|
||||
}
|
||||
|
||||
return i4Ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* FUNCTION : ifnBmcFanSpeedGet
|
||||
* DESCRIPTION : To Get Fan Speed from Ipmitool
|
||||
* INPUT : pi1FanName
|
||||
* pu4RetData
|
||||
* OUTPUT :
|
||||
* RETURN : ONLP_STATUS_OK
|
||||
****************************************************************************/
|
||||
INT4 ifnBmcFanSpeedGet(INT1 *pi1FanName, UINT4 *pu4RetData)
|
||||
{
|
||||
INT4 i4Ret = ONLP_STATUS_OK;
|
||||
UINT4 u4Data = 0;
|
||||
INT1 ai1Cmd [OS_MAX_MSG_SIZE] = {0};
|
||||
INT1 au1Data[OS_MAX_MSG_SIZE] = {0};
|
||||
INT1 *pui1Temp = NULL;
|
||||
FILE *pFd = NULL;
|
||||
|
||||
sprintf(ai1Cmd, "ipmitool sdr | grep %s", pi1FanName);
|
||||
|
||||
pFd = popen(ai1Cmd, "r");
|
||||
|
||||
if(pFd != NULL)
|
||||
{
|
||||
if (fgets(au1Data, OS_MAX_MSG_SIZE, pFd) != NULL)
|
||||
{
|
||||
pui1Temp = strchr(au1Data, '|');
|
||||
|
||||
do
|
||||
{
|
||||
u4Data += strtol(pui1Temp, &pui1Temp, 10);
|
||||
}while (*pui1Temp++);
|
||||
|
||||
*pu4RetData = u4Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
i4Ret = ONLP_STATUS_E_INTERNAL;
|
||||
AIM_LOG_ERROR("Command \"%s\": Get Data Failed (ret: %d)", ai1Cmd, i4Ret);
|
||||
}
|
||||
|
||||
pclose(pFd);
|
||||
}
|
||||
else
|
||||
{
|
||||
i4Ret = ONLP_STATUS_E_INTERNAL;
|
||||
AIM_LOG_ERROR("Execute command \"%s\" failed (ret: %d)", ai1Cmd, i4Ret);
|
||||
}
|
||||
|
||||
return i4Ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* FUNCTION : ifnBmcFanSpeedSet
|
||||
* DESCRIPTION : To Set Fan Speed from Ipmitool
|
||||
* INPUT : u4FanNumber
|
||||
* u4Percentage
|
||||
* OUTPUT :
|
||||
* RETURN : ONLP_STATUS_OK
|
||||
****************************************************************************/
|
||||
INT4 ifnBmcFanSpeedSet(UINT4 u4FanNumber, UINT4 u4Percentage)
|
||||
{
|
||||
INT1 ai1Cmd[OS_MAX_MSG_SIZE] = {0};
|
||||
INT4 i4Ret = ONLP_STATUS_OK;
|
||||
FILE *pFd = NULL;
|
||||
|
||||
sprintf(ai1Cmd, "ipmitool raw 0x38 0xB %d %d", u4FanNumber, u4Percentage);
|
||||
|
||||
pFd = popen(ai1Cmd, "r");
|
||||
|
||||
if (pFd != NULL)
|
||||
{
|
||||
pclose(pFd);
|
||||
}
|
||||
else
|
||||
{
|
||||
i4Ret = ONLP_STATUS_E_INTERNAL;
|
||||
AIM_LOG_ERROR("Execute command \"%s\" failed (ret: %d)", ai1Cmd, i4Ret);
|
||||
}
|
||||
|
||||
return i4Ret;
|
||||
}
|
||||
|
||||
UINT4 MMI_XTOI (const UINT1* str)
|
||||
{
|
||||
INT4 digit = 0;
|
||||
UINT4 x = 0;
|
||||
|
||||
if ((*str == '0') && (*(str+1) == 'x')) str += 2;
|
||||
|
||||
while (*str)
|
||||
{
|
||||
if ((*str >= '0') && (*str <= '9'))
|
||||
{
|
||||
digit = *str - '0';
|
||||
}
|
||||
else if ((*str >= 'A') && (*str <= 'F'))
|
||||
{
|
||||
digit = 10 + *str - 'A';
|
||||
}
|
||||
else if ((*str >= 'a') && (*str <= 'f'))
|
||||
{
|
||||
digit = 10 + *str - 'a';
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
x *= 16;
|
||||
x += digit;
|
||||
str++;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2017 v=onl>
|
||||
*
|
||||
* Copyright 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_wb2448_log.h"
|
||||
|
||||
typedef unsigned int UINT4;
|
||||
typedef unsigned short UINT2;
|
||||
typedef unsigned char UINT1;
|
||||
typedef int INT4;
|
||||
typedef short INT2;
|
||||
typedef char INT1;
|
||||
|
||||
#define OS_MAX_MSG_SIZE 100
|
||||
|
||||
INT4 ifnOS_LINUX_BmcI2CGet(UINT1 u1Bus, UINT1 u1Dev, UINT4 u4Addr, UINT1 u1AddrLen, UINT4 *pu4RetData, UINT1 u1DataLen);
|
||||
INT4 ifnOS_LINUX_BmcI2CSet(UINT1 u1Bus, UINT1 u1Dev, UINT4 u4Addr, UINT1 u1AddrLen, UINT4 u4Data, UINT1 u1DataLen);
|
||||
INT4 ifnOS_LINUX_BmcI2CProbe(UINT1 u1Bus, UINT1 u1Dev);
|
||||
INT4 ifnBmcFanSpeedGet(INT1 *pi1FanName, UINT4 *pu4RetData);
|
||||
INT4 ifnBmcFanSpeedSet(UINT4 u4FanNumber, UINT4 u4Percentage);
|
||||
UINT4 MMI_XTOI (const UINT1* str);
|
||||
|
||||
#endif /* __PLATFORM_LIB_H__ */
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014, 2015 Big Switch Networks, Inc.
|
||||
* Copyright 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 <onlp/platformi/psui.h>
|
||||
#include "x86_64_delta_wb2448_int.h"
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <onlplib/mmap.h>
|
||||
|
||||
#include "platform_lib.h"
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do \
|
||||
{ \
|
||||
if(!ONLP_OID_IS_PSU(_id)) \
|
||||
{ \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define I2C_BUS 0x04
|
||||
#define CPLD_ADDR 0x28
|
||||
#define PSU_PRESENT_REGISTER 0x04
|
||||
#define PSU_STATUS_REGISTER 0x05
|
||||
#define PSU_ADDR_LEN 1
|
||||
#define PSU_DATA_LEN 1
|
||||
#define PSU_STATUS_ALL_GOOD 0xbf
|
||||
#define PSU_STATUS_PRESENT 0x30
|
||||
#define PSU_ID 1
|
||||
|
||||
/*
|
||||
* Get all information about the given PSU oid.
|
||||
*/
|
||||
static onlp_psu_info_t pinfo[] =
|
||||
{
|
||||
{ }, /* Not used */
|
||||
{
|
||||
{ ONLP_PSU_ID_CREATE(PSU_ID), "PSU", 0 },
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
onlp_psui_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
|
||||
{
|
||||
INT4 rv = ONLP_STATUS_OK;
|
||||
UINT4 u4PSUStatus = 0;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
*info = pinfo[ONLP_OID_ID_GET(id)];
|
||||
|
||||
rv = ifnOS_LINUX_BmcI2CGet(I2C_BUS, CPLD_ADDR, PSU_PRESENT_REGISTER, PSU_ADDR_LEN, &u4PSUStatus, PSU_DATA_LEN);
|
||||
|
||||
if(rv == ONLP_STATUS_OK)
|
||||
{
|
||||
if (u4PSUStatus != PSU_STATUS_PRESENT)
|
||||
{
|
||||
info->status &= ~ONLP_PSU_STATUS_PRESENT;
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AIM_LOG_ERROR("Unable to read PSU present status: %d\r\n", rv);
|
||||
}
|
||||
|
||||
info->status |= ONLP_PSU_STATUS_PRESENT;
|
||||
|
||||
u4PSUStatus = 0;
|
||||
|
||||
rv = ifnOS_LINUX_BmcI2CGet(I2C_BUS, CPLD_ADDR, PSU_STATUS_REGISTER, PSU_ADDR_LEN, &u4PSUStatus, PSU_DATA_LEN);
|
||||
|
||||
if(rv == ONLP_STATUS_OK)
|
||||
{
|
||||
if (u4PSUStatus != PSU_STATUS_ALL_GOOD)
|
||||
{
|
||||
info->status |= ONLP_PSU_STATUS_FAILED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AIM_LOG_ERROR("Unable to read PSU failed/good status: %d\r\n", rv);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_psui_ioctl(onlp_oid_t pid, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014, 2015 Big Switch Networks, Inc.
|
||||
* Copyright 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 <onlp/platformi/sfpi.h>
|
||||
#include <x86_64_delta_wb2448/x86_64_delta_wb2448_config.h>
|
||||
#include "x86_64_delta_wb2448_log.h"
|
||||
|
||||
#define SFP_PORT_BASE 49
|
||||
|
||||
static int sfp_count__ = X86_64_DELTA_WB2448_CONFIG_SFP_COUNT;
|
||||
|
||||
int
|
||||
onlp_sfpi_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap)
|
||||
{
|
||||
int p;
|
||||
|
||||
for(p = 0; p < sfp_count__; p++)
|
||||
{
|
||||
AIM_BITMAP_SET(bmap, p + SFP_PORT_BASE);
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_is_present(int port)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)
|
||||
{
|
||||
AIM_BITMAP_CLR_ALL(dst);
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function reads the SFPs idrom and returns in
|
||||
* in the data buffer provided.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_eeprom_read(int port, uint8_t data[256])
|
||||
{
|
||||
return ONLP_STATUS_E_MISSING;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_ioctl(int port, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014, 2015 Big Switch Networks, Inc.
|
||||
* Copyright 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 <onlp/platformi/sysi.h>
|
||||
#include <onlplib/crc32.h>
|
||||
#include <onlplib/file.h>
|
||||
|
||||
#include "x86_64_delta_wb2448_log.h"
|
||||
#include "platform_lib.h"
|
||||
|
||||
#define IDPROM_PATH "/sys/class/i2c-adapter/i2c-0/0-0053/eeprom"
|
||||
|
||||
#define NUM_OF_THERMAL_ON_MAIN_BROAD 5
|
||||
#define NUM_OF_LED_ON_MAIN_BROAD 3
|
||||
#define NUM_OF_PSU_ON_MAIN_BROAD 1
|
||||
#define NUM_OF_FAN_ON_MAIN_BROAD 2
|
||||
|
||||
#define I2C_BUS 0x04
|
||||
#define CPLD_ADDR 0x28
|
||||
#define CPLD_VERSION_REGISTER 0x08
|
||||
#define CPLD_VERSION_ADDR_LEN 0x01
|
||||
#define CPLD_VERSION_DATA_LEN 0x01
|
||||
#define CPLD_VERSION_OFFSET 5
|
||||
|
||||
const char*
|
||||
onlp_sysi_platform_get(void)
|
||||
{
|
||||
return "x86-64-delta-wb2448-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_INTERNAL;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sysi_platform_info_get(onlp_platform_info_t* pi)
|
||||
{
|
||||
INT4 rv = ONLP_STATUS_OK;
|
||||
UINT4 u4Data = 0;
|
||||
|
||||
rv = ifnOS_LINUX_BmcI2CGet(I2C_BUS, CPLD_ADDR, CPLD_VERSION_REGISTER, CPLD_VERSION_ADDR_LEN, &u4Data, CPLD_VERSION_DATA_LEN);
|
||||
|
||||
if(rv == ONLP_STATUS_OK)
|
||||
{
|
||||
u4Data = u4Data >> CPLD_VERSION_OFFSET;
|
||||
|
||||
pi->cpld_versions = aim_fstrdup("%d", u4Data);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
/* 5 Thermal sensors on the chassis */
|
||||
for (i = 1; i <= NUM_OF_THERMAL_ON_MAIN_BROAD; i++)
|
||||
{
|
||||
*e++ = ONLP_THERMAL_ID_CREATE(i);
|
||||
}
|
||||
|
||||
/* 3 LEDs on the chassis */
|
||||
for (i = 1; i <= NUM_OF_LED_ON_MAIN_BROAD; i++)
|
||||
{
|
||||
*e++ = ONLP_LED_ID_CREATE(i);
|
||||
}
|
||||
|
||||
/* 1 PSUs on the chassis */
|
||||
for (i = 1; i <= NUM_OF_PSU_ON_MAIN_BROAD; i++)
|
||||
{
|
||||
*e++ = ONLP_PSU_ID_CREATE(i);
|
||||
}
|
||||
|
||||
/* 2 Fans on the chassis */
|
||||
for (i = 1; i <= NUM_OF_FAN_ON_MAIN_BROAD; i++)
|
||||
{
|
||||
*e++ = ONLP_FAN_ID_CREATE(i);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sysi_ioctl(int code, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014, 2015 Big Switch Networks, Inc.
|
||||
* Copyright 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>
|
||||
************************************************************
|
||||
*
|
||||
* Thermal Sensor Platform Implementation.
|
||||
*
|
||||
***********************************************************/
|
||||
#include <onlp/platformi/thermali.h>
|
||||
#include "x86_64_delta_wb2448_log.h"
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <onlplib/mmap.h>
|
||||
#include <onlplib/i2c.h>
|
||||
|
||||
#include "platform_lib.h"
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do \
|
||||
{ \
|
||||
if(!ONLP_OID_IS_THERMAL(_id)) \
|
||||
{ \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define THERMAL_CPU_I2C_BUS 0x00
|
||||
#define THERMAL_12_I2C_BUS 0x01
|
||||
#define THERMAL_34_I2C_BUS 0x04
|
||||
#define THERMAL_CPU_ADDR 0x4D
|
||||
#define THERMAL_1_ADDR 0x4B
|
||||
#define THERMAL_2_ADDR 0x4C
|
||||
#define THERMAL_3_ADDR 0x49
|
||||
#define THERMAL_4_ADDR 0x4A
|
||||
#define THERMAL_REGISTER 0x00
|
||||
#define THERMAL_ADDR_LEN 0x01
|
||||
#define THERMAL_DATA_LEN 0x01
|
||||
|
||||
enum onlp_thermal_id
|
||||
{
|
||||
THERMAL_RESERVED = 0,
|
||||
THERMAL_CPU_CORE,
|
||||
THERMAL_1_ON_MAIN_BROAD,
|
||||
THERMAL_2_ON_MAIN_BROAD,
|
||||
THERMAL_3_ON_MAIN_BROAD,
|
||||
THERMAL_4_ON_MAIN_BROAD,
|
||||
};
|
||||
|
||||
/* Static values */
|
||||
static onlp_thermal_info_t linfo[] = {
|
||||
{ }, /* Not used */
|
||||
{
|
||||
{ ONLP_THERMAL_ID_CREATE(THERMAL_CPU_CORE), "CPU Core", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
|
||||
},
|
||||
{
|
||||
{ ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_MAIN_BROAD), "Chassis Thermal Sensor 1", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
|
||||
},
|
||||
{
|
||||
{ ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_MAIN_BROAD), "Chassis Thermal Sensor 2", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
|
||||
},
|
||||
{
|
||||
{ ONLP_THERMAL_ID_CREATE(THERMAL_3_ON_MAIN_BROAD), "Chassis Thermal Sensor 3", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
|
||||
},
|
||||
{
|
||||
{ ONLP_THERMAL_ID_CREATE(THERMAL_4_ON_MAIN_BROAD), "Chassis Thermal Sensor 4", 0},
|
||||
ONLP_THERMAL_STATUS_PRESENT,
|
||||
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
|
||||
},
|
||||
};
|
||||
|
||||
int
|
||||
onlp_thermali_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info)
|
||||
{
|
||||
INT4 rv = ONLP_STATUS_OK;
|
||||
INT4 local_id = 0;
|
||||
INT4 temp_base = 1000;
|
||||
UINT4 u4Data = 0;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
|
||||
*info = linfo[ONLP_OID_ID_GET(id)];
|
||||
|
||||
switch(local_id)
|
||||
{
|
||||
case THERMAL_CPU_CORE:
|
||||
rv = ifnOS_LINUX_BmcI2CGet(THERMAL_CPU_I2C_BUS, THERMAL_CPU_ADDR, THERMAL_REGISTER, THERMAL_ADDR_LEN, &u4Data, THERMAL_DATA_LEN);
|
||||
break;
|
||||
|
||||
case THERMAL_1_ON_MAIN_BROAD:
|
||||
rv = ifnOS_LINUX_BmcI2CGet(THERMAL_12_I2C_BUS, THERMAL_1_ADDR, THERMAL_REGISTER, THERMAL_ADDR_LEN, &u4Data, THERMAL_DATA_LEN);
|
||||
break;
|
||||
|
||||
case THERMAL_2_ON_MAIN_BROAD:
|
||||
rv = ifnOS_LINUX_BmcI2CGet(THERMAL_12_I2C_BUS, THERMAL_2_ADDR, THERMAL_REGISTER, THERMAL_ADDR_LEN, &u4Data, THERMAL_DATA_LEN);
|
||||
break;
|
||||
|
||||
case THERMAL_3_ON_MAIN_BROAD:
|
||||
rv = ifnOS_LINUX_BmcI2CGet(THERMAL_34_I2C_BUS, THERMAL_3_ADDR, THERMAL_REGISTER, THERMAL_ADDR_LEN, &u4Data, THERMAL_DATA_LEN);
|
||||
break;
|
||||
|
||||
case THERMAL_4_ON_MAIN_BROAD:
|
||||
rv = ifnOS_LINUX_BmcI2CGet(THERMAL_34_I2C_BUS, THERMAL_4_ADDR, THERMAL_REGISTER, THERMAL_ADDR_LEN, &u4Data, THERMAL_DATA_LEN);
|
||||
break;
|
||||
|
||||
default:
|
||||
AIM_LOG_ERROR("Invalid Thermal ID!!\n");
|
||||
return ONLP_STATUS_E_PARAM;
|
||||
}
|
||||
|
||||
if(rv == ONLP_STATUS_OK)
|
||||
{
|
||||
info->mcelsius = u4Data * temp_base;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_thermali_ioctl(int id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <x86_64_delta_wb2448/x86_64_delta_wb2448_config.h>
|
||||
|
||||
/* <auto.start.cdefs(x86_64_delta_wb2448_CONFIG_HEADER).source> */
|
||||
#define __x86_64_delta_wb2448_config_STRINGIFY_NAME(_x) #_x
|
||||
#define __x86_64_delta_wb2448_config_STRINGIFY_VALUE(_x) __x86_64_delta_wb2448_config_STRINGIFY_NAME(_x)
|
||||
x86_64_delta_wb2448_config_settings_t x86_64_delta_wb2448_config_settings[] =
|
||||
{
|
||||
#ifdef X86_64_DELTA_WB2448_CONFIG_INCLUDE_LOGGING
|
||||
{ __x86_64_delta_wb2448_config_STRINGIFY_NAME(X86_64_DELTA_WB2448_CONFIG_INCLUDE_LOGGING), __x86_64_delta_wb2448_config_STRINGIFY_VALUE(X86_64_DELTA_WB2448_CONFIG_INCLUDE_LOGGING) },
|
||||
#else
|
||||
{ X86_64_DELTA_WB2448_CONFIG_INCLUDE_LOGGING(__x86_64_delta_wb2448_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_WB2448_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
{ __x86_64_delta_wb2448_config_STRINGIFY_NAME(X86_64_DELTA_WB2448_CONFIG_LOG_OPTIONS_DEFAULT), __x86_64_delta_wb2448_config_STRINGIFY_VALUE(X86_64_DELTA_WB2448_CONFIG_LOG_OPTIONS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_DELTA_WB2448_CONFIG_LOG_OPTIONS_DEFAULT(__x86_64_delta_wb2448_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_WB2448_CONFIG_LOG_BITS_DEFAULT
|
||||
{ __x86_64_delta_wb2448_config_STRINGIFY_NAME(X86_64_DELTA_WB2448_CONFIG_LOG_BITS_DEFAULT), __x86_64_delta_wb2448_config_STRINGIFY_VALUE(X86_64_DELTA_WB2448_CONFIG_LOG_BITS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_DELTA_WB2448_CONFIG_LOG_BITS_DEFAULT(__x86_64_delta_wb2448_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_WB2448_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
{ __x86_64_delta_wb2448_config_STRINGIFY_NAME(X86_64_DELTA_WB2448_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __x86_64_delta_wb2448_config_STRINGIFY_VALUE(X86_64_DELTA_WB2448_CONFIG_LOG_CUSTOM_BITS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_DELTA_WB2448_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__x86_64_delta_wb2448_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB
|
||||
{ __x86_64_delta_wb2448_config_STRINGIFY_NAME(X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB), __x86_64_delta_wb2448_config_STRINGIFY_VALUE(X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB) },
|
||||
#else
|
||||
{ X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB(__x86_64_delta_wb2448_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_WB2448_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
{ __x86_64_delta_wb2448_config_STRINGIFY_NAME(X86_64_DELTA_WB2448_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __x86_64_delta_wb2448_config_STRINGIFY_VALUE(X86_64_DELTA_WB2448_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) },
|
||||
#else
|
||||
{ X86_64_DELTA_WB2448_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__x86_64_delta_wb2448_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_WB2448_CONFIG_INCLUDE_UCLI
|
||||
{ __x86_64_delta_wb2448_config_STRINGIFY_NAME(X86_64_DELTA_WB2448_CONFIG_INCLUDE_UCLI), __x86_64_delta_wb2448_config_STRINGIFY_VALUE(X86_64_DELTA_WB2448_CONFIG_INCLUDE_UCLI) },
|
||||
#else
|
||||
{ X86_64_DELTA_WB2448_CONFIG_INCLUDE_UCLI(__x86_64_delta_wb2448_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_WB2448_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION
|
||||
{ __x86_64_delta_wb2448_config_STRINGIFY_NAME(X86_64_DELTA_WB2448_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION), __x86_64_delta_wb2448_config_STRINGIFY_VALUE(X86_64_DELTA_WB2448_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION) },
|
||||
#else
|
||||
{ X86_64_DELTA_WB2448_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION(__x86_64_delta_wb2448_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_WB2448_CONFIG_SFP_COUNT
|
||||
{ __x86_64_delta_wb2448_config_STRINGIFY_NAME(X86_64_DELTA_WB2448_CONFIG_SFP_COUNT), __x86_64_delta_wb2448_config_STRINGIFY_VALUE(X86_64_DELTA_WB2448_CONFIG_SFP_COUNT) },
|
||||
#else
|
||||
{ X86_64_DELTA_WB2448_CONFIG_SFP_COUNT(__x86_64_delta_wb2448_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_DELTA_WB2448_CONFIG_FAN_RPM_MAX
|
||||
{ __x86_64_delta_wb2448_config_STRINGIFY_NAME(X86_64_DELTA_WB2448_CONFIG_FAN_RPM_MAX), __x86_64_delta_wb2448_config_STRINGIFY_VALUE(X86_64_DELTA_WB2448_CONFIG_FAN_RPM_MAX) },
|
||||
#else
|
||||
{ X86_64_DELTA_WB2448_CONFIG_FAN_RPM_MAX(__x86_64_delta_wb2448_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
#undef __x86_64_delta_wb2448_config_STRINGIFY_VALUE
|
||||
#undef __x86_64_delta_wb2448_config_STRINGIFY_NAME
|
||||
|
||||
const char*
|
||||
x86_64_delta_wb2448_config_lookup(const char* setting)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; x86_64_delta_wb2448_config_settings[i].name; i++) {
|
||||
if(strcmp(x86_64_delta_wb2448_config_settings[i].name, setting)) {
|
||||
return x86_64_delta_wb2448_config_settings[i].value;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
x86_64_delta_wb2448_config_show(struct aim_pvs_s* pvs)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; x86_64_delta_wb2448_config_settings[i].name; i++) {
|
||||
aim_printf(pvs, "%s = %s\n", x86_64_delta_wb2448_config_settings[i].name, x86_64_delta_wb2448_config_settings[i].value);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/* <auto.end.cdefs(x86_64_delta_wb2448_CONFIG_HEADER).source> */
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <x86_64_delta_wb2448/x86_64_delta_wb2448_config.h>
|
||||
|
||||
/* <--auto.start.enum(ALL).source> */
|
||||
/* <auto.end.enum(ALL).source> */
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* x86_64_delta_wb2448 Internal Header
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __X86_64_DELTA_WB2448_INT_H__
|
||||
#define __X86_64_DELTA_WB2448_INT_H__
|
||||
|
||||
#include <x86_64_delta_wb2448/x86_64_delta_wb2448_config.h>
|
||||
|
||||
|
||||
#endif /* __X86_64_DELTA_WB2448_INT_H__ */
|
||||
@@ -0,0 +1,21 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <x86_64_delta_wb2448/x86_64_delta_wb2448_config.h>
|
||||
|
||||
#include "x86_64_delta_wb2448_log.h"
|
||||
/*
|
||||
* x86_64_delta_wb2448 log struct.
|
||||
*/
|
||||
AIM_LOG_STRUCT_DEFINE
|
||||
(
|
||||
X86_64_DELTA_WB2448_CONFIG_LOG_OPTIONS_DEFAULT,
|
||||
X86_64_DELTA_WB2448_CONFIG_LOG_BITS_DEFAULT,
|
||||
NULL, /* Custom log map */
|
||||
X86_64_DELTA_WB2448_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef __X86_64_DELTA_WB2448_LOG_H__
|
||||
#define __X86_64_DELTA_WB2448_LOG_H__
|
||||
|
||||
#define AIM_LOG_MODULE_NAME x86_64_delta_wb2448
|
||||
#include <AIM/aim_log.h>
|
||||
|
||||
#endif /* __X86_64_DELTA_WB2448_LOG_H__ */
|
||||
@@ -0,0 +1,26 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <x86_64_delta_wb2448/x86_64_delta_wb2448_config.h>
|
||||
|
||||
#include "x86_64_delta_wb2448_log.h"
|
||||
|
||||
static int
|
||||
datatypes_init__(void)
|
||||
{
|
||||
#define x86_64_DELTA_WB2448_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
|
||||
#include <x86_64_delta_wb2448/x86_64_delta_wb2448.x>
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __x86_64_delta_wb2448_module_init__(void)
|
||||
{
|
||||
AIM_LOG_STRUCT_REGISTER();
|
||||
datatypes_init__();
|
||||
}
|
||||
|
||||
int __onlp_platform_version__ = 1;
|
||||
@@ -0,0 +1,64 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <x86_64_delta_wb2448/x86_64_delta_wb2448_config.h>
|
||||
|
||||
#if X86_64_DELTA_WB2448_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_wb2448_ucli_ucli__config__(ucli_context_t* uc)
|
||||
{
|
||||
UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_delta_wb2448)
|
||||
}
|
||||
|
||||
/* <auto.ucli.handlers.start> */
|
||||
/******************************************************************************
|
||||
*
|
||||
* These handler table(s) were autogenerated from the symbols in this
|
||||
* source file.
|
||||
*
|
||||
*****************************************************************************/
|
||||
static ucli_command_handler_f x86_64_delta_wb2448_ucli_ucli_handlers__[] =
|
||||
{
|
||||
x86_64_delta_wb2448_ucli_ucli__config__,
|
||||
NULL
|
||||
};
|
||||
/******************************************************************************/
|
||||
/* <auto.ucli.handlers.end> */
|
||||
|
||||
static ucli_module_t
|
||||
x86_64_delta_wb2448_ucli_module__ =
|
||||
{
|
||||
"x86_64_delta_wb2448_ucli",
|
||||
NULL,
|
||||
x86_64_delta_wb2448_ucli_ucli_handlers__,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
ucli_node_t*
|
||||
x86_64_delta_wb2448_ucli_node_create(void)
|
||||
{
|
||||
ucli_node_t* n;
|
||||
ucli_module_init(&x86_64_delta_wb2448_ucli_module__);
|
||||
n = ucli_node_create("x86_64_delta_wb2448", NULL, &x86_64_delta_wb2448_ucli_module__);
|
||||
ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_delta_wb2448"));
|
||||
return n;
|
||||
}
|
||||
|
||||
#else
|
||||
void*
|
||||
x86_64_delta_wb2448_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-wb2448 REVISION=r0
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# platform-config for DELTA wb2448
|
||||
######################################################################
|
||||
|
||||
x86-64-delta-wb2448-r0:
|
||||
|
||||
grub:
|
||||
|
||||
serial: >-
|
||||
--port=0x3f8
|
||||
--speed=115200
|
||||
--word=8
|
||||
--parity=no
|
||||
--stop=1
|
||||
|
||||
kernel:
|
||||
<<: *kernel-3-16
|
||||
|
||||
args: >-
|
||||
nopat
|
||||
console=ttyS0,115200n8
|
||||
pci=noacpi
|
||||
acpi_enforce_resources=no
|
||||
|
||||
##network
|
||||
## interfaces:
|
||||
## ma1:
|
||||
## name: ~
|
||||
## syspath: pci0000:00/0000:00:03.0
|
||||
@@ -0,0 +1,16 @@
|
||||
from onl.platform.base import *
|
||||
from onl.platform.delta import *
|
||||
|
||||
class OnlPlatform_x86_64_delta_wb2448_r0(OnlPlatformDelta,
|
||||
OnlPlatformPortConfig_48x1_4x10):
|
||||
PLATFORM='x86-64-delta-wb2448-r0'
|
||||
MODEL="wb2448"
|
||||
SYS_OBJECT_ID=".2448.1"
|
||||
|
||||
def baseconfig(self):
|
||||
|
||||
# initiate eeprom
|
||||
self.new_i2c_device('24c02', 0x53, 0)
|
||||
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user