Skip to content

Commit

Permalink
[Sync PR #14361] [Edgecore][AS4630-54PE/PDDF] Enhance sonic_platform …
Browse files Browse the repository at this point in the history
…feature

sonic-net/sonic-buildimage#14361

Why I did it
Base on Adding PDDF common framework enhancements. #12863 to modify pddf-device.json and platform API.
Add code to pass pytest.

How I did it
Add needed code to sonic_platform and driver.

How to verify it
sonic-cli cmd:
show platform {fan, temperature, firmware status, syseeprom, psustatus}
sfputil cmd:
show {presence, eeprom, lpmode}
Verify function by sonic-mgmt tools:
Test file path: /tests/platform_tests/api/
 Test items: test_chassis.py, test_component.py, test_fan_drawer.py, test_psu.py, test_thermal.py, test_sfp.py
  • Loading branch information
ChrisKe1643 committed Mar 25, 2024
1 parent e9e10b7 commit bf08432
Show file tree
Hide file tree
Showing 23 changed files with 2,474 additions and 139 deletions.
167 changes: 167 additions & 0 deletions device/accton/x86_64-accton_as4630_54pe-r0/pcie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
- bus: '00'
dev: '00'
fn: '0'
id: '1980'
name: 'Host bridge: Intel Corporation Atom Processor C3000 Series System Agent (rev
11)'
- bus: '00'
dev: '04'
fn: '0'
id: 19a1
name: 'Host bridge: Intel Corporation Atom Processor C3000 Series Error Registers
(rev 11)'
- bus: '00'
dev: '05'
fn: '0'
id: 19a2
name: 'Generic system peripheral [0807]: Intel Corporation Atom Processor C3000
Series Root Complex Event Collector (rev 11)'
- bus: '00'
dev: '06'
fn: '0'
id: 19a3
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated QAT
Root Port (rev 11)'
- bus: '00'
dev: 09
fn: '0'
id: 19a4
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root
Port #0 (rev 11)'
- bus: '00'
dev: 0b
fn: '0'
id: 19a6
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root
Port #2 (rev 11)'
- bus: '00'
dev: 0e
fn: '0'
id: 19a8
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root
Port #4 (rev 11)'
- bus: '00'
dev: '10'
fn: '0'
id: 19aa
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root
Port #6 (rev 11)'
- bus: '00'
dev: '12'
fn: '0'
id: 19ac
name: 'System peripheral: Intel Corporation Atom Processor C3000 Series SMBus Contoller
- Host (rev 11)'
- bus: '00'
dev: '13'
fn: '0'
id: 19b2
name: 'SATA controller: Intel Corporation Atom Processor C3000 Series SATA Controller
0 (rev 11)'
- bus: '00'
dev: '15'
fn: '0'
id: 19d0
name: 'USB controller: Intel Corporation Atom Processor C3000 Series USB 3.0 xHCI
Controller (rev 11)'
- bus: '00'
dev: '16'
fn: '0'
id: 19d1
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated LAN
Root Port #0 (rev 11)'
- bus: '00'
dev: '17'
fn: '0'
id: 19d2
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated LAN
Root Port #1 (rev 11)'
- bus: '00'
dev: '18'
fn: '0'
id: 19d3
name: 'Communication controller: Intel Corporation Atom Processor C3000 Series ME
HECI 1 (rev 11)'
- bus: '00'
dev: 1a
fn: '0'
id: 19d8
name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller
(rev 11)'
- bus: '00'
dev: 1a
fn: '1'
id: 19d8
name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller
(rev 11)'
- bus: '00'
dev: 1a
fn: '2'
id: 19d8
name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller
(rev 11)'
- bus: '00'
dev: 1c
fn: '0'
id: 19db
name: 'SD Host controller: Intel Corporation Device 19db (rev 11)'
- bus: '00'
dev: 1f
fn: '0'
id: 19dc
name: 'ISA bridge: Intel Corporation Atom Processor C3000 Series LPC or eSPI (rev
11)'
- bus: '00'
dev: 1f
fn: '1'
id: 19dd
name: 'Memory controller: Intel Corporation Atom Processor C3000 Series Primary
to Side Band (P2SB) Bridge (rev 11)'
- bus: '00'
dev: 1f
fn: '2'
id: 19de
name: 'Memory controller: Intel Corporation Atom Processor C3000 Series Power Management
Controller (rev 11)'
- bus: '00'
dev: 1f
fn: '4'
id: 19df
name: 'SMBus: Intel Corporation Atom Processor C3000 Series SMBus controller (rev
11)'
- bus: '00'
dev: 1f
fn: '5'
id: 19e0
name: 'Serial bus controller [0c80]: Intel Corporation Atom Processor C3000 Series
SPI Controller (rev 11)'
- bus: '01'
dev: '00'
fn: '0'
id: 19e2
name: 'Co-processor: Intel Corporation Atom Processor C3000 Series QuickAssist Technology
(rev 11)'
- bus: '05'
dev: '00'
fn: '0'
id: b371
name: 'Ethernet controller: Broadcom Inc. and subsidiaries BCM56371 Switch ASIC
(rev 03)'
- bus: '06'
dev: '00'
fn: '0'
id: 15c2
name: 'Ethernet controller: Intel Corporation Ethernet Connection X553 Backplane
(rev 11)'
- bus: '06'
dev: '00'
fn: '1'
id: 15c2
name: 'Ethernet controller: Intel Corporation Ethernet Connection X553 Backplane
(rev 11)'
- bus: 08
dev: '00'
fn: '0'
id: 15e5
name: 'Ethernet controller: Intel Corporation Ethernet Connection X553 1GbE (rev
11)'
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
{
"i2c":
{
"valmap": { "F2B":"EXHAUST", "B2F":"INTAKE" }
"valmap": { "F2B":"exhaust", "B2F":"intake" }
}
},

"PSU_FAN_MAX_SPEED":"18000"
"PSU_FAN_MAX_SPEED":"26688"
},

"FAN":
Expand All @@ -46,7 +46,7 @@
{
"i2c":
{
"valmap": {"1":"EXHAUST", "0":"INTAKE"}
"valmap": {"1":"exhaust", "0":"intake"}
}
},

Expand Down
73 changes: 50 additions & 23 deletions device/accton/x86_64-accton_as4630_54pe-r0/pddf/pddf-device.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"num_fantrays":3,
"num_fans_pertray":1,
"num_ports":54,
"num_temps": 3,
"num_temps": 4,
"pddf_dev_types":
{
"description":"AS4630 - 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",
Expand Down Expand Up @@ -211,6 +211,21 @@
}
},

"TEMP4" :
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP4"},
"dev_attr": { "display_name":"coretemp-isa-0000"},
"i2c":
{
"path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon1"},
"attr_list":
[
{ "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp1_crit"},
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"},
{ "attr_name": "temp1_input"}
]
}
},

"CPLD1":
{
Expand Down Expand Up @@ -251,15 +266,15 @@
"SYS_LED":
{
"dev_info": { "device_type":"LED", "device_name":"SYS_LED"},
"dev_attr": { "index":"0"},
"dev_attr": { "index":"0", "flag": "rw"},
"i2c" : {
"attr_list":
[
{"attr_name":"STATUS_LED_COLOR_GREEN", "bits" : "7:5", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"},
{"attr_name":"STATUS_LED_COLOR_GREEN_BLINK", "bits" : "7:5", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"},
{"attr_name":"STATUS_LED_COLOR_AMBER", "bits" : "7:5", "descr" : "", "value" : "0x4", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"},
{"attr_name":"STATUS_LED_COLOR_AMBER_BLINK", "bits" : "7:5", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"},
{"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "7:5", "descr" : "", "value" : "0x7", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}
{"attr_name":"green", "bits" : "7:5", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"},
{"attr_name":"green_blink", "bits" : "7:5", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"},
{"attr_name":"amber", "bits" : "7:5", "descr" : "", "value" : "0x4", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"},
{"attr_name":"amber_blink", "bits" : "7:5", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"},
{"attr_name":"off", "bits" : "7:5", "descr" : "", "value" : "0x7", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}
]
}
},
Expand All @@ -268,41 +283,41 @@
"PSU1_LED":
{
"dev_info": { "device_type":"LED", "device_name":"PSU_LED"},
"dev_attr": { "index":"0"},
"dev_attr": { "index":"0", "flag": "r"},
"i2c" : {
"attr_list":
[
{"attr_name":"STATUS_LED_COLOR_GREEN", "bits" : "1:0", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"},
{"attr_name":"STATUS_LED_COLOR_AMBER", "bits" : "1:0", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"},
{"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "1:0", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}
{"attr_name":"green", "bits" : "1:0", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"},
{"attr_name":"amber", "bits" : "1:0", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"},
{"attr_name":"off", "bits" : "1:0", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}
]
}
},

"PSU2_LED":
{
"dev_info": { "device_type":"LED", "device_name":"PSU_LED"},
"dev_attr": { "index":"1"},
"dev_attr": { "index":"1", "flag": "r"},
"i2c" : {
"attr_list":
[
{"attr_name":"STATUS_LED_COLOR_GREEN", "bits" : "7:6", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"},
{"attr_name":"STATUS_LED_COLOR_AMBER", "bits" : "7:6", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"},
{"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "7:6", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"}
{"attr_name":"green", "bits" : "7:6", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"},
{"attr_name":"amber", "bits" : "7:6", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"},
{"attr_name":"off", "bits" : "7:6", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"}
]
}
},

"FAN_LED":
{
"dev_info": { "device_type":"LED", "device_name":"FAN_LED"},
"dev_attr": { "index":"0"},
"dev_attr": { "index":"0", "flag": "r"},
"i2c" : {
"attr_list":
[
{"attr_name":"STATUS_LED_COLOR_GREEN", "bits" : "3:2", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"},
{"attr_name":"STATUS_LED_COLOR_AMBER", "bits" : "3:2", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"},
{"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "3:2", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"}
{"attr_name":"green", "bits" : "3:2", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"},
{"attr_name":"amber", "bits" : "3:2", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"},
{"attr_name":"off", "bits" : "3:2", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"}
]
}
},
Expand Down Expand Up @@ -336,7 +351,11 @@
{ "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_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"}
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_v_out_max", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa5", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_v_out_min", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa4", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_p_out_max", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa7", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_temp1_high_threshold", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa8", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}
]
}
},
Expand Down Expand Up @@ -387,7 +406,11 @@
{ "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_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"}
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_v_out_max", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xa5", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_v_out_min", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xa4", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_p_out_max", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xa7", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_temp1_high_threshold", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xa8", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}
]
}
},
Expand Down Expand Up @@ -592,7 +615,9 @@
"topo_info": { "parent_bus":"0x16", "dev_addr":"0x53", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x21", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}
{ "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x21", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x21", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x21", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}
]
}
},
Expand Down Expand Up @@ -630,7 +655,9 @@
"topo_info": { "parent_bus":"0x17", "dev_addr":"0x53", "dev_type":"pddf_xcvr"},
"attr_list":
[
{ "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x21", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}
{ "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x21", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x21", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"},
{ "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x21", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}
]
}
}
Expand Down

0 comments on commit bf08432

Please sign in to comment.