/proc/iomem



cat /proc/iomem


00000000-0009fbff : System RAM
0009fc00-0009ffff : reserved
000a0000-000bffff : Video RAM area
000c0000-000c7fff : Video ROM
000f0000-000fffff : System ROM
00100000-07eeffff : System RAM
00100000-0022614c : Kernel code
0022614d-0029547f : Kernel data
07ef0000-07ef7fff : ACPI Tables
07ef8000-07efffff : ACPI Non-volatile Storage
07f00000-07ffffff : reserved
e7b00000-e7bfffff : PCI Bus #01
e7bfff00-e7bfffff : Analog Devices SM56 PCI modem
e8000000-ebffffff : Intel Corp. 82810E DC-133 CGC [Chipset Graphics Controller]
efd00000-efdfffff : PCI Bus #01
eff80000-efffffff : Intel Corp. 82810E DC-133 CGC [Chipset Graphics Controller]


i think addresses in the above are virual addresses . If u want to read or write , there is no need to call
                ioremap()

But when i tried to readb ,writeb() ,  it leads to OOPS

why ?
can we derefernce these virtuals address directly ? (eg :  *ptr =0x88 )
karanaAsked:
Who is Participating?
 
praseedgopalCommented:
Hi
         To obtain and relinquish the I/O memory, you have to use

     int request_mem_region(unsigned long start, unsigned long len,char *name);

     int release_mem_region(unsigned long start, unsigned long len);

Earlier
     int check_mem_region(unsigned long start, unsigned long len);
was used  also used to check whether that memory is accessible.


     
0
 
manish_regmiCommented:
>> i think addresses in the above are virual addresses . If u want to read or write ,
>> there is no need to call ioremap()

No, They are Physical addresses. And you need to call ioremap before using readb/writeb.

>> can we derefernce these virtuals address directly ? (eg :  *ptr =0x88 )
Yes but only after remapping.And Make sure it is writeable.

Regards
Manish Regm
0
 
karanaAuthor Commented:
hi  manish ,

if  i/o  is memory mapped .
 consider this address
      0xeff80000
 it is actually  comes after  3gb . I have only 128 mb ram .
                                 

if i/o is i/o mapped , it wont come under

cat /proc/iomem .

0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
manish_regmiCommented:
hi,
  Memory != ram
  for eg, In your system,
 00000000-0009fbff : System RAM        (RAM)
0009fc00-0009ffff : reserved                 (RAM)
000a0000-000bffff : Video RAM area      (VIDEO RAM; not RAM)
000c0000-000c7fff : Video ROM             (ROM or EPROM; Not RAM)
000f0000-000fffff : System ROM            (ROM ; Not RAM)
00100000-07eeffff : System RAM           (RAM)
00100000-0022614c : Kernel code          (RAM)
0022614d-0029547f : Kernel data           (RAM)
...
e7b00000-e7bfffff : PCI Bus #01              (Memory mapped I/O; not RAM).  
e7bfff00-e7bfffff : Analog Devices SM56 PCI modem              (Memory mapped I/O; not RAM).
 
PS: You might have studied address decoding in computer architecture class.

>> if  i/o  is memory mapped .
>> consider this address
>>      0xeff80000
>> it is actually  comes after  3gb . I have only 128 mb ram .

If you had RAM at that place, that device would have been mapped to some other(higher) place (AFAIK by BIOS).

regards
Manish Regmi
0
 
karanaAuthor Commented:
hi manish ,
         
  int no1;
   init_module() {  
 
     printk("<1> %x \n" ,&no1);
           }

i get the answer as  0xc8891150

          int  no2;
      int main()
              {
            printf("%x \n" ,&no2);
           }
i get the answer as  0x80494e0



       int init_module()
           {
    printk("<1>  %x  \n" ,__pa(0xc8891150));
    printk("<1>  %x  \n" ,__ pa(0x80494e0));
        }

i get the output as
                            0x8891150
                            0x480494e0

but from
(00100000-07eeffff : System RAM )


the physical address from __pa() should be between   0x100000 and 0x07eeffff . why  we get 0x8891150 and 0x480494e0
0
 
manish_regmiCommented:
>> int no1;
 >> ...
 >> i get the answer as  0xc8891150

Because the kernel virtual address is beyond 3G.

>>      int  no2;
>> ...
>> i get the answer as  0x80494e0
 
User apps Virtual address is around that address.

USER:- 0-3G
KERNEL:- 3G-4G

>> printk("<1>  %x  \n" ,__pa(0xc8891150));
>>   printk("<1>  %x  \n" ,__ pa(0x80494e0));

>> i get the output as
>>    0x8891150
>>    0x480494e0

As intended, because __pa converts kernel virtual ro physical. Actually it substracts 3 G(0xc0000000) from the address.

regards
Manish Regmi

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.