Re: /dev/mem contains physical memory addresses?

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

 



On Fri, 2006-07-07 at 11:28 +0530, Daniel Rodrick wrote:
> > > How about peripheral memory mapped to some addresses? Assuming I have
> > > a PCI device and a on board flash PROM, would I be able to see them in
> > > /proc/(k)mem ? I feel not. Am I correct?
> >
> > /dev/mem yes
> >
> > HOWEVER, there is a much nicer way to mmap a PCI device's resources, and
> > that is sysfs.
> > /sys/bus/pci/devices/0000:00:02.0/resource0
> > for example is the first resource of a PCI device on my system.
> > No need to muck about with the dangerous /dev/mem; this one is at least
> > well defined and portable across systems, including virtualization etc
> > etc
> 
> So you mean to say that if I have a device whose registers are are
> memory mapped to say physical addresses "0x20020000 - 0x20020010".
> Then the file /sys/bus/pci/devices/0000:00:02.0/resource0 will contain
> thsi memory range as its contents?

well assuming the device is 00:02.0 on the bus (obviously you need to
find the right device) and that it's the first resource of the device,
then yes. (and you have to mmap it, not "read"/"write")

lspci -v  is your friend in finding out which resource and which device
it is...


Greetings,
   Arjan van de Ven

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

[Index of Archives]     [Audio]     [Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux