driver:tpu:fix pcie info bug
Signed-off-by: tingzhu.wang@sophgo.com <tingzhu.wang@sophgo.com>
This commit is contained in:
parent
e0489b7bcf
commit
60be7ce535
|
@ -25,6 +25,7 @@
|
|||
#include <linux/fs.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/sched/clock.h>
|
||||
#include <linux/delay.h>
|
||||
#include "sgdrv.h"
|
||||
#include "../pcie_ep/ap_pcie_ep.h"
|
||||
#include "../c2c_rc/c2c_rc.h"
|
||||
|
@ -1226,6 +1227,7 @@ static long sg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
c2c_ok = sophgo_check_c2c();
|
||||
if (c2c_ok)
|
||||
break;
|
||||
msleep(1000);
|
||||
}
|
||||
|
||||
if (c2c_ok == 0)
|
||||
|
|
|
@ -130,16 +130,34 @@ static ssize_t c2c_enable_show(struct device *dev,
|
|||
return strlen(buf);
|
||||
}
|
||||
|
||||
static int dump_pcie_info(struct pcie_info *pcie_info)
|
||||
{
|
||||
pr_err("pcie[%llu] status:%s\n", pcie_info->pcie_id, pcie_info->enable == 1 ? "enable": "disable");
|
||||
pr_err(" slot id:0x%llx\n", pcie_info->slot_id);
|
||||
pr_err(" socket id:0x%llx\n", pcie_info->socket_id);
|
||||
pr_err(" send port:0x%llx, recv port:0x%llx\n", pcie_info->send_port, pcie_info->recv_port);
|
||||
pr_err(" data link type:%s, link role:%s, gpio:%llu\n",
|
||||
pcie_info->data_link_type == PCIE_DATA_LINK_C2C ?
|
||||
"c2c" : (pcie_info->data_link_type == PCIE_LINK_ROLE_RC ? "cascade" : "error"),
|
||||
pcie_info->link_role == PCIE_LINK_ROLE_RC ? "rc" : (pcie_info->link_role == PCIE_LINK_ROLE_EP ?
|
||||
"ep" : "error"),
|
||||
pcie_info->link_role_gpio);
|
||||
pr_err(" perst gpio:%llu\n", pcie_info->perst_gpio);
|
||||
pr_err(" peer slot id:%llu, peer socket id:%llu, peer pcie id:%llu\n\n",
|
||||
pcie_info->peer_slotid, pcie_info->peer_socketid, pcie_info->peer_pcie_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int check_all_rc(struct c2c_info *info)
|
||||
{
|
||||
struct pcie_info *pcie_info;
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
pcie_info = (struct pcie_info *)info->pcie_info + i * PER_CONFIG_STR_OFFSET;
|
||||
if (pcie_info->data_link_type == PCIE_DATA_LINK_C2C && pcie_info->link_role == PCIE_LINK_ROLE_RC) {
|
||||
pr_err("[pcie%d] as c2c rc\n", i);
|
||||
pcie_info = (struct pcie_info *)(info->pcie_info + i * PER_CONFIG_STR_OFFSET);
|
||||
dump_pcie_info(pcie_info);
|
||||
if (pcie_info->data_link_type == PCIE_DATA_LINK_C2C && pcie_info->link_role == PCIE_LINK_ROLE_RC)
|
||||
all_c2c_rc++;
|
||||
}
|
||||
}
|
||||
|
||||
return all_c2c_rc;
|
||||
|
|
Loading…
Reference in New Issue