mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-25 17:27:01 +00:00
Merge pull request #208 from raymondhuey/netberg
Support Netberg Platform
This commit is contained in:
@@ -0,0 +1,400 @@
|
||||
diff -Nu a/drivers/net/ethernet/intel/igb/bcm_phy.c b/drivers/net/ethernet/intel/igb/bcm_phy.c
|
||||
--- a/drivers/net/ethernet/intel/igb/bcm_phy.c 1970-01-01 08:00:00.000000000 +0800
|
||||
+++ b/drivers/net/ethernet/intel/igb/bcm_phy.c 2017-06-20 17:00:46.000000000 +0800
|
||||
@@ -0,0 +1,206 @@
|
||||
+#include "e1000_hw.h"
|
||||
+#include "linux/brcmphy.h"
|
||||
+
|
||||
+/*
|
||||
+ * 1000Base-T Control Register
|
||||
+ */
|
||||
+#define MII_BCM54XX_AUX_CTL_ENCODE(val) (((val & 0x7) << 12)|(val & 0x7))
|
||||
+
|
||||
+/*
|
||||
+ * MII Link Advertisment
|
||||
+ */
|
||||
+#define MII_ANA_ASF (1 << 0) /* Advertise Selector Field */
|
||||
+#define MII_ANA_HD_10 (1 << 5) /* Half duplex 10Mb/s supported */
|
||||
+#define MII_ANA_FD_10 (1 << 6) /* Full duplex 10Mb/s supported */
|
||||
+#define MII_ANA_HD_100 (1 << 7) /* Half duplex 100Mb/s supported */
|
||||
+#define MII_ANA_FD_100 (1 << 8) /* Full duplex 100Mb/s supported */
|
||||
+#define MII_ANA_T4 (1 << 9) /* T4 */
|
||||
+#define MII_ANA_PAUSE (1 << 10)/* Pause supported */
|
||||
+#define MII_ANA_ASYM_PAUSE (1 << 11)/* Asymmetric pause supported */
|
||||
+#define MII_ANA_RF (1 << 13)/* Remote fault */
|
||||
+#define MII_ANA_NP (1 << 15)/* Next Page */
|
||||
+
|
||||
+#define MII_ANA_ASF_802_3 (1) /* 802.3 PHY */
|
||||
+
|
||||
+/*
|
||||
+ * BCM54XX: Shadow registers
|
||||
+ * Shadow values go into bits [14:10] of register 0x1c to select a shadow
|
||||
+ * register to access.
|
||||
+ */
|
||||
+#define BCM54XX_SHD_AUTODETECT 0x1e /* 11110: Auto detect Regisrer */
|
||||
+#define BCM54XX_SHD_MODE 0x1f /* 11111: Mode Control Register */
|
||||
+#define BCM54XX_SHD_MODE_SER 1<<6
|
||||
+
|
||||
+/*
|
||||
+ * Indirect register access functions for the 1000BASE-T/100BASE-TX/10BASE-T
|
||||
+ * 0x1c shadow registers.
|
||||
+ */
|
||||
+
|
||||
+int bcmphy_write(struct e1000_hw *hw,u32 reg, u16 regval)
|
||||
+{
|
||||
+ u32 ret;
|
||||
+ struct e1000_phy_info *phy = &hw->phy;
|
||||
+
|
||||
+ ret = phy->ops.write_reg(hw,reg, regval);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+u16 bcmphy_read(struct e1000_hw *hw, u32 reg)
|
||||
+{
|
||||
+ u16 val;
|
||||
+ struct e1000_phy_info *phy = &hw->phy;
|
||||
+
|
||||
+ phy->ops.read_reg(hw,reg, &val);
|
||||
+ return val;
|
||||
+}
|
||||
+
|
||||
+static int bcm54xx_shadow_read(struct e1000_hw *hw, u16 shadow)
|
||||
+{
|
||||
+ bcmphy_write(hw, MII_BCM54XX_SHD, MII_BCM54XX_SHD_VAL(shadow));
|
||||
+ return MII_BCM54XX_SHD_DATA(bcmphy_read(hw, MII_BCM54XX_SHD));
|
||||
+}
|
||||
+
|
||||
+static int bcm54xx_shadow_write(struct e1000_hw *hw, u16 shadow, u16 val)
|
||||
+{
|
||||
+ return bcmphy_write(hw, MII_BCM54XX_SHD,
|
||||
+ MII_BCM54XX_SHD_WRITE |
|
||||
+ MII_BCM54XX_SHD_VAL(shadow) |
|
||||
+ MII_BCM54XX_SHD_DATA(val));
|
||||
+}
|
||||
+
|
||||
+static int bcm54xx_auxctl_write(struct e1000_hw *hw, u16 regnum, u16 val)
|
||||
+{
|
||||
+ return bcmphy_write(hw, MII_BCM54XX_AUX_CTL, (regnum | val));
|
||||
+}
|
||||
+
|
||||
+static int bcm54xx_config_init(struct e1000_hw *hw)
|
||||
+{
|
||||
+ int reg, err;
|
||||
+
|
||||
+ reg = bcmphy_read(hw, MII_BCM54XX_ECR);
|
||||
+ if (reg < 0)
|
||||
+ return reg;
|
||||
+
|
||||
+ /* Mask interrupts globally. */
|
||||
+ reg |= MII_BCM54XX_ECR_IM;
|
||||
+ err = bcmphy_write(hw, MII_BCM54XX_ECR, reg);
|
||||
+ if (err < 0)
|
||||
+ return err;
|
||||
+
|
||||
+ /* Unmask events we are interested in. */
|
||||
+ reg = ~(MII_BCM54XX_INT_DUPLEX |
|
||||
+ MII_BCM54XX_INT_SPEED |
|
||||
+ MII_BCM54XX_INT_LINK);
|
||||
+ err = bcmphy_write(hw, MII_BCM54XX_IMR, reg);
|
||||
+ if (err < 0)
|
||||
+ return err;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void bcm54616s_linkup(struct e1000_hw *hw, int speed, int duplex)
|
||||
+{
|
||||
+ u16 regval;
|
||||
+
|
||||
+ /* set speed and full duplex*/
|
||||
+ regval = bcmphy_read(hw,PHY_CONTROL);
|
||||
+ regval &= ~(MII_CR_SPEED_SELECT_MSB |
|
||||
+ MII_CR_SPEED_SELECT_LSB |
|
||||
+ MII_CR_FULL_DUPLEX);
|
||||
+
|
||||
+ switch(speed) {
|
||||
+ case SPEED_10:
|
||||
+ regval |= MII_CR_SPEED_10;
|
||||
+ break;
|
||||
+ case SPEED_100:
|
||||
+ regval |= MII_CR_SPEED_100;
|
||||
+ break;
|
||||
+ case SPEED_1000:
|
||||
+ default:
|
||||
+ regval |= MII_CR_SPEED_1000;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ switch(duplex) {
|
||||
+ case FULL_DUPLEX:
|
||||
+ regval |= MII_CR_FULL_DUPLEX;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ bcmphy_write(hw,PHY_CONTROL, regval);
|
||||
+
|
||||
+ regval = bcmphy_read(hw, PHY_CONTROL);
|
||||
+ regval &= ~(MII_CR_ISOLATE);
|
||||
+ bcmphy_write(hw, PHY_CONTROL, regval);
|
||||
+}
|
||||
+
|
||||
+int bcm54616s_config_init(struct e1000_hw *hw)
|
||||
+{
|
||||
+ int err, reg;
|
||||
+ u16 regval;
|
||||
+ int i;
|
||||
+
|
||||
+ /* reset PHY */
|
||||
+ regval = (1<<15);
|
||||
+ bcmphy_write(hw, PHY_CONTROL, regval);
|
||||
+
|
||||
+ mdelay(10);
|
||||
+
|
||||
+ /* disable Power down and iso */
|
||||
+ regval = bcmphy_read(hw,PHY_CONTROL);
|
||||
+ regval &= ~(MII_CR_POWER_DOWN | MII_CR_ISOLATE);
|
||||
+ bcmphy_write(hw, PHY_CONTROL, regval);
|
||||
+
|
||||
+ /* disable suport I */
|
||||
+ /*0000 0100 1100 0010 */
|
||||
+ bcm54xx_auxctl_write(hw, 0, 0x04c2);
|
||||
+
|
||||
+ regval = bcmphy_read(hw, MII_BCM54XX_AUX_CTL);
|
||||
+
|
||||
+ /* set 1000base-T */
|
||||
+ regval = bcmphy_read(hw, PHY_1000T_CTRL);
|
||||
+ regval |= (CR_1000T_FD_CAPS | CR_1000T_REPEATER_DTE);
|
||||
+ bcmphy_write(hw, PHY_1000T_CTRL, regval);
|
||||
+
|
||||
+ /* set ctrl */
|
||||
+ regval = (MII_CR_SPEED_1000 |
|
||||
+ MII_CR_FULL_DUPLEX |
|
||||
+ MII_CR_SPEED_SELECT_MSB);
|
||||
+ bcmphy_write(hw, PHY_CONTROL, regval);
|
||||
+
|
||||
+ /* Setup read from auxilary control shadow register 7 */
|
||||
+ bcmphy_write(hw, MII_BCM54XX_AUX_CTL, MII_BCM54XX_AUX_CTL_ENCODE(7));
|
||||
+
|
||||
+ /* Read Misc Control register */
|
||||
+ reg = ((bcmphy_read(hw, MII_BCM54XX_AUX_CTL) & 0x8FFF) | 0x8010);
|
||||
+ bcmphy_write(hw, MII_BCM54XX_AUX_CTL, reg);
|
||||
+
|
||||
+ /* Enable auto-detect and copper prefer */
|
||||
+ bcm54xx_shadow_write(hw, BCM54XX_SHD_AUTODETECT, 0x31);
|
||||
+
|
||||
+ err = bcm54xx_config_init(hw);
|
||||
+
|
||||
+ /* set link parner */
|
||||
+ regval = MII_ANA_ASF_802_3;
|
||||
+ regval |= MII_ANA_HD_10;
|
||||
+ regval |= MII_ANA_HD_100;
|
||||
+ regval |= MII_ANA_FD_10;
|
||||
+ regval |= MII_ANA_FD_100;
|
||||
+ regval |= MII_ANA_ASYM_PAUSE;
|
||||
+ regval |= (MII_ANA_PAUSE | MII_ANA_ASYM_PAUSE);
|
||||
+ regval |= MII_ANA_PAUSE;
|
||||
+ bcmphy_write(hw, PHY_AUTONEG_ADV, reg);
|
||||
+
|
||||
+ i=0;
|
||||
+ while (1) {
|
||||
+ regval = bcm54xx_shadow_read(hw,BCM54XX_SHD_MODE);
|
||||
+ if (regval & BCM54XX_SHD_MODE_SER)
|
||||
+ break;
|
||||
+ if (i++ > 500) {
|
||||
+ //printk("SERDES no link %x\n",regval);
|
||||
+ break;
|
||||
+ }
|
||||
+ mdelay(1); /* 1 ms */
|
||||
+ }
|
||||
+ return err;
|
||||
+}
|
||||
diff -Nu a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
|
||||
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c 2017-06-20 16:44:29.000000000 +0800
|
||||
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c 2017-06-20 17:00:52.000000000 +0800
|
||||
@@ -317,6 +317,10 @@
|
||||
break;
|
||||
case BCM54616_E_PHY_ID:
|
||||
phy->type = e1000_phy_bcm54616;
|
||||
+ phy->ops.check_polarity = NULL;
|
||||
+ phy->ops.get_info = igb_get_phy_info_bcm;
|
||||
+ phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_bcm;
|
||||
+ bcm54616s_config_init(hw);
|
||||
break;
|
||||
case BCM50210S_E_PHY_ID:
|
||||
break;
|
||||
@@ -1636,6 +1640,7 @@
|
||||
ret_val = igb_e1000_copper_link_setup_82577(hw);
|
||||
break;
|
||||
case e1000_phy_bcm54616:
|
||||
+ ret_val = igb_copper_link_setup_bcm(hw);
|
||||
break;
|
||||
case e1000_phy_bcm5461s:
|
||||
break;
|
||||
diff -Nu a/drivers/net/ethernet/intel/igb/e1000_82575.h b/drivers/net/ethernet/intel/igb/e1000_82575.h
|
||||
--- a/drivers/net/ethernet/intel/igb/e1000_82575.h 2017-06-20 16:44:27.000000000 +0800
|
||||
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.h 2017-06-20 17:00:57.000000000 +0800
|
||||
@@ -25,6 +25,8 @@
|
||||
#ifndef _E1000_82575_H_
|
||||
#define _E1000_82575_H_
|
||||
|
||||
+extern void bcm54616s_linkup(struct e1000_hw *hw,int speed , int duplex);
|
||||
+extern int bcm54616s_config_init(struct e1000_hw *hw);
|
||||
#define ID_LED_DEFAULT_82575_SERDES ((ID_LED_DEF1_DEF2 << 12) | \
|
||||
(ID_LED_DEF1_DEF2 << 8) | \
|
||||
(ID_LED_DEF1_DEF2 << 4) | \
|
||||
diff -Nu a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c
|
||||
--- a/drivers/net/ethernet/intel/igb/e1000_phy.c 2017-06-20 16:44:27.000000000 +0800
|
||||
+++ b/drivers/net/ethernet/intel/igb/e1000_phy.c 2017-06-20 17:01:05.000000000 +0800
|
||||
@@ -1187,6 +1187,19 @@
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
|
||||
+s32 igb_copper_link_setup_bcm(struct e1000_hw *hw)
|
||||
+{
|
||||
+ struct e1000_phy_info *phy = &hw->phy;
|
||||
+ s32 ret_val;
|
||||
+ u16 phy_data;
|
||||
+
|
||||
+ ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data);
|
||||
+ phy_data &= ~(MII_CR_ISOLATE);
|
||||
+ ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* e1000_copper_link_setup_m88_gen2 - Setup m88 PHY's for copper link
|
||||
* @hw: pointer to the HW structure
|
||||
@@ -1720,6 +1733,62 @@
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
+s32 igb_phy_force_speed_duplex_bcm(struct e1000_hw *hw)
|
||||
+{
|
||||
+ struct e1000_phy_info *phy = &hw->phy;
|
||||
+ s32 ret_val;
|
||||
+ u16 phy_data;
|
||||
+ bool link;
|
||||
+
|
||||
+ ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data);
|
||||
+ if (ret_val)
|
||||
+ return ret_val;
|
||||
+
|
||||
+ e1000_phy_force_speed_duplex_setup(hw, &phy_data);
|
||||
+
|
||||
+ phy_data &= ~(MII_CR_POWER_DOWN | MII_CR_ISOLATE);
|
||||
+ ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data);
|
||||
+ if (ret_val)
|
||||
+ return ret_val;
|
||||
+
|
||||
+ /* Clear Auto-Crossover to force MDI manually. IGP requires MDI
|
||||
+ * forced whenever speed and duplex are forced.
|
||||
+ */
|
||||
+ #if 0
|
||||
+ ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data);
|
||||
+ if (ret_val)
|
||||
+ return ret_val;
|
||||
+
|
||||
+ phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX;
|
||||
+ phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX;
|
||||
+
|
||||
+ ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data);
|
||||
+ if (ret_val)
|
||||
+ return ret_val;
|
||||
+
|
||||
+ hw_dbg("IGP PSCR: %X\n", phy_data);
|
||||
+ #endif
|
||||
+ udelay(1);
|
||||
+
|
||||
+ if (phy->autoneg_wait_to_complete) {
|
||||
+ DEBUGFUNC("Waiting for forced speed/duplex link on IGP phy.\n");
|
||||
+
|
||||
+ ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
|
||||
+ 100000, &link);
|
||||
+ if (ret_val)
|
||||
+ return ret_val;
|
||||
+
|
||||
+ if (!link)
|
||||
+ DEBUGFUNC("Link taking longer than expected.\n");
|
||||
+
|
||||
+ /* Try once more */
|
||||
+ ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
|
||||
+ 100000, &link);
|
||||
+ }
|
||||
+
|
||||
+ return ret_val;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* e1000_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY
|
||||
* @hw: pointer to the HW structure
|
||||
@@ -2614,6 +2683,29 @@
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
+}
|
||||
+
|
||||
+s32 igb_get_phy_info_bcm(struct e1000_hw *hw)
|
||||
+{
|
||||
+ struct e1000_phy_info *phy = &hw->phy;
|
||||
+ s32 ret_val;
|
||||
+ bool link;
|
||||
+
|
||||
+ if (phy->media_type != e1000_media_type_copper) {
|
||||
+ DEBUGFUNC("Phy info is only valid for copper media\n");
|
||||
+ return -E1000_ERR_CONFIG;
|
||||
+ }
|
||||
+
|
||||
+ ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link);
|
||||
+ if (ret_val)
|
||||
+ return ret_val;
|
||||
+
|
||||
+ if (!link) {
|
||||
+ DEBUGFUNC("Phy info is only valid if link is up\n");
|
||||
+ return -E1000_ERR_CONFIG;
|
||||
+ }
|
||||
+
|
||||
+ return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
diff -Nu a/drivers/net/ethernet/intel/igb/e1000_phy.h b/drivers/net/ethernet/intel/igb/e1000_phy.h
|
||||
--- a/drivers/net/ethernet/intel/igb/e1000_phy.h 2017-06-20 16:44:27.000000000 +0800
|
||||
+++ b/drivers/net/ethernet/intel/igb/e1000_phy.h 2017-06-20 17:01:24.000000000 +0800
|
||||
@@ -99,6 +99,9 @@
|
||||
s32 e1000_write_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 data,
|
||||
bool line_override);
|
||||
bool e1000_is_mphy_ready(struct e1000_hw *hw);
|
||||
+s32 igb_copper_link_setup_bcm(struct e1000_hw *hw);
|
||||
+s32 igb_phy_force_speed_duplex_bcm(struct e1000_hw *hw);
|
||||
+s32 igb_get_phy_info_bcm(struct e1000_hw *hw);
|
||||
|
||||
#define E1000_MAX_PHY_ADDR 8
|
||||
|
||||
diff -Nu a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
|
||||
--- a/drivers/net/ethernet/intel/igb/igb_main.c 2017-06-20 16:44:27.000000000 +0800
|
||||
+++ b/drivers/net/ethernet/intel/igb/igb_main.c 2017-06-20 17:01:29.000000000 +0800
|
||||
@@ -4814,6 +4814,14 @@
|
||||
&adapter->link_speed,
|
||||
&adapter->link_duplex);
|
||||
|
||||
+ switch (hw->phy.type) {
|
||||
+ case e1000_phy_bcm54616:
|
||||
+ bcm54616s_linkup(hw, adapter->link_speed, adapter->link_duplex);
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
ctrl = E1000_READ_REG(hw, E1000_CTRL);
|
||||
/* Links status message must follow this format */
|
||||
netdev_info(netdev,
|
||||
diff -Nu a/drivers/net/ethernet/intel/igb/Makefile b/drivers/net/ethernet/intel/igb/Makefile
|
||||
--- a/drivers/net/ethernet/intel/igb/Makefile 2017-06-20 16:44:27.000000000 +0800
|
||||
+++ b/drivers/net/ethernet/intel/igb/Makefile 2017-06-20 17:01:34.000000000 +0800
|
||||
@@ -35,4 +35,4 @@
|
||||
e1000_mac.o e1000_nvm.o e1000_phy.o e1000_mbx.o \
|
||||
e1000_i210.o igb_ptp.o igb_hwmon.o \
|
||||
e1000_manage.o igb_param.o kcompat.o e1000_api.o \
|
||||
- igb_vmdq.o igb_procfs.o igb_debugfs.o
|
||||
+ igb_vmdq.o igb_procfs.o igb_debugfs.o bcm_phy.o
|
||||
@@ -25,3 +25,4 @@ platform-powerpc-85xx-Makefile.patch
|
||||
platform-powerpc-dni-7448-r0.patch
|
||||
platform-powerpc-quanta-lb9-r0.patch
|
||||
driver-support-intel-igb-bcm50210-phy.patch
|
||||
driver-igb-netberg-aurora.patch
|
||||
|
||||
1
packages/platforms/netberg/Makefile
Executable file
1
packages/platforms/netberg/Makefile
Executable file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
1
packages/platforms/netberg/vendor-config/Makefile
Executable file
1
packages/platforms/netberg/vendor-config/Makefile
Executable file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
1
packages/platforms/netberg/vendor-config/PKG.yml
Executable file
1
packages/platforms/netberg/vendor-config/PKG.yml
Executable file
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/platform-config-vendor.yml VENDOR=netberg Vendor=Netberg
|
||||
7
packages/platforms/netberg/vendor-config/src/python/netberg/__init__.py
Executable file
7
packages/platforms/netberg/vendor-config/src/python/netberg/__init__.py
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from onl.platform.base import *
|
||||
|
||||
class OnlPlatformNetberg(OnlPlatformBase):
|
||||
MANUFACTURER='Netberg'
|
||||
PRIVATE_ENTERPRISE_NUMBER=47294
|
||||
1
packages/platforms/netberg/x86-64/Makefile
Executable file
1
packages/platforms/netberg/x86-64/Makefile
Executable file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
1
packages/platforms/netberg/x86-64/modules/Makefile
Executable file
1
packages/platforms/netberg/x86-64/modules/Makefile
Executable file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
1
packages/platforms/netberg/x86-64/modules/PKG.yml
Executable file
1
packages/platforms/netberg/x86-64/modules/PKG.yml
Executable file
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/arch-vendor-modules.yml ARCH=amd64 VENDOR=netberg KERNELS="onl-kernel-3.16-lts-x86-64-all:amd64"
|
||||
1
packages/platforms/netberg/x86-64/modules/builds/.gitignore
vendored
Executable file
1
packages/platforms/netberg/x86-64/modules/builds/.gitignore
vendored
Executable file
@@ -0,0 +1 @@
|
||||
lib
|
||||
6
packages/platforms/netberg/x86-64/modules/builds/Makefile
Executable file
6
packages/platforms/netberg/x86-64/modules/builds/Makefile
Executable file
@@ -0,0 +1,6 @@
|
||||
KERNELS := onl-kernel-3.16-lts-x86-64-all:amd64
|
||||
KMODULES := $(wildcard *.c)
|
||||
VENDOR := netberg
|
||||
BASENAME := common
|
||||
ARCH := x86_64
|
||||
include $(ONL)/make/kmodule.mk
|
||||
6307
packages/platforms/netberg/x86-64/modules/builds/hardware_monitor.c
Executable file
6307
packages/platforms/netberg/x86-64/modules/builds/hardware_monitor.c
Executable file
File diff suppressed because it is too large
Load Diff
2
packages/platforms/netberg/x86-64/x86-64-netberg-aurora-620-rangeley/.gitignore
vendored
Executable file
2
packages/platforms/netberg/x86-64/x86-64-netberg-aurora-620-rangeley/.gitignore
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
*x86*64*netberg*aurora*620*rangeley*.mk
|
||||
onlpdump.mk
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/no-platform-modules.yml ARCH=amd64 VENDOR=netberg BASENAME=x86-64-netberg-aurora-620-rangeley
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=x86-64-netberg-aurora-620-rangeley ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu
|
||||
@@ -0,0 +1,2 @@
|
||||
FILTER=src
|
||||
include $(ONL)/make/subdirs.mk
|
||||
@@ -0,0 +1,45 @@
|
||||
############################################################
|
||||
# <bsn.cl fy=2014 v=onl>
|
||||
#
|
||||
# Copyright 2014 BigSwitch Networks, Inc.
|
||||
#
|
||||
# Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
# either express or implied. See the License for the specific
|
||||
# language governing permissions and limitations under the
|
||||
# License.
|
||||
#
|
||||
# </bsn.cl>
|
||||
############################################################
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
include $(ONL)/make/config.amd64.mk
|
||||
|
||||
MODULE := libonlp-x86-64-netberg-aurora-620-rangeley
|
||||
include $(BUILDER)/standardinit.mk
|
||||
|
||||
DEPENDMODULES := AIM IOF x86_64_netberg_aurora_620_rangeley onlplib
|
||||
DEPENDMODULE_HEADERS := sff
|
||||
|
||||
include $(BUILDER)/dependmodules.mk
|
||||
|
||||
SHAREDLIB := libonlp-x86-64-netberg-aurora-620-rangeley.so
|
||||
$(SHAREDLIB)_TARGETS := $(ALL_TARGETS)
|
||||
include $(BUILDER)/so.mk
|
||||
.DEFAULT_GOAL := $(SHAREDLIB)
|
||||
|
||||
GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc
|
||||
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
|
||||
GLOBAL_CFLAGS += -fPIC
|
||||
GLOBAL_LINK_LIBS += -lpthread
|
||||
|
||||
include $(BUILDER)/targets.mk
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
############################################################
|
||||
# <bsn.cl fy=2014 v=onl>
|
||||
#
|
||||
# Copyright 2014 BigSwitch Networks, Inc.
|
||||
#
|
||||
# Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
# either express or implied. See the License for the specific
|
||||
# language governing permissions and limitations under the
|
||||
# License.
|
||||
#
|
||||
# </bsn.cl>
|
||||
############################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
include $(ONL)/make/config.amd64.mk
|
||||
|
||||
.DEFAULT_GOAL := onlpdump
|
||||
|
||||
MODULE := onlpdump
|
||||
include $(BUILDER)/standardinit.mk
|
||||
|
||||
DEPENDMODULES := AIM IOF onlp x86_64_netberg_aurora_620_rangeley onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS
|
||||
|
||||
include $(BUILDER)/dependmodules.mk
|
||||
|
||||
BINARY := onlpdump
|
||||
$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS)
|
||||
include $(BUILDER)/bin.mk
|
||||
|
||||
GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main
|
||||
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
|
||||
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
|
||||
GLOBAL_LINK_LIBS += -lpthread -lm
|
||||
|
||||
include $(BUILDER)/targets.mk
|
||||
@@ -0,0 +1 @@
|
||||
name: x86_64_netberg_aurora_620_rangeley
|
||||
@@ -0,0 +1,9 @@
|
||||
###############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
include $(ONL)/make/config.mk
|
||||
MODULE := x86_64_netberg_aurora_620_rangeley
|
||||
AUTOMODULE := x86_64_netberg_aurora_620_rangeley
|
||||
include $(BUILDER)/definemodule.mk
|
||||
@@ -0,0 +1,9 @@
|
||||
###############################################################################
|
||||
#
|
||||
# x86_64_netberg_aurora_620_rangeley Autogeneration
|
||||
#
|
||||
###############################################################################
|
||||
x86_64_netberg_aurora_620_rangeley_AUTO_DEFS := module/auto/x86_64_netberg_aurora_620_rangeley.yml
|
||||
x86_64_netberg_aurora_620_rangeley_AUTO_DIRS := module/inc/x86_64_netberg_aurora_620_rangeley module/src
|
||||
include $(BUILDER)/auto.mk
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
###############################################################################
|
||||
#
|
||||
# x86_64_netberg_aurora_620_rangeley Autogeneration Definitions.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
cdefs: &cdefs
|
||||
- X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_LOGGING:
|
||||
doc: "Include or exclude logging."
|
||||
default: 1
|
||||
- X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT:
|
||||
doc: "Default enabled log options."
|
||||
default: AIM_LOG_OPTIONS_DEFAULT
|
||||
- X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_BITS_DEFAULT:
|
||||
doc: "Default enabled log bits."
|
||||
default: AIM_LOG_BITS_DEFAULT
|
||||
- X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
|
||||
doc: "Default enabled custom log bits."
|
||||
default: 0
|
||||
- X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB:
|
||||
doc: "Default all porting macros to use the C standard libraries."
|
||||
default: 1
|
||||
- X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
|
||||
doc: "Include standard library headers for stdlib porting macros."
|
||||
default: X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
- X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_UCLI:
|
||||
doc: "Include generic uCli support."
|
||||
default: 0
|
||||
- X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD:
|
||||
doc: "RPM Threshold at which the fan is considered to have failed."
|
||||
default: 3000
|
||||
|
||||
definitions:
|
||||
cdefs:
|
||||
X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_HEADER:
|
||||
defs: *cdefs
|
||||
basename: x86_64_netberg_aurora_620_rangeley_config
|
||||
|
||||
enum: &enums
|
||||
|
||||
fan_id:
|
||||
members:
|
||||
- FAN1 : 1
|
||||
- FAN2 : 2
|
||||
- FAN3 : 3
|
||||
- FAN4 : 4
|
||||
- FAN5 : 5
|
||||
- FAN6 : 6
|
||||
- FAN7 : 7
|
||||
- FAN8 : 8
|
||||
- FAN9 : 9
|
||||
- FAN10 : 10
|
||||
|
||||
fan_oid:
|
||||
members:
|
||||
- FAN1 : ONLP_FAN_ID_CREATE(1)
|
||||
- FAN2 : ONLP_FAN_ID_CREATE(2)
|
||||
- FAN3 : ONLP_FAN_ID_CREATE(3)
|
||||
- FAN4 : ONLP_FAN_ID_CREATE(4)
|
||||
- FAN5 : ONLP_FAN_ID_CREATE(5)
|
||||
- FAN6 : ONLP_FAN_ID_CREATE(6)
|
||||
- FAN7 : ONLP_FAN_ID_CREATE(7)
|
||||
- FAN8 : ONLP_FAN_ID_CREATE(8)
|
||||
- FAN9 : ONLP_FAN_ID_CREATE(9)
|
||||
- FAN10 : ONLP_FAN_ID_CREATE(10)
|
||||
|
||||
psu_id:
|
||||
members:
|
||||
- PSU1 : 1
|
||||
- PSU2 : 2
|
||||
|
||||
psu_oid:
|
||||
members:
|
||||
- PSU1 : ONLP_PSU_ID_CREATE(1)
|
||||
- PSU2 : ONLP_PSU_ID_CREATE(2)
|
||||
|
||||
thermal_id:
|
||||
members:
|
||||
- THERMAL1 : 1
|
||||
- THERMAL2 : 2
|
||||
- THERMAL3 : 3
|
||||
- THERMAL4 : 4
|
||||
- THERMAL5 : 5
|
||||
- THERMAL6 : 6
|
||||
- THERMAL7 : 7
|
||||
|
||||
thermal_oid:
|
||||
members:
|
||||
- THERMAL1 : ONLP_THERMAL_ID_CREATE(1)
|
||||
- THERMAL2 : ONLP_THERMAL_ID_CREATE(2)
|
||||
- THERMAL3 : ONLP_THERMAL_ID_CREATE(3)
|
||||
- THERMAL4 : ONLP_THERMAL_ID_CREATE(4)
|
||||
- THERMAL5 : ONLP_THERMAL_ID_CREATE(5)
|
||||
- THERMAL6 : ONLP_THERMAL_ID_CREATE(6)
|
||||
- THERMAL7 : ONLP_THERMAL_ID_CREATE(7)
|
||||
|
||||
led_id:
|
||||
members:
|
||||
- STAT : 1
|
||||
|
||||
led_oid:
|
||||
members:
|
||||
- STAT : ONLP_LED_ID_CREATE(1)
|
||||
|
||||
|
||||
portingmacro:
|
||||
X86_64_NETBERG_AURORA_620_RANGELEY:
|
||||
macros:
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
@@ -0,0 +1,14 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_config.h>
|
||||
|
||||
/* <--auto.start.xmacro(ALL).define> */
|
||||
/* <auto.end.xmacro(ALL).define> */
|
||||
|
||||
/* <--auto.start.xenum(ALL).define> */
|
||||
/* <auto.end.xenum(ALL).define> */
|
||||
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* @file
|
||||
* @brief x86_64_netberg_aurora_620_rangeley Configuration Header
|
||||
*
|
||||
* @addtogroup x86_64_netberg_aurora_620_rangeley-config
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_H__
|
||||
#define __X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_H__
|
||||
|
||||
#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG
|
||||
#include <global_custom_config.h>
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_620_RANGELEY_INCLUDE_CUSTOM_CONFIG
|
||||
#include <x86_64_netberg_aurora_620_rangeley_custom_config.h>
|
||||
#endif
|
||||
|
||||
/* <auto.start.cdefs(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_HEADER).header> */
|
||||
#include <AIM/aim.h>
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_LOGGING
|
||||
*
|
||||
* Include or exclude logging. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_LOGGING
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_LOGGING 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
*
|
||||
* Default enabled log options. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_BITS_DEFAULT
|
||||
*
|
||||
* Default enabled log bits. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_BITS_DEFAULT
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
*
|
||||
* Default enabled custom log bits. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
*
|
||||
* Default all porting macros to use the C standard libraries. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
*
|
||||
* Include standard library headers for stdlib porting macros. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_UCLI
|
||||
*
|
||||
* Include generic uCli support. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_UCLI
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_UCLI 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD
|
||||
*
|
||||
* RPM Threshold at which the fan is considered to have failed. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD 3000
|
||||
#endif
|
||||
|
||||
/**
|
||||
* All compile time options can be queried or displayed
|
||||
*/
|
||||
|
||||
/** Configuration settings structure. */
|
||||
typedef struct x86_64_netberg_aurora_620_rangeley_config_settings_s {
|
||||
/** name */
|
||||
const char* name;
|
||||
/** value */
|
||||
const char* value;
|
||||
} x86_64_netberg_aurora_620_rangeley_config_settings_t;
|
||||
|
||||
/** Configuration settings table. */
|
||||
/** x86_64_netberg_aurora_620_rangeley_config_settings table. */
|
||||
extern x86_64_netberg_aurora_620_rangeley_config_settings_t x86_64_netberg_aurora_620_rangeley_config_settings[];
|
||||
|
||||
/**
|
||||
* @brief Lookup a configuration setting.
|
||||
* @param setting The name of the configuration option to lookup.
|
||||
*/
|
||||
const char* x86_64_netberg_aurora_620_rangeley_config_lookup(const char* setting);
|
||||
|
||||
/**
|
||||
* @brief Show the compile-time configuration.
|
||||
* @param pvs The output stream.
|
||||
*/
|
||||
int x86_64_netberg_aurora_620_rangeley_config_show(struct aim_pvs_s* pvs);
|
||||
|
||||
/* <auto.end.cdefs(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_HEADER).header> */
|
||||
|
||||
#include "x86_64_netberg_aurora_620_rangeley_porting.h"
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_H__ */
|
||||
/* @} */
|
||||
@@ -0,0 +1,26 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* x86_64_netberg_aurora_620_rangeley Doxygen Header
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_620_RANGELEY_DOX_H__
|
||||
#define __X86_64_NETBERG_AURORA_620_RANGELEY_DOX_H__
|
||||
|
||||
/**
|
||||
* @defgroup x86_64_netberg_aurora_620_rangeley x86_64_netberg_aurora_620_rangeley - x86_64_netberg_aurora_620_rangeley Description
|
||||
*
|
||||
|
||||
The documentation overview for this module should go here.
|
||||
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @defgroup x86_64_netberg_aurora_620_rangeley-x86_64_netberg_aurora_620_rangeley Public Interface
|
||||
* @defgroup x86_64_netberg_aurora_620_rangeley-config Compile Time Configuration
|
||||
* @defgroup x86_64_netberg_aurora_620_rangeley-porting Porting Macros
|
||||
*
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_620_RANGELEY_DOX_H__ */
|
||||
@@ -0,0 +1,87 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* @file
|
||||
* @brief x86_64_netberg_aurora_620_rangeley Porting Macros.
|
||||
*
|
||||
* @addtogroup x86_64_netberg_aurora_620_rangeley-porting
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_620_RANGELEY_PORTING_H__
|
||||
#define __X86_64_NETBERG_AURORA_620_RANGELEY_PORTING_H__
|
||||
|
||||
|
||||
/* <auto.start.portingmacro(ALL).define> */
|
||||
#if X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <memory.h>
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_MEMSET
|
||||
#if defined(GLOBAL_MEMSET)
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_MEMSET GLOBAL_MEMSET
|
||||
#elif X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_MEMSET memset
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_620_RANGELEY_MEMSET is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_MEMCPY
|
||||
#if defined(GLOBAL_MEMCPY)
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_MEMCPY GLOBAL_MEMCPY
|
||||
#elif X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_MEMCPY memcpy
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_620_RANGELEY_MEMCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_STRNCPY GLOBAL_STRNCPY
|
||||
#elif X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_620_RANGELEY_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
#elif X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_VSNPRINTF vsnprintf
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_620_RANGELEY_VSNPRINTF is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_SNPRINTF
|
||||
#if defined(GLOBAL_SNPRINTF)
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_SNPRINTF GLOBAL_SNPRINTF
|
||||
#elif X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_SNPRINTF snprintf
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_620_RANGELEY_SNPRINTF is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_STRLEN
|
||||
#if defined(GLOBAL_STRLEN)
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_STRLEN GLOBAL_STRLEN
|
||||
#elif X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_STRLEN strlen
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_620_RANGELEY_STRLEN is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* <auto.end.portingmacro(ALL).define> */
|
||||
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_620_RANGELEY_PORTING_H__ */
|
||||
/* @} */
|
||||
@@ -0,0 +1,10 @@
|
||||
###############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
x86_64_netberg_aurora_620_rangeley_INCLUDES := -I $(THIS_DIR)inc
|
||||
x86_64_netberg_aurora_620_rangeley_INTERNAL_INCLUDES := -I $(THIS_DIR)src
|
||||
x86_64_netberg_aurora_620_rangeley_DEPENDMODULE_ENTRIES := init:x86_64_netberg_aurora_620_rangeley ucli:x86_64_netberg_aurora_620_rangeley
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
###############################################################################
|
||||
#
|
||||
# Local source generation targets.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
ucli:
|
||||
@../../../../tools/uclihandlers.py x86_64_netberg_aurora_620_rangeley_ucli.c
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
*
|
||||
* Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_config.h>
|
||||
#include <onlp/platformi/fani.h>
|
||||
|
||||
#include "x86_64_netberg_aurora_620_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_620_rangeley_log.h"
|
||||
|
||||
#include <onlplib/file.h>
|
||||
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_FAN(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static int
|
||||
sys_fan_info_get__(onlp_fan_info_t* info, int id)
|
||||
{
|
||||
int value = 0;
|
||||
int rv;
|
||||
|
||||
rv = onlp_file_read_int(&value, SYS_HWMON2_PREFIX "/fan%d_abs", ((id/2)+1));
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
return rv;
|
||||
|
||||
if (value == 0)
|
||||
{
|
||||
info->status = ONLP_FAN_STATUS_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->status = ONLP_FAN_STATUS_PRESENT;
|
||||
|
||||
rv = onlp_file_read_int(&value, SYS_HWMON2_PREFIX "/fan%d_dir", ((id/2)+1));
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
return rv;
|
||||
|
||||
if (value == 1)
|
||||
{
|
||||
info->status |= ONLP_FAN_STATUS_B2F;
|
||||
info->caps |= ONLP_FAN_CAPS_B2F;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->status |= ONLP_FAN_STATUS_F2B;
|
||||
info->caps |= ONLP_FAN_CAPS_F2B;
|
||||
}
|
||||
|
||||
rv = onlp_file_read_int(&(info->rpm), SYS_HWMON1_PREFIX "/fan%d_rpm", (id+1));
|
||||
if (rv == ONLP_STATUS_E_INTERNAL)
|
||||
return rv;
|
||||
|
||||
if (rv == ONLP_STATUS_E_MISSING)
|
||||
{
|
||||
info->status &= ~1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (info->rpm <= X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD)
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
|
||||
|
||||
rv = onlp_file_read_int(&(info->percentage), SYS_HWMON1_PREFIX "/fan%d_duty", (id+1));
|
||||
if (rv == ONLP_STATUS_E_INTERNAL)
|
||||
return rv;
|
||||
|
||||
if (rv == ONLP_STATUS_E_MISSING)
|
||||
{
|
||||
info->status &= ~1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
psu_fan_info_get__(onlp_fan_info_t* info, int id)
|
||||
{
|
||||
return onlp_file_read_int(&(info->rpm), SYS_HWMON2_PREFIX "/psu%d_fan_speed", id);
|
||||
}
|
||||
|
||||
/* Onboard Fans */
|
||||
static onlp_fan_info_t fans__[] = {
|
||||
{ }, /* Not used */
|
||||
{ { FAN_OID_FAN1, "Fan1_rotor1", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN2, "Fan1_rotor2", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN3, "Fan2_rotor1", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN4, "Fan2_rotor2", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN5, "Fan3_rotor1", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN6, "Fan3_rotor2", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN7, "Fan4_rotor1", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN8, "Fan4_rotor2", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN9, "PSU-1 Fan", 0 }, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN10, "PSU-2 Fan", 0 }, ONLP_FAN_STATUS_PRESENT },
|
||||
};
|
||||
|
||||
/*
|
||||
* This function will be called prior to all of onlp_fani_* functions.
|
||||
*/
|
||||
int
|
||||
onlp_fani_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info)
|
||||
{
|
||||
int fid;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
memset(info, 0, sizeof(onlp_fan_info_t));
|
||||
fid = ONLP_OID_ID_GET(id);
|
||||
*info = fans__[fid];
|
||||
|
||||
info->caps |= ONLP_FAN_CAPS_GET_RPM;
|
||||
|
||||
switch(fid)
|
||||
{
|
||||
case FAN_ID_FAN1:
|
||||
case FAN_ID_FAN2:
|
||||
case FAN_ID_FAN3:
|
||||
case FAN_ID_FAN4:
|
||||
case FAN_ID_FAN5:
|
||||
case FAN_ID_FAN6:
|
||||
case FAN_ID_FAN7:
|
||||
case FAN_ID_FAN8:
|
||||
return sys_fan_info_get__(info, (fid - 1));
|
||||
break;
|
||||
|
||||
case FAN_ID_FAN9:
|
||||
case FAN_ID_FAN10:
|
||||
return psu_fan_info_get__(info, (fid - FAN_ID_FAN9 + 1));
|
||||
break;
|
||||
|
||||
default:
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
break;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function sets the speed of the given fan in RPM.
|
||||
*
|
||||
* This function will only be called if the fan supprots the RPM_SET
|
||||
* capability.
|
||||
*
|
||||
* It is optional if you have no fans at all with this feature.
|
||||
*/
|
||||
int
|
||||
onlp_fani_rpm_set(onlp_oid_t id, int rpm)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function sets the fan speed of the given OID as a percentage.
|
||||
*
|
||||
* This will only be called if the OID has the PERCENTAGE_SET
|
||||
* capability.
|
||||
*
|
||||
* It is optional if you have no fans at all with this feature.
|
||||
*/
|
||||
int
|
||||
onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function sets the fan speed of the given OID as per
|
||||
* the predefined ONLP fan speed modes: off, slow, normal, fast, max.
|
||||
*
|
||||
* Interpretation of these modes is up to the platform.
|
||||
*
|
||||
*/
|
||||
int
|
||||
onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function sets the fan direction of the given OID.
|
||||
*
|
||||
* This function is only relevant if the fan OID supports both direction
|
||||
* capabilities.
|
||||
*
|
||||
* This function is optional unless the functionality is available.
|
||||
*/
|
||||
int
|
||||
onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic fan ioctl. Optional.
|
||||
*/
|
||||
int
|
||||
onlp_fani_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
* Copyright 2013 Accton Technology Corporation.
|
||||
*
|
||||
* Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <onlp/platformi/ledi.h>
|
||||
#include <onlplib/file.h>
|
||||
#include "x86_64_netberg_aurora_620_rangeley_int.h"
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_LED(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/* LED related data
|
||||
*/
|
||||
enum led_light_mode { /*must be the same with the definition @ kernel driver */
|
||||
LED_MODE_OFF = 0,
|
||||
LED_MODE_AMBER,
|
||||
LED_MODE_GREEN,
|
||||
};
|
||||
|
||||
int led_light_map_mode[][2] =
|
||||
{
|
||||
{LED_MODE_OFF, ONLP_LED_MODE_OFF},
|
||||
{LED_MODE_AMBER, ONLP_LED_MODE_ORANGE},
|
||||
{LED_MODE_GREEN, ONLP_LED_MODE_GREEN},
|
||||
};
|
||||
|
||||
/*
|
||||
* Get the information for the given LED OID.
|
||||
*/
|
||||
static onlp_led_info_t linfo[] =
|
||||
{
|
||||
{ }, /* Not used */
|
||||
{
|
||||
{ LED_OID_LED1, "Chassis LED 1 (STAT LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN,
|
||||
ONLP_LED_MODE_OFF,
|
||||
},
|
||||
};
|
||||
|
||||
static int conver_led_light_mode_to_driver(int led_ligth_mode)
|
||||
{
|
||||
int i, nsize = sizeof(led_light_map_mode)/sizeof(led_light_map_mode[0]);
|
||||
for(i=0; i<nsize; i++)
|
||||
{
|
||||
if (led_ligth_mode == led_light_map_mode[i][1])
|
||||
{
|
||||
return led_light_map_mode[i][0];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will be called prior to any other onlp_ledi_* functions.
|
||||
*/
|
||||
int
|
||||
onlp_ledi_init(void)
|
||||
{
|
||||
/*
|
||||
* Turn on the STAT LEDs at startup
|
||||
*/
|
||||
onlp_ledi_mode_set(LED_OID_LED1, ONLP_LED_MODE_GREEN);
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
{
|
||||
int local_id;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
memset(info, 0, sizeof(onlp_led_info_t));
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
*info = linfo[local_id];
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Turn an LED on or off.
|
||||
*
|
||||
* This function will only be called if the LED OID supports the ONOFF
|
||||
* capability.
|
||||
*
|
||||
* What 'on' means in terms of colors or modes for multimode LEDs is
|
||||
* up to the platform to decide. This is intended as baseline toggle mechanism.
|
||||
*/
|
||||
int
|
||||
onlp_ledi_set(onlp_oid_t id, int on_or_off)
|
||||
{
|
||||
VALIDATE(id);
|
||||
|
||||
if (!on_or_off)
|
||||
return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF);
|
||||
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function puts the LED into the given mode. It is a more functional
|
||||
* interface for multimode LEDs.
|
||||
*
|
||||
* Only modes reported in the LED's capabilities will be attempted.
|
||||
*/
|
||||
int
|
||||
onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
{
|
||||
int local_id;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
switch(local_id)
|
||||
{
|
||||
case LED_ID_LED1:
|
||||
linfo[local_id].status = ONLP_LED_STATUS_PRESENT;
|
||||
if (mode != ONLP_LED_MODE_OFF)
|
||||
linfo[local_id].status |= ONLP_LED_STATUS_ON;
|
||||
linfo[local_id].mode = mode;
|
||||
return onlp_file_write_int(conver_led_light_mode_to_driver(mode), SYS_HWMON2_PREFIX "/system_led");
|
||||
break;
|
||||
|
||||
default:
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
break;
|
||||
}
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic LED ioctl interface.
|
||||
*/
|
||||
int
|
||||
onlp_ledi_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
###############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
LIBRARY := x86_64_netberg_aurora_620_rangeley
|
||||
$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
include $(BUILDER)/lib.mk
|
||||
@@ -0,0 +1,201 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_config.h>
|
||||
#include <onlp/platformi/psui.h>
|
||||
#include <onlplib/file.h>
|
||||
#include "x86_64_netberg_aurora_620_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_620_rangeley_log.h"
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_PSU(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static onlp_psu_info_t psus__[] = {
|
||||
{ }, /* Not used */
|
||||
{
|
||||
{
|
||||
PSU_OID_PSU1,
|
||||
"PSU-1",
|
||||
0,
|
||||
{
|
||||
FAN_OID_FAN9,
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
PSU_OID_PSU2,
|
||||
"PSU-2",
|
||||
0,
|
||||
{
|
||||
FAN_OID_FAN10,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* This function will be called prior to any other onlp_psui functions.
|
||||
*/
|
||||
int
|
||||
onlp_psui_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
|
||||
{
|
||||
int rv;
|
||||
int pid;
|
||||
uint8_t data[256];
|
||||
int value = -1;
|
||||
int len;
|
||||
double dvalue;
|
||||
int i;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
memset(info, 0, sizeof(onlp_psu_info_t));
|
||||
pid = ONLP_OID_ID_GET(id);
|
||||
*info = psus__[pid];
|
||||
|
||||
rv = onlp_file_read_int(&value, SYS_HWMON1_PREFIX "/psu%d_abs", pid);
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
return rv;
|
||||
if (value == 0)
|
||||
{
|
||||
info->status = ONLP_PSU_STATUS_UNPLUGGED;
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/* PSU is present. */
|
||||
info->status = ONLP_PSU_STATUS_PRESENT;
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_eeprom", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
i = 11;
|
||||
|
||||
/* Manufacturer Name */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
i += len;
|
||||
|
||||
/* Product Name */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
memcpy(info->model, (char *) &(data[i]), len);
|
||||
i += len;
|
||||
|
||||
/* Product part,model number */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
i += len;
|
||||
|
||||
/* Product Version */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
i += len;
|
||||
|
||||
/* Product Serial Number */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
memcpy(info->serial, (char *) &(data[i]), len);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(info->model, "Missing");
|
||||
strcpy(info->serial, "Missing");
|
||||
}
|
||||
|
||||
info->caps |= ONLP_PSU_CAPS_AC;
|
||||
|
||||
#if 0
|
||||
/* PSU is powered. */
|
||||
rv = onlp_file_read_int(&value, SYS_HWMON1_PREFIX "/psu%d_pg", pid);
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
return rv;
|
||||
if (value == 0)
|
||||
{
|
||||
info->status |= ONLP_PSU_STATUS_FAILED;
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_iout", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)data);
|
||||
if (dvalue > 0.0)
|
||||
{
|
||||
info->caps |= ONLP_PSU_CAPS_IOUT;
|
||||
info->miout = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_vout", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)data);
|
||||
if (dvalue > 0.0)
|
||||
{
|
||||
info->caps |= ONLP_PSU_CAPS_VOUT;
|
||||
info->mvout = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_pin", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)data);
|
||||
if (dvalue > 0.0)
|
||||
{
|
||||
info->caps |= ONLP_PSU_CAPS_PIN;
|
||||
info->mpin = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_pout", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)data);
|
||||
if (dvalue > 0.0)
|
||||
{
|
||||
info->caps |= ONLP_PSU_CAPS_POUT;
|
||||
info->mpout = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is an optional generic ioctl() interface.
|
||||
* Its purpose is to allow future expansion and
|
||||
* custom functionality that is not otherwise exposed
|
||||
* in the standard interface.
|
||||
*
|
||||
* The semantics of this function are platform specific.
|
||||
* This function is completely optional.
|
||||
*/
|
||||
int
|
||||
onlp_psui_ioctl(onlp_oid_t pid, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,389 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
*
|
||||
* Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
* SFPI Interface for the Aurora 620 Platform
|
||||
*
|
||||
***********************************************************/
|
||||
#include <x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_config.h>
|
||||
#include <onlp/oids.h>
|
||||
#include <onlp/platformi/sfpi.h>
|
||||
#include <onlplib/file.h>
|
||||
#include <onlplib/sfp.h>
|
||||
#include "x86_64_netberg_aurora_620_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_620_rangeley_log.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/* Model ID Definition */
|
||||
typedef enum
|
||||
{
|
||||
HURACAN_WITH_BMC = 0x0,
|
||||
HURACAN_WITHOUT_BMC,
|
||||
CABRERAIII_WITH_BMC,
|
||||
CABRERAIII_WITHOUT_BMC,
|
||||
SESTO_WITH_BMC,
|
||||
SESTO_WITHOUT_BMC,
|
||||
NCIIX_WITH_BMC,
|
||||
NCIIX_WITHOUT_BMC,
|
||||
ASTERION_WITH_BMC,
|
||||
ASTERION_WITHOUT_BMC,
|
||||
HURACAN_A_WITH_BMC,
|
||||
HURACAN_A_WITHOUT_BMC,
|
||||
|
||||
MODEL_ID_LAST
|
||||
} modelId_t;
|
||||
|
||||
static int
|
||||
onlp_board_model_id_get(void)
|
||||
{
|
||||
static int board_model_id = MODEL_ID_LAST;
|
||||
|
||||
if (board_model_id == MODEL_ID_LAST)
|
||||
{
|
||||
if (onlp_file_read_int(&board_model_id, SYS_HWMON1_PREFIX "/board_model_id") != ONLP_STATUS_OK)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return board_model_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will be called prior to all other onlp_sfpi_* functions.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function should populate the give bitmap with
|
||||
* all valid, SFP-capable port numbers.
|
||||
*
|
||||
* Only port numbers in this bitmap will be queried by the the
|
||||
* ONLP framework.
|
||||
*
|
||||
* No SFPI functions will be called with ports that are
|
||||
* not in this bitmap. You can ignore all error checking
|
||||
* on the incoming ports defined in this interface.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap)
|
||||
{
|
||||
int p;
|
||||
int total_port = 0;
|
||||
int board_model_id = onlp_board_model_id_get();
|
||||
|
||||
switch (board_model_id)
|
||||
{
|
||||
case HURACAN_WITH_BMC:
|
||||
case HURACAN_WITHOUT_BMC:
|
||||
case HURACAN_A_WITH_BMC:
|
||||
case HURACAN_A_WITHOUT_BMC:
|
||||
total_port = 32;
|
||||
break;
|
||||
|
||||
case SESTO_WITH_BMC:
|
||||
case SESTO_WITHOUT_BMC:
|
||||
case NCIIX_WITH_BMC:
|
||||
case NCIIX_WITHOUT_BMC:
|
||||
total_port = 54;
|
||||
break;
|
||||
|
||||
case ASTERION_WITH_BMC:
|
||||
case ASTERION_WITHOUT_BMC:
|
||||
total_port = 64;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
AIM_BITMAP_CLR_ALL(bmap);
|
||||
for(p = 0; p < total_port; p++)
|
||||
AIM_BITMAP_SET(bmap, p);
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function should return whether an SFP is inserted on the given
|
||||
* port.
|
||||
*
|
||||
* Returns 1 if the SFP is present.
|
||||
* Returns 0 if the SFP is not present.
|
||||
* Returns ONLP_E_* if there was an error determining the status.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_is_present(int port)
|
||||
{
|
||||
int value = 0;
|
||||
|
||||
onlp_file_read_int(&value, SYS_HWMON2_PREFIX "/port_%d_abs", (port+1));
|
||||
return value;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_port_map(int port, int* rport)
|
||||
{
|
||||
int board_model_id = onlp_board_model_id_get();
|
||||
|
||||
switch (board_model_id)
|
||||
{
|
||||
case HURACAN_WITH_BMC:
|
||||
case HURACAN_WITHOUT_BMC:
|
||||
case HURACAN_A_WITH_BMC:
|
||||
case HURACAN_A_WITHOUT_BMC:
|
||||
/* odd <=> even */
|
||||
if (port & 0x1)
|
||||
*rport = (port - 1);
|
||||
else
|
||||
*rport = (port + 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
*rport = port; break;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* bmap)
|
||||
{
|
||||
int p;
|
||||
int total_port = 0;
|
||||
int board_model_id = onlp_board_model_id_get();
|
||||
|
||||
switch (board_model_id)
|
||||
{
|
||||
case SESTO_WITH_BMC:
|
||||
case SESTO_WITHOUT_BMC:
|
||||
case NCIIX_WITH_BMC:
|
||||
case NCIIX_WITHOUT_BMC:
|
||||
case ASTERION_WITH_BMC:
|
||||
case ASTERION_WITHOUT_BMC:
|
||||
total_port = 48;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
AIM_BITMAP_CLR_ALL(bmap);
|
||||
for(p = 0; p < total_port; p++)
|
||||
AIM_BITMAP_SET(bmap, p);
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function reads the SFPs idrom and returns in
|
||||
* in the data buffer provided.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_eeprom_read(int port, uint8_t data[256])
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
char fname[128];
|
||||
|
||||
memset(data, 0, 256);
|
||||
memset(fname, 0, sizeof(fname));
|
||||
sprintf(fname, SYS_HWMON2_PREFIX "/port_%d_data_a0", (port+1));
|
||||
rv = onlplib_sfp_eeprom_read_file(fname, data);
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
AIM_LOG_INFO("Unable to read eeprom from port(%d)\r\n", port);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_dom_read(int port, uint8_t data[256])
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
char fname[128];
|
||||
|
||||
memset(data, 0, 256);
|
||||
memset(fname, 0, sizeof(fname));
|
||||
sprintf(fname, SYS_HWMON2_PREFIX "/port_%d_data_a2", (port+1));
|
||||
rv = onlplib_sfp_eeprom_read_file(fname, data);
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
AIM_LOG_INFO("Unable to read eeprom from port(%d)\r\n", port);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* Manually enable or disable the given SFP.
|
||||
*
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_enable_set(int port, int enable)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns whether the SFP is currently enabled or disabled.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_enable_get(int port, int* enable)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the platform requires any setup or equalizer modifications
|
||||
* based on the actual SFP that was inserted then that custom
|
||||
* setup should be performed here.
|
||||
*
|
||||
* After a new SFP is detected by the ONLP framework this
|
||||
* function will be called to perform the (optional) setup.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_post_insert(int port, sff_info_t* sff_info)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the current status of the SFP.
|
||||
* See onlp_sfp_status_t;
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_status_get(int port, uint32_t* status)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int onlp_sfpi_control_supported(int port, onlp_sfp_control_t control, int* supported)
|
||||
{
|
||||
if (supported == NULL)
|
||||
return ONLP_STATUS_E_PARAM;
|
||||
|
||||
*supported = 0;
|
||||
switch (control)
|
||||
{
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
case ONLP_SFP_CONTROL_RX_LOS:
|
||||
{
|
||||
int board_model_id = onlp_board_model_id_get();
|
||||
|
||||
switch (board_model_id)
|
||||
{
|
||||
case SESTO_WITH_BMC:
|
||||
case SESTO_WITHOUT_BMC:
|
||||
case NCIIX_WITH_BMC:
|
||||
case NCIIX_WITHOUT_BMC:
|
||||
case ASTERION_WITH_BMC:
|
||||
case ASTERION_WITHOUT_BMC:
|
||||
if (port < 48)
|
||||
*supported = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value)
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
int supported = 0;
|
||||
|
||||
if ((onlp_sfpi_control_supported(port, control, &supported) == ONLP_STATUS_OK) && (supported == 0))
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
|
||||
switch (control)
|
||||
{
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
rv = onlp_file_write_int(value, SYS_HWMON2_PREFIX "/port_%d_tx_disable", (port+1));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value)
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
int supported = 0;
|
||||
|
||||
if (value == NULL)
|
||||
return ONLP_STATUS_E_PARAM;
|
||||
|
||||
if ((onlp_sfpi_control_supported(port, control, &supported) == ONLP_STATUS_OK) && (supported == 0))
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
|
||||
*value = 0;
|
||||
switch (control)
|
||||
{
|
||||
case ONLP_SFP_CONTROL_RX_LOS:
|
||||
rv = onlp_file_read_int(value, SYS_HWMON2_PREFIX "/port_%d_rxlos", (port+1));
|
||||
break;
|
||||
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
rv = onlp_file_read_int(value, SYS_HWMON2_PREFIX "/port_%d_tx_disable", (port+1));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a generic ioctl interface.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_ioctl(int port, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* De-initialize the SFPI subsystem.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_denit(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <onlp/platformi/sysi.h>
|
||||
#include <onlplib/file.h>
|
||||
#include "x86_64_netberg_aurora_620_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_620_rangeley_log.h"
|
||||
|
||||
/*
|
||||
* This is the first function called by the ONLP framework.
|
||||
*
|
||||
* It should return the name of your platform driver.
|
||||
*
|
||||
* If the name of your platform driver is the same as the
|
||||
* current platform then this driver will be used.
|
||||
*
|
||||
* If the name of the driver is different from the current
|
||||
* platform, or the driver is capable of supporting multiple
|
||||
* platform variants, see onlp_sysi_platform_set() below.
|
||||
*/
|
||||
const char*
|
||||
onlp_sysi_platform_get(void)
|
||||
{
|
||||
return "x86-64-netberg-aurora-620-rangeley-r0";
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the first function the ONLP framework will call
|
||||
* after it has validated the the platform is supported using the mechanisms
|
||||
* described above.
|
||||
*
|
||||
* If this function does not return ONL_STATUS_OK
|
||||
* then platform initialization is aborted.
|
||||
*/
|
||||
int
|
||||
onlp_sysi_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sysi_onie_info_get(onlp_onie_info_t* onie)
|
||||
{
|
||||
int rv;
|
||||
uint8_t data[256];
|
||||
int len;
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/eeprom");
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
rv = onlp_onie_decode(onie, (uint8_t*)data, sizeof(data));
|
||||
if(rv >= 0)
|
||||
{
|
||||
onie->platform_name = aim_strdup("x86-64-netberg-aurora-620-rangeley-r0");
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sysi_oids_get(onlp_oid_t* table, int max)
|
||||
{
|
||||
onlp_oid_t* e = table;
|
||||
memset(table, 0, max*sizeof(onlp_oid_t));
|
||||
int i;
|
||||
int n_thermal=7, n_fan=10, n_led=1;
|
||||
|
||||
/* 2 PSUs */
|
||||
*e++ = ONLP_PSU_ID_CREATE(1);
|
||||
*e++ = ONLP_PSU_ID_CREATE(2);
|
||||
|
||||
/* LEDs Item */
|
||||
for (i=1; i<=n_led; i++)
|
||||
{
|
||||
*e++ = ONLP_LED_ID_CREATE(i);
|
||||
}
|
||||
|
||||
/* THERMALs Item */
|
||||
for (i=1; i<=n_thermal; i++)
|
||||
{
|
||||
*e++ = ONLP_THERMAL_ID_CREATE(i);
|
||||
}
|
||||
|
||||
/* Fans Item */
|
||||
for (i=1; i<=n_fan; i++)
|
||||
{
|
||||
*e++ = ONLP_FAN_ID_CREATE(i);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
*
|
||||
* Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <onlp/platformi/thermali.h>
|
||||
#include <onlplib/file.h>
|
||||
#include "x86_64_netberg_aurora_620_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_620_rangeley_log.h"
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_THERMAL(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static int
|
||||
sys_thermal_info_get__(onlp_thermal_info_t* info, int id)
|
||||
{
|
||||
int rv;
|
||||
|
||||
if (id == THERMAL_ID_THERMAL3)
|
||||
{
|
||||
rv = onlp_file_read_int(&info->mcelsius, SYS_HWMON1_PREFIX "/mac_temp");
|
||||
info->mcelsius *= 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t buffer[64];
|
||||
double dvalue;
|
||||
int len;
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
rv = onlp_file_read(buffer, sizeof(buffer), &len, SYS_HWMON1_PREFIX "/remote_temp%d", id);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)buffer);
|
||||
info->mcelsius = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
if(rv == ONLP_STATUS_E_INTERNAL)
|
||||
return rv;
|
||||
|
||||
if(rv == ONLP_STATUS_E_MISSING)
|
||||
{
|
||||
info->status &= ~1;
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
psu1_thermal_info_get__(onlp_thermal_info_t* info, int id)
|
||||
{
|
||||
int rv;
|
||||
uint8_t buffer[64];
|
||||
double dvalue;
|
||||
int len;
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
rv = onlp_file_read(buffer, sizeof(buffer), &len, SYS_HWMON2_PREFIX "/psu1_temp_%d", id);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)buffer);
|
||||
info->mcelsius = (int)(dvalue * 1000);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
psu2_thermal_info_get__(onlp_thermal_info_t* info, int id)
|
||||
{
|
||||
int rv;
|
||||
uint8_t buffer[64];
|
||||
double dvalue;
|
||||
int len;
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
rv = onlp_file_read(buffer, sizeof(buffer), &len, SYS_HWMON2_PREFIX "/psu2_temp_%d", id);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)buffer);
|
||||
info->mcelsius = (int)(dvalue * 1000);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static onlp_thermal_info_t temps__[] =
|
||||
{
|
||||
{ }, /* Not used */
|
||||
{ { THERMAL_OID_THERMAL1, "Chassis Thermal 1 (Front of MAC)", 0}, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
{ { THERMAL_OID_THERMAL2, "Chassis Thermal 2 (Rear of MAC)", 0}, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
{ { THERMAL_OID_THERMAL3, "Chassis Thermal 3 (MAC)", 0}, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
|
||||
{ { THERMAL_OID_THERMAL4, "PSU-1 Thermal 1", PSU_OID_PSU1 }, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
{ { THERMAL_OID_THERMAL5, "PSU-1 Thermal 2", PSU_OID_PSU1 }, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
|
||||
{ { THERMAL_OID_THERMAL6, "PSU-2 Thermal 1", PSU_OID_PSU2 }, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
{ { THERMAL_OID_THERMAL7, "PSU-2 Thermal 2", PSU_OID_PSU2 }, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* This will be called to intiialize the thermali subsystem.
|
||||
*/
|
||||
int
|
||||
onlp_thermali_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve the information structure for the given thermal OID.
|
||||
*
|
||||
* If the OID is invalid, return ONLP_E_STATUS_INVALID.
|
||||
* If an unexpected error occurs, return ONLP_E_STATUS_INTERNAL.
|
||||
* Otherwise, return ONLP_STATUS_OK with the OID's information.
|
||||
*
|
||||
* Note -- it is expected that you fill out the information
|
||||
* structure even if the sensor described by the OID is not present.
|
||||
*/
|
||||
int
|
||||
onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info)
|
||||
{
|
||||
int tid;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
memset(info, 0, sizeof(onlp_thermal_info_t));
|
||||
tid = ONLP_OID_ID_GET(id);
|
||||
*info = temps__[tid];
|
||||
|
||||
switch(tid)
|
||||
{
|
||||
case THERMAL_ID_THERMAL1:
|
||||
case THERMAL_ID_THERMAL2:
|
||||
case THERMAL_ID_THERMAL3:
|
||||
return sys_thermal_info_get__(info, tid);
|
||||
|
||||
case THERMAL_ID_THERMAL4:
|
||||
case THERMAL_ID_THERMAL5:
|
||||
return psu1_thermal_info_get__(info, (tid - THERMAL_ID_THERMAL4 + 1));
|
||||
|
||||
case THERMAL_ID_THERMAL6:
|
||||
case THERMAL_ID_THERMAL7:
|
||||
return psu2_thermal_info_get__(info, (tid - THERMAL_ID_THERMAL6 + 1));
|
||||
}
|
||||
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_config.h>
|
||||
|
||||
/* <auto.start.cdefs(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_HEADER).source> */
|
||||
#define __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME(_x) #_x
|
||||
#define __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_VALUE(_x) __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME(_x)
|
||||
x86_64_netberg_aurora_620_rangeley_config_settings_t x86_64_netberg_aurora_620_rangeley_config_settings[] =
|
||||
{
|
||||
#ifdef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_LOGGING
|
||||
{ __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_LOGGING), __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_LOGGING) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_LOGGING(__x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
{ __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT), __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT(__x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_BITS_DEFAULT
|
||||
{ __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_BITS_DEFAULT), __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_BITS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_BITS_DEFAULT(__x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
{ __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
{ __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB), __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB(__x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
{ __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_UCLI
|
||||
{ __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_UCLI), __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_UCLI) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_UCLI(__x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD
|
||||
{ __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD), __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD(__x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
#undef __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_VALUE
|
||||
#undef __x86_64_netberg_aurora_620_rangeley_config_STRINGIFY_NAME
|
||||
|
||||
const char*
|
||||
x86_64_netberg_aurora_620_rangeley_config_lookup(const char* setting)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; x86_64_netberg_aurora_620_rangeley_config_settings[i].name; i++) {
|
||||
if(strcmp(x86_64_netberg_aurora_620_rangeley_config_settings[i].name, setting)) {
|
||||
return x86_64_netberg_aurora_620_rangeley_config_settings[i].value;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
x86_64_netberg_aurora_620_rangeley_config_show(struct aim_pvs_s* pvs)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; x86_64_netberg_aurora_620_rangeley_config_settings[i].name; i++) {
|
||||
aim_printf(pvs, "%s = %s\n", x86_64_netberg_aurora_620_rangeley_config_settings[i].name, x86_64_netberg_aurora_620_rangeley_config_settings[i].value);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/* <auto.end.cdefs(X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_HEADER).source> */
|
||||
@@ -0,0 +1,10 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_config.h>
|
||||
|
||||
/* <--auto.start.enum(ALL).source> */
|
||||
/* <auto.end.enum(ALL).source> */
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* x86_64_netberg_aurora_620_rangeley Internal Header
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_620_RANGELEY_INT_H__
|
||||
#define __X86_64_NETBERG_AURORA_620_RANGELEY_INT_H__
|
||||
|
||||
#include <x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_config.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* <auto.start.enum(ALL).header> */
|
||||
/** thermal_oid */
|
||||
typedef enum thermal_oid_e {
|
||||
THERMAL_OID_THERMAL1 = ONLP_THERMAL_ID_CREATE(1),
|
||||
THERMAL_OID_THERMAL2 = ONLP_THERMAL_ID_CREATE(2),
|
||||
THERMAL_OID_THERMAL3 = ONLP_THERMAL_ID_CREATE(3),
|
||||
THERMAL_OID_THERMAL4 = ONLP_THERMAL_ID_CREATE(4),
|
||||
THERMAL_OID_THERMAL5 = ONLP_THERMAL_ID_CREATE(5),
|
||||
THERMAL_OID_THERMAL6 = ONLP_THERMAL_ID_CREATE(6),
|
||||
THERMAL_OID_THERMAL7 = ONLP_THERMAL_ID_CREATE(7),
|
||||
THERMAL_OID_THERMAL8 = ONLP_THERMAL_ID_CREATE(8),
|
||||
THERMAL_OID_THERMAL9 = ONLP_THERMAL_ID_CREATE(9),
|
||||
THERMAL_OID_THERMAL10 = ONLP_THERMAL_ID_CREATE(10),
|
||||
} thermal_oid_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* thermal_oid_name(thermal_oid_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int thermal_oid_value(const char* str, thermal_oid_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* thermal_oid_desc(thermal_oid_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int thermal_oid_valid(thermal_oid_t e);
|
||||
|
||||
/** validator */
|
||||
#define THERMAL_OID_VALID(_e) \
|
||||
(thermal_oid_valid((_e)))
|
||||
|
||||
/** thermal_oid_map table. */
|
||||
extern aim_map_si_t thermal_oid_map[];
|
||||
/** thermal_oid_desc_map table. */
|
||||
extern aim_map_si_t thermal_oid_desc_map[];
|
||||
|
||||
/** thermal_id */
|
||||
typedef enum thermal_id_e {
|
||||
THERMAL_ID_THERMAL1 = 1,
|
||||
THERMAL_ID_THERMAL2 = 2,
|
||||
THERMAL_ID_THERMAL3 = 3,
|
||||
THERMAL_ID_THERMAL4 = 4,
|
||||
THERMAL_ID_THERMAL5 = 5,
|
||||
THERMAL_ID_THERMAL6 = 6,
|
||||
THERMAL_ID_THERMAL7 = 7,
|
||||
THERMAL_ID_THERMAL8 = 8,
|
||||
THERMAL_ID_THERMAL9 = 9,
|
||||
THERMAL_ID_THERMAL10 = 10,
|
||||
} thermal_id_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* thermal_id_name(thermal_id_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int thermal_id_value(const char* str, thermal_id_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* thermal_id_desc(thermal_id_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int thermal_id_valid(thermal_id_t e);
|
||||
|
||||
/** validator */
|
||||
#define THERMAL_ID_VALID(_e) \
|
||||
(thermal_id_valid((_e)))
|
||||
|
||||
/** thermal_id_map table. */
|
||||
extern aim_map_si_t thermal_id_map[];
|
||||
/** thermal_id_desc_map table. */
|
||||
extern aim_map_si_t thermal_id_desc_map[];
|
||||
|
||||
|
||||
/** psu_oid */
|
||||
typedef enum psu_oid_e {
|
||||
PSU_OID_PSU1 = ONLP_PSU_ID_CREATE(1),
|
||||
PSU_OID_PSU2 = ONLP_PSU_ID_CREATE(2),
|
||||
} psu_oid_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* psu_oid_name(psu_oid_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int psu_oid_value(const char* str, psu_oid_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* psu_oid_desc(psu_oid_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int psu_oid_valid(psu_oid_t e);
|
||||
|
||||
/** validator */
|
||||
#define PSU_OID_VALID(_e) \
|
||||
(psu_oid_valid((_e)))
|
||||
|
||||
/** psu_oid_map table. */
|
||||
extern aim_map_si_t psu_oid_map[];
|
||||
/** psu_oid_desc_map table. */
|
||||
extern aim_map_si_t psu_oid_desc_map[];
|
||||
|
||||
/** psu_id */
|
||||
typedef enum psu_id_e {
|
||||
PSU_ID_PSU1 = 1,
|
||||
PSU_ID_PSU2 = 2,
|
||||
} psu_id_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* psu_id_name(psu_id_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int psu_id_value(const char* str, psu_id_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* psu_id_desc(psu_id_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int psu_id_valid(psu_id_t e);
|
||||
|
||||
/** validator */
|
||||
#define PSU_ID_VALID(_e) \
|
||||
(psu_id_valid((_e)))
|
||||
|
||||
/** psu_id_map table. */
|
||||
extern aim_map_si_t psu_id_map[];
|
||||
/** psu_id_desc_map table. */
|
||||
extern aim_map_si_t psu_id_desc_map[];
|
||||
|
||||
|
||||
|
||||
/** fan_oid */
|
||||
typedef enum fan_oid_e {
|
||||
FAN_OID_FAN1 = ONLP_FAN_ID_CREATE(1),
|
||||
FAN_OID_FAN2 = ONLP_FAN_ID_CREATE(2),
|
||||
FAN_OID_FAN3 = ONLP_FAN_ID_CREATE(3),
|
||||
FAN_OID_FAN4 = ONLP_FAN_ID_CREATE(4),
|
||||
FAN_OID_FAN5 = ONLP_FAN_ID_CREATE(5),
|
||||
FAN_OID_FAN6 = ONLP_FAN_ID_CREATE(6),
|
||||
FAN_OID_FAN7 = ONLP_FAN_ID_CREATE(7),
|
||||
FAN_OID_FAN8 = ONLP_FAN_ID_CREATE(8),
|
||||
FAN_OID_FAN9 = ONLP_FAN_ID_CREATE(9),
|
||||
FAN_OID_FAN10 = ONLP_FAN_ID_CREATE(10),
|
||||
} fan_oid_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* fan_oid_name(fan_oid_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int fan_oid_value(const char* str, fan_oid_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* fan_oid_desc(fan_oid_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int fan_oid_valid(fan_oid_t e);
|
||||
|
||||
/** validator */
|
||||
#define FAN_OID_VALID(_e) \
|
||||
(fan_oid_valid((_e)))
|
||||
|
||||
/** fan_oid_map table. */
|
||||
extern aim_map_si_t fan_oid_map[];
|
||||
/** fan_oid_desc_map table. */
|
||||
extern aim_map_si_t fan_oid_desc_map[];
|
||||
|
||||
/** fan_id */
|
||||
typedef enum fan_id_e {
|
||||
FAN_ID_FAN1 = 1,
|
||||
FAN_ID_FAN2 = 2,
|
||||
FAN_ID_FAN3 = 3,
|
||||
FAN_ID_FAN4 = 4,
|
||||
FAN_ID_FAN5 = 5,
|
||||
FAN_ID_FAN6 = 6,
|
||||
FAN_ID_FAN7 = 7,
|
||||
FAN_ID_FAN8 = 8,
|
||||
FAN_ID_FAN9 = 9,
|
||||
FAN_ID_FAN10 = 10,
|
||||
} fan_id_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* fan_id_name(fan_id_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int fan_id_value(const char* str, fan_id_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* fan_id_desc(fan_id_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int fan_id_valid(fan_id_t e);
|
||||
|
||||
/** validator */
|
||||
#define FAN_ID_VALID(_e) \
|
||||
(fan_id_valid((_e)))
|
||||
|
||||
/** fan_id_map table. */
|
||||
extern aim_map_si_t fan_id_map[];
|
||||
/** fan_id_desc_map table. */
|
||||
extern aim_map_si_t fan_id_desc_map[];
|
||||
|
||||
/** led_oid */
|
||||
typedef enum led_oid_e {
|
||||
LED_OID_LED1 = ONLP_LED_ID_CREATE(1),
|
||||
LED_OID_LED2 = ONLP_LED_ID_CREATE(2),
|
||||
LED_OID_LED3 = ONLP_LED_ID_CREATE(3),
|
||||
LED_OID_LED4 = ONLP_LED_ID_CREATE(4),
|
||||
} led_oid_t;
|
||||
|
||||
/** led_id */
|
||||
typedef enum led_id_e {
|
||||
LED_ID_LED1 = 1,
|
||||
LED_ID_LED2 = 2,
|
||||
LED_ID_LED3 = 3,
|
||||
LED_ID_LED4 = 4,
|
||||
} led_id_t;
|
||||
|
||||
/* <auto.end.enum(ALL).header> */
|
||||
|
||||
/* psu info table */
|
||||
struct psu_info_s {
|
||||
char path[PATH_MAX];
|
||||
int present;
|
||||
int busno;
|
||||
int addr;
|
||||
};
|
||||
|
||||
#define SYS_HWMON1_PREFIX "/sys/class/hwmon/hwmon1/device"
|
||||
#define SYS_HWMON2_PREFIX "/sys/class/hwmon/hwmon2/device"
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_620_RANGELEY_INT_H__ */
|
||||
@@ -0,0 +1,18 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_config.h>
|
||||
|
||||
#include "x86_64_netberg_aurora_620_rangeley_log.h"
|
||||
/*
|
||||
* x86_64_netberg_aurora_620_rangeley log struct.
|
||||
*/
|
||||
AIM_LOG_STRUCT_DEFINE(
|
||||
X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT,
|
||||
X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_BITS_DEFAULT,
|
||||
NULL, /* Custom log map */
|
||||
X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_620_RANGELEY_LOG_H__
|
||||
#define __X86_64_NETBERG_AURORA_620_RANGELEY_LOG_H__
|
||||
|
||||
#define AIM_LOG_MODULE_NAME x86_64_netberg_aurora_620_rangeley
|
||||
#include <AIM/aim_log.h>
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_620_RANGELEY_LOG_H__ */
|
||||
@@ -0,0 +1,24 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_config.h>
|
||||
|
||||
#include "x86_64_netberg_aurora_620_rangeley_log.h"
|
||||
|
||||
static int
|
||||
datatypes_init__(void)
|
||||
{
|
||||
#define X86_64_NETBERG_AURORA_620_RANGELEY_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
|
||||
#include <x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley.x>
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __x86_64_netberg_aurora_620_rangeley_module_init__(void)
|
||||
{
|
||||
AIM_LOG_STRUCT_REGISTER();
|
||||
datatypes_init__();
|
||||
}
|
||||
|
||||
int __onlp_platform_version__ = 1;
|
||||
@@ -0,0 +1,50 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_config.h>
|
||||
|
||||
#if X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_INCLUDE_UCLI == 1
|
||||
|
||||
#include <uCli/ucli.h>
|
||||
#include <uCli/ucli_argparse.h>
|
||||
#include <uCli/ucli_handler_macros.h>
|
||||
|
||||
static ucli_status_t
|
||||
x86_64_netberg_aurora_620_rangeley_ucli_ucli__config__(ucli_context_t* uc)
|
||||
{
|
||||
UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_netberg_aurora_620_rangeley)
|
||||
}
|
||||
|
||||
/* <auto.ucli.handlers.start> */
|
||||
/* <auto.ucli.handlers.end> */
|
||||
|
||||
static ucli_module_t
|
||||
x86_64_netberg_aurora_620_rangeley_ucli_module__ =
|
||||
{
|
||||
"x86_64_netberg_aurora_620_rangeley_ucli",
|
||||
NULL,
|
||||
x86_64_netberg_aurora_620_rangeley_ucli_ucli_handlers__,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
ucli_node_t*
|
||||
x86_64_netberg_aurora_620_rangeley_ucli_node_create(void)
|
||||
{
|
||||
ucli_node_t* n;
|
||||
ucli_module_init(&x86_64_netberg_aurora_620_rangeley_ucli_module__);
|
||||
n = ucli_node_create("x86_64_netberg_aurora_620_rangeley", NULL, &x86_64_netberg_aurora_620_rangeley_ucli_module__);
|
||||
ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_netberg_aurora_620_rangeley"));
|
||||
return n;
|
||||
}
|
||||
|
||||
#else
|
||||
void*
|
||||
x86_64_netberg_aurora_620_rangeley_ucli_node_create(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=netberg BASENAME=x86-64-netberg-aurora-620-rangeley REVISION=r0
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# platform-config for AURORA 620
|
||||
#
|
||||
######################################################################
|
||||
|
||||
x86-64-netberg-aurora-620-rangeley-r0:
|
||||
|
||||
grub:
|
||||
|
||||
serial: >-
|
||||
--port=0x2f8
|
||||
--speed=115200
|
||||
--word=8
|
||||
--parity=no
|
||||
--stop=1
|
||||
|
||||
kernel:
|
||||
<<: *kernel-3-16
|
||||
|
||||
args: >-
|
||||
console=ttyS1,115200n8
|
||||
|
||||
##network:
|
||||
## interfaces:
|
||||
## ma1:
|
||||
## name: ~
|
||||
## syspath: pci0000:00/0000:00:14.0
|
||||
@@ -0,0 +1,12 @@
|
||||
from onl.platform.base import *
|
||||
from onl.platform.netberg import *
|
||||
|
||||
class OnlPlatform_x86_64_netberg_aurora_620_rangeley_r0(OnlPlatformNetberg,
|
||||
OnlPlatformPortConfig_48x25_6x100):
|
||||
PLATFORM='x86-64-netberg-aurora-620-rangeley-r0'
|
||||
MODEL="AURORA620"
|
||||
SYS_OBJECT_ID=".620.1"
|
||||
|
||||
def baseconfig(self):
|
||||
self.insmod("hardware_monitor")
|
||||
return True
|
||||
2
packages/platforms/netberg/x86-64/x86-64-netberg-aurora-720-rangeley/.gitignore
vendored
Executable file
2
packages/platforms/netberg/x86-64/x86-64-netberg-aurora-720-rangeley/.gitignore
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
*x86*64*netberg*aurora*720*rangeley*.mk
|
||||
onlpdump.mk
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/no-platform-modules.yml ARCH=amd64 VENDOR=netberg BASENAME=x86-64-netberg-aurora-720-rangeley
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=x86-64-netberg-aurora-720-rangeley ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu
|
||||
@@ -0,0 +1,2 @@
|
||||
FILTER=src
|
||||
include $(ONL)/make/subdirs.mk
|
||||
@@ -0,0 +1,45 @@
|
||||
############################################################
|
||||
# <bsn.cl fy=2014 v=onl>
|
||||
#
|
||||
# Copyright 2014 BigSwitch Networks, Inc.
|
||||
#
|
||||
# Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
# either express or implied. See the License for the specific
|
||||
# language governing permissions and limitations under the
|
||||
# License.
|
||||
#
|
||||
# </bsn.cl>
|
||||
############################################################
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
include $(ONL)/make/config.amd64.mk
|
||||
|
||||
MODULE := libonlp-x86-64-netberg-aurora-720-rangeley
|
||||
include $(BUILDER)/standardinit.mk
|
||||
|
||||
DEPENDMODULES := AIM IOF x86_64_netberg_aurora_720_rangeley onlplib
|
||||
DEPENDMODULE_HEADERS := sff
|
||||
|
||||
include $(BUILDER)/dependmodules.mk
|
||||
|
||||
SHAREDLIB := libonlp-x86-64-netberg-aurora-720-rangeley.so
|
||||
$(SHAREDLIB)_TARGETS := $(ALL_TARGETS)
|
||||
include $(BUILDER)/so.mk
|
||||
.DEFAULT_GOAL := $(SHAREDLIB)
|
||||
|
||||
GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc
|
||||
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
|
||||
GLOBAL_CFLAGS += -fPIC
|
||||
GLOBAL_LINK_LIBS += -lpthread
|
||||
|
||||
include $(BUILDER)/targets.mk
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
############################################################
|
||||
# <bsn.cl fy=2014 v=onl>
|
||||
#
|
||||
# Copyright 2014 BigSwitch Networks, Inc.
|
||||
#
|
||||
# Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
# either express or implied. See the License for the specific
|
||||
# language governing permissions and limitations under the
|
||||
# License.
|
||||
#
|
||||
# </bsn.cl>
|
||||
############################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
include $(ONL)/make/config.amd64.mk
|
||||
|
||||
.DEFAULT_GOAL := onlpdump
|
||||
|
||||
MODULE := onlpdump
|
||||
include $(BUILDER)/standardinit.mk
|
||||
|
||||
DEPENDMODULES := AIM IOF onlp x86_64_netberg_aurora_720_rangeley onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS
|
||||
|
||||
include $(BUILDER)/dependmodules.mk
|
||||
|
||||
BINARY := onlpdump
|
||||
$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS)
|
||||
include $(BUILDER)/bin.mk
|
||||
|
||||
GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main
|
||||
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
|
||||
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
|
||||
GLOBAL_LINK_LIBS += -lpthread -lm
|
||||
|
||||
include $(BUILDER)/targets.mk
|
||||
@@ -0,0 +1 @@
|
||||
name: x86_64_netberg_aurora_720_rangeley
|
||||
@@ -0,0 +1,9 @@
|
||||
###############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
include $(ONL)/make/config.mk
|
||||
MODULE := x86_64_netberg_aurora_720_rangeley
|
||||
AUTOMODULE := x86_64_netberg_aurora_720_rangeley
|
||||
include $(BUILDER)/definemodule.mk
|
||||
@@ -0,0 +1,9 @@
|
||||
###############################################################################
|
||||
#
|
||||
# x86_64_netberg_aurora_720_rangeley Autogeneration
|
||||
#
|
||||
###############################################################################
|
||||
x86_64_netberg_aurora_720_rangeley_AUTO_DEFS := module/auto/x86_64_netberg_aurora_720_rangeley.yml
|
||||
x86_64_netberg_aurora_720_rangeley_AUTO_DIRS := module/inc/x86_64_netberg_aurora_720_rangeley module/src
|
||||
include $(BUILDER)/auto.mk
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
###############################################################################
|
||||
#
|
||||
# x86_64_netberg_aurora_720_rangeley Autogeneration Definitions.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
cdefs: &cdefs
|
||||
- X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_LOGGING:
|
||||
doc: "Include or exclude logging."
|
||||
default: 1
|
||||
- X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT:
|
||||
doc: "Default enabled log options."
|
||||
default: AIM_LOG_OPTIONS_DEFAULT
|
||||
- X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_BITS_DEFAULT:
|
||||
doc: "Default enabled log bits."
|
||||
default: AIM_LOG_BITS_DEFAULT
|
||||
- X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
|
||||
doc: "Default enabled custom log bits."
|
||||
default: 0
|
||||
- X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB:
|
||||
doc: "Default all porting macros to use the C standard libraries."
|
||||
default: 1
|
||||
- X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
|
||||
doc: "Include standard library headers for stdlib porting macros."
|
||||
default: X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
- X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_UCLI:
|
||||
doc: "Include generic uCli support."
|
||||
default: 0
|
||||
- X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD:
|
||||
doc: "RPM Threshold at which the fan is considered to have failed."
|
||||
default: 3000
|
||||
|
||||
definitions:
|
||||
cdefs:
|
||||
X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_HEADER:
|
||||
defs: *cdefs
|
||||
basename: x86_64_netberg_aurora_720_rangeley_config
|
||||
|
||||
enum: &enums
|
||||
|
||||
fan_id:
|
||||
members:
|
||||
- FAN1 : 1
|
||||
- FAN2 : 2
|
||||
- FAN3 : 3
|
||||
- FAN4 : 4
|
||||
- FAN5 : 5
|
||||
- FAN6 : 6
|
||||
- FAN7 : 7
|
||||
- FAN8 : 8
|
||||
- FAN9 : 9
|
||||
- FAN10 : 10
|
||||
|
||||
fan_oid:
|
||||
members:
|
||||
- FAN1 : ONLP_FAN_ID_CREATE(1)
|
||||
- FAN2 : ONLP_FAN_ID_CREATE(2)
|
||||
- FAN3 : ONLP_FAN_ID_CREATE(3)
|
||||
- FAN4 : ONLP_FAN_ID_CREATE(4)
|
||||
- FAN5 : ONLP_FAN_ID_CREATE(5)
|
||||
- FAN6 : ONLP_FAN_ID_CREATE(6)
|
||||
- FAN7 : ONLP_FAN_ID_CREATE(7)
|
||||
- FAN8 : ONLP_FAN_ID_CREATE(8)
|
||||
- FAN9 : ONLP_FAN_ID_CREATE(9)
|
||||
- FAN10 : ONLP_FAN_ID_CREATE(10)
|
||||
|
||||
psu_id:
|
||||
members:
|
||||
- PSU1 : 1
|
||||
- PSU2 : 2
|
||||
|
||||
psu_oid:
|
||||
members:
|
||||
- PSU1 : ONLP_PSU_ID_CREATE(1)
|
||||
- PSU2 : ONLP_PSU_ID_CREATE(2)
|
||||
|
||||
thermal_id:
|
||||
members:
|
||||
- THERMAL1 : 1
|
||||
- THERMAL2 : 2
|
||||
- THERMAL3 : 3
|
||||
- THERMAL4 : 4
|
||||
- THERMAL5 : 5
|
||||
- THERMAL6 : 6
|
||||
- THERMAL7 : 7
|
||||
|
||||
thermal_oid:
|
||||
members:
|
||||
- THERMAL1 : ONLP_THERMAL_ID_CREATE(1)
|
||||
- THERMAL2 : ONLP_THERMAL_ID_CREATE(2)
|
||||
- THERMAL3 : ONLP_THERMAL_ID_CREATE(3)
|
||||
- THERMAL4 : ONLP_THERMAL_ID_CREATE(4)
|
||||
- THERMAL5 : ONLP_THERMAL_ID_CREATE(5)
|
||||
- THERMAL6 : ONLP_THERMAL_ID_CREATE(6)
|
||||
- THERMAL7 : ONLP_THERMAL_ID_CREATE(7)
|
||||
|
||||
led_id:
|
||||
members:
|
||||
- STAT : 1
|
||||
|
||||
led_oid:
|
||||
members:
|
||||
- STAT : ONLP_LED_ID_CREATE(1)
|
||||
|
||||
|
||||
portingmacro:
|
||||
X86_64_NETBERG_AURORA_720_RANGELEY:
|
||||
macros:
|
||||
- memset
|
||||
- memcpy
|
||||
- strncpy
|
||||
- vsnprintf
|
||||
- snprintf
|
||||
- strlen
|
||||
@@ -0,0 +1,14 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_config.h>
|
||||
|
||||
/* <--auto.start.xmacro(ALL).define> */
|
||||
/* <auto.end.xmacro(ALL).define> */
|
||||
|
||||
/* <--auto.start.xenum(ALL).define> */
|
||||
/* <auto.end.xenum(ALL).define> */
|
||||
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* @file
|
||||
* @brief x86_64_netberg_aurora_720_rangeley Configuration Header
|
||||
*
|
||||
* @addtogroup x86_64_netberg_aurora_720_rangeley-config
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_H__
|
||||
#define __X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_H__
|
||||
|
||||
#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG
|
||||
#include <global_custom_config.h>
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_720_RANGELEY_INCLUDE_CUSTOM_CONFIG
|
||||
#include <x86_64_netberg_aurora_720_rangeley_custom_config.h>
|
||||
#endif
|
||||
|
||||
/* <auto.start.cdefs(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_HEADER).header> */
|
||||
#include <AIM/aim.h>
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_LOGGING
|
||||
*
|
||||
* Include or exclude logging. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_LOGGING
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_LOGGING 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
*
|
||||
* Default enabled log options. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_BITS_DEFAULT
|
||||
*
|
||||
* Default enabled log bits. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_BITS_DEFAULT
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
*
|
||||
* Default enabled custom log bits. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
*
|
||||
* Default all porting macros to use the C standard libraries. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
*
|
||||
* Include standard library headers for stdlib porting macros. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_UCLI
|
||||
*
|
||||
* Include generic uCli support. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_UCLI
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_UCLI 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD
|
||||
*
|
||||
* RPM Threshold at which the fan is considered to have failed. */
|
||||
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD 3000
|
||||
#endif
|
||||
|
||||
/**
|
||||
* All compile time options can be queried or displayed
|
||||
*/
|
||||
|
||||
/** Configuration settings structure. */
|
||||
typedef struct x86_64_netberg_aurora_720_rangeley_config_settings_s {
|
||||
/** name */
|
||||
const char* name;
|
||||
/** value */
|
||||
const char* value;
|
||||
} x86_64_netberg_aurora_720_rangeley_config_settings_t;
|
||||
|
||||
/** Configuration settings table. */
|
||||
/** x86_64_netberg_aurora_720_rangeley_config_settings table. */
|
||||
extern x86_64_netberg_aurora_720_rangeley_config_settings_t x86_64_netberg_aurora_720_rangeley_config_settings[];
|
||||
|
||||
/**
|
||||
* @brief Lookup a configuration setting.
|
||||
* @param setting The name of the configuration option to lookup.
|
||||
*/
|
||||
const char* x86_64_netberg_aurora_720_rangeley_config_lookup(const char* setting);
|
||||
|
||||
/**
|
||||
* @brief Show the compile-time configuration.
|
||||
* @param pvs The output stream.
|
||||
*/
|
||||
int x86_64_netberg_aurora_720_rangeley_config_show(struct aim_pvs_s* pvs);
|
||||
|
||||
/* <auto.end.cdefs(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_HEADER).header> */
|
||||
|
||||
#include "x86_64_netberg_aurora_720_rangeley_porting.h"
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_H__ */
|
||||
/* @} */
|
||||
@@ -0,0 +1,26 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* x86_64_netberg_aurora_720_rangeley Doxygen Header
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_720_RANGELEY_DOX_H__
|
||||
#define __X86_64_NETBERG_AURORA_720_RANGELEY_DOX_H__
|
||||
|
||||
/**
|
||||
* @defgroup x86_64_netberg_aurora_720_rangeley x86_64_netberg_aurora_720_rangeley - x86_64_netberg_aurora_720_rangeley Description
|
||||
*
|
||||
|
||||
The documentation overview for this module should go here.
|
||||
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @defgroup x86_64_netberg_aurora_720_rangeley-x86_64_netberg_aurora_720_rangeley Public Interface
|
||||
* @defgroup x86_64_netberg_aurora_720_rangeley-config Compile Time Configuration
|
||||
* @defgroup x86_64_netberg_aurora_720_rangeley-porting Porting Macros
|
||||
*
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_720_RANGELEY_DOX_H__ */
|
||||
@@ -0,0 +1,87 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* @file
|
||||
* @brief x86_64_netberg_aurora_720_rangeley Porting Macros.
|
||||
*
|
||||
* @addtogroup x86_64_netberg_aurora_720_rangeley-porting
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_720_RANGELEY_PORTING_H__
|
||||
#define __X86_64_NETBERG_AURORA_720_RANGELEY_PORTING_H__
|
||||
|
||||
|
||||
/* <auto.start.portingmacro(ALL).define> */
|
||||
#if X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <memory.h>
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_MEMSET
|
||||
#if defined(GLOBAL_MEMSET)
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_MEMSET GLOBAL_MEMSET
|
||||
#elif X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_MEMSET memset
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_720_RANGELEY_MEMSET is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_MEMCPY
|
||||
#if defined(GLOBAL_MEMCPY)
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_MEMCPY GLOBAL_MEMCPY
|
||||
#elif X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_MEMCPY memcpy
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_720_RANGELEY_MEMCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_STRNCPY
|
||||
#if defined(GLOBAL_STRNCPY)
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_STRNCPY GLOBAL_STRNCPY
|
||||
#elif X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_STRNCPY strncpy
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_720_RANGELEY_STRNCPY is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_VSNPRINTF
|
||||
#if defined(GLOBAL_VSNPRINTF)
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_VSNPRINTF GLOBAL_VSNPRINTF
|
||||
#elif X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_VSNPRINTF vsnprintf
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_720_RANGELEY_VSNPRINTF is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_SNPRINTF
|
||||
#if defined(GLOBAL_SNPRINTF)
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_SNPRINTF GLOBAL_SNPRINTF
|
||||
#elif X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_SNPRINTF snprintf
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_720_RANGELEY_SNPRINTF is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_STRLEN
|
||||
#if defined(GLOBAL_STRLEN)
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_STRLEN GLOBAL_STRLEN
|
||||
#elif X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB == 1
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_STRLEN strlen
|
||||
#else
|
||||
#error The macro X86_64_NETBERG_AURORA_720_RANGELEY_STRLEN is required but cannot be defined.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* <auto.end.portingmacro(ALL).define> */
|
||||
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_720_RANGELEY_PORTING_H__ */
|
||||
/* @} */
|
||||
@@ -0,0 +1,10 @@
|
||||
###############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
x86_64_netberg_aurora_720_rangeley_INCLUDES := -I $(THIS_DIR)inc
|
||||
x86_64_netberg_aurora_720_rangeley_INTERNAL_INCLUDES := -I $(THIS_DIR)src
|
||||
x86_64_netberg_aurora_720_rangeley_DEPENDMODULE_ENTRIES := init:x86_64_netberg_aurora_720_rangeley ucli:x86_64_netberg_aurora_720_rangeley
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
###############################################################################
|
||||
#
|
||||
# Local source generation targets.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
ucli:
|
||||
@../../../../tools/uclihandlers.py x86_64_netberg_aurora_720_rangeley_ucli.c
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
*
|
||||
* Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_config.h>
|
||||
#include <onlp/platformi/fani.h>
|
||||
|
||||
#include "x86_64_netberg_aurora_720_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_720_rangeley_log.h"
|
||||
|
||||
#include <onlplib/file.h>
|
||||
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_FAN(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static int
|
||||
sys_fan_info_get__(onlp_fan_info_t* info, int id)
|
||||
{
|
||||
int value = 0;
|
||||
int rv;
|
||||
|
||||
rv = onlp_file_read_int(&value, SYS_HWMON2_PREFIX "/fan%d_abs", ((id/2)+1));
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
return rv;
|
||||
|
||||
if (value == 0)
|
||||
{
|
||||
info->status = ONLP_FAN_STATUS_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->status = ONLP_FAN_STATUS_PRESENT;
|
||||
|
||||
rv = onlp_file_read_int(&value, SYS_HWMON2_PREFIX "/fan%d_dir", ((id/2)+1));
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
return rv;
|
||||
|
||||
if (value == 1)
|
||||
{
|
||||
info->status |= ONLP_FAN_STATUS_B2F;
|
||||
info->caps |= ONLP_FAN_CAPS_B2F;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->status |= ONLP_FAN_STATUS_F2B;
|
||||
info->caps |= ONLP_FAN_CAPS_F2B;
|
||||
}
|
||||
|
||||
rv = onlp_file_read_int(&(info->rpm), SYS_HWMON1_PREFIX "/fan%d_rpm", (id+1));
|
||||
if (rv == ONLP_STATUS_E_INTERNAL)
|
||||
return rv;
|
||||
|
||||
if (rv == ONLP_STATUS_E_MISSING)
|
||||
{
|
||||
info->status &= ~1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (info->rpm <= X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD)
|
||||
info->status |= ONLP_FAN_STATUS_FAILED;
|
||||
|
||||
|
||||
rv = onlp_file_read_int(&(info->percentage), SYS_HWMON1_PREFIX "/fan%d_duty", (id+1));
|
||||
if (rv == ONLP_STATUS_E_INTERNAL)
|
||||
return rv;
|
||||
|
||||
if (rv == ONLP_STATUS_E_MISSING)
|
||||
{
|
||||
info->status &= ~1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
psu_fan_info_get__(onlp_fan_info_t* info, int id)
|
||||
{
|
||||
return onlp_file_read_int(&(info->rpm), SYS_HWMON2_PREFIX "/psu%d_fan_speed", id);
|
||||
}
|
||||
|
||||
/* Onboard Fans */
|
||||
static onlp_fan_info_t fans__[] = {
|
||||
{ }, /* Not used */
|
||||
{ { FAN_OID_FAN1, "Fan1_rotor1", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN2, "Fan1_rotor2", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN3, "Fan2_rotor1", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN4, "Fan2_rotor2", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN5, "Fan3_rotor1", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN6, "Fan3_rotor2", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN7, "Fan4_rotor1", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN8, "Fan4_rotor2", 0}, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN9, "PSU-1 Fan", 0 }, ONLP_FAN_STATUS_PRESENT },
|
||||
{ { FAN_OID_FAN10, "PSU-2 Fan", 0 }, ONLP_FAN_STATUS_PRESENT },
|
||||
};
|
||||
|
||||
/*
|
||||
* This function will be called prior to all of onlp_fani_* functions.
|
||||
*/
|
||||
int
|
||||
onlp_fani_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info)
|
||||
{
|
||||
int fid;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
memset(info, 0, sizeof(onlp_fan_info_t));
|
||||
fid = ONLP_OID_ID_GET(id);
|
||||
*info = fans__[fid];
|
||||
|
||||
info->caps |= ONLP_FAN_CAPS_GET_RPM;
|
||||
|
||||
switch(fid)
|
||||
{
|
||||
case FAN_ID_FAN1:
|
||||
case FAN_ID_FAN2:
|
||||
case FAN_ID_FAN3:
|
||||
case FAN_ID_FAN4:
|
||||
case FAN_ID_FAN5:
|
||||
case FAN_ID_FAN6:
|
||||
case FAN_ID_FAN7:
|
||||
case FAN_ID_FAN8:
|
||||
return sys_fan_info_get__(info, (fid - 1));
|
||||
break;
|
||||
|
||||
case FAN_ID_FAN9:
|
||||
case FAN_ID_FAN10:
|
||||
return psu_fan_info_get__(info, (fid - FAN_ID_FAN9 + 1));
|
||||
break;
|
||||
|
||||
default:
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
break;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function sets the speed of the given fan in RPM.
|
||||
*
|
||||
* This function will only be called if the fan supprots the RPM_SET
|
||||
* capability.
|
||||
*
|
||||
* It is optional if you have no fans at all with this feature.
|
||||
*/
|
||||
int
|
||||
onlp_fani_rpm_set(onlp_oid_t id, int rpm)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function sets the fan speed of the given OID as a percentage.
|
||||
*
|
||||
* This will only be called if the OID has the PERCENTAGE_SET
|
||||
* capability.
|
||||
*
|
||||
* It is optional if you have no fans at all with this feature.
|
||||
*/
|
||||
int
|
||||
onlp_fani_percentage_set(onlp_oid_t id, int p)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function sets the fan speed of the given OID as per
|
||||
* the predefined ONLP fan speed modes: off, slow, normal, fast, max.
|
||||
*
|
||||
* Interpretation of these modes is up to the platform.
|
||||
*
|
||||
*/
|
||||
int
|
||||
onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function sets the fan direction of the given OID.
|
||||
*
|
||||
* This function is only relevant if the fan OID supports both direction
|
||||
* capabilities.
|
||||
*
|
||||
* This function is optional unless the functionality is available.
|
||||
*/
|
||||
int
|
||||
onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic fan ioctl. Optional.
|
||||
*/
|
||||
int
|
||||
onlp_fani_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
* Copyright 2013 Accton Technology Corporation.
|
||||
*
|
||||
* Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <onlp/platformi/ledi.h>
|
||||
#include <onlplib/file.h>
|
||||
#include "x86_64_netberg_aurora_720_rangeley_int.h"
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_LED(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/* LED related data
|
||||
*/
|
||||
enum led_light_mode { /*must be the same with the definition @ kernel driver */
|
||||
LED_MODE_OFF = 0,
|
||||
LED_MODE_AMBER,
|
||||
LED_MODE_GREEN,
|
||||
};
|
||||
|
||||
int led_light_map_mode[][2] =
|
||||
{
|
||||
{LED_MODE_OFF, ONLP_LED_MODE_OFF},
|
||||
{LED_MODE_AMBER, ONLP_LED_MODE_ORANGE},
|
||||
{LED_MODE_GREEN, ONLP_LED_MODE_GREEN},
|
||||
};
|
||||
|
||||
/*
|
||||
* Get the information for the given LED OID.
|
||||
*/
|
||||
static onlp_led_info_t linfo[] =
|
||||
{
|
||||
{ }, /* Not used */
|
||||
{
|
||||
{ LED_OID_LED1, "Chassis LED 1 (STAT LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN,
|
||||
ONLP_LED_MODE_OFF,
|
||||
},
|
||||
};
|
||||
|
||||
static int conver_led_light_mode_to_driver(int led_ligth_mode)
|
||||
{
|
||||
int i, nsize = sizeof(led_light_map_mode)/sizeof(led_light_map_mode[0]);
|
||||
for(i=0; i<nsize; i++)
|
||||
{
|
||||
if (led_ligth_mode == led_light_map_mode[i][1])
|
||||
{
|
||||
return led_light_map_mode[i][0];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will be called prior to any other onlp_ledi_* functions.
|
||||
*/
|
||||
int
|
||||
onlp_ledi_init(void)
|
||||
{
|
||||
/*
|
||||
* Turn on the STAT LEDs at startup
|
||||
*/
|
||||
onlp_ledi_mode_set(LED_OID_LED1, ONLP_LED_MODE_GREEN);
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
{
|
||||
int local_id;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
memset(info, 0, sizeof(onlp_led_info_t));
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
*info = linfo[local_id];
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Turn an LED on or off.
|
||||
*
|
||||
* This function will only be called if the LED OID supports the ONOFF
|
||||
* capability.
|
||||
*
|
||||
* What 'on' means in terms of colors or modes for multimode LEDs is
|
||||
* up to the platform to decide. This is intended as baseline toggle mechanism.
|
||||
*/
|
||||
int
|
||||
onlp_ledi_set(onlp_oid_t id, int on_or_off)
|
||||
{
|
||||
VALIDATE(id);
|
||||
|
||||
if (!on_or_off)
|
||||
return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF);
|
||||
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function puts the LED into the given mode. It is a more functional
|
||||
* interface for multimode LEDs.
|
||||
*
|
||||
* Only modes reported in the LED's capabilities will be attempted.
|
||||
*/
|
||||
int
|
||||
onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
{
|
||||
int local_id;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
local_id = ONLP_OID_ID_GET(id);
|
||||
switch(local_id)
|
||||
{
|
||||
case LED_ID_LED1:
|
||||
linfo[local_id].status = ONLP_LED_STATUS_PRESENT;
|
||||
if (mode != ONLP_LED_MODE_OFF)
|
||||
linfo[local_id].status |= ONLP_LED_STATUS_ON;
|
||||
linfo[local_id].mode = mode;
|
||||
return onlp_file_write_int(conver_led_light_mode_to_driver(mode), SYS_HWMON2_PREFIX "/system_led");
|
||||
break;
|
||||
|
||||
default:
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
break;
|
||||
}
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic LED ioctl interface.
|
||||
*/
|
||||
int
|
||||
onlp_ledi_ioctl(onlp_oid_t id, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
###############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
LIBRARY := x86_64_netberg_aurora_720_rangeley
|
||||
$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
include $(BUILDER)/lib.mk
|
||||
@@ -0,0 +1,201 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_config.h>
|
||||
#include <onlp/platformi/psui.h>
|
||||
#include <onlplib/file.h>
|
||||
#include "x86_64_netberg_aurora_720_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_720_rangeley_log.h"
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_PSU(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static onlp_psu_info_t psus__[] = {
|
||||
{ }, /* Not used */
|
||||
{
|
||||
{
|
||||
PSU_OID_PSU1,
|
||||
"PSU-1",
|
||||
0,
|
||||
{
|
||||
FAN_OID_FAN9,
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
PSU_OID_PSU2,
|
||||
"PSU-2",
|
||||
0,
|
||||
{
|
||||
FAN_OID_FAN10,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* This function will be called prior to any other onlp_psui functions.
|
||||
*/
|
||||
int
|
||||
onlp_psui_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
|
||||
{
|
||||
int rv;
|
||||
int pid;
|
||||
uint8_t data[256];
|
||||
int value = -1;
|
||||
int len;
|
||||
double dvalue;
|
||||
int i;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
memset(info, 0, sizeof(onlp_psu_info_t));
|
||||
pid = ONLP_OID_ID_GET(id);
|
||||
*info = psus__[pid];
|
||||
|
||||
rv = onlp_file_read_int(&value, SYS_HWMON1_PREFIX "/psu%d_abs", pid);
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
return rv;
|
||||
if (value == 0)
|
||||
{
|
||||
info->status = ONLP_PSU_STATUS_UNPLUGGED;
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/* PSU is present. */
|
||||
info->status = ONLP_PSU_STATUS_PRESENT;
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_eeprom", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
i = 11;
|
||||
|
||||
/* Manufacturer Name */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
i += len;
|
||||
|
||||
/* Product Name */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
memcpy(info->model, (char *) &(data[i]), len);
|
||||
i += len;
|
||||
|
||||
/* Product part,model number */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
i += len;
|
||||
|
||||
/* Product Version */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
i += len;
|
||||
|
||||
/* Product Serial Number */
|
||||
len = (data[i]&0x0f);
|
||||
i++;
|
||||
memcpy(info->serial, (char *) &(data[i]), len);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(info->model, "Missing");
|
||||
strcpy(info->serial, "Missing");
|
||||
}
|
||||
|
||||
info->caps |= ONLP_PSU_CAPS_AC;
|
||||
|
||||
#if 0
|
||||
/* PSU is powered. */
|
||||
rv = onlp_file_read_int(&value, SYS_HWMON1_PREFIX "/psu%d_pg", pid);
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
return rv;
|
||||
if (value == 0)
|
||||
{
|
||||
info->status |= ONLP_PSU_STATUS_FAILED;
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_iout", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)data);
|
||||
if (dvalue > 0.0)
|
||||
{
|
||||
info->caps |= ONLP_PSU_CAPS_IOUT;
|
||||
info->miout = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_vout", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)data);
|
||||
if (dvalue > 0.0)
|
||||
{
|
||||
info->caps |= ONLP_PSU_CAPS_VOUT;
|
||||
info->mvout = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_pin", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)data);
|
||||
if (dvalue > 0.0)
|
||||
{
|
||||
info->caps |= ONLP_PSU_CAPS_PIN;
|
||||
info->mpin = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/psu%d_pout", pid);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)data);
|
||||
if (dvalue > 0.0)
|
||||
{
|
||||
info->caps |= ONLP_PSU_CAPS_POUT;
|
||||
info->mpout = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is an optional generic ioctl() interface.
|
||||
* Its purpose is to allow future expansion and
|
||||
* custom functionality that is not otherwise exposed
|
||||
* in the standard interface.
|
||||
*
|
||||
* The semantics of this function are platform specific.
|
||||
* This function is completely optional.
|
||||
*/
|
||||
int
|
||||
onlp_psui_ioctl(onlp_oid_t pid, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,389 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
*
|
||||
* Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
* SFPI Interface for the Aurora 720 Platform
|
||||
*
|
||||
***********************************************************/
|
||||
#include <x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_config.h>
|
||||
#include <onlp/oids.h>
|
||||
#include <onlp/platformi/sfpi.h>
|
||||
#include <onlplib/file.h>
|
||||
#include <onlplib/sfp.h>
|
||||
#include "x86_64_netberg_aurora_720_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_720_rangeley_log.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/* Model ID Definition */
|
||||
typedef enum
|
||||
{
|
||||
HURACAN_WITH_BMC = 0x0,
|
||||
HURACAN_WITHOUT_BMC,
|
||||
CABRERAIII_WITH_BMC,
|
||||
CABRERAIII_WITHOUT_BMC,
|
||||
SESTO_WITH_BMC,
|
||||
SESTO_WITHOUT_BMC,
|
||||
NCIIX_WITH_BMC,
|
||||
NCIIX_WITHOUT_BMC,
|
||||
ASTERION_WITH_BMC,
|
||||
ASTERION_WITHOUT_BMC,
|
||||
HURACAN_A_WITH_BMC,
|
||||
HURACAN_A_WITHOUT_BMC,
|
||||
|
||||
MODEL_ID_LAST
|
||||
} modelId_t;
|
||||
|
||||
static int
|
||||
onlp_board_model_id_get(void)
|
||||
{
|
||||
static int board_model_id = MODEL_ID_LAST;
|
||||
|
||||
if (board_model_id == MODEL_ID_LAST)
|
||||
{
|
||||
if (onlp_file_read_int(&board_model_id, SYS_HWMON1_PREFIX "/board_model_id") != ONLP_STATUS_OK)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return board_model_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will be called prior to all other onlp_sfpi_* functions.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function should populate the give bitmap with
|
||||
* all valid, SFP-capable port numbers.
|
||||
*
|
||||
* Only port numbers in this bitmap will be queried by the the
|
||||
* ONLP framework.
|
||||
*
|
||||
* No SFPI functions will be called with ports that are
|
||||
* not in this bitmap. You can ignore all error checking
|
||||
* on the incoming ports defined in this interface.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap)
|
||||
{
|
||||
int p;
|
||||
int total_port = 0;
|
||||
int board_model_id = onlp_board_model_id_get();
|
||||
|
||||
switch (board_model_id)
|
||||
{
|
||||
case HURACAN_WITH_BMC:
|
||||
case HURACAN_WITHOUT_BMC:
|
||||
case HURACAN_A_WITH_BMC:
|
||||
case HURACAN_A_WITHOUT_BMC:
|
||||
total_port = 32;
|
||||
break;
|
||||
|
||||
case SESTO_WITH_BMC:
|
||||
case SESTO_WITHOUT_BMC:
|
||||
case NCIIX_WITH_BMC:
|
||||
case NCIIX_WITHOUT_BMC:
|
||||
total_port = 54;
|
||||
break;
|
||||
|
||||
case ASTERION_WITH_BMC:
|
||||
case ASTERION_WITHOUT_BMC:
|
||||
total_port = 64;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
AIM_BITMAP_CLR_ALL(bmap);
|
||||
for(p = 0; p < total_port; p++)
|
||||
AIM_BITMAP_SET(bmap, p);
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function should return whether an SFP is inserted on the given
|
||||
* port.
|
||||
*
|
||||
* Returns 1 if the SFP is present.
|
||||
* Returns 0 if the SFP is not present.
|
||||
* Returns ONLP_E_* if there was an error determining the status.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_is_present(int port)
|
||||
{
|
||||
int value = 0;
|
||||
|
||||
onlp_file_read_int(&value, SYS_HWMON2_PREFIX "/port_%d_abs", (port+1));
|
||||
return value;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_port_map(int port, int* rport)
|
||||
{
|
||||
int board_model_id = onlp_board_model_id_get();
|
||||
|
||||
switch (board_model_id)
|
||||
{
|
||||
case HURACAN_WITH_BMC:
|
||||
case HURACAN_WITHOUT_BMC:
|
||||
case HURACAN_A_WITH_BMC:
|
||||
case HURACAN_A_WITHOUT_BMC:
|
||||
/* odd <=> even */
|
||||
if (port & 0x1)
|
||||
*rport = (port - 1);
|
||||
else
|
||||
*rport = (port + 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
*rport = port; break;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* bmap)
|
||||
{
|
||||
int p;
|
||||
int total_port = 0;
|
||||
int board_model_id = onlp_board_model_id_get();
|
||||
|
||||
switch (board_model_id)
|
||||
{
|
||||
case SESTO_WITH_BMC:
|
||||
case SESTO_WITHOUT_BMC:
|
||||
case NCIIX_WITH_BMC:
|
||||
case NCIIX_WITHOUT_BMC:
|
||||
case ASTERION_WITH_BMC:
|
||||
case ASTERION_WITHOUT_BMC:
|
||||
total_port = 48;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
AIM_BITMAP_CLR_ALL(bmap);
|
||||
for(p = 0; p < total_port; p++)
|
||||
AIM_BITMAP_SET(bmap, p);
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function reads the SFPs idrom and returns in
|
||||
* in the data buffer provided.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_eeprom_read(int port, uint8_t data[256])
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
char fname[128];
|
||||
|
||||
memset(data, 0, 256);
|
||||
memset(fname, 0, sizeof(fname));
|
||||
sprintf(fname, SYS_HWMON2_PREFIX "/port_%d_data_a0", (port+1));
|
||||
rv = onlplib_sfp_eeprom_read_file(fname, data);
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
AIM_LOG_INFO("Unable to read eeprom from port(%d)\r\n", port);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_dom_read(int port, uint8_t data[256])
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
char fname[128];
|
||||
|
||||
memset(data, 0, 256);
|
||||
memset(fname, 0, sizeof(fname));
|
||||
sprintf(fname, SYS_HWMON2_PREFIX "/port_%d_data_a2", (port+1));
|
||||
rv = onlplib_sfp_eeprom_read_file(fname, data);
|
||||
if (rv != ONLP_STATUS_OK)
|
||||
AIM_LOG_INFO("Unable to read eeprom from port(%d)\r\n", port);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* Manually enable or disable the given SFP.
|
||||
*
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_enable_set(int port, int enable)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns whether the SFP is currently enabled or disabled.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_enable_get(int port, int* enable)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the platform requires any setup or equalizer modifications
|
||||
* based on the actual SFP that was inserted then that custom
|
||||
* setup should be performed here.
|
||||
*
|
||||
* After a new SFP is detected by the ONLP framework this
|
||||
* function will be called to perform the (optional) setup.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_post_insert(int port, sff_info_t* sff_info)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the current status of the SFP.
|
||||
* See onlp_sfp_status_t;
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_status_get(int port, uint32_t* status)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int onlp_sfpi_control_supported(int port, onlp_sfp_control_t control, int* supported)
|
||||
{
|
||||
if (supported == NULL)
|
||||
return ONLP_STATUS_E_PARAM;
|
||||
|
||||
*supported = 0;
|
||||
switch (control)
|
||||
{
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
case ONLP_SFP_CONTROL_RX_LOS:
|
||||
{
|
||||
int board_model_id = onlp_board_model_id_get();
|
||||
|
||||
switch (board_model_id)
|
||||
{
|
||||
case SESTO_WITH_BMC:
|
||||
case SESTO_WITHOUT_BMC:
|
||||
case NCIIX_WITH_BMC:
|
||||
case NCIIX_WITHOUT_BMC:
|
||||
case ASTERION_WITH_BMC:
|
||||
case ASTERION_WITHOUT_BMC:
|
||||
if (port < 48)
|
||||
*supported = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value)
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
int supported = 0;
|
||||
|
||||
if ((onlp_sfpi_control_supported(port, control, &supported) == ONLP_STATUS_OK) && (supported == 0))
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
|
||||
switch (control)
|
||||
{
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
rv = onlp_file_write_int(value, SYS_HWMON2_PREFIX "/port_%d_tx_disable", (port+1));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value)
|
||||
{
|
||||
int rv = ONLP_STATUS_OK;
|
||||
int supported = 0;
|
||||
|
||||
if (value == NULL)
|
||||
return ONLP_STATUS_E_PARAM;
|
||||
|
||||
if ((onlp_sfpi_control_supported(port, control, &supported) == ONLP_STATUS_OK) && (supported == 0))
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
|
||||
*value = 0;
|
||||
switch (control)
|
||||
{
|
||||
case ONLP_SFP_CONTROL_RX_LOS:
|
||||
rv = onlp_file_read_int(value, SYS_HWMON2_PREFIX "/port_%d_rxlos", (port+1));
|
||||
break;
|
||||
|
||||
case ONLP_SFP_CONTROL_TX_DISABLE:
|
||||
rv = onlp_file_read_int(value, SYS_HWMON2_PREFIX "/port_%d_tx_disable", (port+1));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a generic ioctl interface.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_ioctl(int port, va_list vargs)
|
||||
{
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* De-initialize the SFPI subsystem.
|
||||
*/
|
||||
int
|
||||
onlp_sfpi_denit(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <onlp/platformi/sysi.h>
|
||||
#include <onlplib/file.h>
|
||||
#include "x86_64_netberg_aurora_720_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_720_rangeley_log.h"
|
||||
|
||||
/*
|
||||
* This is the first function called by the ONLP framework.
|
||||
*
|
||||
* It should return the name of your platform driver.
|
||||
*
|
||||
* If the name of your platform driver is the same as the
|
||||
* current platform then this driver will be used.
|
||||
*
|
||||
* If the name of the driver is different from the current
|
||||
* platform, or the driver is capable of supporting multiple
|
||||
* platform variants, see onlp_sysi_platform_set() below.
|
||||
*/
|
||||
const char*
|
||||
onlp_sysi_platform_get(void)
|
||||
{
|
||||
return "x86-64-netberg-aurora-720-rangeley-r0";
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the first function the ONLP framework will call
|
||||
* after it has validated the the platform is supported using the mechanisms
|
||||
* described above.
|
||||
*
|
||||
* If this function does not return ONL_STATUS_OK
|
||||
* then platform initialization is aborted.
|
||||
*/
|
||||
int
|
||||
onlp_sysi_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sysi_onie_info_get(onlp_onie_info_t* onie)
|
||||
{
|
||||
int rv;
|
||||
uint8_t data[256];
|
||||
int len;
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
rv = onlp_file_read(data, sizeof(data), &len, SYS_HWMON2_PREFIX "/eeprom");
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
rv = onlp_onie_decode(onie, (uint8_t*)data, sizeof(data));
|
||||
if(rv >= 0)
|
||||
{
|
||||
onie->platform_name = aim_strdup("x86-64-netberg-aurora-720-rangeley-r0");
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sysi_oids_get(onlp_oid_t* table, int max)
|
||||
{
|
||||
onlp_oid_t* e = table;
|
||||
memset(table, 0, max*sizeof(onlp_oid_t));
|
||||
int i;
|
||||
int n_thermal=7, n_fan=10, n_led=1;
|
||||
|
||||
/* 2 PSUs */
|
||||
*e++ = ONLP_PSU_ID_CREATE(1);
|
||||
*e++ = ONLP_PSU_ID_CREATE(2);
|
||||
|
||||
/* LEDs Item */
|
||||
for (i=1; i<=n_led; i++)
|
||||
{
|
||||
*e++ = ONLP_LED_ID_CREATE(i);
|
||||
}
|
||||
|
||||
/* THERMALs Item */
|
||||
for (i=1; i<=n_thermal; i++)
|
||||
{
|
||||
*e++ = ONLP_THERMAL_ID_CREATE(i);
|
||||
}
|
||||
|
||||
/* Fans Item */
|
||||
for (i=1; i<=n_fan; i++)
|
||||
{
|
||||
*e++ = ONLP_FAN_ID_CREATE(i);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
/************************************************************
|
||||
* <bsn.cl fy=2014 v=onl>
|
||||
*
|
||||
* Copyright 2014 Big Switch Networks, Inc.
|
||||
*
|
||||
* Licensed under the Eclipse Public License, Version 1.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*
|
||||
* </bsn.cl>
|
||||
************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
***********************************************************/
|
||||
#include <onlp/platformi/thermali.h>
|
||||
#include <onlplib/file.h>
|
||||
#include "x86_64_netberg_aurora_720_rangeley_int.h"
|
||||
#include "x86_64_netberg_aurora_720_rangeley_log.h"
|
||||
|
||||
#define VALIDATE(_id) \
|
||||
do { \
|
||||
if(!ONLP_OID_IS_THERMAL(_id)) { \
|
||||
return ONLP_STATUS_E_INVALID; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static int
|
||||
sys_thermal_info_get__(onlp_thermal_info_t* info, int id)
|
||||
{
|
||||
int rv;
|
||||
|
||||
if (id == THERMAL_ID_THERMAL3)
|
||||
{
|
||||
rv = onlp_file_read_int(&info->mcelsius, SYS_HWMON1_PREFIX "/mac_temp");
|
||||
info->mcelsius *= 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t buffer[64];
|
||||
double dvalue;
|
||||
int len;
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
rv = onlp_file_read(buffer, sizeof(buffer), &len, SYS_HWMON1_PREFIX "/remote_temp%d", id);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)buffer);
|
||||
info->mcelsius = (int)(dvalue * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
if(rv == ONLP_STATUS_E_INTERNAL)
|
||||
return rv;
|
||||
|
||||
if(rv == ONLP_STATUS_E_MISSING)
|
||||
{
|
||||
info->status &= ~1;
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
psu1_thermal_info_get__(onlp_thermal_info_t* info, int id)
|
||||
{
|
||||
int rv;
|
||||
uint8_t buffer[64];
|
||||
double dvalue;
|
||||
int len;
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
rv = onlp_file_read(buffer, sizeof(buffer), &len, SYS_HWMON2_PREFIX "/psu1_temp_%d", id);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)buffer);
|
||||
info->mcelsius = (int)(dvalue * 1000);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
psu2_thermal_info_get__(onlp_thermal_info_t* info, int id)
|
||||
{
|
||||
int rv;
|
||||
uint8_t buffer[64];
|
||||
double dvalue;
|
||||
int len;
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
rv = onlp_file_read(buffer, sizeof(buffer), &len, SYS_HWMON2_PREFIX "/psu2_temp_%d", id);
|
||||
if (rv == ONLP_STATUS_OK)
|
||||
{
|
||||
dvalue = atof((const char *)buffer);
|
||||
info->mcelsius = (int)(dvalue * 1000);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static onlp_thermal_info_t temps__[] =
|
||||
{
|
||||
{ }, /* Not used */
|
||||
{ { THERMAL_OID_THERMAL1, "Chassis Thermal 1 (Front of MAC)", 0}, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
{ { THERMAL_OID_THERMAL2, "Chassis Thermal 2 (Rear of MAC)", 0}, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
{ { THERMAL_OID_THERMAL3, "Chassis Thermal 3 (MAC)", 0}, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
|
||||
{ { THERMAL_OID_THERMAL4, "PSU-1 Thermal 1", PSU_OID_PSU1 }, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
{ { THERMAL_OID_THERMAL5, "PSU-1 Thermal 2", PSU_OID_PSU1 }, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
|
||||
{ { THERMAL_OID_THERMAL6, "PSU-2 Thermal 1", PSU_OID_PSU2 }, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
{ { THERMAL_OID_THERMAL7, "PSU-2 Thermal 2", PSU_OID_PSU2 }, ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0},
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* This will be called to intiialize the thermali subsystem.
|
||||
*/
|
||||
int
|
||||
onlp_thermali_init(void)
|
||||
{
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve the information structure for the given thermal OID.
|
||||
*
|
||||
* If the OID is invalid, return ONLP_E_STATUS_INVALID.
|
||||
* If an unexpected error occurs, return ONLP_E_STATUS_INTERNAL.
|
||||
* Otherwise, return ONLP_STATUS_OK with the OID's information.
|
||||
*
|
||||
* Note -- it is expected that you fill out the information
|
||||
* structure even if the sensor described by the OID is not present.
|
||||
*/
|
||||
int
|
||||
onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info)
|
||||
{
|
||||
int tid;
|
||||
|
||||
VALIDATE(id);
|
||||
|
||||
memset(info, 0, sizeof(onlp_thermal_info_t));
|
||||
tid = ONLP_OID_ID_GET(id);
|
||||
*info = temps__[tid];
|
||||
|
||||
switch(tid)
|
||||
{
|
||||
case THERMAL_ID_THERMAL1:
|
||||
case THERMAL_ID_THERMAL2:
|
||||
case THERMAL_ID_THERMAL3:
|
||||
return sys_thermal_info_get__(info, tid);
|
||||
|
||||
case THERMAL_ID_THERMAL4:
|
||||
case THERMAL_ID_THERMAL5:
|
||||
return psu1_thermal_info_get__(info, (tid - THERMAL_ID_THERMAL4 + 1));
|
||||
|
||||
case THERMAL_ID_THERMAL6:
|
||||
case THERMAL_ID_THERMAL7:
|
||||
return psu2_thermal_info_get__(info, (tid - THERMAL_ID_THERMAL6 + 1));
|
||||
}
|
||||
|
||||
return ONLP_STATUS_E_INVALID;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_config.h>
|
||||
|
||||
/* <auto.start.cdefs(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_HEADER).source> */
|
||||
#define __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME(_x) #_x
|
||||
#define __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_VALUE(_x) __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME(_x)
|
||||
x86_64_netberg_aurora_720_rangeley_config_settings_t x86_64_netberg_aurora_720_rangeley_config_settings[] =
|
||||
{
|
||||
#ifdef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_LOGGING
|
||||
{ __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_LOGGING), __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_LOGGING) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_LOGGING(__x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT
|
||||
{ __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT), __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT(__x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_BITS_DEFAULT
|
||||
{ __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_BITS_DEFAULT), __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_BITS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_BITS_DEFAULT(__x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
{ __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB
|
||||
{ __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB), __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB(__x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS
|
||||
{ __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_UCLI
|
||||
{ __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_UCLI), __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_UCLI) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_UCLI(__x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
#ifdef X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD
|
||||
{ __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD), __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_VALUE(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD) },
|
||||
#else
|
||||
{ X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD(__x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME), "__undefined__" },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
#undef __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_VALUE
|
||||
#undef __x86_64_netberg_aurora_720_rangeley_config_STRINGIFY_NAME
|
||||
|
||||
const char*
|
||||
x86_64_netberg_aurora_720_rangeley_config_lookup(const char* setting)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; x86_64_netberg_aurora_720_rangeley_config_settings[i].name; i++) {
|
||||
if(strcmp(x86_64_netberg_aurora_720_rangeley_config_settings[i].name, setting)) {
|
||||
return x86_64_netberg_aurora_720_rangeley_config_settings[i].value;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
x86_64_netberg_aurora_720_rangeley_config_show(struct aim_pvs_s* pvs)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; x86_64_netberg_aurora_720_rangeley_config_settings[i].name; i++) {
|
||||
aim_printf(pvs, "%s = %s\n", x86_64_netberg_aurora_720_rangeley_config_settings[i].name, x86_64_netberg_aurora_720_rangeley_config_settings[i].value);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/* <auto.end.cdefs(X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_HEADER).source> */
|
||||
@@ -0,0 +1,10 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_config.h>
|
||||
|
||||
/* <--auto.start.enum(ALL).source> */
|
||||
/* <auto.end.enum(ALL).source> */
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* x86_64_netberg_aurora_720_rangeley Internal Header
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_720_RANGELEY_INT_H__
|
||||
#define __X86_64_NETBERG_AURORA_720_RANGELEY_INT_H__
|
||||
|
||||
#include <x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_config.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* <auto.start.enum(ALL).header> */
|
||||
/** thermal_oid */
|
||||
typedef enum thermal_oid_e {
|
||||
THERMAL_OID_THERMAL1 = ONLP_THERMAL_ID_CREATE(1),
|
||||
THERMAL_OID_THERMAL2 = ONLP_THERMAL_ID_CREATE(2),
|
||||
THERMAL_OID_THERMAL3 = ONLP_THERMAL_ID_CREATE(3),
|
||||
THERMAL_OID_THERMAL4 = ONLP_THERMAL_ID_CREATE(4),
|
||||
THERMAL_OID_THERMAL5 = ONLP_THERMAL_ID_CREATE(5),
|
||||
THERMAL_OID_THERMAL6 = ONLP_THERMAL_ID_CREATE(6),
|
||||
THERMAL_OID_THERMAL7 = ONLP_THERMAL_ID_CREATE(7),
|
||||
THERMAL_OID_THERMAL8 = ONLP_THERMAL_ID_CREATE(8),
|
||||
THERMAL_OID_THERMAL9 = ONLP_THERMAL_ID_CREATE(9),
|
||||
THERMAL_OID_THERMAL10 = ONLP_THERMAL_ID_CREATE(10),
|
||||
} thermal_oid_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* thermal_oid_name(thermal_oid_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int thermal_oid_value(const char* str, thermal_oid_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* thermal_oid_desc(thermal_oid_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int thermal_oid_valid(thermal_oid_t e);
|
||||
|
||||
/** validator */
|
||||
#define THERMAL_OID_VALID(_e) \
|
||||
(thermal_oid_valid((_e)))
|
||||
|
||||
/** thermal_oid_map table. */
|
||||
extern aim_map_si_t thermal_oid_map[];
|
||||
/** thermal_oid_desc_map table. */
|
||||
extern aim_map_si_t thermal_oid_desc_map[];
|
||||
|
||||
/** thermal_id */
|
||||
typedef enum thermal_id_e {
|
||||
THERMAL_ID_THERMAL1 = 1,
|
||||
THERMAL_ID_THERMAL2 = 2,
|
||||
THERMAL_ID_THERMAL3 = 3,
|
||||
THERMAL_ID_THERMAL4 = 4,
|
||||
THERMAL_ID_THERMAL5 = 5,
|
||||
THERMAL_ID_THERMAL6 = 6,
|
||||
THERMAL_ID_THERMAL7 = 7,
|
||||
THERMAL_ID_THERMAL8 = 8,
|
||||
THERMAL_ID_THERMAL9 = 9,
|
||||
THERMAL_ID_THERMAL10 = 10,
|
||||
} thermal_id_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* thermal_id_name(thermal_id_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int thermal_id_value(const char* str, thermal_id_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* thermal_id_desc(thermal_id_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int thermal_id_valid(thermal_id_t e);
|
||||
|
||||
/** validator */
|
||||
#define THERMAL_ID_VALID(_e) \
|
||||
(thermal_id_valid((_e)))
|
||||
|
||||
/** thermal_id_map table. */
|
||||
extern aim_map_si_t thermal_id_map[];
|
||||
/** thermal_id_desc_map table. */
|
||||
extern aim_map_si_t thermal_id_desc_map[];
|
||||
|
||||
|
||||
/** psu_oid */
|
||||
typedef enum psu_oid_e {
|
||||
PSU_OID_PSU1 = ONLP_PSU_ID_CREATE(1),
|
||||
PSU_OID_PSU2 = ONLP_PSU_ID_CREATE(2),
|
||||
} psu_oid_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* psu_oid_name(psu_oid_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int psu_oid_value(const char* str, psu_oid_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* psu_oid_desc(psu_oid_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int psu_oid_valid(psu_oid_t e);
|
||||
|
||||
/** validator */
|
||||
#define PSU_OID_VALID(_e) \
|
||||
(psu_oid_valid((_e)))
|
||||
|
||||
/** psu_oid_map table. */
|
||||
extern aim_map_si_t psu_oid_map[];
|
||||
/** psu_oid_desc_map table. */
|
||||
extern aim_map_si_t psu_oid_desc_map[];
|
||||
|
||||
/** psu_id */
|
||||
typedef enum psu_id_e {
|
||||
PSU_ID_PSU1 = 1,
|
||||
PSU_ID_PSU2 = 2,
|
||||
} psu_id_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* psu_id_name(psu_id_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int psu_id_value(const char* str, psu_id_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* psu_id_desc(psu_id_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int psu_id_valid(psu_id_t e);
|
||||
|
||||
/** validator */
|
||||
#define PSU_ID_VALID(_e) \
|
||||
(psu_id_valid((_e)))
|
||||
|
||||
/** psu_id_map table. */
|
||||
extern aim_map_si_t psu_id_map[];
|
||||
/** psu_id_desc_map table. */
|
||||
extern aim_map_si_t psu_id_desc_map[];
|
||||
|
||||
|
||||
|
||||
/** fan_oid */
|
||||
typedef enum fan_oid_e {
|
||||
FAN_OID_FAN1 = ONLP_FAN_ID_CREATE(1),
|
||||
FAN_OID_FAN2 = ONLP_FAN_ID_CREATE(2),
|
||||
FAN_OID_FAN3 = ONLP_FAN_ID_CREATE(3),
|
||||
FAN_OID_FAN4 = ONLP_FAN_ID_CREATE(4),
|
||||
FAN_OID_FAN5 = ONLP_FAN_ID_CREATE(5),
|
||||
FAN_OID_FAN6 = ONLP_FAN_ID_CREATE(6),
|
||||
FAN_OID_FAN7 = ONLP_FAN_ID_CREATE(7),
|
||||
FAN_OID_FAN8 = ONLP_FAN_ID_CREATE(8),
|
||||
FAN_OID_FAN9 = ONLP_FAN_ID_CREATE(9),
|
||||
FAN_OID_FAN10 = ONLP_FAN_ID_CREATE(10),
|
||||
} fan_oid_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* fan_oid_name(fan_oid_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int fan_oid_value(const char* str, fan_oid_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* fan_oid_desc(fan_oid_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int fan_oid_valid(fan_oid_t e);
|
||||
|
||||
/** validator */
|
||||
#define FAN_OID_VALID(_e) \
|
||||
(fan_oid_valid((_e)))
|
||||
|
||||
/** fan_oid_map table. */
|
||||
extern aim_map_si_t fan_oid_map[];
|
||||
/** fan_oid_desc_map table. */
|
||||
extern aim_map_si_t fan_oid_desc_map[];
|
||||
|
||||
/** fan_id */
|
||||
typedef enum fan_id_e {
|
||||
FAN_ID_FAN1 = 1,
|
||||
FAN_ID_FAN2 = 2,
|
||||
FAN_ID_FAN3 = 3,
|
||||
FAN_ID_FAN4 = 4,
|
||||
FAN_ID_FAN5 = 5,
|
||||
FAN_ID_FAN6 = 6,
|
||||
FAN_ID_FAN7 = 7,
|
||||
FAN_ID_FAN8 = 8,
|
||||
FAN_ID_FAN9 = 9,
|
||||
FAN_ID_FAN10 = 10,
|
||||
} fan_id_t;
|
||||
|
||||
/** Enum names. */
|
||||
const char* fan_id_name(fan_id_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int fan_id_value(const char* str, fan_id_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* fan_id_desc(fan_id_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int fan_id_valid(fan_id_t e);
|
||||
|
||||
/** validator */
|
||||
#define FAN_ID_VALID(_e) \
|
||||
(fan_id_valid((_e)))
|
||||
|
||||
/** fan_id_map table. */
|
||||
extern aim_map_si_t fan_id_map[];
|
||||
/** fan_id_desc_map table. */
|
||||
extern aim_map_si_t fan_id_desc_map[];
|
||||
|
||||
/** led_oid */
|
||||
typedef enum led_oid_e {
|
||||
LED_OID_LED1 = ONLP_LED_ID_CREATE(1),
|
||||
LED_OID_LED2 = ONLP_LED_ID_CREATE(2),
|
||||
LED_OID_LED3 = ONLP_LED_ID_CREATE(3),
|
||||
LED_OID_LED4 = ONLP_LED_ID_CREATE(4),
|
||||
} led_oid_t;
|
||||
|
||||
/** led_id */
|
||||
typedef enum led_id_e {
|
||||
LED_ID_LED1 = 1,
|
||||
LED_ID_LED2 = 2,
|
||||
LED_ID_LED3 = 3,
|
||||
LED_ID_LED4 = 4,
|
||||
} led_id_t;
|
||||
|
||||
/* <auto.end.enum(ALL).header> */
|
||||
|
||||
/* psu info table */
|
||||
struct psu_info_s {
|
||||
char path[PATH_MAX];
|
||||
int present;
|
||||
int busno;
|
||||
int addr;
|
||||
};
|
||||
|
||||
#define SYS_HWMON1_PREFIX "/sys/class/hwmon/hwmon1/device"
|
||||
#define SYS_HWMON2_PREFIX "/sys/class/hwmon/hwmon2/device"
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_720_RANGELEY_INT_H__ */
|
||||
@@ -0,0 +1,18 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_config.h>
|
||||
|
||||
#include "x86_64_netberg_aurora_720_rangeley_log.h"
|
||||
/*
|
||||
* x86_64_netberg_aurora_720_rangeley log struct.
|
||||
*/
|
||||
AIM_LOG_STRUCT_DEFINE(
|
||||
X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_OPTIONS_DEFAULT,
|
||||
X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_BITS_DEFAULT,
|
||||
NULL, /* Custom log map */
|
||||
X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_LOG_CUSTOM_BITS_DEFAULT
|
||||
);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __X86_64_NETBERG_AURORA_720_RANGELEY_LOG_H__
|
||||
#define __X86_64_NETBERG_AURORA_720_RANGELEY_LOG_H__
|
||||
|
||||
#define AIM_LOG_MODULE_NAME x86_64_netberg_aurora_720_rangeley
|
||||
#include <AIM/aim_log.h>
|
||||
|
||||
#endif /* __X86_64_NETBERG_AURORA_720_RANGELEY_LOG_H__ */
|
||||
@@ -0,0 +1,24 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_config.h>
|
||||
|
||||
#include "x86_64_netberg_aurora_720_rangeley_log.h"
|
||||
|
||||
static int
|
||||
datatypes_init__(void)
|
||||
{
|
||||
#define X86_64_NETBERG_AURORA_720_RANGELEY_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
|
||||
#include <x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley.x>
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __x86_64_netberg_aurora_720_rangeley_module_init__(void)
|
||||
{
|
||||
AIM_LOG_STRUCT_REGISTER();
|
||||
datatypes_init__();
|
||||
}
|
||||
|
||||
int __onlp_platform_version__ = 1;
|
||||
@@ -0,0 +1,50 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_config.h>
|
||||
|
||||
#if X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_INCLUDE_UCLI == 1
|
||||
|
||||
#include <uCli/ucli.h>
|
||||
#include <uCli/ucli_argparse.h>
|
||||
#include <uCli/ucli_handler_macros.h>
|
||||
|
||||
static ucli_status_t
|
||||
x86_64_netberg_aurora_720_rangeley_ucli_ucli__config__(ucli_context_t* uc)
|
||||
{
|
||||
UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_netberg_aurora_720_rangeley)
|
||||
}
|
||||
|
||||
/* <auto.ucli.handlers.start> */
|
||||
/* <auto.ucli.handlers.end> */
|
||||
|
||||
static ucli_module_t
|
||||
x86_64_netberg_aurora_720_rangeley_ucli_module__ =
|
||||
{
|
||||
"x86_64_netberg_aurora_720_rangeley_ucli",
|
||||
NULL,
|
||||
x86_64_netberg_aurora_720_rangeley_ucli_ucli_handlers__,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
ucli_node_t*
|
||||
x86_64_netberg_aurora_720_rangeley_ucli_node_create(void)
|
||||
{
|
||||
ucli_node_t* n;
|
||||
ucli_module_init(&x86_64_netberg_aurora_720_rangeley_ucli_module__);
|
||||
n = ucli_node_create("x86_64_netberg_aurora_720_rangeley", NULL, &x86_64_netberg_aurora_720_rangeley_ucli_module__);
|
||||
ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_netberg_aurora_720_rangeley"));
|
||||
return n;
|
||||
}
|
||||
|
||||
#else
|
||||
void*
|
||||
x86_64_netberg_aurora_720_rangeley_ucli_node_create(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -0,0 +1 @@
|
||||
!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=netberg BASENAME=x86-64-netberg-aurora-720-rangeley REVISION=r0
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# platform-config for AURORA 720
|
||||
#
|
||||
######################################################################
|
||||
|
||||
x86-64-netberg-aurora-720-rangeley-r0:
|
||||
|
||||
grub:
|
||||
|
||||
serial: >-
|
||||
--port=0x2f8
|
||||
--speed=115200
|
||||
--word=8
|
||||
--parity=no
|
||||
--stop=1
|
||||
|
||||
kernel:
|
||||
<<: *kernel-3-16
|
||||
|
||||
args: >-
|
||||
console=ttyS1,115200n8
|
||||
|
||||
##network:
|
||||
## interfaces:
|
||||
## ma1:
|
||||
## name: ~
|
||||
## syspath: pci0000:00/0000:00:14.0
|
||||
@@ -0,0 +1,12 @@
|
||||
from onl.platform.base import *
|
||||
from onl.platform.netberg import *
|
||||
|
||||
class OnlPlatform_x86_64_netberg_aurora_720_rangeley_r0(OnlPlatformNetberg,
|
||||
OnlPlatformPortConfig_32x100):
|
||||
PLATFORM='x86-64-netberg-aurora-720-rangeley-r0'
|
||||
MODEL="AURORA720"
|
||||
SYS_OBJECT_ID=".720.1"
|
||||
|
||||
def baseconfig(self):
|
||||
self.insmod("hardware_monitor")
|
||||
return True
|
||||
Reference in New Issue
Block a user