This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problem about dm8168 pcie Epdrv_sample_apps

Hi all:

i develop on dm8168 board designed by our own using dvrrdk 4.0,

one is used as dm8168 RC , another is dm8168 EP,

and when i run the demo at rc it prints:

root@dm816x:/opt/pcie_rc# ./rc_app
ti81xx_pci_info.c:178:get_devices():  cmd ls /sys/bus/pci/devices > 6b8b45670X.pcidevlist,list_devices 6b8b45670X.pcidevlist
ti81xx_pci_info.c:182:get_devices():  get_device[   72.010000] Unhandled fault: Precise External Abort on non-linefetch (0x1018) at 0x4036f004
s:182
ti81xx_pci_info.c:187:get_devices():  get_devices:187
ti81xx_pci_info.c:196:get_devices():  get_devices:196 file_med 0000:00:00.0
ti81xx_pci_info.c:204:get_devices(): vendor file name is /sys/bus/pci/devices/0000:00:00.0/vendor
ti81xx_pci_info.c:208:get_devices(): device file name is /sys/bus/pci/devices/0000:00:00.0/device
ti81xx_pci_info.c:212:get_devices(): resource file name is /sys/bus/pci/devices/0000:00:00.0/resource
ti81xx_pci_info.c:216:get_devices(): class file name is /sys/bus/pci/devices/0000:00:00.0/class
ti81xx_pci_info.c:260:get_devices(): Skipping RC: file 0000:00:00.0

ti81xx_pci_info.c:196:get_devices():  get_devices:196 file_med 0000:01:00.0
ti81xx_pci_info.c:204:get_devices(): vendor file name is /sys/bus/pci/devices/0000:01:00.0/vendor
ti81xx_pci_info.c:208:get_devices(): device file name is /sys/bus/pci/devices/0000:01:00.0/device
ti81xx_pci_info.c:212:get_devices(): resource file name is /sys/bus/pci/devices/0000:01:00.0/resource
ti81xx_pci_info.c:216:get_devices(): class file name is /sys/bus/pci/devices/0000:01:00.0/class
ti81xx_pci_info.c:272:get_devices(): this file is not related to EP : file 0000:01:00.0

ti81xx_pci_info.c:196:get_devices():  get_devices:196 file_med 0000:02:01.0
ti81xx_pci_info.c:204:get_devices(): vendor file name is /sys/bus/pci/devices/0000:02:01.0/vendor
ti81xx_pci_info.c:208:get_devices(): device file name is /sys/bus/pci/devices/0000:02:01.0/device
ti81xx_pci_info.c:212:get_devices(): resource file name is /sys/bus/pci/devices/0000:02:01.0/resource
ti81xx_pci_info.c:216:get_devices(): class file name is /sys/bus/pci/devices/0000:02:01.0/class
ti81xx_pci_info.c:272:get_devices(): this file is not related to EP : file 0000:02:01.0

ti81xx_pci_info.c:196:get_devices():  get_devices:196 file_med 0000:02:02.0
ti81xx_pci_info.c:204:get_devices(): vendor file name is /sys/bus/pci/devices/0000:02:02.0/vendor
ti81xx_pci_info.c:208:get_devices(): device file name is /sys/bus/pci/devices/0000:02:02.0/device
ti81xx_pci_info.c:212:get_devices(): resource file name is /sys/bus/pci/devices/0000:02:02.0/resource
ti81xx_pci_info.c:216:get_devices(): class file name is /sys/bus/pci/devices/0000:02:02.0/class
ti81xx_pci_info.c:272:get_devices(): this file is not related to EP : file 0000:02:02.0

ti81xx_pci_info.c:196:get_devices():  get_devices:196 file_med 0000:03:00.0
ti81xx_pci_info.c:204:get_devices(): vendor file name is /sys/bus/pci/devices/0000:03:00.0/vendor
ti81xx_pci_info.c:208:get_devices(): device file name is /sys/bus/pci/devices/0000:03:00.0/device
ti81xx_pci_info.c:212:get_devices(): resource file name is /sys/bus/pci/devices/0000:03:00.0/resource
ti81xx_pci_info.c:216:get_devices(): class file name is /sys/bus/pci/devices/0000:03:00.0/class
ti81xx_pci_info.c:264:get_devices():
 EP has been found here vendor=0x104C device=0xB800

ti81xx_pci_info.c:191:get_devices(): no more pci devices in sysfs

ti81xx_rc_app.c:325:main(): no of ep in system is 1
ti81xx_rc_app.c:328:main(): start address of mgmt_area is virt--ca800000  phy--8a800000
Bus error,

the print on EP side:

ti81xx_trans.c:24:access_mgmt_area(): reading unique id from management area
ti81xx_trans.c:27:access_mgmt_area(): unique id field in mgmt area is :  1
ti81xx_trans.c:36:access_mgmt_area(): someone else is accessing this management area
ti81xx_ep_app.c:890:main(): mgmt area access not granted

....

what does this mean?

I run the demo ok yesterday, but now it can not be run correctly.

what is happenning?

best regards

