From: Wolfgang Denk Date: Fri, 02 Apr 2004 10:29:43 +0200 Subject: [U-Boot-Users] memsize.c patch In-Reply-To: Your message of "Fri, 02 Apr 2004 13:08:50 +0900." <000c01c41868$34814910$212d4cdc@smkim> Message-ID: <20040402082948.0F205C109F@atlas.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de In message <000c01c41868$34814910$212d4cdc@smkim> you wrote: > > When get_ram_size(common/memsize.c) is called on a MPC8245 board which has > 256MB SDRAM, booting stops. > This is because the function tries to read outside BAT boundary. This is intentional. You can only find out how much mempory is installed when you test beyound the end - otrherwise there might be more memory, right? You must map more memory, then. > This patch fixes the problem. > I tested it on our board(board/etin/debris). But it breaks many other boards. > for (cnt = 1; cnt < maxsize / sizeof (long); cnt <<= 1) { > addr = base + cnt; /* pointer arith! */ > - val = *addr; > - *addr = save[--i]; > - if (val != ~cnt) { > + if (addr < maxsize) { > + val = *addr; > + *addr = save[--i]; > + } Just a simple question: what happens if base != 0 ? Rejected. Wolfgang Denk -- Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de An armed society is a polite society.