Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Get GTT size from PGTBL_CTL on G4X chipsets.



details:   https://anonhg.NetBSD.org/src/rev/4bdf8ab2983c
branches:  trunk
changeset: 329870:4bdf8ab2983c
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Jun 12 18:46:32 2014 +0000

description:
Get GTT size from PGTBL_CTL on G4X chipsets.

diffstat:

 sys/dev/pci/agp_i810.c |  30 +++++++++++++++++++++++++++---
 sys/dev/pci/agpreg.h   |  10 +++++++++-
 2 files changed, 36 insertions(+), 4 deletions(-)

diffs (75 lines):

diff -r 24733286212e -r 4bdf8ab2983c sys/dev/pci/agp_i810.c
--- a/sys/dev/pci/agp_i810.c    Thu Jun 12 18:46:12 2014 +0000
+++ b/sys/dev/pci/agp_i810.c    Thu Jun 12 18:46:32 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agp_i810.c,v 1.102 2014/06/12 18:41:46 riastradh Exp $ */
+/*     $NetBSD: agp_i810.c,v 1.103 2014/06/12 18:46:32 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.102 2014/06/12 18:41:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.103 2014/06/12 18:46:32 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -844,7 +844,31 @@
                        }
                        break;
                case CHIP_G4X:
-                       gtt_size = 256;
+                       switch (isc->pgtblctl & AGP_G4X_PGTBL_SIZE_MASK) {
+                       case AGP_G4X_PGTBL_SIZE_512K:
+                               gtt_size = 512;
+                               break;
+                       case AGP_G4X_PGTBL_SIZE_256K:
+                               gtt_size = 256;
+                               break;
+                       case AGP_G4X_PGTBL_SIZE_128K:
+                               gtt_size = 128;
+                               break;
+                       case AGP_G4X_PGTBL_SIZE_1M:
+                               gtt_size = 1*1024;
+                               break;
+                       case AGP_G4X_PGTBL_SIZE_2M:
+                               gtt_size = 2*1024;
+                               break;
+                       case AGP_G4X_PGTBL_SIZE_1_5M:
+                               gtt_size = 1*1024 + 512;
+                               break;
+                       default:
+                               aprint_error_dev(sc->as_dev,
+                                   "bad PGTBL size\n");
+                               error = ENXIO;
+                               goto fail0;
+                       }
                        break;
                default:
                        panic("impossible chiptype %d", isc->chiptype);
diff -r 24733286212e -r 4bdf8ab2983c sys/dev/pci/agpreg.h
--- a/sys/dev/pci/agpreg.h      Thu Jun 12 18:46:12 2014 +0000
+++ b/sys/dev/pci/agpreg.h      Thu Jun 12 18:46:32 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agpreg.h,v 1.21 2014/05/23 22:58:56 riastradh Exp $    */
+/*     $NetBSD: agpreg.h,v 1.22 2014/06/12 18:46:32 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -286,6 +286,14 @@
 
 #define AGP_G4X_GTT                    (2*1024*1024)
 
+#define        AGP_G4X_PGTBL_SIZE_MASK         0x0000000e
+#define        AGP_G4X_PGTBL_SIZE_512K         (0 << 1)
+#define        AGP_G4X_PGTBL_SIZE_256K         (1 << 1)
+#define        AGP_G4X_PGTBL_SIZE_128K         (2 << 1)
+#define        AGP_G4X_PGTBL_SIZE_1M           (3 << 1)
+#define        AGP_G4X_PGTBL_SIZE_2M           (4 << 1)
+#define        AGP_G4X_PGTBL_SIZE_1_5M         (5 << 1)
+
 #define AGP_G4X_GCC1_GMS_STOLEN_96M    0xa0
 #define AGP_G4X_GCC1_GMS_STOLEN_160M   0xb0
 #define AGP_G4X_GCC1_GMS_STOLEN_224M   0xc0



Home | Main Index | Thread Index | Old Index