From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Thu, 27 May 2010 15:06:37 -0500 Subject: [U-Boot] [PATCH] [RFC] memsize.c: adapt get_ram_size() for address spaces >32 bit In-Reply-To: <20100527194442.632FEEAC238@gemini.denx.de> References: <1274983869-9173-1-git-send-email-wd@denx.de> <20100527194442.632FEEAC238@gemini.denx.de> Message-ID: <4BFED0CD.5010301@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 05/27/2010 02:44 PM, Wolfgang Denk wrote: > Dear Timur Tabi, > > In message you wrote: >> On Thu, May 27, 2010 at 1:11 PM, Wolfgang Denk wrote: >>> get_ram_size() used to use "long" data types for addresses and data, >>> which in limited it to systems with less than 4 GiB memory. As more >>> and more systems are coming up with bigger memory resources, we adapt >>> the code to use phys_addr_t / phys_size_t data types instead. >>> >>> Signed-off-by: Wolfgang Denk >>> Cc: Timur Tabi >>> --- >> >> The problem is that on all of our PowerPC boards, the TLBs only map >> the lower 2GB of memory, regardless as to how much is present. So we >> still can't use get_ram_size() to determine how much memory is in the >> system, because any attempt to access memory higher than 2GB will >> fail. > > Now this is your problem, then, and you should kno how to fix it. Not using get_ram_size(), which is of minimal utility when you know the actual size (and is an unsafe approach to the problem when you don't, unless you know a lot about where I/O is mapped and how the system responds to accessing memory that doesn't exist -- not exactly the sort of thing you want to make a mandate for any board to be accepted), seems like a good way to "fix it". >> And even if we did have TLBs for all of memory, an attempt to access >> RAM that doesn't exist will cause a machine check, which will hang >> U-Boot. So we still couldn't use get_ram_size() to determine how much >> RAM actually exists. > > Please see how it's done on all other PowerPC systems, and do similar. "All other PowerPC systems" is a ridiculous overstatement. I see exactly *one* Freescale board that uses this thing, and it's an ARM board. -Scott