CVS commit: [riastradh-drm2] src/sys/dev/pci

2014-03-05 Thread Taylor R Campbell
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 

CVS commit: [riastradh-drm2] src/sys/dev/pci

2014-03-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  5 22:18:19 UTC 2014

Modified Files:
src/sys/dev/pci [riastradh-drm2]: agp_i810.c agp_i810var.h

Log Message:
Expose agp_i810_write_gtt_entry for drm2.

Also add an agp_i810_post_gtt_entry to do a posting read for that GTT
entry.


To generate a diff of this commit:
cvs rdiff -u -r1.73.26.1 -r1.73.26.2 src/sys/dev/pci/agp_i810.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 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.26.1 src/sys/dev/pci/agp_i810.c:1.73.26.2
--- src/sys/dev/pci/agp_i810.c:1.73.26.1	Wed Mar  5 14:42:40 2014
+++ src/sys/dev/pci/agp_i810.c	Wed Mar  5 22:18:19 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.73.26.1 2014/03/05 14:42:40 riastradh Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.73.26.2 2014/03/05 22:18:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.73.26.1 2014/03/05 14:42:40 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.73.26.2 2014/03/05 22:18:19 riastradh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -87,8 +87,6 @@ static bool agp_i810_resume(device_t, co
 static int agp_i810_init(struct agp_softc *);
 
 static int agp_i810_init(struct agp_softc *);
-static int agp_i810_write_gtt_entry(struct agp_i810_softc *, off_t,
-bus_addr_t);
 
 static struct agp_methods agp_i810_methods = {
 	agp_i810_get_aperture,
@@ -103,7 +101,7 @@ static struct agp_methods agp_i810_metho
 	agp_i810_unbind_memory,
 };
 
-static int
+int
 agp_i810_write_gtt_entry(struct agp_i810_softc *isc, off_t off, bus_addr_t v)
 {
 	u_int32_t pte;
@@ -157,6 +155,35 @@ agp_i810_write_gtt_entry(struct agp_i810
 	return 0;
 }
 
+void
+agp_i810_post_gtt_entry(struct agp_i810_softc *isc, off_t off)
+{
+	bus_size_t base_off, wroff;
+
+	base_off = 0;
+	wroff = (off  AGP_PAGE_SHIFT) * 4;
+
+	switch (isc-chiptype) {
+	case CHIP_I810:
+	case CHIP_I830:
+	case CHIP_I855:
+		base_off = AGP_I810_GTT;
+		break;
+	case CHIP_I965:
+		base_off = AGP_I965_GTT;
+		break;
+	case CHIP_G4X:
+		base_off = AGP_G4X_GTT;
+		break;
+	case CHIP_I915:
+	case CHIP_G33:
+		(void)bus_space_read_4(isc-gtt_bst, isc-gtt_bsh, wroff);
+		return;
+	}
+
+	(void)READ4(base_off + wroff);
+}
+
 /* XXXthorpej -- duplicated code (see arch/x86/pci/pchb.c) */
 static int
 agp_i810_vgamatch(const struct pci_attach_args *pa)

Index: src/sys/dev/pci/agp_i810var.h
diff -u src/sys/dev/pci/agp_i810var.h:1.1.2.1 src/sys/dev/pci/agp_i810var.h:1.1.2.2
--- src/sys/dev/pci/agp_i810var.h:1.1.2.1	Wed Mar  5 14:42:40 2014
+++ src/sys/dev/pci/agp_i810var.h	Wed Mar  5 22:18:19 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810var.h,v 1.1.2.1 2014/03/05 14:42:40 riastradh Exp $	*/
+/*	$NetBSD: agp_i810var.h,v 1.1.2.2 2014/03/05 22:18:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -51,3 +51,6 @@ struct agp_i810_softc {
 };
 
 extern struct agp_softc	*agp_i810_sc;
+
+int	agp_i810_write_gtt_entry(struct agp_i810_softc *, off_t, bus_addr_t);
+void	agp_i810_post_gtt_entry(struct agp_i810_softc *, off_t);



CVS commit: [riastradh-drm2] src/sys/dev/wscons

2014-01-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jan 30 17:18:51 UTC 2014

Modified Files:
src/sys/dev/wscons [riastradh-drm2]: wsdisplay_vcons.c

Log Message:
Make wsdisplay_vcons likelier to be modularizable too.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.28.4.1 src/sys/dev/wscons/wsdisplay_vcons.c

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/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.28 src/sys/dev/wscons/wsdisplay_vcons.c:1.28.4.1
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.28	Tue May 28 11:04:04 2013
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Thu Jan 30 17:18:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.28 2013/05/28 11:04:04 macallan Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.28.4.1 2014/01/30 17:18:51 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.28 2013/05/28 11:04:04 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.28.4.1 2014/01/30 17:18:51 riastradh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -51,9 +51,11 @@ __KERNEL_RCSID(0, $NetBSD: wsdisplay_vc
 
 #include dev/wscons/wsdisplay_vconsvar.h
 
+#ifdef _KERNEL_OPT
 #include opt_wsemul.h
 #include opt_wsdisplay_compat.h
 #include opt_vcons.h
+#endif
 
 static void vcons_dummy_init_screen(void *, struct vcons_screen *, int, 
 	long *);



CVS commit: [riastradh-drm2] src/sys/dev/wsfb

2014-01-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jan 29 19:48:45 UTC 2014

Modified Files:
src/sys/dev/wsfb [riastradh-drm2]: genfb.c

Log Message:
Make genfb replay the msgbuf only if it's becoming the console.


To generate a diff of this commit:
cvs rdiff -u -r1.50.8.1 -r1.50.8.2 src/sys/dev/wsfb/genfb.c

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/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.50.8.1 src/sys/dev/wsfb/genfb.c:1.50.8.2
--- src/sys/dev/wsfb/genfb.c:1.50.8.1	Wed Jan 29 19:48:29 2014
+++ src/sys/dev/wsfb/genfb.c	Wed Jan 29 19:48:45 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.50.8.1 2014/01/29 19:48:29 riastradh Exp $ */
+/*	$NetBSD: genfb.c,v 1.50.8.2 2014/01/29 19:48:45 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.50.8.1 2014/01/29 19:48:29 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.50.8.2 2014/01/29 19:48:45 riastradh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -317,7 +317,8 @@ genfb_attach(struct genfb_softc *sc, str
 	}
 #else
 	genfb_init_palette(sc);
-	vcons_replay_msgbuf(sc-sc_console_screen);
+	if (console)
+		vcons_replay_msgbuf(sc-sc_console_screen);
 #endif
 
 	if (genfb_softc == NULL)



CVS commit: [riastradh-drm2] src/sys/dev/wsfb

2014-01-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jan 29 19:48:29 UTC 2014

Modified Files:
src/sys/dev/wsfb [riastradh-drm2]: genfb.c

Log Message:
Make genfb_attach configure the wsemuldisplaydev attribute.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.50.8.1 src/sys/dev/wsfb/genfb.c

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/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.50 src/sys/dev/wsfb/genfb.c:1.50.8.1
--- src/sys/dev/wsfb/genfb.c:1.50	Thu Jan 10 22:06:59 2013
+++ src/sys/dev/wsfb/genfb.c	Wed Jan 29 19:48:29 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.50 2013/01/10 22:06:59 jmcneill Exp $ */
+/*	$NetBSD: genfb.c,v 1.50.8.1 2014/01/29 19:48:29 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.50 2013/01/10 22:06:59 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.50.8.1 2014/01/29 19:48:29 riastradh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -333,7 +333,8 @@ genfb_attach(struct genfb_softc *sc, str
 		SCREEN_DISABLE_DRAWING(sc-sc_console_screen);
 #endif
 
-	config_found(sc-sc_dev, aa, wsemuldisplaydevprint);
+	config_found_ia(sc-sc_dev, wsemuldisplaydev, aa,
+	wsemuldisplaydevprint);
 
 	return 0;
 }



CVS commit: [riastradh-drm2] src/sys/dev

2014-01-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jan 29 19:52:12 UTC 2014

Modified Files:
src/sys/dev/wscons [riastradh-drm2]: wsdisplay_vconsvar.h
src/sys/dev/wsfb [riastradh-drm2]: genfb.c genfbvar.h

Log Message:
Make genfb a little friendlier to modules.

This is not enough to make it actually work as a module itself, but
it's enough to make the i915drm module use genfb.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.8.1 src/sys/dev/wscons/wsdisplay_vconsvar.h
cvs rdiff -u -r1.50.8.2 -r1.50.8.3 src/sys/dev/wsfb/genfb.c
cvs rdiff -u -r1.21 -r1.21.24.1 src/sys/dev/wsfb/genfbvar.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/wscons/wsdisplay_vconsvar.h
diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.22 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.22.8.1
--- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.22	Sun Jan 27 03:59:09 2013
+++ src/sys/dev/wscons/wsdisplay_vconsvar.h	Wed Jan 29 19:52:11 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vconsvar.h,v 1.22 2013/01/27 03:59:09 macallan Exp $ */
+/*	$NetBSD: wsdisplay_vconsvar.h,v 1.22.8.1 2014/01/29 19:52:11 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -29,8 +29,10 @@
 #ifndef _WSDISPLAY_VCONS_H_
 #define _WSDISPLAY_VCONS_H_
 
+#ifdef _KERNEL_OPT
 #include opt_wsdisplay_compat.h
 #include opt_vcons.h
+#endif
 
 struct vcons_data;
 

Index: src/sys/dev/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.50.8.2 src/sys/dev/wsfb/genfb.c:1.50.8.3
--- src/sys/dev/wsfb/genfb.c:1.50.8.2	Wed Jan 29 19:48:45 2014
+++ src/sys/dev/wsfb/genfb.c	Wed Jan 29 19:52:11 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.50.8.2 2014/01/29 19:48:45 riastradh Exp $ */
+/*	$NetBSD: genfb.c,v 1.50.8.3 2014/01/29 19:52:11 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.50.8.2 2014/01/29 19:48:45 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.50.8.3 2014/01/29 19:52:11 riastradh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -55,8 +55,10 @@ __KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.
 		AB_VERBOSE | AB_DEBUG) )
 #endif
 
+#ifdef _KERNEL_OPT
 #include opt_genfb.h
 #include opt_wsfb.h
+#endif
 
 #ifdef GENFB_DEBUG
 #define GPRINTF panic

Index: src/sys/dev/wsfb/genfbvar.h
diff -u src/sys/dev/wsfb/genfbvar.h:1.21 src/sys/dev/wsfb/genfbvar.h:1.21.24.1
--- src/sys/dev/wsfb/genfbvar.h:1.21	Wed Jul 13 22:47:29 2011
+++ src/sys/dev/wsfb/genfbvar.h	Wed Jan 29 19:52:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfbvar.h,v 1.21 2011/07/13 22:47:29 macallan Exp $ */
+/*	$NetBSD: genfbvar.h,v 1.21.24.1 2014/01/29 19:52:12 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,12 +27,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: genfbvar.h,v 1.21 2011/07/13 22:47:29 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: genfbvar.h,v 1.21.24.1 2014/01/29 19:52:12 riastradh Exp $);
 
 #ifndef GENFBVAR_H
 #define GENFBVAR_H
 
+#ifdef _KERNEL_OPT
 #include opt_splash.h
+#endif
 
 #include sys/param.h
 #include sys/buf.h
@@ -46,7 +48,9 @@ __KERNEL_RCSID(0, $NetBSD: genfbvar.h,v
 #include dev/rasops/rasops.h
 
 #include dev/wscons/wsdisplay_vconsvar.h
+#ifdef _KERNEL_OPT
 #include opt_genfb.h
+#endif
 
 #ifdef SPLASHSCREEN
 #define GENFB_DISABLE_TEXT