From owner-freebsd-mips@FreeBSD.ORG Thu Mar 10 09:12:23 2011 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B32A106566B; Thu, 10 Mar 2011 09:12:23 +0000 (UTC) (envelope-from ray@dlink.ua) Received: from dlink.ua (smtp.dlink.ua [193.138.187.146]) by mx1.freebsd.org (Postfix) with ESMTP id 25BDC8FC13; Thu, 10 Mar 2011 09:12:21 +0000 (UTC) Received: from gw-lan1.kiev.dlink.ua ([192.168.10.10] helo=terran.dlink.ua) by dlink.ua with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1PxbQJ-0006ro-3P; Thu, 10 Mar 2011 10:40:43 +0200 Date: Thu, 10 Mar 2011 10:40:38 +0200 From: Aleksandr Rybalko To: "Jayachandran C." Message-Id: <20110310104038.b67b3c5b.ray@dlink.ua> In-Reply-To: References: Organization: D-Link X-Mailer: Sylpheed 2.7.1 (GTK+ 2.20.1; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-mips@freebsd.org Subject: Re: What to do when redboot lies about RAM? X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Mar 2011 09:12:23 -0000 On Thu, 10 Mar 2011 08:41:08 +0530 "Jayachandran C." wrote: >> On Thu, Mar 10, 2011 at 8:13 AM, Adrian Chadd wrote: >> > One of the Ubiquiti boards (LS-SR71) has redboot firmware that seems to lie >> > about the amount of RAM it has. >> > >> > Although the board has 32 megabytes of RAM, Redboot only reports 16mb. Linux >> > doesn't query redboot; it probes the amount of RAM by writing bits and >> > reading them back until it finds where that fails. >> > >> > I've whacked together a quick hack to make this memory selection overridable >> > in the kernel configuration. >> > What would be the cleaner way? :) >> >> Sibyte (mips/sibyte/sb_machdep.c) has a tunable hw.physmem for this. >> That has an advantage that you do not have to re-compile the kernel to >> change the memory setting. >> >> There is also a MAXMEM option already in conf/options.mips which can >> be used I think... >> >> JC. >> _______________________________________________ >> freebsd-mips@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-mips >> To unsubscribe, send any mail to "freebsd-mips-unsubscribe@freebsd.org" Hi there, for that case will be nice to have (and use) some fallback variable in nvram/U-Boot env. something like realmem_override. Also we can use realmem testing algorithm: 1. backup uint32 in some place of minimum memory size (think 8M) 2. write some unique signature in that place 3. for (i = 8M; place < sdram_window_size; i <<= 1) if (*(i + place) == signature) { *place = ~signature; if (*(i + place) == ~signature) { printf("Found memory \"address wire\" alias, realmem=%08x\n", i); break; } /* Restore signature */ *place = signature; } -- Alexandr Rybalko aka Alex RAY