From owner-svn-src-head@FreeBSD.ORG Tue Nov 2 17:56:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F158C106566C; Tue, 2 Nov 2010 17:56:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C58E18FC0C; Tue, 2 Nov 2010 17:56:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA2HuGw1073486; Tue, 2 Nov 2010 17:56:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2HuGWd073483; Tue, 2 Nov 2010 17:56:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011021756.oA2HuGWd073483@svn.freebsd.org> From: John Baldwin Date: Tue, 2 Nov 2010 17:56:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214681 - in head/sys: i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 17:56:17 -0000 Author: jhb Date: Tue Nov 2 17:56:16 2010 New Revision: 214681 URL: http://svn.freebsd.org/changeset/base/214681 Log: Further tweaks to the ram_attach() routine: - Use > 2^32 - 1 instead of >= when checking for memory regions above 4G. - Skip SMAP entries > 4G on i386 rather than breaking out of the loop since SMAP entries are not guaranteed to be in order. - Remove 'i' and loop over 'rid' directly in the dump_avail[] case. - Only check for 4G regions in the dump_avail[] case on i386 if PAE is enabled since vm_paddr_t is 32-bit in the !PAE case. Submitted by: alc Modified: head/sys/i386/i386/machdep.c head/sys/x86/x86/nexus.c Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Tue Nov 2 17:00:56 2010 (r214680) +++ head/sys/i386/i386/machdep.c Tue Nov 2 17:56:16 2010 (r214681) @@ -1970,7 +1970,7 @@ add_smap_entry(struct bios_smap *smap, v return (1); #ifndef PAE - if (smap->base >= 0xffffffff) { + if (smap->base > 0xffffffff) { printf("%uK of memory above 4GB ignored\n", (u_int)(smap->length / 1024)); return (1); Modified: head/sys/x86/x86/nexus.c ============================================================================== --- head/sys/x86/x86/nexus.c Tue Nov 2 17:00:56 2010 (r214680) +++ head/sys/x86/x86/nexus.c Tue Nov 2 17:56:16 2010 (r214681) @@ -674,7 +674,7 @@ ram_attach(device_t dev) vm_paddr_t *p; caddr_t kmdp; uint32_t smapsize; - int error, i, rid; + int error, rid; /* Retrieve the system memory map from the loader. */ kmdp = preload_search_by_type("elf kernel"); @@ -699,8 +699,8 @@ ram_attach(device_t dev) * Resources use long's to track resources, so * we can't include memory regions above 4GB. */ - if (smap->base >= ~0ul) - break; + if (smap->base > ~0ul) + continue; #endif error = bus_set_resource(dev, SYS_RES_MEMORY, rid, smap->base, smap->length); @@ -727,24 +727,23 @@ ram_attach(device_t dev) * instead of the start since the start address for the first * segment is 0. */ - for (i = 0, p = dump_avail; p[1] != 0; i++, p += 2) { - rid = i; -#ifdef __i386__ + for (rid = 0, p = dump_avail; p[1] != 0; rid++, p += 2) { +#if defined(__i386__) && defined(PAE) /* * Resources use long's to track resources, so we can't * include memory regions above 4GB. */ - if (p[0] >= ~0ul) + if (p[0] > ~0ul) break; #endif error = bus_set_resource(dev, SYS_RES_MEMORY, rid, p[0], p[1] - p[0]); if (error) - panic("ram_attach: resource %d failed set with %d", i, + panic("ram_attach: resource %d failed set with %d", rid, error); res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0); if (res == NULL) - panic("ram_attach: resource %d failed to attach", i); + panic("ram_attach: resource %d failed to attach", rid); } return (0); }