From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oliver Schinagl Date: Sat, 19 Oct 2013 11:21:24 +0200 Subject: [U-Boot] [RFC] ARM: U-boot and 2 GiB of ram with get_ram_size only being long In-Reply-To: <1382138758.7979.929.camel@snotra.buserror.net> References: <524DDE54.7090709@schinagl.nl> <52521F5B.4090002@schinagl.nl> <20131015091241.48901e5c@lilith> <1381859853.7979.696.camel@snotra.buserror.net> <20131017082748.06618979@lilith> <52607AF9.7050302@schinagl.nl> <1382114601.7979.843.camel@snotra <5261BF4E.9070301@schinagl.nl> <1382138723.7979.928.camel@snotra.buserror.net> <1382138758.7979.929.camel@snotra.buserror.net> Message-ID: <52624F14.5040907@schinagl.nl> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 10/19/13 01:25, Scott Wood wrote: > On Fri, 2013-10-18 at 18:25 -0500, Scott Wood wrote: >> On Sat, 2013-10-19 at 01:07 +0200, Oliver Schinagl wrote: >>> On 10/18/13 18:43, Scott Wood wrote: >>>> On Fri, 2013-10-18 at 02:04 +0200, Oliver Schinagl wrote: >>>>> So now that that's settled, anything fundamentally wrong with my patch? :) >>>> >>>> Did you see my other mail in this thread? This patch is sort of OK for >>> Sorry I did and I got distracted from it. >>> >>>> raising the get_ram_size() limit from 1 GiB to 2 GiB (with an increased >>>> risk of false positives from I/O), but it can't go beyond that on >>> I'd ask 'how so' but I'm not sure I'd understand anyway ;) >> >> Do you mean why it can't go beyond 2 GiB? The next address to probe >> after 0x8000_0000 would be 0x1_0000_0000 which is beyond what can be >> addressed in a 32-bit environment. I suppose you could return 4 GiB if >> 0x8000_0000 tests OK, but nothing beyond that. You'd need a larger >> datatype than "unsigned long" if you want to return 4 GiB, though. > > Oh, and if you actually had 4 GiB of RAM mapped in a 32-bit environment, > where would I/O go? Well you need 4 GiB of address-space don't you? If you have 2 GiB of ram, the other 2 GiB is used as register-space isn't it. So to support 2 GiB of ram you need 4 GiB of address sapce. Granted having more then 2 GiB of ram is highly unlikly as you probably can't get ramsizes that would fit. But the bug exists with 2 GiB, get_ram_size in its current form, which triggered me into fixing it. get_ram_size reports negative ram on our 2 GiB board. Obviously incidentally it doesn't hugely matter because ramsize = get_ram_size(); you put a long inside an unsigned long and it gets automagically fixed. My point was simply get_ram_size is bugged, it cramps signed long into an unsigned long, and I tried to fix that. A side effect is that upto 4 GiB of address space is fixed. :) Oliver > > -Scott > > >