CVS commit: src/sys/dev/usb

2013-09-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep  8 06:37:23 UTC 2013

Modified Files:
src/sys/dev/usb: uhci.c

Log Message:
Add sc-sc_bus.use_polling || to a couple of KASSERTs

PR/46826


To generate a diff of this commit:
cvs rdiff -u -r1.258 -r1.259 src/sys/dev/usb/uhci.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/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.258 src/sys/dev/usb/uhci.c:1.259
--- src/sys/dev/usb/uhci.c:1.258	Sat Sep  7 16:17:12 2013
+++ src/sys/dev/usb/uhci.c	Sun Sep  8 06:37:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.258 2013/09/07 16:17:12 skrll Exp $	*/
+/*	$NetBSD: uhci.c,v 1.259 2013/09/08 06:37:23 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.258 2013/09/07 16:17:12 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.259 2013/09/08 06:37:23 skrll Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1528,7 +1528,7 @@ uhci_idone(uhci_intr_info_t *ii)
 	u_int32_t status = 0, nstatus;
 	int actlen;
 
-	KASSERT(mutex_owned(sc-sc_lock));
+	KASSERT(sc-sc_bus.use_polling || mutex_owned(sc-sc_lock));
 
 	DPRINTFN(12, (uhci_idone: ii=%p\n, ii));
 #ifdef DIAGNOSTIC
@@ -1649,7 +1649,7 @@ uhci_idone(uhci_intr_info_t *ii)
 
  end:
 	usb_transfer_complete(xfer);
-	KASSERT(mutex_owned(sc-sc_lock));
+	KASSERT(sc-sc_bus.use_polling || mutex_owned(sc-sc_lock));
 	DPRINTFN(12, (uhci_idone: ii=%p done\n, ii));
 }
 



CVS commit: src/etc

2013-09-08 Thread Patrick Welche
Module Name:src
Committed By:   prlw1
Date:   Sun Sep  8 08:19:40 UTC 2013

Modified Files:
src/etc: daily security

Log Message:
Add defaults for pkg_info and pkg_admin variables in case pkgpath.conf
is not installed.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/etc/daily
cvs rdiff -u -r1.112 -r1.113 src/etc/security

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/daily
diff -u src/etc/daily:1.89 src/etc/daily:1.90
--- src/etc/daily:1.89	Wed May  1 05:36:25 2013
+++ src/etc/daily	Sun Sep  8 08:19:40 2013
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#	$NetBSD: daily,v 1.89 2013/05/01 05:36:25 agc Exp $
+#	$NetBSD: daily,v 1.90 2013/09/08 08:19:40 prlw1 Exp $
 #	@(#)daily	8.2 (Berkeley) 1/25/94
 #
 
@@ -18,6 +18,9 @@ host=$(hostname)
 date=$(date)
 rcvar_manpage='daily.conf(5)'
 
+pkg_admin=${pkg_admin:-/usr/sbin/pkg_admin}
+pkg_info=${pkg_info:-/usr/sbin/pkg_info}
+
 echo To: ${MAILTO:-root}
 echo Subject: $host daily output for $date
 echo 

Index: src/etc/security
diff -u src/etc/security:1.112 src/etc/security:1.113
--- src/etc/security:1.112	Wed May  1 05:36:25 2013
+++ src/etc/security	Sun Sep  8 08:19:40 2013
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#	$NetBSD: security,v 1.112 2013/05/01 05:36:25 agc Exp $
+#	$NetBSD: security,v 1.113 2013/09/08 08:19:40 prlw1 Exp $
 #	from: @(#)security	8.1 (Berkeley) 6/9/93
 #
 
@@ -30,6 +30,7 @@ fi
 backup_dir=${backup_dir:-/var/backups}
 max_loginlen=${max_loginlen:-8}
 max_grouplen=${max_grouplen:-8}
+pkg_admin=${pkg_admin:-/usr/sbin/pkg_admin}
 pkg_info=${pkg_info:-/usr/sbin/pkg_info}
 
 # Other configurable variables



CVS commit: src/sys/arch/arm/allwinner

2013-09-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  8 10:32:56 UTC 2013

Modified Files:
src/sys/arch/arm/allwinner: awin_board.c

Log Message:
Use correct offset for PLL6 register.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/allwinner/awin_board.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/arch/arm/allwinner/awin_board.c
diff -u src/sys/arch/arm/allwinner/awin_board.c:1.4 src/sys/arch/arm/allwinner/awin_board.c:1.5
--- src/sys/arch/arm/allwinner/awin_board.c:1.4	Sat Sep  7 02:09:23 2013
+++ src/sys/arch/arm/allwinner/awin_board.c	Sun Sep  8 10:32:56 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_board.c,v 1.4 2013/09/07 02:09:23 matt Exp $	*/
+/*	$NetBSD: awin_board.c,v 1.5 2013/09/08 10:32:56 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_board.c,v 1.4 2013/09/07 02:09:23 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_board.c,v 1.5 2013/09/08 10:32:56 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -195,7 +195,8 @@ awin_pll6_enable(void)
 	/*
 	 * SATA needs PLL6 to be a 100MHz clock.
 	 */
-	const uint32_t ocfg = bus_space_read_4(bst, bsh, AWIN_PLL6_CFG_REG);
+	const uint32_t ocfg = bus_space_read_4(bst, bsh,
+	AWIN_CCM_OFFSET + AWIN_PLL6_CFG_REG);
 	const u_int k = __SHIFTOUT(ocfg, AWIN_PLL_CFG_FACTOR_K);
 
 	/*
@@ -208,6 +209,7 @@ awin_pll6_enable(void)
 	ncfg |= __SHIFTIN(25, AWIN_PLL_CFG_FACTOR_N);
 	ncfg |= AWIN_PLL_CFG_ENABLE | AWIN_PLL6_CFG_SATA_CLK_EN;
 	if (ncfg != ocfg) {
-		bus_space_write_4(bst, bsh, AWIN_PLL6_CFG_REG, ncfg);
+		bus_space_write_4(bst, bsh,
+		AWIN_CCM_OFFSET + AWIN_PLL6_CFG_REG, ncfg);
 	}
 }



CVS commit: src/sys/arch/arm/allwinner

2013-09-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  8 10:43:51 UTC 2013

Modified Files:
src/sys/arch/arm/allwinner: awin_ahcisata.c

Log Message:
correct a typo in the reg name polled while waiting for phy calibration


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/allwinner/awin_ahcisata.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/arch/arm/allwinner/awin_ahcisata.c
diff -u src/sys/arch/arm/allwinner/awin_ahcisata.c:1.6 src/sys/arch/arm/allwinner/awin_ahcisata.c:1.7
--- src/sys/arch/arm/allwinner/awin_ahcisata.c:1.6	Sun Sep  8 04:07:45 2013
+++ src/sys/arch/arm/allwinner/awin_ahcisata.c	Sun Sep  8 10:43:51 2013
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_ahcisata.c,v 1.6 2013/09/08 04:07:45 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_ahcisata.c,v 1.7 2013/09/08 10:43:51 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -132,7 +132,7 @@ awin_ahci_phy_init(struct awin_ahci_soft
 		timeout = 1000;
 		do {
 			delay(10);
-			v = bus_space_read_4(bst, bsh, AWIN_AHCI_PHYCS0R_REG);
+			v = bus_space_read_4(bst, bsh, AWIN_AHCI_PHYCS2R_REG);
 		} while (--timeout  (v  __BIT(24)));
 
 		if (!timeout) {



CVS commit: src/sys/dev/ic

2013-09-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Sep  8 11:19:48 UTC 2013

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
If there is only 1 port, don't say 1 ports.
Add a debug printf after reading the active ports.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/ic/ahcisata_core.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/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.48 src/sys/dev/ic/ahcisata_core.c:1.49
--- src/sys/dev/ic/ahcisata_core.c:1.48	Sat Jun 22 05:41:25 2013
+++ src/sys/dev/ic/ahcisata_core.c	Sun Sep  8 11:19:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.48 2013/06/22 05:41:25 matt Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.49 2013/09/08 11:19:47 matt Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ahcisata_core.c,v 1.48 2013/06/22 05:41:25 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ahcisata_core.c,v 1.49 2013/09/08 11:19:47 matt Exp $);
 
 #include sys/types.h
 #include sys/malloc.h
@@ -259,9 +259,11 @@ ahci_attach(struct ahci_softc *sc)
 			b\037S64A\0
 			\0, sc-sc_ahci_cap);
 	aprint_normal_dev(sc-sc_atac.atac_dev, AHCI revision %u.%u
-	, %d ports, %d slots, CAP %s\n,
+	, %d port%s, %d slot%s, CAP %s\n,
 	AHCI_VS_MJR(ahci_rev), AHCI_VS_MNR(ahci_rev),
-	sc-sc_atac.atac_nchannels, sc-sc_ncmds, buf);
+	sc-sc_atac.atac_nchannels,
+	(sc-sc_atac.atac_nchannels == 1 ?  : s), 
+	sc-sc_ncmds, (sc-sc_ncmds == 1 ?  : s), buf);
 
 	sc-sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DMA | ATAC_CAP_UDMA;
 	sc-sc_atac.atac_cap |= sc-sc_atac_capflags;
@@ -312,6 +314,7 @@ ahci_attach(struct ahci_softc *sc)
 	ahci_enable_intrs(sc);
 
 	ahci_ports = AHCI_READ(sc, AHCI_PI);
+	AHCIDEBUG_PRINT((active ports %#x\n, ahci_ports), DEBUG_PROBE);
 	for (i = 0, port = 0; i  AHCI_MAX_PORTS; i++) {
 		if ((ahci_ports  (1  i)) == 0)
 			continue;



CVS commit: src/sys/dev/ic

2013-09-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Sep  8 11:47:16 UTC 2013

Modified Files:
src/sys/dev/ic: ahcisata_core.c ahcisatavar.h

Log Message:
Allow the attachment to override ahci_ports.
Keep ACHI_PI cached in the softc.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/ahcisatavar.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/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.49 src/sys/dev/ic/ahcisata_core.c:1.50
--- src/sys/dev/ic/ahcisata_core.c:1.49	Sun Sep  8 11:19:47 2013
+++ src/sys/dev/ic/ahcisata_core.c	Sun Sep  8 11:47:16 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.49 2013/09/08 11:19:47 matt Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.50 2013/09/08 11:47:16 matt Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ahcisata_core.c,v 1.49 2013/09/08 11:19:47 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ahcisata_core.c,v 1.50 2013/09/08 11:47:16 matt Exp $);
 
 #include sys/types.h
 #include sys/malloc.h
@@ -144,12 +144,10 @@ ahci_reset(struct ahci_softc *sc)
 static void
 ahci_setup_ports(struct ahci_softc *sc)
 {
-	uint32_t ahci_ports;
 	int i, port;
 	
-	ahci_ports = AHCI_READ(sc, AHCI_PI);
 	for (i = 0, port = 0; i  AHCI_MAX_PORTS; i++) {
-		if ((ahci_ports  (1  i)) == 0)
+		if ((sc-sc_ahci_ports  (1  i)) == 0)
 			continue;
 		if (port = sc-sc_atac.atac_nchannels) {
 			aprint_error(%s: more ports than announced\n,
@@ -163,14 +161,12 @@ ahci_setup_ports(struct ahci_softc *sc)
 static void
 ahci_reprobe_drives(struct ahci_softc *sc)
 {
-	uint32_t ahci_ports;
 	int i, port;
 	struct ahci_channel *achp;
 	struct ata_channel *chp;
 
-	ahci_ports = AHCI_READ(sc, AHCI_PI);
 	for (i = 0, port = 0; i  AHCI_MAX_PORTS; i++) {
-		if ((ahci_ports  (1  i)) == 0)
+		if ((sc-sc_ahci_ports  (1  i)) == 0)
 			continue;
 		if (port = sc-sc_atac.atac_nchannels) {
 			aprint_error(%s: more ports than announced\n,
@@ -210,7 +206,7 @@ ahci_enable_intrs(struct ahci_softc *sc)
 void
 ahci_attach(struct ahci_softc *sc)
 {
-	uint32_t ahci_rev, ahci_ports;
+	uint32_t ahci_rev;
 	int i, j, port;
 	struct ahci_channel *achp;
 	struct ata_channel *chp;
@@ -313,10 +309,13 @@ ahci_attach(struct ahci_softc *sc)
 
 	ahci_enable_intrs(sc);
 
-	ahci_ports = AHCI_READ(sc, AHCI_PI);
-	AHCIDEBUG_PRINT((active ports %#x\n, ahci_ports), DEBUG_PROBE);
+	if (sc-sc_ahci_ports == 0) {
+		sc-sc_ahci_ports = AHCI_READ(sc, AHCI_PI);
+		AHCIDEBUG_PRINT((active ports %#x\n, sc-sc_ahci_ports),
+		DEBUG_PROBE);
+	}
 	for (i = 0, port = 0; i  AHCI_MAX_PORTS; i++) {
-		if ((ahci_ports  (1  i)) == 0)
+		if ((sc-sc_ahci_ports  (1  i)) == 0)
 			continue;
 		if (port = sc-sc_atac.atac_nchannels) {
 			aprint_error(%s: more ports than announced\n,
@@ -438,19 +437,17 @@ ahci_detach(struct ahci_softc *sc, int f
 	struct ahci_channel *achp;
 	struct ata_channel *chp;
 	struct scsipi_adapter *adapt;
-	uint32_t ahci_ports;
 	int i, j;
 	int error;
 
 	atac = sc-sc_atac;
 	adapt = atac-atac_atapi_adapter._generic;
 
-	ahci_ports = AHCI_READ(sc, AHCI_PI);
 	for (i = 0; i  AHCI_MAX_PORTS; i++) {
 		achp = sc-sc_channels[i];
 		chp = achp-ata_channel;
 
-		if ((ahci_ports  (1  i)) == 0)
+		if ((sc-sc_ahci_ports  (1  i)) == 0)
 			continue;
 		if (i = sc-sc_atac.atac_nchannels) {
 			aprint_error(%s: more ports than announced\n,

Index: src/sys/dev/ic/ahcisatavar.h
diff -u src/sys/dev/ic/ahcisatavar.h:1.14 src/sys/dev/ic/ahcisatavar.h:1.15
--- src/sys/dev/ic/ahcisatavar.h:1.14	Thu Sep 20 17:53:48 2012
+++ src/sys/dev/ic/ahcisatavar.h	Sun Sep  8 11:47:16 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisatavar.h,v 1.14 2012/09/20 17:53:48 matt Exp $	*/
+/*	$NetBSD: ahcisatavar.h,v 1.15 2013/09/08 11:47:16 matt Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -62,6 +62,7 @@ struct ahci_softc {
 
 	uint32_t sc_ahci_cap;	/* copy of AHCI_CAP */
 	int sc_ncmds; /* number of command slots */
+	uint32_t sc_ahci_ports;
 	struct ata_channel *sc_chanarray[AHCI_MAX_PORTS];
 	struct ahci_channel {
 		struct ata_channel ata_channel; /* generic part */



CVS commit: src/sys/arch/arm/allwinner

2013-09-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Sep  8 11:47:50 UTC 2013

Modified Files:
src/sys/arch/arm/allwinner: awin_ahcisata.c

Log Message:
Set the ACHI port mask since the h/w is broken.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/allwinner/awin_ahcisata.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/arch/arm/allwinner/awin_ahcisata.c
diff -u src/sys/arch/arm/allwinner/awin_ahcisata.c:1.7 src/sys/arch/arm/allwinner/awin_ahcisata.c:1.8
--- src/sys/arch/arm/allwinner/awin_ahcisata.c:1.7	Sun Sep  8 10:43:51 2013
+++ src/sys/arch/arm/allwinner/awin_ahcisata.c	Sun Sep  8 11:47:50 2013
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_ahcisata.c,v 1.7 2013/09/08 10:43:51 jmcneill Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_ahcisata.c,v 1.8 2013/09/08 11:47:50 matt Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -180,6 +180,7 @@ awin_ahci_attach(device_t parent, device
 	sc-sc_dmat = aio-aio_dmat;
 	sc-sc_ahcit = aio-aio_core_bst;
 	sc-sc_ahcis = loc-loc_size;
+	sc-sc_ahci_ports = 1;
 
 	bus_space_subregion(aio-aio_core_bst, aio-aio_core_bsh,
 	loc-loc_offset, loc-loc_size, sc-sc_ahcih);



CVS commit: src/lib/libc/arch/arm/misc

2013-09-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Sep  8 12:11:56 UTC 2013

Modified Files:
src/lib/libc/arch/arm/misc: arm_initfini.c

Log Message:
Detect presence of hardware divide.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/arm/misc/arm_initfini.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/arm/misc/arm_initfini.c
diff -u src/lib/libc/arch/arm/misc/arm_initfini.c:1.5 src/lib/libc/arch/arm/misc/arm_initfini.c:1.6
--- src/lib/libc/arch/arm/misc/arm_initfini.c:1.5	Mon Aug 19 22:14:37 2013
+++ src/lib/libc/arch/arm/misc/arm_initfini.c	Sun Sep  8 12:11:56 2013
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__RCSID($NetBSD: arm_initfini.c,v 1.5 2013/08/19 22:14:37 matt Exp $);
+__RCSID($NetBSD: arm_initfini.c,v 1.6 2013/09/08 12:11:56 matt Exp $);
 
 #include namespace.h
 
@@ -47,6 +47,7 @@ __RCSID($NetBSD: arm_initfini.c,v 1.5 2
 #include stddef.h
 
 __dso_hidden int _libc_arm_fpu_present;
+__dso_hidden int _libc_arm_hwdiv_present;
 static bool _libc_aapcs_initialized;
 
 void	_libc_aapcs_init(void) __attribute__((__constructor__, __used__));
@@ -59,5 +60,7 @@ _libc_aapcs_init(void)
 		_libc_aapcs_initialized = true;
 		(void)sysctlbyname(machdep.fpu_present,
 		_libc_arm_fpu_present, len, NULL, 0);
+		(void)sysctlbyname(machdep.hwdiv_present,
+		_libc_arm_hwdiv_present, len, NULL, 0);
 	}
 }



CVS commit: src/sys/conf

2013-09-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  8 12:51:14 UTC 2013

Modified Files:
src/sys/conf: files

Log Message:
defparam ATADEBUG_MASK


To generate a diff of this commit:
cvs rdiff -u -r1.1078 -r1.1079 src/sys/conf/files

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1078 src/sys/conf/files:1.1079
--- src/sys/conf/files:1.1078	Sat Jul 27 07:02:03 2013
+++ src/sys/conf/files	Sun Sep  8 12:51:14 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1078 2013/07/27 07:02:03 kiyohara Exp $
+#	$NetBSD: files,v 1.1079 2013/09/08 12:51:14 jmcneill Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20100430
@@ -956,8 +956,9 @@ define	ata_udma
 define	ata_piobm
 device	wdc: ata, wdc_common
 
-defflag	opt_ata.h	ATADEBUG
-defflag	opt_wdc.h	WDC_NO_IDS
+defflag opt_ata.h	ATADEBUG
+defparam opt_ata.h	ATADEBUG_MASK
+defflag opt_wdc.h	WDC_NO_IDS
 
 device	atabus: atapi,ata_hl
 attach	atabus at ata



CVS commit: src/lib/libc/arch/arm/misc

2013-09-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Sep  8 13:15:54 UTC 2013

Modified Files:
src/lib/libc/arch/arm/misc: arm_initfini.c

Log Message:
detect whether hw divide is present.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/arm/misc/arm_initfini.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/arm/misc/arm_initfini.c
diff -u src/lib/libc/arch/arm/misc/arm_initfini.c:1.6 src/lib/libc/arch/arm/misc/arm_initfini.c:1.7
--- src/lib/libc/arch/arm/misc/arm_initfini.c:1.6	Sun Sep  8 12:11:56 2013
+++ src/lib/libc/arch/arm/misc/arm_initfini.c	Sun Sep  8 13:15:53 2013
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 
-__RCSID($NetBSD: arm_initfini.c,v 1.6 2013/09/08 12:11:56 matt Exp $);
+__RCSID($NetBSD: arm_initfini.c,v 1.7 2013/09/08 13:15:53 matt Exp $);
 
 #include namespace.h
 
@@ -47,7 +47,9 @@ __RCSID($NetBSD: arm_initfini.c,v 1.6 2
 #include stddef.h
 
 __dso_hidden int _libc_arm_fpu_present;
+#ifndef __ARM_ARCH_EXT_IDIV__
 __dso_hidden int _libc_arm_hwdiv_present;
+#endif
 static bool _libc_aapcs_initialized;
 
 void	_libc_aapcs_init(void) __attribute__((__constructor__, __used__));
@@ -60,7 +62,9 @@ _libc_aapcs_init(void)
 		_libc_aapcs_initialized = true;
 		(void)sysctlbyname(machdep.fpu_present,
 		_libc_arm_fpu_present, len, NULL, 0);
+#ifndef __ARM_ARCH_EXT_IDIV__
 		(void)sysctlbyname(machdep.hwdiv_present,
 		_libc_arm_hwdiv_present, len, NULL, 0);
+#endif
 	}
 }



CVS commit: src/common/lib/libc/arch/arm/gen

2013-09-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Sep  8 13:24:16 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/gen: divsi3.S udivsi3.S

Log Message:
Support using hwdiv instructions if those are available.
But only for EABI.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/common/lib/libc/arch/arm/gen/divsi3.S
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/arm/gen/udivsi3.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libc/arch/arm/gen/divsi3.S
diff -u src/common/lib/libc/arch/arm/gen/divsi3.S:1.9 src/common/lib/libc/arch/arm/gen/divsi3.S:1.10
--- src/common/lib/libc/arch/arm/gen/divsi3.S:1.9	Thu Sep  5 05:16:08 2013
+++ src/common/lib/libc/arch/arm/gen/divsi3.S	Sun Sep  8 13:24:16 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: divsi3.S,v 1.9 2013/09/05 05:16:08 matt Exp $	*/
+/*	$NetBSD: divsi3.S,v 1.10 2013/09/08 13:24:16 matt Exp $	*/
 
 /*
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
@@ -16,7 +16,11 @@
 
 #include machine/asm.h
 
+#if defined(__thumb__)  !defined(_ARM_ARCH_T2)
+ARM_ENTRY(__divsi3)
+#else
 ENTRY(__divsi3)
+#endif
 #if defined(__ARM_ARCH_EXT_IDIV__)
 # if defined(__ARM_EABI__)
 	mov	r3, r0		@ save for mls
@@ -26,25 +30,38 @@ ENTRY(__divsi3)
 	mls	r1, r0, r1, r3	@ return modulus in r1
 # endif
 	RET
-#elif !defined(__thumb__) || defined(_ARM_ARCH_T2)
-	b	__divide
+#elif defined(__ARM_EABI__)  defined(_LIBC)
+#ifdef _ARM_ARCH_7
+	movw	r2, #:lower16:REL_SYM(__libc_arm_hwdiv_present, .LPIC0)
+	movt	r2, #:upper16:REL_SYM(__libc_arm_hwdiv_present, .LPIC0)
 #else
-#if defined(__ARM_EABI__)  defined(__UNWIND_TABLES__)
-	.fnstart
-	.cfi_startproc
-#endif
-	push	{r4, lr}
-#if defined(__ARM_EABI__)  defined(__UNWIND_TABLES__)
-	.cfi_def_cfa_offset 8
-	.cfi_offset 14, -4
-	.cfi_offset 4, -8
-#endif
-	bl	__divide
-	pop	{r4, pc}
-#if defined(__ARM_EABI__)  defined(__UNWIND_TABLES__)
-	.cfi_endproc
-	.fnend
+	ldr	r2, .Lhwdiv_present
 #endif
+# ifdef PIC
+	add	r2, r2, pc
+# endif
+	ldr	r2, [r2]
+.LPIC0:	cmp	r2, #0
+	beq	__divide
+	mov	r3, r0
+#if defined(__ARM_ARCH_EXT_IDIV__)
+	sdiv	r0, r0, r1
+	mls	r1, r0, r1, r3	/* return modulus in r1 */
+#elif defined(__thumb__)  defined(_ARM_ARCH_T2)
+	.inst.w	0xfb90f0f1
+	.inst.w	0xfb003111
+#else
+	.inst	0xe710f110
+	.inst	0xe0613190
+#endif
+	RET
+#ifndef _ARM_ARCH_7
+	.align	0
+.Lhwdiv_present:
+	.word	REL_SYM(__libc_arm_hwdiv_present, .LPIC0)
+#endif
+#else /* !__ARM_EABI__ */
+	b	__divide
 #endif
 END(__divsi3)
 

Index: src/common/lib/libc/arch/arm/gen/udivsi3.S
diff -u src/common/lib/libc/arch/arm/gen/udivsi3.S:1.5 src/common/lib/libc/arch/arm/gen/udivsi3.S:1.6
--- src/common/lib/libc/arch/arm/gen/udivsi3.S:1.5	Thu Sep  5 05:16:08 2013
+++ src/common/lib/libc/arch/arm/gen/udivsi3.S	Sun Sep  8 13:24:16 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: udivsi3.S,v 1.5 2013/09/05 05:16:08 matt Exp $	*/
+/*	$NetBSD: udivsi3.S,v 1.6 2013/09/08 13:24:16 matt Exp $	*/
 
 /*
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
@@ -16,7 +16,11 @@
 
 #include machine/asm.h
 
+#if defined(__ARM_EABI__)  defined(__thumb__)  !defined(_ARM_ARCH_T2)
+ARM_ENTRY(__udivsi3)
+#else
 ENTRY(__udivsi3)
+#endif
 #if defined(__ARM_ARCH_EXT_IDIV__)
 # if defined(__ARM_EABI__)
 	mov	r3, r0		@ save for mls
@@ -26,26 +30,38 @@ ENTRY(__udivsi3)
 	mls	r1, r0, r1, r3	@ return modulus in r1
 # endif
 	RET
-#elif !defined(__thumb__) || defined(_ARM_ARCH_T2)
-	b	__udivide
+#elif defined(__ARM_EABI__)  defined(_LIBC)
+#ifdef _ARM_ARCH_7
+	movw	r2, #:lower16:REL_SYM(__libc_arm_hwdiv_present, .LPIC0)
+	movt	r2, #:upper16:REL_SYM(__libc_arm_hwdiv_present, .LPIC0)
+#else
+	ldr	r2, .Lhwdiv_present
+#endif
+#ifdef PIC
+	add	r2, r2, pc
+#endif
+	ldr	r2, [r2]
+.LPIC0:	cmp	r2, #0
+	beq	__udivide
+	mov	r3, r0
+#if defined(__ARM_ARCH_EXT_IDIV__)
+	udiv	r0, r0, r1
+	mls	r1, r0, r1, r3	/* return modulus in r1 */
+#elif defined(__thumb__)  defined(_ARM_ARCH_T2)
+	.inst.w 0xfbb0f0f1
+	.inst.w	0xfb003111
 #else
-#if defined(__ARM_EABI__)  defined(__UNWIND_TABLES__)
-	.fnstart
-	.cfi_startproc
-#endif
-	push	{r4, lr}
-#if defined(__ARM_EABI__)  defined(__UNWIND_TABLES__)
-	.save	{r4, lr}
-	.cfi_def_cfa_offset 8
-	.cfi_offset 14, -4
-	.cfi_offset 4, -8
-#endif
-	bl	__udivide
-	pop	{r4, pc}
-#if defined(__ARM_EABI__)  defined(__UNWIND_TABLES__)
-	.cfi_endproc
-	.fnend
+	.inst	0xe730f110
+	.inst	0xe0613190
+#endif
+	RET
+#ifndef _ARM_ARCH_7
+	.align 0
+.Lhwdiv_present:
+	.word	REL_SYM(__libc_arm_hwdiv_present, .LPIC0)
 #endif
+#else
+	b	__udivide
 #endif
 END(__udivsi3)
 



CVS commit: src/sbin/dump

2013-09-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Sep  8 13:26:05 UTC 2013

Modified Files:
src/sbin/dump: main.c optr.c

