mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ole André Vadla Ravnås" <oleavr-lkml@jblinux.net>
To: root@chaos.analogic.com
Cc: steve@neptune.ca, linux-kernel@vger.kernel.org
Subject: Re: Virtual to physical address mapping
Date: 18 Sep 2002 18:04:44 +0200	[thread overview]
Message-ID: <1032365084.3481.12.camel@zole.jblinux.net> (raw)
In-Reply-To: <Pine.LNX.3.95.1020918075900.3583A-100000@chaos.analogic.com>

On Wed, 2002-09-18 at 14:06, Richard B. Johnson wrote:
> On 18 Sep 2002, Ole [ISO-8859-1] André Vadla [ISO-8859-1] Ravnås wrote:
> 
> > Thanks, but the address specified there is certainly not the same as the
> > base address ifconfig reports. I made a simple program to verify this:
> 
> [SNIPPED...]
> 
> `ifconfig` reports the base address of a port (I don't know why).
> There are other addresses in use.

Ah.. that explains it all, as I modified net/core/dev.c earlier today to
report the base_addr present in the net_device structure in the
sprintf_stats() which is responsible for the /proc/net/dev output --
and, what I got was:
0xf88fa000
where the ifmap structure returned by the SIOCGIFMAP ioctl contained a
base_addr saying:
0xa000
I did this ugly hack (WRT net/core/dev.c) since I discovered that the
net_device()'s base_addr was an unsigned long, while ifmap's base_addr
was an unsigned short - and indeed, just like you said, it's only the
base-address that's returned in the ifmap. :-)

> eth0      Link encap:Ethernet  HWaddr 00:50:DA:19:7A:7D  
>           inet addr:10.100.2.224  Bcast:10.255.255.255  Mask:255.0.0.0
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:2630005 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:307396 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:2430 txqueuelen:100 
>           Interrupt:10 Base address:0xb800 
> 
> [SNIPPED...]
> 
> A private version of `lspci` that actually reads the PCI ports
> shows:
> 
> Device      Vendor                    Type
>    0   Intel Corporation              440BX/ZX - 82443BX/ZX Host bridge
> [SNIPPED...]
>   11   3Com Corporation               3c905B 100BaseTX [Cyclone]         
>        IRQ 10 Pin A
>        I/O  ports : 0xb800->0xb87e
>        I/O memory : 0xdf800000->0xdf80007f
> 
> Notice that it has memory-mapped I/O.
> That said, neither of these addresses are the virtual addresses.
> On an ix86, these are physical addresses which are the same as
> the bus addresses. Other machines may not have the same physical
> and bus address. The virtual address is whatever mmap() returns
> in user-space, and whatever ioremap() returns in kernel space.
> Note that in kernel space, the returned value should not be used
> as a pointer. There are macros defined to access the I/O addressed
> elements. See .../linux/Documentation/IO-mapping.txt.

Ah, I see! Thanks a lot for your help! :-)

Best regards
Ole André



  reply	other threads:[~2002-09-18 15:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-18  5:54 Ole André Vadla Ravnås
2002-09-18  6:05 ` Steve Mickeler
2002-09-18  8:07   ` Ole André Vadla Ravnås
2002-09-18 12:06     ` Richard B. Johnson
2002-09-18 16:04       ` Ole André Vadla Ravnås [this message]
2002-09-18 11:47 ` Brian Gerst
2002-09-18 16:10   ` Ole André Vadla Ravnås
2002-09-18 14:46 ` Jonathan Lundell
2002-09-18 16:05   ` Ole André Vadla Ravnås

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1032365084.3481.12.camel@zole.jblinux.net \
    --to=oleavr-lkml@jblinux.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=root@chaos.analogic.com \
    --cc=steve@neptune.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®