From owner-svn-src-all@FreeBSD.ORG Tue Nov 2 13:04:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57A00106564A; Tue, 2 Nov 2010 13:04:26 +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 2BD548FC1B; Tue, 2 Nov 2010 13:04:26 +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 oA2D4QQk047495; Tue, 2 Nov 2010 13:04:26 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA2D4QEB047493; Tue, 2 Nov 2010 13:04:26 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011021304.oA2D4QEB047493@svn.freebsd.org> From: John Baldwin Date: Tue, 2 Nov 2010 13:04:26 +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: r214676 - head/sys/x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 13:04:26 -0000 Author: jhb Date: Tue Nov 2 13:04:25 2010 New Revision: 214676 URL: http://svn.freebsd.org/changeset/base/214676 Log: Skip SMAP regions above 4GB on i386 since they will not fit into a long. While here, update some comments to better explain the new code flow. Tested by: dhw Modified: head/sys/x86/x86/nexus.c Modified: head/sys/x86/x86/nexus.c ============================================================================== --- head/sys/x86/x86/nexus.c Tue Nov 2 13:00:56 2010 (r214675) +++ head/sys/x86/x86/nexus.c Tue Nov 2 13:04:25 2010 (r214676) @@ -694,15 +694,24 @@ ram_attach(device_t dev) if (smap->type != SMAP_TYPE_MEMORY || smap->length == 0) continue; +#ifdef __i386__ + /* + * Resources use long's to track resources, so + * we can't include memory regions above 4GB. + */ + if (smap->base >= ~0ul) + break; +#endif error = bus_set_resource(dev, SYS_RES_MEMORY, rid, smap->base, smap->length); if (error) - panic("ram_attach: resource %d failed set with %d", + 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", + panic("ram_attach: resource %d failed to attach", rid); rid++; } @@ -710,19 +719,17 @@ ram_attach(device_t dev) } /* - * We use the dump_avail[] array rather than phys_avail[] for - * the memory map as phys_avail[] contains holes for kernel - * memory, page 0, the message buffer, and the dcons buffer. - * We test the end address in the loop instead of the start - * since the start address for the first segment is 0. - * - * XXX: It would be preferable to use the SMAP if it exists - * instead since if the SMAP is very fragmented we may not - * include some memory regions in dump_avail[] and phys_avail[]. + * If the system map is not available, fall back to using + * dump_avail[]. We use the dump_avail[] array rather than + * phys_avail[] for the memory map as phys_avail[] contains + * holes for kernel memory, page 0, the message buffer, and + * the dcons buffer. We test the end address in the loop + * 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 PAE +#ifdef __i386__ /* * Resources use long's to track resources, so we can't * include memory regions above 4GB.