Yes.Is there a way to find the PHYSICAL ADDRESSES of
all
the devices used in a Computer ?
does cat /proc/iomem serves the purpose ?
This file gives you the allocated regions though request_region and request_mem_region.
[om@crebain ~/prg/mod_dummy]$ cat /proc/iomem
00000000-0009fbff : System RAM
<physical memory>
0009fc00-0009ffff : reserved 000a0000-000bffff : Video RAM area 000c0000-000c7fff : Video ROM
<physical memory>
000f0000-000fffff : System ROM
00100000-1f7effff : System RAM
00100000-00250cab : Kernel code
00250cac-0034abc3 : Kernel data
1f7f0000-1f7f2fff : ACPI Non-volatile Storage
1f7f3000-1f7fffff : ACPI Tables
1f800000-1fffffff : reserved
e0000000-e3ffffff : VIA Technologies, Inc. VT8601 [Apollo ProMedia]
e4000000-e6ffffff : PCI Bus #01
e5000000-e57fffff : Trident Microsystems CyberBlade/i1
e5800000-e5ffffff : Trident Microsystems CyberBlade/i1
e6000000-e601ffff : Trident Microsystems CyberBlade/i1
e8000000-e80000ff : Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+
e8000000-e80000ff : 8139too
ffff0000-ffffffff : reserved
Let me explain the 8139too region.
From /usr/src/linux-2.4.20-6/drivers/net/8139too.c, we can see that this card requires 0x100 bytes for iospace. While initializing the pci device, kernel pci functions (drivers/pci/pci.c) will find out that this device requires 256 bytes for pci io space. Then it allocates 256 bytes for the device as its io space. What I understand is that the io memory is mapped to some address (e8000000-e80000ff) and is allocated in the pci_dev structure corresponding to this device. When the driver comes up, it will get this address space and the driver ioremaps it for its use (line 834) and gets virtual address corresponding.
So what you see is the mapped address of physical devices's memory. Unless we do the remap, we will not get virtual addresses.
(PCI bridges can be filled with the mapped addresses, any access to the mapped addresses within a bridge's range will start generating io/memory cycles)
HTH Om.
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/