From owner-freebsd-mips@FreeBSD.ORG Thu Mar 10 02:41:53 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 CEB98106566B for ; Thu, 10 Mar 2011 02:41:53 +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 83BAA8FC13 for ; Thu, 10 Mar 2011 02:41:53 +0000 (UTC) Received: by vxc34 with SMTP id 34so1312281vxc.13 for ; Wed, 09 Mar 2011 18:41:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=10uhMucfJDIs0DYet/zNOpsptlzrgemQtiuBTu/TCMk=; b=a5QNY7Jt8heV9U0kX8h1qyW1NJi1rT+LVDh9sBgmYEhyO8ASUg9vLJA/46dXxRwYD3 zTaSyKz1UKczv5dKruDhImAcLK+8f4N88L2Dl9YT+uy6LcJ8qMp9VgSHYFVQrTKne9R4 MJPEsXvFtd0ktXOn+Sj8RB8//rP0Spn6KEufk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Vupn9J+hsXH8Nz4Wi/gqKwVX9wL0QlWoCNenPraOWTMDYeKNfIKJsy5YAnkjuzeJ/t rRh19iRMwA0+WBYOL8Bg6/E2idOwp2gAZpql8+n5n2bxlP5R/u+d4Lykhkc/xqy8J4Ep /1U8J00gXd4OZKyYSdoeEW7yDVUAjHHIPaGmc= MIME-Version: 1.0 Received: by 10.52.0.9 with SMTP id 9mr5029254vda.147.1299724912744; Wed, 09 Mar 2011 18:41:52 -0800 (PST) Received: by 10.52.70.17 with HTTP; Wed, 9 Mar 2011 18:41:52 -0800 (PST) Date: Thu, 10 Mar 2011 10:41:52 +0800 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 REALMEM? 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:41:53 -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]$