Module Name: src
Committed By: riastradh
Date: Wed Mar 5 14:42:41 UTC 2014
Modified Files:
src/sys/dev/pci [riastradh-drm2]: agp_i810.c
Added Files:
src/sys/dev/pci [riastradh-drm2]: agp_i810var.h
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.73.26.1 src/sys/dev/pci/agp_i810.c
cvs rdiff -u -r0 -r1.1.2.1 src/sys/dev/pci/agp_i810var.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.73 src/sys/dev/pci/agp_i810.c:1.73.26.1
--- src/sys/dev/pci/agp_i810.c:1.73 Mon Apr 4 20:37:56 2011
+++ src/sys/dev/pci/agp_i810.c Wed Mar 5 14:42:40 2014
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v
#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 @@ __KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v
#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 @@ __KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v
#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 @@ static int agp_i810_init(struct agp_soft
*/
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;
}
Added files:
Index: src/sys/dev/pci/agp_i810var.h
diff -u /dev/null src/sys/dev/pci/agp_i810var.h:1.1.2.1
--- /dev/null Wed Mar 5 14:42:41 2014
+++ src/sys/dev/pci/agp_i810var.h Wed Mar 5 14:42:40 2014
@@ -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;