From owner-freebsd-mips@FreeBSD.ORG Thu Mar 10 02:43:40 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 1CB131065670 for ; Thu, 10 Mar 2011 02:43:40 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id C49608FC0A for ; Thu, 10 Mar 2011 02:43:39 +0000 (UTC) Received: by vxc34 with SMTP id 34so1313766vxc.13 for ; Wed, 09 Mar 2011 18:43:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:date:x-google-sender-auth :message-id:subject:from:to:content-type; bh=TjOtYnd82hiDMlprcOv/dvAcfTws52FhZHIzQdicWuQ=; b=amFuW3cswEStCkLNoNV8WBCvyNx9phUrnjZLmHL+AegGWyEbqC5HJW/okMIRCZ635r 4icjH/B7gx23Lfc8aO7N3rFkJtby1FvuyWVasFuLA+oLz4QeLjEdeMKUX6J7GitbpKmQ Zi1VFHZoFmXcoW5zk62Y6kCbl8DZGMZfGiOTc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=CqN9DM2UA0HYWFZmUQRl9ZT2eWycDK2jXmRioxDcHYLHZoh6kUI3wouoIE1dsQqu6x VYAwgZq0S5mEA8/93S8UWiUZsTWnXv0OzcFWCxH4pIB72KPW5tP4SKWJ+v2NU6x3n0eG PCuw+9KKNbinOAVS2Ey7F8pI2B1+Iuly/eoTA= MIME-Version: 1.0 Received: by 10.52.97.99 with SMTP id dz3mr4682541vdb.267.1299724991173; Wed, 09 Mar 2011 18:43:11 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.52.70.17 with HTTP; Wed, 9 Mar 2011 18:43:11 -0800 (PST) Date: Thu, 10 Mar 2011 10:43:11 +0800 X-Google-Sender-Auth: 7fAPguAMJ4pXPfoc16NaTQE2eDo Message-ID: From: Adrian Chadd To: freebsd-mips@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: 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 02:43:40 -0000 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? :) Thanks, Adrian Index: conf/options =================================================================== --- conf/options (revision 219395) +++ conf/options (working copy) @@ -30,6 +30,9 @@ # If filename is missing, the default is # opt_.h +# A temporary workaround for where redboot lies +MIPS_REALMEM opt_global.h + AAC_DEBUG opt_aac.h AHC_ALLOW_MEMIO opt_aic7xxx.h AHC_TMODE_ENABLE opt_aic7xxx.h Index: mips/atheros/ar71xx_machdep.c =================================================================== --- mips/atheros/ar71xx_machdep.c (revision 219395) +++ mips/atheros/ar71xx_machdep.c (working copy) @@ -180,6 +180,11 @@ if (realmem == 0) realmem = btoc(32*1024*1024); + /* Allow build-time override in case Redboot lies */ +#if defined(MIPS_REALMEM) + realmem = btoc(MIPS_REALMEM); +#endif + /* phys_avail regions are in bytes */ phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end); phys_avail[1] = ctob(realmem); [adrian@pcbsd-3114 /data/freebsd/mips/head/src/sys]$