From owner-svn-src-head@FreeBSD.ORG Fri Jul 6 15:57:04 2012 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 9BCA41065675; Fri, 6 Jul 2012 15:57:04 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6EEDF8FC22; Fri, 6 Jul 2012 15:57:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q66Fv46P069467; Fri, 6 Jul 2012 15:57:04 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q66Fv45N069464; Fri, 6 Jul 2012 15:57:04 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201207061557.q66Fv45N069464@svn.freebsd.org> From: Marcel Moolenaar Date: Fri, 6 Jul 2012 15:57:04 +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: r238172 - head/sys/dev/agp 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: Fri, 06 Jul 2012 15:57:04 -0000 Author: marcel Date: Fri Jul 6 15:57:03 2012 New Revision: 238172 URL: http://svn.freebsd.org/changeset/base/238172 Log: agp.c: Don't use Maxmem when the amount of memory is meant. Use realmem instead. Maxmem is not only a MD variable, it represents the highest physical memory address in use. On systems where memory is sparsely layed-out the highest memory address and the amount of memory are not interchangeable. Scaling the AGP aperture based on the actual amount of memory (= realmem) rather than the available memory (= physmem) makes sure there's consistent behaviour across architectures. agp_i810.c: While arguably the use of Maxmem can be considered correct, replace its use with realmem anyway. agp_i810.c is specific to amd64, i386 & pc98, which have a dense physical memory layout. Avoiding Maxmem here is done with an eye on copy-n-paste behaviour in general and to avoid confusion caused by using realmem in agp.c and Maxmem in agp_i810.c. In both cases, remove the inclusion of md_var.h Modified: head/sys/dev/agp/agp.c head/sys/dev/agp/agp_i810.c Modified: head/sys/dev/agp/agp.c ============================================================================== --- head/sys/dev/agp/agp.c Fri Jul 6 15:46:38 2012 (r238171) +++ head/sys/dev/agp/agp.c Fri Jul 6 15:57:03 2012 (r238172) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -234,7 +233,7 @@ agp_generic_attach(device_t dev) * Work out an upper bound for agp memory allocation. This * uses a heurisitc table from the Linux driver. */ - memsize = ptoa(Maxmem) >> 20; + memsize = ptoa(realmem) >> 20; for (i = 0; i < agp_max_size; i++) { if (memsize <= agp_max[i][0]) break; Modified: head/sys/dev/agp/agp_i810.c ============================================================================== --- head/sys/dev/agp/agp_i810.c Fri Jul 6 15:46:38 2012 (r238171) +++ head/sys/dev/agp/agp_i810.c Fri Jul 6 15:57:03 2012 (r238172) @@ -74,7 +74,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include MALLOC_DECLARE(M_AGP); @@ -1439,7 +1438,7 @@ agp_i810_attach(device_t dev) if (error) return (error); - if (ptoa((vm_paddr_t)Maxmem) > + if (ptoa((vm_paddr_t)realmem) > (1ULL << sc->match->driver->busdma_addr_mask_sz) - 1) { device_printf(dev, "agp_i810 does not support physical " "memory above %ju.\n", (uintmax_t)(1ULL <<