summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2010-03-28 13:22:08 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2010-03-28 13:22:08 +0000
commit6b64249eb7edb0b757eaccba866e783735b2cb77 (patch)
tree12cbd3e8b84d77d1f1c35080ee922cf20ce4e5b1 /sys/dev/pci
parenta1fb7db67753590020570d81289407e56dde5853 (diff)
Don't assign the same value to gatt->ag_size twice, also use ag_size in
a later calculation instead of doing it *again* pointed out by miod quite some time ago.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/agp_amd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sys/dev/pci/agp_amd.c b/sys/dev/pci/agp_amd.c
index 58d0d582648..9fb2126ed92 100644
--- a/sys/dev/pci/agp_amd.c
+++ b/sys/dev/pci/agp_amd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_amd.c,v 1.13 2009/05/10 16:57:44 oga Exp $ */
+/* $OpenBSD: agp_amd.c,v 1.14 2010/03/28 13:22:07 oga Exp $ */
/* $NetBSD: agp_amd.c,v 1.6 2001/10/06 02:48:50 thorpej Exp $ */
/*-
@@ -133,13 +133,11 @@ agp_amd_alloc_gatt(bus_dma_tag_t dmat, bus_size_t apsize)
gatt->ag_entries = entries;
gatt->ag_virtual = (u_int32_t *)(vdir + AGP_PAGE_SIZE);
gatt->ag_physical = gatt->ag_pdir + AGP_PAGE_SIZE;
- gatt->ag_size = AGP_PAGE_SIZE + entries * sizeof(u_int32_t);
/*
* Map the pages of the GATT into the page directory.
*/
- npages = ((entries * sizeof(u_int32_t) + AGP_PAGE_SIZE - 1)
- >> AGP_PAGE_SHIFT);
+ npages = ((gatt->ag_size - 1) >> AGP_PAGE_SHIFT);
for (i = 0; i < npages; i++)
gatt->ag_vdir[i] = (gatt->ag_physical + i * AGP_PAGE_SIZE) | 1;