Other Parts Discussed in Thread: TMS320C6678,
Tool/software: Linux
Hi,
In our custom board, Keystone2 (66AK2H12) is connected to 2 Keystone 1 (tms320c6678) processors thro pcie switch. We tried to boot K1 processors thro PCIe boot. We cross compiled ti provided linux host pcie example (pciedemo.c) and ported in one of K2. It works fine (successfully boots one K1). So we modified the linux host pcie code (pciedemo.c) to support sysfs so that user can load their application (*.out) directly without converting into hex format.
First we created pciedemo.ko module with sysfs which successfully inserted in kernel (known thro pcie bar register read by setpci command and character device creation)
The problem occurs when we try to access application register thro pcie bar0 from user space. While reading the bar registers i am getting unhandled segmentation fault but not in writing. For your reference, I am providing code snippet.
pcie_drv_inst[dev_id].bar_info[0].virtAddr =
(void *)mmap(NULL, pcie_drv_inst[dev_id].bar_info[0].length,
(PROT_READ | PROT_WRITE),
MAP_SHARED, pcie_drv_inst[dev_id].dev_desc, (off_t)pcie_drv_inst[dev_id].bar_info[0].pcieAddr);
/* PCIe application registers virtual address (mapped to PCI window) */
#define PCI_REGV(minor, reg) (unsigned *) (pcie_drv_inst[minor].bar_info[0].virtAddr + reg)
bar_num =*(PCI_REGV(dsp_id, IB_BAR(ib_trans_num))) /*unhandled Segmentation fault occurs*/
*(PCI_REGV(dsp_id, IB_BAR(ib_trans_num))) = bar_num; /* No error but dont know where it is writing !!!! */
My doubt is for virtual memory support anything else has to be taken care in pcie base drivers?
Note: we are using Linux 3.10 from ti git repo. PCie BARs configured in 32-bit mode.
Kindly help on this?
Regards,
S.Sivanantham