diff --git a/.azure-pipelines/azure-pipelines-image-template.yml b/.azure-pipelines/azure-pipelines-image-template.yml index 5d4edb892a38..1078b56e9226 100644 --- a/.azure-pipelines/azure-pipelines-image-template.yml +++ b/.azure-pipelines/azure-pipelines-image-template.yml @@ -52,7 +52,7 @@ jobs: - script: | mkdir -p $(Build.ArtifactStagingDirectory)/target #mv target/* $(Build.ArtifactStagingDirectory)/target/ - mv target/sonic-broadcom.bin $(Build.ArtifactStagingDirectory)/target/ + mv target/sonic-$(parameters.platform).bin $(Build.ArtifactStagingDirectory)/target/ displayName: Copy Artifacts condition: always() - publish: $(Build.ArtifactStagingDirectory) diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_dram.c b/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_dram.c index 8805a8f55701..a04d04d7cf7f 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_dram.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_dram.c @@ -35,7 +35,10 @@ static ulong mem_test_data2 = sizeof(ulong) == 4 ? 0xAAAAAAAAUL : 0xAAAAAAAAAAAA int dram_wr_main(int argc, char **argv) { - printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, argv[0]); + char tmp[128]; + + snprintf(tmp, sizeof(tmp), "%s", argv[0]); + printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, tmp); return 0; } @@ -44,7 +47,8 @@ int dram_rd_main(int argc, char **argv) { int fd, i, ret; unsigned char buffer[1024]; - memset(buffer, 0, 1024); + + memset_s(buffer, sizeof(buffer), 0, sizeof(buffer)); argc = argc; argv = argv; if ((fd = open("/dev/mem",O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO)) < 0 ) { @@ -78,7 +82,10 @@ int dram_rd_main(int argc, char **argv) int dram_chk_main(int argc, char **argv) { - printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, argv[0]); + char tmp[128]; + + snprintf(tmp, sizeof(tmp), "%s", argv[0]); + printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, tmp); return 0; } @@ -226,7 +233,7 @@ int platform_get_sys_memory_size_form_cmdline(unsigned int *sys_memory_size) /* MEMORY information area start character string */ mem_start_string = "RAMSZ="; /* get the memory size from the /proc/octeon_info file */ - memset(mem_size_buf, 0, FAC_MEM_SIZE_BUF_LEN); + memset_s(mem_size_buf, sizeof(mem_size_buf), 0, sizeof(mem_size_buf)); ret = platform_devfile_read("/proc/cmdline", mem_size_buf, FAC_MEM_SIZE_BUF_LEN - 1, 0); if (ret) { FAC_LOG_DBG(GRTD_LOG_ERR, "MEM ERROR:Read mem info fail!\n"); @@ -270,7 +277,7 @@ static int platform_simple_get_mem_space(void **buf, size_t *size) while (!done_mem) { while (!start && wantsize) { start = (void *) malloc(wantsize); - memset(start, 0, wantsize); + memset_s(start, wantsize, 0, wantsize); if (!start) wantsize -= pagesize; } *size = wantsize; @@ -461,7 +468,7 @@ static int platform_simple_sdram_ecc_detect() return FAC_TEST_FAIL; } - memset(file_line, 0, FAC_FILE_LINE_LEN); + memset_s(file_line, sizeof(file_line), 0, sizeof(file_line)); /* Find the name of the MTD device that can be used for production testing in each line of the MTD file */ while (fgets(file_line, FAC_FILE_LINE_LEN, fp) != NULL) { if (i == 0) { @@ -566,7 +573,7 @@ static int platform_get_system_free_mem(size_t *free_size) } /* get the path of mount */ - memset(mem_file_line, 0, sizeof(mem_file_line)); + memset_s(mem_file_line, sizeof(mem_file_line), 0, sizeof(mem_file_line)); while (fgets(mem_file_line, FAC_FILE_LINE_LEN, fp) != NULL) { FAC_LOG_DBG(GRTD_LOG_DEBUG, "meminfo file content:%s \n", mem_file_line); loc = strstr(mem_file_line, "MemFree:"); @@ -695,10 +702,10 @@ int platform_complex_sys_memory_test(char *desc, int kaoji) #endif ft_ddr_test_init(buf, autotest_size); /* init memory */ - memset((char *)buf, 0, autotest_size); + memset_s((char *)buf, autotest_size, 0, autotest_size); /* Test memory */ - memset((char *)desc_tmp, 0, 128); + memset_s((char *)desc_tmp, 128, 0, 128); for (i = 0 ; i < TETS_TOTAL_NUMBER; i++) { if (ft_ddr_test_fun[i].always == 0 && kaoji) { /* some test items are not tested in the copy machine state */ diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_i2c.c b/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_i2c.c index 165e88cdb677..70d068dc997d 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_i2c.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_i2c.c @@ -327,7 +327,7 @@ int i2c_wr_main(int argc, char **argv) int ret, fd; struct i2c_dev_priv i2c_priv; - memset(&i2c_priv, 0, sizeof(struct i2c_dev_priv)); + memset_s(&i2c_priv, sizeof(struct i2c_dev_priv), 0, sizeof(struct i2c_dev_priv)); ret = i2c_arg_check(argc, argv, &i2c_priv, 5); if (ret < 0) { @@ -371,7 +371,7 @@ int i2c_rd_main(int argc, char **argv) int i, ret, fd; struct i2c_dev_priv i2c_priv; - memset(&i2c_priv, 0, sizeof(struct i2c_dev_priv)); + memset_s(&i2c_priv, sizeof(struct i2c_dev_priv), 0, sizeof(struct i2c_dev_priv)); ret = i2c_arg_check(argc, argv, &i2c_priv, 4); if (ret < 0) { i2c_help("i2c_rd"); @@ -424,7 +424,7 @@ int i2c_chk_main(int argc, char **argv) struct i2c_dev_priv i2c_priv; unsigned char *buffer; - memset(&i2c_priv, 0, sizeof(struct i2c_dev_priv)); + memset_s(&i2c_priv, sizeof(struct i2c_dev_priv), 0, sizeof(struct i2c_dev_priv)); ret = i2c_arg_check(argc, argv, &i2c_priv, 5); if (ret < 0) { @@ -484,7 +484,10 @@ int i2c_chk_main(int argc, char **argv) int i2c_reset_main(int argc, char **argv) { - printf("not support %s argc:%d, \r\n", argv[0], argc); + char tmp[128]; + + snprintf(tmp, sizeof(tmp), "%s", argv[0]); + printf("not support %s argc:%d, \r\n", tmp, argc); return 0; } @@ -494,7 +497,7 @@ int pca9548_rd_main(int argc, char **argv) int i, ret, fd; struct i2c_dev_priv i2c_priv; - memset(&i2c_priv, 0, sizeof(struct i2c_dev_priv)); + memset_s(&i2c_priv, sizeof(struct i2c_dev_priv), 0, sizeof(struct i2c_dev_priv)); ret = i2c_arg_check(argc, argv, &i2c_priv, 4); if (ret < 0) { i2c_help("pca9548_rd"); @@ -545,7 +548,7 @@ int pca9548_wr_main(int argc, char **argv) int ret, fd; struct i2c_dev_priv i2c_priv; - memset(&i2c_priv, 0, sizeof(struct i2c_dev_priv)); + memset_s(&i2c_priv, sizeof(struct i2c_dev_priv), 0, sizeof(struct i2c_dev_priv)); ret = i2c_arg_check(argc, argv, &i2c_priv, 5); if (ret < 0) { diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_misc.c b/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_misc.c index 378dd4a7f74e..d10b41b5e86d 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_misc.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_misc.c @@ -148,28 +148,40 @@ static int mdio_arg_parse(int argc, char **argv, int reload_main(int argc, char **argv) { - printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, argv[0]); + char tmp[128]; + + snprintf(tmp, sizeof(tmp), "%s", argv[0]); + printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, tmp); return 0; } int sys_info_main(int argc, char **argv) { - printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, argv[0]); + char tmp[128]; + + snprintf(tmp, sizeof(tmp), "%s", argv[0]); + printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, tmp); return 0; } int mem_dump_main(int argc, char **argv) { - printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, argv[0]); + char tmp[128]; + + snprintf(tmp, sizeof(tmp), "%s", argv[0]); + printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, tmp); return 0; } int cache_flush_main(int argc, char **argv) { - printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, argv[0]); + char tmp[128]; + + snprintf(tmp, sizeof(tmp), "%s", argv[0]); + printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, tmp); return 0; } @@ -713,7 +725,7 @@ int lpc_cpld_rd8_main(int argc, char **argv) printf("\r\n"); } } - + printf("\r\n"); return 0; diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_mtdflash.c b/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_mtdflash.c index 1f086cf13c92..4270fc9b5d8f 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_mtdflash.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_mtdflash.c @@ -212,7 +212,7 @@ int nand_wr_main(int argc, char **argv) struct mtd_dev_priv nand_priv; struct erase_info_user erase; - memset(&nand_priv, 0, sizeof(struct mtd_dev_priv)); + memset_s(&nand_priv, sizeof(struct mtd_dev_priv), 0, sizeof(struct mtd_dev_priv)); ret = mtd_arg_get(argc, argv, &nand_priv, 5); if (ret < 0) { @@ -292,7 +292,7 @@ int nand_rd_main(int argc, char **argv) unsigned int nand_erasesize; struct mtd_dev_priv nand_priv; - memset(&nand_priv, 0, sizeof(struct mtd_dev_priv)); + memset_s(&nand_priv, sizeof(struct mtd_dev_priv), 0, sizeof(struct mtd_dev_priv)); ret = mtd_arg_get(argc, argv, &nand_priv, 3); if (ret < 0) { @@ -365,7 +365,7 @@ int nand_chk_main(int argc, char **argv) struct erase_info_user erase; unsigned char *buffer; - memset(&nand_priv, 0, sizeof(struct mtd_dev_priv)); + memset_s(&nand_priv, sizeof(struct mtd_dev_priv), 0, sizeof(struct mtd_dev_priv)); ret = mtd_arg_get(argc, argv, &nand_priv, 5); if (ret < 0) { @@ -475,7 +475,7 @@ int nor_wr_main(int argc, char **argv) struct mtd_dev_priv nor_priv; struct erase_info_user erase; - memset(&nor_priv, 0, sizeof(struct mtd_dev_priv)); + memset_s(&nor_priv, sizeof(struct mtd_dev_priv), 0, sizeof(struct mtd_dev_priv)); ret = mtd_arg_get(argc, argv, &nor_priv, 5); if (ret < 0) { @@ -555,7 +555,7 @@ int nor_rd_main(int argc, char **argv) unsigned int nor_erasesize; struct mtd_dev_priv nor_priv; - memset(&nor_priv, 0, sizeof(struct mtd_dev_priv)); + memset_s(&nor_priv, sizeof(struct mtd_dev_priv), 0, sizeof(struct mtd_dev_priv)); ret = mtd_arg_get(argc, argv, &nor_priv, 3); if (ret < 0) { @@ -628,7 +628,7 @@ int nor_chk_main(int argc, char **argv) struct erase_info_user erase; unsigned char *buffer; - memset(&nor_priv, 0, sizeof(struct mtd_dev_priv)); + memset_s(&nor_priv, sizeof(struct mtd_dev_priv), 0, sizeof(struct mtd_dev_priv)); ret = mtd_arg_get(argc, argv, &nor_priv, 5); if (ret < 0) { diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_pci.c b/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_pci.c index 73ba16e98812..78788baea2f3 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_pci.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_pci.c @@ -185,7 +185,7 @@ int pci_wr_main(int argc, char **argv) unsigned int *ptr; struct stat sb; - memset(&pci_priv, 0, sizeof(struct pci_dev_priv)); + memset_s(&pci_priv, sizeof(struct pci_dev_priv), 0, sizeof(struct pci_dev_priv)); ret = pci_arg_parse(argc, argv, &pci_priv, 6, 0); if (ret < 0) { pci_help("pci_wr"); @@ -240,7 +240,7 @@ int pci_rd_main(int argc, char **argv) unsigned int *ptr; struct stat sb; - memset(&pci_priv, 0, sizeof(struct pci_dev_priv)); + memset_s(&pci_priv, sizeof(struct pci_dev_priv), 0, sizeof(struct pci_dev_priv)); ret = pci_arg_parse(argc, argv, &pci_priv, 6, 0); if (ret < 0) { pci_help("pci_rd"); @@ -293,7 +293,7 @@ int pci_cfg_wr_main(int argc, char **argv) struct pci_dev_priv pci_priv; char buf[16]; - memset(&pci_priv, 0, sizeof(struct pci_dev_priv)); + memset_s(&pci_priv, sizeof(struct pci_dev_priv), 0, sizeof(struct pci_dev_priv)); ret = pci_arg_parse(argc, argv, &pci_priv, 6, 1); if (ret < 0) { pci_cfg_help("pci_cfg_wr"); @@ -338,7 +338,7 @@ int pci_cfg_rd_main(int argc, char **argv) struct pci_dev_priv pci_priv; unsigned int data; - memset(&pci_priv, 0, sizeof(struct pci_dev_priv)); + memset_s(&pci_priv, sizeof(struct pci_dev_priv), 0, sizeof(struct pci_dev_priv)); ret = pci_arg_parse(argc, argv, &pci_priv, 5, 1); if (ret < 0) { pci_cfg_help("pci_cfg_rd"); @@ -381,7 +381,7 @@ int pci_chk_main(int argc, char **argv) unsigned int *ptr; struct stat sb; - memset(&pci_priv, 0, sizeof(struct pci_dev_priv)); + memset_s(&pci_priv, sizeof(struct pci_dev_priv), 0, sizeof(struct pci_dev_priv)); ret = pci_arg_parse(argc, argv, &pci_priv, 6, 0); if (ret < 0) { pci_help("pci_wr"); @@ -440,7 +440,7 @@ int pci_dump_main(int argc, char **argv) unsigned char *p; struct stat sb; - memset(&pci_priv, 0, sizeof(struct pci_dev_priv)); + memset_s(&pci_priv, sizeof(struct pci_dev_priv), 0, sizeof(struct pci_dev_priv)); ret = pci_arg_parse(argc, argv, &pci_priv, 6, 0); if (ret < 0) { pci_help("pci_dump"); diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_usb.c b/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_usb.c index bf1c2fd02eaa..e04f8c121bec 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_usb.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/app/hw_test/hw_usb.c @@ -25,20 +25,29 @@ int usb_write_main(int argc, char **argv) { - printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, argv[0]); + char tmp[128]; + + snprintf(tmp, sizeof(tmp), "%s", argv[0]); + printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, tmp); return 0; } int usb_read_main(int argc, char **argv) { - printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, argv[0]); + char tmp[128]; + + snprintf(tmp, sizeof(tmp), "%s", argv[0]); + printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, tmp); return 0; } int usb_check_main(int argc, char **argv) { - printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, argv[0]); + char tmp[128]; + + snprintf(tmp, sizeof(tmp), "%s", argv[0]); + printf("%s, %d, %d, %s\r\n", __FUNCTION__, __LINE__, argc, tmp); return 0; } diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.c index 669198ca59fd..ff26c29643c9 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.c @@ -746,6 +746,47 @@ static fpga_pcie_card_info_t g_fpga_pcie_card_info[] = { }, }, }, + /* RA-B6510-48V8C */ + { + .dev_type = 0x404a, + .pca9548_cfg_info = { + { + .pca9548_bus = 12, + .pca9548_addr = 0x70, + .cfg_offset = 0x20, + }, + { + .pca9548_bus = 12, + .pca9548_addr = 0x71, + .cfg_offset = 0x20, + }, + { + .pca9548_bus = 12, + .pca9548_addr = 0x72, + .cfg_offset = 0x20, + }, + { + .pca9548_bus = 12, + .pca9548_addr = 0x73, + .cfg_offset = 0x20, + }, + { + .pca9548_bus = 13, + .pca9548_addr = 0x70, + .cfg_offset = 0x20, + }, + { + .pca9548_bus = 13, + .pca9548_addr = 0x71, + .cfg_offset = 0x20, + }, + { + .pca9548_bus = 13, + .pca9548_addr = 0x72, + .cfg_offset = 0x20, + }, + }, + }, }; extern void pca954x_hw_do_reset_func_register(void* func); diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c index 76270a94ec8b..fa6d554df64e 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c @@ -376,124 +376,34 @@ static pca9548_card_info_t g_pca9548_card_info[] = { { .dev_type = {0x404a}, /* RA-B6510-48V8C */ .pca9548_cfg_info = { - /* psu fan */ - { - .pca9548_reset_type = PCA9548_RESET_GPIO, - .pca9548_bus = 2, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .gpio_attr.gpio = 7, - .gpio_attr.gpio_init = 0, - .gpio_attr.reset_on = 1, - .gpio_attr.reset_off = 0, - }, - }, - /* sff1 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - /* sff2 */ + /* 风扇 */ { .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x71, + .pca9548_bus = 2, + .pca9548_addr = 0x77, .rst_delay_b = 0, .rst_delay = 1000, .rst_delay_a = 1000, .attr = { .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, + .func_attr.cfg_offset = {0x060d0060, -1}, /* bus:6, addr:0x0d, offset:0x60 */ .func_attr.umask = {BIT(1), -1}, }, }, - /* sff3 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - /* sff4 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - /* sff5 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x74, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(4), -1}, - }, - }, - /* sff6 */ - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x75, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, - .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(5), -1}, - }, - }, - /* sff7 */ + /* 电源 */ { .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 1, - .pca9548_addr = 0x76, + .pca9548_bus = 4, + .pca9548_addr = 0x77, .rst_delay_b = 0, .rst_delay = 1000, .rst_delay_a = 1000, .attr = { .func_attr.reset_func = pca954x_hw_do_reset_by_i2c, .func_attr.get_umask_func = pca954x_get_umask_by_i2c, - .func_attr.cfg_offset = {CPLD_PCA9548_RESET, -1}, - .func_attr.umask = {BIT(6), -1}, + .func_attr.cfg_offset = {0x060d0060, -1}, /* bus:6, addr:0x0d, offset:0x60 */ + .func_attr.umask = {BIT(0), -1}, }, }, }, @@ -1527,7 +1437,7 @@ static int pca954x_probe(struct i2c_client *client, if (IS_ERR(gpio)) return PTR_ERR(gpio); #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) - data->idle_state = MUX_IDLE_AS_IS; + data->idle_state = MUX_IDLE_DISCONNECT; if (device_property_read_u32(&client->dev, "idle-state", &data->idle_state)) { if (device_property_read_bool(&client->dev, "i2c-mux-idle-disconnect")) data->idle_state = MUX_IDLE_DISCONNECT; diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/modules/driver/rg_lpc_cpld.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/modules/driver/rg_lpc_cpld.c index 7f32a47436b7..e155f9e58575 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/modules/driver/rg_lpc_cpld.c +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/modules/driver/rg_lpc_cpld.c @@ -1,5 +1,5 @@ -#include /* Wd're doing kernel work */ -#include /* specifically, a module */ +#include /* Wd're doing kernel work */ +#include /* specifically, a module */ #include #include /* Need for the macros */ #include @@ -88,7 +88,7 @@ static int lpc_cpld_read(int address, u8 *val) LPC_CPLD_ERROR("lpc_get_device_info addr 0x%x id %d failed.\r\n", address, cpld_id); return -1; } - + *val = inb(info->base + LPC_GET_CPLD_OFFSET(address)); LPC_CPLD_VERBOSE("Leave info->base 0x%x, addr 0x%x, cpld_id %d, val 0x%x.\r\n", info->base, address, cpld_id, *val); return 0; @@ -105,7 +105,7 @@ static int lpc_cpld_write(int address, u8 reg_val) LPC_CPLD_ERROR("lpc_get_device_info addr 0x%x id %d failed.\r\n", address, cpld_id); return -1; } - + outb(reg_val, info->base + LPC_GET_CPLD_OFFSET(address)); LPC_CPLD_VERBOSE("Leave info->base 0x%x, addr 0x%x, cpld_id %d, val 0x%x.\r\n", info->base, address, cpld_id, reg_val); return 0; @@ -114,21 +114,19 @@ static int lpc_cpld_write(int address, u8 reg_val) static ssize_t show_cpld_version(struct device *dev, struct device_attribute *da, char *buf) { int ret, i; - u8 data[4]; + u8 data[4] = {0}; u32 index = to_sensor_dev_attr(da)->index; - memset(data, 0 ,sizeof(data)); for (i = 0; i < 4; i++) { ret = lpc_cpld_read(index + i, &data[i]); if (ret != 0) { - memset(data, 0 ,sizeof(data)); - LPC_CPLD_ERROR("get cpld version failed!\n"); - break; + LPC_CPLD_ERROR("get cpld version failed, ret: %d\n", ret); + return -EIO; } - } + } return snprintf(buf, COMMON_STR_LEN, "%02x %02x %02x %02x \n", data[0], data[1], data[2], data[3]); - + } static ssize_t show_cpld_sysfs_value(struct device *dev, struct device_attribute *da, char *buf) @@ -145,14 +143,14 @@ static ssize_t show_cpld_sysfs_value(struct device *dev, struct device_attribute return snprintf(buf, COMMON_STR_LEN, "%02x\n", data); } -static ssize_t set_cpld_sysfs_value(struct device *dev, struct device_attribute *da, const char *buf, size_t +static ssize_t set_cpld_sysfs_value(struct device *dev, struct device_attribute *da, const char *buf, size_t count) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); u8 data; unsigned long val; int err; - + err = kstrtoul(buf, 16, &val); if (err) return err; @@ -205,7 +203,7 @@ static int __init rg_lpc_cpld_init(void) return -1; } - status = -1; + status = -1; status = sysfs_create_group(&pdev->dev.kobj, &lpc_cpld_base_sysfs_group); if (status) { LPC_CPLD_ERROR("sysfs_create_group failed!\n"); diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp_config.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp_config.py index a57db85842ce..c6df4f5aca8b 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp_config.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp_config.py @@ -1,7 +1,7 @@ cust_sfp_cfg = { 'x86_64-ragile_ra-b6510-48v8c-r0': { "ver": '2.1', - "port_index_start": 0, + "port_index_start": 1, "port_num": 56, "log_level": 2, "eeprom_retry_times": 5, diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp_config_v2.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp_config_v2.py index a57db85842ce..c6df4f5aca8b 100644 --- a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp_config_v2.py +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-48v8c/sonic_platform/sfp_config_v2.py @@ -1,7 +1,7 @@ cust_sfp_cfg = { 'x86_64-ragile_ra-b6510-48v8c-r0': { "ver": '2.1', - "port_index_start": 0, + "port_index_start": 1, "port_num": 56, "log_level": 2, "eeprom_retry_times": 5,