[Alphanetworks] Add new platform BES2348T (#11196)

* Add BES2348T

Signed-off-by: juntseng62 <juntseng62@gmail.com>

* add get_serial_number

Signed-off-by: juntseng62 <juntseng62@gmail.com>

Signed-off-by: juntseng62 <juntseng62@gmail.com>
This commit is contained in:
juntseng62 2022-09-16 12:34:52 +08:00 committed by GitHub
parent 0a7dd50dcb
commit 23de13feeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 1817 additions and 20 deletions

View File

@ -0,0 +1,173 @@
#port_init_autoneg=0
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
#
# XE/CE port mapping
pbmp_xport_xe=0x1e00000000000000
# MCQ0, MCQ1: QSGMII mode
port_gmii_mode_25=1
port_gmii_mode_41=1
# MQ16-0 (logical ports: P25 to P40)
# MQ16-0_0
portmap_25=25:1
portmap_26=26:1
portmap_27=27:1
portmap_28=28:1
# MQ16-0_1
portmap_29=29:1
portmap_30=30:1
portmap_31=31:1
portmap_32=32:1
# MQ16-0_2
portmap_33=33:1
portmap_34=34:1
portmap_35=35:1
portmap_36=36:1
# MQ16-0_3
portmap_37=37:1
portmap_38=38:1
portmap_39=39:1
portmap_40=40:1
# MQ16-1 (logical ports: P41 to P56)
# MQ16-1_0
portmap_41=41:1
portmap_42=42:1
portmap_43=43:1
portmap_44=44:1
# MQ16-1_2
portmap_45=49:1
portmap_46=50:1
portmap_47=51:1
portmap_48=52:1
# GPHY[5:0] (logical ports: P1 to P24)
portmap_1=1:1
portmap_2=2:1
portmap_3=3:1
portmap_4=4:1
portmap_5=5:1
portmap_6=6:1
portmap_7=7:1
portmap_8=8:1
portmap_9=9:1
portmap_10=10:1
portmap_11=11:1
portmap_12=12:1
portmap_13=13:1
portmap_14=14:1
portmap_15=15:1
portmap_16=16:1
portmap_17=17:1
portmap_18=18:1
portmap_19=19:1
portmap_20=20:1
portmap_21=21:1
portmap_22=22:1
portmap_23=23:1
portmap_24=24:1
# F16-0 (logical ports: P57 to P60)
portmap_57=57:25
portmap_58=58:25
portmap_59=59:25
portmap_60=60:25
# Specifies the base port and phy index of a multi slice phy chip
phy_port_primary_and_offset_1=0x0100
phy_port_primary_and_offset_2=0x0101
phy_port_primary_and_offset_3=0x0102
phy_port_primary_and_offset_4=0x0103
phy_port_primary_and_offset_5=0x0104
phy_port_primary_and_offset_6=0x0105
phy_port_primary_and_offset_7=0x0106
phy_port_primary_and_offset_8=0x0107
phy_port_primary_and_offset_9=0x0900
phy_port_primary_and_offset_10=0x0901
phy_port_primary_and_offset_11=0x0902
phy_port_primary_and_offset_12=0x0903
phy_port_primary_and_offset_13=0x0904
phy_port_primary_and_offset_14=0x0905
phy_port_primary_and_offset_15=0x0906
phy_port_primary_and_offset_16=0x0907
phy_port_primary_and_offset_17=0x1100
phy_port_primary_and_offset_18=0x1101
phy_port_primary_and_offset_19=0x1102
phy_port_primary_and_offset_20=0x1103
phy_port_primary_and_offset_21=0x1104
phy_port_primary_and_offset_22=0x1105
phy_port_primary_and_offset_23=0x1106
phy_port_primary_and_offset_24=0x1107
# Enable DPORT Mapping, to sync the mapping in ds ps with front panel port
dport_map_enable=1
dport_map_port_1=26
dport_map_port_2=25
dport_map_port_3=28
dport_map_port_4=27
dport_map_port_5=30
dport_map_port_6=29
dport_map_port_7=32
dport_map_port_8=31
dport_map_port_9=34
dport_map_port_10=33
dport_map_port_11=36
dport_map_port_12=35
dport_map_port_13=38
dport_map_port_14=37
dport_map_port_15=40
dport_map_port_16=39
dport_map_port_17=42
dport_map_port_18=41
dport_map_port_19=44
dport_map_port_20=43
dport_map_port_21=46
dport_map_port_22=45
dport_map_port_23=48
dport_map_port_24=47
dport_map_port_25=2
dport_map_port_26=1
dport_map_port_27=4
dport_map_port_28=3
dport_map_port_29=6
dport_map_port_30=5
dport_map_port_31=8
dport_map_port_32=7
dport_map_port_33=10
dport_map_port_34=9
dport_map_port_35=12
dport_map_port_36=11
dport_map_port_37=14
dport_map_port_38=13
dport_map_port_39=16
dport_map_port_40=15
dport_map_port_41=18
dport_map_port_42=17
dport_map_port_43=20
dport_map_port_44=19
dport_map_port_45=22
dport_map_port_46=21
dport_map_port_47=24
dport_map_port_48=23
dport_map_port_49=57
dport_map_port_50=58
dport_map_port_51=59
dport_map_port_52=60

View File

@ -0,0 +1,53 @@
# name lanes alias index speed autoneg
Ethernet0 26 thousandE1 1 1000 on
Ethernet1 25 thousandE2 2 1000 on
Ethernet2 28 thousandE3 3 1000 on
Ethernet3 27 thousandE4 4 1000 on
Ethernet4 30 thousandE5 5 1000 on
Ethernet5 29 thousandE6 6 1000 on
Ethernet6 32 thousandE7 7 1000 on
Ethernet7 31 thousandE8 8 1000 on
Ethernet8 34 thousandE9 9 1000 on
Ethernet9 33 thousandE10 10 1000 on
Ethernet10 36 thousandE11 11 1000 on
Ethernet11 35 thousandE12 12 1000 on
Ethernet12 38 thousandE13 13 1000 on
Ethernet13 37 thousandE14 14 1000 on
Ethernet14 40 thousandE15 15 1000 on
Ethernet15 39 thousandE16 16 1000 on
Ethernet16 42 thousandE17 17 1000 on
Ethernet17 41 thousandE18 18 1000 on
Ethernet18 44 thousandE19 19 1000 on
Ethernet19 43 thousandE20 20 1000 on
Ethernet20 50 thousandE21 21 1000 on
Ethernet21 49 thousandE22 22 1000 on
Ethernet22 52 thousandE23 23 1000 on
Ethernet23 51 thousandE24 24 1000 on
Ethernet24 2 thousandE25 25 1000 on
Ethernet25 1 thousandE26 26 1000 on
Ethernet26 4 thousandE27 27 1000 on
Ethernet27 3 thousandE28 28 1000 on
Ethernet28 6 thousandE29 29 1000 on
Ethernet29 5 thousandE30 30 1000 on
Ethernet30 8 thousandE31 31 1000 on
Ethernet31 7 thousandE32 32 1000 on
Ethernet32 10 thousandE33 33 1000 on
Ethernet33 9 thousandE34 34 1000 on
Ethernet34 12 thousandE35 35 1000 on
Ethernet35 11 thousandE36 36 1000 on
Ethernet36 14 thousandE37 37 1000 on
Ethernet37 13 thousandE38 38 1000 on
Ethernet38 16 thousandE39 39 1000 on
Ethernet39 15 thousandE40 40 1000 on
Ethernet40 18 thousandE41 41 1000 on
Ethernet41 17 thousandE42 42 1000 on
Ethernet42 20 thousandE43 43 1000 on
Ethernet43 19 thousandE44 44 1000 on
Ethernet44 22 thousandE45 45 1000 on
Ethernet45 21 thousandE46 46 1000 on
Ethernet46 24 thousandE47 47 1000 on
Ethernet47 23 thousandE48 48 1000 on
Ethernet48 57 twentyfiveGigE49 49 25000 off
Ethernet49 58 twentyfiveGigE50 50 25000 off
Ethernet50 59 twentyfiveGigE51 51 25000 off
Ethernet51 60 twentyfiveGigE52 52 25000 off

View File

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

View File

@ -0,0 +1 @@
Alphanetworks-BES2348T t1

View File

@ -0,0 +1,4 @@
CONSOLE_PORT=0x2f8
CONSOLE_DEV=1
CONSOLE_SPEED=115200
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off modprobe.blacklist=i2c-ismt,i2c_ismt,i2c-i801,i2c_i801"

View File

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

View File

@ -0,0 +1,11 @@
{
"GLOBAL_MEDIA_SETTINGS": {
"49-52": {
"Default": {
"preemphasis": {
"lane0": "0x0a3205"
}
}
}
}
}

View File

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

View File

@ -0,0 +1,564 @@
{
"PLATFORM":
{
"num_psus":2,
"num_fantrays":4,
"num_fans_pertray":1,
"num_ports":52,
"num_temps":5,
"pddf_dev_types":
{
"description":"BES2348T - 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",
"PSU":
[
"psu_eeprom",
"psu_pmbus"
],
"FAN":
[
"fan_ctrl"
],
"PORT_MODULE":
[
"pddf_xcvr"
]
},
"std_perm_kos":
[
"i2c-ismt",
"i2c-i801"
],
"std_kos":
[
"i2c_dev",
"ipmi_devintf",
"i2c_mux_pca954x",
"gpio_pca953x",
"bes2348t_onie_eeprom",
"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"
],
"custom_kos":
[
"pddf_custom_psu"
]
},
"SYSTEM":
{
"dev_info": {"device_type":"CPU", "device_name":"ROOT_COMPLEX", "device_parent":null},
"i2c":
{
"CONTROLLERS":
[
{ "dev_name":"i2c-1", "dev":"SMBUS0" }
]
}
},
"SMBUS0":
{
"dev_info": {"device_type": "SMBUS", "device_name": "SMBUS0", "device_parent": "SYSTEM"},
"i2c":
{
"topo_info": {"dev_addr": "0x1"},
"DEVICES":
[
{"dev": "EEPROM1"},
{"dev": "MUX1"},
{"dev": "GPIO1" },
{"dev": "TEMP5" }
]
}
},
"EEPROM1":
{
"dev_info": {"device_type": "EEPROM", "device_name": "EEPROM1", "device_parent": "SMBUS0"},
"i2c":
{
"topo_info": {"parent_bus": "0x1", "dev_addr": "0x56", "dev_type": "bes2348t_eeprom"},
"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":"0x1", "dev_addr":"0x70", "dev_type":"pca9548"},
"dev_attr": { "virt_bus":"0x2"},
"channel":
[
{ "chn":"4", "dev":"PSU2" },
{ "chn":"5", "dev":"PSU1" },
{ "chn":"6", "dev":"GPIO2" },
{ "chn":"6", "dev":"MUX2" }
]
}
},
"GPIO1":
{
"dev_info": { "device_type":"GPIO", "device_name":"GPIO1", "device_parent":"SMBUS0"},
"i2c":
{
"topo_info": { "parent_bus":"0x1", "dev_addr":"0x75", "dev_type":"pca9539"},
"dev_attr": { "gpio_base":"0x1f0"},
"ports":
[
{"port_num":"0", "direction":"out", "value":"0", "edge":"", "active_low":""},
{"port_num":"1", "direction":"out", "value":"0", "edge":"", "active_low":""},
{"port_num":"2", "direction":"out", "value":"0", "edge":"", "active_low":""},
{"port_num":"3", "direction":"out", "value":"0", "edge":"", "active_low":""}
]
}
},
"PSU1":
{
"dev_info": { "device_type":"PSU", "device_name":"PSU1", "device_parent":"MUX1"},
"dev_attr": { "dev_idx":"1", "num_psu_fans": "1"},
"bmc": {
"ipmitool" : {
"attr_list":
[
{ "attr_name":"psu_present", "bmc_cmd":"ipmitool raw 0x06 0x52 0x09 0xbe 0x1 0x3", "raw": "1", "type":"mask", "mask":"0x04"},
{ "attr_name":"psu_power_good", "bmc_cmd":"ipmitool raw 0x06 0x52 0x09 0xbe 0x1 0x3", "raw": "1", "type":"mask", "mask":"0x02"}
]
}
},
"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":"0x6", "dev_addr":"0x58", "dev_type":"psu_pmbus"},
"attr_list":
[
{ "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_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_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"},
"bmc": {
"ipmitool" : {
"attr_list":
[
{ "attr_name":"psu_present", "bmc_cmd":"ipmitool raw 0x06 0x52 0x09 0xbe 0x1 0x4", "raw": "1", "type":"mask", "mask":"0x04"},
{ "attr_name":"psu_power_good", "bmc_cmd":"ipmitool raw 0x06 0x52 0x09 0xbe 0x1 0x4", "raw": "1", "type":"mask", "mask":"0x02"}
]
}
},
"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":"0x7", "dev_addr":"0x58", "dev_type":"psu_pmbus"},
"attr_list":
[
{ "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_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_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"}
]
}
},
"GPIO2":
{
"dev_info": { "device_type":"GPIO", "device_name":"GPIO2", "device_parent":"MUX2"},
"i2c":
{
"topo_info": { "parent_bus":"0x8", "dev_addr":"0x76", "dev_type":"pca9539"},
"dev_attr": { "gpio_base":"0x1e0"},
"ports":
[
{"port_num":"0", "direction":"out", "value":"1", "edge":"", "active_low":""},
{"port_num":"1", "direction":"in", "value":"", "edge":"", "active_low":""},
{"port_num":"2", "direction":"in", "value":"", "edge":"", "active_low":""},
{"port_num":"3", "direction":"in", "value":"", "edge":"", "active_low":""},
{"port_num":"4", "direction":"out", "value":"1", "edge":"", "active_low":""},
{"port_num":"5", "direction":"in", "value":"", "edge":"", "active_low":""},
{"port_num":"6", "direction":"in", "value":"", "edge":"", "active_low":""},
{"port_num":"7", "direction":"in", "value":"", "edge":"", "active_low":""},
{"port_num":"8", "direction":"out", "value":"1", "edge":"", "active_low":""},
{"port_num":"9", "direction":"in", "value":"", "edge":"", "active_low":""},
{"port_num":"10", "direction":"in", "value":"", "edge":"", "active_low":""},
{"port_num":"11", "direction":"in", "value":"", "edge":"", "active_low":""},
{"port_num":"12", "direction":"out", "value":"1", "edge":"", "active_low":""},
{"port_num":"13", "direction":"in", "value":"", "edge":"", "active_low":""},
{"port_num":"14", "direction":"in", "value":"", "edge":"", "active_low":""},
{"port_num":"15", "direction":"in", "value":"", "edge":"", "active_low":""}
]
}
},
"TEMP5":
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP5", "device_parent":"SMBUS0"},
"dev_attr": { "display_name":"TMP75#2_Temp"},
"i2c":
{
"topo_info": { "parent_bus":"0x1", "dev_addr":"0x4f", "dev_type":"lm75"},
"attr_list":
[
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"},
{ "attr_name": "temp1_max_hyst"},
{ "attr_name": "temp1_input"}
]
}
},
"MUX2":
{
"dev_info": { "device_type":"MUX", "device_name":"MUX2", "device_parent":"MUX1"},
"i2c":
{
"topo_info": { "parent_bus":"0x8", "dev_addr":"0x72", "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" }
]
}
},
"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":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0x1", "attr_mask":"", "attr_cmpval":"", "attr_len":""},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0x0", "attr_mask":"", "attr_cmpval":"", "attr_len":""},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0x2", "attr_mask":"", "attr_cmpval":"", "attr_len":""},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0x3", "attr_mask":"", "attr_cmpval":"", "attr_len":""}
]
}
},
"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":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0x5", "attr_mask":"", "attr_cmpval":"", "attr_len":""},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0x4", "attr_mask":"", "attr_cmpval":"", "attr_len":""},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0x6", "attr_mask":"", "attr_cmpval":"", "attr_len":""},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0x7", "attr_mask":"", "attr_cmpval":"", "attr_len":""}
]
}
},
"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":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0x9", "attr_mask":"", "attr_cmpval":"", "attr_len":""},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0x8", "attr_mask":"", "attr_cmpval":"", "attr_len":""},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0xa", "attr_mask":"", "attr_cmpval":"", "attr_len":""},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0xb", "attr_mask":"", "attr_cmpval":"", "attr_len":""}
]
}
},
"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":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0xd", "attr_mask":"", "attr_cmpval":"", "attr_len":""},
{ "attr_name":"xcvr_txdisable", "attr_devaddr":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0xc", "attr_mask":"", "attr_cmpval":"", "attr_len":""},
{ "attr_name":"xcvr_present", "attr_devaddr":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0xe", "attr_mask":"", "attr_cmpval":"", "attr_len":""},
{ "attr_name":"xcvr_rxlos", "attr_devaddr":"0x76", "attr_devtype":"gpio", "attr_devname":"GPIO2", "attr_offset":"0xf", "attr_mask":"", "attr_cmpval":"", "attr_len":""}
]
}
},
"FAN-CTRL":
{
"dev_info": { "device_type":"FAN"},
"bmc": {
"ipmitool" : {
"attr_list":
[
{ "attr_name":"fan1_present", "bmc_cmd":"ipmitool raw 0x06 0x52 0x09 0xbe 0x1 0x11", "raw": "1", "type":"mask", "mask":"0x02"},
{ "attr_name":"fan2_present", "bmc_cmd":"ipmitool raw 0x06 0x52 0x09 0xbe 0x1 0x12", "raw": "1", "type":"mask", "mask":"0x02"},
{ "attr_name":"fan3_present", "bmc_cmd":"ipmitool raw 0x06 0x52 0x09 0xbe 0x1 0x13", "raw": "1", "type":"mask", "mask":"0x02"},
{ "attr_name":"fan4_present", "bmc_cmd":"ipmitool raw 0x06 0x52 0x09 0xbe 0x1 0x14", "raw": "1", "type":"mask", "mask":"0x02"},
{ "attr_name":"fan1_direction", "bmc_cmd":"ipmitool raw 0x06 0x52 0x09 0xbe 0x1 0x11", "raw": "1", "type":"mask", "mask":"0x01"},
{ "attr_name":"fan2_direction", "bmc_cmd":"ipmitool raw 0x06 0x52 0x09 0xbe 0x1 0x12", "raw": "1", "type":"mask", "mask":"0x01"},
{ "attr_name":"fan3_direction", "bmc_cmd":"ipmitool raw 0x06 0x52 0x09 0xbe 0x1 0x13", "raw": "1", "type":"mask", "mask":"0x01"},
{ "attr_name":"fan4_direction", "bmc_cmd":"ipmitool raw 0x06 0x52 0x09 0xbe 0x1 0x14", "raw": "1", "type":"mask", "mask":"0x01"},
{ "attr_name":"fan1_input", "bmc_cmd":"ipmitool sensor reading Fan01", "raw":"0", "field_name" : "Fan01", "separator":"|", "field_pos":"2", "mult":"1"},
{ "attr_name":"fan2_input", "bmc_cmd":"ipmitool sensor reading Fan02", "raw":"0", "field_name" : "Fan02", "separator":"|", "field_pos":"2", "mult":"1"},
{ "attr_name":"fan3_input", "bmc_cmd":"ipmitool sensor reading Fan03", "raw":"0", "field_name" : "Fan03", "separator":"|", "field_pos":"2", "mult":"1"},
{ "attr_name":"fan4_input", "bmc_cmd":"ipmitool sensor reading Fan04", "raw":"0", "field_name" : "Fan04", "separator":"|", "field_pos":"2", "mult":"1"},
{ "attr_name":"fan1_pwm", "bmc_cmd":"ipmitool raw 0x34 0x03 0x1", "raw": "1", "type":"raw"},
{ "attr_name":"fan2_pwm", "bmc_cmd":"ipmitool raw 0x34 0x03 0x2", "raw": "1", "type":"raw"},
{ "attr_name":"fan3_pwm", "bmc_cmd":"ipmitool raw 0x34 0x03 0x3", "raw": "1", "type":"raw"},
{ "attr_name":"fan4_pwm", "bmc_cmd":"ipmitool raw 0x34 0x03 0x4", "raw": "1", "type":"raw"}
]
}
}
},
"TEMP1":
{
"dev_info": { "device_type":"TEMP_SENSOR"},
"dev_attr": { "display_name":"TMP75#0_Temp"},
"bmc": {
"ipmitool" : {
"attr_list":
[
{ "attr_name":"temp1_high_crit_threshold", "bmc_cmd":"ipmitool raw 0x06 0x52 0x0B 0x90 0x1 0x3", "raw":"1", "type":"raw"},
{ "attr_name":"temp1_high_threshold", "bmc_cmd":"ipmitool raw 0x06 0x52 0x0B 0x90 0x1 0x2", "raw":"1", "type":"raw"},
{ "attr_name":"temp1_input", "bmc_cmd":"ipmitool raw 0x06 0x52 0x0B 0x90 0x1 0x0", "raw":"1", "type":"raw"}
]
}
}
},
"TEMP2":
{
"dev_info": { "device_type":"TEMP_SENSOR"},
"dev_attr": { "display_name":"TMP75#1_Temp"},
"bmc": {
"ipmitool" : {
"attr_list":
[
{ "attr_name":"temp1_high_crit_threshold", "bmc_cmd":"ipmitool raw 0x06 0x52 0x0B 0x92 0x1 0x3", "raw":"1", "type":"raw"},
{ "attr_name":"temp1_high_threshold", "bmc_cmd":"ipmitool raw 0x06 0x52 0x0B 0x92 0x1 0x2", "raw":"1", "type":"raw"},
{ "attr_name":"temp1_input", "bmc_cmd":"ipmitool raw 0x06 0x52 0x0B 0x92 0x1 0x0", "raw":"1", "type":"raw"}
]
}
}
},
"TEMP3":
{
"dev_info": { "device_type":"TEMP_SENSOR"},
"dev_attr": { "display_name":"TMP435#L_Temp"},
"bmc": {
"ipmitool" : {
"attr_list":
[
{ "attr_name":"temp1_high_crit_threshold", "bmc_cmd":"ipmitool sensor get TMP435#L_Temp", "raw":"0", "field_name":"Upper Critical", "separator":": ", "field_pos":"2"},
{ "attr_name":"temp1_high_threshold", "bmc_cmd":"ipmitool sensor get TMP435#L_Temp", "raw":"0", "field_name":"Upper Non-Critical", "separator":": ", "field_pos":"2"},
{ "attr_name":"temp1_input", "bmc_cmd":"ipmitool sensor reading TMP435#L_Temp", "raw":"0", "field_name" : "TMP435#L_Temp", "separator":"| ", "field_pos":"2"}
]
}
}
},
"TEMP4":
{
"dev_info": { "device_type":"TEMP_SENSOR"},
"dev_attr": { "display_name":"TMP435#R_Temp"},
"bmc": {
"ipmitool" : {
"attr_list":
[
{ "attr_name":"temp1_high_crit_threshold", "bmc_cmd":"ipmitool sensor get TMP435#R_Temp", "raw":"0", "field_name":"Upper Critical", "separator":": ", "field_pos":"2"},
{ "attr_name":"temp1_high_threshold", "bmc_cmd":"ipmitool sensor get TMP435#L_Temp", "raw":"0", "field_name":"Upper Non-Critical", "separator":": ", "field_pos":"2"},
{ "attr_name":"temp1_input", "bmc_cmd":"ipmitool sensor reading TMP435#R_Temp", "raw":"0", "field_name" : "TMP435#R_Temp", "separator":"| ", "field_pos":"2"}
]
}
}
},
"SYS_LED" : { "dev_info": { "device_type":"LED", "device_name":"SYS_LED"},
"dev_attr": { "index":"0"},
"i2c": {
"attr_list":
[
{"attr_name":"STATUS_LED_COLOR_GREEN", "attr_devtype":"gpio", "attr_devname":"GPIO1", "bits" : "1:0", "descr" :"Green", "value" : "0x2", "swpld_addr" : "", "swpld_addr_offset" :"0x0"},
{"attr_name":"STATUS_LED_COLOR_AMBER", "attr_devtype":"gpio", "attr_devname":"GPIO1", "bits" : "1:0", "descr" :"Amber", "value" : "0x1", "swpld_addr" : "", "swpld_addr_offset" :"0x0"},
{"attr_name":"STATUS_LED_COLOR_OFF", "attr_devtype":"gpio", "attr_devname":"GPIO1", "bits" : "1:0", "descr" :"Off", "value" : "0x0", "swpld_addr" : "", "swpld_addr_offset" :"0x0"}
]
}
},
"FAN_LED" : { "dev_info": { "device_type":"LED", "device_name":"FAN_LED"},
"dev_attr": { "index":"0"},
"i2c": {
"attr_list":
[
{"attr_name":"STATUS_LED_COLOR_GREEN", "attr_devtype":"gpio", "attr_devname":"GPIO1", "bits" : "1:0", "descr" :"Green", "value" : "0x2", "swpld_addr" : "", "swpld_addr_offset" :"0x2"},
{"attr_name":"STATUS_LED_COLOR_AMBER", "attr_devtype":"gpio", "attr_devname":"GPIO1", "bits" : "1:0", "descr" :"Amber", "value" : "0x1", "swpld_addr" : "", "swpld_addr_offset" :"0x2"},
{"attr_name":"STATUS_LED_COLOR_OFF", "attr_devtype":"gpio", "attr_devname":"GPIO1", "bits" : "1:0", "descr" :"Off", "value" : "0x0", "swpld_addr" : "", "swpld_addr_offset" :"0x2"}
]
}
}
}

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/bus/i2c/devices/1-0056/eeprom"
#Two i2c buses might get flipped order, check them both.
if not os.path.exists(self.eeprom_path):
self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -0,0 +1,21 @@
- bus: '00'
dev: '13'
fn: '0'
id: 19b2
name: 'SATA controller: Intel Corporation DNV SATA Controller 0 (rev 11)'
- bus: '00'
dev: '14'
fn: '0'
id: 19c2
name: 'SATA controller: Intel Corporation DNV SATA Controller 1 (rev 11)'
- bus: '04'
dev: '00'
fn: '0'
id: '1533'
name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev
03)'
- bus: '05'
dev: '00'
fn: '0'
id: b274
name: 'Ethernet controller: Broadcom Limited Device b274 (rev 02)'

View File

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

View File

@ -0,0 +1,9 @@
# libsensors configuration file
# --------------------------------------------------
#
bus "i2c-1" "SMBus I801 adapter at 3000"
chip "lm75-i2c-1-4f"
set temp1_max 80
set temp1_max_hyst 75

View File

@ -0,0 +1,17 @@
{
"services_to_ignore": [],
"devices_to_ignore": [
"asic",
"psu.temperature",
"psu.voltage",
"PSU1_FAN1.speed",
"PSU2_FAN1.speed"
],
"user_defined_checkers": [],
"polling_interval": 60,
"led_color": {
"fault": "STATUS_LED_COLOR_AMBER",
"normal": "STATUS_LED_COLOR_GREEN",
"booting": "STATUS_LED_COLOR_AMBER"
}
}

View File

@ -69,6 +69,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \
$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE) \
$(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE) \
$(ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE) \
$(ALPHANETWORKS_BES2348T_PLATFORM_MODULE) \
$(BRCM_XLR_GTS_PLATFORM_MODULE) \
$(DELTA_AG9032V2A_PLATFORM_MODULE) \
$(JUNIPER_QFX5210_PLATFORM_MODULE) \

View File

@ -3,10 +3,12 @@
ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE_VERSION = 1.0
ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE_VERSION = 1.0
ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE_VERSION = 1.0
ALPHANETWORKS_BES2348T_PLATFORM_MODULE_VERSION = 1.0
export ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE_VERSION
export ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE_VERSION
export ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE_VERSION
export ALPHANETWORKS_BES2348T_PLATFORM_MODULE_VERSION
ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE = sonic-platform-alphanetworks-snh60a0-320fv2_$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE_VERSION)_amd64.deb
$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-alphanetworks
@ -22,4 +24,7 @@ ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE = sonic-platform-alphanetworks-snj60d
$(ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE)_PLATFORM = x86_64-alphanetworks_snj60d0_320f-r0
$(eval $(call add_extra_package,$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE),$(ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE)))
ALPHANETWORKS_BES2348T_PLATFORM_MODULE = sonic-platform-alphanetworks-bes2348t_$(ALPHANETWORKS_BES2348T_PLATFORM_MODULE_VERSION)_amd64.deb
$(ALPHANETWORKS_BES2348T_PLATFORM_MODULE)_PLATFORM = x86_64-alphanetworks_bes2348t-r0
$(eval $(call add_extra_package,$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE),$(ALPHANETWORKS_BES2348T_PLATFORM_MODULE)))

View File

@ -5,7 +5,7 @@ include $(PLATFORM_PATH)/platform-modules-dell.mk
include $(PLATFORM_PATH)/platform-modules-arista.mk
#include $(PLATFORM_PATH)/platform-modules-ingrasys.mk
include $(PLATFORM_PATH)/platform-modules-accton.mk
#include $(PLATFORM_PATH)/platform-modules-alphanetworks.mk
include $(PLATFORM_PATH)/platform-modules-alphanetworks.mk
#include $(PLATFORM_PATH)/platform-modules-inventec.mk
include $(PLATFORM_PATH)/platform-modules-cel.mk
#include $(PLATFORM_PATH)/platform-modules-delta.mk

View File

@ -0,0 +1,3 @@
obj-m:=bes2348t_onie_eeprom.o pddf_custom_psu.o
CFLAGS_pddf_custom_psu.o := -I$(M)/../../../../pddf/i2c/modules/include
KBUILD_EXTRA_SYMBOLS := $(M)/../../../../pddf/i2c/Module.symvers.PDDF

View File

@ -0,0 +1,208 @@
/*
* A driver for alphanetworks_bes2348t ONIE EEPROM
*
* Copyright (C) 2020 Alphanetworks Technology Corporation.
* Robin Chen <Robin_chen@Alphanetworks.com>
* 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
* 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.
* see <http://www.gnu.org/licenses/>
*
* Based on ad7414.c
* Copyright 2006 Stefan Roese <sr at denx.de>, DENX Software Engineering
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#define EEPROM_SIZE 256
static ssize_t onie_read(struct device *dev, struct device_attribute *attr, char *buf);
static ssize_t onie_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
/* Each client has this additional data
*/
struct bes2348t_onie_eeprom_data
{
struct mutex update_lock;
unsigned char onie_eeprom[EEPROM_SIZE];
};
/* Addresses scanned for bes2348t_onie_eeprom */
static const unsigned short normal_i2c[] = { 0x56, I2C_CLIENT_END };
enum bes2348t_onie_eeprom_sysfs_attributes {
ONIE_RW,
};
static SENSOR_DEVICE_ATTR(eeprom, (0660), onie_read, onie_write, ONIE_RW);
static struct attribute *bes2348t_onie_attributes[] = {
&sensor_dev_attr_eeprom.dev_attr.attr,
NULL
};
static const struct attribute_group bes2348t_onie_group = {
.attrs = bes2348t_onie_attributes,
};
static ssize_t onie_read(struct device *dev, struct device_attribute *attr, char *buf)
{
int val = 0, res = 0;
u8 command;
__u8 read_write;
unsigned short offset = 0;
union i2c_smbus_data temp;
struct i2c_client *client = to_i2c_client(dev);
struct bes2348t_onie_eeprom_data *data = i2c_get_clientdata(client);
mutex_lock(&data->update_lock);
read_write = I2C_SMBUS_WRITE;
offset = offset & 0x3fff;
temp.byte = (u8)offset;
res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0,
read_write, 0, 2, &temp);
res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0,
read_write, 0, 2, &temp);
for( offset=0 ; offset < EEPROM_SIZE ; ++offset )
{
read_write = I2C_SMBUS_READ;
res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0,
read_write, 0, 1, &temp);
if (!res)
{
data->onie_eeprom[offset] = temp.byte;
}
}
memcpy(buf, data->onie_eeprom, EEPROM_SIZE);
mutex_unlock(&data->update_lock);
return EEPROM_SIZE;
}
static ssize_t onie_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
struct i2c_client *client = to_i2c_client(dev);
int error, write, command, read;
error = kstrtoint(buf, 10, &write);
if (error)
return error;
if (write < 0 || write > 255)
return -EINVAL;
/* Not support yet */
return count;
}
static int onie_eeprom_probe(struct i2c_client *client,
const struct i2c_device_id *dev_id)
{
struct bes2348t_onie_eeprom_data *data;
int status;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr);
status = -EIO;
goto exit;
}
data = kzalloc(sizeof(struct bes2348t_onie_eeprom_data), GFP_KERNEL);
if (!data) {
status = -ENOMEM;
goto exit;
}
i2c_set_clientdata(client, data);
mutex_init(&data->update_lock);
dev_info(&client->dev, "chip found\n");
/* Register sysfs hooks */
status = sysfs_create_group(&client->dev.kobj, &bes2348t_onie_group);
if (status) {
goto exit_free;
}
return 0;
exit_free:
kfree(data);
exit:
return status;
}
static int onie_eeprom_remove(struct i2c_client *client)
{
struct bes2348t_onie_eeprom_data *data = i2c_get_clientdata(client);
sysfs_remove_group(&client->dev.kobj, &bes2348t_onie_group);
kfree(data);
return 0;
}
static const struct i2c_device_id onie_eeprom_id[] = {
{ "bes2348t_eeprom", 0 },
{}
};
MODULE_DEVICE_TABLE(i2c, onie_eeprom_id);
static struct i2c_driver onie_eeprom_driver = {
.driver = {
.name = "bes2348t_eeprom",
},
.probe = onie_eeprom_probe,
.remove = onie_eeprom_remove,
.id_table = onie_eeprom_id,
.address_list = normal_i2c,
};
static int __init onie_eeprom_init(void)
{
return i2c_add_driver(&onie_eeprom_driver);
}
static void __exit onie_eeprom_exit(void)
{
i2c_del_driver(&onie_eeprom_driver);
}
module_init(onie_eeprom_init);
module_exit(onie_eeprom_exit);
MODULE_AUTHOR("Alpha-SID6");
MODULE_DESCRIPTION("ONIE EEPROM 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_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,3 @@
# All the derived classes for PDDF
__all__ = ["platform", "chassis", "sfp", "psu", "thermal"]
from . import platform

View File

@ -0,0 +1,133 @@
#############################################################################
# PDDF
# Module contains an implementation of SONiC Chassis API
#
#############################################################################
try:
import sys
import time
from sonic_platform_pddf_base.pddf_chassis import PddfChassis
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Chassis(PddfChassis):
"""
PDDF Platform-specific Chassis class
"""
SYSLED_DEV_NAME = "SYS_LED"
def __init__(self, pddf_data=None, pddf_plugin_data=None):
PddfChassis.__init__(self, pddf_data, pddf_plugin_data)
self.sfp_state = []
# Provide the functions/variables below for which implementation is to be overwritten
def get_sfp(self, index):
"""
Retrieves sfp represented by (0-based) index <index>
Args:
index: An integer, the index (0-based) of the sfp to retrieve.
The index should be the sequence of a physical port in a chassis,
starting from 0.
For example, 0 for Ethernet0, 1 for Ethernet4 and so on.
Returns:
An object derived from SfpBase representing the specified sfp
"""
sfp = None
try:
# The 'index' starts from 1 for this platform
sfp = self._sfp_list[index-1]
except IndexError:
sys.stderr.write("SFP index {} out of range (1-{})\n".format(
index, len(self._sfp_list)))
return sfp
def get_serial_number(self):
return self.get_serial()
def initizalize_system_led(self):
return True
def get_status_led(self):
return self.pddf_obj.get_system_led_color(self.SYSLED_DEV_NAME)
def set_status_led(self, color):
return self.pddf_obj.set_system_led_color(self.SYSLED_DEV_NAME, color)
def get_change_event(self, timeout=0):
"""
Returns a nested dictionary containing all devices which have
experienced a change at chassis level
Args:
timeout: Timeout in milliseconds (optional). If timeout == 0,
this method will block until a change is detected.
Returns:
(bool, dict):
- True if call successful, False if not;
- A nested dictionary where key is a device type,
value is a dictionary with key:value pairs in the format of
{'device_id':'device_event'},
where device_id is the device ID for this device and
device_event,
status='1' represents device inserted,
status='0' represents device removed.
Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}}
indicates that fan 0 has been removed, fan 2
has been inserted and sfp 11 has been removed.
Specifically for SFP event, besides SFP plug in and plug out,
there are some other error event could be raised from SFP, when
these error happened, SFP eeprom will not be avalaible, XCVRD shall
stop to read eeprom before SFP recovered from error status.
status='2' I2C bus stuck,
status='3' Bad eeprom,
status='4' Unsupported cable,
status='5' High Temperature,
status='6' Bad cable.
"""
change_event_dict = {"sfp": {}}
sfp_status, sfp_change_dict = self.get_transceiver_change_event(timeout)
change_event_dict["sfp"] = sfp_change_dict
if sfp_status is True:
return True, change_event_dict
return False, {}
def get_transceiver_change_event(self, timeout=0):
start_time = time.time()
# SFP status definition from xcvrd
SFP_STATUS_INSERTED = '1'
SFP_STATUS_REMOVED = '0'
timeout = (timeout/1000)
end_time = start_time + timeout
while (timeout >= 0):
new_sfp_state = []
change_dict = {}
for index in range(self.get_num_sfps()):
# get current status
state = self._sfp_list[index].get_presence()
new_sfp_state.append(state)
port_index = self._sfp_list[index].port_index
if self.sfp_state == []:
change_dict[port_index] = SFP_STATUS_INSERTED if state == True else SFP_STATUS_REMOVED
elif state != self.sfp_state[index]:
change_dict[port_index] = SFP_STATUS_INSERTED if state == True else SFP_STATUS_REMOVED
self.sfp_state = new_sfp_state
current_time = time.time()
if bool(change_dict):
return True, change_dict
elif timeout == 0 or current_time < end_time:
time.sleep(1)
continue
else:
return True, {}
return False, {}

View File

@ -0,0 +1,14 @@
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
def __init__(self, pddf_data=None, pddf_plugin_data=None):
PddfEeprom.__init__(self, pddf_data, pddf_plugin_data)
# 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_fan import PddfFan
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
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)
# Provide the functions/variables below for which implementation is to be overwritten
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:
direction = self.FAN_DIRECTION_EXHAUST
else:
idx = (self.fantray_index-1)*self.platform['num_fans_pertray'] + self.fan_index
attr = "fan" + str(idx) + "_direction"
output = self.pddf_obj.get_attr_name_output("FAN-CTRL", attr)
if not output:
return False
mode = output['mode']
val = output['status']
val = val.rstrip()
vmap = self.plugin_data['FAN']['direction'][mode]['valmap']
if val in vmap:
direction = vmap[val]
else:
direction = val
return direction
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 20 percent. If it changes based on platforms, overwrite
# this value in derived pddf fan class
return 20

View File

@ -0,0 +1,17 @@
#!/usr/bin/env python
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)
# Provide the functions/variables below for which implementation is to be overwritten

View File

@ -0,0 +1,23 @@
#############################################################################
# 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,35 @@
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"
# Currently the platform supports only AC type of PSUs
return ptype

View File

@ -0,0 +1,22 @@
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
@property
def port_type(self):
type = self.PORT_TYPE_NONE
if self.port_index in range(49, 53):
type = self.PORT_TYPE_SFP
return type

View File

@ -0,0 +1,26 @@
try:
import os
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)
# Provide the functions/variables below for which implementation is to be overwritten
def get_cpu_temperature(self):
dev_path = "/sys/devices/platform/coretemp.0/hwmon/"
hwmon_node = os.listdir(dev_path)[0]
node = dev_path + hwmon_node + '/temp1_input'
try:
with open(node, 'r') as fp:
temp = float(fp.read()) / 1000
except IOError:
return None
return temp

View File

@ -0,0 +1,14 @@
try:
from sonic_platform_pddf_base.pddf_watchdog import PddfWatchdog
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Watchdog(PddfWatchdog):
"""PDDF Platform-Specific Watchdog Class"""
def __init__(self):
PddfWatchdog.__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 Alpha 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,16 @@
[Unit]
Description=Alphanetworks BES2348T Platform Thermal Shutdown service
Before=pmon.service
After=pddf-platform-init.service
DefaultDependencies=no
[Service]
ExecStart=/usr/local/bin/alphanetworks_bes2348t_thermal_shutdown.py
KillSignal=SIGKILL
SuccessExitStatus=SIGKILL
# Resource Limitations
LimitCORE=infinity
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
../../../../pddf/i2c/service/pddf-platform-init.service

