Find the answer to your Linux question:
Results 1 to 5 of 5
I have a driver that I wrote a few years ago under SuSE 9.3 (kernel 2.6.11). The target is a PCI card which has memory-mapped regions, accessed through a PLX9050 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2010
    Posts
    5

    PCI-driver memory-access changes after k2.6.11 ?


    I have a driver that I wrote a few years ago under SuSE 9.3 (kernel 2.6.11). The target is a PCI card which has memory-mapped regions, accessed through a PLX9050 PCI chip. All Write operations require writing to a memory location, then polling a bit on a Xilinx chip (behind the PCI chip) to determine when the write is complete.

    This worked fine back under k2.6.11, but now I'm trying to update to Ubuntu 10.04 (k2.6.32), and while pci register, obtaining memory addresses, remapping and all are completing successfully, I'm finding that in many cases I cannot successfully write/read the PCI memory regions; sometimes it works, but other times I don't get my DONE indicator back from the Xilinx.

    Has something changed in how accessing PCI memory regions is handled?

    (I can post the relevant code here if it's useful, but I thought I'd start by just describing the situation first and see what people had to say here).

    Dan Miller

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,578
    A lot of kernel structures changed sometime around (I think) 2.6.32. You should check on The Linux Kernel Archives for details about what they were. Custom drivers such as yours will need some tweaking to work properly.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Nov 2010
    Posts
    5
    Okay, I've gotten a clue on this!!

    First, I have *three* data regions that I access behind this PCI chip; one is defined in the PCI config data as an IO space (region 2, which is a Zilog UART), and the other two are memory regions as I previously described.

    I have now solved the problem with accessing the memory regions; I was directly accessing the remapped data with memory reads/writes:

    *(char *)( device->xilinx_base + XIL_EEPROM_CTRL_2 ) = u8_value ;

    However, in looking through other k2.6.32 drivers, I saw comments that direct dereferencing of these memory spaces was no longer proper, and one should use ioread8() and its ilk instead for this purpose, so I changed this (and all other related accesses) to:
    iowrite8(u8_value, device->xilinx_base + XIL_EEPROM_CTRL_2) ;
    and now these memory accesses all are proceeding successfully!!

    However, I'm still having problems with accesses to the IO space, and I'm not sure how to handle these. The immediate result is that I perform a DMA test (this is a UART DMA operation, not a kernel DMA operation) during device startup/testing, and that fails (on ONE of the two boards, though the other succeeds!).

    I use inw() and outw() to access the UART registers; is there some other operation that I'm supposed to use for these accesses now? Perhaps some equivalent of iowrite16() for memory accesses?

    Also, to obtain access to the PCI IO space, I use:
    mem_base = pci_resource_start(pdev, j);
    mem_len = pci_resource_len(pdev, j);
    request_region (mem_base, mem_len, ip3_pci_name);
    which was the historical way to do this; is there something else I should be doing to access PCI IO spaces?

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,578
    AFAIK, you will still use inw() and outw() to access I/O space. Since one board works and the other doesn't (I assume they are otherwise identical?), then I think possibly something in the non-working board settings have likely remapped the I/O addresses (jumper/flash settings?). If that isn't the case, then perhaps the board has a fault?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  5. #5
    Just Joined!
    Join Date
    Nov 2010
    Posts
    5
    I think the boards and configurations are fine. The way I set up the system is as so: I put in one disk, installed SuSE 9.3 on it, built and loaded our driver, recorded all the addresses, and tested the environment. I then put in a different disk, installed Ubuntu 10.04, built and loaded our driver, and performed the same configuration and testing. The virtual and physical addresses of all PCI regions is the same on both boards.

    With SuSE 9.3 (k2.6.11), all testing and accesses work fine. With k2.6.32, however, I have the documented problems. So the only difference between the two is kernel version.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •