From 7bf36164a7555ca377b8c193554850b308d4efa5 Mon Sep 17 00:00:00 2001 From: jym Date: Wed, 24 Feb 2010 00:01:11 +0000 Subject: - Use ctob() instead of ptoa() to obtain physical addresses from frame numbers. Using ptoa() will cast to vaddr_t, which might no be adequate for architectures where sizeof(paddr_t) > sizeof(vaddr_t) (like i386 PAE). - small fix inside AGP heuristics to avoid masking high order bits for systems with more than 4GB. Reviewed by bouyer@. See also http://mail-index.netbsd.org/tech-kern/2010/02/22/msg007373.html --- sys/dev/pci/agp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/pci/agp.c b/sys/dev/pci/agp.c index 0e07125cd55..c05d6a2d6dd 100644 --- a/sys/dev/pci/agp.c +++ b/sys/dev/pci/agp.c @@ -1,4 +1,4 @@ -/* $NetBSD: agp.c,v 1.66 2010/01/08 19:56:51 dyoung Exp $ */ +/* $NetBSD: agp.c,v 1.67 2010/02/24 00:01:11 jym Exp $ */ /*- * Copyright (c) 2000 Doug Rabson @@ -65,7 +65,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: agp.c,v 1.66 2010/01/08 19:56:51 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: agp.c,v 1.67 2010/02/24 00:01:11 jym Exp $"); #include #include @@ -327,7 +327,7 @@ agpattach(device_t parent, device_t self, void *aux) * Work out an upper bound for agp memory allocation. This * uses a heuristic table from the Linux driver. */ - memsize = ptoa(physmem) >> 20; + memsize = physmem >> (20 - PAGE_SHIFT); /* memsize is in MB */ for (i = 0; i < agp_max_size; i++) { if (memsize <= agp_max[i][0]) break; -- cgit