Add belgite support (#9511)

Why I did it
add celestica belgite platform

How I did it
add belgite platform in celestica

Co-authored-by: nicwu-cel <nicwu@celestica.com>
Co-authored-by: anjian <anjian@celestica.com>
Co-authored-by: sandycelestica <sandyli@celestica.com>
This commit is contained in:
jerseyang 2022-05-24 09:45:37 +08:00 committed by GitHub
parent b23ad6748a
commit c92bfe0728
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 4907 additions and 1 deletions

View File

@ -0,0 +1,169 @@
## 48xGE+4x10G+2xHGd[21]
phy_chain_rx_polarity_flip_physical{29.0}=1
bcm_num_cos=8
stable_size=0x5500000
ifp_inports_support_enable=1
ipv6_lpm_128b_enable=0x1
l2xmsg_mode=1
l2_mem_entries=32768
l3_mem_entries=16384
lpm_scaling_enable=0
l3_alpm_enable=0
riot_enable=0
port_flex_enable=1
#Core clock Frequency
core_clock_frequency=266
#GPORT0
portmap_25=2:1
phy_port_primary_and_offset_25=0x0100
portmap_26=1:1
phy_port_primary_and_offset_26=0x0101
portmap_27=4:1
phy_port_primary_and_offset_27=0x0102
portmap_28=3:1
phy_port_primary_and_offset_28=0x0103
portmap_29=6:1
phy_port_primary_and_offset_29=0x0500
portmap_30=5:1
phy_port_primary_and_offset_30=0x0501
portmap_31=8:1
phy_port_primary_and_offset_31=0x0502
portmap_32=7:1
phy_port_primary_and_offset_32=0x0503
#GPORT1
portmap_33=10:1
phy_port_primary_and_offset_33=0x0900
portmap_34=9:1
phy_port_primary_and_offset_34=0x0901
portmap_35=12:1
phy_port_primary_and_offset_35=0x0902
portmap_36=11:1
phy_port_primary_and_offset_36=0x0903
portmap_37=14:1
phy_port_primary_and_offset_37=0x0d00
portmap_38=13:1
phy_port_primary_and_offset_38=0x0d01
portmap_39=16:1
phy_port_primary_and_offset_39=0x0d02
portmap_40=15:1
phy_port_primary_and_offset_40=0x0d03
#GPORT2
portmap_41=18:1
phy_port_primary_and_offset_41=0x1101
portmap_42=17:1
phy_port_primary_and_offset_42=0x1100
portmap_43=20:1
phy_port_primary_and_offset_43=0x1103
portmap_44=19:1
phy_port_primary_and_offset_44=0x1102
portmap_45=22:1
phy_port_primary_and_offset_45=0x1501
portmap_46=21:1
phy_port_primary_and_offset_46=0x1500
portmap_47=24:1
phy_port_primary_and_offset_47=0x1503
portmap_48=23:1
phy_port_primary_and_offset_48=0x1502
#PM4x10Q0
port_gmii_mode{25}=1
portmap_1=26:1
portmap_2=25:1
portmap_3=28:1
portmap_4=27:1
portmap_5=30:1
portmap_6=29:1
portmap_7=32:1
portmap_8=31:1
phy_port_primary_and_offset_2=0x1900
phy_port_primary_and_offset_1=0x1901
phy_port_primary_and_offset_4=0x1902
phy_port_primary_and_offset_3=0x1903
phy_port_primary_and_offset_6=0x1904
phy_port_primary_and_offset_5=0x1905
phy_port_primary_and_offset_8=0x1906
phy_port_primary_and_offset_7=0x1907
port_phy_addr_2=0x01
port_phy_addr_1=0x02
port_phy_addr_4=0x03
port_phy_addr_3=0x04
port_phy_addr_6=0x05
port_phy_addr_5=0x06
port_phy_addr_8=0x07
port_phy_addr_7=0x08
portmap_9=34:1
portmap_10=33:1
portmap_11=36:1
portmap_12=35:1
portmap_13=38:1
portmap_14=37:1
portmap_15=40:1
portmap_16=39:1
phy_port_primary_and_offset_10=0x2100
phy_port_primary_and_offset_9=0x2101
phy_port_primary_and_offset_12=0x2102
phy_port_primary_and_offset_11=0x2103
phy_port_primary_and_offset_14=0x2104
phy_port_primary_and_offset_13=0x2105
phy_port_primary_and_offset_16=0x2106
phy_port_primary_and_offset_15=0x2107
port_phy_addr_10=0x2a
port_phy_addr_9=0x2b
port_phy_addr_12=0x2c
port_phy_addr_11=0x2d
port_phy_addr_14=0x2e
port_phy_addr_13=0x2f
port_phy_addr_16=0x30
port_phy_addr_15=0x31
#PM4x10Q1
port_gmii_mode{41}=1
portmap_17=42:1
portmap_18=41:1
portmap_19=44:1
portmap_20=43:1
portmap_21=50:1
portmap_22=49:1
portmap_23=52:1
portmap_24=51:1
phy_port_primary_and_offset_18=0x2900
phy_port_primary_and_offset_17=0x2901
phy_port_primary_and_offset_20=0x2902
phy_port_primary_and_offset_19=0x2903
phy_port_primary_and_offset_22=0x2904
phy_port_primary_and_offset_21=0x2905
phy_port_primary_and_offset_24=0x2906
phy_port_primary_and_offset_23=0x2907
port_phy_addr_18=0x53
port_phy_addr_17=0x54
port_phy_addr_20=0x55
port_phy_addr_19=0x56
port_phy_addr_22=0x57
port_phy_addr_21=0x58
port_phy_addr_24=0x59
port_phy_addr_23=0x5a
#PM4x25
portmap_49=60:10
portmap_50=58:10
portmap_51=59:10
portmap_52=57:10
##PM4x10HG
portmap_53=62:10
portmap_54=64:10
portmap_55=61:10
portmap_56=63:10
pbmp_xport_xe=0x01FFFFFFFFFFFFFE
#

View File

@ -0,0 +1,57 @@
# name lanes alias index speed autoneg
Ethernet0 26 Ethernet1/0/1 1 1000 1
Ethernet1 25 Ethernet1/0/2 2 1000 1
Ethernet2 28 Ethernet1/0/3 3 1000 1
Ethernet3 27 Ethernet1/0/4 4 1000 1
Ethernet4 30 Ethernet1/0/5 5 1000 1
Ethernet5 29 Ethernet1/0/6 6 1000 1
Ethernet6 32 Ethernet1/0/7 7 1000 1
Ethernet7 31 Ethernet1/0/8 8 1000 1
Ethernet8 34 Ethernet1/0/9 9 1000 1
Ethernet9 33 Ethernet1/0/10 10 1000 1
Ethernet10 36 Ethernet1/0/11 11 1000 1
Ethernet11 35 Ethernet1/0/12 12 1000 1
Ethernet12 38 Ethernet1/0/13 13 1000 1
Ethernet13 37 Ethernet1/0/14 14 1000 1
Ethernet14 40 Ethernet1/0/15 15 1000 1
Ethernet15 39 Ethernet1/0/16 16 1000 1
Ethernet16 42 Ethernet1/0/17 17 1000 1
Ethernet17 41 Ethernet1/0/18 18 1000 1
Ethernet18 44 Ethernet1/0/19 19 1000 1
Ethernet19 43 Ethernet1/0/20 20 1000 1
Ethernet20 50 Ethernet1/0/21 21 1000 1
Ethernet21 49 Ethernet1/0/22 22 1000 1
Ethernet22 52 Ethernet1/0/23 23 1000 1
Ethernet23 51 Ethernet1/0/24 24 1000 1
Ethernet24 2 Ethernet1/0/25 25 1000 1
Ethernet25 1 Ethernet1/0/26 26 1000 1
Ethernet26 4 Ethernet1/0/27 27 1000 1
Ethernet27 3 Ethernet1/0/28 28 1000 1
Ethernet28 6 Ethernet1/0/29 29 1000 1
Ethernet29 5 Ethernet1/0/30 30 1000 1
Ethernet30 8 Ethernet1/0/31 31 1000 1
Ethernet31 7 Ethernet1/0/32 32 1000 1
Ethernet32 10 Ethernet1/0/33 33 1000 1
Ethernet33 9 Ethernet1/0/34 34 1000 1
Ethernet34 12 Ethernet1/0/35 35 1000 1
Ethernet35 11 Ethernet1/0/36 36 1000 1
Ethernet36 14 Ethernet1/0/37 37 1000 1
Ethernet37 13 Ethernet1/0/38 38 1000 1
Ethernet38 16 Ethernet1/0/39 39 1000 1
Ethernet39 15 Ethernet1/0/40 40 1000 1
Ethernet40 18 Ethernet1/0/41 41 1000 1
Ethernet41 17 Ethernet1/0/42 42 1000 1
Ethernet42 20 Ethernet1/0/43 43 1000 1
Ethernet43 19 Ethernet1/0/44 44 1000 1
Ethernet44 22 Ethernet1/0/45 45 1000 1
Ethernet45 21 Ethernet1/0/46 46 1000 1
Ethernet46 24 Ethernet1/0/47 47 1000 1
Ethernet47 23 Ethernet1/0/48 48 1000 1
Ethernet48 60 Ethernet1/0/49 49 10000 0
Ethernet49 58 Ethernet1/0/50 50 10000 0
Ethernet50 59 Ethernet1/0/51 51 10000 0
Ethernet51 57 Ethernet1/0/52 52 10000 0
Ethernet52 62 Ethernet1/0/53 53 10000 0
Ethernet53 64 Ethernet1/0/54 54 10000 0
Ethernet54 61 Ethernet1/0/55 55 10000 0
Ethernet55 63 Ethernet1/0/56 56 10000 0

View File

@ -0,0 +1 @@
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/belgite.config.bcm

Binary file not shown.

View File

@ -0,0 +1 @@
CELESTICA-BELGITE t1

View File

@ -0,0 +1,4 @@
CONSOLE_PORT=0x3f8
CONSOLE_DEV=0
CONSOLE_SPEED=9600
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off module_blacklist=gpio_ich crashkernel=0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M acpi_no_watchdog"

View File

@ -0,0 +1,24 @@
#
# Copyright: (c) 2012 Broadcom Corp.
# All Rights Reserved.
#
SDK = ../../../../sdk-all-6.5.16/
export SDK
ifeq (${SDK},)
# {
$(error environment variable SDK not set)
# }
endif
INCDIR = -I${SDK}/include
all:
arm-linux-gcc -O1 -g ${INCDIR} -mthumb -mcpu=cortex-m0 -c -o custom_led.o custom_led.c
arm-linux-ld -T custom_led.lds -Bstatic -nostdlib --entry 0 -EL -Map custom_led.map -o custom_led.elf custom_led.o
arm-linux-objcopy -O binary custom_led.elf custom_led.bin
clean:
rm -rf *.elf *.o *.map *.bin

View File

@ -0,0 +1,171 @@
/*
* $Id: custom_led.c$
* $Copyright: (c) 2019 Broadcom
* Broadcom Proprietary and Confidential. All rights reserved.$
*/
/******************************************************************************
CMICX LED Interface has two RAM Banks, as shown below, Bank0(ACCUMULATION RAM)
for accumulation of status from ports and Bank1(PATTERN RAM) for writing
LED pattern. Both Bank0 and Bank1 are of 1024x16-bit, each row representing
one port.
ACCUMULATION RAM (Bank 0) Pattern RAM (Bank1)
15 0 15 0
------------------------------ -----------------------------
Row 0 | Port1 status | | Port1 LED Pattern |
------------------------------ -----------------------------
Row 1 | Port2 status | | Port2 LED Pattern |
------------------------------ -----------------------------
| | | |
------------------------------ -----------------------------
| | | |
------------------------------ -----------------------------
| | | |
------------------------------ -----------------------------
| | | |
------------------------------ -----------------------------
| | | |
------------------------------ -----------------------------
Row 127 | Port128 status | | Port128 LED Pattern |
------------------------------ -----------------------------
Row 128 | | | |
------------------------------ -----------------------------
| | | |
------------------------------ -----------------------------
| | | |
------------------------------ -----------------------------
Row x | Port(x+1) status | | Port(x+1) LED Pattern |
------------------------------ -----------------------------
| | | |
------------------------------ -----------------------------
| | | |
------------------------------ -----------------------------
Row 1022| Port1023 status | | Port1023 LED Pattern |
------------------------------ -----------------------------
Row 1023| Port1024 status | | Port1024 LED Pattern |
------------------------------ -----------------------------
Format of Accumulation RAM:
Bits 15:9 8 7 6 5 4:3 2 1 0
------------------------------------------------------------------------
| Reserved | Link | Link Up | Flow | Duplex | Speed | Col | Tx | Rx |
| | Enable| Status | Control| | | | | |
------------------------------------------------------------------------
The custom handler in this file should read port status, for each port used,
from accumulation ram, and form required LED bit pattern in the Bank1 RAM
(pattern RAM) location corresponding to the port of interest. Note that
physical port numbers may differ from row number of LED RAM Banks. For
Trident3, Physical port numbers spread from 1 to 128 in 128x25G configuration
and corresponding LED rows spread from Row 0 to Row 127.
There are five LED interfaces in CMICX based devices. Although single
interface can be used to output LED pattern for all ports, it is possible
that more than one interface can be used in the end system, e.g., LEDs for
some ports are connected to one LED interface-0 (i.e LED_CLK and LED_DATA),
while the rest of the ports are connected to LED interface-1. Accordingly,
custom handler MUST fill in start port, end port and width of pattern in the
soc_led_custom_handler_ctrl_t structure passsed to custom handler. The
example custom handler provided in this file has reference code for forming
two different LED patterns. Please refer to these patterns before writing your
own custom handler code.
The soc_led_custom_handler_ctrl_t structure definition is available in
$SDK/include/shared/cmicfw/cmicx_led_public.h
soc_led_custom_handler_ctrl_t structure also carries a point to array
port_speed[] of size equal to maximum ports in the system, e.g 128 in Trident3.
This array would have port speed for each port, as per bit mapping defined in
"soc_led_speed_t" in $SDK/include/shared/cmicfw/cmicx_led_public.h file.
Here is an exception, please keep in mind:
1. For TH3, port status/speed of xe1 (physical port 258) is located in the
accumulation entry/speed array of physical port 259.
******************************************************************************/
#include <shared/cmicfw/cmicx_led_public.h>
#define ACTIVITY_TICKS 2
#define READ_LED_ACCU_DATA(base, port) (*((uint16 *)(base + ((port - 1) * sizeof(uint32)))))
#define WRITE_LED_SEND_DATA(base, port, val) (*((uint16 *)(base + ((port - 1) * sizeof(uint32)))) = val)
#define PORT_NUM_TOTAL 56
#define LED_GREEN_BICOLOR 0x2 //bit : 10
#define LED_AMBER_BICOLOR 0x1 //bit : 01
#define LED_OFF_BICOLOR 0x3 //bit : 11
unsigned short portmap[] = {
25, 26, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 49, 50, 51, 52,
1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 24, 23, 22, 21,
20, 19, 18, 17, 16, 15, 14, 13,
58, 60, 57, 59, 64, 62, 63, 61
};
/*
* Function:
* custom_led_handler
* Purpose:
* Timer event handler to accumulate, process and transmit led status
* Parameters:
* param - parameter added while registering the timer event.
* Returns:
* 0 on success
* Error code on failure
*/
void custom_led_handler(soc_led_custom_handler_ctrl_t *ctrl,
uint32 activity_count)
{
unsigned short accu_val = 0, send_val = 0;
unsigned short port, physical_port;
/* Physical port numbers to be used */
for(port = 1; port <= PORT_NUM_TOTAL; port++) {
physical_port = portmap[port-1];
/* Read value from led_ram bank0 */
accu_val = READ_LED_ACCU_DATA(ctrl->accu_ram_base, physical_port);
send_val = 0xff;
if (((accu_val & LED_OUTPUT_RX) || (accu_val & LED_OUTPUT_TX)) && (activity_count & ACTIVITY_TICKS))
{
send_val = LED_OFF_BICOLOR;
}
else if ( accu_val & LED_OUTPUT_LINK_UP)
{
send_val = LED_GREEN_BICOLOR;
}
else
{
send_val = LED_OFF_BICOLOR;
}
/* Write value to led_ram bank1 */
WRITE_LED_SEND_DATA(ctrl->pat_ram_base, port, send_val);
} /* for */
/* Send the pattern over LED interface 1 for ports 1 - 56*/
ctrl->intf_ctrl[1].valid = 1;
ctrl->intf_ctrl[1].start_row = 0;
ctrl->intf_ctrl[1].end_row = 55;
ctrl->intf_ctrl[1].pat_width = 2;
/* Invalidate rest of the interfaces */
ctrl->intf_ctrl[0].valid = 0;
ctrl->intf_ctrl[2].valid = 0;
ctrl->intf_ctrl[3].valid = 0;
ctrl->intf_ctrl[4].valid = 0;
return;
}

View File

@ -0,0 +1,21 @@
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(custom_led_handler)
SECTIONS
{
. = 0x3800;
. = ALIGN(4);
.text :
{
*(.text)
*(.data)
*(.bss)
}
/DISCARD/ : { *(.dynstr*) }
/DISCARD/ : { *(.dynamic*) }
/DISCARD/ : { *(.plt*) }
/DISCARD/ : { *(.interp*) }
/DISCARD/ : { *(.gnu*) }
}

View File

@ -0,0 +1,3 @@
m0 load 0 0x3800 /usr/share/sonic/platform/custom_led.bin
led start

View File

@ -0,0 +1,49 @@
{
"GLOBAL_MEDIA_SETTINGS": {
"49-52": {
"Default": {
"preemphasis": {
"lane0": "0x14410a"
}
},
"TERALUX-ABS022,SFP+-CR-1.0,TERALUX-ABS023,SFP+-CR-3.0,TERALUX-ABS074,SFP+-CR-5.0": {
"preemphasis": {
"lane0": "0x14410a"
}
},
"TERALUX-ABS661,SFP+-CR-7.0": {
"preemphasis": {
"lane0": "0x14410a"
}
},
"FINISAR CORP.-FTLX8571D3BCV,SFP+-SR": {
"preemphasis": {
"lane0": "0x0c4104"
}
}
},
"53-56": {
"Default": {
"preemphasis": {
"lane0": "0x0a3200"
}
},
"TERALUX-ABS022,SFP+-CR-1.0,TERALUX-ABS023,SFP+-CR-3.0,TERALUX-ABS074,SFP+-CR-5.0": {
"preemphasis": {
"lane0": "0x0a280a"
}
},
"TERALUX-ABS661,SFP+-CR-7.0": {
"preemphasis": {
"lane0": "0x0f2805"
}
},
"FINISAR CORP.-FTLX8571D3BCV,SFP+-SR": {
"preemphasis": {
"lane0": "0x0a3200"
}
}
}
}
}

View File

@ -0,0 +1,121 @@
- bus: '00'
dev: '00'
fn: '0'
id: 1980
name: 'Host bridge: Intel Corporation Atom Processor C3000 Series System Agent'
- bus: '00'
dev: '04'
fn: '0'
id: 19a1
name: 'Host bridge: Intel Corporation Atom Processor C3000 Series Error Registers'
- bus: '00'
dev: '05'
fn: '0'
id: 19a2
name: 'Generic system peripheral [0807]: Intel Corporation Atom Processor C3000 Series Root Complex Event Collector'
- bus: '00'
dev: '06'
fn: '0'
id: 19e2
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated QAT Root Port'
- bus: '00'
dev: '09'
fn: '0'
id: b277
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root Port'
- bus: '00'
dev: '0b'
fn: '0'
id: 1533
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root Port'
- bus: '00'
dev: '0e'
fn: '0'
id: 19a8
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root Port'
- bus: '00'
dev: '12'
fn: '0'
id: 19ac
name: 'System peripheral: Intel Corporation DNV SMBus Contoller - Host'
- bus: '00'
dev: '14'
fn: '0'
id: 19c2
name: 'SATA controller: Intel Corporation DNV SATA Controller 1'
- bus: '00'
dev: '15'
fn: '0'
id: 19d0
name: 'USB controller: Intel Corporation Atom Processor C3000 Series USB 3.0 xHCI Controller'
- bus: '00'
dev: '16'
fn: '0'
id: 15ce
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated LAN Root Port'
- bus: '00'
dev: '18'
fn: '0'
id: 19d3
name: 'Communication controller: Intel Corporation Atom Processor C3000 Series ME HECI 1'
- bus: '00'
dev: '1a'
fn: '0'
id: 19d8
name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller'
- bus: '00'
dev: '1a'
fn: '1'
id: 19d8
name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller'
- bus: '00'
dev: '1a'
fn: '2'
id: 19d8
name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller'
- bus: '00'
dev: '1f'
fn: '0'
id: 19dc
name: 'ISA bridge: Intel Corporation DNV LPC or eSPI'
- bus: '00'
dev: '1f'
fn: '2'
id: 19de
name: 'Memory controller: Intel Corporation Atom Processor C3000 Series Power Management Controller'
- bus: '00'
dev: '1f'
fn: '4'
id: 19df
name: 'SMBus: Intel Corporation DNV SMBus controller'
- bus: '00'
dev: '1f'
fn: '5'
id: 19e0
name: 'Serial bus controller [0c80]: Intel Corporation DNV SPI Controller'
- bus: '01'
dev: '00'
fn: '0'
id: 19e2
name: 'Co-processor: Intel Corporation Atom Processor C3000 Series QuickAssist Technology'
- bus: '02'
dev: '00'
fn: '0'
id: b277
name: 'Ethernet controller: Broadcom Limited Device b277'
- bus: '03'
dev: '00'
fn: '0'
id: 1533
name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection'
- bus: '05'
dev: '00'
fn: '0'
id: 15ce
name: 'Ethernet controller: Intel Corporation Ethernet Connection X553 10 GbE SFP+'
- bus: '05'
dev: '00'
fn: '1'
id: 15ce
name: 'Ethernet controller: Intel Corporation Ethernet Connection X553 10 GbE SFP+'

View File

@ -0,0 +1,61 @@
{
"XCVR":
{
"xcvr_present":
{
"i2c":
{
"valmap-SFP28": {"1":false, "0":true }
}
}
},
"PSU":
{
"psu_present":
{
"i2c":
{
"valmap": { "1":true, "0":false }
}
},
"psu_power_good":
{
"i2c":
{
"valmap": { "0": true, "1":false }
}
},
"psu_fan_dir":
{
"i2c":
{
"valmap": { "F2B":"INTAKE", "B2F":"EXHAUST" }
}
},
"PSU_FAN_MAX_SPEED":"18000"
},
"FAN":
{
"direction":
{
"i2c":
{
"valmap": {"1":"EXHAUST", "0":"INTAKE"}
}
},
"present":
{
"i2c":
{
"valmap": {"1":false, "0":true}
}
},
"fan_master_led_color":
{
"colmap": {"green":"green", "red":"amber"}
},
"duty_cycle_to_pwm": "lambda dc: dc*255/100",
"pwm_to_duty_cycle": "lambda pwm: pwm/255*100"
}
}

View File

@ -0,0 +1,685 @@
{
"PLATFORM":
{
"num_psus":2,
"num_fantrays":3,
"num_fans_pertray":1,
"num_ports":56,
"num_temps":4,
"pddf_dev_types":
{
"description":"Belgite - Below is the list of supported PDDF device types (chip names) for various components. If any component uses some other driver, we will create the client using 'echo <dev-address> <dev-type> > <path>/new_device' method",
"CPLD":
[
"i2c_cpld"
],
"PSU":
[
"psu_eeprom",
"psu_pmbus"
],
"FAN":
[
"fan_ctrl",
"fan_eeprom",
"fan_cpld"
],
"PORT_MODULE":
[
"pddf_xcvr"
]
},
"std_perm_kos":
[
"i2c-ismt",
"i2c-i801"
],
"std_kos":
[
"i2c_dev",
"i2c_mux_pca954x force_deselect_on_exit=1",
"gpio_pca953x",
"mc24lc64t",
"optoe"
],
"pddf_kos":
[
"pddf_client_module",
"pddf_mux_module",
"pddf_psu_driver_module",
"pddf_psu_module",
"pddf_gpio_module",
"pddf_xcvr_module",
"pddf_xcvr_driver_module",
"pddf_led_module",
"pddf_fan_driver_module",
"pddf_fan_module",
"pddf_led_module"
],
"custom_kos":
[
"pddf_custom_psu",
"pddf_custom_wdt"
]
},
"SYSTEM":
{
"dev_info": {"device_type":"CPU", "device_name":"ROOT_COMPLEX", "device_parent":null},
"i2c":
{
"CONTROLLERS":
[
{ "dev_name":"i2c-0", "dev":"SMBUS0" }
]
}
},
"SMBUS0":
{
"dev_info": {"device_type": "SMBUS", "device_name": "SMBUS0", "device_parent": "SYSTEM"},
"i2c":
{
"topo_info": {"dev_addr": "0x0"},
"DEVICES":
[
{"dev": "EEPROM1"},
{"dev": "MUX1"}
]
}
},
"EEPROM1":
{
"dev_info": {"device_type": "EEPROM", "device_name": "EEPROM1", "device_parent": "SMBUS0"},
"i2c":
{
"topo_info": {"parent_bus": "0x0", "dev_addr": "0x52", "dev_type": "24lc64t"},
"dev_attr": {"access_mode": "BLOCK"},
"attr_list":
[
{"attr_name": "eeprom"}
]
}
},
"MUX1":
{
"dev_info": { "device_type":"MUX", "device_name":"MUX1", "device_parent":"SMBUS0"},
"i2c":
{
"topo_info": { "parent_bus":"0x0", "dev_addr":"0x70", "dev_type":"pca9548"},
"dev_attr": { "virt_bus":"0x2"},
"channel":
[
{"chn":"0", "dev":"CPLD1" },
{"chn":"0", "dev":"FAN-CTRL" },
{"chn":"2", "dev":"PSU1" },
{"chn":"2", "dev":"PSU2" },
{"chn":"3", "dev":"TEMP1"},
{"chn":"3", "dev":"TEMP2"},
{"chn":"4", "dev":"TEMP3"},
{"chn":"4", "dev":"TEMP4"},
{"chn":"7", "dev":"MUX2"}
]
}
},
"MUX2":
{
"dev_info": { "device_type":"MUX", "device_name":"MUX2", "device_parent":"MUX1"},
"i2c":
{
"topo_info": { "parent_bus":"0x9", "dev_addr":"0x71", "dev_type":"pca9548"},
"dev_attr": { "virt_bus":"0xA"},
"channel":
[
{"chn":"0", "dev":"PORT49"},
{"chn":"1", "dev":"PORT50"},
{"chn":"2", "dev":"PORT51"},
{"chn":"3", "dev":"PORT52"},
{"chn":"4", "dev":"PORT53"},
{"chn":"5", "dev":"PORT54"},
{"chn":"6", "dev":"PORT55"},
{"chn":"7", "dev":"PORT56"}
]
}
},
"CPLD1":
{
"dev_info": {"device_type": "CPLD", "device_name": "CPLD1", "device_parent": "MUX1"},
"i2c":
{
"topo_info": {"parent_bus": "0x2", "dev_addr": "0x32", "dev_type": "i2c_cpld"},
"dev_attr": {}
}
},
"PSU1":
{
"dev_info": { "device_type":"PSU", "device_name":"PSU1", "device_parent":"MUX1"},
"dev_attr": { "dev_idx":"1", "num_psu_fans": "1"},
"i2c":
{
"interface":
[
{ "itf":"pmbus", "dev":"PSU1-PMBUS" }
]
}
},
"PSU1-PMBUS":
{
"dev_info": { "device_type":"PSU-PMBUS", "device_name":"PSU1-PMBUS", "device_parent":"MUX1", "virt_parent":"PSU1"},
"i2c":
{
"topo_info":{ "parent_bus":"0x4", "dev_addr":"0x58", "dev_type":"psu_pmbus"},
"attr_list":
[
{ "attr_name":"psu_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x41", "attr_mask":"0x10", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"psu_power_good", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x41", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"psu_model_name", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"13" },
{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"11" },
{ "attr_name":"psu_serial_num", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"14" },
{ "attr_name":"psu_v_in", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x88", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_i_in", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x89", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc5", "attr_mask":"0x18", "attr_cmpval":"0x08", "attr_len":"1"},
{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}
]
}
},
"PSU2":
{
"dev_info": { "device_type":"PSU", "device_name":"PSU2", "device_parent":"MUX1" },
"dev_attr": { "dev_idx":"2", "num_psu_fans":"1"},
"i2c":
{
"interface":
[
{ "itf":"pmbus", "dev":"PSU2-PMBUS"}
]
}
},
"PSU2-PMBUS":
{
"dev_info": {"device_type":"PSU-PMBUS", "device_name":"PSU2-PMBUS", "device_parent":"MUX1", "virt_parent":"PSU2"},
"i2c":
{
"topo_info": { "parent_bus":"0x4", "dev_addr":"0x59", "dev_type":"psu_pmbus"},
"attr_list":
[
{ "attr_name":"psu_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x41", "attr_mask":"0x20", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"psu_power_good", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x41", "attr_mask":"0x8", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"psu_model_name", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"13" },
{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"11" },
{ "attr_name":"psu_serial_num", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x9e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"14" },
{ "attr_name":"psu_v_in", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x88", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_i_in", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x89", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_v_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_i_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_p_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xc5", "attr_mask":"0x18", "attr_cmpval":"0x08", "attr_len":"1"},
{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}
]
}
},
"TEMP1":
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP1", "device_parent":"MUX1"},
"dev_attr": { "display_name":"LM75_U10"},
"i2c":
{
"topo_info": { "parent_bus":"0x5", "dev_addr":"0x48", "dev_type":"lm75"},
"attr_list":
[
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"},
{ "attr_name": "temp1_max_hyst"},
{ "attr_name": "temp1_input"}
]
}
},
"TEMP2":
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP2", "device_parent":"MUX1"},
"dev_attr": { "display_name":"LM75_U4"},
"i2c":
{
"topo_info": { "parent_bus":"0x5", "dev_addr":"0x49", "dev_type":"lm75"},
"attr_list":
[
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"},
{ "attr_name": "temp1_max_hyst"},
{ "attr_name": "temp1_input"}
]
}
},
"TEMP3":
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP3", "device_parent":"MUX1"},
"dev_attr": { "display_name":"LM75_U7"},
"i2c":
{
"topo_info": { "parent_bus":"0x6", "dev_addr":"0x4a", "dev_type":"lm75"},
"attr_list":
[
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"},
{ "attr_name": "temp1_max_hyst"},
{ "attr_name": "temp1_input"}
]
}
},
"TEMP4":
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP4", "device_parent":"MUX1"},
"dev_attr": { "display_name":"LM75_U60"},
"i2c":
{
"topo_info": { "parent_bus":"0x6", "dev_addr":"0x49", "dev_type":"lm75"},
"attr_list":
[
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"},
{ "attr_name": "temp1_max_hyst"},
{ "attr_name": "temp1_input"}
]
}
},
"PORT49":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT49", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"49"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT49-EEPROM" },
{ "itf":"control", "dev":"PORT49-CTRL" }
]
}
},
"PORT49-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT49-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT49"},
"i2c":
{
"topo_info": { "parent_bus":"0xA", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT49-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT49-CTRL", "device_parent":"MUX2", "virt_parent":"PORT49"},
"i2c":
{
"topo_info": { "parent_bus":"0xA", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}
]
}
},
"PORT50":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT50", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"50"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT50-EEPROM" },
{ "itf":"control", "dev":"PORT50-CTRL" }
]
}
},
"PORT50-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT50-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT50"},
"i2c":
{
"topo_info": { "parent_bus":"0xB", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT50-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT50-CTRL", "device_parent":"MUX2", "virt_parent":"PORT50"},
"i2c":
{
"topo_info": { "parent_bus":"0xB", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}
]
}
},
"PORT51":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT51", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"51"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT51-EEPROM" },
{ "itf":"control", "dev":"PORT51-CTRL" }
]
}
},
"PORT51-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT51-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT51"},
"i2c":
{
"topo_info": { "parent_bus":"0xC", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT51-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT51-CTRL", "device_parent":"MUX2", "virt_parent":"PORT51"},
"i2c":
{
"topo_info": { "parent_bus":"0xC", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}
]
}
},
"PORT52":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT52", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"52"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT52-EEPROM" },
{ "itf":"control", "dev":"PORT52-CTRL" }
]
}
},
"PORT52-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT52-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT52"},
"i2c":
{
"topo_info": { "parent_bus":"0xD", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT52-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT52-CTRL", "device_parent":"MUX2", "virt_parent":"PORT52"},
"i2c":
{
"topo_info": { "parent_bus":"0xD", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}
]
}
},
"PORT53":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT53", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"53"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT53-EEPROM" },
{ "itf":"control", "dev":"PORT53-CTRL" }
]
}
},
"PORT53-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT53-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT53"},
"i2c":
{
"topo_info": { "parent_bus":"0xE", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT53-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT53-CTRL", "device_parent":"MUX2", "virt_parent":"PORT53"},
"i2c":
{
"topo_info": { "parent_bus":"0xE", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}
]
}
},
"PORT54":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT54", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"54"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT54-EEPROM" },
{ "itf":"control", "dev":"PORT54-CTRL" }
]
}
},
"PORT54-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT54-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT54"},
"i2c":
{
"topo_info": { "parent_bus":"0xF", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT54-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT54-CTRL", "device_parent":"MUX2", "virt_parent":"PORT54"},
"i2c":
{
"topo_info": { "parent_bus":"0xF", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}
]
}
},
"PORT55":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT55", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"55"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT55-EEPROM" },
{ "itf":"control", "dev":"PORT55-CTRL" }
]
}
},
"PORT55-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT55-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT55"},
"i2c":
{
"topo_info": { "parent_bus":"0x10", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT55-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT55-CTRL", "device_parent":"MUX2", "virt_parent":"PORT55"},
"i2c":
{
"topo_info": { "parent_bus":"0x10", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}
]
}
},
"PORT56":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT56", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"56"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT56-EEPROM" },
{ "itf":"control", "dev":"PORT56-CTRL" }
]
}
},
"PORT56-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT56-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT56"},
"i2c":
{
"topo_info": { "parent_bus":"0x11", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT56-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT56-CTRL", "device_parent":"MUX2", "virt_parent":"PORT56"},
"i2c":
{
"topo_info": { "parent_bus":"0x11", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}
]
}
},
"FAN-CTRL":
{
"dev_info": { "device_type":"FAN", "device_name":"FAN-CTRL", "device_parent":"MUX1"},
"i2c":
{
"topo_info": { "parent_bus":"0x2", "dev_addr":"0x66", "dev_type":"fan_cpld"},
"dev_attr": { "num_fantrays":"3"},
"attr_list":
[
{ "attr_name":"fan1_pwm", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x32", "attr_mask":"0xff", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"fan2_pwm", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x36", "attr_mask":"0xff", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"fan3_pwm", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x3a", "attr_mask":"0xff", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"fan1_direction", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x88", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"fan2_direction", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x88", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"fan3_direction", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x88", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"fan1_input", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x31", "attr_mask":"0xff", "attr_len":"1", "attr_mult":"150", "attr_is_divisor":0},
{ "attr_name":"fan2_input", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x35", "attr_mask":"0xff", "attr_len":"1", "attr_mult":"150" , "attr_is_divisor":0},
{ "attr_name":"fan3_input", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x39", "attr_mask":"0xff", "attr_len":"1", "attr_mult":"150", "attr_is_divisor":0}
]
}
},
"SYS_LED":
{
"dev_info": { "device_type":"LED", "device_name":"SYS_LED"},
"dev_attr": { "index":"0"},
"i2c" : {
"attr_list":
[
{"attr_name":"STATUS_LED_COLOR_AMBER","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x1","swpld_addr_offset":"0x43"},
{"attr_name":"STATUS_LED_COLOR_GREEN","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x2","swpld_addr_offset":"0x43"},
{"attr_name":"STATUS_LED_COLOR_OFF","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x0","swpld_addr_offset":"0x43"}
]
}
},
"FANTRAY1_LED":
{
"dev_info": { "device_type":"LED", "device_name":"FANTRAY_LED"},
"dev_attr": { "index":"0"},
"i2c" : {
"attr_list":
[
{"attr_name":"STATUS_LED_COLOR_GREEN","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x1","swpld_addr":"0x32","swpld_addr_offset":"0x33"},
{"attr_name":"STATUS_LED_COLOR_AMBER","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x2","swpld_addr":"0x32","swpld_addr_offset":"0x33"}
]
}
},
"FANTRAY2_LED":
{
"dev_info": { "device_type":"LED", "device_name":"FANTRAY_LED"},
"dev_attr": { "index":"1"},
"i2c" : {
"attr_list":
[
{"attr_name":"STATUS_LED_COLOR_GREEN","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x1","swpld_addr":"0x32","swpld_addr_offset":"0x37"},
{"attr_name":"STATUS_LED_COLOR_AMBER","attr_devtype":"cpld","attr_devname":"CPLD1B","bits":"1:0","descr":"","value":"0x2","swpld_addr":"0x32","swpld_addr_offset":"0x37"}
]
}
},
"FANTRAY3_LED":
{
"dev_info": { "device_type":"LED", "device_name":"FANTRAY_LED"},
"dev_attr": { "index":"2"},
"i2c" : {
"attr_list":
[
{"attr_name":"STATUS_LED_COLOR_GREEN","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x1","swpld_addr":"0x32","swpld_addr_offset":"0x3b"},
{"attr_name":"STATUS_LED_COLOR_AMBER","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x2","swpld_addr":"0x32","swpld_addr_offset":"0x3b"}
]
}
}
}

View File

@ -0,0 +1,686 @@
{
"PLATFORM":
{
"num_psus":2,
"num_fantrays":3,
"num_fans_pertray":1,
"num_ports":56,
"num_temps":4,
"pddf_dev_types":
{
"description":"Belgite - Below is the list of supported PDDF device types (chip names) for various components. If any component uses some other driver, we will create the client using 'echo <dev-address> <dev-type> > <path>/new_device' method",
"CPLD":
[
"i2c_cpld"
],
"PSU":
[
"psu_eeprom",
"psu_pmbus"
],
"FAN":
[
"fan_ctrl",
"fan_eeprom",
"fan_cpld"
],
"PORT_MODULE":
[
"pddf_xcvr"
]
},
"std_perm_kos":
[
"i2c-ismt",
"i2c-i801"
],
"std_kos":
[
"i2c_dev",
"i2c_mux_pca954x",
"gpio_pca953x",
"mc24lc64t",
"optoe"
],
"pddf_kos":
[
"pddf_client_module",
"pddf_mux_module",
"pddf_psu_driver_module",
"pddf_psu_module",
"pddf_gpio_module",
"pddf_xcvr_module",
"pddf_xcvr_driver_module",
"pddf_led_module",
"pddf_fan_driver_module",
"pddf_fan_module",
"pddf_led_module"
],
"custom_kos":
[
"pddf_custom_psu"
]
},
"SYSTEM":
{
"dev_info": {"device_type":"CPU", "device_name":"ROOT_COMPLEX", "device_parent":null},
"i2c":
{
"CONTROLLERS":
[
{ "dev_name":"i2c-0", "dev":"SMBUS0" }
]
}
},
"SMBUS0":
{
"dev_info": {"device_type": "SMBUS", "device_name": "SMBUS0", "device_parent": "SYSTEM"},
"i2c":
{
"topo_info": {"dev_addr": "0x0"},
"DEVICES":
[
{"dev": "EEPROM1"},
{"dev": "MUX1"}
]
}
},
"EEPROM1":
{
"dev_info": {"device_type": "EEPROM", "device_name": "EEPROM1", "device_parent": "SMBUS0"},
"i2c":
{
"topo_info": {"parent_bus": "0x0", "dev_addr": "0x52", "dev_type": "24lc64t"},
"dev_attr": {"access_mode": "BLOCK"},
"attr_list":
[
{"attr_name": "eeprom"}
]
}
},
"MUX1":
{
"dev_info": { "device_type":"MUX", "device_name":"MUX1", "device_parent":"SMBUS0"},
"i2c":
{
"topo_info": { "parent_bus":"0x0", "dev_addr":"0x70", "dev_type":"pca9548"},
"dev_attr": { "virt_bus":"0x2"},
"channel":
[
{"chn":"0", "dev":"CPLD1" },
{"chn":"0", "dev":"FAN-CTRL1" },
{"chn":"2", "dev":"PSU1" },
{"chn":"2", "dev":"PSU2" },
{"chn":"3", "dev":"TEMP1"},
{"chn":"3", "dev":"TEMP2"},
{"chn":"4", "dev":"TEMP3"},
{"chn":"4", "dev":"TEMP4"},
{"chn":"7", "dev":"MUX2"}
]
}
},
"MUX2":
{
"dev_info": { "device_type":"MUX", "device_name":"MUX2", "device_parent":"MUX1"},
"i2c":
{
"topo_info": { "parent_bus":"0x9", "dev_addr":"0x71", "dev_type":"pca9548"},
"dev_attr": { "virt_bus":"0x10"},
"channel":
[
{"chn":"0", "dev":"PORT49"},
{"chn":"1", "dev":"PORT50"},
{"chn":"2", "dev":"PORT51"},
{"chn":"3", "dev":"PORT52"},
{"chn":"4", "dev":"PORT53"},
{"chn":"5", "dev":"PORT54"},
{"chn":"6", "dev":"PORT55"},
{"chn":"7", "dev":"PORT56"}
]
}
},
"CPLD1":
{
"dev_info": {"device_type": "CPLD", "device_name": "CPLD1", "device_parent": "MUX1"},
"i2c":
{
"topo_info": {"parent_bus": "0x2", "dev_addr": "0x32", "dev_type": "i2c_cpld"},
"dev_attr": {}
}
},
"PSU1":
{
"dev_info": { "device_type":"PSU", "device_name":"PSU1", "device_parent":"MUX1"},
"dev_attr": { "dev_idx":"1", "num_psu_fans": "1"},
"i2c":
{
"interface":
[
{ "itf":"pmbus", "dev":"PSU1-PMBUS" }
]
}
},
"PSU1-PMBUS":
{
"dev_info": { "device_type":"PSU-PMBUS", "device_name":"PSU1-PMBUS", "device_parent":"MUX1", "virt_parent":"PSU1"},
"i2c":
{
"topo_info":{ "parent_bus":"0x4", "dev_addr":"0x58", "dev_type":"psu_pmbus"},
"attr_list":
[
{ "attr_name":"psu_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x41", "attr_mask":"0x10", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"psu_power_good", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x41", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"psu_model_name", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"16" },
{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"7" },
{ "attr_name":"psu_serial_num", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"16" },
{ "attr_name":"psu_v_in", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x88", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_i_in", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x89", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_p_in", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa7", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc5", "attr_mask":"0x18", "attr_cmpval":"0x08", "attr_len":"1"},
{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}
]
}
},
"PSU2":
{
"dev_info": { "device_type":"PSU", "device_name":"PSU2", "device_parent":"MUX1" },
"dev_attr": { "dev_idx":"2", "num_psu_fans":"1"},
"i2c":
{
"interface":
[
{ "itf":"pmbus", "dev":"PSU2-PMBUS"}
]
}
},
"PSU2-PMBUS":
{
"dev_info": {"device_type":"PSU-PMBUS", "device_name":"PSU2-PMBUS", "device_parent":"MUX1", "virt_parent":"PSU2"},
"i2c":
{
"topo_info": { "parent_bus":"0x4", "dev_addr":"0x59", "dev_type":"psu_pmbus"},
"attr_list":
[
{ "attr_name":"psu_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x41", "attr_mask":"0x20", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"psu_power_good", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x41", "attr_mask":"0x8", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"psu_model_name", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"16" },
{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"7" },
{ "attr_name":"psu_serial_num", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x9e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"16" },
{ "attr_name":"psu_v_in", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x88", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_i_in", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x89", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_p_in", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xa7", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_v_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_i_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_p_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xc5", "attr_mask":"0x18", "attr_cmpval":"0x08", "attr_len":"1"},
{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}
]
}
},
"TEMP1":
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP1", "device_parent":"MUX1"},
"dev_attr": { "display_name":"LM75_U10"},
"i2c":
{
"topo_info": { "parent_bus":"0x5", "dev_addr":"0x48", "dev_type":"lm75"},
"attr_list":
[
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"},
{ "attr_name": "temp1_max_hyst"},
{ "attr_name": "temp1_input"}
]
}
},
"TEMP2":
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP2", "device_parent":"MUX1"},
"dev_attr": { "display_name":"LM75_U4"},
"i2c":
{
"topo_info": { "parent_bus":"0x5", "dev_addr":"0x49", "dev_type":"lm75"},
"attr_list":
[
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"},
{ "attr_name": "temp1_max_hyst"},
{ "attr_name": "temp1_input"}
]
}
},
"TEMP3":
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP3", "device_parent":"MUX1"},
"dev_attr": { "display_name":"LM75_U7"},
"i2c":
{
"topo_info": { "parent_bus":"0x6", "dev_addr":"0x4a", "dev_type":"lm75"},
"attr_list":
[
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"},
{ "attr_name": "temp1_max_hyst"},
{ "attr_name": "temp1_input"}
]
}
},
"TEMP4":
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP4", "device_parent":"MUX1"},
"dev_attr": { "display_name":"LM75_U60"},
"i2c":
{
"topo_info": { "parent_bus":"0x6", "dev_addr":"0x49", "dev_type":"lm75"},
"attr_list":
[
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"},
{ "attr_name": "temp1_max_hyst"},
{ "attr_name": "temp1_input"}
]
}
},
"PORT49":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT49", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"49"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT49-EEPROM" },
{ "itf":"control", "dev":"PORT49-CTRL" }
]
}
},
"PORT49-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT49-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT49"},
"i2c":
{
"topo_info": { "parent_bus":"0x10", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT49-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT49-CTRL", "device_parent":"MUX2", "virt_parent":"PORT49"},
"i2c":
{
"topo_info": { "parent_bus":"0x10", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}
]
}
},
"PORT50":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT50", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"50"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT50-EEPROM" },
{ "itf":"control", "dev":"PORT50-CTRL" }
]
}
},
"PORT50-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT50-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT50"},
"i2c":
{
"topo_info": { "parent_bus":"0x11", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT50-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT50-CTRL", "device_parent":"MUX2", "virt_parent":"PORT50"},
"i2c":
{
"topo_info": { "parent_bus":"0x11", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}
]
}
},
"PORT51":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT51", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"51"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT51-EEPROM" },
{ "itf":"control", "dev":"PORT51-CTRL" }
]
}
},
"PORT51-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT51-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT51"},
"i2c":
{
"topo_info": { "parent_bus":"0x12", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT51-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT51-CTRL", "device_parent":"MUX2", "virt_parent":"PORT51"},
"i2c":
{
"topo_info": { "parent_bus":"0x12", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}
]
}
},
"PORT52":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT52", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"52"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT52-EEPROM" },
{ "itf":"control", "dev":"PORT52-CTRL" }
]
}
},
"PORT52-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT52-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT52"},
"i2c":
{
"topo_info": { "parent_bus":"0x13", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT52-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT52-CTRL", "device_parent":"MUX2", "virt_parent":"PORT52"},
"i2c":
{
"topo_info": { "parent_bus":"0x13", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}
]
}
},
"PORT53":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT53", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"53"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT53-EEPROM" },
{ "itf":"control", "dev":"PORT53-CTRL" }
]
}
},
"PORT53-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT53-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT53"},
"i2c":
{
"topo_info": { "parent_bus":"0x14", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT53-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT53-CTRL", "device_parent":"MUX2", "virt_parent":"PORT53"},
"i2c":
{
"topo_info": { "parent_bus":"0x14", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}
]
}
},
"PORT54":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT54", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"54"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT54-EEPROM" },
{ "itf":"control", "dev":"PORT54-CTRL" }
]
}
},
"PORT54-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT54-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT54"},
"i2c":
{
"topo_info": { "parent_bus":"0x15", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT54-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT54-CTRL", "device_parent":"MUX2", "virt_parent":"PORT54"},
"i2c":
{
"topo_info": { "parent_bus":"0x15", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}
]
}
},
"PORT55":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT55", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"55"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT55-EEPROM" },
{ "itf":"control", "dev":"PORT55-CTRL" }
]
}
},
"PORT55-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT55-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT55"},
"i2c":
{
"topo_info": { "parent_bus":"0x16", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT55-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT55-CTRL", "device_parent":"MUX2", "virt_parent":"PORT55"},
"i2c":
{
"topo_info": { "parent_bus":"0x16", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}
]
}
},
"PORT56":
{
"dev_info": { "device_type":"SFP28", "device_name":"PORT56", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"56"},
"i2c":
{
"interface":
[
{ "itf":"eeprom", "dev":"PORT56-EEPROM" },
{ "itf":"control", "dev":"PORT56-CTRL" }
]
}
},
"PORT56-EEPROM":
{
"dev_info": { "device_type":"", "device_name":"PORT56-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT56"},
"i2c":
{
"topo_info": { "parent_bus":"0x17", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
]
}
},
"PORT56-CTRL":
{
"dev_info": { "device_type":"", "device_name":"PORT56-CTRL", "device_parent":"MUX2", "virt_parent":"PORT56"},
"i2c":
{
"topo_info": { "parent_bus":"0x17", "dev_addr":"0x66", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_txfault", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x47", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"},
{ "attr_name":"xcvr_lpmode", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x4a", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x49", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x48", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}
]
}
},
"FAN-CTRL1":
{
"dev_info": { "device_type":"FAN", "device_name":"FAN-CTRL1", "device_parent":"MUX1"},
"i2c":
{
"topo_info": { "parent_bus":"0x2", "dev_addr":"0x66", "dev_type":"fan_cpld"},
"dev_attr": { "num_fantrays":"3"},
"attr_list":
[
{ "attr_name":"fan1_pwm", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x32", "attr_mask":"0xff", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"fan2_pwm", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x36", "attr_mask":"0xff", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"fan3_pwm", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x3a", "attr_mask":"0xff", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"fan1_direction", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x88", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"fan2_direction", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x88", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"fan3_direction", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x88", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"fan1_input", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x31", "attr_mask":"0xff", "attr_len":"1", "attr_mult":"150", "attr_is_divisor":0},
{ "attr_name":"fan2_input", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x35", "attr_mask":"0xff", "attr_len":"1", "attr_mult":"150" , "attr_is_divisor":0},
{ "attr_name":"fan3_input", "attr_devaddr":"0x32", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x39", "attr_mask":"0xff", "attr_len":"1", "attr_mult":"150", "attr_is_divisor":0}
]
}
},
"SYS_LED":
{
"dev_info": { "device_type":"LED", "device_name":"SYS_LED"},
"dev_attr": { "index":"0", "flag": "rw"},
"i2c" : {
"attr_list":
[
{"attr_name":"amber","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x1","swpld_addr_offset":"0x43"},
{"attr_name":"green","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x2","swpld_addr_offset":"0x43"},
{"attr_name":"off","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x0","swpld_addr_offset":"0x43"}
]
}
},
"FANTRAY1_LED":
{
"dev_info": { "device_type":"LED", "device_name":"FANTRAY_LED"},
"dev_attr": { "index":"0", "flag": "rw"},
"i2c" : {
"attr_list":
[
{"attr_name":"green","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x1","swpld_addr":"0x32","swpld_addr_offset":"0x33"},
{"attr_name":"red","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x2","swpld_addr":"0x32","swpld_addr_offset":"0x33"}
]
}
},
"FANTRAY2_LED":
{
"dev_info": { "device_type":"LED", "device_name":"FANTRAY_LED"},
"dev_attr": { "index":"1", "flag": "rw"},
"i2c" : {
"attr_list":
[
{"attr_name":"green","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x1","swpld_addr":"0x32","swpld_addr_offset":"0x37"},
{"attr_name":"red","attr_devtype":"cpld","attr_devname":"CPLD1B","bits":"1:0","descr":"","value":"0x2","swpld_addr":"0x32","swpld_addr_offset":"0x37"}
]
}
},
"FANTRAY3_LED":
{
"dev_info": { "device_type":"LED", "device_name":"FANTRAY_LED"},
"dev_attr": { "index":"2", "flag": "rw"},
"i2c" : {
"attr_list":
[
{"attr_name":"green","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x1","swpld_addr":"0x32","swpld_addr_offset":"0x3b"},
{"attr_name":"red","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x2","swpld_addr":"0x32","swpld_addr_offset":"0x3b"}
]
}
}
}

View File

@ -0,0 +1,395 @@
{
"chassis": {
"name": "E1070",
"status_led": {
"controllable": true,
"colors": ["green", "amber", "off"]
},
"thermal_manager": false,
"components": [
{
"name": "SWCPLD"
},
{
"name": "Main_BIOS"
},
{
"name": "Backup_BIOS"
}
],
"fans": [
{
"name": "Fantray1_1",
"speed": {
"controllable": true
},
"status_led": {
"controllable": true,
"colors": ["green", "amber","off"]
}
},
{
"name": "Fantray2_1",
"speed": {
"controllable": true
},
"status_led": {
"controllable": true,
"colors": ["green", "amber","off"]
}
},
{
"name": "Fantray3_1",
"speed": {
"controllable": true
},
"status_led": {
"controllable": true,
"colors": ["green", "amber","off"]
}
},
{
"name": "Fantray1_1",
"speed": {
"controllable": true
},
"status_led": {
"controllable": true,
"colors": ["green", "amber","off"]
}
},
{
"name": "Fantray2_1",
"speed": {
"controllable": true
},
"status_led": {
"controllable": true,
"colors": ["green", "amber","off"]
}
},
{
"name": "Fantray3_1",
"speed": {
"controllable": true
},
"status_led": {
"controllable": true,
"colors": ["green", "amber","off"]
}
}
],
"fan_drawers": [
{
"name": "Fantray1",
"speed": {
"controllable": false
},
"status_led": {
"controllable": false
},
"max_consumed_power": false,
"fans": [
{
"name": "Fantray1_1",
"speed": {
"controllable": false
},
"status_led": {
"controllable": false
}
}
]
},
{
"name": "Fantray2",
"speed": {
"controllable": false
},
"status_led": {
"controllable": false
},
"max_consumed_power": false,
"fans": [
{
"name": "Fantray2_1",
"speed": {
"controllable": false
},
"status_led": {
"controllable": false
}
}
]
},
{
"name": "Fantray3",
"speed": {
"controllable": false
},
"status_led": {
"controllable": false
},
"max_consumed_power": false,
"fans": [
{
"name": "Fantray3_1",
"speed": {
"controllable": false
},
"status_led": {
"controllable": false
}
}
]
}
],
"psus": [
{
"name": "PSU1",
"fans": [
{
"name": "PSU1_FAN1",
"speed": {
"controllable": false
},
"status_led": {
"controllable": false
}
}
],
"current": true,
"power": true,
"max_power": false,
"voltage_high_threshold": false,
"voltage_low_threshold": false,
"temperature": false,
"fans_target_speed": false,
"status_led": {
"controllable": false
}
},
{
"name": "PSU2",
"fans": [
{
"name": "PSU2_FAN1",
"speed": {
"controllable": false
},
"status_led": {
"controllable": false
}
}
],
"current": true,
"power": true,
"max_power": false,
"voltage_high_threshold": false,
"voltage_low_threshold": false,
"temperature": false,
"fans_target_speed": false,
"status_led": {
"controllable": false
}
}
],
"thermals": [
{
"name": "LM75_U10",
"controllable": false,
"low-threshold": false,
"low-crit-threshold": true
},
{
"name": "LM75_U4",
"controllable": false,
"low-threshold": false,
"low-crit-threshold": true
},
{
"name": "LM75_U7",
"controllable": false,
"low-threshold": false,
"low-crit-threshold": true
},
{
"name": "LM75_U60",
"controllable": false,
"low-threshold": false,
"low-crit-threshold": true
}
],
"sfps": [
{
"name": "PORT0"
},
{
"name": "PORT1"
},
{
"name": "PORT2"
},
{
"name": "PORT3"
},
{
"name": "PORT4"
},
{
"name": "PORT5"
},
{
"name": "PORT6"
},
{
"name": "PORT7"
},
{
"name": "PORT8"
},
{
"name": "PORT9"
},
{
"name": "PORT10"
},
{
"name": "PORT11"
},
{
"name": "PORT12"
},
{
"name": "PORT13"
},
{
"name": "PORT14"
},
{
"name": "PORT15"
},
{
"name": "PORT16"
},
{
"name": "PORT17"
},
{
"name": "PORT18"
},
{
"name": "PORT19"
},
{
"name": "PORT20"
},
{
"name": "PORT21"
},
{
"name": "PORT22"
},
{
"name": "PORT23"
},
{
"name": "PORT24"
},
{
"name": "PORT25"
},
{
"name": "PORT26"
},
{
"name": "PORT27"
},
{
"name": "PORT28"
},
{
"name": "PORT29"
},
{
"name": "PORT30"
},
{
"name": "PORT31"
},
{
"name": "PORT32"
},
{
"name": "PORT33"
},
{
"name": "PORT34"
},
{
"name": "PORT35"
},
{
"name": "PORT36"
},
{
"name": "PORT37"
},
{
"name": "PORT38"
},
{
"name": "PORT39"
},
{
"name": "PORT40"
},
{
"name": "PORT41"
},
{
"name": "PORT42"
},
{
"name": "PORT43"
},
{
"name": "PORT44"
},
{
"name": "PORT45"
},
{
"name": "PORT46"
},
{
"name": "PORT47"
},
{
"name": "PORT48"
},
{
"name": "PORT49"
},
{
"name": "PORT50"
},
{
"name": "PORT51"
},
{
"name": "PORT52"
},
{
"name": "PORT53"
},
{
"name": "PORT54"
},
{
"name": "PORT55"
}
]
},
"interfaces": {}
}

View File

@ -0,0 +1 @@
broadcom

View File

@ -0,0 +1,14 @@
try:
import os
from sonic_eeprom import eeprom_tlvinfo
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/0-0052/eeprom"
#Two i2c buses might get flipped order, check them both.
if not os.path.exists(self.eeprom_path):
self.eeprom_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-1/1-0052/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -0,0 +1,4 @@
{
"skip_ledd": true,
"skip_pcied": true
}

View File

@ -0,0 +1,16 @@
{
"services_to_ignore": [],
"devices_to_ignore": [
"asic",
"psu.temperature",
"PSU2 Fan",
"PSU1 Fan"
],
"user_defined_checkers": [],
"polling_interval": 60,
"led_color": {
"fault": "orange",
"normal": "green",
"booting": "orange_blink"
}
}

View File

@ -52,6 +52,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \
$(CEL_DX010_PLATFORM_MODULE) \ $(CEL_DX010_PLATFORM_MODULE) \
$(CEL_HALIBURTON_PLATFORM_MODULE) \ $(CEL_HALIBURTON_PLATFORM_MODULE) \
$(CEL_SEASTONE2_PLATFORM_MODULE) \ $(CEL_SEASTONE2_PLATFORM_MODULE) \
$(CEL_BELGITE_PLATFORM_MODULE) \
$(DELTA_AG9032V1_PLATFORM_MODULE) \ $(DELTA_AG9032V1_PLATFORM_MODULE) \
$(DELTA_AG9064_PLATFORM_MODULE) \ $(DELTA_AG9064_PLATFORM_MODULE) \
$(DELTA_AG5648_PLATFORM_MODULE) \ $(DELTA_AG5648_PLATFORM_MODULE) \

View File

@ -4,11 +4,13 @@ CEL_DX010_PLATFORM_MODULE_VERSION = 0.9
CEL_HALIBURTON_PLATFORM_MODULE_VERSION = 0.9 CEL_HALIBURTON_PLATFORM_MODULE_VERSION = 0.9
CEL_SEASTONE2_PLATFORM_MODULE_VERSION = 0.9 CEL_SEASTONE2_PLATFORM_MODULE_VERSION = 0.9
CEL_SILVERSTONE_PLATFORM_MODULE_VERSION = 0.9 CEL_SILVERSTONE_PLATFORM_MODULE_VERSION = 0.9
CEL_BELGITE_PLATFORM_MODULE_VERSION = 0.9
export CEL_DX010_PLATFORM_MODULE_VERSION export CEL_DX010_PLATFORM_MODULE_VERSION
export CEL_HALIBURTON_PLATFORM_MODULE_VERSION export CEL_HALIBURTON_PLATFORM_MODULE_VERSION
export CEL_SEASTONE2_PLATFORM_MODULE_VERSION export CEL_SEASTONE2_PLATFORM_MODULE_VERSION
export CEL_SILVERSTONE_PLATFORM_MODULE_VERSION export CEL_SILVERSTONE_PLATFORM_MODULE_VERSION
export CEL_BELGITE_PLATFORM_MODULE_VERSION
CEL_DX010_PLATFORM_MODULE = platform-modules-dx010_$(CEL_DX010_PLATFORM_MODULE_VERSION)_amd64.deb CEL_DX010_PLATFORM_MODULE = platform-modules-dx010_$(CEL_DX010_PLATFORM_MODULE_VERSION)_amd64.deb
$(CEL_DX010_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-cel $(CEL_DX010_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-cel
@ -28,3 +30,6 @@ CEL_SILVERSTONE_PLATFORM_MODULE = platform-modules-silverstone_$(CEL_SILVERSTONE
$(CEL_SILVERSTONE_PLATFORM_MODULE)_PLATFORM = x86_64-cel_silverstone-r0 $(CEL_SILVERSTONE_PLATFORM_MODULE)_PLATFORM = x86_64-cel_silverstone-r0
$(eval $(call add_extra_package,$(CEL_DX010_PLATFORM_MODULE),$(CEL_SILVERSTONE_PLATFORM_MODULE))) $(eval $(call add_extra_package,$(CEL_DX010_PLATFORM_MODULE),$(CEL_SILVERSTONE_PLATFORM_MODULE)))
CEL_BELGITE_PLATFORM_MODULE = platform-modules-belgite_$(CEL_BELGITE_PLATFORM_MODULE_VERSION)_amd64.deb
$(CEL_BELGITE_PLATFORM_MODULE)_PLATFORM = x86_64-cel_belgite-r0
$(eval $(call add_extra_package,$(CEL_DX010_PLATFORM_MODULE),$(CEL_BELGITE_PLATFORM_MODULE)))

View File

@ -0,0 +1 @@
obj-m:= mc24lc64t.o pddf_custom_wdt.o pddf_custom_psu.o

View File

@ -0,0 +1,174 @@
/*
* mc24lc64t.c - driver for Microchip 24LC64T(TLV Eeprom)
*
* Copyright (C) 2017 Celestica Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/mutex.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/jiffies.h>
#define EEPROM_SIZE 256 //mc24lt64t eeprom size in bytes.
struct mc24lc64t_data {
struct mutex update_lock;
};
static ssize_t mc24lc64t_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
struct i2c_client *client = kobj_to_i2c_client(kobj);
struct mc24lc64t_data *drvdata = i2c_get_clientdata(client);
unsigned long timeout, read_time, i = 0;
int status;
mutex_lock(&drvdata->update_lock);
if (i2c_smbus_write_byte_data(client, off>>8, off))
{
status = -EIO;
goto exit;
}
msleep(1);
begin:
if (i < count)
{
timeout = jiffies + msecs_to_jiffies(25); /* 25 mS timeout*/
do {
read_time = jiffies;
status = i2c_smbus_read_byte(client);
if (status >= 0)
{
buf[i++] = status;
goto begin;
}
} while (time_before(read_time, timeout));
status = -ETIMEDOUT;
goto exit;
}
status = count;
exit:
mutex_unlock(&drvdata->update_lock);
return status;
}
static ssize_t mc24lc64t_write (struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count){
struct i2c_client *client = kobj_to_i2c_client(kobj);
struct mc24lc64t_data *drvdata = i2c_get_clientdata(client);
unsigned long timeout, write_time, i = 0;
int status;
u16 value;
mutex_lock(&drvdata->update_lock);
begin:
if (i < count){
timeout = jiffies + msecs_to_jiffies(25); /* 25 mS timeout*/
value = (buf[i] << 8 | ( off &0xff));
do {
write_time = jiffies;
status = i2c_smbus_write_word_data(client, off>>8, value);
if (status >= 0)
{
// increase offset
off++;
// increase buffer index
i++;
goto begin;
}
} while (time_before(write_time, timeout));
status = -ETIMEDOUT;
goto exit;
}
status = count;
exit:
mutex_unlock(&drvdata->update_lock);
return status;
}
static struct bin_attribute mc24lc64t_bit_attr = {
.attr = {
.name = "eeprom",
.mode = S_IRUGO | S_IWUGO,
},
.size = EEPROM_SIZE,
.read = mc24lc64t_read,
.write = mc24lc64t_write,
};
static int mc24lc64t_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct i2c_adapter *adapter = client->adapter;
struct mc24lc64t_data *drvdata;
int err;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA
| I2C_FUNC_SMBUS_READ_BYTE))
return -EPFNOSUPPORT;
if (!(drvdata = devm_kzalloc(&client->dev,
sizeof(struct mc24lc64t_data), GFP_KERNEL)))
return -ENOMEM;
i2c_set_clientdata(client, drvdata);
mutex_init(&drvdata->update_lock);
err = sysfs_create_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr);
return err;
}
static int mc24lc64t_remove(struct i2c_client *client)
{
struct mc24lc64t_data *drvdata = i2c_get_clientdata(client);
sysfs_remove_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr);
return 0;
}
static const struct i2c_device_id mc24lc64t_id[] = {
{ "24lc64t", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, mc24lc64t_id);
static struct i2c_driver mc24lc64t_driver = {
.driver = {
.name = "mc24lc64t",
.owner = THIS_MODULE,
},
.probe = mc24lc64t_probe,
.remove = mc24lc64t_remove,
.id_table = mc24lc64t_id,
};
module_i2c_driver(mc24lc64t_driver);
MODULE_AUTHOR("Abhisit Sangjan <asang@celestica.com>");
MODULE_DESCRIPTION("Microchip 24LC64T Driver");
MODULE_LICENSE("GPL");

View File

@ -0,0 +1,125 @@
#include <linux/module.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <linux/slab.h>
#include <linux/dmi.h>
#include "../../../../pddf/i2c/modules/include/pddf_psu_defs.h"
#define PSU_REG_VOUT_MODE 0x20
#define PSU_REG_READ_VOUT 0x8b
ssize_t pddf_show_custom_psu_v_out(struct device *dev, struct device_attribute *da, char *buf);
extern PSU_SYSFS_ATTR_DATA access_psu_v_out;
static int two_complement_to_int(u16 data, u8 valid_bit, int mask)
{
u16 valid_data = data & mask;
bool is_negative = valid_data >> (valid_bit - 1);
return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data;
}
static u8 psu_get_vout_mode(struct i2c_client *client)
{
u8 status = 0, retry = 10;
uint8_t offset = PSU_REG_VOUT_MODE;
while (retry) {
status = i2c_smbus_read_byte_data((struct i2c_client *)client, offset);
if (unlikely(status < 0)) {
msleep(60);
retry--;
continue;
}
break;
}
if (status < 0)
{
printk(KERN_ERR "%s: Get PSU Vout mode failed\n", __func__);
return 0;
}
else
{
/*printk(KERN_ERR "%s: vout_mode reg value 0x%x\n", __func__, status);*/
return status;
}
}
static u16 psu_get_v_out(struct i2c_client *client)
{
u16 status = 0, retry = 10;
uint8_t offset = PSU_REG_READ_VOUT;
while (retry) {
status = i2c_smbus_read_word_data((struct i2c_client *)client, offset);
if (unlikely(status < 0)) {
msleep(60);
retry--;
continue;
}
break;
}
if (status < 0)
{
printk(KERN_ERR "%s: Get PSU Vout failed\n", __func__);
return 0;
}
else
{
/*printk(KERN_ERR "%s: vout reg value 0x%x\n", __func__, status);*/
return status;
}
}
ssize_t pddf_show_custom_psu_v_out(struct device *dev, struct device_attribute *da, char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
int exponent, mantissa;
int multiplier = 1000;
u16 value = psu_get_v_out(client);
u8 vout_mode = psu_get_vout_mode(client);
if ((vout_mode >> 5) == 0)
exponent = two_complement_to_int(vout_mode & 0x1f, 5, 0x1f);
else
{
/*printk(KERN_ERR "%s: Only support linear mode for vout mode\n", __func__);*/
exponent = 0;
}
mantissa = value;
if (exponent >= 0)
return sprintf(buf, "%d\n", (mantissa << exponent) * multiplier);
else
return sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent));
}
static int __init pddf_custom_psu_init(void)
{
access_psu_v_out.show = pddf_show_custom_psu_v_out;
access_psu_v_out.do_get = NULL;
return 0;
}
static void __exit pddf_custom_psu_exit(void)
{
return;
}
MODULE_AUTHOR("Broadcom");
MODULE_DESCRIPTION("pddf custom psu api");
MODULE_LICENSE("GPL");
module_init(pddf_custom_psu_init);
module_exit(pddf_custom_psu_exit);

