Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Fix bogus vdir offset calculation.



details:   https://anonhg.NetBSD.org/src/rev/3efae42674fb
branches:  trunk
changeset: 515670:3efae42674fb
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Mon Oct 01 14:41:09 2001 +0000

description:
Fix bogus vdir offset calculation.

diffstat:

 sys/dev/pci/agp_amd.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 6c2f6171afcd -r 3efae42674fb sys/dev/pci/agp_amd.c
--- a/sys/dev/pci/agp_amd.c     Mon Oct 01 12:02:07 2001 +0000
+++ b/sys/dev/pci/agp_amd.c     Mon Oct 01 14:41:09 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agp_amd.c,v 1.3 2001/09/16 03:42:12 thorpej Exp $      */
+/*     $NetBSD: agp_amd.c,v 1.4 2001/10/01 14:41:09 fvdl Exp $ */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -99,6 +99,7 @@
        u_int32_t entries = apsize >> AGP_PAGE_SHIFT;
        struct agp_amd_gatt *gatt;
        int i, npages;
+       caddr_t vdir;
 
        gatt = malloc(sizeof(struct agp_amd_gatt), M_AGP, M_NOWAIT);
        if (!gatt)
@@ -106,14 +107,15 @@
 
        if (agp_alloc_dmamem(sc->as_dmat,
            AGP_PAGE_SIZE + entries * sizeof(u_int32_t), 0,
-           &gatt->ag_dmamap, (caddr_t *)&gatt->ag_vdir, &gatt->ag_pdir,
+           &gatt->ag_dmamap, (caddr_t *)&vdir, &gatt->ag_pdir,
            &gatt->ag_dmaseg, 1, &gatt->ag_nseg) != 0) {
                printf("failed to allocate GATT\n");
                return NULL;
        }
 
+       gatt->ag_vdir = (u_int32_t *)vdir;
        gatt->ag_entries = entries;
-       gatt->ag_virtual = gatt->ag_vdir + AGP_PAGE_SIZE;
+       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);
 



Home | Main Index | Thread Index | Old Index