Source-Changes-HG archive

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

[src/riastradh-drm2]: src/sys/dev/pci Expose the agp_i810 softc.



details:   https://anonhg.NetBSD.org/src/rev/2f1e66134a4c
branches:  riastradh-drm2
changeset: 788643:2f1e66134a4c
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Mar 05 14:42:40 2014 +0000

description:
Expose the agp_i810 softc.

This is an Intel-specific kludge so that i915drmkms can get at the
GTT, graphics translation table, for pre-Sandy Bridge Intel graphics
devices.

diffstat:

 sys/dev/pci/agp_i810.c    |  34 +++++++++++++----------------
 sys/dev/pci/agp_i810var.h |  53 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 19 deletions(-)

diffs (136 lines):

diff -r 09bbdd272a90 -r 2f1e66134a4c sys/dev/pci/agp_i810.c
--- a/sys/dev/pci/agp_i810.c    Wed Mar 05 14:42:27 2014 +0000
+++ b/sys/dev/pci/agp_i810.c    Wed Mar 05 14:42:40 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agp_i810.c,v 1.73 2011/04/04 20:37:56 dyoung Exp $     */
+/*     $NetBSD: agp_i810.c,v 1.73.26.1 2014/03/05 14:42:40 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -26,11 +26,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *     $FreeBSD: src/sys/pci/agp_i810.c,v 1.4 2001/07/05 21:28:47 jhb Exp $
+ *     $FreeBSD$
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.73 2011/04/04 20:37:56 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.73.26.1 2014/03/05 14:42:40 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -45,6 +45,7 @@
 #include <dev/pci/pcidevs.h>
 #include <dev/pci/agpvar.h>
 #include <dev/pci/agpreg.h>
+#include <dev/pci/agp_i810var.h>
 
 #include <sys/agpio.h>
 
@@ -52,6 +53,8 @@
 
 #include "agp_intel.h"
 
+struct agp_softc *agp_i810_sc = NULL;
+
 #define READ1(off)     bus_space_read_1(isc->bst, isc->bsh, off)
 #define READ4(off)     bus_space_read_4(isc->bst, isc->bsh, off)
 #define WRITE4(off,v)  bus_space_write_4(isc->bst, isc->bsh, off, v)
@@ -64,22 +67,6 @@
 #define CHIP_G33  5    /* G33/Q33/Q35 */
 #define CHIP_G4X  6    /* G45/Q45 */
 
-struct agp_i810_softc {
-       u_int32_t initial_aperture;     /* aperture size at startup */
-       struct agp_gatt *gatt;
-       int chiptype;                   /* i810-like or i830 */
-       u_int32_t dcache_size;          /* i810 only */
-       u_int32_t stolen;               /* number of i830/845 gtt entries
-                                          for stolen memory */
-       bus_space_tag_t bst;            /* register bus_space tag */
-       bus_space_handle_t bsh;         /* register bus_space handle */
-       bus_space_tag_t gtt_bst;        /* GTT bus_space tag */
-       bus_space_handle_t gtt_bsh;     /* GTT bus_space handle */
-       struct pci_attach_args vga_pa;
-
-       u_int32_t pgtblctl;
-};
-
 /* XXX hack, see below */
 static bus_addr_t agp_i810_vga_regbase;
 static bus_space_handle_t agp_i810_vga_bsh;
@@ -676,6 +663,15 @@
         */
        agp_flush_cache();
 
+       /*
+        * Publish what we found for kludgey drivers (I'm looking at
+        * you, drm).
+        */
+       if (agp_i810_sc == NULL)
+               agp_i810_sc = sc;
+       else
+               aprint_error_dev(sc->as_dev, "i810 agp already attached\n");
+
        return 0;
 }
 
diff -r 09bbdd272a90 -r 2f1e66134a4c sys/dev/pci/agp_i810var.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/agp_i810var.h Wed Mar 05 14:42:40 2014 +0000
@@ -0,0 +1,53 @@
+/*     $NetBSD: agp_i810var.h,v 1.1.2.1 2014/03/05 14:42:40 riastradh Exp $    */
+
+/*-
+ * Copyright (c) 2000 Doug Rabson
+ * Copyright (c) 2000 Ruslan Ermilov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <sys/bus.h>
+
+#include <dev/pci/pcivar.h>
+
+#include <dev/pci/agpvar.h>
+
+struct agp_i810_softc {
+       u_int32_t initial_aperture;     /* aperture size at startup */
+       struct agp_gatt *gatt;
+       int chiptype;                   /* i810-like or i830 */
+       u_int32_t dcache_size;          /* i810 only */
+       u_int32_t stolen;               /* number of i830/845 gtt entries
+                                          for stolen memory */
+       bus_space_tag_t bst;            /* register bus_space tag */
+       bus_space_handle_t bsh;         /* register bus_space handle */
+       bus_space_tag_t gtt_bst;        /* GTT bus_space tag */
+       bus_space_handle_t gtt_bsh;     /* GTT bus_space handle */
+       struct pci_attach_args vga_pa;
+
+       u_int32_t pgtblctl;
+};
+
+extern struct agp_softc        *agp_i810_sc;



Home | Main Index | Thread Index | Old Index