View File

@ -0,0 +1,93 @@
#!/usr/bin/env python3
try:
import subprocess
import re
import time
from sonic_platform import platform
from sonic_py_common import logger
except ImportError as e:
raise ImportError('%s - required module not found' % str(e))
sonic_logger = logger.Logger('thermal_shutdown')
# Thermal Shutdown
# CPU Board
# Core>=80
# TMP75_2(0x4F)>=80
# Main board
# TMP75_0(0x48)>=80
# TMP75_1(0x49)>=80
# ASIC maximum peak temperature>=108
def power_off_device():
command = "sync"
subprocess.getstatusoutput(command)
time.sleep(3)
command = "ipmitool chassis power off"
subprocess.getstatusoutput(command)
def get_asic_temperature():
command = "bcmcmd \"show temp\" | grep \"maximum peak temperature\""
status, output = subprocess.getstatusoutput(command)
if status:
sonic_logger.log_warning("Failed to get asic temperature.")
return 0
temperature = [float(s) for s in re.findall(r'-?\d+\.?\d*', output)]
return temperature[0]
class thermal_shutdown_monitor(object):
# Critical temperatures
CRIT_CPU_TEMPERATURE = 80
CRIT_ASIC_TEMPERATURE = 108
CRIT_THERMAL_TEMPERATURE = 80
CRIT_THERMAL_NAME = "TMP75"
def monitor(self):
global platform_chassis
# Check asic temperature
asic_temperature = get_asic_temperature()
if asic_temperature >= self.CRIT_ASIC_TEMPERATURE:
sonic_logger.log_warning("ASIC temperature {} is over critical ASIC temperature {}, shutdown device.".format(
asic_temperature, self.CRIT_ASIC_TEMPERATURE))
power_off_device()
return True
# Check cpu temperature
cpu_temperature = platform_chassis.get_thermal(0).get_cpu_temperature()
if cpu_temperature >= self.CRIT_CPU_TEMPERATURE:
sonic_logger.log_warning("CPU temperature {} is over critial CPU temperature {}, shutdown device.".format(
cpu_temperature, self.CRIT_CPU_TEMPERATURE))
power_off_device()
return True
# Check thermal temperature
for thermal in platform_chassis.get_all_thermals():
if self.CRIT_THERMAL_NAME in thermal.get_name():
thermal_temperature = thermal.get_temperature()
if thermal_temperature >= self.CRIT_THERMAL_TEMPERATURE:
sonic_logger.log_warning("Thermal {} temperature {} is over critial thermal temperature {}, shutdown device.".format(
thermal.get_name(), thermal_temperature, self.CRIT_THERMAL_TEMPERATURE))
power_off_device()
return True
return True
def main():
global platform_chassis
platform_chassis = platform.Platform().get_chassis()
# thermal shutdown monitor
monitor = thermal_shutdown_monitor()
POLL_INTERVAL=30
# start monitor
while True:
monitor.monitor()
time.sleep(POLL_INTERVAL)
if __name__ == '__main__':
main()

View File

@ -0,0 +1,24 @@
#!/bin/bash
# bes2348t post device creation script
echo "Disable SFP28 PORT49 TX disable"
echo 0 > /sys/class/gpio/gpio480/value
echo "Disable SFP28 PORT50 TX disable"
echo 0 > /sys/class/gpio/gpio484/value
echo "Disable SFP28 PORT51 TX disable"
echo 0 > /sys/class/gpio/gpio488/value
echo "Disable SFP28 PORT52 TX disable"
echo 0 > /sys/class/gpio/gpio492/value
set_pca_mux_idle_disconnect()
{
echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state >& /dev/null
if [ $? -ne 0 ]; then
echo Fail to set pca954x mux idle disconnect
exit 2
fi
}
set_pca_mux_idle_disconnect

View File

@ -1,6 +1,6 @@
sonic-alphanetworks-platform-modules (1.0) unstable; urgency=low
* Add support for SNH60A0-320FV2, SNH60B0_640F, and SNJ60D0_320F.
* Add support for SNH60A0-320FV2, SNH60B0_640F, SNJ60D0_320F, and SCG60D0-484T.
-- Alphanetworks <Jun_Tseng@alphanetworks.com> Tue, 14 Sep 2021 14:50:08 +0800
-- Alphanetworks <Jun_Tseng@alphanetworks.com> Thu, 26 May 2022 14:50:08 +0800

