Some problems with IO/Mem-mapping

From: Dag Brattli (dagb@cs.uit.no)
Date: Fri Jan 28 2000 - 14:05:39 EST

  • Next message: Rick Hohensee: "Re: linux-kernel-learning"

    Hi,

    I'm helping out a friend who is developing a Linux driver for a AD/DA PCI
    card. The card has a shared memory region, which he wants to mmap() to
    user-space.

    dub ~/ > lspci -vv
    00:0e.0 Class ff00: Ultraview Corporation ADDA 1280 DX
            Subsystem: Unknown device febd:0067
            Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
            Status: Cap- 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
            Interrupt: pin A routed to IRQ 9
            Region 0: Memory at 42000000 (32-bit, non-prefetchable)

    The problem is how to get the physical address which we need to feed to
    remap_page_range(). If we use phys = virt_to_phys(bus_to_virt(mem_addr)) to
    make the driver portable to non i386 platforms, then it will strip off the
    highest bit because of the PAGE_OFFSET. Using virt_to_phys() on whats
    returned from ioremap() does not produce the correct physical address
    either. Recompiling the kernel for 2GB phys mem is probably not the
    "correct" solution. Using the base_address (0x42000000) directly will of
    course give the correct result, but we would really like the driver to work
    on non-i386 platforms as well.

    I guess we are not understanding this issue at all, so any hints would be
    appreciated!

    Thanks

    -- Dag

    -- 
       / Dag Brattli                   | The Linux-IrDA Project               /
      // University of Tromsoe, Norway | Infrared communication for Linux    //
     /// http://www.cs.uit.no/~dagb    | http://www.cs.uit.no/linux-irda/   ///
    

    - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Fri Jan 28 2000 - 22:58:42 EST