Best way for PCI memory allocation?

testlaster testlaster at gmail.com
Thu Dec 18 07:32:17 EST 2014


Hey Guys.
What would you say is the best memory allocation function to use when I 
want to dump a specific size and address of memory to a file?
Im working through the PCI chip to gain access to a shared 8meg memory 
bank. What I essentially have to do is try and access that bank from 
memory start to a specific memory offset and
dump all its containing data into a file as soon as possible.

This is a quick sum of my great adventures to try and get PCI device 
data and register offsets.
Im just summing this up so that you can see HOW I got to the PCI device 
info.

First I run __init pci_init_module()  and inside it the following.
-alloc_chrdev_region()
-MAJOR()
-pci_cdev_init();
-pci_register_driver();

Then it seems to me like the just automatically runs the .probe function 
and it runs these functions.
-pci_cdev-add()
-MKDEV();
-cdev_alloc();
cdev_init();
cdev->owner = THIS_MODULE;
-cdev_add();
dev_info();
pci_enabled_device();

Ok soo from here on I try and allocate / request regions of RAM.
This is what I tried :
pci_request_region();  and it failed miserably saying " BAR 3: Can't 
reserve [mem 0xe0800000 - 0xe0ffffff]
also
ioremap_nocache(pci_resource_start());  This works but it seems slow and 
I should copy register by register out of the ram? Is this the only way ?
also ive tried using
pci_set_dma_mask() ; which failed also with a return value of a really 
large value starting with 4.

I wanted to paste my code but the last time I pasted it my Email had to 
be moderated and they never came back to me about it :( .







More information about the Kernelnewbies mailing list