Re: Adding PCI memory to kernel.

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

 



On Sat, Feb 19, 2005 at 06:28:45PM -0800, P. Sadik hit keys to express the following:
>   I have a PCI card with RAM mapped through BAR 0. What is the best way to 
> add this memory to the kernel from the device driver? Is the following
> sufficient?
> 
>   mem_start = pci_resource_start(struct pci_dev *mydev, 0);
>   mem_len = pci_resource_len(struct pci_dev *mydev, 0);
> 
>   add_memory_region(mem_start, mem_len, ??)
It would be better if you can give more details.
Your PCI card has, say, 2MB memory, inside the card and you want to map it into
kernel? Or your pci card can address 2MB memory and you want to get that memory
assigened to the card? In the latter case, you will be better off by
pci_request_region(). In the former case, you might want to use vmalloc() for
contiguous logical address and then program the bar with that address. The
accesses to this area should be handled by the device (hopefully, but it works
for us).

HTH,
Om.
-- 
In my end is my beginning.
		-- Mary Stuart, Queen of Scots

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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