View File

@ -7,16 +7,20 @@ Standards-Version: 3.9.3
Package: sonic-platform-alphanetworks-snh60a0-320fv2
Architecture: amd64
Depends: linux-image-4.19.0-12-2-amd64-unsigned
Depends: linux-image-5.10.0-12-2-amd64-unsigned
Description: kernel modules for platform devices such as fan, led, sfp
Package: sonic-platform-alphanetworks-snh60b0-640f
Architecture: amd64
Depends: linux-image-4.19.0-12-2-amd64-unsigned
Depends: linux-image-5.10.0-12-2-amd64-unsigned
Description: kernel modules for platform devices such as fan, led, sfp
Package: sonic-platform-alphanetworks-snj60d0-320f
Architecture: amd64
Depends: linux-image-4.19.0-12-2-amd64-unsigned
Depends: linux-image-5.10.0-12-2-amd64-unsigned
Description: kernel modules for platform devices such as fan, led, sfp
Package: sonic-platform-alphanetworks-bes2348t
Architecture: amd64
Depends: linux-image-5.10.0-12-2-amd64-unsigned
Description: kernel modules for platform devices such as fan, led, sfp

View File

@ -13,13 +13,13 @@ include /usr/share/dpkg/pkg-info.mk
export INSTALL_MOD_DIR:=extra
PYTHON ?= python2
PYTHON3 ?= python3
PACKAGE_PRE_NAME := sonic-platform-alphanetworks
KVERSION ?= $(shell uname -r)
KERNEL_SRC := /lib/modules/$(KVERSION)
MOD_SRC_DIR:= $(shell pwd)
MODULE_DIRS:= snh60a0-320fv2 snh60b0-640f snj60d0-320f
MODULE_DIRS:= snh60a0-320fv2 snh60b0-640f snj60d0-320f bes2348t
MODULE_DIR := modules
UTILS_DIR := utils
SERVICE_DIR := service
@ -39,11 +39,15 @@ build:
(for mod in $(MODULE_DIRS); do \
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \
cd $(MOD_SRC_DIR)/$${mod}; \
$(PYTHON) setup.py build; \
$(PYTHON) setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/utils; \
if [ $$mod = "snj60d0-320f" ]; then \
python3 setup.py build; \
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/utils; \
if [ -f setup.py ]; then \
$(PYTHON3) setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}; \
fi; \
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; \
cd $(MOD_SRC_DIR); \
done)
@ -68,17 +72,13 @@ binary-indep:
(for mod in $(MODULE_DIRS); do \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/local/bin; \
platform_name=`echo $${mod} | sed "s/-/_/g"`; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/share/sonic/device/x86_64-alphanetworks_$${platform_name}-r0; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \
cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.py debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.whl debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/share/sonic/device/x86_64-alphanetworks_$${platform_name}-r0; \
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \
cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \
cd $(MOD_SRC_DIR)/$${mod}; \
$(PYTHON) setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
if [ $$mod = "snj60d0-320f" ]; then \
python3 setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
if [ -f setup.py ]; then \
$(PYTHON3) setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
fi; \
cd $(MOD_SRC_DIR); \
done)

View File

@ -0,0 +1 @@
bes2348t/pddf/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-alphanetworks_bes2348t-r0/pddf

View File

@ -0,0 +1 @@
snj60d0-320f/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-alphanetworks_snj60d0_320f-r0