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
This commit is contained in:
parent
aaaf515fde
commit
e11379e9f8
@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <vm/vm_pageout.h>
|
#include <vm/vm_pageout.h>
|
||||||
#include <vm/pmap.h>
|
#include <vm/pmap.h>
|
||||||
|
|
||||||
#include <machine/md_var.h>
|
|
||||||
#include <machine/bus.h>
|
#include <machine/bus.h>
|
||||||
#include <machine/resource.h>
|
#include <machine/resource.h>
|
||||||
#include <sys/rman.h>
|
#include <sys/rman.h>
|
||||||
@ -234,7 +233,7 @@ agp_generic_attach(device_t dev)
|
|||||||
* Work out an upper bound for agp memory allocation. This
|
* Work out an upper bound for agp memory allocation. This
|
||||||
* uses a heurisitc table from the Linux driver.
|
* uses a heurisitc table from the Linux driver.
|
||||||
*/
|
*/
|
||||||
memsize = ptoa(Maxmem) >> 20;
|
memsize = ptoa(realmem) >> 20;
|
||||||
for (i = 0; i < agp_max_size; i++) {
|
for (i = 0; i < agp_max_size; i++) {
|
||||||
if (memsize <= agp_max[i][0])
|
if (memsize <= agp_max[i][0])
|
||||||
break;
|
break;
|
||||||
|
@ -74,7 +74,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include <machine/bus.h>
|
#include <machine/bus.h>
|
||||||
#include <machine/resource.h>
|
#include <machine/resource.h>
|
||||||
#include <machine/md_var.h>
|
|
||||||
#include <sys/rman.h>
|
#include <sys/rman.h>
|
||||||
|
|
||||||
MALLOC_DECLARE(M_AGP);
|
MALLOC_DECLARE(M_AGP);
|
||||||
@ -1439,7 +1438,7 @@ agp_i810_attach(device_t dev)
|
|||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
if (ptoa((vm_paddr_t)Maxmem) >
|
if (ptoa((vm_paddr_t)realmem) >
|
||||||
(1ULL << sc->match->driver->busdma_addr_mask_sz) - 1) {
|
(1ULL << sc->match->driver->busdma_addr_mask_sz) - 1) {
|
||||||
device_printf(dev, "agp_i810 does not support physical "
|
device_printf(dev, "agp_i810 does not support physical "
|
||||||
"memory above %ju.\n", (uintmax_t)(1ULL <<
|
"memory above %ju.\n", (uintmax_t)(1ULL <<
|
||||||
|
Loading…
Reference in New Issue
Block a user