From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,7e930b7d42ecea7 X-Google-Attributes: gid111c93,public From: acher@atbode61.informatik.tu-muenchen.de (Georg Acher) Subject: Re: Alpha and PCI Driver (w/ mmap) problems ... Date: 2000/05/11 Message-ID: <8febtf$ei9$1@sunsystem5.informatik.tu-muenchen.de>#1/1 X-Deja-AN: 622098616 Distribution: world References: <391958A4.4D5D66C7@cfl.rr.com> Organization: Technische Universitaet Muenchen, Germany Xcanpos: shelf.2/200005251801!0006653221 Newsgroups: comp.os.linux.alpha In article <391958A4.4D5D66C7@cfl.rr.com>, John Ward writes: |> I have a "simple" PCI card that has a memory region which is mmap'able |> ... so I wrote a driver which identifies the card with the |> pci_find_device() call, and then mmap's the information out of the |> appropriate base address using the following call: |> |> remap_page_range(vma->vm_start, (vma->vm_offset + g_offset), |> (vma->vm_end |> - vma->vm_start), vma->vm_page_prot); |> |> Anyhow, I have a corresponding application program that simply opens the |> device and then prints out the contents of a mmap'd region: |> |> fd = open("/dev/truetime", O_RDWR)); |> |> ptr = mmap(0, MAX_DEV_MEM_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED, |> fd, 0); |> |> etc ... |> |> Problem is that on my alpha system I get all 0's ... nada ... zilch. Are you sure, that you really map the actual PCI address space? On Alpha, the tiny 32bit-PCI space is not starting at CPU address 0. To convert the PCI address into the addresses as needed by the CPU, you should use bus_to_virt. Accessing PCI memory in userspace via /dev/mem has similar problems, but there exists a library (included somewhere in XFree) that calculates the necessary offset. -- Georg Acher, acher@in.tum.de http://www.in.tum.de/~acher/ "Oh no, not again !" The bowl of petunias