View File

@ -0,0 +1,741 @@
/***************************************************************************
* Copyright (C) 2021 Celestica Corp *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/err.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/miscdevice.h>
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/uaccess.h>
#include <linux/watchdog.h>
#include <linux/sysfs.h>
#include <linux/hwmon-sysfs.h>
#define WDT_CONTROL_BASE 0xA100
#define TEST_SCRATCH_REG 0xA101
#define REBOOT_CAUSE_REG 0xA105
#define WDT_SET_TIMER_H_BIT_REG 0xA161
#define WDT_SET_TIMER_M_BIT_REG 0xA162
#define WDT_SET_TIMER_L_BIT_REG 0xA163
#define WDT_TIMER_H_BIT_REG 0xA164
#define WDT_TIMER_M_BIT_REG 0xA165
#define WDT_TIMER_L_BIT_REG 0xA166
#define WDT_ENABLE_REG 0xA167
#define WDT_FEED_REG 0xA168
#define WDT_PUNCH_REG 0xA169
#define WDT_START_FEED 0x01
#define WDT_STOP_FEED 0x00
#define POWER_CYCLE_RESET 0x00
#define POWER_ON_RESET 0x11
#define SOFT_SET_WARM_RESET 0x22
#define SOFT_SET_COLD_RESET 0x33
#define CPU_WARM_RESET 0x44
#define CPU_COLD_RESET 0x55
#define CPU_GPIO_WARM_RESET 0x66
#define WDT_RESET 0x77
#define CPU_OVERLOAD_RESET 0x88
#define INSUFFICIENT_FAN_SPEED_RESET 0xAA
#define MAX_TIMER_VALUE 0xffffff
#define DEFUALT_TIMER_VALUE 180000 /* 180s */
#define WDT_ENABLE 0x01
#define WDT_DISABLE 0x00
#define WDT_RESTART 0x00
#define DRV_NAME "cpld_wdt"
#define DRV_VERSION "1.0.0"
#define DEV_NAME "cpld_wdt"
struct wdt_data {
unsigned long opened;
struct mutex lock;
char expect_close;
struct watchdog_info ident;
int timeout;
int timer_val;
char caused_reboot; /* last reboot was by the watchdog */
struct resource *res;
};
struct cpld_wdt_private {
struct platform_device *pdev;
struct watchdog_device wddev;
struct cdev cdev;
bool suspended;
struct wdt_data wdat;
};
//struct class *cpld_wdt;
static const int max_timeout = MAX_TIMER_VALUE;
static int timeout = DEFUALT_TIMER_VALUE; /* default 180s */
module_param(timeout, int, 0);
MODULE_PARM_DESC(timeout, "Start watchdog timer on module load with"
" given initial timeout(unit: ms)."
" Zero (default) disables this feature.");
static bool nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0444);
MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close");
static unsigned int watchdog_get_timeleft(struct cpld_wdt_private *wdt)
{
int time = 0;
mutex_lock(&wdt->wdat.lock);
time = inb(WDT_TIMER_H_BIT_REG);
time = time << 8 | inb(WDT_TIMER_M_BIT_REG);
time = time << 8 | inb(WDT_TIMER_L_BIT_REG);
time = time/1000;
mutex_unlock(&wdt->wdat.lock);
//pr_crit("Watchdog Get Timeleft:%u\n", time);
return time;
}
static int watchdog_get_timeout(struct cpld_wdt_private *wdt)
{
int timeout = 0;
if(!wdt)
return -EINVAL;
mutex_lock(&wdt->wdat.lock);
timeout = inb(WDT_SET_TIMER_H_BIT_REG);
timeout = timeout << 8 | inb(WDT_SET_TIMER_M_BIT_REG);
timeout = timeout << 8 | inb(WDT_SET_TIMER_L_BIT_REG);
timeout=timeout/1000;
mutex_unlock(&wdt->wdat.lock);
return timeout;
}
static int watchdog_set_timeout(struct cpld_wdt_private *wdt, unsigned int timeout)
{
unsigned char val = 0;
if(!wdt)
return -EINVAL;
if (timeout <= 0
|| timeout > max_timeout) {
pr_err("watchdog timeout out of range\n");
return -EINVAL;
}
mutex_lock(&wdt->wdat.lock);
wdt->wdat.timeout = timeout;
if (timeout > MAX_TIMER_VALUE) {
wdt->wdat.timer_val = MAX_TIMER_VALUE;
} else {
wdt->wdat.timer_val = timeout;
}
/* Set timer value */
//pr_crit("Watchdog Timeout:0x%06x\n", wdt->wdat.timer_val);
outb((wdt->wdat.timer_val >> 16) & 0xff, WDT_SET_TIMER_H_BIT_REG);
outb((wdt->wdat.timer_val >> 8) & 0xff, WDT_SET_TIMER_M_BIT_REG);
outb(wdt->wdat.timer_val & 0xff, WDT_SET_TIMER_L_BIT_REG);
mutex_unlock(&wdt->wdat.lock);
return 0;
}
static int watchdog_ping(struct cpld_wdt_private *wdt)
{
if(!wdt)
return -EINVAL;
mutex_lock(&wdt->wdat.lock);
/* start feed watchdog */
outb(WDT_START_FEED, WDT_FEED_REG);
/* stop feed watchdog */
outb(WDT_STOP_FEED, WDT_FEED_REG);
//pr_crit("Watchdog Ping\n");
mutex_unlock(&wdt->wdat.lock);
return 0;
}
static void watchdog_keepalive(struct cpld_wdt_private *wdt)
{
unsigned char val = 0;
if(!wdt)
return;
mutex_lock(&wdt->wdat.lock);
val = inb(WDT_FEED_REG);
val &= 0x1;
val = ~val;
val &= 0x1;
/* start feed watchdog */
outb(val, WDT_FEED_REG);
//pr_crit("Watchdog Keepalive\n");
mutex_unlock(&wdt->wdat.lock);
return;
}
static int watchdog_start(struct cpld_wdt_private *wdt)
{
if(!wdt)
return -EINVAL;
/* Make sure we don't die as soon as the watchdog is enabled below */
//watchdog_keepalive();
mutex_lock(&wdt->wdat.lock);
outb(WDT_ENABLE, WDT_ENABLE_REG);
outb(WDT_RESTART, WDT_PUNCH_REG);
mutex_unlock(&wdt->wdat.lock);
//pr_crit("Watchdog Start:Enable and PUNCH\n");
return 0;
}
static int watchdog_stop(struct cpld_wdt_private *wdt)
{
if(!wdt)
return -EINVAL;
mutex_lock(&wdt->wdat.lock);
outb(WDT_DISABLE, WDT_ENABLE_REG);
mutex_unlock(&wdt->wdat.lock);
//pr_crit("Watchdog Stop\n");
return 0;
}
static char watchdog_get_reason(struct cpld_wdt_private *p)
{
char status = 0;
if (!p)
return -1;
mutex_lock(&p->wdat.lock);
status = inb(REBOOT_CAUSE_REG);
mutex_unlock(&p->wdat.lock);
return status;
}
static bool watchdog_is_running(struct cpld_wdt_private *wdt)
{
/*
* if we fail to determine the watchdog's status assume it to be
* running to be on the safe side
*/
bool is_running = true;
mutex_lock(&wdt->wdat.lock);
is_running = inb(WDT_ENABLE_REG);
mutex_unlock(&wdt->wdat.lock);
return is_running;
}
static const struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING |
WDIOF_MAGICCLOSE,
.firmware_version = 0,
.identity = DRV_NAME,
};
static ssize_t identity_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct cpld_wdt_private *wdt = dev_get_drvdata(dev);
if(!wdt)
return -EINVAL;
return sprintf(buf, "%s\n", wdt->wdat.ident.identity);
}
static DEVICE_ATTR_RO(identity);
static ssize_t state_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct cpld_wdt_private *wdt = dev_get_drvdata(dev);
bool state = watchdog_is_running(wdt);
if(true == state)
return sprintf(buf, "active\n");
else
return sprintf(buf, "inactive\n");
}
static DEVICE_ATTR_RO(state);
static ssize_t status_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
unsigned int status;
struct cpld_wdt_private *wdt = dev_get_drvdata(dev);
if(!wdt)
return -EINVAL;
return sprintf(buf, "0x%x\n", status);
}
static DEVICE_ATTR_RO(status);
static ssize_t reason_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
char bootstatus;
struct cpld_wdt_private *wdt = dev_get_drvdata(dev);
if(!wdt)
return -EINVAL;
bootstatus = watchdog_get_reason(wdt);
return sprintf(buf, "0x%02x\n", bootstatus);
}
static DEVICE_ATTR_RO(reason);
static ssize_t timeleft_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
unsigned int timeleft;
struct cpld_wdt_private *wdt = dev_get_drvdata(dev);
if(!wdt)
return -EINVAL;
timeleft = watchdog_get_timeleft(wdt);
return sprintf(buf, "%u\n", timeleft);
}
static DEVICE_ATTR_RO(timeleft);
static ssize_t timeout_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
unsigned int timeout;
struct cpld_wdt_private *wdt = dev_get_drvdata(dev);
if(!wdt)
return -EINVAL;
timeout = watchdog_get_timeout(wdt);
return sprintf(buf, "%u\n", timeout);
}
static DEVICE_ATTR_RO(timeout);
static struct attribute *wdt_attrs[] = {
&dev_attr_state.attr,
&dev_attr_identity.attr,
&dev_attr_status.attr,
&dev_attr_reason.attr,
&dev_attr_timeleft.attr,
&dev_attr_timeout.attr,
NULL,
};
static const struct attribute_group wdt_group = {
.attrs = wdt_attrs,
};
static int watchdog_open(struct inode *inode, struct file *file)
{
struct cpld_wdt_private *wdt;
wdt = container_of(inode->i_cdev, struct cpld_wdt_private, cdev);
/* If the watchdog is alive we don't need to start it again */
if (test_and_set_bit(0, &wdt->wdat.opened))
return -EBUSY;
//watchdog_start(wdt);
if (nowayout)
__module_get(THIS_MODULE);
wdt->wdat.expect_close = 0;
file->private_data = wdt;
return nonseekable_open(inode, file);
}
static int watchdog_release(struct inode *inode, struct file *file)
{
struct cpld_wdt_private *p;
p = (struct cpld_wdt_private *)file->private_data;
if(!p)
return -EINVAL;
clear_bit(0, &p->wdat.opened);
if (!p->wdat.expect_close) {
//watchdog_keepalive(p);
//pr_crit("Unexpected close, Not stopping watchdog!\n");
} else if (!nowayout) {
//pr_crit("Cpld Watchdog Stopped!\n");
watchdog_stop(p);
}
return 0;
}
/*
* watchdog_write:
* @file: file handle to the watchdog
* @buf: buffer to write
* @count: count of bytes
* @ppos: pointer to the position to write. No seeks allowed
*
* A write to a watchdog device is defined as a keepalive signal. Any
* write of data will do, as we we don't define content meaning.
*/
static ssize_t watchdog_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct cpld_wdt_private *p;
p = (struct cpld_wdt_private *)file->private_data;
if(!p)
return -EINVAL;
if (count) {
if (!nowayout) {
size_t i;
/* In case it was set long ago */
bool expect_close = false;
for (i = 0; i != count; i++) {
char c;
if (get_user(c, buf + i))
return -EFAULT;
expect_close = (c == 'V');
}
/* Properly order writes across fork()ed processes */
mutex_lock(&p->wdat.lock);
p->wdat.expect_close = expect_close;
mutex_unlock(&p->wdat.lock);
}
/* someone wrote to us, we should restart timer */
watchdog_keepalive(p);
}
return count;
}
/*
* watchdog_ioctl:
* @inode: inode of the device
* @file: file handle to the device
* @cmd: watchdog command
* @arg: argument pointer
*
* The watchdog API defines a common set of functions for all watchdogs
* according to their available features.
*/
static long watchdog_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
int status;
int new_options;
int new_timeout;
unsigned int val;
union {
struct watchdog_info __user *ident;
int __user *i;
} uarg;
uarg.i = (int __user *)arg;
struct cpld_wdt_private *p;
p = (struct cpld_wdt_private *)file->private_data;
if(!p)
return -EINVAL;
switch (cmd) {
case WDIOC_GETSUPPORT:
return copy_to_user(uarg.ident, &p->wdat.ident,
sizeof(p->wdat.ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS:
status = watchdog_is_running(p);
return put_user(status, uarg.i);
case WDIOC_GETBOOTSTATUS:
//status = watchdog_get_bootstatus(p);
return put_user(status, uarg.i);
case WDIOC_SETOPTIONS:
if (get_user(new_options, uarg.i)){
return -EFAULT;
}
if (new_options & WDIOS_DISABLECARD){
return watchdog_stop(p);
}
if (new_options & WDIOS_ENABLECARD){
return watchdog_start(p);
}
return 0;
case WDIOC_KEEPALIVE:
watchdog_keepalive(p);
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, uarg.i))
return -EFAULT;
new_timeout = new_timeout*1000;
if (watchdog_set_timeout(p, new_timeout))
return -EINVAL;
val = watchdog_get_timeout(p);
return put_user(val, uarg.i);
case WDIOC_GETTIMEOUT:
val = watchdog_get_timeout(p);
return put_user(val, uarg.i);
case WDIOC_GETTIMELEFT:
val = watchdog_get_timeleft(p);
return put_user(val, uarg.i);
default:
return -ENOTTY;
}
}
static int watchdog_notify_sys(struct notifier_block *this, unsigned long code,
void *unused)
{
if (code == SYS_DOWN || code == SYS_HALT)
//watchdog_stop(p);
pr_err("CPLD Watchdog did not Stop!\n");
return NOTIFY_DONE;
}
static const struct file_operations watchdog_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.open = watchdog_open,
.release = watchdog_release,
.write = watchdog_write,
.unlocked_ioctl = watchdog_ioctl,
};
static struct miscdevice watchdog_miscdev = {
//.minor = WATCHDOG_MINOR,
.name = DEV_NAME,
.fops = &watchdog_fops,
};
static struct notifier_block watchdog_notifier = {
.notifier_call = watchdog_notify_sys,
};
static int cpld_wdt_probe(struct platform_device *pdev)
{
int wdt_reboot_cause, err = 0;
unsigned char ver = 0;
struct device *dev = &pdev->dev;
struct cpld_wdt_private *p;
p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL);
if (!p)
return -ENOMEM;
mutex_init(&(p->wdat.lock));
p->wdat.ident.options = WDIOC_SETTIMEOUT
| WDIOF_MAGICCLOSE
| WDIOF_KEEPALIVEPING
| WDIOC_GETTIMELEFT;
snprintf(p->wdat.ident.identity,
sizeof(p->wdat.ident.identity), "%s", DRV_NAME);
wdt_reboot_cause = inb(REBOOT_CAUSE_REG); // REBOOT_CAUSE
p->wdat.caused_reboot = wdt_reboot_cause;
ver = inb(WDT_CONTROL_BASE);
pr_info("Watchdog CPLD Version:0x%02x\n",
ver);
if (timeout) {
if (timeout <= 0
|| timeout > max_timeout) {
pr_err("starting timeout out of range\n");
err = -EINVAL;
return err;
}
//watchdog_start(p);
if (timeout > MAX_TIMER_VALUE) {
watchdog_set_timeout(p, MAX_TIMER_VALUE);
} else {
watchdog_set_timeout(p, timeout);
}
if (nowayout)
__module_get(THIS_MODULE);
pr_info("watchdog started with initial timeout of %u Second(s)\n",
timeout/1000);
}
err = watchdog_set_timeout(p, timeout);
if (err)
return err;
err = register_reboot_notifier(&watchdog_notifier);
if (err)
return err;
err = misc_register(&watchdog_miscdev);
if (err) {
pr_err("cannot register miscdev on minor=%d\n",
watchdog_miscdev.minor);
return err;;
}
/*p->wdat.res = platform_get_resource(pdev, IORESOURCE_IO, WDT_CONTROL_BASE);
if (!p->wdat.res)
return -ENODEV;
if (!devm_request_region(dev, p->wdat.res->start,
resource_size(p->wdat.res),
pdev->name)) {
return -EBUSY;
}
*/
err = sysfs_create_group(&pdev->dev.kobj, &wdt_group);
if (err) {
printk(KERN_ERR "Cannot create sysfs for cpld_wdt.\n");
return err;
}
platform_set_drvdata(pdev, p);
dev_set_drvdata(dev, p);
pr_info("initialized. sec (nowayout=%d)\n",
nowayout);
return 0;
}
static int cpld_wdt_remove(struct platform_device *pdev)
{
struct cpld_wdt_private *p = platform_get_drvdata(pdev);
/*
if (!nowayout)
watchdog_stop(&p->wddev);
*/
if(!p)
return 0;
sysfs_remove_group(&pdev->dev.kobj, &wdt_group);
misc_deregister(&watchdog_miscdev);
unregister_reboot_notifier(&watchdog_notifier);
return 0;
}
static struct platform_driver cpld_wdt_driver = {
.probe = cpld_wdt_probe,
.remove = cpld_wdt_remove,
.driver = {
.name = DRV_NAME,
},
};
static struct resource cpld_wdt_resources[] = {
{
.start = 0xA100,
.end = 0xA1F2,
.flags = IORESOURCE_IO,
},
};
static void wdt_dev_release( struct device * dev)
{
return;
}
static struct platform_device cpld_wdt_dev = {
.name = DRV_NAME,
.id = -1,
.num_resources = ARRAY_SIZE(cpld_wdt_resources),
.resource = cpld_wdt_resources,
.dev = {
.release = wdt_dev_release,
}
};
static int __init cpld_wdt_init_module(void)
{
int err = 0;
err = platform_device_register(&cpld_wdt_dev);
err += platform_driver_register(&cpld_wdt_driver);
if(err < 0)
pr_info("Platform Device/Driver Register Failed. err:%d\n", err);
pr_info("CPLD WatchDog Timer Driver v%s\n", DRV_VERSION);
return err;
}
static void __exit cpld_wdt_cleanup_module(void)
{
platform_driver_unregister(&cpld_wdt_driver);
platform_device_unregister(&cpld_wdt_dev);
pr_info("Watchdog Module Unloaded\n");
}
module_init(cpld_wdt_init_module);
module_exit(cpld_wdt_cleanup_module);
MODULE_DESCRIPTION("Cpld Watchdog Driver");
MODULE_VERSION(DRV_VERSION);
MODULE_AUTHOR("Nicholas <nicwu@celestica.com>");
MODULE_LICENSE("GPL");

View File

@ -0,0 +1,4 @@
# All the derived classes for PDDF
__all__ = ["platform", "chassis", "sfp", "psu", "thermal"]
from sonic_platform import * #[py/polluting-import]

View File

@ -0,0 +1,162 @@
#############################################################################
# PDDF
# Module contains an implementation of SONiC Chassis API
#
#############################################################################
import os
try:
from sonic_platform_pddf_base.pddf_chassis import PddfChassis
from sonic_platform_pddf_base.pddf_eeprom import PddfEeprom
from sonic_platform_base.chassis_base import ChassisBase
from sonic_platform.fan_drawer import FanDrawer
from sonic_platform.watchdog import Watchdog
import sys
import subprocess
from sonic_py_common import device_info
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
NUM_COMPONENT = 3
FAN_DIRECTION_FILE_PATH = "/var/fan_direction"
class Chassis(PddfChassis):
"""
PDDF Platform-specific Chassis class
"""
def __init__(self, pddf_data=None, pddf_plugin_data=None):
PddfChassis.__init__(self, pddf_data, pddf_plugin_data)
vendor_ext = self._eeprom.vendor_ext_str()
with open(FAN_DIRECTION_FILE_PATH, "w+") as f:
f.write(vendor_ext)
(self.platform, self.hwsku) = device_info.get_platform_and_hwsku()
self.__initialize_components()
def __initialize_components(self):
from sonic_platform.component import Component
for index in range(0, NUM_COMPONENT):
component = Component(index)
self._component_list.append(component)
# Provide the functions/variables below for which implementation is to be overwritten
def initizalize_system_led(self):
return True
def get_sfp(self, index):
"""
Retrieves sfp represented by (1-based) index <index>
For Quanta the index in sfputil.py starts from 1, so override
Args:
index: An integer, the index (1-based) of the sfp to retrieve.
The index should be the sequence of a physical port in a chassis,
starting from 1.
Returns:
An object dervied from SfpBase representing the specified sfp
"""
sfp = None
try:
if index == 0:
raise IndexError
sfp = self._sfp_list[index - 1]
except IndexError:
sys.stderr.write("override: SFP index {} out of range (1-{})\n".format(
index, len(self._sfp_list)))
return sfp
def get_watchdog(self):
"""
Retreives hardware watchdog device on this chassis
Returns:
An object derived from WatchdogBase representing the hardware
watchdog device
"""
if self._watchdog is None:
self._watchdog = Watchdog()
return self._watchdog
def get_reboot_cause(self):
"""
Retrieves the cause of the previous reboot
Returns:
A tuple (string, string) where the first element is a string
containing the cause of the previous reboot. This string must be
one of the predefined strings in this class. If the first string
is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used
to pass a description of the reboot cause.
"""
hw_reboot_cause = ""
with open("/sys/devices/platform/cpld_wdt/reason", "r") as f:
hw_reboot_cause = f.read().strip()
if hw_reboot_cause == "0x77":
reboot_cause = self.REBOOT_CAUSE_WATCHDOG
description = 'Hardware Watchdog Reset'
elif hw_reboot_cause == "0x66":
reboot_cause = self.REBOOT_CAUSE_HARDWARE_OTHER
description = 'GPIO Request Warm Reset'
elif hw_reboot_cause == "0x55":
reboot_cause = self.REBOOT_CAUSE_HARDWARE_OTHER
description = 'CPU Cold Reset'
elif hw_reboot_cause == "0x44":
reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE
description = 'CPU Warm Reset'
elif hw_reboot_cause == "0x33":
reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE
description = 'Soft-Set Cold Reset'
elif hw_reboot_cause == "0x22":
reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE
description = 'Soft-Set Warm Reset'
elif hw_reboot_cause == "0x11":
reboot_cause = self.REBOOT_CAUSE_POWER_LOSS
description = 'Power Loss'
else:
reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE
description = 'Unkown Reason'
return (reboot_cause, description)
def get_serial(self):
return self._eeprom.serial_number_str()
def get_revision(self):
return self._eeprom.revision_str()
@staticmethod
def get_position_in_parent():
return -1
@staticmethod
def is_replaceable():
return True
def get_base_mac(self):
return self._eeprom.base_mac_addr()
def get_system_eeprom_info(self):
return self._eeprom.system_eeprom_info()
def get_name(self):
return self.modelstr()
def get_model(self):
return self._eeprom.part_number_str()
def set_status_led(self, color):
color_dict = {
'green': "STATUS_LED_COLOR_GREEN",
'red': "STATUS_LED_COLOR_AMBER",
'amber': "STATUS_LED_COLOR_AMBER",
'off': "STATUS_LED_COLOR_OFF"
}
return self.set_system_led("SYS_LED", color_dict.get(color, "off"))
def get_status_led(self):
return self.get_system_led("SYS_LED")

View File

@ -0,0 +1,142 @@
#!/usr/bin/env python
#############################################################################
# Celestica
#
# Component contains an implementation of SONiC Platform Base API and
# provides the components firmware management function
#
#############################################################################
import os.path
import subprocess
import time
import os
try:
from sonic_platform_base.component_base import ComponentBase
#from helper import APIHelper
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
SWCPLD_VERSION_PATH = "i2cget -y -f 2 0x32 0"
BIOS_VERSION_PATH = "dmidecode -t bios | grep Version"
COMPONENT_NAME_LIST = ["SWCPLD", "Main_BIOS", "Backup_BIOS"]
COMPONENT_DES_LIST = ["Use for boot control and BIOS switch",
"Main basic Input/Output System",
"Backup basic Input/Output System"]
class Component(ComponentBase):
"""Platform-specific Component class"""
DEVICE_TYPE = "component"
def __init__(self, component_index):
ComponentBase.__init__(self)
self.index = component_index
#self._api_helper = APIHelper()
self.name = self.get_name()
def run_command(self,cmd):
responses = os.popen(cmd).read()
return responses
def __get_bios_version(self):
# Retrieves the BIOS firmware version
result = self.run_command("i2cget -y -f 2 0x32 0x19")
if result.strip() == "0x01":
if self.name == "Main_BIOS":
version = self.run_command(BIOS_VERSION_PATH)
bios_version = version.strip().split(" ")[1]
return str(bios_version)
elif self.name == "Backup_BIOS":
bios_version = "na"
return bios_version
elif result.strip() == "0x03":
if self.name == "Backup_BIOS":
version = self.run_command(BIOS_VERSION_PATH)
bios_version = version.strip().split(" ")[1]
return str(bios_version)
elif self.name == "Main_BIOS":
bios_version = "na"
return bios_version
def __get_cpld_version(self):
if self.name == "SWCPLD":
ver = self.run_command(SWCPLD_VERSION_PATH)
print("ver is %s" % ver)
ver = ver.strip().split("x")[1]
print("ver2 is %s" % ver)
version = int(ver.strip()) / 10
return str(version)
def get_name(self):
"""
Retrieves the name of the component
Returns:
A string containing the name of the component
"""
return COMPONENT_NAME_LIST[self.index]
def get_description(self):
"""
Retrieves the description of the component
Returns:
A string containing the description of the component
"""
return COMPONENT_DES_LIST[self.index]
def get_firmware_version(self):
"""
Retrieves the firmware version of module
Returns:
string: The firmware versions of the module
"""
fw_version = None
if "BIOS" in self.name:
fw_version = self.__get_bios_version()
elif "CPLD" in self.name:
fw_version = self.__get_cpld_version()
return fw_version
def install_firmware(self, image_path):
"""
Install firmware to module
Args:
image_path: A string, path to firmware image
Returns:
A boolean, True if install successfully, False if not
"""
return False
def update_firmware(self, image_path):
return False
def get_available_firmware_version(self, image_path):
return 'N/A'
def get_firmware_update_notification(self, image_path):
return "None"
def get_model(self):
return 'N/A'
def get_position_in_parent(self):
return -1
def get_presence(self):
return True
def get_serial(self):
return 'N/A'
def get_status(self):
return True
def is_replaceable(self):
return False

View File

@ -0,0 +1,75 @@
try:
from sonic_platform_pddf_base.pddf_eeprom import PddfEeprom
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Eeprom(PddfEeprom):
_TLV_DISPLAY_VENDOR_EXT = True
_TLV_INFO_MAX_LEN = 256
pddf_obj = {}
plugin_data = {}
def __init__(self, pddf_data=None, pddf_plugin_data=None):
if not pddf_data or not pddf_plugin_data:
raise ValueError('PDDF JSON data error')
self.pddf_obj = pddf_data
self.plugin_data = pddf_plugin_data
# system EEPROM always has device name EEPROM1
self.eeprom_path = self.pddf_obj.get_path("EEPROM1", "eeprom")
if self.eeprom_path is None:
return
super(PddfEeprom, self).__init__(self.eeprom_path, 0, '', True)
#super().__init__(self.pddf_obj, self.plugin_data)
self.eeprom_tlv_dict = dict()
try:
self.eeprom_data = self.read_eeprom()
except Exception as e:
self.eeprom_data = "N/A"
raise RuntimeError("PddfEeprom is not Programmed - Error: {}".format(str(e)))
else:
eeprom = self.eeprom_data
if not self.is_valid_tlvinfo_header(eeprom):
return
total_length = ((eeprom[9]) << 8) | (eeprom[10])
tlv_index = self._TLV_INFO_HDR_LEN
tlv_end = self._TLV_INFO_HDR_LEN + total_length
while (tlv_index + 2) < self._TLV_INFO_MAX_LEN and tlv_index < tlv_end:
if not self.is_valid_tlv(eeprom[tlv_index:]):
break
tlv = eeprom[tlv_index:tlv_index + 2
+ (eeprom[tlv_index + 1])]
code = "0x%02X" % ((tlv[0]))
if (tlv[0]) == self._TLV_CODE_VENDOR_EXT:
name = "Vendor Extension" #lgtm [py/multiple-definition]
value = ""
if self._TLV_DISPLAY_VENDOR_EXT:
for c in tlv[2:2 + tlv[1]]:
value += "0x%02X " % c
else:
name, value = self.decoder(None, tlv)
self.eeprom_tlv_dict[code] = value
if (eeprom[tlv_index]) == self._TLV_CODE_CRC_32:
break
tlv_index += (eeprom[tlv_index+1]) + 2
def vendor_ext_str(self):
"""
:return: the direction of fan(FB or BF, string)
"""
(is_valid, results) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_VENDOR_EXT)
if not is_valid:
return "N/A"
return str(hex(int(results[2][2]))).replace("0x", "").upper()
# Provide the functions/variables below for which implementation is to be overwritten

