From e360fc302786fd3aa1f93f86990d7b86d9509205 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Tue, 14 Sep 2021 10:16:46 -0700 Subject: [PATCH] Update SAI module for Celestica for Bullseye and 5.10 kernel Signed-off-by: Saikrishna Arcot --- platform/broadcom/rules.mk | 2 +- .../sonic-platform-modules-cel/debian/control | 8 ++--- .../debian/platform-modules-dx010.install | 1 - .../platform-modules-haliburton.install | 3 +- .../debian/platform-modules-seastone2.install | 4 +-- .../platform-modules-silverstone.install | 2 +- .../sonic-platform-modules-cel/debian/rules | 2 -- .../dx010/modules/leds-dx010.c | 1 + .../dx010/modules/mc24lc64t.c | 2 +- .../haliburton/modules/mc24lc64t.c | 2 +- .../haliburton/modules/smc.c | 1 + .../seastone2/modules/switchboard_fpga.c | 30 +++++++++---------- .../platform_api/platform_api_mgnt.sh | 7 ----- .../silverstone/modules/switchboard.c | 30 +++++++++---------- 14 files changed, 43 insertions(+), 52 deletions(-) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 7af31c77cc..78b7358815 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -7,7 +7,7 @@ include $(PLATFORM_PATH)/platform-modules-nokia.mk #include $(PLATFORM_PATH)/platform-modules-accton.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-cel.mk #include $(PLATFORM_PATH)/platform-modules-delta.mk #include $(PLATFORM_PATH)/platform-modules-quanta.mk ##include $(PLATFORM_PATH)/platform-modules-mitac.mk diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/control b/platform/broadcom/sonic-platform-modules-cel/debian/control index a41f92ab54..48ae0ed837 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/control +++ b/platform/broadcom/sonic-platform-modules-cel/debian/control @@ -7,21 +7,21 @@ Standards-Version: 3.9.3 Package: platform-modules-dx010 Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-haliburton Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-seastone2 Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as led, sfp Package: platform-modules-silverstone Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as led, sfp. diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install index 98c17e55a9..4698507c6b 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install @@ -4,6 +4,5 @@ dx010/systemd/platform-modules-dx010.service lib/systemd/system dx010/scripts/fancontrol.sh etc/init.d dx010/scripts/fancontrol.service lib/systemd/system services/fancontrol/fancontrol usr/local/bin -dx010/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-cel_seastone-r0 dx010/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-cel_seastone-r0 services/platform_api/platform_api_mgnt.sh usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install index 8788480d93..6c58afe6d5 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install @@ -3,10 +3,9 @@ haliburton/systemd/platform-modules-haliburton.service lib/systemd/system haliburton/script/fancontrol.sh etc/init.d haliburton/script/fancontrol.service lib/systemd/system services/fancontrol/fancontrol usr/local/bin -haliburton/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-cel_e1031-r0 haliburton/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-cel_e1031-r0 services/platform_api/platform_api_mgnt.sh usr/local/bin haliburton/script/popmsg.sh usr/local/bin haliburton/script/udev_prefix.sh usr/local/bin haliburton/script/reload_udev.sh usr/local/bin -haliburton/script/50-ttyUSB-C0.rules etc/udev/rules.d \ No newline at end of file +haliburton/script/50-ttyUSB-C0.rules etc/udev/rules.d diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-seastone2.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-seastone2.install index 41a381eeb0..31fc4fd3bd 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-seastone2.install +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-seastone2.install @@ -1,4 +1,4 @@ seastone2/cfg/seastone2-modules.conf etc/modules-load.d seastone2/systemd/platform-modules-seastone2.service lib/systemd/system -seastone2/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-cel_seastone_2-r0 -services/platform_api/platform_api_mgnt.sh usr/local/bin \ No newline at end of file +seastone2/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-cel_seastone_2-r0 +services/platform_api/platform_api_mgnt.sh usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-silverstone.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-silverstone.install index 67b433ced8..73fa4b90a4 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-silverstone.install +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-silverstone.install @@ -2,5 +2,5 @@ silverstone/scripts/sensors usr/bin silverstone/scripts/platform_sensors.py usr/local/bin silverstone/cfg/silverstone-modules.conf etc/modules-load.d silverstone/systemd/platform-modules-silverstone.service lib/systemd/system -silverstone/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-cel_silverstone-r0 +silverstone/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-cel_silverstone-r0 services/platform_api/platform_api_mgnt.sh usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/rules b/platform/broadcom/sonic-platform-modules-cel/debian/rules index efb5aa47b4..3a6ef1bfdb 100755 --- a/platform/broadcom/sonic-platform-modules-cel/debian/rules +++ b/platform/broadcom/sonic-platform-modules-cel/debian/rules @@ -15,12 +15,10 @@ override_dh_auto_build: make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ if [ $$mod = "seastone2" ]; then \ cd services/platform_api; \ - python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ continue; \ fi; \ cd $(MOD_SRC_DIR)/$${mod}; \ - python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ done) diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c index fac8322f06..c1693a37e3 100644 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include #include diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c index a391056d09..002172f587 100644 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c @@ -94,7 +94,7 @@ static int mc24lc64t_probe(struct i2c_client *client, sizeof(struct mc24lc64t_data), GFP_KERNEL))) return -ENOMEM; - drvdata->fake_client = i2c_new_dummy(client->adapter, client->addr + 1); + drvdata->fake_client = i2c_new_dummy_device(client->adapter, client->addr + 1); if (!drvdata->fake_client) return -ENOMEM; diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c index a391056d09..002172f587 100644 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c @@ -94,7 +94,7 @@ static int mc24lc64t_probe(struct i2c_client *client, sizeof(struct mc24lc64t_data), GFP_KERNEL))) return -ENOMEM; - drvdata->fake_client = i2c_new_dummy(client->adapter, client->addr + 1); + drvdata->fake_client = i2c_new_dummy_device(client->adapter, client->addr + 1); if (!drvdata->fake_client) return -ENOMEM; diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c index 7ec9753066..b38b8ea68f 100644 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/platform/broadcom/sonic-platform-modules-cel/seastone2/modules/switchboard_fpga.c b/platform/broadcom/sonic-platform-modules-cel/seastone2/modules/switchboard_fpga.c index 5918d27f39..a30265616e 100644 --- a/platform/broadcom/sonic-platform-modules-cel/seastone2/modules/switchboard_fpga.c +++ b/platform/broadcom/sonic-platform-modules-cel/seastone2/modules/switchboard_fpga.c @@ -1870,7 +1870,7 @@ static struct i2c_adapter * seastone2_i2c_init(struct platform_device *pdev, if (!new_data) { printk(KERN_ALERT "Cannot alloc i2c data for %s", fpga_i2c_bus_dev[portid].calling_name); - kzfree(new_adapter); + kfree_sensitive(new_adapter); return NULL; } @@ -1889,8 +1889,8 @@ static struct i2c_adapter * seastone2_i2c_init(struct platform_device *pdev, error = i2c_add_numbered_adapter(new_adapter); if (error < 0) { printk(KERN_ALERT "Cannot add i2c adapter %s", new_data->pca9548.calling_name); - kzfree(new_adapter); - kzfree(new_data); + kfree_sensitive(new_adapter); + kfree_sensitive(new_data); return NULL; } @@ -1936,7 +1936,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) fpga = kobject_create_and_add("FPGA", &pdev->dev.kobj); if (!fpga) { - kzfree(fpga_data); + kfree_sensitive(fpga_data); return -ENOMEM; } @@ -1944,7 +1944,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) if (ret != 0) { printk(KERN_ERR "Cannot create FPGA sysfs attributes\n"); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1952,7 +1952,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) if (!cpld1) { sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return -ENOMEM; } ret = sysfs_create_group(cpld1, &cpld1_attr_grp); @@ -1961,7 +1961,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1971,7 +1971,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return -ENOMEM; } ret = sysfs_create_group(cpld2, &cpld2_attr_grp); @@ -1982,7 +1982,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1995,7 +1995,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return PTR_ERR(sff_dev); } @@ -2009,7 +2009,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -2023,7 +2023,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -2040,9 +2040,9 @@ static int seastone2_drv_probe(struct platform_device *pdev) sff_data = dev_get_drvdata(fpga_data->sff_devices[portid_count]); BUG_ON(sff_data == NULL); if ( sff_data->port_type == QSFP ) { - fpga_data->sff_i2c_clients[portid_count] = i2c_new_device(i2c_adap, &sff8436_eeprom_info[0]); + fpga_data->sff_i2c_clients[portid_count] = i2c_new_client_device(i2c_adap, &sff8436_eeprom_info[0]); } else { - fpga_data->sff_i2c_clients[portid_count] = i2c_new_device(i2c_adap, &sff8436_eeprom_info[1]); + fpga_data->sff_i2c_clients[portid_count] = i2c_new_client_device(i2c_adap, &sff8436_eeprom_info[1]); } sff_data = NULL; sysfs_create_link(&fpga_data->sff_devices[portid_count]->kobj, @@ -2362,4 +2362,4 @@ module_exit(seastone2_exit); MODULE_AUTHOR("Pradchaya P. "); MODULE_DESCRIPTION("Celestica Seastone2 switchboard driver"); MODULE_VERSION(MOD_VERSION); -MODULE_LICENSE("GPL"); \ No newline at end of file +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-cel/services/platform_api/platform_api_mgnt.sh b/platform/broadcom/sonic-platform-modules-cel/services/platform_api/platform_api_mgnt.sh index 208c8696c4..7515b81784 100755 --- a/platform/broadcom/sonic-platform-modules-cel/services/platform_api/platform_api_mgnt.sh +++ b/platform/broadcom/sonic-platform-modules-cel/services/platform_api/platform_api_mgnt.sh @@ -4,20 +4,13 @@ PREV_REBOOT_CAUSE="/host/reboot-cause/" DEVICE="/usr/share/sonic/device" PLATFORM=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) FILES=$DEVICE/$PLATFORM/api_files -PY2_PACK=$DEVICE/$PLATFORM/sonic_platform-1.0-py2-none-any.whl PY3_PACK=$DEVICE/$PLATFORM/sonic_platform-1.0-py3-none-any.whl install() { - # Install python2.7 sonic-platform package - if [ -e $PY2_PACK ]; then - pip install $PY2_PACK - fi - # Install python3 sonic-platform package if [ -e $PY3_PACK ]; then pip3 install $PY3_PACK fi - } init() { diff --git a/platform/broadcom/sonic-platform-modules-cel/silverstone/modules/switchboard.c b/platform/broadcom/sonic-platform-modules-cel/silverstone/modules/switchboard.c index 2ee6c858a8..e41b64bade 100644 --- a/platform/broadcom/sonic-platform-modules-cel/silverstone/modules/switchboard.c +++ b/platform/broadcom/sonic-platform-modules-cel/silverstone/modules/switchboard.c @@ -1604,7 +1604,7 @@ static struct i2c_adapter * silverstone_i2c_init(struct platform_device *pdev, i new_data = kzalloc(sizeof(*new_data), GFP_KERNEL); if (!new_data) { printk(KERN_ALERT "Cannot alloc i2c data for %s", fpga_i2c_bus_dev[portid].calling_name); - kzfree(new_adapter); + kfree_sensitive(new_adapter); return NULL; } @@ -1623,8 +1623,8 @@ static struct i2c_adapter * silverstone_i2c_init(struct platform_device *pdev, i error = i2c_add_numbered_adapter(new_adapter); if (error < 0) { printk(KERN_ALERT "Cannot add i2c adapter %s", new_data->pca9548.calling_name); - kzfree(new_adapter); - kzfree(new_data); + kfree_sensitive(new_adapter); + kfree_sensitive(new_data); return NULL; } @@ -1685,7 +1685,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) fpga = kobject_create_and_add("FPGA", &pdev->dev.kobj); if (!fpga) { - kzfree(fpga_data); + kfree_sensitive(fpga_data); return -ENOMEM; } @@ -1693,7 +1693,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) if (ret != 0) { printk(KERN_ERR "Cannot create FPGA sysfs attributes\n"); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1701,7 +1701,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) if (!cpld1) { sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return -ENOMEM; } ret = sysfs_create_group(cpld1, &cpld1_attr_grp); @@ -1710,7 +1710,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1720,7 +1720,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return -ENOMEM; } ret = sysfs_create_group(cpld2, &cpld2_attr_grp); @@ -1731,7 +1731,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1744,7 +1744,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return PTR_ERR(sff_dev); } @@ -1758,7 +1758,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1772,7 +1772,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1788,9 +1788,9 @@ static int silverstone_drv_probe(struct platform_device *pdev) sff_data = dev_get_drvdata(fpga_data->sff_devices[portid_count]); BUG_ON(sff_data == NULL); if ( sff_data->port_type == QSFP ) { - fpga_data->sff_i2c_clients[portid_count] = i2c_new_device(i2c_adap, &sff8436_eeprom_info[0]); + fpga_data->sff_i2c_clients[portid_count] = i2c_new_client_device(i2c_adap, &sff8436_eeprom_info[0]); } else { - fpga_data->sff_i2c_clients[portid_count] = i2c_new_device(i2c_adap, &sff8436_eeprom_info[1]); + fpga_data->sff_i2c_clients[portid_count] = i2c_new_client_device(i2c_adap, &sff8436_eeprom_info[1]); } sff_data = NULL; sysfs_create_link(&fpga_data->sff_devices[portid_count]->kobj, @@ -2103,4 +2103,4 @@ module_exit(silverstone_exit); MODULE_AUTHOR("Celestica Inc."); MODULE_DESCRIPTION("Celestica Silverstone platform driver"); MODULE_VERSION(MOD_VERSION); -MODULE_LICENSE("GPL"); \ No newline at end of file +MODULE_LICENSE("GPL");