xavier

  • I found that rules that if i insmod ti81xx_pcie_bootdrv.ko at rc side before insmod ti81xx_pcie_epdrv.ko at ep side,
    it works well.in my board i do not use pcie boot mode which load ep from rc through pcie,
    i boot ep board from nand flash and i init the ep in uboot, so no need to do insmod ti81xx_pcie_bootdrv.ko,
    I kown that ti81xx_pcie_bootdrv do init the ep device, but how about ti81xx_pcie_rcdrv.ko, if i want to
    start from ti81xx_pcie_rcdrv.ko, which part should be added to the driver?

    another question is that i do not understand the function propagate_system_info in the driver ti81xx_pcie_rcdrv.ko
    really do as mmap munmap ?
    what does really want to get through mmap.
    /**
    * propagate_system_info(): propaget PCI subsytem mapping in RC
    * address space to every EP inlist.
    * @start: start of list
    * @fd: file descriptor returned from RC module device file.
    * @eps: no of eps as returned by get_device()
    */

    int propagate_system_info(struct pci_sys_info *start, int fd,
    int eps, unsigned int startaddr)
    {
    unsigned int bar2_addr = 0;
    unsigned int bar2_size = 0;
    unsigned int *mgmt_area;
    struct pci_sys_info *temp;
    /*fetch unique id of every node and fill them in structure*/
    for (temp = start; temp != NULL; temp = temp->next) {

    bar2_addr = temp->res_value[3][0];
    bar2_size = temp->res_value[3][1];

    mgmt_area = mmap(0, bar2_size, PROT_READ|PROT_WRITE,
    MAP_SHARED, fd, (off_t)bar2_addr);

    if ((void *)-1 == (void *) mgmt_area) {
    debug_print("mmap bar2 of EP having ID %u "
    "failed\n", temp->res_value[0][0]);
    close(fd);
    return -1;
    }
    fetch_my_unique_id(mgmt_area, temp);
    munmap(mgmt_area, bar2_size);
    }

    for (temp = start; temp != NULL ; temp = temp->next) {

    bar2_addr = temp->res_value[3][0];
    bar2_size = temp->res_value[3][1];

    mgmt_area = mmap(0, bar2_size, PROT_READ | PROT_WRITE,
    MAP_SHARED, fd, (off_t) bar2_addr);
    if ((void *)-1 == (void *) mgmt_area) {
    debug_print("mmap bar2 of EP having Id %u "
    "failed\n", temp->res_value[0][0]);
    close(fd);
    return -1;
    }
    dump_info_on_ep(start, mgmt_area , eps, startaddr);
    munmap(mgmt_area, bar2_size);
    }
    return 0;
    }

  • Xavier,

    Xavier said:
    in my board i do not use pcie boot mode which load ep from rc through pcie,
    i boot ep board from nand flash and i init the ep in uboot, so no need to do insmod ti81xx_pcie_bootdrv.ko,
    I kown that ti81xx_pcie_bootdrv do init the ep device, but how about ti81xx_pcie_rcdrv.ko, if i want to
    start from ti81xx_pcie_rcdrv.ko, which part should be added to the driver?

    See if the below links will be in help:

    http://processors.wiki.ti.com/index.php/TI81XX_PCIe_FAQs#How_can_I_initialize_PCIe_module_on_DM816x_to_be_used_as_PCIe_Endpoint_without_using_any_of_the_PCIe_Boot_mode.3F

    http://processors.wiki.ti.com/index.php/TI81XX_PCIe_FAQs#How_can_I_initialize_PCIe_module_on_DM816x_to_be_used_as_PCIe_Root_Complex_without_using_Linux_Kernel_integrated_with_DM816x_Root_Complex_Driver_.3F

    http://processors.wiki.ti.com/index.php/TI81XX_PCIe_FAQs#what.E2.80.99s_the_difference_between_pcie_boot_and_SPI_pcie_boot_support.3F

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_PCI_Express_Root_Complex_Driver_User_Guide

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_PCI_Express_Endpoint_Driver_User_Guide

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_PCI_Express_Endpoint_Boot_Driver_User_Guide

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_U-Boot_PCIe_Boot_User_Guide

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_04.04.00.02_Feature_Performance_Guide#PCIe_RC_Driver

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_04.04.00.02_Feature_Performance_Guide#PCIe_EP_Boot_Driver

    BR
    Pavel

  • Xavier said:
    another question is that i do not understand the function propagate_system_info in the driver ti81xx_pcie_rcdrv.ko
    really do as mmap munmap ?
    what does really want to get through mmap.

    We have some info regarding mmap() in the below wiki:

    http://processors.wiki.ti.com/index.php/DM81xx_AM38xx_PCI_Express_Endpoint_Driver_User_Guide

    mmap() MMAP interface can be used by the application using EP driver to map the reserved memory for PCIe as well as the h/w window of 256MB starting from 0x20000000. 

    TI81XX_GET_PCIE_MEM_INFO Application can use this to query the size and physical address of the reserved memory on DM81xx EP for PCIe transfers. This memory space can then be divided by the application across different BARs (for inbound mapping) and to perform CPU/EDMA read/write transfers from EP. To access this memory in userspace, the application can use mmap facility provided by the EP driver (for CPU transfers) or by EDMA sample driver for EDMA trnasfers.

    The EP drive expects a contiguous block of memory reserved at boot time to facilitate applications to do mmap when doing data transfer using PCIe. The desired size should vary depending upon the application requirement.

    NOTE2: The EP driver doesn't require any memory to be reserved for its own functionality, but this memory is required to provide mmap regions mapping to PCIe BARs (inbound transfers) and/or EDMA regions (outbound transfers) to allow application to perform PCIe communication and transfers.

    WARNING: If PCIe memory is not reserved during boot time, the EP driver would still load successfully but the application on EP might fail if it expects reserved RAM available to transfer data using mmap or DMA. To ensure that the driver had reserved memory available, the application must use TI81XX_GET_PCIE_MEM_INFO ioctl to check if reserved memory size fits application's requirement.

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_PCI_Express_Endpoint_Boot_Driver_User_Guide

    Provide mmap support to enable the boot application to copy image files (U-Boot, kernel etc) to EP memory

    http://processors.wiki.ti.com/index.php/USB_to_PCI_loopback#simple_sink_thread

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/220530.aspx

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/154734.aspx

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/110055.aspx

    BR
    Pavel