linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adam Nielsen <a.nielsen@shikadi.net>
To: David VomLehn <dvomlehn@cisco.com>
Cc: linux-mips@linux-mips.org
Subject: Re: Setting the physical RAM map
Date: Tue, 01 Dec 2009 08:35:28 +1000	[thread overview]
Message-ID: <4B1448B0.6020100@shikadi.net> (raw)
In-Reply-To: <20091130190036.GA24581@dvomlehn-lnx2.corp.sa.net>

>>    Determined physical RAM map:
>>     memory: 00800000 @ 40250000 (usable)
>>     memory: 00040000 @ 9fc00000 (ROM data)
>>    Wasting 8407552 bytes for tracking 262736 unused pages
>
> These are kernel messages, so you are getting into the kernel, but this
> looks odd to me.  The MIPS processor needs memory mapped in the first
> 512 MiB to execute. This first 512 MiB will be mapped as cached memory
> at virtual address 0x80000000 (known as kseg0) and as uncached memory at
> virtual address 0x0a0000000 (known as kseg1). Perhaps you system is like
> mine, where I have memory above 512 MiB aliased into the first 512 MiB
> of physical space.
>
> The second odd thing is the ROM data physical address. This is a good virtual
> address but as a physical address it is not accessible by the MIPS processor
> without mapping to with a TLB entry.

Are these supposed to be physical addresses?  Maybe that's where I'm going 
wrong.  I only know the virtual addresses from some experimentation, but I've 
got no idea how to find out the physical addresses.

The system won't accept the kernel unless its virtual load address is 
0x40020000.  If I use the 'sm' (show memory) command in the boot loader it 
tells me there is 16MB of RAM starting at 0x20000000 and 8MB starting at 
0x21000000, so but if memory is supposed to start at 0x0 then those don't look 
like physical addresses either.

>>    TLB refill exception PC = 40024094 address = 7FFFF000
>
> This is not too surprising since the kernel is executing at an address
> must have a TLB entry to be accessible.

 From my other experiments here, 0x40024094 is fine, the problem is that the 
kernel is trying to access the unmapped address at 0x7FFFF000 and I'm not sure 
why.  It looks like an unusual address - is it trying to trigger an exception 
to test whether some exception handler has been installed correctly?

> My guess, and since I don't have a lot of information this is a pretty
> wild guess, is that you are actually running your kernel at 0x40020000,
> and that the reason you can do this is that the bootloader has left the
> TLBs in such a state that the first few pages are mapped. Then, when it
> leaves the mapped area, it dies with the TLB refill exception.
>
> Another possibility is that you actually start off at reasonable 0x8xxxxxxx
> address, but then use a pointer that takes you off to 0x40024094.

I'm pretty sure execution starts at 0x40020000.  With some testing code I have 
successfully written at 0x40040000 so it looks like that's where the boot 
loader has mapped a fair chunk of memory.  0x40024094 shouldn't be a problem, 
but 0x7FFFF000 probably would be.

> One suggestion is to look at the code at 0x40024094 to see what it's doing.
> Then, use a JTAG debugger or add printk() statements to see exactly what's
> happening.

I think that's probably the best bet.  Unfortunately figuring out where that 
address ends up in the C source is a little tricky for me, and I'm still a bit 
slow at reading MIPS assembly!

Thanks for your helpful reply.

Cheers,
Adam.

  parent reply	other threads:[~2009-11-30 22:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-28 14:38 Setting the physical RAM map Adam Nielsen
2009-11-30 19:00 ` David VomLehn
2009-11-30 19:25   ` Geert Uytterhoeven
2009-11-30 22:35   ` Adam Nielsen [this message]
2009-12-20  9:07   ` Adam Nielsen
2009-11-30 21:41 ` Ralf Baechle
2009-11-30 22:38   ` Adam Nielsen
2009-12-01  0:49     ` Ralf Baechle

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=4B1448B0.6020100@shikadi.net \
    --to=a.nielsen@shikadi.net \
    --cc=dvomlehn@cisco.com \
    --cc=linux-mips@linux-mips.org \
    /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;
as well as URLs for NNTP newsgroup(s).