Thank you for your help!!
I have setup the inbound memory window as you suggested on the setup_pci_atmu function but I do not receive any message, Do I have to configure the inbound memory windows on a certain range?
This is the code I included on setup_pci_atmu function:
/* PCIe can overmap inbound & outbound since RX & TX are separated */
if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) {
/* Size window to exact size if power-of-two or one size up */
if ((1ull << mem_log) != mem) {
mem_log++;
if ((1ull << mem_log) > mem)
pr_info("%s: Setting PCI inbound window "
"greater than memory size\n", name);
}
piwar |= ((mem_log - 1) & PIWAR_SZ_MASK);
/* Setup inbound memory window */
if(!strcmp("/pcie@ff70a000",name)){
out_be32(&pci->piw[win_idx].pitar, 0x0003FE00);
out_be32(&pci->piw[win_idx].piwbar, 0x000AD000);
out_be32(&pci->piw[win_idx].piwar, piwar);
win_idx--;
hose->dma_window_base_cur = 0x00000000;
hose->dma_window_size = (resource_size_t)sz;
/* Setup inbound memory window */
out_be32(&pci->piw[win_idx].pitar, 0x000B0100);
out_be32(&pci->piw[win_idx].piwbar, 0x000AB000);
out_be32(&pci->piw[win_idx].piwar, piwar);
win_idx--;
hose->dma_window_base_cur = 0xB0100000;
hose->dma_window_size = (resource_size_t)sz;
}
if(!strcmp("/pcie@ff709000",name)){
out_be32(&pci->piw[win_idx].pitar, 0x0003FD00);
out_be32(&pci->piw[win_idx].piwbar, 0x000BD000);
out_be32(&pci->piw[win_idx].piwar, piwar);
win_idx--;
hose->dma_window_base_cur = 0x00000000;
hose->dma_window_size = (resource_size_t)sz;
/* Setup inbound memory window */
out_be32(&pci->piw[win_idx].pitar, 0x000A0100);
out_be32(&pci->piw[win_idx].piwbar, 0x000BA000);
out_be32(&pci->piw[win_idx].piwar, piwar);
win_idx--;
hose->dma_window_base_cur = 0x00000000;
hose->dma_window_size = (resource_size_t)sz;
}
/*
* if we have >4G of memory setup second PCI inbound window to
* let devices that are 64-bit address capable to work w/o
* SWIOTLB and access the full range of memory
*/
Then on the kernel user space I try to map the inbound windows by using mmap command as follows:
int fd;
void *where;
// Open PCIe devices
fd=open("/dev/mem",O_RDWR);
where=mmap(0,0x100000,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0x3fe00000);
if(where==(void *)0xffffffff)
{
close(fd);
printf("Cannot open PCIe uA-uD communications\n");
exit(-1);
}
pcie_inboundA=(void *) where;
}
And then read inbound window as:
Memcpy(rx_buffer, pcie_inboundA,size);
And no message is received. Is there a problem with the inbound window address range that I am using??
Thanks again for your help!