Log Message:
Fix handling of NAME aliases in /etc/fstab.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sbin/dump/main.c
cvs rdiff -u -r1.41 -r1.42 src/sbin/dump/optr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/dump/main.c
diff -u src/sbin/dump/main.c:1.70 src/sbin/dump/main.c:1.71
--- src/sbin/dump/main.c:1.70	Sat Jun 15 01:27:19 2013
+++ src/sbin/dump/main.c	Sun Sep  8 13:26:05 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.70 2013/06/15 01:27:19 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.71 2013/09/08 13:26:05 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = @(#)main.c	8.6 (Berkeley) 5/1/95;
 #else
-__RCSID($NetBSD: main.c,v 1.70 2013/06/15 01:27:19 christos Exp $);
+__RCSID($NetBSD: main.c,v 1.71 2013/09/08 13:26:05 mlelstv Exp $);
 #endif
 #endif /* not lint */
 
@@ -280,22 +280,20 @@ main(int argc, char *argv[])
 	dirc = 0;
 	for (i = 0; i  argc; i++) {
 		struct stat sb;
+		int error;
 
-		if (lstat(argv[i], sb) == -1)
-			quit(Cannot stat %s: %s\n, argv[i], strerror(errno));
-		if (Fflag || S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) {
+		error = lstat(argv[i], sb);
+		if (Fflag || (!error  (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode {
+			if (error)
+quit(Cannot stat %s: %s\n, argv[i], strerror(errno));
 			disk = argv[i];
  multicheck:
 			if (dirc != 0)
-quit(
-	Can't dump a disk or image at the same time as a file list\n);
+quit(Can't dump a disk or image at the same time as a file list\n);
 			break;
 		}
 		if ((dt = fstabsearch(argv[i])) != NULL) {
-			if (getfsspecname(buf, sizeof(buf), dt-fs_spec)
-			== NULL)
-quit(%s (%s), buf, strerror(errno));
-			disk = buf;
+			disk = argv[i];
 			mountpoint = xstrdup(dt-fs_file);
 			goto multicheck;
 		}
@@ -416,6 +414,7 @@ main(int argc, char *argv[])
 		== NULL)
 			quit(Can't get disk raw name for `%s' (%s),
 			mntinfo-f_mntfromname, strerror(errno));
+		disk = rbuf;
 		mountpoint = mntinfo-f_mntonname;
 		msg(Found %s on %s in mount table\n, disk, mountpoint);
 	}

Index: src/sbin/dump/optr.c
diff -u src/sbin/dump/optr.c:1.41 src/sbin/dump/optr.c:1.42
--- src/sbin/dump/optr.c:1.41	Sat Jun 15 01:27:19 2013
+++ src/sbin/dump/optr.c	Sun Sep  8 13:26:05 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: optr.c,v 1.41 2013/06/15 01:27:19 christos Exp $	*/
+/*	$NetBSD: optr.c,v 1.42 2013/09/08 13:26:05 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)optr.c	8.2 (Berkeley) 1/6/94;
 #else
-__RCSID($NetBSD: optr.c,v 1.41 2013/06/15 01:27:19 christos Exp $);
+__RCSID($NetBSD: optr.c,v 1.42 2013/09/08 13:26:05 mlelstv Exp $);
 #endif
 #endif /* not lint */
 
@@ -320,15 +320,11 @@ static struct fstab *
 allocfsent(const struct fstab *fs)
 {
 	struct fstab *new;
-	char buf[MAXPATHLEN];
 
 	new = xmalloc(sizeof (*fs));
 	new-fs_file = xstrdup(fs-fs_file);
 	new-fs_type = xstrdup(fs-fs_type);
-
-	if (getfsspecname(buf, sizeof(buf), fs-fs_spec) == NULL)
-		msg(%s (%s), buf, strerror(errno));
-	new-fs_spec = xstrdup(buf);
+	new-fs_spec = xstrdup(fs-fs_spec);
 	new-fs_passno = fs-fs_passno;
 	new-fs_freq = fs-fs_freq;
 	return (new);



CVS commit: src/sys/dev/i2c

2013-09-08 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Sun Sep  8 14:59:42 UTC 2013

Modified Files:
src/sys/dev/i2c: files.i2c
Added Files:
src/sys/dev/i2c: mpl115a.c mpl115areg.h

Log Message:
Preliminary support for MPL115A2 pressure sensor. It works, but accurracy is
awful.

I should add presure as a new type of sensor to envsys at some point...


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r0 -r1.1 src/sys/dev/i2c/mpl115a.c src/sys/dev/i2c/mpl115areg.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/i2c/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.51 src/sys/dev/i2c/files.i2c:1.52
--- src/sys/dev/i2c/files.i2c:1.51	Fri Sep  6 00:56:12 2013
+++ src/sys/dev/i2c/files.i2c	Sun Sep  8 14:59:42 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.51 2013/09/06 00:56:12 matt Exp $
+#	$NetBSD: files.i2c,v 1.52 2013/09/08 14:59:42 rkujawa Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -198,3 +198,9 @@ file	dev/i2c/mcp980x.c 		mcp980x
 device	w83795g: gpiobus, sysmon_envsys, sysmon_wdog
 attach	w83795g at iic
 file	dev/i2c/w83795g.c 		w83795g
+
+# Freescale MPL115A2
+device  mpl115a: sysmon_envsys
+attach  mpl115a at iic
+filedev/i2c/mpl115a.c		mpl115a
+

Added files:

Index: src/sys/dev/i2c/mpl115a.c
diff -u /dev/null src/sys/dev/i2c/mpl115a.c:1.1
--- /dev/null	Sun Sep  8 14:59:42 2013
+++ src/sys/dev/i2c/mpl115a.c	Sun Sep  8 14:59:42 2013
@@ -0,0 +1,303 @@
+/*	$NetBSD: mpl115a.c,v 1.1 2013/09/08 14:59:42 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*
+ * Freescale MPL115A2 miniature digital barometer driver.
+ *
+ * This driver could be split into bus-indepented driver and I2C-specific
+ * attachment, as SPI variant of this chip also exist.
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: mpl115a.c,v 1.1 2013/09/08 14:59:42 rkujawa Exp $);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/device.h
+#include sys/kernel.h
+#include sys/mutex.h
+#include sys/endian.h
+
+#include sys/bus.h
+#include dev/i2c/i2cvar.h
+
+#include dev/sysmon/sysmonvar.h
+
+#include dev/i2c/mpl115areg.h
+
+#define MPL115A_DEBUG 1
+
+struct mpl115a_softc {
+	device_t		sc_dev;
+
+	i2c_tag_t		sc_tag;
+	i2c_addr_t		sc_addr;
+
+	/* raw coefficients */
+	int16_t			sc_a0;
+	int16_t			sc_b1;
+	int16_t			sc_b2;
+	int16_t			sc_c12;
+
+	/* envsys(4) stuff */
+	struct sysmon_envsys	*sc_sme;
+	envsys_data_t		sc_sensor;
+	kmutex_t		sc_lock; 
+};
+
+
+static int	mpl115a_match(device_t, cfdata_t, void *);
+static void	mpl115a_attach(device_t, device_t, void *);
+
+static uint8_t	mpl115a_reg_read_1(struct mpl115a_softc *sc, uint8_t);
+static void	mpl115a_reg_write_1(struct mpl115a_softc *sc, uint8_t, uint8_t);
+
+static void	mpl115a_load_coeffs(struct mpl115a_softc *sc);
+static uint16_t	mpl115a_make_coeff(uint8_t msb, uint8_t lsb);
+static uint32_t	mpl115a_pressure(struct mpl115a_softc *sc);
+static uint32_t mpl115a_calc(struct mpl115a_softc *sc, uint16_t padc, uint16_t tadc) ;
+
+static void mpl115a_envsys_register(struct mpl115a_softc *);
+static void mpl115a_envsys_refresh(struct sysmon_envsys *, envsys_data_t *);
+
+CFATTACH_DECL_NEW(mpl115a, sizeof (struct mpl115a_softc),
+mpl115a_match, mpl115a_attach, NULL, NULL);
+
+static int
+mpl115a_match(device_t parent, cfdata_t cf, void *aux)
+{
+	struct i2c_attach_args *ia = aux;
+
+	if (ia-ia_addr == 

CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:26:24 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/drm [riastradh-drm2]: drm_module.c

Log Message:
Initialize and destroy drm_global_mutex on module init/fini.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/external/bsd/drm2/drm/drm_module.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/external/bsd/drm2/drm/drm_module.c
diff -u src/sys/external/bsd/drm2/drm/drm_module.c:1.1.2.5 src/sys/external/bsd/drm2/drm/drm_module.c:1.1.2.6
--- src/sys/external/bsd/drm2/drm/drm_module.c:1.1.2.5	Wed Jul 24 03:51:04 2013
+++ src/sys/external/bsd/drm2/drm/drm_module.c	Sun Sep  8 15:26:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_module.c,v 1.1.2.5 2013/07/24 03:51:04 riastradh Exp $	*/
+/*	$NetBSD: drm_module.c,v 1.1.2.6 2013/09/08 15:26:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: drm_module.c,v 1.1.2.5 2013/07/24 03:51:04 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: drm_module.c,v 1.1.2.6 2013/09/08 15:26:24 riastradh Exp $);
 
 #include sys/types.h
 #include sys/device.h
@@ -38,6 +38,9 @@ __KERNEL_RCSID(0, $NetBSD: drm_module.c
 #include sys/systm.h
 
 #include linux/highmem.h
+#include linux/mutex.h
+
+#include drm/drmP.h
 
 /*
  * XXX I2C stuff should be moved to a separate drm2edid module.
@@ -65,6 +68,7 @@ drm2_modcmd(modcmd_t cmd, void *arg __un
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
+		linux_mutex_init(drm_global_mutex);
 		error = linux_kmap_init();
 		if (error) {
 			aprint_error(drm: unable to initialize linux kmap:
@@ -105,6 +109,7 @@ drm2_modcmd(modcmd_t cmd, void *arg __un
 			return error;
 #endif
 		linux_kmap_fini();
+		linux_mutex_destroy(drm_global_mutex);
 		return 0;
 
 	default:



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

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:33:06 UTC 2013

Modified Files:
src/sys/conf [riastradh-drm2]: files

Log Message:
Restore config `drm' attribute in sys/conf/files.

Not sure why this started to be necessary after the merge, but
whatever...


To generate a diff of this commit:
cvs rdiff -u -r1.1077.2.1 -r1.1077.2.2 src/sys/conf/files

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1077.2.1 src/sys/conf/files:1.1077.2.2
--- src/sys/conf/files:1.1077.2.1	Wed Jul 24 03:53:14 2013
+++ src/sys/conf/files	Sun Sep  8 15:33:06 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1077.2.1 2013/07/24 03:53:14 riastradh Exp $
+#	$NetBSD: files,v 1.1077.2.2 2013/09/08 15:33:06 riastradh Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20100430
@@ -1093,7 +1093,7 @@ device	smsh: arp, ether, ifnet, mii
 file	dev/ic/lan9118.c		smsh
 
 # DRM - Direct Rendering Infrastructure: dev/drm
-#define drm {}
+define drm {}
 #include external/bsd/drm/conf/files.drm
 #include dev/drm/files.drm
 



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:33:35 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: kref.h

Log Message:
Fix sense of atomic_cas loop condition and use kassertmsg for krefs.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \
src/sys/external/bsd/drm2/include/linux/kref.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/external/bsd/drm2/include/linux/kref.h
diff -u src/sys/external/bsd/drm2/include/linux/kref.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/kref.h:1.1.2.3
--- src/sys/external/bsd/drm2/include/linux/kref.h:1.1.2.2	Wed Jul 24 01:51:36 2013
+++ src/sys/external/bsd/drm2/include/linux/kref.h	Sun Sep  8 15:33:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: kref.h,v 1.1.2.2 2013/07/24 01:51:36 riastradh Exp $	*/
+/*	$NetBSD: kref.h,v 1.1.2.3 2013/09/08 15:33:35 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@ kref_get(struct kref *kref)
 	const unsigned int count __unused =
 	atomic_inc_uint_nv(kref-kr_count);
 
-	KASSERT(count  1);
+	KASSERTMSG((count  1), getting released kref);
 }
 
 static inline int
@@ -64,9 +64,10 @@ kref_sub(struct kref *kref, unsigned int
 
 	do {
 		old = kref-kr_count;
-		KASSERT(count = old);
+		KASSERTMSG((count = old), overreleasing kref: %u - %u,
+		old, count);
 		new = (old - count);
-	} while (atomic_cas_uint(kref-kr_count, old, new) == old);
+	} while (atomic_cas_uint(kref-kr_count, old, new) != old);
 
 	if (new == 0) {
 		(*release)(kref);



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:34:06 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_dma.c

Log Message:
Destroy context_idr and mm.lock in i915_driver_postclose.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.23 -r1.1.1.1.2.24 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.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/external/bsd/drm2/dist/drm/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.23 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.24
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.23	Wed Jul 24 04:05:34 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Sun Sep  8 15:34:06 2013
@@ -1989,6 +1989,11 @@ void i915_driver_postclose(struct drm_de
 {
 	struct drm_i915_file_private *file_priv = file-driver_priv;
 
+#ifdef __NetBSD__
+	idr_destroy(file_priv-context_idr);
+	spin_lock_destroy(file_priv-mm.lock);
+#endif
+
 	kfree(file_priv);
 }
 



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:34:36 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/drm [riastradh-drm2]: drm_drv.c

Log Message:
Decrement sc_opencount on drm_close.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.22 -r1.1.2.23 src/sys/external/bsd/drm2/drm/drm_drv.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/external/bsd/drm2/drm/drm_drv.c
diff -u src/sys/external/bsd/drm2/drm/drm_drv.c:1.1.2.22 src/sys/external/bsd/drm2/drm/drm_drv.c:1.1.2.23
--- src/sys/external/bsd/drm2/drm/drm_drv.c:1.1.2.22	Wed Jul 24 04:05:00 2013
+++ src/sys/external/bsd/drm2/drm/drm_drv.c	Sun Sep  8 15:34:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_drv.c,v 1.1.2.22 2013/07/24 04:05:00 riastradh Exp $	*/
+/*	$NetBSD: drm_drv.c,v 1.1.2.23 2013/09/08 15:34:36 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: drm_drv.c,v 1.1.2.22 2013/07/24 04:05:00 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: drm_drv.c,v 1.1.2.23 2013/09/08 15:34:36 riastradh Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -489,9 +489,15 @@ static int
 drm_close(struct file *fp)
 {
 	struct drm_file *const file = fp-f_data;
+	struct drm_softc *const sc = device_private(file-minor-kdev);
+	int error;
+
+	KASSERT(0  sc-sc_opencount);
 
 	/* XXX errno Linux-NetBSD */
-	return -drm_close_file(file);
+	error = -drm_close_file(file);
+	atomic_dec_uint(sc-sc_opencount);
+	return error;
 }
 
 /*



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:35:06 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: io.h

Log Message:
Define page_to_phys in Linux asm/io.h.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/external/bsd/drm2/include/asm/io.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/external/bsd/drm2/include/asm/io.h
diff -u src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.3 src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.4
--- src/sys/external/bsd/drm2/include/asm/io.h:1.1.2.3	Wed Jul 24 03:44:10 2013
+++ src/sys/external/bsd/drm2/include/asm/io.h	Sun Sep  8 15:35:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.h,v 1.1.2.3 2013/07/24 03:44:10 riastradh Exp $	*/
+/*	$NetBSD: io.h,v 1.1.2.4 2013/09/08 15:35:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,6 +32,12 @@
 #ifndef _ASM_IO_H_
 #define _ASM_IO_H_
 
+#include sys/bus.h
+
+#include uvm/uvm_page.h
+
+#include linux/mm_types.h
+
 /*
  * XXX This is bollocks, and is wrong on various architectures (should
  * work for x86; who knows what else), but bus_space_barrier won't work
@@ -43,4 +49,16 @@
 #define	memcpy_toio	memcpy
 #define	memset_io	memset
 
+/*
+ * XXX Not sure why this is here, but so it is in Linux...  Also, not
+ * sure what the right type is: Linux uses dma_addr_t, but I don't
+ * think bus_addr_t is right here -- paddr_t sounds more appropriate.
+ */
+
+static inline bus_addr_t
+page_to_phys(struct page *page)
+{
+	return VM_PAGE_TO_PHYS(page-p_vmp);
+}
+
 #endif  /* _ASM_IO_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/asm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:35:36 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/asm [riastradh-drm2]: uaccess.h

Log Message:
Add some copy_to/from_user variants to Linux asm/uaccess.h.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \
src/sys/external/bsd/drm2/include/asm/uaccess.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/external/bsd/drm2/include/asm/uaccess.h
diff -u src/sys/external/bsd/drm2/include/asm/uaccess.h:1.1.2.4 src/sys/external/bsd/drm2/include/asm/uaccess.h:1.1.2.5
--- src/sys/external/bsd/drm2/include/asm/uaccess.h:1.1.2.4	Wed Jul 24 02:12:14 2013
+++ src/sys/external/bsd/drm2/include/asm/uaccess.h	Sun Sep  8 15:35:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: uaccess.h,v 1.1.2.4 2013/07/24 02:12:14 riastradh Exp $	*/
+/*	$NetBSD: uaccess.h,v 1.1.2.5 2013/09/08 15:35:36 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,6 +35,19 @@
 #include sys/types.h
 #include sys/systm.h
 
+/* XXX This is a cop-out.  */
+#define	VERIFY_READ	0
+#define	VERIFY_WRITE	1
+static inline bool
+access_ok(int verify_op __unused, const void *uaddr __unused,
+size_t nbytes __unused)
+{
+	return true;
+}
+
+#define	__copy_from_user	copy_from_user
+#define	__copy_to_user		copy_to_user
+
 static inline int
 copy_from_user(void *kernel_addr, const void *user_addr, size_t len)
 {
@@ -55,4 +68,33 @@ copy_to_user(void *user_addr, const void
 #define	put_user(KERNEL_LOC, USER_ADDR)	\
 	copy_to_user((USER_ADDR), (KERNEL_LOC), sizeof(KERNEL_LOC))
 
+#if 0
+/*
+ * XXX These `inatomic' versions are a cop out, but they should do for
+ * now -- they are used only in fast paths which can't fault but which
+ * can fall back to slower paths that arrange things so faulting is OK.
+ */
+
+static inline int
+__copy_from_user_inatomic(void *kernel_addr __unused,
+const void *user_addr __unused, size_t len __unused)
+{
+	return -EFAULT;
+}
+
+static inline int
+__copy_to_user_inatomic(void *user_addr __unused,
+const void *kernel_addr __unused, size_t len __unused)
+{
+	return -EFAULT;
+}
+#endif	/* 0 */
+
+static inline int
+__copy_from_user_inatomic_nocache(void *kernel_addr __unused,
+const void *user_addr __unused, size_t len __unused)
+{
+	return -EFAULT;
+}
+
 #endif  /* _ASM_UACCESS_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:36:05 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include [riastradh-drm2]: i915_trace.h

Log Message:
Add trace_i915_gem_object_unbind.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \
src/sys/external/bsd/drm2/include/i915_trace.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/external/bsd/drm2/include/i915_trace.h
diff -u src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.4 src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.5
--- src/sys/external/bsd/drm2/include/i915_trace.h:1.1.2.4	Wed Jul 24 03:29:14 2013
+++ src/sys/external/bsd/drm2/include/i915_trace.h	Sun Sep  8 15:36:05 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_trace.h,v 1.1.2.4 2013/07/24 03:29:14 riastradh Exp $	*/
+/*	$NetBSD: i915_trace.h,v 1.1.2.5 2013/09/08 15:36:05 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -105,6 +105,11 @@ trace_i915_gem_object_pwrite(struct drm_
 }
 
 static inline void
+trace_i915_gem_object_unbind(struct drm_i915_gem_object *obj __unused)
+{
+}
+
+static inline void
 trace_i915_gem_request_add(struct intel_ring_buffer *ring __unused,
 uint32_t seqno __unused)
 {



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:36:35 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: errno.h

Log Message:
Add ERESTARTSYS as a Linuxoid alias for ERESTART.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \
src/sys/external/bsd/drm2/include/linux/errno.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/external/bsd/drm2/include/linux/errno.h
diff -u src/sys/external/bsd/drm2/include/linux/errno.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/errno.h:1.1.2.3
--- src/sys/external/bsd/drm2/include/linux/errno.h:1.1.2.2	Wed Jul 24 01:57:50 2013
+++ src/sys/external/bsd/drm2/include/linux/errno.h	Sun Sep  8 15:36:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: errno.h,v 1.1.2.2 2013/07/24 01:57:50 riastradh Exp $	*/
+/*	$NetBSD: errno.h,v 1.1.2.3 2013/09/08 15:36:35 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,4 +34,6 @@
 
 #include sys/errno.h
 
+#define	ERESTARTSYS	ERESTART
+
 #endif  /* _LINUX_ERRNO_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:37:04 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: atomic.h

Log Message:
Fix Linux atomic set/clear/change_bit to work on arrays.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 \
src/sys/external/bsd/drm2/include/linux/atomic.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/external/bsd/drm2/include/linux/atomic.h
diff -u src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.9 src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.10
--- src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.9	Wed Jul 24 03:35:50 2013
+++ src/sys/external/bsd/drm2/include/linux/atomic.h	Sun Sep  8 15:37:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic.h,v 1.1.2.9 2013/07/24 03:35:50 riastradh Exp $	*/
+/*	$NetBSD: atomic.h,v 1.1.2.10 2013/09/08 15:37:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,6 +34,8 @@
 
 #include sys/atomic.h
 
+#include machine/limits.h
+
 struct atomic {
 	union {
 		int au_int;
@@ -125,53 +127,69 @@ atomic_inc_not_zero(atomic_t *atomic)
 }
 
 static inline void
-set_bit(unsigned long bit, volatile unsigned long *ptr)
+set_bit(unsigned int bit, volatile unsigned long *ptr)
 {
-	atomic_or_ulong(ptr, (1  bit));
+	const unsigned int units = (sizeof(*ptr) * CHAR_BIT);
+
+	atomic_or_ulong(ptr[bit / units], (1UL  (bit % units)));
 }
 
 static inline void
-clear_bit(unsigned long bit, volatile unsigned long *ptr)
+clear_bit(unsigned int bit, volatile unsigned long *ptr)
 {
-	atomic_and_ulong(ptr, ~(1  bit));
+	const unsigned int units = (sizeof(*ptr) * CHAR_BIT);
+
+	atomic_and_ulong(ptr[bit / units], ~(1UL  (bit % units)));
 }
 
 static inline void
-change_bit(unsigned long bit, volatile unsigned long *ptr)
+change_bit(unsigned int bit, volatile unsigned long *ptr)
 {
+	const unsigned int units = (sizeof(*ptr) * CHAR_BIT);
+	volatile unsigned long *const p = ptr[bit / units];
+	const unsigned long mask = (1UL  (bit % units));
 	unsigned long v;
 
-	do v = *ptr; while (atomic_cas_ulong(ptr, v, v ^ (1  bit)) != v);
+	do v = *p; while (atomic_cas_ulong(p, v, (v ^ mask)) != v);
 }
 
 static inline unsigned long
-test_and_set_bit(unsigned long bit, volatile unsigned long *ptr)
+test_and_set_bit(unsigned int bit, volatile unsigned long *ptr)
 {
+	const unsigned int units = (sizeof(*ptr) * CHAR_BIT);
+	volatile unsigned long *const p = ptr[bit / units];
+	const unsigned long mask = (1UL  (bit % units));
 	unsigned long v;
 
-	do v = *ptr; while (atomic_cas_ulong(ptr, v, v | (1  bit)) != v);
+	do v = *p; while (atomic_cas_ulong(p, v, (v | mask)) != v);
 
-	return (v  (1  bit));
+	return (v  mask);
 }
 
 static inline unsigned long
-test_and_clear_bit(unsigned long bit, volatile unsigned long *ptr)
+test_and_clear_bit(unsigned int bit, volatile unsigned long *ptr)
 {
+	const unsigned int units = (sizeof(*ptr) * CHAR_BIT);
+	volatile unsigned long *const p = ptr[bit / units];
+	const unsigned long mask = (1UL  (bit % units));
 	unsigned long v;
 
-	do v = *ptr; while (atomic_cas_ulong(ptr, v, v ~ (1  bit)) != v);
+	do v = *p; while (atomic_cas_ulong(p, v, (v  ~mask)) != v);
 
-	return (v  (1  bit));
+	return (v  mask);
 }
 
 static inline unsigned long
-test_and_change_bit(unsigned long bit, volatile unsigned long *ptr)
+test_and_change_bit(unsigned int bit, volatile unsigned long *ptr)
 {
+	const unsigned int units = (sizeof(*ptr) * CHAR_BIT);
+	volatile unsigned long *const p = ptr[bit / units];
+	const unsigned long mask = (1UL  (bit % units));
 	unsigned long v;
 
-	do v = *ptr; while (atomic_cas_ulong(ptr, v, v ^ (1  bit)) != v);
+	do v = *p; while (atomic_cas_ulong(p, v, (v ^ mask)) != v);
 
-	return (v  (1  bit));
+	return (v  mask);
 }
 
 #if defined(MULTIPROCESSOR)  !defined(__HAVE_ATOMIC_AS_MEMBAR)



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:38:05 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: jiffies.h
log2.h pagemap.h time.h timer.h types.h

Log Message:
More miscellaneous Linux header cruft.  See patch for details.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \
src/sys/external/bsd/drm2/include/linux/jiffies.h \
src/sys/external/bsd/drm2/include/linux/timer.h
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \
src/sys/external/bsd/drm2/include/linux/log2.h
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \
src/sys/external/bsd/drm2/include/linux/pagemap.h \
src/sys/external/bsd/drm2/include/linux/time.h
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 \
src/sys/external/bsd/drm2/include/linux/types.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/external/bsd/drm2/include/linux/jiffies.h
diff -u src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.4
--- src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.3	Wed Jul 24 03:03:23 2013
+++ src/sys/external/bsd/drm2/include/linux/jiffies.h	Sun Sep  8 15:38:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: jiffies.h,v 1.1.2.3 2013/07/24 03:03:23 riastradh Exp $	*/
+/*	$NetBSD: jiffies.h,v 1.1.2.4 2013/09/08 15:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -49,6 +49,12 @@ usecs_to_jiffies(unsigned int usec)
 	return mstohz((usec + (1000 / hz) - 1) / (1000 / hz));
 }
 
+static inline unsigned int
+timespec_to_jiffies(const struct timespec *ts)
+{
+	return tstohz(ts);
+}
+
 /* XXX long is the wrong type here times...  */
 
 #define	__linux_time_compare(A, OP, B)	(((long)(A) - (long)(B)) OP 0)
Index: src/sys/external/bsd/drm2/include/linux/timer.h
diff -u src/sys/external/bsd/drm2/include/linux/timer.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/timer.h:1.1.2.4
--- src/sys/external/bsd/drm2/include/linux/timer.h:1.1.2.3	Wed Jul 24 03:50:16 2013
+++ src/sys/external/bsd/drm2/include/linux/timer.h	Sun Sep  8 15:38:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: timer.h,v 1.1.2.3 2013/07/24 03:50:16 riastradh Exp $	*/
+/*	$NetBSD: timer.h,v 1.1.2.4 2013/09/08 15:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -78,4 +78,10 @@ round_jiffies_up(unsigned long j)
 	return roundup(j, hz);
 }
 
+static inline unsigned long
+round_jiffies_up_relative(unsigned long j)
+{
+	return roundup(j, hz);
+}
+
 #endif  /* _LINUX_TIMER_H_ */

Index: src/sys/external/bsd/drm2/include/linux/log2.h
diff -u src/sys/external/bsd/drm2/include/linux/log2.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/log2.h:1.1.2.3
--- src/sys/external/bsd/drm2/include/linux/log2.h:1.1.2.2	Wed Jul 24 02:03:00 2013
+++ src/sys/external/bsd/drm2/include/linux/log2.h	Sun Sep  8 15:38:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: log2.h,v 1.1.2.2 2013/07/24 02:03:00 riastradh Exp $	*/
+/*	$NetBSD: log2.h,v 1.1.2.3 2013/09/08 15:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,4 +34,10 @@
 
 #include sys/bitops.h
 
+static inline bool
+is_power_of_2(unsigned long x)
+{
+	return ((x != 0)  (((x - 1)  x) == 0));
+}
+
 #endif  /* _LINUX_LOG2_H_ */

Index: src/sys/external/bsd/drm2/include/linux/pagemap.h
diff -u src/sys/external/bsd/drm2/include/linux/pagemap.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/pagemap.h:1.1.2.2
--- src/sys/external/bsd/drm2/include/linux/pagemap.h:1.1.2.1	Wed Jul 24 00:33:12 2013
+++ src/sys/external/bsd/drm2/include/linux/pagemap.h	Sun Sep  8 15:38:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pagemap.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $	*/
+/*	$NetBSD: pagemap.h,v 1.1.2.2 2013/09/08 15:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,4 +32,16 @@
 #ifndef _LINUX_PAGEMAP_H_
 #define _LINUX_PAGEMAP_H_
 
+static inline int
+fault_in_multipages_readable(const char *uaddr __unused, size_t len __unused)
+{
+	return 0;
+}
+
+static inline int
+fault_in_multipages_writeable(char *uaddr __unused, size_t len __unused)
+{
+	return 0;
+}
+
 #endif  /* _LINUX_PAGEMAP_H_ */
Index: src/sys/external/bsd/drm2/include/linux/time.h
diff -u src/sys/external/bsd/drm2/include/linux/time.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/time.h:1.1.2.2
--- src/sys/external/bsd/drm2/include/linux/time.h:1.1.2.1	Wed Jul 24 03:18:46 2013
+++ src/sys/external/bsd/drm2/include/linux/time.h	Sun Sep  8 15:38:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: time.h,v 1.1.2.1 2013/07/24 03:18:46 riastradh Exp $	*/
+/*	$NetBSD: time.h,v 1.1.2.2 2013/09/08 15:38:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -48,4 +48,66 @@ get_seconds(void)
 	return time_second;
 }
 
+static inline void
+getrawmonotonic(struct timespec *ts)
+{
+	getnanouptime(ts);
+}
+
+static inline bool
+timespec_valid(const struct timespec 

CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:37:34 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: bitops.h

Log Message:
Add Linuxoid non-atomic __set/clear_bit to linux/bitops.h.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \
src/sys/external/bsd/drm2/include/linux/bitops.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/external/bsd/drm2/include/linux/bitops.h
diff -u src/sys/external/bsd/drm2/include/linux/bitops.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/bitops.h:1.1.2.3
--- src/sys/external/bsd/drm2/include/linux/bitops.h:1.1.2.2	Wed Jul 24 03:44:39 2013
+++ src/sys/external/bsd/drm2/include/linux/bitops.h	Sun Sep  8 15:37:34 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bitops.h,v 1.1.2.2 2013/07/24 03:44:39 riastradh Exp $	*/
+/*	$NetBSD: bitops.h,v 1.1.2.3 2013/09/08 15:37:34 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,6 +32,13 @@
 #ifndef _LINUX_BITOPS_H_
 #define _LINUX_BITOPS_H_
 
+#include sys/types.h
+#include sys/param.h
+#include sys/atomic.h
+#include sys/cdefs.h
+
+#include machine/limits.h
+
 #include lib/libkern/libkern.h
 
 static inline unsigned int
@@ -40,4 +47,45 @@ hweight16(uint16_t n)
 	return popcount32(n);
 }
 
+/*
+ * XXX Don't define BITS_PER_LONG as sizeof(unsigned long)*CHAR_BIT
+ * because that won't work in preprocessor conditionals, where it often
+ * turns up.
+ */
+
+#define	BITS_TO_LONGS(n)		\
+	roundup2((n), (sizeof(unsigned long) * CHAR_BIT))
+
+static inline int
+test_bit(unsigned int n, const volatile unsigned long *p)
+{
+	const unsigned units = (sizeof(unsigned long) * CHAR_BIT);
+
+	return ((p[n / units]  (1UL  (n % units))) != 0);
+}
+
+static inline void
+__set_bit(unsigned int n, volatile unsigned long *p)
+{
+	const unsigned units = (sizeof(unsigned long) * CHAR_BIT);
+
+	p[n / units] |= (1UL  (n % units));
+}
+
+static inline void
+__clear_bit(unsigned int n, volatile unsigned long *p)
+{
+	const unsigned units = (sizeof(unsigned long) * CHAR_BIT);
+
+	p[n / units] = ~(1UL  (n % units));
+}
+
+static inline void
+__change_bit(unsigned int n, volatile unsigned long *p)
+{
+	const unsigned units = (sizeof(unsigned long) * CHAR_BIT);
+
+	p[n / units] ^= (1UL  (n % units));
+}
+
 #endif  /* _LINUX_BITOPS_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:38:35 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: mm.h

Log Message:
Fix definition of Linux PAGE_ALIGN in linux/mm.h.

Can't use uvm round_page because that depends on PAGE_MASK, whose
sense we have to invert for Linux!  Plurgh.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/external/bsd/drm2/include/linux/mm.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/external/bsd/drm2/include/linux/mm.h
diff -u src/sys/external/bsd/drm2/include/linux/mm.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/mm.h:1.1.2.5
--- src/sys/external/bsd/drm2/include/linux/mm.h:1.1.2.4	Wed Jul 24 03:58:04 2013
+++ src/sys/external/bsd/drm2/include/linux/mm.h	Sun Sep  8 15:38:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: mm.h,v 1.1.2.4 2013/07/24 03:58:04 riastradh Exp $	*/
+/*	$NetBSD: mm.h,v 1.1.2.5 2013/09/08 15:38:35 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -40,12 +40,13 @@
 
 #include uvm/uvm_extern.h
 
-#define	PAGE_ALIGN(x)	round_page(x)
-
 /* XXX Ugh bletch!  Whattakludge!  Linux's sense is reversed...  */
 #undef	PAGE_MASK
 #define	PAGE_MASK	(~(PAGE_SIZE-1))
 
+#define	PAGE_ALIGN(x)		(((x) + (PAGE_SIZE-1))  ~(PAGE_SIZE-1))
+#define	offset_in_page(x)	((x)  (PAGE_SIZE-1))
+
 /*
  * ###
  * ### XXX THIS NEEDS SERIOUS SCRUTINY XXX ###



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:39:05 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: workqueue.h

Log Message:
Rename delayed_work::dw_work to delayed_work::work for Linux source.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 \
src/sys/external/bsd/drm2/include/linux/workqueue.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/external/bsd/drm2/include/linux/workqueue.h
diff -u src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.7 src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.8
--- src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.7	Wed Jul 24 03:59:06 2013
+++ src/sys/external/bsd/drm2/include/linux/workqueue.h	Sun Sep  8 15:39:05 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: workqueue.h,v 1.1.2.7 2013/07/24 03:59:06 riastradh Exp $	*/
+/*	$NetBSD: workqueue.h,v 1.1.2.8 2013/09/08 15:39:05 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@ struct work_struct {
 };
 
 struct delayed_work {
-	struct work_struct dw_work;
+	struct work_struct work;
 };
 
 static inline void
@@ -64,13 +64,13 @@ INIT_WORK(struct work_struct *work, void
 static inline void
 INIT_DELAYED_WORK(struct delayed_work *dw, void (*fn)(struct work_struct *))
 {
-	INIT_WORK(dw-dw_work, fn);
+	INIT_WORK(dw-work, fn);
 }
 
 static inline struct delayed_work *
 to_delayed_work(struct work_struct *work)
 {
-	return container_of(work, struct delayed_work, dw_work);
+	return container_of(work, struct delayed_work, work);
 }
 
 static inline void
@@ -83,7 +83,7 @@ static inline void
 schedule_delayed_work(struct delayed_work *dw, unsigned long ticks)
 {
 	KASSERT(ticks  INT_MAX);
-	callout_schedule(dw-dw_work.ws_callout, (int)ticks);
+	callout_schedule(dw-work.ws_callout, (int)ticks);
 }
 
 static inline void
@@ -95,7 +95,7 @@ cancel_work_sync(struct work_struct *wor
 static inline void
 cancel_delayed_work_sync(struct delayed_work *dw)
 {
-	cancel_work_sync(dw-dw_work);
+	cancel_work_sync(dw-work);
 }
 
 /*



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:39:48 UTC 2013

Added Files:
src/sys/external/bsd/drm2/include/drm [riastradh-drm2]: bus_dma_hacks.h

Log Message:
Implement a bus_dmamem_wire_uvm_object hack.

This is fit only for x86 at the moment -- it parrots the x86
bus_dmamem_alloc code but with uvm_obj_wirepages instead of
uvm_pglistalloc.

XXX THIS IS A MEGA-KLUDGE THAT NEEDS TO BE DONE PROPERLY.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 \
src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h
diff -u /dev/null src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h:1.1.2.1
--- /dev/null	Sun Sep  8 15:39:48 2013
+++ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h	Sun Sep  8 15:39:48 2013
@@ -0,0 +1,110 @@
+/*	$NetBSD: bus_dma_hacks.h,v 1.1.2.1 2013/09/08 15:39:48 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Taylor R. Campbell.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#ifndef	_DRM_BUS_DMA_HACKS_H_
+#define	_DRM_BUS_DMA_HACKS_H_
+
+#include sys/cdefs.h
+#include sys/bus.h
+
+#include uvm/uvm.h
+#include uvm/uvm_extern.h
+
+/* XXX This is x86-specific bollocks.  */
+
+static inline int
+bus_dmamem_wire_uvm_object(bus_dma_tag_t tag, struct uvm_object *uobj,
+off_t start, bus_size_t size, struct pglist *pages, bus_size_t alignment,
+bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs,
+int flags)
+{
+	struct pglist pageq;
+	struct vm_page *page;
+	bus_addr_t prev_addr, addr;
+	unsigned int i;
+	int error;
+
+	KASSERT(size = __type_max(off_t));
+	KASSERT(start = (__type_max(off_t) - size));
+	KASSERT(alignment == PAGE_SIZE); /* XXX */
+	KASSERT(0  nsegs);
+
+	if (pages == NULL) {
+		TAILQ_INIT(pageq);
+		pages = pageq;
+	}
+
+	error = uvm_obj_wirepages(uobj, start, (start + size), pages);
+	if (error)
+		goto fail0;
+
+	page = TAILQ_FIRST(pages);
+	KASSERT(page != NULL);
+
+	addr = VM_PAGE_TO_PHYS(page);
+	segs[0].ds_addr = addr;
+	segs[0].ds_len = PAGE_SIZE;
+
+	i = 0;
+	while ((page = TAILQ_NEXT(page, pageq.queue)) != NULL) {
+		prev_addr = addr;
+		addr = VM_PAGE_TO_PHYS(page);
+		if ((addr == (prev_addr + PAGE_SIZE)) 
+		((addr  boundary) == (prev_addr  boundary))) {
+			segs[i].ds_len += PAGE_SIZE;
+		} else {
+			i += 1;
+			if (i = nsegs) {
+error = EFBIG;
+goto fail1;
+			}
+			segs[i].ds_addr = addr;
+			segs[i].ds_len = PAGE_SIZE;
+		}
+	}
+
+	/* Success!  */
+	*rsegs = (i + 1);
+	return 0;
+
+fail1:	uvm_obj_unwirepages(uobj, start, (start + size));
+fail0:	return error;
+}
+
+static inline void
+bus_dmamem_unwire_uvm_object(bus_dma_tag_t tag __unused,
+struct uvm_object *uobj, off_t start, bus_size_t size,
+bus_dma_segment_t *segs __unused, int nsegs __unused)
+{
+	uvm_obj_unwirepages(uobj, start, (start + size));
+}
+
+#endif	/* _DRM_BUS_DMA_HACKS_H_ */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:40:17 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/drm [riastradh-drm2]: intel-gtt.h

Log Message:
Rework Intel GTT abstraction to use bus_dma.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \
src/sys/external/bsd/drm2/include/drm/intel-gtt.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/external/bsd/drm2/include/drm/intel-gtt.h
diff -u src/sys/external/bsd/drm2/include/drm/intel-gtt.h:1.1.2.1 src/sys/external/bsd/drm2/include/drm/intel-gtt.h:1.1.2.2
--- src/sys/external/bsd/drm2/include/drm/intel-gtt.h:1.1.2.1	Wed Jul 24 03:49:20 2013
+++ src/sys/external/bsd/drm2/include/drm/intel-gtt.h	Sun Sep  8 15:40:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel-gtt.h,v 1.1.2.1 2013/07/24 03:49:20 riastradh Exp $	*/
+/*	$NetBSD: intel-gtt.h,v 1.1.2.2 2013/09/08 15:40:17 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,16 +32,22 @@
 #ifndef _DRM_INTEL_GTT_H_
 #define _DRM_INTEL_GTT_H_
 
+#include sys/bus.h
+
+#include drm/bus_dma_hacks.h
+
+#include linux/pci.h
+
+#include drm/drm_agp_netbsd.h
+
 struct intel_gtt {
-	unsigned int	stolen_size;
-	unsigned int	gtt_total_entries;
-	unsigned int	gtt_mappable_entries;
-	bool		needs_dmar;
-	bool		do_idle_maps;
-	bus_addr_t	scratch_page_dma;
-	struct vm_page	*scratch_page; /* XXX Sensible?  */
-	bus_size_t	gtt;
-	paddr_t		gma_bus_addr;
+	paddr_t			gma_bus_addr;
+	unsigned int		stolen_size;
+	unsigned int		gtt_total_entries;
+	unsigned int		gtt_mappable_entries;
+	bus_dma_segment_t	gtt_scratch_seg;
+	bus_dmamap_t		gtt_scratch_map;
+	bus_space_handle_t	gtt_bsh;
 };
 
 struct intel_gtt *



CVS commit: [riastradh-drm2] src/sys

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:41:07 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/include/drm [riastradh-drm2]: drmP.h
src/sys/modules/drm2 [riastradh-drm2]: Makefile
Added Files:
src/sys/external/bsd/drm2/drm [riastradh-drm2]: drm_cache.c

Log Message:
Implement drm_cache.c, for x86 only at the moment.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.50 -r1.1.1.1.2.51 \
src/sys/external/bsd/drm2/dist/include/drm/drmP.h
cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/drm/drm_cache.c
cvs rdiff -u -r1.1.2.38 -r1.1.2.39 src/sys/modules/drm2/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/include/drm/drmP.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.1.1.1.2.50 src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.1.1.1.2.51
--- src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.1.1.1.2.50	Wed Jul 24 03:53:46 2013
+++ src/sys/external/bsd/drm2/dist/include/drm/drmP.h	Sun Sep  8 15:41:07 2013
@@ -1601,7 +1601,11 @@ extern int drm_authmagic(struct drm_devi
 			 struct drm_file *file_priv);
 extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic);
 
-#ifndef __NetBSD__		/* XXX temporary measure 20130212 */
+#ifdef __NetBSD__		/* XXX drm clflush */
+void drm_clflush_pglist(struct pglist *);
+void drm_clflush_page(struct page *);
+void drm_clflush_virt_range(const void *, size_t);
+#else
 /* Cache management (drm_cache.c) */
 void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
 void drm_clflush_sg(struct sg_table *st);

Index: src/sys/modules/drm2/Makefile
diff -u src/sys/modules/drm2/Makefile:1.1.2.38 src/sys/modules/drm2/Makefile:1.1.2.39
--- src/sys/modules/drm2/Makefile:1.1.2.38	Wed Jul 24 03:52:37 2013
+++ src/sys/modules/drm2/Makefile	Sun Sep  8 15:41:07 2013
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.2.38 2013/07/24 03:52:37 riastradh Exp $
+# $NetBSD: Makefile,v 1.1.2.39 2013/09/08 15:41:07 riastradh Exp $
 
 .include ../Makefile.inc
 .include Makefile.inc
@@ -16,7 +16,7 @@ SRCS+=	drm_agpsupport.c	# XXX Move to dr
 SRCS+=	drm_auth.c
 SRCS+=	drm_buffer.c
 SRCS+=	drm_bufs.c
-#SRCS+=	drm_cache.c		# XXX Rewrite for uvm.
+SRCS+=	drm_cache.c
 SRCS+=	drm_context.c
 SRCS+=	drm_crtc.c
 SRCS+=	drm_crtc_helper.c

Added files:

Index: src/sys/external/bsd/drm2/drm/drm_cache.c
diff -u /dev/null src/sys/external/bsd/drm2/drm/drm_cache.c:1.1.2.1
--- /dev/null	Sun Sep  8 15:41:07 2013
+++ src/sys/external/bsd/drm2/drm/drm_cache.c	Sun Sep  8 15:41:07 2013
@@ -0,0 +1,148 @@
+/*	$NetBSD: drm_cache.c,v 1.1.2.1 2013/09/08 15:41:07 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Taylor R. Campbell.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: drm_cache.c,v 1.1.2.1 2013/09/08 15:41:07 riastradh Exp $);
+
+#include sys/types.h
+#include sys/xcall.h
+
+#include uvm/uvm_extern.h
+
+#include machine/cpufunc.h
+
+#include linux/mm_types.h
+
+#include drm/drmP.h
+
+static bool		drm_md_clflush_finegrained_p(void);
+static void		drm_md_clflush_all(void);
+static void		drm_md_clflush_page(struct page *);
+static void		drm_md_clflush_virt_range(const void *, size_t);
+
+void
+drm_clflush_pglist(struct pglist *list)
+{
+
+	if (drm_md_clflush_finegrained_p()) {
+		struct vm_page *page;
+
+		TAILQ_FOREACH(page, list, pageq.queue)
+			drm_md_clflush_page(container_of(page, struct page,
+p_vmp));
+	} else {

CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:42:12 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]:
i915_gem_execbuffer.c

Log Message:
Add missing includes to i915_gem_execbuffer.c.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.2 -r1.1.1.1.2.3 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_execbuffer.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/external/bsd/drm2/dist/drm/i915/i915_gem_execbuffer.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_execbuffer.c:1.1.1.1.2.2 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_execbuffer.c:1.1.1.1.2.3
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_execbuffer.c:1.1.1.1.2.2	Tue Jul 23 21:28:22 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_execbuffer.c	Sun Sep  8 15:42:12 2013
@@ -32,6 +32,8 @@
 #include i915_trace.h
 #include intel_drv.h
 #include linux/dma_remapping.h
+#include linux/log2.h
+#include linux/pagemap.h
 
 struct eb_objects {
 	int and;



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:41:41 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_gem.c

Log Message:
Add missing includes to i915_gem.c.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.6 -r1.1.1.1.2.7 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.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/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.6 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.7
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.6	Wed Jul 24 03:28:59 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Sun Sep  8 15:41:41 2013
@@ -35,6 +35,9 @@
 #include linux/swap.h
 #include linux/pci.h
 #include linux/dma-buf.h
+#include linux/errno.h
+#include linux/time.h
+#include linux/err.h
 #include asm/param.h
 
 static void i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *obj);



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:42:48 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]:
intel_ringbuffer.c

Log Message:
intel_ringbuffer.c needs asm/param.h for HZ.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.6 -r1.1.1.1.2.7 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.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/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.1.1.1.2.6 src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.1.1.1.2.7
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.1.1.1.2.6	Wed Jul 24 03:43:10 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c	Sun Sep  8 15:42:48 2013
@@ -27,6 +27,7 @@
  *
  */
 
+#include asm/param.h
 #include drm/drmP.h
 #include i915_drv.h
 #include drm/i915_drm.h



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:44:14 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/drm [riastradh-drm2]: drm_gem_vm.c
drm_scatter.c drm_vm.c

Log Message:
Avoid the PAGE_MASK mess in drm_gem_vm.c, drm_scatter.c,  drm_vm.c.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/external/bsd/drm2/drm/drm_gem_vm.c \
src/sys/external/bsd/drm2/drm/drm_vm.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/external/bsd/drm2/drm/drm_scatter.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/external/bsd/drm2/drm/drm_gem_vm.c
diff -u src/sys/external/bsd/drm2/drm/drm_gem_vm.c:1.1.2.1 src/sys/external/bsd/drm2/drm/drm_gem_vm.c:1.1.2.2
--- src/sys/external/bsd/drm2/drm/drm_gem_vm.c:1.1.2.1	Wed Jul 24 02:54:09 2013
+++ src/sys/external/bsd/drm2/drm/drm_gem_vm.c	Sun Sep  8 15:44:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_gem_vm.c,v 1.1.2.1 2013/07/24 02:54:09 riastradh Exp $	*/
+/*	$NetBSD: drm_gem_vm.c,v 1.1.2.2 2013/09/08 15:44:14 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: drm_gem_vm.c,v 1.1.2.1 2013/07/24 02:54:09 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: drm_gem_vm.c,v 1.1.2.2 2013/09/08 15:44:14 riastradh Exp $);
 
 #include sys/types.h
 
@@ -85,7 +85,7 @@ drm_gem_mmap_object_locked(struct drm_de
 	KASSERT(drm_core_check_feature(dev, DRIVER_GEM));
 	KASSERT(dev-driver-gem_uvm_ops != NULL);
 
-	if (byte_offset != trunc_page(byte_offset)) /* XXX kassert?  */
+	if (byte_offset != (byte_offset  ~(PAGE_SIZE-1))) /* XXX kassert?  */
 		return -EINVAL;
 
 	if (drm_ht_find_item(mm-offset_hash, page_offset, hash) != 0) {
Index: src/sys/external/bsd/drm2/drm/drm_vm.c
diff -u src/sys/external/bsd/drm2/drm/drm_vm.c:1.1.2.1 src/sys/external/bsd/drm2/drm/drm_vm.c:1.1.2.2
--- src/sys/external/bsd/drm2/drm/drm_vm.c:1.1.2.1	Wed Jul 24 02:53:31 2013
+++ src/sys/external/bsd/drm2/drm/drm_vm.c	Sun Sep  8 15:44:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_vm.c,v 1.1.2.1 2013/07/24 02:53:31 riastradh Exp $	*/
+/*	$NetBSD: drm_vm.c,v 1.1.2.2 2013/09/08 15:44:14 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: drm_vm.c,v 1.1.2.1 2013/07/24 02:53:31 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: drm_vm.c,v 1.1.2.2 2013/09/08 15:44:14 riastradh Exp $);
 
 #include sys/types.h
 
@@ -50,7 +50,7 @@ drm_mmap_paddr(struct drm_device *dev, o
 	paddr_t paddr = (paddr_t)-1;
 	int error;
 
-	if (byte_offset != trunc_page(byte_offset))
+	if (byte_offset != (byte_offset  ~(PAGE_SIZE-1)))
 		return (paddr_t)-1;
 
 	mutex_lock(dev-struct_mutex);

Index: src/sys/external/bsd/drm2/drm/drm_scatter.c
diff -u src/sys/external/bsd/drm2/drm/drm_scatter.c:1.1.2.2 src/sys/external/bsd/drm2/drm/drm_scatter.c:1.1.2.3
--- src/sys/external/bsd/drm2/drm/drm_scatter.c:1.1.2.2	Wed Jul 24 03:27:52 2013
+++ src/sys/external/bsd/drm2/drm/drm_scatter.c	Sun Sep  8 15:44:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_scatter.c,v 1.1.2.2 2013/07/24 03:27:52 riastradh Exp $	*/
+/*	$NetBSD: drm_scatter.c,v 1.1.2.3 2013/09/08 15:44:14 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: drm_scatter.c,v 1.1.2.2 2013/07/24 03:27:52 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: drm_scatter.c,v 1.1.2.3 2013/09/08 15:44:14 riastradh Exp $);
 
 #include sys/types.h
 #include sys/bus.h
@@ -123,7 +123,7 @@ drm_sg_alloc_mem(struct drm_device *dev,
 	KASSERT(drm_core_check_feature(dev, DRIVER_SG));
 
 	KASSERT(size = (size_t)0xUL); /* XXX 32-bit sizes only?  */
-	const size_t nbytes = round_page(size);
+	const size_t nbytes = PAGE_ALIGN(size);
 	const size_t npages = nbytes  PAGE_SHIFT;
 	KASSERT(npages = (size_t)INT_MAX);
 



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

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:46:22 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/pci [riastradh-drm2]: drm_pci.c

Log Message:
Add missing initialization of dev-dmat in drm_pci_attach.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/sys/external/bsd/drm2/pci/drm_pci.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/external/bsd/drm2/pci/drm_pci.c
diff -u src/sys/external/bsd/drm2/pci/drm_pci.c:1.1.2.8 src/sys/external/bsd/drm2/pci/drm_pci.c:1.1.2.9
--- src/sys/external/bsd/drm2/pci/drm_pci.c:1.1.2.8	Wed Jul 24 04:05:34 2013
+++ src/sys/external/bsd/drm2/pci/drm_pci.c	Sun Sep  8 15:46:22 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_pci.c,v 1.1.2.8 2013/07/24 04:05:34 riastradh Exp $	*/
+/*	$NetBSD: drm_pci.c,v 1.1.2.9 2013/09/08 15:46:22 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: drm_pci.c,v 1.1.2.8 2013/07/24 04:05:34 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: drm_pci.c,v 1.1.2.9 2013/09/08 15:46:22 riastradh Exp $);
 
 #include sys/types.h
 #include sys/errno.h
@@ -106,6 +106,7 @@ drm_pci_attach(device_t self, const stru
 
 	dev-bst = pa-pa_memt;
 	dev-bus_dmat = pa-pa_dmat; /* XXX dmat64?  */
+	dev-dmat = dev-bus_dmat;
 	dev-dmat_subregion_p = false;
 
 	CTASSERT(PCI_NMAPREGS  (SIZE_MAX / sizeof(dev-bus_maps[0])));



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:47:17 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/drm [riastradh-drm2]: drm_mem_util.h

Log Message:
Simplify drm_mem_util.h; fix source compatibility for drm_free_large.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \
src/sys/external/bsd/drm2/include/drm/drm_mem_util.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/external/bsd/drm2/include/drm/drm_mem_util.h
diff -u src/sys/external/bsd/drm2/include/drm/drm_mem_util.h:1.1.2.1 src/sys/external/bsd/drm2/include/drm/drm_mem_util.h:1.1.2.2
--- src/sys/external/bsd/drm2/include/drm/drm_mem_util.h:1.1.2.1	Wed Jul 24 01:56:19 2013
+++ src/sys/external/bsd/drm2/include/drm/drm_mem_util.h	Sun Sep  8 15:47:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_mem_util.h,v 1.1.2.1 2013/07/24 01:56:19 riastradh Exp $	*/
+/*	$NetBSD: drm_mem_util.h,v 1.1.2.2 2013/09/08 15:47:17 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,53 +32,27 @@
 #ifndef _DRM_MEM_UTIL_H_
 #define _DRM_MEM_UTIL_H_
 
-#include sys/types.h
-#include sys/kmem.h
-#include sys/systm.h
+#include linux/slab.h
 
 static inline void *
 drm_calloc_large(size_t n, size_t size)
 {
-
-#if 1
-	KASSERT(size != 0);	/* XXX Let's see whether this ever happens.  */
-#else
-	if (size == 0)
-		return NULL;	/* XXX OK?  */
-#endif
-
-	if (n  (SIZE_MAX / size))
-		return NULL;
-
-	return kmem_zalloc((n * size), KM_SLEEP);
+	return kcalloc(n, size, GFP_KERNEL);
 }
 
 static inline void *
 drm_malloc_ab(size_t n, size_t size)
 {
+	if (size  (SIZE_MAX / n))
+		return NULL;
 
-#if 1
-	KASSERT(size != 0);	/* XXX Let's see whether this ever happens.  */
-#else
-	if (size == 0)
-		return NULL;	/* XXX OK?  */
-#endif
-
-	return kmem_alloc((n * size), KM_SLEEP);
+	return kmalloc((n * size), GFP_KERNEL);
 }
 
 static inline void
-drm_free_large(void *ptr, size_t n, size_t size)
+drm_free_large(void *ptr)
 {
-
-#if 0/* XXX */
-	if (ptr != NULL)
-#endif
-	{
-		KASSERT(size != 0);
-		KASSERT(n = (SIZE_MAX / size));
-		kmem_free(ptr, (n * size));
-	}
+	kfree(ptr);
 }
 
 #endif  /* _DRM_MEM_UTIL_H_ */



CVS commit: [riastradh-drm2] src/sys

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:52:20 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_drv.h
i915_gem.c i915_gem_execbuffer.c i915_gem_tiling.c
src/sys/modules/i915drm2 [riastradh-drm2]: Makefile
Added Files:
src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: i915_gem_gtt.c
intel_gtt.c
Removed Files:
src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: i915_gem.c

Log Message:
Adapt the i915 GEM code to NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.14 -r1.1.1.1.2.15 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
cvs rdiff -u -r1.1.1.1.2.7 -r1.1.1.1.2.8 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
cvs rdiff -u -r1.1.1.1.2.3 -r1.1.1.1.2.4 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_execbuffer.c
cvs rdiff -u -r1.1.1.1.2.2 -r1.1.1.1.2.3 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_tiling.c
cvs rdiff -u -r1.1.2.2 -r0 src/sys/external/bsd/drm2/i915drm/i915_gem.c
cvs rdiff -u -r0 -r1.1.2.1 src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c \
src/sys/external/bsd/drm2/i915drm/intel_gtt.c
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/sys/modules/i915drm2/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.1.1.1.2.14 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.1.1.1.2.15
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.1.1.1.2.14	Wed Jul 24 03:40:29 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h	Sun Sep  8 15:52:20 2013
@@ -1084,7 +1084,14 @@ struct drm_i915_gem_object {
 	unsigned int has_global_gtt_mapping:1;
 	unsigned int has_dma_mapping:1;
 
+#ifdef __NetBSD__
+	struct pglist igo_pageq;
+	bus_dma_segment_t *pages; /* `pages' is an expedient misnomer.  */
+	int igo_nsegs;
+	bus_dmamap_t igo_dmamap;
+#else
 	struct sg_table *pages;
+#endif
 	int pages_pin_count;
 
 	/* prime dma-buf support */
@@ -1436,7 +1443,23 @@ void i915_gem_release_mmap(struct drm_i9
 void i915_gem_lastclose(struct drm_device *dev);
 
 int __must_check i915_gem_object_get_pages(struct drm_i915_gem_object *obj);
-#ifndef __NetBSD__		/* XXX */
+#ifdef __NetBSD__		/* XXX */
+static inline struct page *
+i915_gem_object_get_page(struct drm_i915_gem_object *obj, int n)
+{
+
+	/*
+	 * Pages must be pinned so that we need not hold the lock to
+	 * prevent them from disappearing.
+	 */
+	KASSERT(obj-pages != NULL);
+	mutex_enter(obj-base.gemo_uvmobj.vmobjlock);
+	struct vm_page *const page = uvm_pagelookup(obj-base.gemo_shm_uao, n);
+	mutex_exit(obj-base.gemo_uvmobj.vmobjlock);
+
+	return container_of(page, struct page, p_vmp);
+}
+#else
 static inline struct page *i915_gem_object_get_page(struct drm_i915_gem_object *obj, int n)
 {
 	struct scatterlist *sg = obj-pages-sgl;
@@ -1534,7 +1557,10 @@ int i915_add_request(struct intel_ring_b
 		 u32 *seqno);
 int __must_check i915_wait_seqno(struct intel_ring_buffer *ring,
  uint32_t seqno);
-#ifndef __NetBSD__		/* XXX */
+#ifdef __NetBSD__		/* XXX */
+int i915_gem_fault(struct uvm_faultinfo *, vaddr_t, struct vm_page **,
+int, int, vm_prot_t, int);
+#else
 int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
 #endif
 int __must_check

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.7 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.8
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.7	Sun Sep  8 15:41:41 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Sun Sep  8 15:52:20 2013
@@ -25,6 +25,21 @@
  *
  */
 
+#ifdef __NetBSD__
+#if 0/* XXX uvmhist option?  */
+#include opt_uvmhist.h
+#endif
+
+#include sys/types.h
+#include sys/param.h
+
+#include uvm/uvm.h
+#include uvm/uvm_fault.h
+#include uvm/uvm_page.h
+#include uvm/uvm_pmap.h
+#include uvm/uvm_prot.h
+#endif
+
 #include drm/drmP.h
 #include drm/i915_drm.h
 #include i915_drv.h
@@ -350,6 +365,9 @@ shmem_pread_fast(struct page *page, int 
 		 char __user *user_data,
 		 bool page_do_bit17_swizzling, bool needs_clflush)
 {
+#ifdef __NetBSD__		/* XXX atomic shmem fast path */
+	return -EFAULT;
+#else
 	char *vaddr;
 	int ret;
 
@@ -366,6 +384,7 @@ shmem_pread_fast(struct page *page, int 
 	kunmap_atomic(vaddr);
 
 	return ret ? -EFAULT : 0;
+#endif
 }
 
 static void
@@ -431,10 +450,14 @@ i915_gem_shmem_pread(struct drm_device *
 	int shmem_page_offset, page_length, ret = 0;
 	int obj_do_bit17_swizzling, page_do_bit17_swizzling;
 	int hit_slowpath = 0;
+#ifndef __NetBSD__		/* XXX */
 	int prefaulted = 0;
+#endif
 	int needs_clflush = 0;
+#ifndef __NetBSD__
 	struct scatterlist *sg;
 	int i;
+#endif
 
 	user_data = (char __user *) (uintptr_t) args-data_ptr;
 	remain = args-size;

CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:54:48 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/drm [riastradh-drm2]: drm_cache.c

Log Message:
Helps to commit all my changes to drm_cache.c.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/external/bsd/drm2/drm/drm_cache.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/external/bsd/drm2/drm/drm_cache.c
diff -u src/sys/external/bsd/drm2/drm/drm_cache.c:1.1.2.1 src/sys/external/bsd/drm2/drm/drm_cache.c:1.1.2.2
--- src/sys/external/bsd/drm2/drm/drm_cache.c:1.1.2.1	Sun Sep  8 15:41:07 2013
+++ src/sys/external/bsd/drm2/drm/drm_cache.c	Sun Sep  8 15:54:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_cache.c,v 1.1.2.1 2013/09/08 15:41:07 riastradh Exp $	*/
+/*	$NetBSD: drm_cache.c,v 1.1.2.2 2013/09/08 15:54:48 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: drm_cache.c,v 1.1.2.1 2013/09/08 15:41:07 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: drm_cache.c,v 1.1.2.2 2013/09/08 15:54:48 riastradh Exp $);
 
 #include sys/types.h
 #include sys/xcall.h
@@ -94,13 +94,13 @@ drm_md_clflush_finegrained_p(void)
 static void
 drm_x86_clflush_cpu(void)
 {
-	__asm__ __volatile__ (wbinvd);
+	asm volatile (wbinvd);
 }
 
 static void
 drm_x86_clflush(const void *vaddr)
 {
-	__asm__ __volatile__ (clflush %0 : : =r (vaddr));
+	asm volatile (clflush %0 : : m (*(const char *)vaddr));
 }
 
 static size_t
@@ -119,7 +119,7 @@ drm_x86_clflush_xc(void *arg0 __unused, 
 static void
 drm_md_clflush_all(void)
 {
-	xc_wait(xc_broadcast(0, drm_md_clflush_xc, NULL, NULL));
+	xc_wait(xc_broadcast(0, drm_x86_clflush_xc, NULL, NULL));
 }
 
 static void
@@ -142,7 +142,7 @@ drm_md_clflush_virt_range(const void *va
 
 	KASSERT(drm_md_clflush_finegrained_p());
 	for (p = start; p  end; p += clflush_size)
-		drm_clflush(p);
+		drm_x86_clflush(p);
 }
 
 #endif	/* defined(__i386__) || defined(__x86_64__) */



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:54:20 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_dma.c
intel_ringbuffer.c intel_ringbuffer.h
src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: intel_pm.c
Removed Files:
src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: intel_ringbuffer.c

Log Message:
Adapt the Intel ringbuffer code to NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.24 -r1.1.1.1.2.25 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
cvs rdiff -u -r1.1.1.1.2.7 -r1.1.1.1.2.8 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c
cvs rdiff -u -r1.1.1.1.2.6 -r1.1.1.1.2.7 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.h
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/external/bsd/drm2/i915drm/intel_pm.c
cvs rdiff -u -r1.1.2.2 -r0 \
src/sys/external/bsd/drm2/i915drm/intel_ringbuffer.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/external/bsd/drm2/dist/drm/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.24 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.25
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.24	Sun Sep  8 15:34:06 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Sun Sep  8 15:54:20 2013
@@ -239,19 +239,11 @@ static int i915_dma_resume(struct drm_de
 
 	DRM_DEBUG_DRIVER(%s\n, __func__);
 
-#ifdef __NetBSD__
-	if (!ring-virtual_start_mapped) {
-		DRM_ERROR(can not ioremap virtual address for
-			   ring buffer\n);
-		return -ENOMEM;
-	}
-#else
 	if (ring-virtual_start == NULL) {
 		DRM_ERROR(can not ioremap virtual address for
 			   ring buffer\n);
 		return -ENOMEM;
 	}
-#endif
 
 	/* Program Hardware Status Page */
 	if (!ring-status_page.page_addr) {
@@ -834,17 +826,10 @@ static int i915_irq_emit(struct drm_devi
 	if (drm_core_check_feature(dev, DRIVER_MODESET))
 		return -ENODEV;
 
-#ifdef __NetBSD__
-	if (!dev_priv || !LP_RING(dev_priv)-virtual_start_mapped) {
-		DRM_ERROR(called with no initialization\n);
-		return -EINVAL;
-	}
-#else
 	if (!dev_priv || !LP_RING(dev_priv)-virtual_start) {
 		DRM_ERROR(called with no initialization\n);
 		return -EINVAL;
 	}
-#endif
 
 	RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
 

Index: src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.1.1.1.2.7 src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.1.1.1.2.8
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.1.1.1.2.7	Sun Sep  8 15:42:48 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c	Sun Sep  8 15:54:20 2013
@@ -464,7 +464,12 @@ init_pipe_control(struct intel_ring_buff
 		goto err_unref;
 
 	pc-gtt_offset = obj-gtt_offset;
+#ifdef __NetBSD__
+	pc-cpu_page = kmap(container_of(TAILQ_FIRST(obj-igo_pageq),
+		struct page, p_vmp));
+#else
 	pc-cpu_page =  kmap(sg_page(obj-pages-sgl));
+#endif
 	if (pc-cpu_page == NULL)
 		goto err_unpin;
 
@@ -492,7 +497,11 @@ cleanup_pipe_control(struct intel_ring_b
 
 	obj = pc-obj;
 
+#ifdef __NetBSD__
+	kunmap(container_of(TAILQ_FIRST(obj-igo_pageq), struct page, p_vmp));
+#else
 	kunmap(sg_page(obj-pages-sgl));
+#endif
 	i915_gem_object_unpin(obj);
 	drm_gem_object_unreference(obj-base);
 
@@ -1067,7 +1076,11 @@ static void cleanup_status_page(struct i
 	if (obj == NULL)
 		return;
 
+#ifdef __NetBSD__
+	kunmap(container_of(TAILQ_FIRST(obj-igo_pageq), struct page, p_vmp));
+#else
 	kunmap(sg_page(obj-pages-sgl));
+#endif
 	i915_gem_object_unpin(obj);
 	drm_gem_object_unreference(obj-base);
 	ring-status_page.obj = NULL;
@@ -1094,7 +1107,13 @@ static int init_status_page(struct intel
 	}
 
 	ring-status_page.gfx_addr = obj-gtt_offset;
+#ifdef __NetBSD__
+	ring-status_page.page_addr =
+	kmap(container_of(TAILQ_FIRST(obj-igo_pageq), struct page,
+		p_vmp));
+#else
 	ring-status_page.page_addr = kmap(sg_page(obj-pages-sgl));
+#endif
 	if (ring-status_page.page_addr == NULL) {
 		ret = -ENOMEM;
 		goto err_unpin;
@@ -1195,22 +1214,17 @@ static int intel_init_ring_buffer(struct
 	ring-virtual_start_map.flags |= _DRM_KERNEL;
 	ring-virtual_start_map.flags |= _DRM_WRITE_COMBINING;
 	ring-virtual_start_map.flags |= _DRM_DRIVER;
-	ret = drm_ioremap(dev, ring-virtual_start_map);
-	if (ret) {
-		DRM_ERROR(failed to map ring buffer\n);
-		goto err_unpin;
-	}
-	ring-virtual_start_mapped = true;
+	ring-virtual_start = drm_ioremap(dev, ring-virtual_start_map);
 #else
 	ring-virtual_start =
 		ioremap_wc(dev_priv-mm.gtt-gma_bus_addr + obj-gtt_offset,
 			   ring-size);
+#endif
 	if (ring-virtual_start == NULL) {
 		DRM_ERROR(Failed to map ringbuffer.\n);
 		ret = -EINVAL;
 		goto err_unpin;
 	}
-#endif
 
 	ret = ring-init(ring);
 	if (ret)
@@ -1229,7 +1243,7 @@ static int intel_init_ring_buffer(struct
 err_unmap:
 

CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:55:23 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_gem.c

Log Message:
Use pmap_enter_default, not pmap_enter.

Seems to be a problem with modules referring to weak aliases?


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.8 -r1.1.1.1.2.9 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.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/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.8 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.9
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.8	Sun Sep  8 15:52:20 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Sun Sep  8 15:55:23 2013
@@ -1555,7 +1555,12 @@ out:
 
 /*
  * XXX i915_udv_fault is copypasta of udv_fault from uvm_device.c.
+ *
+ * XXX pmap_enter_default instead of pmap_enter because of a problem
+ * with using weak aliases in kernel modules or something.
  */
+int	pmap_enter_default(pmap_t, vaddr_t, paddr_t, vm_prot_t, unsigned);
+
 static int
 i915_udv_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr, struct vm_page **pps,
 int npages, int centeridx, vm_prot_t access_type, int flags,
@@ -1615,7 +1620,7 @@ i915_udv_fault(struct uvm_faultinfo *ufi
 		UVMHIST_LOG(maphist,
 		  MAPPING: device: pm=0x%x, va=0x%x, pa=0x%lx, at=%d,
 		ufi-orig_map-pmap, curr_va, paddr, mapprot);
-		if (pmap_enter(ufi-orig_map-pmap, curr_va, paddr, mapprot,
+		if (pmap_enter_default(ufi-orig_map-pmap, curr_va, paddr, mapprot,
 		PMAP_CANFAIL | mapprot | mmapflags) != 0) {
 			/*
 			 * pmap_enter() didn't have the resource to



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:56:02 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_drv.c
i915_gem.c

Log Message:
Hook up the i915_gem uvm pager ops.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.13 -r1.1.1.1.2.14 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c
cvs rdiff -u -r1.1.1.1.2.9 -r1.1.1.1.2.10 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.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/external/bsd/drm2/dist/drm/i915/i915_drv.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.1.1.1.2.13 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.1.1.1.2.14
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c:1.1.1.1.2.13	Wed Jul 24 04:00:35 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c	Sun Sep  8 15:56:02 2013
@@ -915,7 +915,16 @@ int i915_reset(struct drm_device *dev)
 	return 0;
 }
 
-#ifndef __NetBSD__
+#ifdef __NetBSD__
+
+static const struct uvm_pagerops i915_gem_uvm_ops = {
+	.pgo_reference = drm_gem_pager_reference,
+	.pgo_detach = drm_gem_pager_detach,
+	.pgo_fault = i915_gem_fault,
+};
+
+#else
+
 static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	struct intel_device_info *intel_info =
@@ -1048,6 +1057,7 @@ static const struct file_operations i915
 #endif
 	.llseek = noop_llseek,
 };
+
 #endif	/* defined(__NetBSD__) */
 
 static struct drm_driver driver = {
@@ -1078,7 +1088,7 @@ static struct drm_driver driver = {
 	.gem_init_object = i915_gem_init_object,
 	.gem_free_object = i915_gem_free_object,
 #ifdef __NetBSD__
-	.gem_uvm_ops = NULL,
+	.gem_uvm_ops = i915_gem_uvm_ops,
 #else
 	.gem_vm_ops = i915_gem_vm_ops,
 #endif

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.9 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.10
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.9	Sun Sep  8 15:55:23 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Sun Sep  8 15:56:02 2013
@@ -34,6 +34,7 @@
 #include sys/param.h
 
 #include uvm/uvm.h
+#include uvm/uvm_extern.h
 #include uvm/uvm_fault.h
 #include uvm/uvm_page.h
 #include uvm/uvm_pmap.h



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/i915drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:57:01 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: i915_gem_gtt.c

Log Message:
Shift the GTT size by twenty only once.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \
src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.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/external/bsd/drm2/i915drm/i915_gem_gtt.c
diff -u src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.1 src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.2
--- src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.1	Sun Sep  8 15:52:20 2013
+++ src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c	Sun Sep  8 15:57:01 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_gtt.c,v 1.1.2.1 2013/09/08 15:52:20 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_gtt.c,v 1.1.2.2 2013/09/08 15:57:01 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: i915_gem_gtt.c,v 1.1.2.1 2013/09/08 15:52:20 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: i915_gem_gtt.c,v 1.1.2.2 2013/09/08 15:57:01 riastradh Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -137,7 +137,7 @@ i915_gem_gtt_init(struct drm_device *dev
 	}
 
 	/* GGMS: GTT Graphics Memory Size.  */
-	ggms = __SHIFTOUT(snb_gmch_ctl, SNB_GMCH_GGMS)  20;
+	ggms = __SHIFTOUT(snb_gmch_ctl, SNB_GMCH_GGMS);
 	gtt-gtt_total_entries = (ggms  20) / sizeof(gtt_pte_t);
 
 	gtt-gtt_mappable_entries = (dev-bus_maps[2].bm_size  PAGE_SHIFT);



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:56:32 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/drm [riastradh-drm2]: drm_gem_vm.c

Log Message:
Use the _unlocked variant of unreference in drm_gem_pager_detach.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/external/bsd/drm2/drm/drm_gem_vm.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/external/bsd/drm2/drm/drm_gem_vm.c
diff -u src/sys/external/bsd/drm2/drm/drm_gem_vm.c:1.1.2.2 src/sys/external/bsd/drm2/drm/drm_gem_vm.c:1.1.2.3
--- src/sys/external/bsd/drm2/drm/drm_gem_vm.c:1.1.2.2	Sun Sep  8 15:44:14 2013
+++ src/sys/external/bsd/drm2/drm/drm_gem_vm.c	Sun Sep  8 15:56:32 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_gem_vm.c,v 1.1.2.2 2013/09/08 15:44:14 riastradh Exp $	*/
+/*	$NetBSD: drm_gem_vm.c,v 1.1.2.3 2013/09/08 15:56:32 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: drm_gem_vm.c,v 1.1.2.2 2013/09/08 15:44:14 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: drm_gem_vm.c,v 1.1.2.3 2013/09/08 15:56:32 riastradh Exp $);
 
 #include sys/types.h
 
@@ -56,7 +56,7 @@ drm_gem_pager_detach(struct uvm_object *
 	struct drm_gem_object *const obj = container_of(uobj,
 	struct drm_gem_object, gemo_uvmobj);
 
-	drm_gem_object_unreference(obj);
+	drm_gem_object_unreference_unlocked(obj);
 }
 
 int



CVS commit: [riastradh-drm2] src/sys

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:57:55 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm [riastradh-drm2]: drm_crtc.c
src/sys/modules/drm2 [riastradh-drm2]: Makefile

Log Message:
Use -Wno-shadow, not a cpp kludge, for drm_crtc.c's local min/max.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.16 -r1.1.1.1.2.17 \
src/sys/external/bsd/drm2/dist/drm/drm_crtc.c
cvs rdiff -u -r1.1.2.39 -r1.1.2.40 src/sys/modules/drm2/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_crtc.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.1.1.1.2.16 src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.1.1.1.2.17
--- src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.1.1.1.2.16	Wed Jul 24 04:03:15 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_crtc.c	Sun Sep  8 15:57:54 2013
@@ -2914,12 +2914,6 @@ struct drm_property *drm_property_create
 }
 EXPORT_SYMBOL(drm_property_create_bitmask);
 
-#ifdef __NetBSD__
-/* XXX Whattakludge...  */
-#  define	min	min_hack
-#  define	max	max_hack
-#endif
-
 struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
 	 const char *name,
 	 uint64_t min, uint64_t max)
@@ -2939,11 +2933,6 @@ struct drm_property *drm_property_create
 }
 EXPORT_SYMBOL(drm_property_create_range);
 
-#ifdef __NetBSD__
-#  undef	min
-#  undef	max
-#endif
-
 int drm_property_add_enum(struct drm_property *property, int index,
 			  uint64_t value, const char *name)
 {

Index: src/sys/modules/drm2/Makefile
diff -u src/sys/modules/drm2/Makefile:1.1.2.39 src/sys/modules/drm2/Makefile:1.1.2.40
--- src/sys/modules/drm2/Makefile:1.1.2.39	Sun Sep  8 15:41:07 2013
+++ src/sys/modules/drm2/Makefile	Sun Sep  8 15:57:54 2013
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.2.39 2013/09/08 15:41:07 riastradh Exp $
+# $NetBSD: Makefile,v 1.1.2.40 2013/09/08 15:57:54 riastradh Exp $
 
 .include ../Makefile.inc
 .include Makefile.inc
@@ -58,4 +58,6 @@ SRCS+=	linux_i2c.c
 SRCS+=	linux_idr.c
 SRCS+=	linux_list_sort.c
 
+COPTS.drm_crtc.c+=	-Wno-shadow
+
 .include bsd.kmodule.mk



CVS commit: src/share/man/man4

2013-09-08 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Sun Sep  8 15:57:39 UTC 2013

Modified Files:
src/share/man/man4: Makefile
Added Files:
src/share/man/man4: mpl115a.4

Log Message:
Add mpl115a(4) man page for the new MPL115A2 pressure sensor driver.


To generate a diff of this commit:
cvs rdiff -u -r1.601 -r1.602 src/share/man/man4/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/mpl115a.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.601 src/share/man/man4/Makefile:1.602
--- src/share/man/man4/Makefile:1.601	Tue Aug  6 22:33:59 2013
+++ src/share/man/man4/Makefile	Sun Sep  8 15:57:39 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.601 2013/08/06 22:33:59 soren Exp $
+#	$NetBSD: Makefile,v 1.602 2013/09/08 15:57:39 rkujawa Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -121,8 +121,8 @@ MAN+=	sc.4 si.4
 MAN+=	fwohci.4 fwip.4 sbp.4
 
 # machine-independent I2C devices
-MAN+=	dbcool.4 g760a.4 lmtemp.4 mcp980x.4 sdtemp.4 smscmon.4 spdmem.4 \
-	tps65217pmic.4
+MAN+=	dbcool.4 g760a.4 lmtemp.4 mcp980x.4 mpl115a.4 sdtemp.4 smscmon.4 \
+	spdmem.4 tps65217pmic.4
 
 # machine-independent SPI devices
 MAN +=	m25p.4 tm121temp.4

Added files:

Index: src/share/man/man4/mpl115a.4
diff -u /dev/null src/share/man/man4/mpl115a.4:1.1
--- /dev/null	Sun Sep  8 15:57:39 2013
+++ src/share/man/man4/mpl115a.4	Sun Sep  8 15:57:39 2013
@@ -0,0 +1,67 @@
+.\ $NetBSD: mpl115a.4,v 1.1 2013/09/08 15:57:39 rkujawa Exp $
+.\
+.\ Copyright (c) 2013 The NetBSD Foundation, Inc.
+.\ All rights reserved.
+.\
+.\ This code is derived from software contributed to The NetBSD Foundation
+.\ by Radoslaw Kujawa.
+.\
+.\ 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\
+.Dd September 8, 2013
+.Dt MPL115A 4
+.Os
+.Sh NAME
+.Nm mpl115a 
+.Nd Freescale MPL115A2 absolute pressure sensor driver
+.Sh SYNOPSIS
+.Cd mpl115a* at iic? addr 0x60
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the MPL115A2 pressure sensor.
+It allows reporting absolute pressure through the
+.Xr envsys 4
+API.
+.Sh SEE ALSO
+.Xr envsys 4
+.Sh HISTORY
+The
+.Nm
+device first appeared in
+.Nx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Radoslaw Kujawa Aq radoslaw.kuj...@gmail.com .
+The fixed-point pressure calculation algorithm was suggested by
+.An Matt Thomas .
+.Sh CAVEATS
+The MPL115A2 chip has an accuracy of +/- 1 kPa, which makes it not very useful
+for weather-related applications.
+.Pp
+The
+.Xr envsys 4
+API does not support pressure reporting yet, so the result is reported just as
+integer number.



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:58:53 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: intel_pm.c

Log Message:
Add missing includes to intel_pm.c.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.3 -r1.1.1.1.2.4 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.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/external/bsd/drm2/dist/drm/i915/intel_pm.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c:1.1.1.1.2.3 src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c:1.1.1.1.2.4
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c:1.1.1.1.2.3	Wed Jul 24 02:58:56 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c	Sun Sep  8 15:58:53 2013
@@ -32,6 +32,11 @@
 #include ../../../platform/x86/intel_ips.h
 #endif
 #include linux/module.h
+#include linux/kgdb.h
+#include linux/log2.h
+#include linux/math64.h
+#include linux/time.h
+#include asm/param.h
 
 #define FORCEWAKE_ACK_TIMEOUT_MS 2
 



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:58:24 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: jiffies.h
kernel.h kgdb.h workqueue.h

Log Message:
Buncha new cruft for linux/*.h.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \
src/sys/external/bsd/drm2/include/linux/jiffies.h
cvs rdiff -u -r1.1.2.20 -r1.1.2.21 \
src/sys/external/bsd/drm2/include/linux/kernel.h
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \
src/sys/external/bsd/drm2/include/linux/kgdb.h
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 \
src/sys/external/bsd/drm2/include/linux/workqueue.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/external/bsd/drm2/include/linux/jiffies.h
diff -u src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.5
--- src/sys/external/bsd/drm2/include/linux/jiffies.h:1.1.2.4	Sun Sep  8 15:38:04 2013
+++ src/sys/external/bsd/drm2/include/linux/jiffies.h	Sun Sep  8 15:58:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: jiffies.h,v 1.1.2.4 2013/09/08 15:38:04 riastradh Exp $	*/
+/*	$NetBSD: jiffies.h,v 1.1.2.5 2013/09/08 15:58:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -44,6 +44,12 @@ msecs_to_jiffies(unsigned int msec)
 }
 
 static inline unsigned int
+jiffies_to_msecs(unsigned int j)
+{
+	return hztoms(j);
+}
+
+static inline unsigned int
 usecs_to_jiffies(unsigned int usec)
 {
 	return mstohz((usec + (1000 / hz) - 1) / (1000 / hz));

Index: src/sys/external/bsd/drm2/include/linux/kernel.h
diff -u src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.20 src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.21
--- src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.20	Wed Jul 24 03:45:24 2013
+++ src/sys/external/bsd/drm2/include/linux/kernel.h	Sun Sep  8 15:58:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernel.h,v 1.1.2.20 2013/07/24 03:45:24 riastradh Exp $	*/
+/*	$NetBSD: kernel.h,v 1.1.2.21 2013/09/08 15:58:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -51,6 +51,13 @@
 #define	min_t(T, X, Y)	MIN(X, Y)
 
 /*
+ * Rounding to nearest.
+ */
+#define	DIV_ROUND_CLOSEST(N, D)		\
+	((0  (N)) ? (((N) + ((D) / 2)) / (D))\
+	: (((N) - ((D) / 2)) / (D)))
+
+/*
  * Rounding to what may or may not be powers of two.
  */
 #define	DIV_ROUND_UP(X, N)	(((X) + (N) - 1) / (N))

Index: src/sys/external/bsd/drm2/include/linux/kgdb.h
diff -u src/sys/external/bsd/drm2/include/linux/kgdb.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/kgdb.h:1.1.2.2
--- src/sys/external/bsd/drm2/include/linux/kgdb.h:1.1.2.1	Wed Jul 24 00:33:12 2013
+++ src/sys/external/bsd/drm2/include/linux/kgdb.h	Sun Sep  8 15:58:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: kgdb.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $	*/
+/*	$NetBSD: kgdb.h,v 1.1.2.2 2013/09/08 15:58:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,4 +32,26 @@
 #ifndef _LINUX_KGDB_H_
 #define _LINUX_KGDB_H_
 
+#if 0/* XXX */
+#include opt_ddb.h
+#else
+#define	DDB
+#endif
+
+#ifdef DDB
+extern int	db_active;
+
+static inline bool
+in_dbg_master(void)
+{
+	return db_active;
+}
+#else
+static inline bool
+in_dbg_master(void)
+{
+	return false;
+}
+#endif
+
 #endif  /* _LINUX_KGDB_H_ */

Index: src/sys/external/bsd/drm2/include/linux/workqueue.h
diff -u src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.8 src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.9
--- src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.8	Sun Sep  8 15:39:05 2013
+++ src/sys/external/bsd/drm2/include/linux/workqueue.h	Sun Sep  8 15:58:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: workqueue.h,v 1.1.2.8 2013/09/08 15:39:05 riastradh Exp $	*/
+/*	$NetBSD: workqueue.h,v 1.1.2.9 2013/09/08 15:58:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -86,16 +86,28 @@ schedule_delayed_work(struct delayed_wor
 	callout_schedule(dw-work.ws_callout, (int)ticks);
 }
 
-static inline void
+static inline bool
+cancel_work(struct work_struct *work)
+{
+	return !callout_stop(work-ws_callout);
+}
+
+static inline bool
 cancel_work_sync(struct work_struct *work)
 {
-	callout_halt(work-ws_callout, NULL);
+	return !callout_halt(work-ws_callout, NULL);
 }
 
-static inline void
+static inline bool
+cancel_delayed_work(struct delayed_work *dw)
+{
+	return cancel_work(dw-work);
+}
+
+static inline bool
 cancel_delayed_work_sync(struct delayed_work *dw)
 {
-	cancel_work_sync(dw-work);
+	return cancel_work_sync(dw-work);
 }
 
 /*



CVS commit: [riastradh-drm2] src/sys

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 15:59:47 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: intel_pm.c
src/sys/modules/i915drm2 [riastradh-drm2]: Makefile
Removed Files:
src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: intel_pm.c

Log Message:
Adapt intel_pm.c to NetBSD.  Drop stubs.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c
cvs rdiff -u -r1.1.2.5 -r0 src/sys/external/bsd/drm2/i915drm/intel_pm.c
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/modules/i915drm2/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c:1.1.1.1.2.4 src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c:1.1.1.1.2.5
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c:1.1.1.1.2.4	Sun Sep  8 15:58:53 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c	Sun Sep  8 15:59:47 2013
@@ -2300,7 +2300,11 @@ err_unref:
 /**
  * Lock protecting IPS related data structures
  */
+#ifdef __NetBSD__
+spinlock_t mchdev_lock;
+#else
 DEFINE_SPINLOCK(mchdev_lock);
+#endif
 
 /* Global for IPS driver to get at the current i915 device. Protected by
  * mchdev_lock. */
@@ -2682,6 +2686,12 @@ static void gen6_update_ring_freq(struct
 
 	WARN_ON(!mutex_is_locked(dev_priv-rps.hw_lock));
 
+#ifdef __NetBSD__		/* XXX cpufreq */
+	{
+		extern uint64_t tsc_freq; /* x86 TSC frequency in Hz */
+		max_ia_freq = (tsc_freq / 1000);
+	}
+#else
 	max_ia_freq = cpufreq_quick_get_max(0);
 	/*
 	 * Default to measured freq if none found, PCU will ensure we don't go
@@ -2689,6 +2699,7 @@ static void gen6_update_ring_freq(struct
 	 */
 	if (!max_ia_freq)
 		max_ia_freq = tsc_khz;
+#endif
 
 	/* Convert from kHz to MHz */
 	max_ia_freq /= 1000;
@@ -3190,6 +3201,7 @@ unsigned long i915_gfx_val(struct drm_i9
 	return val;
 }
 
+#ifndef __NetBSD__		/* XXX IPS */
 /**
  * i915_read_mch_val - return value for IPS use
  *
@@ -3329,6 +3341,7 @@ out_unlock:
 	return ret;
 }
 EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable);
+#endif
 
 /**
  * Tells the intel_ips driver that the i915 driver is now loaded, if
@@ -3354,6 +3367,14 @@ ips_ping_for_i915_load(void)
 
 void intel_gpu_ips_init(struct drm_i915_private *dev_priv)
 {
+#ifdef __NetBSD__		/* XXX */
+	/*
+	 * This seems as good a place as any to initialize mchdev_lock.
+	 * Taking the lock in the rest of this routine is silly, but...
+	 */
+	spin_lock_init(mchdev_lock);
+#endif
+
 	/* We only register the i915 ips part with intel-ips once everything is
 	 * set up, to avoid intel-ips sneaking in and reading bogus values. */
 	spin_lock_irq(mchdev_lock);
@@ -3368,6 +3389,9 @@ void intel_gpu_ips_teardown(void)
 	spin_lock_irq(mchdev_lock);
 	i915_mch_dev = NULL;
 	spin_unlock_irq(mchdev_lock);
+#ifdef __NetBSD__
+	spin_lock_destroy(mchdev_lock);
+#endif
 }
 static void intel_init_emon(struct drm_device *dev)
 {

Index: src/sys/modules/i915drm2/Makefile
diff -u src/sys/modules/i915drm2/Makefile:1.1.2.9 src/sys/modules/i915drm2/Makefile:1.1.2.10
--- src/sys/modules/i915drm2/Makefile:1.1.2.9	Sun Sep  8 15:52:20 2013
+++ src/sys/modules/i915drm2/Makefile	Sun Sep  8 15:59:47 2013
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.2.9 2013/09/08 15:52:20 riastradh Exp $
+# $NetBSD: Makefile,v 1.1.2.10 2013/09/08 15:59:47 riastradh Exp $
 
 .include ../Makefile.inc
 .include ../drm2/Makefile.inc
@@ -57,4 +57,6 @@ SRCS+=	i915_module.c
 SRCS+=	i915_pci.c
 SRCS+=	intel_gtt.c
 
+COPTS.intel_pm.c+=	-Wno-shadow
+
 .include bsd.kmodule.mk



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:01:22 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_dma.c

Log Message:
More little error branch cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.26 -r1.1.1.1.2.27 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.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/external/bsd/drm2/dist/drm/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.26 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.27
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.26	Sun Sep  8 16:00:22 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Sun Sep  8 16:01:22 2013
@@ -1757,6 +1757,8 @@ out_gem_unload:
 	spin_lock_destroy(dev_priv-rps.lock);
 	spin_lock_destroy(dev_priv-dpio_lock);
 	linux_mutex_destroy(dev_priv-rps.hw_lock);
+	DRM_DESTROY_WAITQUEUE(dev_priv-pending_flip_queue);
+	destroy_completion(dev_priv-error_completion);
 #endif
 
 	if (dev-pdev-msi_enabled)
@@ -1891,6 +1893,12 @@ int i915_driver_unload(struct drm_device
 	}
 
 #ifdef __NetBSD__
+	/* XXX Not sure this is the right place, but it looks safe.  */
+	DRM_DESTROY_WAITQUEUE(dev_priv-pending_flip_queue);
+	destroy_completion(dev_priv-error_completion);
+#endif
+
+#ifdef __NetBSD__
 	if (dev_priv-regs_map != NULL)
 		(void)drm_rmmap(dev, dev_priv-regs_map);
 #else



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:02:21 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]:
intel_ringbuffer.c

Log Message:
More error branch cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.8 -r1.1.1.1.2.9 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.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/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.1.1.1.2.8 src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.1.1.1.2.9
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.1.1.1.2.8	Sun Sep  8 15:54:20 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c	Sun Sep  8 16:02:21 2013
@@ -1180,12 +1180,12 @@ static int intel_init_ring_buffer(struct
 	if (I915_NEED_GFX_HWS(dev)) {
 		ret = init_status_page(ring);
 		if (ret)
-			return ret;
+			goto err_waitqueue;
 	} else {
 		BUG_ON(ring-id != RCS);
 		ret = init_phys_hws_pga(ring);
 		if (ret)
-			return ret;
+			goto err_waitqueue;
 	}
 
 	obj = i915_gem_alloc_object(dev, ring-size);
@@ -1254,6 +1254,10 @@ err_unref:
 	ring-obj = NULL;
 err_hws:
 	cleanup_status_page(ring);
+err_waitqueue:
+#ifdef __NetBSD__
+	DRM_DESTROY_WAITQUEUE(ring-irq_queue);
+#endif
 	return ret;
 }
 



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:01:49 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: completion.h

Log Message:
Destroy the mutex too in destroy_completion.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \
src/sys/external/bsd/drm2/include/linux/completion.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/external/bsd/drm2/include/linux/completion.h
diff -u src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.5
--- src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.4	Sun Sep  8 16:00:50 2013
+++ src/sys/external/bsd/drm2/include/linux/completion.h	Sun Sep  8 16:01:49 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: completion.h,v 1.1.2.4 2013/09/08 16:00:50 riastradh Exp $	*/
+/*	$NetBSD: completion.h,v 1.1.2.5 2013/09/08 16:01:49 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -78,6 +78,7 @@ destroy_completion(struct completion *co
 {
 	KASSERT(!cv_has_waiters(completion-c_cv));
 	cv_destroy(completion-c_cv);
+	mutex_destroy(completion-c_lock);
 }
 
 /*



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:03:21 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_dma.c
i915_gem.c i915_irq.c

Log Message:
Use dev-struct_mutex, not drm_global_mutex, for ring-irq_queue.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.27 -r1.1.1.1.2.28 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
cvs rdiff -u -r1.1.1.1.2.11 -r1.1.1.1.2.12 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
cvs rdiff -u -r1.1.1.1.2.6 -r1.1.1.1.2.7 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_irq.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/external/bsd/drm2/dist/drm/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.27 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.28
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.27	Sun Sep  8 16:01:22 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Sun Sep  8 16:03:21 2013
@@ -795,7 +795,7 @@ static int i915_wait_irq(struct drm_devi
 
 	if (ring-irq_get(ring)) {
 #ifdef __NetBSD__
-		DRM_TIMED_WAIT_UNTIL(ret, ring-irq_queue, drm_global_mutex,
+		DRM_TIMED_WAIT_UNTIL(ret, ring-irq_queue, dev-struct_mutex,
 		3 * DRM_HZ,
 		READ_BREADCRUMB(dev_priv) = irq_nr);
 #else

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.11 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.12
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.11	Sun Sep  8 16:00:22 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Sun Sep  8 16:03:21 2013
@@ -1197,7 +1197,8 @@ static int __wait_seqno(struct intel_rin
 		 * XXX This wait is always interruptible; we should
 		 * heed the flag `interruptible'.
 		 */
-		DRM_TIMED_WAIT_UNTIL(end, ring-irq_queue, drm_global_mutex,
+		DRM_TIMED_WAIT_UNTIL(end, ring-irq_queue,
+		ring-dev-struct_mutex,
 		timeout_jiffies,
 		EXIT_COND);
 #else

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_irq.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_irq.c:1.1.1.1.2.6 src/sys/external/bsd/drm2/dist/drm/i915/i915_irq.c:1.1.1.1.2.7
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_irq.c:1.1.1.1.2.6	Wed Jul 24 04:01:22 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_irq.c	Sun Sep  8 16:03:21 2013
@@ -355,7 +355,7 @@ static void notify_ring(struct drm_devic
 	trace_i915_gem_request_complete(ring, ring-get_seqno(ring, false));
 
 #ifdef __NetBSD__
-	DRM_WAKEUP_ALL(ring-irq_queue, drm_global_mutex);
+	DRM_WAKEUP_ALL(ring-irq_queue, dev-struct_mutex);
 #else
 	wake_up_all(ring-irq_queue);
 #endif
@@ -1168,7 +1168,7 @@ static void i915_record_ring_state(struc
 
 #ifdef __NetBSD__
 	error-waiting[ring-id] = DRM_WAITERS_P(ring-irq_queue,
-	drm_global_mutex);
+	dev-struct_mutex);
 #else
 	error-waiting[ring-id] = waitqueue_active(ring-irq_queue);
 #endif
@@ -1487,7 +1487,7 @@ void i915_handle_error(struct drm_device
 		 */
 		for_each_ring(ring, dev_priv, i)
 #ifdef __NetBSD__
-			DRM_WAKEUP_ALL(ring-irq_queue, drm_global_mutex);
+			DRM_WAKEUP_ALL(ring-irq_queue, dev-struct_mutex);
 #else
 			wake_up_all(ring-irq_queue);
 #endif
@@ -1696,12 +1696,21 @@ static bool i915_hangcheck_ring_idle(str
 			  ring_last_seqno(ring))) {
 		/* Issue a wake-up to catch stuck h/w. */
 #ifdef __NetBSD__
-		if (DRM_WAITERS_P(ring-irq_queue, drm_global_mutex)) {
+		/*
+		 * XXX mutex_lock here is a load of bollocks, but I'm
+		 * not sure what invariants the irq_queue is actually
+		 * relying on.
+		 */
+		mutex_lock(ring-dev-struct_mutex);
+		if (DRM_WAITERS_P(ring-irq_queue,
+			ring-dev-struct_mutex)) {
 			DRM_ERROR(Hangcheck timer elapsed... %s idle\n,
   ring-name);
-			DRM_WAKEUP_ALL(ring-irq_queue, drm_global_mutex);
+			DRM_WAKEUP_ALL(ring-irq_queue,
+			ring-dev-struct_mutex);
 			*err = true;
 		}
+		mutex_unlock(ring-dev-struct_mutex);
 #else
 		if (waitqueue_active(ring-irq_queue)) {
 			DRM_ERROR(Hangcheck timer elapsed... %s idle\n,



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:02:51 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/drm [riastradh-drm2]:
drm_wait_netbsd.h

Log Message:
Fix result of DRM_TIMED_WAIT_UNTIL.

This has to return a positive number of ticks left if we haven't
timed out in order to match the semantics of Linux waitqueues.

This also fixes the amount of time for timeout if we ever wait for
more than one iteration.

Now we can actually wait for results from the ring buffers!


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 \
src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.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/external/bsd/drm2/include/drm/drm_wait_netbsd.h
diff -u src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.6 src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.7
--- src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.6	Wed Jul 24 03:08:03 2013
+++ src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h	Sun Sep  8 16:02:50 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_wait_netbsd.h,v 1.1.2.6 2013/07/24 03:08:03 riastradh Exp $	*/
+/*	$NetBSD: drm_wait_netbsd.h,v 1.1.2.7 2013/09/08 16:02:50 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -112,13 +112,28 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, 
 
 #define	DRM_TIMED_WAIT_UNTIL(RET, Q, INTERLOCK, TICKS, CONDITION) do	\
 {	\
+	extern int hardclock_ticks;	\
+	const int _dtwu_start = hardclock_ticks;			\
+	int _dtwu_ticks = (TICKS);	\
 	KASSERT(mutex_is_locked((INTERLOCK)));\
-	while (!(CONDITION)) {		\
+	for (;;) {			\
+		if (CONDITION) {	\
+			(RET) = _dtwu_ticks;\
+			break;		\
+		}			\
 		/* XXX errno NetBSD-Linux */\
 		(RET) = -cv_timedwait_sig((Q), (INTERLOCK)-mtx_lock,	\
-		(TICKS));		\
+		_dtwu_ticks);	\
 		if (RET)		\
 			break;		\
+		const int _dtwu_now = hardclock_ticks;			\
+		KASSERT(_dtwu_start = _dtwu_now);			\
+		if ((_dtwu_now - _dtwu_start)  _dtwu_ticks) {		\
+			_dtwu_ticks -= (_dtwu_now - _dtwu_start);	\
+		} else {		\
+			(RET) = 0;	\
+			break;		\
+		}			\
 	}\
 } while (0)
 
@@ -136,13 +151,28 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, 
 #define	DRM_SPIN_TIMED_WAIT_UNTIL(RET, Q, INTERLOCK, TICKS, CONDITION)	\
 	do\
 {	\
+	extern int hardclock_ticks;	\
+	const int _dstwu_start = hardclock_ticks;			\
+	int _dstwu_ticks = (TICKS);	\
 	KASSERT(spin_is_locked((INTERLOCK)));\
-	while (!(CONDITION)) {		\
+	for (;;) {			\
+		if (CONDITION) {	\
+			(RET) = _dstwu_ticks;\
+			break;		\
+		}			\
 		/* XXX errno NetBSD-Linux */\
 		(RET) = -cv_timedwait_sig((Q), (INTERLOCK)-sl_lock,	\
-		(TICKS));		\
+		_dstwu_ticks);	\
 		if (RET)		\
 			break;		\
+		const int _dstwu_now = hardclock_ticks;			\
+		KASSERT(_dstwu_start = _dstwu_now);			\
+		if ((_dstwu_now - _dstwu_start)  _dstwu_ticks) {	\
+			_dstwu_ticks -= (_dstwu_now - _dstwu_start);	\
+		} else {		\
+			(RET) = 0;	\
+			break;		\
+		}			\
 	}\
 } while (0)
 



CVS commit: src/doc

2013-09-08 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Sun Sep  8 16:04:21 UTC 2013

Modified Files:
src/doc: CHANGES

Log Message:
Note the new driver for MPL115A2.


To generate a diff of this commit:
cvs rdiff -u -r1.1846 -r1.1847 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1846 src/doc/CHANGES:1.1847
--- src/doc/CHANGES:1.1846	Wed Sep  4 19:51:37 2013
+++ src/doc/CHANGES	Sun Sep  8 16:04:21 2013
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1846 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1847 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -279,3 +279,5 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
 		card. [rkujawa 20130808]
 	postfix(1): Import version 2.9.7 [tron 20130821]
 less(1): Import version 458 [tron 20130804]
+	mpl115a(4): Add driver for Freescale MPL115A2 I2C absolute pressure 
+		sensor. [rkujawa 20130908]



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:04:09 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_gem.c

Log Message:
The bus_dmamap_load_raw got moved to i915_gem_gtt but not committed.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.12 -r1.1.1.1.2.13 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.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/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.12 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.13
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.12	Sun Sep  8 16:03:21 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Sun Sep  8 16:04:09 2013
@@ -2034,7 +2034,6 @@ i915_gem_object_put_pages_gtt(struct drm
 
 	/* XXX Maintain dirty flag?  */
 
-	bus_dmamap_unload(dev-dmat, obj-igo_dmamap);
 	bus_dmamap_destroy(dev-dmat, obj-igo_dmamap);
 	bus_dmamem_unwire_uvm_object(dev-dmat, obj-base.gemo_shm_uao, 0,
 	obj-base.size, obj-pages, obj-igo_nsegs);
@@ -2198,12 +2197,6 @@ i915_gem_object_get_pages_gtt(struct drm
 	if (error)
 		goto fail2;
 
-	/* XXX errno NetBSD-Linux */
-	error = -bus_dmamap_load_raw(dev-dmat, obj-igo_dmamap, obj-pages,
-	obj-igo_nsegs, obj-base.size, BUS_DMA_NOWAIT);
-	if (error)
-		goto fail3;
-
 	/* XXX Cargo-culted from the Linux code.  */
 	if (i915_gem_object_needs_bit17_swizzle(obj))
 		i915_gem_object_do_bit_17_swizzle(obj);
@@ -2211,7 +2204,6 @@ i915_gem_object_get_pages_gtt(struct drm
 	/* Success!  */
 	return 0;
 
-fail3:	bus_dmamap_destroy(dev-dmat, obj-igo_dmamap);
 fail2:	bus_dmamem_unwire_uvm_object(dev-dmat, obj-base.gemo_shm_uao, 0,
 	obj-base.size, obj-pages, (obj-base.size / PAGE_SIZE));
 fail1:	kfree(obj-pages);



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:05:07 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_gem.c

Log Message:
Check that GEM wired pages use at most 40 bits of physical addresses.

Can't express this constraint to uvm_obj_wirepages at the moment, so
at least fail early and noisily if we violate it.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.13 -r1.1.1.1.2.14 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.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/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.13 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.14
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.13	Sun Sep  8 16:04:09 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Sun Sep  8 16:05:06 2013
@@ -2166,6 +2166,7 @@ static int
 i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
 {
 	struct drm_device *const dev = obj-base.dev;
+	struct vm_page *page;
 	int error;
 
 	/* XXX Cargo-culted from the Linux code.  */
@@ -2191,6 +2192,21 @@ i915_gem_object_get_pages_gtt(struct drm
 	KASSERT(0  obj-igo_nsegs);
 	KASSERT(obj-igo_nsegs = (obj-base.size / PAGE_SIZE));
 
+	/*
+	 * Check that the paddrs will fit in 40 bits.
+	 *
+	 * XXX This is wrong; we ought to pass this constraint to
+	 * bus_dmamem_wire_uvm_object instead.
+	 */
+	TAILQ_FOREACH(page, obj-igo_pageq, pageq.queue) {
+		if (VM_PAGE_TO_PHYS(page)  ~0xffULL) {
+			DRM_ERROR(GEM physical address exceeds 40 bits
+			: %PRIxMAX\n,
+			(uintmax_t)VM_PAGE_TO_PHYS(page));
+			goto fail2;
+		}
+	}
+
 	/* XXX errno NetBSD-Linux */
 	error = -bus_dmamap_create(dev-dmat, obj-base.size, obj-igo_nsegs,
 	PAGE_SIZE, 0, BUS_DMA_NOWAIT, obj-igo_dmamap);



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:00:22 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_dma.c
i915_drv.h i915_gem.c i915_gem_stolen.c intel_pm.c
src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: i915_gem_gtt.c

Log Message:
Fix a bunch of i915 error branches.

Some of these fixes are necessary only on NetBSD because we require
mutex_destroy, while Linux doesn't.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.25 -r1.1.1.1.2.26 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
cvs rdiff -u -r1.1.1.1.2.15 -r1.1.1.1.2.16 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
cvs rdiff -u -r1.1.1.1.2.10 -r1.1.1.1.2.11 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
cvs rdiff -u -r1.1.1.1.2.2 -r1.1.1.1.2.3 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c
cvs rdiff -u -r1.1.1.1.2.5 -r1.1.1.1.2.6 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \
src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.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/external/bsd/drm2/dist/drm/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.25 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.26
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.25	Sun Sep  8 15:54:20 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Sun Sep  8 16:00:22 2013
@@ -1396,6 +1396,7 @@ cleanup_gem:
 	mutex_unlock(dev-struct_mutex);
 	i915_gem_cleanup_aliasing_ppgtt(dev);
 cleanup_gem_stolen:
+	intel_modeset_cleanup(dev);
 	i915_gem_cleanup_stolen(dev);
 cleanup_vga_switcheroo:
 #ifndef __NetBSD__		/* XXX vga */
@@ -1725,7 +1726,7 @@ int i915_driver_load(struct drm_device *
 		ret = i915_load_modeset_init(dev);
 		if (ret  0) {
 			DRM_ERROR(failed to init modeset\n);
-			goto out_gem_unload;
+			goto out_vblank_cleanup;
 		}
 	}
 
@@ -1743,6 +1744,9 @@ int i915_driver_load(struct drm_device *
 
 	return 0;
 
+out_vblank_cleanup:
+	drm_vblank_cleanup(dev);
+
 out_gem_unload:
 	if (dev_priv-mm.inactive_shrinker.shrink)
 		unregister_shrinker(dev_priv-mm.inactive_shrinker);
@@ -1760,6 +1764,9 @@ out_gem_unload:
 
 	intel_teardown_gmbus(dev);
 	intel_teardown_mchbar(dev);
+#ifdef __NetBSD__		/* XXX gt fini */
+	intel_gt_fini(dev);
+#endif
 	destroy_workqueue(dev_priv-wq);
 out_mtrrfree:
 #ifndef __NetBSD__		/* XXX gtt */

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.1.1.1.2.15 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.1.1.1.2.16
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.1.1.1.2.15	Sun Sep  8 15:52:20 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h	Sun Sep  8 16:00:22 2013
@@ -1360,6 +1360,9 @@ void i915_handle_error(struct drm_device
 
 extern void intel_irq_init(struct drm_device *dev);
 extern void intel_gt_init(struct drm_device *dev);
+#ifdef __NetBSD__		/* XXX gt fini */
+extern void intel_gt_fini(struct drm_device *dev);
+#endif
 extern void intel_gt_reset(struct drm_device *dev);
 
 void i915_error_state_free(struct kref *error_ref);
@@ -1625,6 +1628,9 @@ void i915_gem_init_global_gtt(struct drm
 			  unsigned long start,
 			  unsigned long mappable_end,
 			  unsigned long end);
+#ifdef __NetBSD__		/* XXX fini global gtt */
+void i915_gem_fini_global_gtt(struct drm_device *dev);
+#endif
 int i915_gem_gtt_init(struct drm_device *dev);
 void i915_gem_gtt_fini(struct drm_device *dev);
 static inline void i915_gem_chipset_flush(struct drm_device *dev)

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.10 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.11
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.10	Sun Sep  8 15:56:02 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Sun Sep  8 16:00:22 2013
@@ -4462,6 +4462,9 @@ int i915_gem_init(struct drm_device *dev
 
 		ret = i915_gem_init_aliasing_ppgtt(dev);
 		if (ret) {
+#ifdef __NetBSD__		/* XXX fini global gtt */
+			i915_gem_fini_global_gtt(dev);
+#endif
 			mutex_unlock(dev-struct_mutex);
 			return ret;
 		}
@@ -4481,6 +4484,10 @@ int i915_gem_init(struct drm_device *dev
 	}
 
 	ret = i915_gem_init_hw(dev);
+#ifdef __NetBSD__		/* XXX fini global gtt */
+	if (ret)
+		i915_gem_fini_global_gtt(dev);
+#endif
 	mutex_unlock(dev-struct_mutex);
 	if (ret) {
 		i915_gem_cleanup_aliasing_ppgtt(dev);

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c:1.1.1.1.2.2 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c:1.1.1.1.2.3
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c:1.1.1.1.2.2	Tue Jul 23 21:28:22 2013
+++ 

CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:06:35 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: dvo_ch7xxx.c

Log Message:
Remove #ifdef __NetBSD__ from const fixes in dvo_ch7xxx.c.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.3 -r1.1.1.1.2.4 \
src/sys/external/bsd/drm2/dist/drm/i915/dvo_ch7xxx.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/external/bsd/drm2/dist/drm/i915/dvo_ch7xxx.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/dvo_ch7xxx.c:1.1.1.1.2.3 src/sys/external/bsd/drm2/dist/drm/i915/dvo_ch7xxx.c:1.1.1.1.2.4
--- src/sys/external/bsd/drm2/dist/drm/i915/dvo_ch7xxx.c:1.1.1.1.2.3	Wed Jul 24 03:02:35 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/dvo_ch7xxx.c	Sun Sep  8 16:06:35 2013
@@ -84,11 +84,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
 static struct ch7xxx_id_struct {
 	uint8_t vid;
-#ifdef __NetBSD__
 	const char *name;
-#else
-	char *name;
-#endif
 } ch7xxx_ids[] = {
 	{ CH7011_VID, CH7011 },
 	{ CH7009A_VID, CH7009A },
@@ -100,11 +96,7 @@ struct ch7xxx_priv {
 	bool quiet;
 };
 
-#ifdef __NetBSD__
 static const char *ch7xxx_get_id(uint8_t vid)
-#else
-static char *ch7xxx_get_id(uint8_t vid)
-#endif
 {
 	int i;
 
@@ -187,11 +179,7 @@ static bool ch7xxx_init(struct intel_dvo
 	/* this will detect the CH7xxx chip on the specified i2c bus */
 	struct ch7xxx_priv *ch7xxx;
 	uint8_t vendor, device;
-#ifdef __NetBSD__
 	const char *name;
-#else
-	char *name;
-#endif
 
 	ch7xxx = kzalloc(sizeof(struct ch7xxx_priv), GFP_KERNEL);
 	if (ch7xxx == NULL)



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:00:50 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: completion.h

Log Message:
Implement destroy_completion in linux/completion.h.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \
src/sys/external/bsd/drm2/include/linux/completion.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/external/bsd/drm2/include/linux/completion.h
diff -u src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.4
--- src/sys/external/bsd/drm2/include/linux/completion.h:1.1.2.3	Wed Jul 24 03:29:43 2013
+++ src/sys/external/bsd/drm2/include/linux/completion.h	Sun Sep  8 16:00:50 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: completion.h,v 1.1.2.3 2013/07/24 03:29:43 riastradh Exp $	*/
+/*	$NetBSD: completion.h,v 1.1.2.4 2013/09/08 16:00:50 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -71,6 +71,16 @@ init_completion(struct completion *compl
 }
 
 /*
+ * Destroy a completion object.
+ */
+static inline void
+destroy_completion(struct completion *completion)
+{
+	KASSERT(!cv_has_waiters(completion-c_cv));
+	cv_destroy(completion-c_cv);
+}
+
+/*
  * Notify one waiter of completion, but not any future ones.
  */
 static inline void



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:07:29 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: atomic.h

Log Message:
Add Linux ATOMIC_INIT, atomic_inc_return, and atomic_dec_return.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 \
src/sys/external/bsd/drm2/include/linux/atomic.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/external/bsd/drm2/include/linux/atomic.h
diff -u src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.10 src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.11
--- src/sys/external/bsd/drm2/include/linux/atomic.h:1.1.2.10	Sun Sep  8 15:37:04 2013
+++ src/sys/external/bsd/drm2/include/linux/atomic.h	Sun Sep  8 16:07:29 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic.h,v 1.1.2.10 2013/09/08 15:37:04 riastradh Exp $	*/
+/*	$NetBSD: atomic.h,v 1.1.2.11 2013/09/08 16:07:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -43,6 +43,8 @@ struct atomic {
 	} a_u;
 };
 
+#define	ATOMIC_INIT(i)	{ .a_u = { .au_int = (i) } }
+
 typedef struct atomic atomic_t;
 
 static inline int
@@ -88,6 +90,18 @@ atomic_dec(atomic_t *atomic)
 }
 
 static inline int
+atomic_inc_return(atomic_t *atomic)
+{
+	return (int)atomic_inc_uint_nv(atomic-a_u.au_uint);
+}
+
+static inline int
+atomic_dec_return(atomic_t *atomic)
+{
+	return (int)atomic_dec_uint_nv(atomic-a_u.au_uint);
+}
+
+static inline int
 atomic_dec_and_test(atomic_t *atomic)
 {
 	return (-1 == (int)atomic_dec_uint_nv(atomic-a_u.au_uint));



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:08:38 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm [riastradh-drm2]: drm_auth.c

Log Message:
Use Linux atomics, not spinlocks or NetBSD atomics in drm_auth.c.

Removes an #ifdef __NetBSD__.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.3 -r1.1.1.1.2.4 \
src/sys/external/bsd/drm2/dist/drm/drm_auth.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/external/bsd/drm2/dist/drm/drm_auth.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_auth.c:1.1.1.1.2.3 src/sys/external/bsd/drm2/dist/drm/drm_auth.c:1.1.1.1.2.4
--- src/sys/external/bsd/drm2/dist/drm/drm_auth.c:1.1.1.1.2.3	Wed Jul 24 02:00:22 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_auth.c	Sun Sep  8 16:08:38 2013
@@ -141,10 +141,7 @@ int drm_remove_magic(struct drm_master *
  */
 int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
 {
-	static drm_magic_t sequence = 0;
-#ifndef __NetBSD__
-	static DEFINE_SPINLOCK(lock);
-#endif
+	static atomic_t sequence = ATOMIC_INIT(0);
 	struct drm_auth *auth = data;
 
 	/* Find unique magic */
@@ -152,15 +149,7 @@ int drm_getmagic(struct drm_device *dev,
 		auth-magic = file_priv-magic;
 	} else {
 		do {
-#ifdef __NetBSD__
-			auth-magic = atomic_inc_uint_nv(sequence);
-#else
-			spin_lock(lock);
-			if (!sequence)
-++sequence;	/* reserve 0 */
-			auth-magic = sequence++;
-			spin_unlock(lock);
-#endif
+			auth-magic = atomic_inc_return(sequence);
 		} while (drm_find_file(file_priv-master, auth-magic));
 		file_priv-magic = auth-magic;
 		drm_add_magic(file_priv-master, file_priv, auth-magic);



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:10:23 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm [riastradh-drm2]: drm_bufs.c

Log Message:
Unconditionally avoid arithmetic on void * in drm_bufs.c.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.12 -r1.1.1.1.2.13 \
src/sys/external/bsd/drm2/dist/drm/drm_bufs.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/external/bsd/drm2/dist/drm/drm_bufs.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_bufs.c:1.1.1.1.2.12 src/sys/external/bsd/drm2/dist/drm/drm_bufs.c:1.1.1.1.2.13
--- src/sys/external/bsd/drm2/dist/drm/drm_bufs.c:1.1.1.1.2.12	Wed Jul 24 03:11:06 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_bufs.c	Sun Sep  8 16:10:23 2013
@@ -942,11 +942,7 @@ int drm_addbufs_pci(struct drm_device * 
 			buf-order = order;
 			buf-used = 0;
 			buf-offset = (dma-byte_count + byte_count + offset);
-#ifdef __NetBSD__
 			buf-address = (void *)((char *)dmah-vaddr + offset);
-#else
-			buf-address = (void *)(dmah-vaddr + offset);
-#endif
 			buf-bus_address = dmah-busaddr + offset;
 			buf-next = NULL;
 			buf-waiting = 0;



CVS commit: [riastradh-drm2] src/sys

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:11:29 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm [riastradh-drm2]: drm_context.c
drm_crtc.c drm_edid.c drm_gem.c drm_global.c drm_irq.c
src/sys/external/bsd/drm2/dist/include/drm [riastradh-drm2]: drmP.h
drm_crtc.h drm_mm.h
src/sys/modules/drm2 [riastradh-drm2]: Makefile

Log Message:
Remove some more needless #ifdef __NetBSD__.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.6 -r1.1.1.1.2.7 \
src/sys/external/bsd/drm2/dist/drm/drm_context.c
cvs rdiff -u -r1.1.1.1.2.17 -r1.1.1.1.2.18 \
src/sys/external/bsd/drm2/dist/drm/drm_crtc.c
cvs rdiff -u -r1.1.1.1.2.10 -r1.1.1.1.2.11 \
src/sys/external/bsd/drm2/dist/drm/drm_edid.c
cvs rdiff -u -r1.1.1.1.2.7 -r1.1.1.1.2.8 \
src/sys/external/bsd/drm2/dist/drm/drm_gem.c
cvs rdiff -u -r1.1.1.1.2.5 -r1.1.1.1.2.6 \
src/sys/external/bsd/drm2/dist/drm/drm_global.c
cvs rdiff -u -r1.1.1.1.2.9 -r1.1.1.1.2.10 \
src/sys/external/bsd/drm2/dist/drm/drm_irq.c
cvs rdiff -u -r1.1.1.1.2.51 -r1.1.1.1.2.52 \
src/sys/external/bsd/drm2/dist/include/drm/drmP.h
cvs rdiff -u -r1.1.1.1.2.5 -r1.1.1.1.2.6 \
src/sys/external/bsd/drm2/dist/include/drm/drm_crtc.h
cvs rdiff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 \
src/sys/external/bsd/drm2/dist/include/drm/drm_mm.h
cvs rdiff -u -r1.1.2.40 -r1.1.2.41 src/sys/modules/drm2/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_context.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_context.c:1.1.1.1.2.6 src/sys/external/bsd/drm2/dist/drm/drm_context.c:1.1.1.1.2.7
--- src/sys/external/bsd/drm2/dist/drm/drm_context.c:1.1.1.1.2.6	Wed Jul 24 03:55:48 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_context.c	Sun Sep  8 16:11:29 2013
@@ -121,9 +121,7 @@ void drm_ctxbitmap_cleanup(struct drm_de
 {
 	mutex_lock(dev-struct_mutex);
 	idr_remove_all(dev-ctx_idr);
-#ifdef __NetBSD__
 	idr_destroy(dev-ctx_idr);
-#endif
 	mutex_unlock(dev-struct_mutex);
 }
 
@@ -267,10 +265,7 @@ static int drm_context_switch_complete(s
    struct drm_file *file_priv, int new)
 {
 	dev-last_context = new;	/* PRE/POST: This is the _only_ writer. */
-#ifndef __NetBSD__
-	/* XXX Nobody seems to use last_switch. */
 	dev-last_switch = jiffies;
-#endif
 
 	if (!_DRM_LOCK_IS_HELD(file_priv-master-lock.hw_lock-lock)) {
 		DRM_ERROR(Lock isn't held after context switch\n);

Index: src/sys/external/bsd/drm2/dist/drm/drm_crtc.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.1.1.1.2.17 src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.1.1.1.2.18
--- src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.1.1.1.2.17	Sun Sep  8 15:57:54 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_crtc.c	Sun Sep  8 16:11:29 2013
@@ -41,8 +41,6 @@
 #include drm/drm_fourcc.h
 
 /* Avoid boilerplate.  I'm tired of typing. */
-#ifdef __NetBSD__
-/* XXX Does nobody build this code with -Wwrite-strings?  */
 #define DRM_ENUM_NAME_FN(fnname, list)\
 	const char *fnname(int val)\
 	{			\
@@ -53,18 +51,6 @@
 		}		\
 		return (unknown);\
 	}
-#else
-#define DRM_ENUM_NAME_FN(fnname, list)\
-	char *fnname(int val)	\
-	{			\
-		int i;		\
-		for (i = 0; i  ARRAY_SIZE(list); i++) {	\
-			if (list[i].type == val)		\
-return list[i].name;		\
-		}		\
-		return (unknown);\
-	}
-#endif
 
 /*
  * Global properties
@@ -155,11 +141,7 @@ DRM_ENUM_NAME_FN(drm_get_dirty_info_name
 
 struct drm_conn_prop_enum_list {
 	int type;
-#ifdef __NetBSD__
 	const char *name;
-#else
-	char *name;
-#endif
 	int count;
 };
 
@@ -858,13 +840,8 @@ EXPORT_SYMBOL(drm_mode_create_dvi_i_prop
  * responsible for allocating a list of format names and passing them to
  * this routine.
  */
-#ifdef __NetBSD__		/* XXX const */
 int drm_mode_create_tv_properties(struct drm_device *dev, int num_modes,
   const char *modes[])
-#else
-int drm_mode_create_tv_properties(struct drm_device *dev, int num_modes,
-  char *modes[])
-#endif
 {
 	struct drm_property *tv_selector;
 	struct drm_property *tv_subconnector;
@@ -1047,10 +1024,8 @@ void drm_mode_config_init(struct drm_dev
 }
 EXPORT_SYMBOL(drm_mode_config_init);
 
-#ifdef __NetBSD__
-static
-#endif
-int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *group)
+static int drm_mode_group_init(struct drm_device *dev,
+			   struct drm_mode_group *group)
 {
 	uint32_t total_objects = 0;
 
@@ -2667,12 +2642,7 @@ int drm_mode_attachmode_crtc(struct drm_
 		if (!connector-encoder)
 			continue;
 		if (connector-encoder-crtc == crtc)
-#ifdef __NetBSD__
-			list_move_tail(list_next(list),
-			connector-user_modes);
-#else
 			list_move_tail(list.next, connector-user_modes);
-#endif
 	}
 
 	WARN_ON(!list_empty(list));
@@ -3531,21 +3501,13 @@ int drm_mode_gamma_set_ioctl(struct drm_
 		goto out;
 	}
 
-#ifdef __NetBSD__
 	

CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/i915drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:13:10 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: i915_gem_gtt.c

Log Message:
Sprinkle some kasserts into i915_gem_gtt.c.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \
src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.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/external/bsd/drm2/i915drm/i915_gem_gtt.c
diff -u src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.3 src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.4
--- src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.3	Sun Sep  8 16:00:22 2013
+++ src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c	Sun Sep  8 16:13:10 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_gtt.c,v 1.1.2.3 2013/09/08 16:00:22 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_gtt.c,v 1.1.2.4 2013/09/08 16:13:10 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: i915_gem_gtt.c,v 1.1.2.3 2013/09/08 16:00:22 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: i915_gem_gtt.c,v 1.1.2.4 2013/09/08 16:13:10 riastradh Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -66,7 +66,7 @@ typedef uint32_t gtt_pte_t;
 static uint32_t
 gen6_pte_addr_encode(bus_addr_t addr)
 {
-	/* XXX KASSERT bounds?  Must be at most 36-bit, it seems.  */
+	KASSERT(addr = __BITS(39, 0));
 	return (addr | ((addr  28)  0xff0));
 }
 
@@ -392,6 +392,7 @@ gen6_ggtt_bind_object(struct drm_i915_ge
 		len = obj-igo_dmamap-dm_segs[seg].ds_len;
 		do {
 			KASSERT(PAGE_SIZE = len);
+			KASSERT(0 == (len % PAGE_SIZE));
 			bus_space_write_4(bst, bsh, 4*(first_entry + i),
 			pte_encode(dev, addr, cache_level));
 			addr += PAGE_SIZE;



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:12:26 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]:
intel_ringbuffer.c

Log Message:
Specify the ring map type as _DRM_REGISTERS.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.9 -r1.1.1.1.2.10 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.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/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.1.1.1.2.9 src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.1.1.1.2.10
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.1.1.1.2.9	Sun Sep  8 16:02:21 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c	Sun Sep  8 16:12:26 2013
@@ -1209,6 +1209,7 @@ static int intel_init_ring_buffer(struct
 	ring-virtual_start_map.offset = (dev_priv-mm.gtt-gma_bus_addr +
 	obj-gtt_offset);
 	ring-virtual_start_map.size = ring-size;
+	ring-virtual_start_map.type = _DRM_REGISTERS;
 	ring-virtual_start_map.flags = 0;
 	ring-virtual_start_map.flags |= _DRM_RESTRICTED;
 	ring-virtual_start_map.flags |= _DRM_KERNEL;



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/i915drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:13:55 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: i915_gem_gtt.c

Log Message:
Fix arithmetic in gen6_ggtt_bind_object.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \
src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.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/external/bsd/drm2/i915drm/i915_gem_gtt.c
diff -u src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.4 src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.5
--- src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.4	Sun Sep  8 16:13:10 2013
+++ src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c	Sun Sep  8 16:13:55 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_gtt.c,v 1.1.2.4 2013/09/08 16:13:10 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_gtt.c,v 1.1.2.5 2013/09/08 16:13:55 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: i915_gem_gtt.c,v 1.1.2.4 2013/09/08 16:13:10 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: i915_gem_gtt.c,v 1.1.2.5 2013/09/08 16:13:55 riastradh Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -409,9 +409,10 @@ gen6_ggtt_bind_object(struct drm_i915_ge
 	if (0  i) {
 		/* Posting read and sanity check.  */
 		/* XXX Shouldn't there be a bus_space_sync?  */
-		const uint32_t expected = pte_encode(dev, addr, cache_level);
+		const uint32_t expected = pte_encode(dev, addr - PAGE_SIZE,
+		cache_level);
 		const uint32_t actual = bus_space_read_4(bst, bsh,
-		(first_entry + (4*(i-1;
+		4*(first_entry + i-1));
 		if (actual != expected)
 			aprint_error_dev(dev-dev, mismatched PTE
 			: 0x%PRIxMAX != 0x%PRIxMAX\n,



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

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:15:17 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/pci [riastradh-drm2]: drm_pci.c

Log Message:
Use the 64-bit PCI DMA tag if available.

Otherwise, it can't handle 32-bit physical addresses, which
uvm_obj_wirepages seems to have a tendency to return.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/sys/external/bsd/drm2/pci/drm_pci.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/external/bsd/drm2/pci/drm_pci.c
diff -u src/sys/external/bsd/drm2/pci/drm_pci.c:1.1.2.9 src/sys/external/bsd/drm2/pci/drm_pci.c:1.1.2.10
--- src/sys/external/bsd/drm2/pci/drm_pci.c:1.1.2.9	Sun Sep  8 15:46:22 2013
+++ src/sys/external/bsd/drm2/pci/drm_pci.c	Sun Sep  8 16:15:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_pci.c,v 1.1.2.9 2013/09/08 15:46:22 riastradh Exp $	*/
+/*	$NetBSD: drm_pci.c,v 1.1.2.10 2013/09/08 16:15:17 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: drm_pci.c,v 1.1.2.9 2013/09/08 15:46:22 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: drm_pci.c,v 1.1.2.10 2013/09/08 16:15:17 riastradh Exp $);
 
 #include sys/types.h
 #include sys/errno.h
@@ -105,7 +105,8 @@ drm_pci_attach(device_t self, const stru
 	/* XXX Set the power state to D0?  */
 
 	dev-bst = pa-pa_memt;
-	dev-bus_dmat = pa-pa_dmat; /* XXX dmat64?  */
+	/* XXX Let the driver say something about 32-bit vs 64-bit DMA?  */
+	dev-bus_dmat = (pci_dma64_available(pa)? pa-pa_dmat64 : pa-pa_dmat);
 	dev-dmat = dev-bus_dmat;
 	dev-dmat_subregion_p = false;
 



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:16:37 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: highmem.h
src/sys/external/bsd/drm2/linux [riastradh-drm2]: linux_kmap.c

Log Message:
Fix kunmap: unlike kunmap_atomic, it takes a page, not a vaddr.

Unmapping the vaddr where the struct vm_page is stored makes for a
rather confusing state of affairs!


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 \
src/sys/external/bsd/drm2/include/linux/highmem.h
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/external/bsd/drm2/linux/linux_kmap.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/external/bsd/drm2/include/linux/highmem.h
diff -u src/sys/external/bsd/drm2/include/linux/highmem.h:1.1.2.3 src/sys/external/bsd/drm2/include/linux/highmem.h:1.1.2.4
--- src/sys/external/bsd/drm2/include/linux/highmem.h:1.1.2.3	Wed Jul 24 03:46:22 2013
+++ src/sys/external/bsd/drm2/include/linux/highmem.h	Sun Sep  8 16:16:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: highmem.h,v 1.1.2.3 2013/07/24 03:46:22 riastradh Exp $	*/
+/*	$NetBSD: highmem.h,v 1.1.2.4 2013/09/08 16:16:37 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -51,6 +51,6 @@ void *	kmap_atomic(struct page *);
 void	kunmap_atomic(void *);
 
 void *	kmap(struct page *);
-void	kunmap(void *);
+void	kunmap(struct page *);
 
 #endif  /* _LINUX_HIGHMEM_H_ */

Index: src/sys/external/bsd/drm2/linux/linux_kmap.c
diff -u src/sys/external/bsd/drm2/linux/linux_kmap.c:1.1.2.2 src/sys/external/bsd/drm2/linux/linux_kmap.c:1.1.2.3
--- src/sys/external/bsd/drm2/linux/linux_kmap.c:1.1.2.2	Wed Jul 24 03:46:22 2013
+++ src/sys/external/bsd/drm2/linux/linux_kmap.c	Sun Sep  8 16:16:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_kmap.c,v 1.1.2.2 2013/07/24 03:46:22 riastradh Exp $	*/
+/*	$NetBSD: linux_kmap.c,v 1.1.2.3 2013/09/08 16:16:37 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,10 +30,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_kmap.c,v 1.1.2.2 2013/07/24 03:46:22 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_kmap.c,v 1.1.2.3 2013/09/08 16:16:37 riastradh Exp $);
 
 #include sys/types.h
+#include sys/kmem.h
 #include sys/mutex.h
+#include sys/rbtree.h
 
 #include uvm/uvm_extern.h
 
@@ -55,6 +57,51 @@ __KERNEL_RCSID(0, $NetBSD: linux_kmap.c
 static kmutex_t linux_kmap_atomic_lock;
 static vaddr_t linux_kmap_atomic_vaddr;
 
+static kmutex_t linux_kmap_lock;
+static rb_tree_t linux_kmap_entries;
+
+struct linux_kmap_entry {
+	paddr_t		lke_paddr;
+	vaddr_t		lke_vaddr;
+	unsigned int	lke_refcnt;
+	rb_node_t	lke_node;
+};
+
+static int
+lke_compare_nodes(void *ctx __unused, const void *an, const void *bn)
+{
+	const struct linux_kmap_entry *const a = an;
+	const struct linux_kmap_entry *const b = bn;
+
+	if (a-lke_paddr  b-lke_paddr)
+		return -1;
+	else if (a-lke_paddr  b-lke_paddr)
+		return +1;
+	else
+		return 0;
+}
+
+static int
+lke_compare_key(void *ctx __unused, const void *node, const void *key)
+{
+	const struct linux_kmap_entry *const lke = node;
+	const paddr_t *const paddrp = key;
+
+	if (lke-lke_paddr  *paddrp)
+		return -1;
+	else if (lke-lke_paddr  *paddrp)
+		return +1;
+	else
+		return 0;
+}
+
+static const rb_tree_ops_t linux_kmap_entry_ops = {
+	.rbto_compare_nodes = lke_compare_nodes,
+	.rbto_compare_key = lke_compare_key,
+	.rbto_node_offset = offsetof(struct linux_kmap_entry, lke_node),
+	.rbto_context = NULL,
+};
+
 int
 linux_kmap_init(void)
 {
@@ -68,6 +115,9 @@ linux_kmap_init(void)
 	KASSERT(linux_kmap_atomic_vaddr != 0);
 	KASSERT(!pmap_extract(pmap_kernel(), linux_kmap_atomic_vaddr, NULL));
 
+	mutex_init(linux_kmap_lock, MUTEX_DEFAULT, IPL_VM);
+	rb_tree_init(linux_kmap_entries, linux_kmap_entry_ops);
+
 	return 0;
 }
 
@@ -75,6 +125,13 @@ void
 linux_kmap_fini(void)
 {
 
+	KASSERT(rb_tree_iterate(linux_kmap_entries, NULL, RB_DIR_RIGHT) ==
+	NULL);
+#if 0/* XXX no rb_tree_destroy*/
+	rb_tree_destroy(linux_kmap_entries);
+#endif
+	mutex_destroy(linux_kmap_lock);
+
 	KASSERT(linux_kmap_atomic_vaddr != 0);
 	KASSERT(!pmap_extract(pmap_kernel(), linux_kmap_atomic_vaddr, NULL));
 
@@ -121,16 +178,25 @@ kunmap_atomic(void *addr)
 void *
 kmap(struct page *page)
 {
-	int s;
-
+	const paddr_t paddr = VM_PAGE_TO_PHYS(page-p_vmp);
 	const vaddr_t vaddr = uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
 	(UVM_KMF_VAONLY | UVM_KMF_WAITVA));
 	KASSERT(vaddr != 0);
 
-	s = splvm();
+	struct linux_kmap_entry *const lke = kmem_alloc(sizeof(*lke),
+	KM_SLEEP);
+	lke-lke_paddr = paddr;
+	lke-lke_vaddr = vaddr;
+
+	mutex_spin_enter(linux_kmap_lock);
+	struct linux_kmap_entry *const collision __unused =
+	rb_tree_insert_node(linux_kmap_entries, lke);
+	KASSERT(collision == lke);
+	mutex_spin_exit(linux_kmap_lock);
+
+	const int s = splvm();
 
 	KASSERT(!pmap_extract(pmap_kernel(), 

CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:17:58 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: highmem.h

Log Message:
linux_ namespace for kmap and kunmap.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \
src/sys/external/bsd/drm2/include/linux/highmem.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/external/bsd/drm2/include/linux/highmem.h
diff -u src/sys/external/bsd/drm2/include/linux/highmem.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/highmem.h:1.1.2.5
--- src/sys/external/bsd/drm2/include/linux/highmem.h:1.1.2.4	Sun Sep  8 16:16:37 2013
+++ src/sys/external/bsd/drm2/include/linux/highmem.h	Sun Sep  8 16:17:58 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: highmem.h,v 1.1.2.4 2013/09/08 16:16:37 riastradh Exp $	*/
+/*	$NetBSD: highmem.h,v 1.1.2.5 2013/09/08 16:17:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -43,6 +43,8 @@
 /* XXX Make the nm output a little more greppable...  */
 #define	kmap_atomic	linux_kmap_atomic
 #define	kunmap_atomic	linux_kunmap_atomic
+#define	kmap		linux_kmap
+#define	kunmap		linux_kunmap
 
 int	linux_kmap_init(void);
 void	linux_kmap_fini(void);



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:19:15 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: io-mapping.h

Log Message:
Just use bus_space_map for io-mapping, and limit to one at a time.

Reserving the whole region interferes with other parts of the driver
which want to map it in different ways.  It also horrifically wastes
space when actually mapped, because there's no way to map a subregion
of a reservation.  And the bus_space_reservation API is x86-only at
the moment.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \
src/sys/external/bsd/drm2/include/linux/io-mapping.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/external/bsd/drm2/include/linux/io-mapping.h
diff -u src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.1.2.2 src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.1.2.3
--- src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.1.2.2	Wed Jul 24 03:17:48 2013
+++ src/sys/external/bsd/drm2/include/linux/io-mapping.h	Sun Sep  8 16:19:15 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: io-mapping.h,v 1.1.2.2 2013/07/24 03:17:48 riastradh Exp $	*/
+/*	$NetBSD: io-mapping.h,v 1.1.2.3 2013/09/08 16:19:15 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -36,19 +36,13 @@
 #include sys/kmem.h
 #include sys/systm.h
 
-/*
- * XXX This uses NetBSD bus space reservations, which are currently
- * implemented only for x86.
- */
-
 struct io_mapping {
 	bus_space_tag_t		diom_bst;
 	bus_addr_t		diom_addr;
-	bus_addr_t		diom_size;
+	bus_size_t		diom_size;
 	int			diom_flags;
-	bus_space_reservation_t	diom_bsr;
-	bool			diom_mapped;
 	bus_space_handle_t	diom_bsh;
+	void			*diom_vaddr;
 };
 
 static inline struct io_mapping *
@@ -63,13 +57,15 @@ bus_space_io_mapping_create_wc(bus_space
 	mapping-diom_flags = 0;
 	mapping-diom_flags |= BUS_SPACE_MAP_LINEAR;
 	mapping-diom_flags |= BUS_SPACE_MAP_PREFETCHABLE;
-	mapping-diom_mapped = false;
+	mapping-diom_vaddr = NULL;
 
-	if (bus_space_reserve(mapping-diom_bst, addr, size,
-		mapping-diom_flags, mapping-diom_bsr)) {
+	bus_space_handle_t bsh;
+	if (bus_space_map(mapping-diom_bst, addr, PAGE_SIZE,
+		mapping-diom_flags, bsh)) {
 		kmem_free(mapping, sizeof(*mapping));
 		return NULL;
 	}
+	bus_space_unmap(mapping-diom_bst, bsh, PAGE_SIZE);
 
 	return mapping;
 }
@@ -78,8 +74,7 @@ static inline void
 io_mapping_free(struct io_mapping *mapping)
 {
 
-	KASSERT(!mapping-diom_mapped);
-	bus_space_release(mapping-diom_bst, mapping-diom_bsr);
+	KASSERT(mapping-diom_vaddr == NULL);
 	kmem_free(mapping, sizeof(*mapping));
 }
 
@@ -87,25 +82,24 @@ static inline void *
 io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset)
 {
 
-	KASSERT(!mapping-diom_mapped);
+	KASSERT(mapping-diom_vaddr == NULL);
 	KASSERT(ISSET(mapping-diom_flags, BUS_SPACE_MAP_LINEAR));
-	if (bus_space_reservation_map(mapping-diom_bst, mapping-diom_bsr,
-		mapping-diom_flags, mapping-diom_bsh))
+	if (bus_space_map(mapping-diom_bst, (mapping-diom_addr + offset),
+		PAGE_SIZE, mapping-diom_flags, mapping-diom_bsh))
 		panic(Unable to make I/O mapping!); /* XXX */
-	mapping-diom_mapped = true;
+	mapping-diom_vaddr = bus_space_vaddr(mapping-diom_bst,
+	mapping-diom_bsh);
 
-	return (char *)bus_space_vaddr(mapping-diom_bst, mapping-diom_bsh)
-	+ offset;		/* XXX arithmetic overflow */
+	return mapping-diom_vaddr;
 }
 
 static inline void
 io_mapping_unmap(struct io_mapping *mapping, void *vaddr __unused)
 {
 
-	KASSERT(mapping-diom_mapped);
-	bus_space_reservation_unmap(mapping-diom_bst, mapping-diom_bsh,
-	mapping-diom_size);
-	mapping-diom_mapped = false;
+	KASSERT(mapping-diom_vaddr == vaddr);
+	bus_space_unmap(mapping-diom_bst, mapping-diom_bsh, PAGE_SIZE);
+	mapping-diom_vaddr = NULL;
 }
 
 static inline void *



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:20:45 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]:
i915_gem_stolen.c

Log Message:
i915_gem_cleanup_stolen need not take down mm.stolen after all.

The one caller, i915_driver_unload, already takes care of this.
Having i915_gem_cleanup_stolen do it is obviously the right thing,
but this state of affairs reduces diffs to upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.3 -r1.1.1.1.2.4 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.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/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c:1.1.1.1.2.3 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c:1.1.1.1.2.4
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c:1.1.1.1.2.3	Sun Sep  8 16:00:22 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c	Sun Sep  8 16:20:45 2013
@@ -171,11 +171,8 @@ static void i915_cleanup_compression(str
 
 void i915_gem_cleanup_stolen(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev-dev_private;
-
 	if (I915_HAS_FBC(dev)  i915_powersave)
 		i915_cleanup_compression(dev);
-	drm_mm_takedown(dev_priv-mm.stolen);
 }
 
 int i915_gem_init_stolen(struct drm_device *dev)



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:22:29 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_dma.c

Log Message:
Use the cached mmio bar information to map the GTT.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.28 -r1.1.1.1.2.29 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.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/external/bsd/drm2/dist/drm/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.28 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.29
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.28	Sun Sep  8 16:03:21 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Sun Sep  8 16:22:29 2013
@@ -1599,23 +1599,21 @@ int i915_driver_load(struct drm_device *
 		mmio_size = 2*1024*1024;
 
 #ifdef __NetBSD__
-	/* XXX Maybe it would be better to just use pci_mapreg_map...  */
-	{
-		bus_addr_t addr;
-		bus_size_t size;
-
-		if (pci_mapreg_info(dev-pdev-pd_pa.pa_pc,
-			dev-pdev-pd_pa.pa_tag, PCI_BAR(mmio_bar),
-			PCI_MAPREG_TYPE_MEM,
-			addr, size, NULL /* XXX flags? */)) {
-			ret = -EIO;	/* XXX */
-			goto put_gmch;
-		}
+	if (dev-bus_maps[mmio_bar].bm_size  mmio_size) {
+		DRM_ERROR(MMIO BAR %d is too small
+		: %PRIxMAX  %PRIxMAX\n,
+		mmio_bar,
+		(uintmax_t)dev-bus_maps[mmio_bar].bm_size,
+		(uintmax_t)mmio_size);
+		ret = -EIO;
+		goto put_gmch;
+	}
 
-		ret = drm_addmap(dev, addr, size, _DRM_REGISTERS,
-		(_DRM_KERNEL | _DRM_DRIVER), dev_priv-regs_map);
-		if (ret)
-			goto put_gmch;
+	ret = drm_addmap(dev, dev-bus_maps[mmio_bar].bm_base, mmio_size,
+	_DRM_REGISTERS, (_DRM_KERNEL | _DRM_DRIVER), dev_priv-regs_map);
+	if (ret) {
+		DRM_ERROR(Failed to map MMIO BAR %d: %d\n, mmio_bar, ret);
+		goto put_gmch;
 	}
 #else
 	dev_priv-regs = pci_iomap(dev-pdev, mmio_bar, mmio_size);



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/dist/drm/i915

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:27:15 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_dma.c

Log Message:
Hook up some GTT logic again in i915_driver_load.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.29 -r1.1.1.1.2.30 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.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/external/bsd/drm2/dist/drm/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.29 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.30
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.29	Sun Sep  8 16:22:29 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Sun Sep  8 16:27:15 2013
@@ -1432,7 +1432,6 @@ void i915_master_destroy(struct drm_devi
 	master-driver_priv = NULL;
 }
 
-#ifndef __NetBSD__		/* XXX gtt */
 static void
 i915_mtrr_setup(struct drm_i915_private *dev_priv, unsigned long base,
 		unsigned long size)
@@ -1455,7 +1454,6 @@ i915_mtrr_setup(struct drm_i915_private 
 			 performance may suffer.\n);
 	}
 }
-#endif
 
 #ifndef __NetBSD__		/* XXX fb */
 static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
@@ -1511,9 +1509,7 @@ int i915_driver_load(struct drm_device *
 	struct drm_i915_private *dev_priv;
 	struct intel_device_info *info;
 	int ret = 0, mmio_bar, mmio_size;
-#ifndef __NetBSD__		/* XXX gtt */
 	uint32_t aperture_size;
-#endif
 
 	info = (struct intel_device_info *) flags;
 
@@ -1624,7 +1620,6 @@ int i915_driver_load(struct drm_device *
 	}
 #endif
 
-#ifndef __NetBSD__		/* XXX gtt */
 	aperture_size = dev_priv-mm.gtt-gtt_mappable_entries  PAGE_SHIFT;
 	dev_priv-mm.gtt_base_addr = dev_priv-mm.gtt-gma_bus_addr;
 
@@ -1644,7 +1639,6 @@ int i915_driver_load(struct drm_device *
 
 	i915_mtrr_setup(dev_priv, dev_priv-mm.gtt_base_addr,
 			aperture_size);
-#endif	/* __NetBSD__ */
 
 	/* The i915 workqueue is primarily used for batched retirement of
 	 * requests (and thus managing bo) once the task has been completed
@@ -1769,7 +1763,6 @@ out_gem_unload:
 #endif
 	destroy_workqueue(dev_priv-wq);
 out_mtrrfree:
-#ifndef __NetBSD__		/* XXX gtt */
 	if (dev_priv-mm.gtt_mtrr = 0) {
 		mtrr_del(dev_priv-mm.gtt_mtrr,
 			 dev_priv-mm.gtt_base_addr,
@@ -1778,7 +1771,6 @@ out_mtrrfree:
 	}
 	io_mapping_free(dev_priv-mm.gtt_mapping);
 out_rmmap:
-#endif
 #ifdef __NetBSD__
 	(void)drm_rmmap(dev, dev_priv-regs_map);
 #else



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:28:27 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_dma.c
i915_gem.c
src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: i915_gem_gtt.c

Log Message:
Still more error branch cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.30 -r1.1.1.1.2.31 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
cvs rdiff -u -r1.1.1.1.2.14 -r1.1.1.1.2.15 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 \
src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.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/external/bsd/drm2/dist/drm/i915/i915_dma.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.30 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.31
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c:1.1.1.1.2.30	Sun Sep  8 16:27:15 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c	Sun Sep  8 16:28:27 2013
@@ -1758,9 +1758,7 @@ out_gem_unload:
 
 	intel_teardown_gmbus(dev);
 	intel_teardown_mchbar(dev);
-#ifdef __NetBSD__		/* XXX gt fini */
 	intel_gt_fini(dev);
-#endif
 	destroy_workqueue(dev_priv-wq);
 out_mtrrfree:
 	if (dev_priv-mm.gtt_mtrr = 0) {
@@ -1873,6 +1871,7 @@ int i915_driver_unload(struct drm_device
 		i915_gem_context_fini(dev);
 		mutex_unlock(dev-struct_mutex);
 		i915_gem_cleanup_aliasing_ppgtt(dev);
+		i915_gem_fini_global_gtt(dev);
 		i915_gem_cleanup_stolen(dev);
 		drm_mm_takedown(dev_priv-mm.stolen);
 
@@ -1906,9 +1905,11 @@ int i915_driver_unload(struct drm_device
 
 	intel_teardown_gmbus(dev);
 	intel_teardown_mchbar(dev);
+	intel_gt_fini(dev);
 
 	destroy_workqueue(dev_priv-wq);
 
+	i915_gem_gtt_fini(dev);
 	pci_dev_put(dev_priv-bridge_dev);
 	kfree(dev-dev_private);
 

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.14 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.15
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.14	Sun Sep  8 16:05:06 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Sun Sep  8 16:28:27 2013
@@ -4471,9 +4471,7 @@ int i915_gem_init(struct drm_device *dev
 
 		ret = i915_gem_init_aliasing_ppgtt(dev);
 		if (ret) {
-#ifdef __NetBSD__		/* XXX fini global gtt */
 			i915_gem_fini_global_gtt(dev);
-#endif
 			mutex_unlock(dev-struct_mutex);
 			return ret;
 		}

Index: src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c
diff -u src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.5 src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.6
--- src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c:1.1.2.5	Sun Sep  8 16:13:55 2013
+++ src/sys/external/bsd/drm2/i915drm/i915_gem_gtt.c	Sun Sep  8 16:28:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_gtt.c,v 1.1.2.5 2013/09/08 16:13:55 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_gtt.c,v 1.1.2.6 2013/09/08 16:28:27 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: i915_gem_gtt.c,v 1.1.2.5 2013/09/08 16:13:55 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: i915_gem_gtt.c,v 1.1.2.6 2013/09/08 16:28:27 riastradh Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -244,6 +244,17 @@ void
 i915_gem_fini_global_gtt(struct drm_device *dev)
 {
 	struct drm_i915_private *const dev_priv = dev-dev_private;
+	struct drm_i915_gem_object *obj, *next;
+	int ret;
+
+	/* Empty the mm before taking it down.  */
+	list_for_each_entry_safe(obj, next, dev_priv-mm.unbound_list,
+	gtt_list) {
+		ret = i915_gem_object_unbind(obj);
+		if (ret)
+			DRM_ERROR(Unable to unbind object %p: %d\n, obj,
+			ret);
+	}
 
 	drm_mm_takedown(dev_priv-mm.gtt_space);
 }



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:30:13 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/include/drm [riastradh-drm2]: drmP.h
src/sys/external/bsd/drm2/drm [riastradh-drm2]: drm_memory.c

Log Message:
Simplify drm_ioremap and map only what is requested, exclusively.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.52 -r1.1.1.1.2.53 \
src/sys/external/bsd/drm2/dist/include/drm/drmP.h
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/external/bsd/drm2/drm/drm_memory.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/external/bsd/drm2/dist/include/drm/drmP.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.1.1.1.2.52 src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.1.1.1.2.53
--- src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.1.1.1.2.52	Sun Sep  8 16:11:29 2013
+++ src/sys/external/bsd/drm2/dist/include/drm/drmP.h	Sun Sep  8 16:30:13 2013
@@ -647,7 +647,6 @@ struct drm_bus_map {
 	bus_size_t		bm_size;
 	bus_space_handle_t	bm_bsh;
 	int			bm_flags;
-	unsigned int		bm_mapped;
 };
 #endif
 

Index: src/sys/external/bsd/drm2/drm/drm_memory.c
diff -u src/sys/external/bsd/drm2/drm/drm_memory.c:1.1.2.7 src/sys/external/bsd/drm2/drm/drm_memory.c:1.1.2.8
--- src/sys/external/bsd/drm2/drm/drm_memory.c:1.1.2.7	Wed Jul 24 03:14:15 2013
+++ src/sys/external/bsd/drm2/drm/drm_memory.c	Sun Sep  8 16:30:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_memory.c,v 1.1.2.7 2013/07/24 03:14:15 riastradh Exp $	*/
+/*	$NetBSD: drm_memory.c,v 1.1.2.8 2013/09/08 16:30:13 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: drm_memory.c,v 1.1.2.7 2013/07/24 03:14:15 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: drm_memory.c,v 1.1.2.8 2013/09/08 16:30:13 riastradh Exp $);
 
 #ifdef _KERNEL_OPT
 #include agp_i810.h
@@ -79,7 +79,6 @@ drm_ioremap(struct drm_device *dev, stru
 {
 	const bus_space_tag_t bst = dev-bst;
 	unsigned int unit;
-	int error;
 
 	/*
 	 * Search dev's bus maps for a match.
@@ -95,132 +94,44 @@ drm_ioremap(struct drm_device *dev, stru
 		if (bm-bm_size  map-size)
 			continue;
 
-		/*
-		 * Reject maps that the request doesn't fit in.  (Make
-		 * sure to avoid integer overflow.)
-		 */
+		/* Reject maps that the request doesn't fit in.  */
 		if ((bm-bm_size - map-size) 
 		(map-offset - bm-bm_base))
 			continue;
 
-		/* Has it been mapped yet?  If not, map it.  */
-		if (bm-bm_mapped == 0) {
-			KASSERT(ISSET(bm-bm_flags, BUS_SPACE_MAP_LINEAR));
-			error = bus_space_map(bst, bm-bm_base,
-			bm-bm_size, bm-bm_flags, bm-bm_bsh);
-			if (error) {
-if (drm_bus_borrow(map-offset,
-	map-lm_data.bus_space.bsh)) {
-	map-lm_data.bus_space.bus_map = NULL;
-	goto win;
-}
-return NULL;
-			}
-		}
-
-		/* Mark it used and make a subregion just for the request.  */
-		if (bm-bm_mapped == UINT_MAX)
-			return NULL;
-		bm-bm_mapped++;
-		error = bus_space_subregion(bst, bm-bm_bsh,
-		map-offset - bm-bm_base, map-size,
-		map-lm_data.bus_space.bsh);
-		if (error) {
-			/*
-			 * Back out: unmark it and, if nobody else was
-			 * using it, unmap it.
-			 */
-			KASSERT(bm-bm_mapped  0);
-			if (--bm-bm_mapped == 0)
-bus_space_unmap(bst, bm-bm_bsh,
-bm-bm_size);
-			return NULL;
-		}
+		/* Ensure we can map the space into virtual memory.  */
+		if (!ISSET(bm-bm_flags, BUS_SPACE_MAP_LINEAR))
+			continue;
+
+		/* Map it.  */
+		if (bus_space_map(bst, map-offset, map-size,
+			bm-bm_flags, map-lm_data.bus_space.bsh))
+			break;
 
-		/* Got it!  */
 		map-lm_data.bus_space.bus_map = bm;
 		goto win;
 	}
 
-	/*
-	 * No dice.  Try mapping it directly ourselves.
-	 *
-	 * XXX Is this sensible?  What prevents us from clobbering some
-	 * existing map?  And what does this have to do with agp?
-	 */
-	for (unit = 0; unit  dev-agp_nmaps; unit++) {
-		struct drm_bus_map *const bm = dev-agp_maps[unit];
-
-		/* Is this one allocated? */
-		if (bm-bm_mapped  0) {
-			/*
-			 * Make sure it has the same base.
-			 *
-			 * XXX Why must it be the same base?  Can't we
-			 * subregion here too?
-			 */
-			if (bm-bm_base != map-offset)
-continue;
-
-			/* Make sure it's big enough.  */
-			if (bm-bm_size  map-size)
-continue;
-
-			/* Mark it used and return it.  */
-			if (bm-bm_mapped == UINT_MAX)
-return NULL;
-			bm-bm_mapped++;
-
-			/* XXX size is an input/output parameter too...?  */
-			map-size = bm-bm_size;
-
-			map-lm_data.bus_space.bsh = bm-bm_bsh;
-			map-lm_data.bus_space.bus_map = bm;
-			goto win;
-		} else {
-			const int flags = BUS_SPACE_MAP_PREFETCHABLE |
-			BUS_SPACE_MAP_LINEAR;
-
-			/* Try mapping the request.  */
-			error = bus_space_map(bst, map-offset, map-size,
-			flags, bm-bm_bsh);
-			if (error)
-return NULL; /* XXX Why not continue?  */
-
-			/* Got it.  Allocate 

CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:31:14 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: spinlock.h

Log Message:
Create Linux spin locks at IPL_VM for now.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 \
src/sys/external/bsd/drm2/include/linux/spinlock.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/external/bsd/drm2/include/linux/spinlock.h
diff -u src/sys/external/bsd/drm2/include/linux/spinlock.h:1.1.2.8 src/sys/external/bsd/drm2/include/linux/spinlock.h:1.1.2.9
--- src/sys/external/bsd/drm2/include/linux/spinlock.h:1.1.2.8	Wed Jul 24 04:01:05 2013
+++ src/sys/external/bsd/drm2/include/linux/spinlock.h	Sun Sep  8 16:31:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: spinlock.h,v 1.1.2.8 2013/07/24 04:01:05 riastradh Exp $	*/
+/*	$NetBSD: spinlock.h,v 1.1.2.9 2013/09/08 16:31:14 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -85,8 +85,8 @@ spin_unlock_irqrestore(spinlock_t *spinl
 static inline void
 spin_lock_init(spinlock_t *spinlock)
 {
-	/* XXX Need to identify which need to block intrs.  */
-	mutex_init(spinlock-sl_lock, MUTEX_DEFAULT, IPL_NONE);
+	/* XXX What's the right IPL?  IPL_DRM...?  */
+	mutex_init(spinlock-sl_lock, MUTEX_DEFAULT, IPL_VM);
 }
 
 /*



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:32:37 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: device.h
kernel.h notifier.h printk.h sysrq.h

Log Message:
Miscellaneous Linux header file crud.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \
src/sys/external/bsd/drm2/include/linux/device.h
cvs rdiff -u -r1.1.2.21 -r1.1.2.22 \
src/sys/external/bsd/drm2/include/linux/kernel.h
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \
src/sys/external/bsd/drm2/include/linux/notifier.h \
src/sys/external/bsd/drm2/include/linux/sysrq.h
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 \
src/sys/external/bsd/drm2/include/linux/printk.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/external/bsd/drm2/include/linux/device.h
diff -u src/sys/external/bsd/drm2/include/linux/device.h:1.1.2.4 src/sys/external/bsd/drm2/include/linux/device.h:1.1.2.5
--- src/sys/external/bsd/drm2/include/linux/device.h:1.1.2.4	Wed Jul 24 03:26:18 2013
+++ src/sys/external/bsd/drm2/include/linux/device.h	Sun Sep  8 16:32:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: device.h,v 1.1.2.4 2013/07/24 03:26:18 riastradh Exp $	*/
+/*	$NetBSD: device.h,v 1.1.2.5 2013/09/08 16:32:37 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,6 +38,9 @@
 #define	dev_err(DEV, FMT, ...)	\
 	device_printf((DEV), error:  FMT, ##__VA_ARGS__)
 
+#define	dev_info(DEV, FMT, ...)	\
+	device_printf((DEV), info:  FMT, ##__VA_ARGS__)
+
 #define	dev_warn(DEV, FMT, ...)	\
 	device_printf((DEV), warning:  FMT, ##__VA_ARGS__)
 

Index: src/sys/external/bsd/drm2/include/linux/kernel.h
diff -u src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.21 src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.22
--- src/sys/external/bsd/drm2/include/linux/kernel.h:1.1.2.21	Sun Sep  8 15:58:24 2013
+++ src/sys/external/bsd/drm2/include/linux/kernel.h	Sun Sep  8 16:32:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernel.h,v 1.1.2.21 2013/09/08 15:58:24 riastradh Exp $	*/
+/*	$NetBSD: kernel.h,v 1.1.2.22 2013/09/08 16:32:37 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -109,4 +109,6 @@ abs64(int64_t x)
 	return (x  0? (-x) : x);
 }
 
+static int panic_timeout __unused = 0;
+
 #endif  /* _LINUX_KERNEL_H_ */

Index: src/sys/external/bsd/drm2/include/linux/notifier.h
diff -u src/sys/external/bsd/drm2/include/linux/notifier.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/notifier.h:1.1.2.2
--- src/sys/external/bsd/drm2/include/linux/notifier.h:1.1.2.1	Wed Jul 24 03:49:42 2013
+++ src/sys/external/bsd/drm2/include/linux/notifier.h	Sun Sep  8 16:32:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: notifier.h,v 1.1.2.1 2013/07/24 03:49:42 riastradh Exp $	*/
+/*	$NetBSD: notifier.h,v 1.1.2.2 2013/09/08 16:32:37 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,11 +32,31 @@
 #ifndef _LINUX_NOTIFIER_H_
 #define _LINUX_NOTIFIER_H_
 
+#include sys/cdefs.h
+
+#define	NOTIFY_OK	0
+
 struct notifier_block {
 	int	(*notifier_call)(struct notifier_block *, unsigned long,
 		void *);
 };
 
-#define	NOTIFY_OK	0
+struct atomic_notifier_head {
+	char	anh_blahdittyblahblah;
+};
+
+static struct atomic_notifier_head panic_notifier_list __unused;
+
+static inline void
+atomic_notifier_chain_register(struct atomic_notifier_head *head __unused,
+struct notifier_block *block __unused)
+{
+}
+
+static inline void
+atomic_notifier_chain_unregister(struct atomic_notifier_head *head __unused,
+struct notifier_block *block __unused)
+{
+}
 
 #endif  /* _LINUX_NOTIFIER_H_ */
Index: src/sys/external/bsd/drm2/include/linux/sysrq.h
diff -u src/sys/external/bsd/drm2/include/linux/sysrq.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/sysrq.h:1.1.2.2
--- src/sys/external/bsd/drm2/include/linux/sysrq.h:1.1.2.1	Wed Jul 24 00:33:12 2013
+++ src/sys/external/bsd/drm2/include/linux/sysrq.h	Sun Sep  8 16:32:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysrq.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $	*/
+/*	$NetBSD: sysrq.h,v 1.1.2.2 2013/09/08 16:32:37 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,4 +32,18 @@
 #ifndef _LINUX_SYSRQ_H_
 #define _LINUX_SYSRQ_H_
 
+struct sysrq_key_op {
+	char sko_blahdittyblahblah;
+};
+
+static inline void
+register_sysrq_key(char key __unused, struct sysrq_key_op *op __unused)
+{
+}
+
+static inline void
+unregister_sysrq_key(char key __unused, struct sysrq_key_op *op __unused)
+{
+}
+
 #endif  /* _LINUX_SYSRQ_H_ */

Index: src/sys/external/bsd/drm2/include/linux/printk.h
diff -u src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.5 src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.6
--- src/sys/external/bsd/drm2/include/linux/printk.h:1.1.2.5	Wed Jul 24 03:50:45 2013
+++ src/sys/external/bsd/drm2/include/linux/printk.h	Sun Sep  8 16:32:37 2013
@@ -1,4 +1,4 @@
-/*	

CVS commit: src/etc/etc.evbarm

2013-09-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Sep  8 16:34:06 UTC 2013

Modified Files:
src/etc/etc.evbarm: Makefile.inc

Log Message:
Add CUBIEBOARD


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/etc/etc.evbarm/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/etc.evbarm/Makefile.inc
diff -u src/etc/etc.evbarm/Makefile.inc:1.58 src/etc/etc.evbarm/Makefile.inc:1.59
--- src/etc/etc.evbarm/Makefile.inc:1.58	Mon Aug 19 04:27:22 2013
+++ src/etc/etc.evbarm/Makefile.inc	Sun Sep  8 16:34:06 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.58 2013/08/19 04:27:22 jmcneill Exp $
+#	$NetBSD: Makefile.inc,v 1.59 2013/09/08 16:34:06 matt Exp $
 #
 #	etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -70,6 +70,8 @@ EVBARM_BOARDS.armv7+=		BEAGLEBOARDXM
 EVBARM_BOARDS.armv7hf+= 	BEAGLEBOARDXM
 EVBARM_BOARDS.armv7+=		BEAGLEBONE
 EVBARM_BOARDS.armv7hf+= 	BEAGLEBONE
+EVBARM_BOARDS.armv7+=		CUBIEBOARD
+EVBARM_BOARDS.armv7hf+= 	CUBIEBOARD
 #EVBARM_BOARDS.armv7+=		IGEPV2
 #EVBARM_BOARDS.armv7+=		N900
 #EVBARM_BOARDS.armv7+=		NETWALKER



CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:35:20 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/drm [riastradh-drm2]:
drm_wait_netbsd.h

Log Message:
Fix DRM_WAIT_UNTIL to initialize (RET) on every exit.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 \
src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.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/external/bsd/drm2/include/drm/drm_wait_netbsd.h
diff -u src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.7 src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.8
--- src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.1.2.7	Sun Sep  8 16:02:50 2013
+++ src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h	Sun Sep  8 16:35:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_wait_netbsd.h,v 1.1.2.7 2013/09/08 16:02:50 riastradh Exp $	*/
+/*	$NetBSD: drm_wait_netbsd.h,v 1.1.2.8 2013/09/08 16:35:20 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -102,7 +102,11 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, 
 #define	DRM_WAIT_UNTIL(RET, Q, INTERLOCK, CONDITION)	do		\
 {	\
 	KASSERT(mutex_is_locked((INTERLOCK)));\
-	while (!(CONDITION)) {		\
+	for (;;) {			\
+		if (CONDITION) {	\
+			(RET) = 0;	\
+			break;		\
+		}			\
 		/* XXX errno NetBSD-Linux */\
 		(RET) = -cv_wait_sig((Q), (INTERLOCK)-mtx_lock);	\
 		if (RET)		\



CVS commit: [riastradh-drm2] src/sys

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:38:02 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm [riastradh-drm2]: drm_crtc.c
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: intel_panel.c
src/sys/modules/i915drm2 [riastradh-drm2]: Makefile

Log Message:
Omit more needless #ifdef __NetBSD__.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.18 -r1.1.1.1.2.19 \
src/sys/external/bsd/drm2/dist/drm/drm_crtc.c
cvs rdiff -u -r1.1.1.1.2.5 -r1.1.1.1.2.6 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.c
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/modules/i915drm2/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_crtc.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.1.1.1.2.18 src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.1.1.1.2.19
--- src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.1.1.1.2.18	Sun Sep  8 16:11:29 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_crtc.c	Sun Sep  8 16:38:02 2013
@@ -2160,12 +2160,8 @@ int drm_mode_addfb(struct drm_device *de
 		   void *data, struct drm_file *file_priv)
 {
 	struct drm_mode_fb_cmd *or = data;
-#ifdef __NetBSD__		/* XXX ...or just use memset.  */
 	static const struct drm_mode_fb_cmd2 zero_fbcmd;
 	struct drm_mode_fb_cmd2 r = zero_fbcmd;
-#else
-	struct drm_mode_fb_cmd2 r = {};
-#endif
 	struct drm_mode_config *config = dev-mode_config;
 	struct drm_framebuffer *fb;
 	int ret = 0;

Index: src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.c:1.1.1.1.2.5 src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.c:1.1.1.1.2.6
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.c:1.1.1.1.2.5	Wed Jul 24 03:47:23 2013
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.c	Sun Sep  8 16:38:02 2013
@@ -166,10 +166,6 @@ static u32 i915_read_blc_pwm_ctl(struct 
 	return val;
 }
 
-#ifdef __NetBSD__		/* XXX max kludge */
-#  define	max	max_hack
-#endif
-
 static u32 _intel_panel_get_max_backlight(struct drm_device *dev)
 {
 	u32 max;
@@ -288,10 +284,6 @@ static void intel_panel_actually_set_bac
 	I915_WRITE(BLC_PWM_CTL, tmp | level);
 }
 
-#ifdef __NetBSD__		/* XXX max hack */
-#  undef	max
-#endif
-
 void intel_panel_set_backlight(struct drm_device *dev, u32 level)
 {
 	struct drm_i915_private *dev_priv = dev-dev_private;

Index: src/sys/modules/i915drm2/Makefile
diff -u src/sys/modules/i915drm2/Makefile:1.1.2.10 src/sys/modules/i915drm2/Makefile:1.1.2.11
--- src/sys/modules/i915drm2/Makefile:1.1.2.10	Sun Sep  8 15:59:47 2013
+++ src/sys/modules/i915drm2/Makefile	Sun Sep  8 16:38:02 2013
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.2.10 2013/09/08 15:59:47 riastradh Exp $
+# $NetBSD: Makefile,v 1.1.2.11 2013/09/08 16:38:02 riastradh Exp $
 
 .include ../Makefile.inc
 .include ../drm2/Makefile.inc
@@ -57,6 +57,7 @@ SRCS+=	i915_module.c
 SRCS+=	i915_pci.c
 SRCS+=	intel_gtt.c
 
+COPTS.intel_panel.c+=	-Wno-shadow
 COPTS.intel_pm.c+=	-Wno-shadow
 
 .include bsd.kmodule.mk



CVS commit: [riastradh-drm2] src/sys

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:38:51 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/dist/drm [riastradh-drm2]: drm_fb_helper.c
src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]:
intel_display.c intel_drv.h
src/sys/external/bsd/drm2/dist/include/drm [riastradh-drm2]:
drm_fb_helper.h
src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: intel_fb.c
src/sys/modules/drm2 [riastradh-drm2]: Makefile

Log Message:
Round of hacking on i915 framebuffers.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.2 -r1.1.1.1.2.3 \
src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c
cvs rdiff -u -r1.1.1.1.2.8 -r1.1.1.1.2.9 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_display.c
cvs rdiff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_drv.h
cvs rdiff -u -r1.1.1.1.2.2 -r1.1.1.1.2.3 \
src/sys/external/bsd/drm2/dist/include/drm/drm_fb_helper.h
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/external/bsd/drm2/i915drm/intel_fb.c
cvs rdiff -u -r1.1.2.41 -r1.1.2.42 src/sys/modules/drm2/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.1.1.1.2.2 src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.1.1.1.2.3
--- src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.1.1.1.2.2	Tue Jul 23 21:28:21 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c	Sun Sep  8 16:38:51 2013
@@ -34,6 +34,12 @@
 #include linux/slab.h
 #include linux/fb.h
 #include linux/module.h
+#include linux/device.h
+#include linux/export.h
+#include linux/list.h
+#include linux/notifier.h
+#include linux/printk.h
+#include linux/sysrq.h
 #include drm/drmP.h
 #include drm/drm_crtc.h
 #include drm/drm_fb_helper.h
@@ -43,7 +49,12 @@ MODULE_AUTHOR(David Airlie, Jesse Barne
 MODULE_DESCRIPTION(DRM KMS helper);
 MODULE_LICENSE(GPL and additional rights);
 
+#ifdef __NetBSD__		/* XXX LIST_HEAD means something else */
+static struct list_head kernel_fb_helper_list =
+LIST_HEAD_INIT(kernel_fb_helper_list);
+#else
 static LIST_HEAD(kernel_fb_helper_list);
+#endif
 
 /**
  * DOC: fbdev helpers
@@ -82,6 +93,7 @@ fail:
 }
 EXPORT_SYMBOL(drm_fb_helper_single_add_all_connectors);
 
+#ifndef __NetBSD__		/* XXX fb command line */
 static int drm_fb_helper_parse_command_line(struct drm_fb_helper *fb_helper)
 {
 	struct drm_fb_helper_connector *fb_helper_conn;
@@ -135,7 +147,9 @@ static int drm_fb_helper_parse_command_l
 	}
 	return 0;
 }
+#endif
 
+#ifndef __NetBSD__		/* XXX fb info */
 static void drm_fb_helper_save_lut_atomic(struct drm_crtc *crtc, struct drm_fb_helper *helper)
 {
 	uint16_t *r_base, *g_base, *b_base;
@@ -238,6 +252,7 @@ int drm_fb_helper_debug_leave(struct fb_
 	return 0;
 }
 EXPORT_SYMBOL(drm_fb_helper_debug_leave);
+#endif
 
 bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 {
@@ -272,7 +287,7 @@ static bool drm_fb_helper_force_kernel_m
 	return error;
 }
 
-int drm_fb_helper_panic(struct notifier_block *n, unsigned long ununsed,
+static int drm_fb_helper_panic(struct notifier_block *n, unsigned long ununsed,
 			void *panic_str)
 {
 	/*
@@ -323,9 +338,10 @@ static struct sysrq_key_op sysrq_drm_fb_
 	.action_msg = Restore framebuffer console,
 };
 #else
-static struct sysrq_key_op sysrq_drm_fb_helper_restore_op = { };
+static struct sysrq_key_op sysrq_drm_fb_helper_restore_op;
 #endif
 
+#ifndef __NetBSD__		/* XXX fb info */
 static void drm_fb_helper_dpms(struct fb_info *info, int dpms_mode)
 {
 	struct drm_fb_helper *fb_helper = info-par;
@@ -382,6 +398,7 @@ int drm_fb_helper_blank(int blank, struc
 	return 0;
 }
 EXPORT_SYMBOL(drm_fb_helper_blank);
+#endif
 
 static void drm_fb_helper_crtc_free(struct drm_fb_helper *helper)
 {
@@ -462,6 +479,7 @@ void drm_fb_helper_fini(struct drm_fb_he
 }
 EXPORT_SYMBOL(drm_fb_helper_fini);
 
+#ifndef __NetBSD__		/* XXX fb info */
 static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
 		 u16 blue, u16 regno, struct fb_info *info)
 {
@@ -656,22 +674,17 @@ int drm_fb_helper_check_var(struct fb_va
 	return 0;
 }
 EXPORT_SYMBOL(drm_fb_helper_check_var);
+#endif
 
 /* this will let fbcon do the mode init */
-int drm_fb_helper_set_par(struct fb_info *info)
+static int
+drm_fb_helper_set_config(struct drm_fb_helper *fb_helper)
 {
-	struct drm_fb_helper *fb_helper = info-par;
 	struct drm_device *dev = fb_helper-dev;
-	struct fb_var_screeninfo *var = info-var;
 	struct drm_crtc *crtc;
 	int ret;
 	int i;
 
-	if (var-pixclock != 0) {
-		DRM_ERROR(PIXEL CLOCK SET\n);
-		return -EINVAL;
-	}
-
 	mutex_lock(dev-mode_config.mutex);
 	for (i = 0; i  fb_helper-crtc_count; i++) {
 		crtc = fb_helper-crtc_info[i].mode_set.crtc;
@@ -689,6 +702,20 @@ int drm_fb_helper_set_par(struct fb_info
 	}
 	return 0;
 }
+
+#ifndef 

CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/include/linux

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:40:36 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: workqueue.h

Log Message:
Rework Linux `work' to use NetBSD workqueues, not callouts.

Callers expect to be able to allocate in the workers, which callouts
don't allow.

Delayed work uses callouts only to delay enqueueing work.

Linux `workqueues' are still stubs.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 \
src/sys/external/bsd/drm2/include/linux/workqueue.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/external/bsd/drm2/include/linux/workqueue.h
diff -u src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.9 src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.10
--- src/sys/external/bsd/drm2/include/linux/workqueue.h:1.1.2.9	Sun Sep  8 15:58:24 2013
+++ src/sys/external/bsd/drm2/include/linux/workqueue.h	Sun Sep  8 16:40:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: workqueue.h,v 1.1.2.9 2013/09/08 15:58:24 riastradh Exp $	*/
+/*	$NetBSD: workqueue.h,v 1.1.2.10 2013/09/08 16:40:36 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -33,81 +33,220 @@
 #define _LINUX_WORKQUEUE_H_
 
 #include sys/callout.h
+#include sys/condvar.h
+#include sys/mutex.h
+#include sys/workqueue.h
 
 #include asm/bug.h
 #include linux/kernel.h
 
 /*
- * XXX This implementation is a load of bollocks -- callouts are
- * expedient, but wrong, if for no reason other than that we never call
- * callout_destroy.
+ * XXX This implementation is a load of bollocks -- callouts and
+ * workqueues are expedient, but wrong, if for no reason other than
+ * that there is no destroy operation.
+ *
+ * XXX The amount of code in here is absurd; it should be given a
+ * proper source file.
  */
 
 struct work_struct {
-	struct callout ws_callout;
+	void 			(*w_fn)(struct work_struct *);
+	struct workqueue	*w_wq;
+	struct work		w_wk;
+	kmutex_t		w_lock;
+	kcondvar_t		w_cv;
+	enum {
+		WORK_IDLE,
+		WORK_QUEUED,
+		WORK_CANCELLED,
+		WORK_INFLIGHT,
+		WORK_REQUEUED,
+	}			w_state;
 };
 
-struct delayed_work {
-	struct work_struct work;
-};
+static void __unused
+linux_work_fn(struct work *wk __unused, void *arg)
+{
+	struct work_struct *const work = arg;
+
+	mutex_spin_enter(work-w_lock);
+	switch (work-w_state) {
+	case WORK_IDLE:
+		panic(work ran while idle: %p, work);
+		break;
+
+	case WORK_QUEUED:
+		work-w_state = WORK_INFLIGHT;
+		mutex_spin_exit(work-w_lock);
+		(*work-w_fn)(work);
+		mutex_spin_enter(work-w_lock);
+		switch (work-w_state) {
+		case WORK_IDLE:
+		case WORK_QUEUED:
+			panic(work hosed while in flight: %p, work);
+			break;
+
+		case WORK_INFLIGHT:
+		case WORK_CANCELLED:
+			work-w_state = WORK_IDLE;
+			cv_broadcast(work-w_cv);
+			break;
+
+		case WORK_REQUEUED:
+			workqueue_enqueue(work-w_wq, work-w_wk, NULL);
+			work-w_state = WORK_QUEUED;
+			break;
+
+		default:
+			panic(work %p in bad state: %d, work,
+			(int)work-w_state);
+			break;
+		}
+		break;
+
+	case WORK_CANCELLED:
+		work-w_state = WORK_IDLE;
+		cv_broadcast(work-w_cv);
+		break;
+
+	case WORK_INFLIGHT:
+		panic(work already in flight: %p, work);
+		break;
+
+	case WORK_REQUEUED:
+		panic(work requeued while not in flight: %p, work);
+		break;
+
+	default:
+		panic(work %p in bad state: %d, work, (int)work-w_state);
+		break;
+	}
+	mutex_spin_exit(work-w_lock);
+}
 
 static inline void
 INIT_WORK(struct work_struct *work, void (*fn)(struct work_struct *))
 {
+	int error;
 
-	callout_init(work-ws_callout, 0);
-
-	/* XXX This cast business is sketchy.  */
-	callout_setfunc(work-ws_callout, (void (*)(void *))fn, work);
+	work-w_fn = fn;
+	error = workqueue_create(work-w_wq, lnxworkq, linux_work_fn,
+	work, PRI_NONE, IPL_VM, WQ_MPSAFE);
+	if (error)
+		panic(workqueue creation failed: %d, error); /* XXX */
+
+	mutex_init(work-w_lock, MUTEX_DEFAULT, IPL_VM);
+	cv_init(work-w_cv, linxwork);
+	work-w_state = WORK_IDLE;
 }
 
 static inline void
-INIT_DELAYED_WORK(struct delayed_work *dw, void (*fn)(struct work_struct *))
+schedule_work(struct work_struct *work)
 {
-	INIT_WORK(dw-work, fn);
+
+	mutex_spin_enter(work-w_lock);
+	switch (work-w_state) {
+	case WORK_IDLE:
+		workqueue_enqueue(work-w_wq, work-w_wk, NULL);
+		work-w_state = WORK_QUEUED;
+		break;
+
+	case WORK_CANCELLED:
+		break;
+
+	case WORK_INFLIGHT:
+		work-w_state = WORK_REQUEUED;
+		break;
+
+	case WORK_QUEUED:
+	case WORK_REQUEUED:
+		break;
+
+	default:
+		panic(work %p in bad state: %d, work, (int)work-w_state);
+		break;
+	}
+	mutex_spin_exit(work-w_lock);
 }
 
-static inline struct delayed_work *
-to_delayed_work(struct work_struct *work)
+/*
+ * XXX This API can't possibly be right because there is no interlock.
+ */
+static inline bool
+cancel_work_sync(struct work_struct *work)
 {
-	return container_of(work, struct delayed_work, work);
+	bool 

CVS commit: [riastradh-drm2] src/sys/external/bsd/drm2/i915drm

2013-09-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Sep  8 16:41:07 UTC 2013

Modified Files:
src/sys/external/bsd/drm2/i915drm [riastradh-drm2]: i915_pci.c

Log Message:
First draft of genfb attachment for i915.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/external/bsd/drm2/i915drm/i915_pci.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/external/bsd/drm2/i915drm/i915_pci.c
diff -u src/sys/external/bsd/drm2/i915drm/i915_pci.c:1.1.2.3 src/sys/external/bsd/drm2/i915drm/i915_pci.c:1.1.2.4
--- src/sys/external/bsd/drm2/i915drm/i915_pci.c:1.1.2.3	Wed Jul 24 03:54:43 2013
+++ src/sys/external/bsd/drm2/i915drm/i915_pci.c	Sun Sep  8 16:41:07 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_pci.c,v 1.1.2.3 2013/07/24 03:54:43 riastradh Exp $	*/
+/*	$NetBSD: i915_pci.c,v 1.1.2.4 2013/09/08 16:41:07 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,27 +30,51 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: i915_pci.c,v 1.1.2.3 2013/07/24 03:54:43 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: i915_pci.c,v 1.1.2.4 2013/09/08 16:41:07 riastradh Exp $);
 
 #include sys/types.h
 #include sys/systm.h
 
+#include dev/pci/pciio.h
 #include dev/pci/pcireg.h
 #include dev/pci/pcivar.h
 
+#if 0/* XXX genfb */
+#include dev/pci/wsdisplay_pci.h
+#include dev/wsfb/genfbvar.h
+#endif
+
 #include drm/drmP.h
 
 #include i915_drv.h
 
 struct i915drm_softc {
-	struct drm_device	sc_drm_dev;
-	struct pci_dev		sc_pci_dev;
+	device_t			sc_dev;
+	struct drm_device		sc_drm_dev;
+	struct pci_dev			sc_pci_dev;
+	struct drm_i915_gem_object	*sc_fb_obj;
+	bus_space_handle_t		sc_fb_bsh;
+#if 0/* XXX genfb */
+	struct genfb_softc		sc_genfb;
+#endif
 };
 
 static int	i915drm_match(device_t, cfdata_t, void *);
 static void	i915drm_attach(device_t, device_t, void *);
 static int	i915drm_detach(device_t, int);
 
+static void	i915drm_attach_framebuffer(device_t);
+static int	i915drm_detach_framebuffer(device_t, int);
+
+static int	i915drm_fb_probe(struct drm_fb_helper *,
+		struct drm_fb_helper_surface_size *);
+
+#if 0/* XXX genfb */
+static int	i915drm_genfb_ioctl(void *, void *, unsigned long, void *,
+		int, struct lwp *);
+static paddr_t	i915drm_genfb_mmap(void *, void *, off_t, int);
+#endif
+
 CFATTACH_DECL_NEW(i915drm, sizeof(struct i915drm_softc),
 i915drm_match, i915drm_attach, i915drm_detach, NULL);
 
@@ -115,10 +139,9 @@ i915drm_attach(device_t parent, device_t
 
 	KASSERT(info != NULL);
 
-	/* XXX Show more information...  */
-	aprint_naive(\n);
-	aprint_normal(: vendor 0x%04x, device 0x%04x, gen %u\n,
-	PCI_VENDOR(pa-pa_id), PCI_PRODUCT(pa-pa_id), info-gen);
+	sc-sc_dev = self;
+
+	pci_aprint_devinfo(pa, NULL);
 
 	/* XXX Whattakludge!  */
 	if (info-gen != 3) {
@@ -132,6 +155,8 @@ i915drm_attach(device_t parent, device_t
 
 	/* Attach the drm driver.  */
 	drm_config_found(self, i915_drm_driver, flags, sc-sc_drm_dev);
+
+	i915drm_attach_framebuffer(self);
 }
 
 static int
@@ -145,6 +170,10 @@ i915drm_detach(device_t self, int flags)
 	if (error)
 		return error;
 
+	error = i915drm_detach_framebuffer(self, flags);
+	if (error)
+		return error;
+
 	/* drm driver is gone.  We can safely drop drm pci driver state.  */
 	error = drm_pci_detach(sc-sc_drm_dev, flags);
 	if (error)
@@ -152,3 +181,331 @@ i915drm_detach(device_t self, int flags)
 
 	return 0;
 }
+
+static struct drm_fb_helper_funcs i915drm_fb_helper_funcs = {
+	.gamma_set = intel_crtc_fb_gamma_set,
+	.gamma_get = intel_crtc_fb_gamma_get,
+	.fb_probe = i915drm_fb_probe,
+};
+
+static void
+i915drm_attach_framebuffer(device_t self)
+{
+	struct i915drm_softc *const sc = device_private(self);
+	struct drm_device *const dev = sc-sc_drm_dev;
+	struct drm_i915_private *const dev_priv = dev-dev_private;
+	int ret;
+
+	aprint_debug_dev(self, attach framebuffer\n);
+	dev_priv-fbdev = kmem_zalloc(sizeof(*dev_priv-fbdev), KM_SLEEP);
+
+	struct drm_fb_helper *const fb_helper = dev_priv-fbdev-helper;
+
+	aprint_debug_dev(self, drm_fb_helper_init\n);
+	fb_helper-funcs = i915drm_fb_helper_funcs;
+	ret = drm_fb_helper_init(dev, fb_helper, dev_priv-num_pipe,
+	INTELFB_CONN_LIMIT);
+	if (ret) {
+		aprint_error_dev(self, unable to init drm fb helper: %d\n,
+		ret);
+		goto fail0;
+	}
+
+	aprint_debug_dev(self, drm_fb_helper_single_add_all_connectors\n);
+	drm_fb_helper_single_add_all_connectors(fb_helper);
+	aprint_debug_dev(self, drm_fb_helper_initial_config\n);
+	drm_fb_helper_initial_config(fb_helper, 32 /* XXX ? */);
+
+	/* Success!  */
+	return;
+
+fail0:	kmem_free(dev_priv-fbdev, sizeof(*dev_priv-fbdev));
+	dev_priv-fbdev = NULL;
+}
+
+static int
+i915drm_detach_framebuffer(device_t self, int flags)
+{
+	struct i915drm_softc *const sc = device_private(self);
+	struct drm_device *const dev = sc-sc_drm_dev;
+	struct drm_i915_private *const dev_priv = dev-dev_private;
+	

CVS commit: src/usr.sbin/altq/altqd

2013-09-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Sep  8 19:12:18 UTC 2013

Modified Files:
src/usr.sbin/altq/altqd: altq.conf.5

Log Message:
use IPv6 Documentation Prefix (2001:db8::/32) instead of unallocated
d000:a::/32 prefix


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/altq/altqd/altq.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/altq/altqd/altq.conf.5
diff -u src/usr.sbin/altq/altqd/altq.conf.5:1.14 src/usr.sbin/altq/altqd/altq.conf.5:1.15
--- src/usr.sbin/altq/altqd/altq.conf.5:1.14	Mon Apr 25 22:45:31 2011
+++ src/usr.sbin/altq/altqd/altq.conf.5	Sun Sep  8 19:12:18 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: altq.conf.5,v 1.14 2011/04/25 22:45:31 wiz Exp $
+.\	$NetBSD: altq.conf.5,v 1.15 2013/09/08 19:12:18 jakllsch Exp $
 .\	$KAME: altq.conf.5,v 1.15 2002/11/17 02:51:49 kjc Exp $
 .\
 .\ Copyright (C) 2000
@@ -1240,7 +1240,7 @@ class cbq vx0 csl_class tcp_class pbandw
 #
 # sample filter6 command
 #
-filter6 vx0 csl_class ::0 0 d000:a:0:123::/64 80 6
+filter6 vx0 csl_class ::0 0 2001:db8:0:123::/64 80 6
 .Ed
 .Ss HFSC Example
 .Bd -literal



CVS commit: src/common/lib/libc/arch/arm/gen

2013-09-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  9 00:34:10 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/gen: divsi3.S udivsi3.S

Log Message:
s/__libc/_libc/


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/common/lib/libc/arch/arm/gen/divsi3.S
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/arch/arm/gen/udivsi3.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libc/arch/arm/gen/divsi3.S
diff -u src/common/lib/libc/arch/arm/gen/divsi3.S:1.10 src/common/lib/libc/arch/arm/gen/divsi3.S:1.11
--- src/common/lib/libc/arch/arm/gen/divsi3.S:1.10	Sun Sep  8 13:24:16 2013
+++ src/common/lib/libc/arch/arm/gen/divsi3.S	Mon Sep  9 00:34:10 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: divsi3.S,v 1.10 2013/09/08 13:24:16 matt Exp $	*/
+/*	$NetBSD: divsi3.S,v 1.11 2013/09/09 00:34:10 matt Exp $	*/
 
 /*
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
@@ -32,8 +32,8 @@ ENTRY(__divsi3)
 	RET
 #elif defined(__ARM_EABI__)  defined(_LIBC)
 #ifdef _ARM_ARCH_7
-	movw	r2, #:lower16:REL_SYM(__libc_arm_hwdiv_present, .LPIC0)
-	movt	r2, #:upper16:REL_SYM(__libc_arm_hwdiv_present, .LPIC0)
+	movw	r2, #:lower16:REL_SYM(_libc_arm_hwdiv_present, .LPIC0)
+	movt	r2, #:upper16:REL_SYM(_libc_arm_hwdiv_present, .LPIC0)
 #else
 	ldr	r2, .Lhwdiv_present
 #endif
@@ -58,7 +58,7 @@ ENTRY(__divsi3)
 #ifndef _ARM_ARCH_7
 	.align	0
 .Lhwdiv_present:
-	.word	REL_SYM(__libc_arm_hwdiv_present, .LPIC0)
+	.word	REL_SYM(_libc_arm_hwdiv_present, .LPIC0)
 #endif
 #else /* !__ARM_EABI__ */
 	b	__divide

Index: src/common/lib/libc/arch/arm/gen/udivsi3.S
diff -u src/common/lib/libc/arch/arm/gen/udivsi3.S:1.6 src/common/lib/libc/arch/arm/gen/udivsi3.S:1.7
--- src/common/lib/libc/arch/arm/gen/udivsi3.S:1.6	Sun Sep  8 13:24:16 2013
+++ src/common/lib/libc/arch/arm/gen/udivsi3.S	Mon Sep  9 00:34:10 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: udivsi3.S,v 1.6 2013/09/08 13:24:16 matt Exp $	*/
+/*	$NetBSD: udivsi3.S,v 1.7 2013/09/09 00:34:10 matt Exp $	*/
 
 /*
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
@@ -32,8 +32,8 @@ ENTRY(__udivsi3)
 	RET
 #elif defined(__ARM_EABI__)  defined(_LIBC)
 #ifdef _ARM_ARCH_7
-	movw	r2, #:lower16:REL_SYM(__libc_arm_hwdiv_present, .LPIC0)
-	movt	r2, #:upper16:REL_SYM(__libc_arm_hwdiv_present, .LPIC0)
+	movw	r2, #:lower16:REL_SYM(_libc_arm_hwdiv_present, .LPIC0)
+	movt	r2, #:upper16:REL_SYM(_libc_arm_hwdiv_present, .LPIC0)
 #else
 	ldr	r2, .Lhwdiv_present
 #endif
@@ -58,7 +58,7 @@ ENTRY(__udivsi3)
 #ifndef _ARM_ARCH_7
 	.align 0
 .Lhwdiv_present:
-	.word	REL_SYM(__libc_arm_hwdiv_present, .LPIC0)
+	.word	REL_SYM(_libc_arm_hwdiv_present, .LPIC0)
 #endif
 #else
 	b	__udivide



CVS commit: [netbsd-6] src/doc

2013-09-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Sep  9 04:13:30 UTC 2013

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Modify ticket 939:
 - Add note about PR#47710
 - 80 columns.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.33 -r1.1.2.34 src/doc/CHANGES-6.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.33 src/doc/CHANGES-6.2:1.1.2.34
--- src/doc/CHANGES-6.2:1.1.2.33	Sat Sep  7 16:44:13 2013
+++ src/doc/CHANGES-6.2	Mon Sep  9 04:13:30 2013
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.33 2013/09/07 16:44:13 bouyer Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.34 2013/09/09 04:13:30 msaitoh Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -574,11 +574,12 @@ share/man/man4/bge.4		1.13-1.15 via patc
 
 	Add some device support, fix a lot of bugs and add some enahcements.
 	- Add Altima AC1003, APPLE BCM5701, Broadcom BCM5785F,
-	  BCM5785G, BCM5787F, BCM5719, BCM5720, BCM57766, BCM57782 and BCM57786.
+	  BCM5785G, BCM5787F, BCM5719, BCM5720, BCM57766, BCM57782 and
+	   BCM57786. PR#47710.
 	- brgphy(4): Add BCM5756, BCM5717C, BCM5719C, BCM5720C and BCM57780.
 	- Add some bugfixes and enhancement from FreeBSD:
-	  - Workaround for BCM5906 silicon bug. When auto-negotiation results in
-	   half-duplex operation, excess collision on the ethernet link may
+	  - Workaround for BCM5906 silicon bug. When auto-negotiation results
+	   in half-duplex operation, excess collision on the ethernet link may
 	   cause internal chip delays that may result in subsequent valid
 	   frames being dropped due to insufficient receive buffer resources.
 	   (FreeBSD: r214219, r214251, r214292)
@@ -614,9 +615,9 @@ share/man/man4/bge.4		1.13-1.15 via patc
 	  flag to not to check Gigabit flags. It's the same as FreeBSD.
 	- In brgphyattach(), set sc_isbge, sc_isbnx and sc_phyflags before
 	  PHY_RESET() because brgphy_reset() refers those flags.
-	- Call brgpy specific autonego function in MII_TICK. Before this commit,
-	  only MII_MEDIACHG calls brgphy_mii_phy_auto() and MII_TICK calls MI
-	  mii_phy_auto(). That was not intended.
+	- Call brgpy specific autonego function in MII_TICK. Before this
+	  commit, only MII_MEDIACHG calls brgphy_mii_phy_auto() and MII_TICK
+	  calls MI mii_phy_auto(). That was not intended.
 	- Sync with FreeBSD and OpenBSD. Almost the same as OpenBSD rev. 1.325:
 	  - Sync the ring setup code closer to FreeBSD's driver
 	  - Do not touch the jumbo replenish threshold register on chips that
@@ -645,9 +646,9 @@ share/man/man4/bge.4		1.13-1.15 via patc
 	  bge_readmem_ind().
 	- For BGE_IS_575X_PLUS() devices, don't set
 	  BGE_RXLPSTATCONTROL_DACK_FIX bits because these bits are reserved.
-	- bge_init_tx_ring() uses BGE_RSLOTS (==256) but bge_free_tx_ring() uses
-	  BGE_TX_RING_CNT (== 512). Delete BGE_RSLOTS and use BGE_TX_RING_CNT.
-	  Same as OpenBSD's if_bge.c rev. 1.86.
+	- bge_init_tx_ring() uses BGE_RSLOTS (==256) but bge_free_tx_ring()
+	  uses BGE_TX_RING_CNT (== 512). Delete BGE_RSLOTS and use
+	  BGE_TX_RING_CNT. Same as OpenBSD's if_bge.c rev. 1.86.
 	- Document says 5717 and newer chips have no
 	  BGE_PCISTATE_INTR_NOT_ACTIVE bit, so don't use the bit on those
 	  chips. Same as OpenBSD.