How to make a DMA over PCI?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

I have a PCI device and I want this to transfer data to and from main
memory by using DMA as PCI master. Shouldn't be a huge problem, I
thought.

The problems start with the bus address of the main memory. The
following module prints the bus address of a variable:


static unsigned int     var;

int init_module(void) {

  printk(KERN_ERR "&var = 0x%08x\n", &var);
  printk(KERN_ERR "virt_to_bus(&var) = 0x%08x\n", virt_to_bus(&var));

  return -1;
}


Result is

virt_to_bus(&var) = 0x0d915340


This address (a bit below 256M) seems to me too high, because the
machine is equipped with only 128 MB and I expect the main memory to
start at address 0. When the PCI device accesses this address, there is
no response (the host bridge answers correctly as selected device, but
then continuously puts a "Target not ready" on the PCI bus, with no
abort). Can this address anyway be a valid bus address?

Next problem: The most effective DMA transfer copies data directly from
the PCI device to user space memory. How do I find out the physical/bus
address of a buffer in user space (supposed this region is already
locked)?


For hints I'd be thankful..

Norbert
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux