Module Name: src
Committed By: riastradh
Date: Thu Jun 12 18:46:32 UTC 2014
Modified Files:
src/sys/dev/pci: agp_i810.c agpreg.h
Log Message:
Get GTT size from PGTBL_CTL on G4X chipsets.
To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/pci/agp_i810.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/agpreg.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/agp_i810.c
diff -u src/sys/dev/pci/agp_i810.c:1.102 src/sys/dev/pci/agp_i810.c:1.103
--- src/sys/dev/pci/agp_i810.c:1.102 Thu Jun 12 18:41:46 2014
+++ src/sys/dev/pci/agp_i810.c Thu Jun 12 18:46:32 2014
@@ -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 @@ agp_i810_init(struct agp_softc *sc)
}
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);
Index: src/sys/dev/pci/agpreg.h
diff -u src/sys/dev/pci/agpreg.h:1.21 src/sys/dev/pci/agpreg.h:1.22
--- src/sys/dev/pci/agpreg.h:1.21 Fri May 23 22:58:56 2014
+++ src/sys/dev/pci/agpreg.h Thu Jun 12 18:46:32 2014
@@ -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