Re: Copying user space data to PCI memory

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

 



Hi Arun,

On Sat, May 16, 2009 at 5:48 PM, arun c <arun.edarath@xxxxxxxxx> wrote:
> Hi all,
>
> I want to copy data from user space to PCI memory.
>
> I mapped the PCI memory of the card by,
>
> 1)pci_request_regions(pci_dev, DEVICE_NAME);
> 2)buffer_addr = pci_iomap(pci_dev, 1, 1024);
>
> Now I want to write data supplied by the
> user to buffer_addr(BAR1 pre-fetch-able memory
> of the device)
>
> I did like this:
>
> copy_from_user(buffer_addr, usr_addr, 1024)
>
> This method is working fine on an X86 running
> linux 2.6.27 kernel. I can see the data clearly copied.
>
> I want to know is this legal for all the platforms? and for
> older kernels starting from 2.6.16?
>
> If the above method is totally legal then can I use
> copy_to_user(usr_addr, buffer_addr, 1024) also?
>
AFAIK, yes.
If you look at the source, the code for copy_from_user/copy_to_user
belongs to the arch directory which according to the semantics means
that its platform specific.
Also, I could see that its defined for all the platforms but its
prototype differs.


> Regards,
> Arun C
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>



-- 
Regards,
Sandeep.





 	
“To learn is to change. Education is a process that changes the learner.”

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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