View File

@ -0,0 +1,146 @@
try:
from sonic_platform_pddf_base.pddf_fan import PddfFan
import os
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
# ------------------------------------------------------------------
# HISTORY:
# 5/1/2022 (A.D.)
# add function:set_status_led,
# Solve the problem that when a fan is pulled out, the Fan LED on the front panel is still green Issue-#11525
# ------------------------------------------------------------------
FAN_DIRECTION_FILE_PATH = "/var/fan_direction"
class Fan(PddfFan):
"""PDDF Platform-Specific Fan class"""
def __init__(self, tray_idx, fan_idx=0, pddf_data=None, pddf_plugin_data=None, is_psu_fan=False, psu_index=0):
# idx is 0-based
PddfFan.__init__(self, tray_idx, fan_idx, pddf_data, pddf_plugin_data, is_psu_fan, psu_index)
def get_speed_tolerance(self):
"""
Retrieves the speed tolerance of the fan
Returns:
An integer, the percentage of variance from target speed which is
considered tolerable
"""
# Fix the speed vairance to 10 percent. If it changes based on platforms, overwrite
# this value in derived pddf fan class
return 20
def get_presence(self):
#Overwirte the PDDF Common since the FANs on Belgite are all Fixed and present
return True
def get_direction(self):
"""
Retrieves the direction of fan
Returns:
A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST
depending on fan direction
"""
if self.is_psu_fan:
cmd_num = "58" if self.fans_psu_index == 1 else "59"
cmd = "i2cget -y -f 4 0x%s 0x80" % cmd_num
res = os.popen(cmd).read()
# F2B
if res.strip() == "0x01":
direction = "EXHAUST"
else:
direction = "INTAKE"
else:
direction = "INTAKE"
with open(FAN_DIRECTION_FILE_PATH, "r") as f:
fan_direction = f.read()
if fan_direction.strip() == "FB":
direction = "EXHAUST"
return direction
def get_status(self):
speed = self.get_speed_rpm()
status = True if (speed != 0) else False
return status
def get_target_speed(self):
"""
Retrieves the target (expected) speed of the fan
Returns:
An integer, the percentage of full fan speed, in the range 0 (off)
to 100 (full speed)
"""
target_speed = 0
if self.is_psu_fan:
# Target speed not usually supported for PSU fans
target_speed = "N/A"
else:
idx = (self.fantray_index - 1) * 1 + self.fan_index
attr = "fan" + str(idx) + "_pwm"
pwm_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-2/2-0066/" + attr
pwm = 0
with open(pwm_path, "r") as f:
pwm = f.read()
percentage = int(pwm.strip())
speed_percentage = int(round(percentage / 255 * 100))
target_speed = speed_percentage
return target_speed
def set_status_led(self, color):
color_dict = {"green": "STATUS_LED_COLOR_GREEN",
"red": "STATUS_LED_COLOR_AMBER"}
color = color_dict.get(color, "off")
index = str(self.fantray_index - 1)
led_device_name = "FANTRAY{}".format(self.fantray_index) + "_LED"
result, msg = self.pddf_obj.is_supported_sysled_state(led_device_name, color)
if result is False:
return False
device_name = self.pddf_obj.data[led_device_name]['dev_info']['device_name']
self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path())
self.pddf_obj.create_attr('index', index, self.pddf_obj.get_led_path())
self.pddf_obj.create_attr('color', color, self.pddf_obj.get_led_cur_state_path())
self.pddf_obj.create_attr('dev_ops', 'set_status', self.pddf_obj.get_led_path())
return True
@staticmethod
def get_model():
"""
Retrieves the model number (or part number) of the device
Returns:
string: Model/part number of device
"""
model = "Unknown"
return model
@staticmethod
def get_serial():
"""
Retrieves the serial number of the device
Returns:
string: Serial number of device
"""
serial = "Unknown"
return serial
def get_position_in_parent(self):
"""
Retrieves the fan/psu fan index number
"""
return self.fantray_index if not self.is_psu_fan else self.fans_psu_index + 4
@staticmethod
def is_replaceable():
"""
Retrieves whether the device is replaceable
"""
return False

View File

@ -0,0 +1,33 @@
#############################################################################
# PDDF
#
# PDDF fan_drawer base class inherited from the common base class fan_drawer.py
#
#############################################################################
try:
from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class FanDrawer(PddfFanDrawer):
"""PDDF Platform-Specific Fan-Drawer class"""
def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None):
# idx is 0-based
PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data)
def set_status_led(self, color):
return self._fan_list[0].set_status_led(color)
def get_status_led(self, color=None):
return self._fan_list[0].get_status_led()
def get_serial(self):
serial = "Unknown"
return serial
def get_model(self):
model = "Unknown"
return model

View File

@ -0,0 +1,21 @@
#############################################################################
# PDDF
# Module contains an implementation of SONiC Platform Base API and
# provides the platform information
#
#############################################################################
try:
from sonic_platform_pddf_base.pddf_platform import PddfPlatform
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Platform(PddfPlatform):
"""
PDDF Platform-Specific Platform Class
"""
def __init__(self):
PddfPlatform.__init__(self)
# Provide the functions/variables below for which implementation is to be overwritten

View File

@ -0,0 +1,55 @@
try:
from sonic_platform_pddf_base.pddf_psu import PddfPsu
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
class Psu(PddfPsu):
"""PDDF Platform-Specific PSU class"""
PLATFORM_PSU_CAPACITY = 550
def __init__(self, index, pddf_data=None, pddf_plugin_data=None):
PddfPsu.__init__(self, index, pddf_data, pddf_plugin_data)
# Provide the functions/variables below for which implementation is to be overwritten
def get_capacity(self):
"""
Gets the capacity (maximum output power) of the PSU in watts
Returns:
An integer, the capacity of PSU
"""
return (self.PLATFORM_PSU_CAPACITY)
def get_type(self):
"""
Gets the type of the PSU
Returns:
A string, the type of PSU (AC/DC)
"""
ptype = "AC"
# This platform supports AC PSU
return ptype
def is_replaceable(self):
"""
Indicate whether this device is replaceable.
Returns:
bool: True if it is replaceable.
"""
return True
def get_position_in_parent(self):
"""
Retrieves the psu index number
"""
return self.psu_index
def get_revision(self):
return "N/A"
def temperature(self):
return self.get_temperature()

View File

@ -0,0 +1,15 @@
try:
from sonic_platform_pddf_base.pddf_sfp import PddfSfp
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
class Sfp(PddfSfp):
"""
PDDF Platform-Specific Sfp class
"""
def __init__(self, index, pddf_data=None, pddf_plugin_data=None):
PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data)
# Provide the functions/variables below for which implementation is to be overwritten

View File

@ -0,0 +1,111 @@
try:
from sonic_platform_pddf_base.pddf_thermal import PddfThermal
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Thermal(PddfThermal):
"""PDDF Platform-Specific Thermal class"""
def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0):
PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index)
self.minimum_thermal = self.get_temperature()
self.maximum_thermal = self.get_temperature()
# Provide the functions/variables below for which implementation is to be overwritten
def get_low_critical_threshold(self):
"""
Retrieves the low critical threshold temperature of thermal
Returns:
A float number, the low critical threshold temperature of thermal in Celsius
up to nearest thousandth of one degree Celsius, e.g. 30.125
"""
return 0.001
def get_high_critical_threshold(self):
"""
Retrieves the high critical threshold temperature of thermal
Returns:
A float number, the high critical threshold temperature of thermal in Celsius
up to nearest thousandth of one degree Celsius, e.g. 30.125
"""
return 100.000
def get_minimum_recorded(self):
"""
Retrieves the minimum recorded temperature of thermal
Returns:
A float number, the minimum recorded temperature of thermal in Celsius
up to nearest thousandth of one degree Celsius, e.g. 30.125
"""
tmp = self.get_temperature()
if tmp < self.minimum_thermal:
self.minimum_thermal = tmp
return self.minimum_thermal
def get_maximum_recorded(self):
"""
Retrieves the maximum recorded temperature of thermal
Returns:
A float number, the maximum recorded temperature of thermal in Celsius
up to nearest thousandth of one degree Celsius, e.g. 30.125
"""
tmp = self.get_temperature()
if tmp > self.maximum_thermal:
self.maximum_thermal = tmp
return self.maximum_thermal
def get_presence(self):
"""
Retrieves the presence of the PSU
Returns:
bool: True if Thermal is present, False if not
"""
return True
def get_model(self):
"""
Retrieves the model number (or part number) of the device
Returns:
string: Model/part number of device
"""
return "N/A"
def get_serial(self):
"""
Retrieves the serial number of the device
Returns:
string: Serial number of device
"""
return "N/A"
def get_status(self):
"""
Retrieves the operational status of the device
Returns:
A boolean value, True if device is operating properly, False if not
"""
if not self.get_presence():
return False
return True
def is_replaceable(self):
"""
Retrieves whether thermal module is replaceable
Returns:
A boolean value, True if replaceable, False if not
"""
return False
def get_position_in_parent(self):
"""
Retrieves the thermal position information
Returns:
A int value, 0 represent ASIC thermal, 1 represent CPU thermal info
"""
return 0

View File

@ -0,0 +1,229 @@
#!/usr/bin/env python
#############################################################################
#
# Watchdog contains an implementation of SONiC Platform Base Watchdog API
#
#############################################################################
import fcntl
import os
import array
try:
from sonic_platform_base.watchdog_base import WatchdogBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
""" ioctl constants """
IO_WRITE = 0x40000000
IO_READ = 0x80000000
IO_READ_WRITE = 0xC0000000
IO_SIZE_INT = 0x00040000
IO_SIZE_40 = 0x00280000
IO_TYPE_WATCHDOG = ord('W') << 8
WDR_INT = IO_READ | IO_SIZE_INT | IO_TYPE_WATCHDOG
WDR_40 = IO_READ | IO_SIZE_40 | IO_TYPE_WATCHDOG
WDWR_INT = IO_READ_WRITE | IO_SIZE_INT | IO_TYPE_WATCHDOG
""" Watchdog ioctl commands """
WDIOC_GETSUPPORT = 0 | WDR_40
WDIOC_GETSTATUS = 1 | WDR_INT
WDIOC_GETBOOTSTATUS = 2 | WDR_INT
WDIOC_GETTEMP = 3 | WDR_INT
WDIOC_SETOPTIONS = 4 | WDR_INT
WDIOC_KEEPALIVE = 5 | WDR_INT
WDIOC_SETTIMEOUT = 6 | WDWR_INT
WDIOC_GETTIMEOUT = 7 | WDR_INT
WDIOC_SETPRETIMEOUT = 8 | WDWR_INT
WDIOC_GETPRETIMEOUT = 9 | WDR_INT
WDIOC_GETTIMELEFT = 10 | WDR_INT
""" Watchdog status constants """
WDIOS_DISABLECARD = 0x0001
WDIOS_ENABLECARD = 0x0002
WDT_COMMON_ERROR = -1
WD_MAIN_IDENTITY = "cpld_wdt"
WDT_SYSFS_PATH = "/sys/class/watchdog/"
DEFAULT_TIMEOUT=180
watchdog = 0
class CpldWatchdog(WatchdogBase):
watchdog = None
def __init__(self):
global watchdog
self.status_path = "/sys/devices/platform/cpld_wdt/status"
self.state_path = "/sys/devices/platform/cpld_wdt/state"
self.timeout_path = "/sys/devices/platform/cpld_wdt/timeout"
# Set default value
with open("/sys/devices/platform/cpld_wdt/state", "r") as fd:
txt = fd.read()
state = txt.strip()
self.armed = True if state == "active" else False
self.timeout = DEFAULT_TIMEOUT
if not watchdog:
watchdog = os.open("/dev/cpld_wdt", os.O_RDWR)
self.watchdog = watchdog
#self._disable()
def _read_file(self, file_path):
"""
Read text file
"""
try:
with open(file_path, "r") as fd:
txt = fd.read()
except IOError:
return WDT_COMMON_ERROR
return txt.strip()
def _enable(self):
"""
Turn on the watchdog timer
"""
req = array.array('h', [WDIOS_ENABLECARD])
fcntl.ioctl(self.watchdog, WDIOC_SETOPTIONS, req, False)
def _disable(self):
"""
Turn off the watchdog timer
"""
req = array.array('h', [WDIOS_DISABLECARD])
fcntl.ioctl(self.watchdog, WDIOC_SETOPTIONS, req, False)
def _keepalive(self):
"""
Keep alive watchdog timer
"""
fcntl.ioctl(self.watchdog, WDIOC_KEEPALIVE)
def _settimeout(self, seconds):
"""
Set watchdog timer timeout
@param seconds - timeout in seconds
@return is the actual set timeout
"""
req = array.array('I', [seconds])
fcntl.ioctl(self.watchdog, WDIOC_SETTIMEOUT, req, True)
return int(req[0])
def _gettimeout(self, timeout_path):
"""
Get watchdog timeout
@return watchdog timeout
"""
req = array.array('I', [0])
fcntl.ioctl(self.watchdog, WDIOC_GETTIMEOUT, req, True)
return int(req[0])
def _gettimeleft(self):
"""
Get time left before watchdog timer expires
@return time left in seconds
"""
req = array.array('I', [0])
fcntl.ioctl(self.watchdog, WDIOC_GETTIMELEFT, req, True)
return int(req[0])
#################################################################
def arm(self, seconds):
"""
Arm the hardware watchdog with a timeout of <seconds> seconds.
If the watchdog is currently armed, calling this function will
simply reset the timer to the provided value. If the underlying
hardware does not support the value provided in <seconds>, this
method should arm the watchdog with the *next greater* available
value.
Returns:
An integer specifying the *actual* number of seconds the watchdog
was armed with. On failure returns -1.
"""
ret = WDT_COMMON_ERROR
if seconds < 0:
return ret
try:
if self.timeout != seconds:
self.timeout = self._settimeout(seconds)
if self.armed:
self._keepalive()
else:
self._enable()
self.armed = True
ret = self.timeout
except IOError as e:
pass
return ret
def disarm(self):
"""
Disarm the hardware watchdog
Returns:
A boolean, True if watchdog is disarmed successfully, False if not
"""
disarmed = False
if self.is_armed():
try:
self._disable()
self.armed = False
disarmed = True
except IOError:
pass
return disarmed
def is_armed(self):
"""
Retrieves the armed state of the hardware watchdog.
Returns:
A boolean, True if watchdog is armed, False if not
"""
return self.armed
def get_remaining_time(self):
"""
If the watchdog is armed, retrieve the number of seconds remaining on
the watchdog timer
Returns:
An integer specifying the number of seconds remaining on thei
watchdog timer. If the watchdog is not armed, returns -1.
"""
timeleft = WDT_COMMON_ERROR
if self.armed:
try:
timeleft = self._gettimeleft()
except IOError:
pass
return timeleft
def __del__(self):
"""
Close watchdog
"""
if self.watchdog is not None :
os.close(self.watchdog)
class Watchdog(CpldWatchdog):
"""PDDF Platform-Specific Watchdog Class"""
def __init__(self):
CpldWatchdog.__init__(self)
# Provide the functions/variables below for which implementation is to be overwritten

