Skip to content

Commit

Permalink
fix code check
Browse files Browse the repository at this point in the history
fix RA-B6510-48 9548 reset
Update port start index
fix pipeline err
Signed-off-by: pettershao-ragilenetworks <pettershao@ragilenetworks.com>
  • Loading branch information
pettershao-ragilenetworks committed Jan 17, 2023
1 parent a419399 commit b4c6ebc
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/azure-pipelines-image-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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 ) {
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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:");
Expand Down Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand All @@ -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");
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -713,7 +725,7 @@ int lpc_cpld_rd8_main(int argc, char **argv)
printf("\r\n");
}
}

printf("\r\n");

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit b4c6ebc

Please sign in to comment.