View File

@ -0,0 +1,27 @@
import os
from setuptools import setup
os.listdir
setup(
name='sonic-platform',
version='1.0',
description='SONiC platform API implementation on Celestica Platforms based on PDDF',
license='Apache 2.0',
author='SONiC Team',
author_email='linuxnetdev@microsoft.com',
url='https://github.com/Azure/sonic-buildimage',
packages=['sonic_platform'],
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Plugins',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3.7',
'Topic :: Utilities',
],
keywords='sonic SONiC platform PLATFORM',
)

View File

@ -0,0 +1,10 @@
#!/bin/bash
# Set U60 shutdown threhold 80
sudo i2cset -y -f 6 0x49 0x3 0x4e 0x00 i
sleep 0.1
sudo i2cset -y -f 6 0x49 0x1 0x2
sleep 0.1
#Set LM75 shutdown enable
sudo i2cset -y -f 2 0x32 0x45 0x1
echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state

View File

@ -0,0 +1,5 @@
#!/bin/bash
modprobe -r i2c_ismt
sleep 0.1
modprobe -r i2c-i801
sleep 0.1

View File

@ -0,0 +1,16 @@
[Unit]
Description=Belgite Platform Monitoring service
Before=pmon.service
After=pddf-platform-init.service
DefaultDependencies=no
[Service]
ExecStart=/usr/local/bin/belgite_pddf_monitor.py
KillSignal=SIGKILL
SuccessExitStatus=SIGKILL
# Resource Limitations
LimitCORE=infinity
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,15 @@
[Unit]
Description=PDDF module and device initialization service
Before=pmon.service watchdog-control.service
Before=opennsl-modules.service
DefaultDependencies=no
[Service]
Type=oneshot
ExecStart=/usr/local/bin/pddf_util.py install
ExecStop=/usr/local/bin/pddf_util.py clean
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
WantedBy=opennsl-modules.service

View File

@ -0,0 +1,272 @@
#!/usr/bin/env python3
#
# Copyright (C) Celestica Technology Corporation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ------------------------------------------------------------------
# HISTORY:
# 9/16/2021 (A.D.)
# ------------------------------------------------------------------
try:
import sys
import getopt
import subprocess
import logging
import logging.config
import time # this is only being used as part of the example
import signal
import math
from sonic_platform import platform
except ImportError as e:
raise ImportError('%s - required module not found' % str(e))
# Deafults
FUNCTION_NAME = 'cel_belgite_monitor'
DUTY_MAX = 100
FAN_NUMBER = 3
SENSOR_NUMBER = 4
CPU_CORE_TEMP = r"/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input"
class cel_belgite_monitor(object):
"""
Make a class we can use to capture stdout and sterr in the log
"""
# static temp var
_ori_temp = 0
_new_perc = DUTY_MAX / 2
syslog = logging.getLogger("[" + FUNCTION_NAME + "]")
init_fan_temperature = [0, 0, 0, 0]
def __init__(self, log_file, log_level):
"""Needs a logger and a logger level."""
formatter = logging.Formatter('%(name)s %(message)s')
sys_handler = logging.handlers.SysLogHandler(address='/dev/log')
sys_handler.setFormatter(formatter)
sys_handler.ident = 'common'
self.syslog.setLevel(logging.WARNING)
self.syslog.addHandler(sys_handler)
self.platform_chassis_obj = platform.Platform().get_chassis()
# set up logging to file
logging.basicConfig(
filename=log_file,
filemode='w',
level=log_level,
format='[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s',
datefmt='%H:%M:%S'
)
# set up logging to console
if log_level == logging.DEBUG:
console = logging.StreamHandler()
console.setLevel(log_level)
formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
console.setFormatter(formatter)
logging.getLogger('').addHandler(console)
logging.debug('SET. logfile:%s / loglevel:%d' % (log_file, log_level))
def get_all_temperature(self):
"""
return: all temperature
"""
all_temperature_list = list()
for sensor_index in range(SENSOR_NUMBER):
temp = self.platform_chassis_obj.get_thermal(sensor_index).get_temperature()
if temp is None or str(temp).strip() == "":
return False
temp = temp*1000
all_temperature_list.append(temp)
u4_temperature = all_temperature_list[0]
u7_temperature = all_temperature_list[1]
# default CPU temperature 70
cpu_temperature = 70000
try:
with open(CPU_CORE_TEMP, "r") as f:
cpu_temperature = float(f.read().strip())
except Exception as E:
logging.debug('Error: %s' % E)
u60_temperature = all_temperature_list[3]
return [u4_temperature, u7_temperature, cpu_temperature, u60_temperature]
def get_fan_speed_by_temperature(self, temp_list):
fan1_direction = self.platform_chassis_obj.get_fan(0).get_direction()
logging.debug('INFO: fan direction: %s' % str(fan1_direction))
all_temp = self.get_all_temperature()
logging.debug('INFO: all_temp: %s' % str(all_temp))
# B2F=intake: U7 temperature F2B-EXHAUST: U4 temperature
a = 1 if fan1_direction.lower() == "intake" else 0
sensor_temp = all_temp[a]
cup_temp = all_temp[2]
u60_temp = all_temp[3]
logging.debug('sensor_temp:%d cup_temp:%d u60_temp:%d' % (sensor_temp, cup_temp, u60_temp))
update_temp_sensor, update_temp_cpu, update_temp_u60 = True, True, True
if all_temp[a] - temp_list[a] < 0:
update_temp_sensor = False
if cup_temp - temp_list[2] < 0:
update_temp_cpu = False
if u60_temp - temp_list[3] < 0:
update_temp_u60 = False
# U4 U7
if not update_temp_sensor: # temperature down
b = math.trunc(1400/13)
if sensor_temp <= 32000:
sensor_temp_speed = 40
elif sensor_temp >= 45000:
sensor_temp_speed = 100
else:
sensor_temp_speed = int(math.trunc(60 / 13) * math.trunc(sensor_temp / 1000) - b)
else: # temperature up
b = math.trunc(1580 / 13)
if sensor_temp <= 35000:
sensor_temp_speed = 40
elif sensor_temp >= 48000:
sensor_temp_speed = 100
else:
sensor_temp_speed = int(math.trunc(60/13) * math.trunc(sensor_temp/1000) - b)
# CPU
if not update_temp_cpu: # temperature down
b = 228
if cup_temp <= 67000:
cpu_temp_speed = 40
elif cup_temp >= 82000:
cpu_temp_speed = 100
else:
cpu_temp_speed = int(4 * (cup_temp / 1000) - b)
else: # temperature up
b = 240
if cup_temp <= 70000:
cpu_temp_speed = 40
elif cup_temp >= 85000:
cpu_temp_speed = 100
else:
cpu_temp_speed = int(4 * (cup_temp / 1000) - b)
# U60
if not update_temp_u60: # temperature down
b = 168
if u60_temp <= 52000:
u60_temp_speed = 40
elif u60_temp >= 67000:
u60_temp_speed = 100
else:
u60_temp_speed = int(4 * (u60_temp / 1000) - b)
else: # temperature up
b = 180
if u60_temp <= 55000:
u60_temp_speed = 40
elif u60_temp >= 70000:
u60_temp_speed = 100
else:
u60_temp_speed = int(4 * (u60_temp / 1000) - b)
return max([sensor_temp_speed, cpu_temp_speed, u60_temp_speed])
def manage_fans(self):
fan_presence_list = [True, True, True] # whether fan is absent or not
for fan_index in range(FAN_NUMBER):
if not self.platform_chassis_obj.get_fan(fan_index).get_presence() or not \
self.platform_chassis_obj.get_fan(fan_index).get_status():
fan_presence_list[fan_index] = False
logging.debug('self.platform_chassis_obj.get_fan(fan_index).get_presence():%s'
% str(self.platform_chassis_obj.get_fan(fan_index).get_presence()))
logging.debug('self.platform_chassis_obj.get_fan(fan_index).get_status():%s'
% str(self.platform_chassis_obj.get_fan(fan_index).get_status()))
else:
fan_presence_list[fan_index] = True
fans_inserted_num = FAN_NUMBER - fan_presence_list.count(False)
if fans_inserted_num == 0: # all fans broken, power off
self.syslog.critical("No fans inserted. Severe overheating hazard. "
"Please insert Fans immediately or power off the device\n")
# power off
elif fans_inserted_num in [1, 2]: # 1 or 2 present, full speed
self._new_perc = DUTY_MAX
else: # 3 fans normal, manage the fans follow thermal policy
self._new_perc = self.get_fan_speed_by_temperature(self.init_fan_temperature)
logging.debug('INFO: 3 fans inserted: self._new_perc: %s' % str(self._new_perc))
self.init_fan_temperature = self.get_all_temperature()
for i in range(FAN_NUMBER):
aa = self.platform_chassis_obj.get_fan(i).get_speed()
logging.debug("INFO: Get before setting fan speed: %s" % aa)
if self._new_perc < 40:
self._new_perc = 40
if self._new_perc > 100:
self._new_perc = 100
set_stat = self.platform_chassis_obj.get_fan(i).set_speed(self._new_perc)
if set_stat is True:
logging.debug('INFO: PASS. set_fan%d_duty_cycle (%d)' % (i, self._new_perc))
else:
logging.debug('INFO: FAIL. set_fan%d_duty_cycle (%d)' % (i, self._new_perc))
def handler(signum, frame):
platform_chassis = platform.Platform().get_chassis()
for _ in range(FAN_NUMBER):
set_stat = platform_chassis.get_fan(_).set_speed(DUTY_MAX)
if set_stat is True:
logging.debug('INFO:Cause signal %d, set fan speed max.' % signum)
else:
logging.debug('INFO: FAIL. set_fan_duty_cycle (%d)' % DUTY_MAX)
# Enable the CPLD Heartbeat back
status, output = subprocess.getstatusoutput('i2cset -f -y 75 0x40 0x22 0x00')
if status == 0:
logging.debug('INFO: CPLD Heartbeat check is enabled back')
sys.exit(0)
def main(argv):
global test_temp
log_file = '/home/admin/%s.log' % FUNCTION_NAME
log_level = logging.INFO
if len(sys.argv) != 1:
try:
opts, args = getopt.getopt(argv, 'hdlt:', ['lfile='])
except getopt.GetoptError:
print('Usage: %s [-d] [-l <log_file>]' % sys.argv[0])
return 0
for opt, arg in opts:
if opt == '-h':
print('Usage: %s [-d] [-l <log_file>]' % sys.argv[0])
return 0
elif opt in ('-d', '--debug'):
log_level = logging.DEBUG
elif opt in ('-l', '--lfile'):
log_file = arg
if sys.argv[1] == '-t':
if len(sys.argv) != 6:
print("temp test, need input 4 temp")
return 0
signal.signal(signal.SIGINT, handler)
signal.signal(signal.SIGTERM, handler)
# Disaable the CPLD Heartbeat check to control Fan speed from CPU via ADT7470
subprocess.getstatusoutput('i2cset -f -y 2 0x32 0x30 0x01')
monitor = cel_belgite_monitor(log_file, log_level)
# Loop forever, doing something useful hopefully:
while True:
monitor.manage_fans()
time.sleep(10)
if __name__ == '__main__':
main(sys.argv[1:])

View File

@ -25,3 +25,8 @@ Package: platform-modules-silverstone
Architecture: amd64 Architecture: amd64
Depends: linux-image-5.10.0-12-2-amd64-unsigned Depends: linux-image-5.10.0-12-2-amd64-unsigned
Description: kernel modules for platform devices such as led, sfp. Description: kernel modules for platform devices such as led, sfp.
Package: platform-modules-belgite
Architecture: amd64
Depends: linux-image-5.10.0-8-2-amd64-unsigned
Description: kernel modules for platform devices such as led, sfp

View File

@ -0,0 +1,7 @@
belgite/systemd/pddf-platform-init.service etc/systemd/system
belgite/service/belgite-pddf-platform-monitor.service lib/systemd/system
belgite/scripts/pddf_pre_driver_install.sh usr/local/bin
belgite/scripts/pddf_post_device_create.sh usr/local/bin
belgite/utils/belgite_pddf_monitor.py usr/local/bin
belgite/pddf/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-cel_belgite-r0/pddf
services/platform_api/platform_api_mgnt.sh usr/local/bin

View File

@ -0,0 +1,6 @@
depmod -a
/usr/local/bin/platform_api_mgnt.sh install
systemctl enable pddf-platform-init.service
systemctl start pddf-platform-init.service
systemctl enable belgite-pddf-platform-monitor.service
systemctl start belgite-pddf-platform-monitor.service

View File

@ -1,11 +1,12 @@
#!/usr/bin/make -f #!/usr/bin/make -f
export INSTALL_MOD_DIR:=extra export INSTALL_MOD_DIR:=extra
export KBUILD_EXTRA_SYMBOLS := /sonic/platform/pddf/i2c/Module.symvers.PDDF
KVERSION ?= $(shell uname -r) KVERSION ?= $(shell uname -r)
KERNEL_SRC := /lib/modules/$(KVERSION) KERNEL_SRC := /lib/modules/$(KVERSION)
MOD_SRC_DIR:= $(shell pwd) MOD_SRC_DIR:= $(shell pwd)
MODULE_DIRS:= dx010 haliburton silverstone seastone2 MODULE_DIRS:= dx010 haliburton silverstone seastone2 belgite
%: %:
dh $@ dh $@
@ -18,6 +19,17 @@ override_dh_auto_build:
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
continue; \ continue; \
fi; \ fi; \
if [ $$mod = "belgite" ]; then \
cd $(MOD_SRC_DIR); \
if [ -d $(MOD_SRC_DIR)/$${mod}/pddf ]; then \
cd $(MOD_SRC_DIR)/$${mod}/pddf; \
if [ -f sonic_platform_setup.py ]; then \
python3 sonic_platform_setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/pddf; \
echo "Finished makig pddf whl package for $$mod"; \
fi; \
fi; \
continue; \
fi; \
cd $(MOD_SRC_DIR)/$${mod}; \ cd $(MOD_SRC_DIR)/$${mod}; \
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
done) done)
@ -36,4 +48,7 @@ override_dh_clean:
dh_clean dh_clean
(for mod in $(MODULE_DIRS); do \ (for mod in $(MODULE_DIRS); do \
make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \ make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \
if [ -f $(MOD_SRC_DIR)/$${mod}/pddf/*.whl ]; then \
rm -f $(MOD_SRC_DIR)/$${mod}/pddf/*.whl; \
fi; \
done) done)

View File

@ -11,6 +11,11 @@ install() {
if [ -e $PY3_PACK ]; then if [ -e $PY3_PACK ]; then
pip3 install $PY3_PACK pip3 install $PY3_PACK
fi fi
if [ -e $DEVICE/$PLATFORM/pddf/sonic_platform-1.0-py3-none-any.whl ]; then
PY3_PACK=$DEVICE/$PLATFORM/pddf/sonic_platform-1.0-py3-none-any.whl
pip3 install $PY3_PACK
fi
} }
init() { init() {