CVS commit: src/sys/dev/ieee1394

2022-08-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug 20 19:01:32 UTC 2022

Modified Files:
src/sys/dev/ieee1394: if_fwip.c

Log Message:
fwip_async_output(): Replace "IF_DEQUEUE() -> IF_PREPEND() on failure" with
"IF_POLL() -> IF_DEQUEUE() on success".


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ieee1394/if_fwip.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/ieee1394/if_fwip.c
diff -u src/sys/dev/ieee1394/if_fwip.c:1.30 src/sys/dev/ieee1394/if_fwip.c:1.31
--- src/sys/dev/ieee1394/if_fwip.c:1.30	Wed Jan 29 06:19:39 2020
+++ src/sys/dev/ieee1394/if_fwip.c	Sat Aug 20 19:01:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_fwip.c,v 1.30 2020/01/29 06:19:39 thorpej Exp $	*/
+/*	$NetBSD: if_fwip.c,v 1.31 2022/08/20 19:01:31 thorpej Exp $	*/
 /*-
  * Copyright (c) 2004
  *	Doug Rabson
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_fwip.c,v 1.30 2020/01/29 06:19:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_fwip.c,v 1.31 2022/08/20 19:01:31 thorpej Exp $");
 
 #include 
 #include 
@@ -552,7 +552,7 @@ fwip_async_output(struct fwip_softc *sc,
 #endif
 			break;
 		}
-		IF_DEQUEUE(>if_snd, m);
+		IF_POLL(>if_snd, m);
 		if (m == NULL) {
 			mutex_exit(>sc_mtx);
 			break;
@@ -663,9 +663,9 @@ fwip_async_output(struct fwip_softc *sc,
 			mutex_enter(>sc_mtx);
 			STAILQ_INSERT_TAIL(>sc_xferlist, xfer, link);
 			mutex_exit(>sc_mtx);
-			IF_PREPEND(>if_snd, m);
 			break;
 		}
+		IF_DEQUEUE(>if_snd, m);
 		if (error) {
 			/* error */
 			if_statinc(ifp, if_oerrors);



CVS commit: src/sys/dev/ieee1394

2022-08-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug 20 19:01:32 UTC 2022

Modified Files:
src/sys/dev/ieee1394: if_fwip.c

Log Message:
fwip_async_output(): Replace "IF_DEQUEUE() -> IF_PREPEND() on failure" with
"IF_POLL() -> IF_DEQUEUE() on success".


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ieee1394/if_fwip.c

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



CVS commit: src/sys/dev/ieee1394

2021-12-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 20 19:56:42 UTC 2021

Modified Files:
src/sys/dev/ieee1394: firewire.c

Log Message:
ieee1394: Need kernel lock around config_found.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/ieee1394/firewire.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.53 src/sys/dev/ieee1394/firewire.c:1.54
--- src/sys/dev/ieee1394/firewire.c:1.53	Mon Oct  4 20:48:05 2021
+++ src/sys/dev/ieee1394/firewire.c	Mon Dec 20 19:56:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.53 2021/10/04 20:48:05 andvar Exp $	*/
+/*	$NetBSD: firewire.c,v 1.54 2021/12/20 19:56:42 riastradh Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.53 2021/10/04 20:48:05 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.54 2021/12/20 19:56:42 riastradh Exp $");
 
 #include 
 #include 
@@ -2041,9 +2041,11 @@ fw_attach_dev(struct firewire_comm *fc)
 
 			fwa.name = fw_get_devclass(fwdev);
 			fwa.fwdev = fwdev;
+			KERNEL_LOCK(1, NULL);
 			fwdev->dev = config_found(sc->dev, , firewire_print,
 			CFARGS(.submatch = config_stdsubmatch,
    .locators = locs));
+			KERNEL_UNLOCK_ONE(NULL);
 			if (fwdev->dev == NULL) {
 free(devlist, M_DEVBUF);
 break;



CVS commit: src/sys/dev/ieee1394

2021-12-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 20 19:56:42 UTC 2021

Modified Files:
src/sys/dev/ieee1394: firewire.c

Log Message:
ieee1394: Need kernel lock around config_found.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/ieee1394/firewire.c

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



CVS commit: src/sys/dev/ieee1394

2021-12-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 08:17:21 UTC 2021

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
s/transcat/transact/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/dev/ieee1394/fwohci.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/ieee1394/fwohci.c
diff -u src/sys/dev/ieee1394/fwohci.c:1.148 src/sys/dev/ieee1394/fwohci.c:1.149
--- src/sys/dev/ieee1394/fwohci.c:1.148	Sat Aug 21 11:55:25 2021
+++ src/sys/dev/ieee1394/fwohci.c	Sun Dec  5 08:17:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci.c,v 1.148 2021/08/21 11:55:25 andvar Exp $	*/
+/*	$NetBSD: fwohci.c,v 1.149 2021/12/05 08:17:21 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.148 2021/08/21 11:55:25 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.149 2021/12/05 08:17:21 msaitoh Exp $");
 
 #include 
 #include 
@@ -1670,7 +1670,7 @@ fwohci_txd(struct fwohci_softc *sc, stru
 			mutex_enter(>xferq.q_mtx);
 			/*
 			 * The watchdog timer takes care of split
-			 * transcation timeout for ACKPEND case.
+			 * transaction timeout for ACKPEND case.
 			 */
 		} else
 			aprint_error_dev(fc->dev, "this shouldn't happen\n");



CVS commit: src/sys/dev/ieee1394

2021-12-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 08:17:21 UTC 2021

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
s/transcat/transact/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/dev/ieee1394/fwohci.c

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



CVS commit: src/sys/dev/ieee1394

2021-11-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 10 16:08:17 UTC 2021

Modified Files:
src/sys/dev/ieee1394: fwdev.c

Log Message:
s/avaliable/available/


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ieee1394/fwdev.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/ieee1394/fwdev.c
diff -u src/sys/dev/ieee1394/fwdev.c:1.32 src/sys/dev/ieee1394/fwdev.c:1.33
--- src/sys/dev/ieee1394/fwdev.c:1.32	Sun Jun 25 12:39:27 2017
+++ src/sys/dev/ieee1394/fwdev.c	Wed Nov 10 16:08:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwdev.c,v 1.32 2017/06/25 12:39:27 maxv Exp $	*/
+/*	$NetBSD: fwdev.c,v 1.33 2021/11/10 16:08:17 msaitoh Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fwdev.c,v 1.32 2017/06/25 12:39:27 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwdev.c,v 1.33 2021/11/10 16:08:17 msaitoh Exp $");
 
 #include 
 #include 
@@ -264,7 +264,7 @@ readloop:
 		}
 	}
 	if (ir->stproc == NULL) {
-		/* no data avaliable */
+		/* no data available */
 		if (slept == 0) {
 			slept = 1;
 			ir->flag |= FWXFERQ_WAKEUP;



CVS commit: src/sys/dev/ieee1394

2021-11-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 10 16:08:17 UTC 2021

Modified Files:
src/sys/dev/ieee1394: fwdev.c

Log Message:
s/avaliable/available/


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ieee1394/fwdev.c

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



CVS commit: src/sys/dev/ieee1394

2021-04-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Apr 12 09:22:21 UTC 2021

Modified Files:
src/sys/dev/ieee1394: firewire.h

Log Message:
convert union member from [0] array to [3] array, so that attempts
to access these members later will  work.

does not affect size of the structure or layout in any other way.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ieee1394/firewire.h

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



CVS commit: src/sys/dev/ieee1394

2021-04-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Apr 12 09:22:21 UTC 2021

Modified Files:
src/sys/dev/ieee1394: firewire.h

Log Message:
convert union member from [0] array to [3] array, so that attempts
to access these members later will  work.

does not affect size of the structure or layout in any other way.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ieee1394/firewire.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/ieee1394/firewire.h
diff -u src/sys/dev/ieee1394/firewire.h:1.6 src/sys/dev/ieee1394/firewire.h:1.7
--- src/sys/dev/ieee1394/firewire.h:1.6	Sun Nov 14 15:47:20 2010
+++ src/sys/dev/ieee1394/firewire.h	Mon Apr 12 09:22:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.h,v 1.6 2010/11/14 15:47:20 uebayasi Exp $	*/
+/*	$NetBSD: firewire.h,v 1.7 2021/04/12 09:22:21 mrg Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -142,7 +142,7 @@ struct fw_asyhdr {
 
 struct fw_pkt {
 	union {
-		uint32_t ld[0];
+		uint32_t ld[3];
 		struct {
 			COMMON_HDR(, , tcode, );
 		} common;



CVS commit: src/sys/dev/ieee1394

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:19:39 UTC 2020

Modified Files:
src/sys/dev/ieee1394: if_fwip.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ieee1394/if_fwip.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/ieee1394/if_fwip.c
diff -u src/sys/dev/ieee1394/if_fwip.c:1.29 src/sys/dev/ieee1394/if_fwip.c:1.30
--- src/sys/dev/ieee1394/if_fwip.c:1.29	Thu Nov 15 10:23:55 2018
+++ src/sys/dev/ieee1394/if_fwip.c	Wed Jan 29 06:19:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_fwip.c,v 1.29 2018/11/15 10:23:55 maxv Exp $	*/
+/*	$NetBSD: if_fwip.c,v 1.30 2020/01/29 06:19:39 thorpej Exp $	*/
 /*-
  * Copyright (c) 2004
  *	Doug Rabson
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_fwip.c,v 1.29 2018/11/15 10:23:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_fwip.c,v 1.30 2020/01/29 06:19:39 thorpej Exp $");
 
 #include 
 #include 
@@ -270,7 +270,7 @@ fwip_start(struct ifnet *ifp)
 			IF_DEQUEUE(>if_snd, m);
 			if (m != NULL)
 m_freem(m);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		} while (m != NULL);
 
 		return;
@@ -511,7 +511,7 @@ fwip_output_callback(struct fw_xfer *xfe
 	/* XXX error check */
 	FWIPDEBUG(ifp, "resp = %d\n", xfer->resp);
 	if (xfer->resp != 0)
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 
 	m_freem(xfer->mbuf);
 	fw_xfer_unload(xfer);
@@ -625,7 +625,7 @@ fwip_async_output(struct fwip_softc *sc,
 fd = fw_noderesolve_eui64(fc, );
 if (!fd) {
 	/* error */
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 	/* XXX set error code */
 	fwip_output_callback(xfer);
 	continue;
@@ -668,12 +668,12 @@ fwip_async_output(struct fwip_softc *sc,
 		}
 		if (error) {
 			/* error */
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			/* XXX set error code */
 			fwip_output_callback(xfer);
 			continue;
 		} else {
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 			i++;
 		}
 	}
@@ -726,7 +726,7 @@ fwip_stream_input(struct fw_xferq *xferq
 		if (sxfer->resp != 0 ||
 		fp->mode.stream.len < 2 * sizeof(uint32_t)) {
 			m_freem(m);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			continue;
 		}
 		m->m_len = m->m_pkthdr.len = fp->mode.stream.len
@@ -753,7 +753,7 @@ fwip_stream_input(struct fw_xferq *xferq
 			FWIPDEBUG(ifp, "Unrecognised GASP header %#08x %#08x\n",
 			ntohl(p[1]), ntohl(p[2]));
 			m_freem(m);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			continue;
 		}
 
@@ -788,7 +788,7 @@ fwip_stream_input(struct fw_xferq *xferq
 		m_adj(m, 3*sizeof(uint32_t));
 		m_set_rcvif(m, ifp);
 		ieee1394_input(ifp, m, src);
-		ifp->if_ipackets++;
+		if_statinc(ifp, if_ipackets);
 	}
 	if (STAILQ_FIRST(>stfree) != NULL)
 		sc->sc_fd.fc->irx_enable(sc->sc_fd.fc, sc->sc_dma_ch);
@@ -857,7 +857,7 @@ fwip_unicast_input(struct fw_xfer *xfer)
 	 */
 	if (rtcode != FWRCODE_COMPLETE) {
 		m_freem(m);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -893,5 +893,5 @@ fwip_unicast_input(struct fw_xfer *xfer)
 	m->m_len = m->m_pkthdr.len = fp->mode.wreqb.len;
 	m_set_rcvif(m, ifp);
 	ieee1394_input(ifp, m, fp->mode.wreqb.src);
-	ifp->if_ipackets++;
+	if_statinc(ifp, if_ipackets);
 }



CVS commit: src/sys/dev/ieee1394

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:19:39 UTC 2020

Modified Files:
src/sys/dev/ieee1394: if_fwip.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ieee1394/if_fwip.c

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



CVS commit: src/sys/dev/ieee1394

2019-10-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 15 18:21:47 UTC 2019

Modified Files:
src/sys/dev/ieee1394: firewire.c fwohci.c fwohcireg.h

Log Message:
 Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.142 -r1.143 src/sys/dev/ieee1394/fwohci.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ieee1394/fwohcireg.h

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



CVS commit: src/sys/dev/ieee1394

2019-10-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 15 18:21:47 UTC 2019

Modified Files:
src/sys/dev/ieee1394: firewire.c fwohci.c fwohcireg.h

Log Message:
 Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.142 -r1.143 src/sys/dev/ieee1394/fwohci.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ieee1394/fwohcireg.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.48 src/sys/dev/ieee1394/firewire.c:1.49
--- src/sys/dev/ieee1394/firewire.c:1.48	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/ieee1394/firewire.c	Tue Oct 15 18:21:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.48 2018/09/03 16:29:31 riastradh Exp $	*/
+/*	$NetBSD: firewire.c,v 1.49 2019/10/15 18:21:47 msaitoh Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.48 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.49 2019/10/15 18:21:47 msaitoh Exp $");
 
 #include 
 #include 
@@ -1407,12 +1407,12 @@ fw_reset_csr(struct firewire_comm *fc)
 	CSRARC(fc, BANDWIDTH_AV) = 4915;
 	CSRARC(fc, CHANNELS_AV_HI) = 0x;
 	CSRARC(fc, CHANNELS_AV_LO) = 0x;
-	CSRARC(fc, IP_CHANNELS) = (1 << 31);
+	CSRARC(fc, IP_CHANNELS) = (1U << 31);
 
 	CSRARC(fc, CONF_ROM) = 0x04 << 24;
 	CSRARC(fc, CONF_ROM + 4) = 0x31333934; /* means strings 1394 */
 	CSRARC(fc, CONF_ROM + 8) =
-	1 << 31 | 1 << 30 | 1 << 29 | 1 << 28 | 0xff << 16 | 0x09 << 8;
+	1U << 31 | 1 << 30 | 1 << 29 | 1 << 28 | 0xff << 16 | 0x09 << 8;
 	CSRARC(fc, CONF_ROM + 0xc) = 0;
 
 /* DV depend CSRs see blue book */

Index: src/sys/dev/ieee1394/fwohci.c
diff -u src/sys/dev/ieee1394/fwohci.c:1.142 src/sys/dev/ieee1394/fwohci.c:1.143
--- src/sys/dev/ieee1394/fwohci.c:1.142	Tue May 28 08:59:34 2019
+++ src/sys/dev/ieee1394/fwohci.c	Tue Oct 15 18:21:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci.c,v 1.142 2019/05/28 08:59:34 msaitoh Exp $	*/
+/*	$NetBSD: fwohci.c,v 1.143 2019/10/15 18:21:47 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.142 2019/05/28 08:59:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.143 2019/10/15 18:21:47 msaitoh Exp $");
 
 #include 
 #include 
@@ -224,7 +224,7 @@ static void fwohci_arcv(struct fwohci_so
 #define	OHCI_ATRETRY		0x008
 #define	OHCI_CROMHDR		0x018
 #define	OHCI_BUS_OPT		0x020
-#define	OHCI_BUSIRMC		(1 << 31)
+#define	OHCI_BUSIRMC		(1U << 31)
 #define	OHCI_BUSCMC		(1 << 30)
 #define	OHCI_BUSISC		(1 << 29)
 #define	OHCI_BUSBMC		(1 << 28)
@@ -250,7 +250,7 @@ static void fwohci_arcv(struct fwohci_so
 
 #define	OHCI_SID_BUF		0x064
 #define	OHCI_SID_CNT		0x068
-#define OHCI_SID_ERR		(1 << 31)
+#define OHCI_SID_ERR		(1U << 31)
 #define OHCI_SID_CNT_MASK	0xffc
 
 #define	OHCI_IT_STAT		0x090
@@ -752,7 +752,7 @@ fwohci_set_bus_manager(struct firewire_c
 	OWRITE(sc, OHCI_CSR_DATA, node);
 	OWRITE(sc, OHCI_CSR_COMP, 0x3f);
 	OWRITE(sc, OHCI_CSR_CONT, OHCI_BUS_MANAGER_ID);
- 	for (i = 0; !(OREAD(sc, OHCI_CSR_CONT) & (1<<31)) && (i < 1000); i++)
+ 	for (i = 0; !(OREAD(sc, OHCI_CSR_CONT) & (1U <<31)) && (i < 1000); i++)
 		DELAY(10);
 	bm = OREAD(sc, OHCI_CSR_DATA);
 	if ((bm & 0x3f) == 0x3f)
@@ -1296,7 +1296,7 @@ fwohci_reset(struct fwohci_softc *sc)
 	/* AT Retries */
 	OWRITE(sc, FWOHCI_RETRY,
 	/* CycleLimit   PhyRespRetries ATRespRetries ATReqRetries */
-	(0x << 16) | (0x0f << 8) | (0x0f << 4) | 0x0f);
+	(0xU << 16) | (0x0f << 8) | (0x0f << 4) | 0x0f);
 
 	sc->atrq.top = STAILQ_FIRST(>atrq.db_trq);
 	sc->atrs.top = STAILQ_FIRST(>atrs.db_trq);
@@ -2013,7 +2013,7 @@ fwohci_intr_core(struct fwohci_softc *sc
 		OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_PHY_BUS_R);
 
 		/* Allow async. request to us */
-		OWRITE(sc, OHCI_AREQHI, 1 << 31);
+		OWRITE(sc, OHCI_AREQHI, 1U << 31);
 		if (firewire_phydma_enable) {
 			/* allow from all nodes */
 			OWRITE(sc, OHCI_PREQHI, 0x7fff);

Index: src/sys/dev/ieee1394/fwohcireg.h
diff -u src/sys/dev/ieee1394/fwohcireg.h:1.19 src/sys/dev/ieee1394/fwohcireg.h:1.20
--- src/sys/dev/ieee1394/fwohcireg.h:1.19	Sat Mar 31 14:50:45 2018
+++ src/sys/dev/ieee1394/fwohcireg.h	Tue Oct 15 18:21:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohcireg.h,v 1.19 2018/03/31 14:50:45 sevan Exp $	*/
+/*	$NetBSD: fwohcireg.h,v 1.20 2019/10/15 18:21:47 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -285,13 +285,13 @@ struct ohci_registers {
 	fwohcireg_t	link_cntl_clr;	/* Chip control clear 0xe4*/
 #define FWOHCI_NODEID	0xe8
 	fwohcireg_t	node;		/* Node ID 0xe8 */
-#define	OHCI_NODE_VALID	(1 << 31)
+#define	OHCI_NODE_VALID	(1U << 31)
 

CVS commit: src/sys/dev/ieee1394

2019-09-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Sep 23 06:56:20 UTC 2019

Modified Files:
src/sys/dev/ieee1394: sbp.c

Log Message:
Remove unused assignment. Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ieee1394/sbp.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/ieee1394/sbp.c
diff -u src/sys/dev/ieee1394/sbp.c:1.37 src/sys/dev/ieee1394/sbp.c:1.38
--- src/sys/dev/ieee1394/sbp.c:1.37	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/ieee1394/sbp.c	Mon Sep 23 06:56:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbp.c,v 1.37 2018/09/03 16:29:31 riastradh Exp $	*/
+/*	$NetBSD: sbp.c,v 1.38 2019/09/23 06:56:20 maxv Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sbp.c,v 1.37 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbp.c,v 1.38 2019/09/23 06:56:20 maxv Exp $");
 
 
 #include 
@@ -2052,7 +2052,6 @@ sbp_free_sdev(struct sbp_dev *sdev)
 		bus_dmamap_destroy(sc->sc_dmat, sdev->ocb[i].dmamap);
 	fwdma_free(sdev->dma.dma_tag, sdev->dma.dma_map, sdev->dma.v_addr);
 	free(sdev, M_SBP);
-	sdev = NULL;
 }
 
 static void



CVS commit: src/sys/dev/ieee1394

2019-09-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Sep 23 06:56:20 UTC 2019

Modified Files:
src/sys/dev/ieee1394: sbp.c

Log Message:
Remove unused assignment. Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ieee1394/sbp.c

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



CVS commit: src/sys/dev/ieee1394

2018-12-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Dec 13 16:38:26 UTC 2018

Modified Files:
src/sys/dev/ieee1394: fwdma.c

Log Message:
Fix fwdma_free() for when bus_dmamap_unload() clobbers the dmamap.

Prevents KASSERTs on detaches of sbp(4) and fwohci(4) on amd64.

We should pass the dmamem segs around seperately, not in loaded dmamap...


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ieee1394/fwdma.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/ieee1394/fwdma.c
diff -u src/sys/dev/ieee1394/fwdma.c:1.16 src/sys/dev/ieee1394/fwdma.c:1.17
--- src/sys/dev/ieee1394/fwdma.c:1.16	Sun May 23 18:56:58 2010
+++ src/sys/dev/ieee1394/fwdma.c	Thu Dec 13 16:38:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwdma.c,v 1.16 2010/05/23 18:56:58 christos Exp $	*/
+/*	$NetBSD: fwdma.c,v 1.17 2018/12/13 16:38:26 jakllsch Exp $	*/
 /*-
  * Copyright (c) 2003
  * 	Hidetoshi Shimokawa. All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fwdma.c,v 1.16 2010/05/23 18:56:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwdma.c,v 1.17 2018/12/13 16:38:26 jakllsch Exp $");
 #if defined(__FreeBSD__)
 __FBSDID("$FreeBSD: src/sys/dev/firewire/fwdma.c,v 1.9 2007/06/06 14:31:36 simokawa Exp $");
 #endif
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD: src/sys/dev/firewire
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -108,11 +109,21 @@ fwdma_malloc(device_t dev, bus_dma_tag_t
 void
 fwdma_free(bus_dma_tag_t dmat, bus_dmamap_t dmamap, void *vaddr)
 {
+	bus_dma_segment_t *segs;
 
+	/* XXX we shouldn't pass around the segs in the dmamap */
+	const bus_size_t mapsize = dmamap->dm_mapsize;
+	const int nsegs = dmamap->dm_nsegs;
+	const size_t segssz = sizeof(bus_dma_segment_t) * nsegs;
+	segs = kmem_alloc(segssz, KM_SLEEP);
+	memcpy(segs, dmamap->dm_segs, segssz);
+	
 	bus_dmamap_unload(dmat, dmamap);
-	bus_dmamem_unmap(dmat, vaddr, dmamap->dm_mapsize);
-	bus_dmamem_free(dmat, dmamap->dm_segs, dmamap->dm_nsegs);
+	bus_dmamem_unmap(dmat, vaddr, mapsize);
+	bus_dmamem_free(dmat, segs, nsegs);
 	bus_dmamap_destroy(dmat, dmamap);
+	
+	kmem_free(segs, segssz);
 }
 
 



CVS commit: src/sys/dev/ieee1394

2018-12-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Dec 13 16:38:26 UTC 2018

Modified Files:
src/sys/dev/ieee1394: fwdma.c

Log Message:
Fix fwdma_free() for when bus_dmamap_unload() clobbers the dmamap.

Prevents KASSERTs on detaches of sbp(4) and fwohci(4) on amd64.

We should pass the dmamem segs around seperately, not in loaded dmamap...


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ieee1394/fwdma.c

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



CVS commit: src/sys/dev/ieee1394

2018-03-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Mar 31 14:50:45 UTC 2018

Modified Files:
src/sys/dev/ieee1394: fwohcireg.h

Log Message:
Listed UniNorth device is in fact the UniNorth 2 interface, rename.
https://pci-ids.ucw.cz/read/PC/106b/0031


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ieee1394/fwohcireg.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/ieee1394/fwohcireg.h
diff -u src/sys/dev/ieee1394/fwohcireg.h:1.18 src/sys/dev/ieee1394/fwohcireg.h:1.19
--- src/sys/dev/ieee1394/fwohcireg.h:1.18	Mon Mar 29 03:05:27 2010
+++ src/sys/dev/ieee1394/fwohcireg.h	Sat Mar 31 14:50:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohcireg.h,v 1.18 2010/03/29 03:05:27 kiyohara Exp $	*/
+/*	$NetBSD: fwohcireg.h,v 1.19 2018/03/31 14:50:45 sevan Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -77,7 +77,7 @@
 #define		FW_DEVICE_R5C551	(0x0551 << 16)
 #define		FW_DEVICE_R5C552	(0x0552 << 16)
 #define		FW_DEVICE_PANGEA	(0x0030 << 16)
-#define		FW_DEVICE_UNINORTH	(0x0031 << 16)
+#define		FW_DEVICE_UNINORTH2	(0x0031 << 16)
 #define		FW_DEVICE_AIC5800	(0x5800 << 16)
 #define		FW_DEVICE_FW322		(0x5811 << 16)
 #define		FW_DEVICE_7007		(0x7007 << 16)



CVS commit: src/sys/dev/ieee1394

2018-03-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Mar 31 14:50:45 UTC 2018

Modified Files:
src/sys/dev/ieee1394: fwohcireg.h

Log Message:
Listed UniNorth device is in fact the UniNorth 2 interface, rename.
https://pci-ids.ucw.cz/read/PC/106b/0031


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ieee1394/fwohcireg.h

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



CVS commit: src/sys/dev/ieee1394

2017-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun 25 12:39:27 UTC 2017

Modified Files:
src/sys/dev/ieee1394: fwdev.c

Log Message:
memory leak, found by Mootja; it seems that we should check the return
value of 'fw_bindadd' in several other places, but whatever


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ieee1394/fwdev.c

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



CVS commit: src/sys/dev/ieee1394

2017-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun 25 12:39:27 UTC 2017

Modified Files:
src/sys/dev/ieee1394: fwdev.c

Log Message:
memory leak, found by Mootja; it seems that we should check the return
value of 'fw_bindadd' in several other places, but whatever


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ieee1394/fwdev.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/ieee1394/fwdev.c
diff -u src/sys/dev/ieee1394/fwdev.c:1.31 src/sys/dev/ieee1394/fwdev.c:1.32
--- src/sys/dev/ieee1394/fwdev.c:1.31	Sun Nov 20 22:47:39 2016
+++ src/sys/dev/ieee1394/fwdev.c	Sun Jun 25 12:39:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwdev.c,v 1.31 2016/11/20 22:47:39 riastradh Exp $	*/
+/*	$NetBSD: fwdev.c,v 1.32 2017/06/25 12:39:27 maxv Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fwdev.c,v 1.31 2016/11/20 22:47:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwdev.c,v 1.32 2017/06/25 12:39:27 maxv Exp $");
 
 #include 
 #include 
@@ -614,6 +614,8 @@ out:
 			/* XXX */
 			PAGE_SIZE, PAGE_SIZE, 5, fc, (void *)fwb, fw_hand);
 			STAILQ_INSERT_TAIL(>binds, fwb, chlist);
+		} else {
+			free(fwb, M_FW);
 		}
 		break;
 



CVS commit: src/sys/dev/ieee1394

2016-11-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Nov 21 01:19:35 UTC 2016

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
Let's try initializing the pointers *before* dereferencing them!

Oops.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/dev/ieee1394/fwohci.c

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



CVS commit: src/sys/dev/ieee1394

2016-11-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Nov 21 01:19:35 UTC 2016

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
Let's try initializing the pointers *before* dereferencing them!

Oops.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/dev/ieee1394/fwohci.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/ieee1394/fwohci.c
diff -u src/sys/dev/ieee1394/fwohci.c:1.140 src/sys/dev/ieee1394/fwohci.c:1.141
--- src/sys/dev/ieee1394/fwohci.c:1.140	Sun Nov 20 22:56:13 2016
+++ src/sys/dev/ieee1394/fwohci.c	Mon Nov 21 01:19:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci.c,v 1.140 2016/11/20 22:56:13 riastradh Exp $	*/
+/*	$NetBSD: fwohci.c,v 1.141 2016/11/21 01:19:35 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.140 2016/11/20 22:56:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.141 2016/11/21 01:19:35 riastradh Exp $");
 
 #include 
 #include 
@@ -428,8 +428,6 @@ fwohci_attach(struct fwohci_softc *sc)
 	if (i == 0)
 		return ENXIO;
 
-	fw_init_isodma(>fc);
-
 	for (i = 0; i < sc->fc.nisodma; i++) {
 		sc->fc.it[i] = >it[i].xferq;
 		sc->fc.ir[i] = >ir[i].xferq;
@@ -441,6 +439,8 @@ fwohci_attach(struct fwohci_softc *sc)
 		sc->ir[i].off = OHCI_IROFF(i);
 	}
 
+	fw_init_isodma(>fc);
+
 	sc->fc.config_rom = fwdma_alloc_setup(sc->fc.dev, sc->fc.dmat,
 	CROMSIZE, >crom_dma, CROMSIZE, BUS_DMA_NOWAIT);
 	if (sc->fc.config_rom == NULL) {



CVS commit: src/sys/dev/ieee1394

2016-11-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Nov 20 22:56:13 UTC 2016

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
KASSERT(mutex_owner(...)) ---> KASSERT(mutex_owned(...))

If this is not correct, then there's something bogus in this code
anyway, so better to fail early.

Final part of PR kern/47114.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/dev/ieee1394/fwohci.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/ieee1394/fwohci.c
diff -u src/sys/dev/ieee1394/fwohci.c:1.139 src/sys/dev/ieee1394/fwohci.c:1.140
--- src/sys/dev/ieee1394/fwohci.c:1.139	Sun Nov 20 22:47:39 2016
+++ src/sys/dev/ieee1394/fwohci.c	Sun Nov 20 22:56:13 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci.c,v 1.139 2016/11/20 22:47:39 riastradh Exp $	*/
+/*	$NetBSD: fwohci.c,v 1.140 2016/11/20 22:56:13 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.139 2016/11/20 22:47:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.140 2016/11/20 22:56:13 riastradh Exp $");
 
 #include 
 #include 
@@ -2508,7 +2508,7 @@ fwohci_txbufdb(struct fwohci_softc *sc, 
 	unsigned short chtag;
 	int idb;
 
-	KASSERT(mutex_owner(>fc.fc_mtx));
+	KASSERT(mutex_owned(>fc.fc_mtx));
 
 	dbch = >it[dmach];
 	chtag = sc->it[dmach].xferq.flag & 0xff;



CVS commit: src/sys/dev/ieee1394

2016-11-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Nov 20 22:56:13 UTC 2016

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
KASSERT(mutex_owner(...)) ---> KASSERT(mutex_owned(...))

If this is not correct, then there's something bogus in this code
anyway, so better to fail early.

Final part of PR kern/47114.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/dev/ieee1394/fwohci.c

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



CVS commit: src/sys/dev/ieee1394

2016-11-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Nov 20 22:47:39 UTC 2016

Modified Files:
src/sys/dev/ieee1394: firewire.c firewirereg.h fwdev.c fwohci.c

Log Message:
Kill some more tsleep.

And no, surrounding tsleep by mutex_exit/mutex_enter does not fix
problems even if the LOCKDEBUG panic symptom goes away...


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ieee1394/firewirereg.h
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ieee1394/fwdev.c
cvs rdiff -u -r1.138 -r1.139 src/sys/dev/ieee1394/fwohci.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.46 src/sys/dev/ieee1394/firewire.c:1.47
--- src/sys/dev/ieee1394/firewire.c:1.46	Sun Nov 20 22:36:45 2016
+++ src/sys/dev/ieee1394/firewire.c	Sun Nov 20 22:47:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.46 2016/11/20 22:36:45 riastradh Exp $	*/
+/*	$NetBSD: firewire.c,v 1.47 2016/11/20 22:47:39 riastradh Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.46 2016/11/20 22:36:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.47 2016/11/20 22:47:39 riastradh Exp $");
 
 #include 
 #include 
@@ -682,6 +682,20 @@ fw_init_isodma(struct firewire_comm *fc)
 
 		fc->ir[i]->maxq = FWMAXQUEUE;
 		fc->it[i]->maxq = FWMAXQUEUE;
+
+		cv_init(>ir[i]->cv, "fw_read");
+		cv_init(>it[i]->cv, "fw_write");
+	}
+}
+
+void
+fw_destroy_isodma(struct firewire_comm *fc)
+{
+	unsigned i;
+
+	for (i = 0; i < fc->nisodma; i++) {
+		cv_destroy(>ir[i]->cv);
+		cv_destroy(>it[i]->cv);
 	}
 }
 

Index: src/sys/dev/ieee1394/firewirereg.h
diff -u src/sys/dev/ieee1394/firewirereg.h:1.19 src/sys/dev/ieee1394/firewirereg.h:1.20
--- src/sys/dev/ieee1394/firewirereg.h:1.19	Sun Nov 20 22:36:45 2016
+++ src/sys/dev/ieee1394/firewirereg.h	Sun Nov 20 22:47:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewirereg.h,v 1.19 2016/11/20 22:36:45 riastradh Exp $	*/
+/*	$NetBSD: firewirereg.h,v 1.20 2016/11/20 22:47:39 riastradh Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -200,6 +200,7 @@ struct fw_xferq {
 	STAILQ_HEAD(, fw_bulkxfer) stfree;
 	STAILQ_HEAD(, fw_bulkxfer) stdma;
 	struct fw_bulkxfer *stproc;
+	kcondvar_t cv;
 	struct selinfo rsel;
 	void *sc;
 	void (*hand) (struct fw_xferq *);
@@ -284,6 +285,7 @@ void fw_drain_txq(struct firewire_comm *
 void fw_busreset(struct firewire_comm *, uint32_t);
 void fw_init(struct firewire_comm *);
 void fw_init_isodma(struct firewire_comm *);
+void fw_destroy_isodma(struct firewire_comm *);
 void fw_destroy(struct firewire_comm *);
 struct fw_bind *fw_bindlookup(struct firewire_comm *, uint16_t, uint32_t);
 int fw_bindadd(struct firewire_comm *, struct fw_bind *);

Index: src/sys/dev/ieee1394/fwdev.c
diff -u src/sys/dev/ieee1394/fwdev.c:1.30 src/sys/dev/ieee1394/fwdev.c:1.31
--- src/sys/dev/ieee1394/fwdev.c:1.30	Fri Jul 25 08:10:37 2014
+++ src/sys/dev/ieee1394/fwdev.c	Sun Nov 20 22:47:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwdev.c,v 1.30 2014/07/25 08:10:37 dholland Exp $	*/
+/*	$NetBSD: fwdev.c,v 1.31 2016/11/20 22:47:39 riastradh Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fwdev.c,v 1.30 2014/07/25 08:10:37 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwdev.c,v 1.31 2016/11/20 22:47:39 riastradh Exp $");
 
 #include 
 #include 
@@ -104,6 +104,7 @@ struct fw_drv1 {
 	struct fw_isobufreq bufreq;
 	STAILQ_HEAD(, fw_bind) binds;
 	STAILQ_HEAD(, fw_xfer) rq;
+	kcondvar_t cv;
 };
 
 static int fwdev_allocbuf(struct firewire_comm *, struct fw_xferq *,
@@ -145,6 +146,7 @@ fw_open(dev_t dev, int flags, int fmt, s
 	d->fc = sc->fc;
 	STAILQ_INIT(>binds);
 	STAILQ_INIT(>rq);
+	cv_init(>cv, "fwra");
 
 	return err;
 }
@@ -217,6 +219,7 @@ fw_close(dev_t dev, int flags, int fmt, 
 		~(FWXFERQ_OPEN | FWXFERQ_MODEMASK | FWXFERQ_CHTAGMASK);
 		d->it = NULL;
 	}
+	cv_destroy(>cv);
 	free(sc->si_drv1, M_FW);
 	sc->si_drv1 = NULL;
 
@@ -265,9 +268,7 @@ readloop:
 		if (slept == 0) {
 			slept = 1;
 			ir->flag |= FWXFERQ_WAKEUP;
-			mutex_exit(>fc_mtx);
-			err = tsleep(ir, FWPRI, "fw_read", hz);
-			mutex_enter(>fc_mtx);
+			err = cv_timedwait_sig(>cv, >fc_mtx, hz);
 			ir->flag &= ~FWXFERQ_WAKEUP;
 			if (err == 0)
 goto readloop;
@@ -343,9 +344,7 @@ isoloop:
 			if (err)
 goto out;
 #endif
-			mutex_exit(>fc_mtx);
-			err = tsleep(it, FWPRI, "fw_write", hz);
-			mutex_enter(>fc_mtx);
+			err = cv_timedwait_sig(>cv, >fc_mtx, hz);
 			if (err)
 goto out;
 			goto isoloop;
@@ -824,11 +823,11 @@ 

CVS commit: src/sys/dev/ieee1394

2016-11-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Nov 20 22:47:39 UTC 2016

Modified Files:
src/sys/dev/ieee1394: firewire.c firewirereg.h fwdev.c fwohci.c

Log Message:
Kill some more tsleep.

And no, surrounding tsleep by mutex_exit/mutex_enter does not fix
problems even if the LOCKDEBUG panic symptom goes away...


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ieee1394/firewirereg.h
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ieee1394/fwdev.c
cvs rdiff -u -r1.138 -r1.139 src/sys/dev/ieee1394/fwohci.c

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



CVS commit: src/sys/dev/ieee1394

2016-11-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Nov 20 22:36:45 UTC 2016

Modified Files:
src/sys/dev/ieee1394: firewire.c firewirereg.h fwohci.c

Log Message:
Defer initialization of isodma channels until we know how many.

Should fix a bug I introduced four years ago in:
https://mail-index.netbsd.org/source-changes/2012/08/04/msg036211.html


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ieee1394/firewirereg.h
cvs rdiff -u -r1.137 -r1.138 src/sys/dev/ieee1394/fwohci.c

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



CVS commit: src/sys/dev/ieee1394

2016-11-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Nov 20 22:36:45 UTC 2016

Modified Files:
src/sys/dev/ieee1394: firewire.c firewirereg.h fwohci.c

Log Message:
Defer initialization of isodma channels until we know how many.

Should fix a bug I introduced four years ago in:
https://mail-index.netbsd.org/source-changes/2012/08/04/msg036211.html


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ieee1394/firewirereg.h
cvs rdiff -u -r1.137 -r1.138 src/sys/dev/ieee1394/fwohci.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.45 src/sys/dev/ieee1394/firewire.c:1.46
--- src/sys/dev/ieee1394/firewire.c:1.45	Sat Oct 18 08:33:28 2014
+++ src/sys/dev/ieee1394/firewire.c	Sun Nov 20 22:36:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.45 2014/10/18 08:33:28 snj Exp $	*/
+/*	$NetBSD: firewire.c,v 1.46 2016/11/20 22:36:45 riastradh Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.45 2014/10/18 08:33:28 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.46 2016/11/20 22:36:45 riastradh Exp $");
 
 #include 
 #include 
@@ -622,33 +622,11 @@ fw_init(struct firewire_comm *fc)
 	mutex_init(>atq->q_mtx, MUTEX_DEFAULT, IPL_VM);
 	mutex_init(>ats->q_mtx, MUTEX_DEFAULT, IPL_VM);
 
-	for (i = 0; i < fc->nisodma; i++) {
-		fc->it[i]->queued = 0;
-		fc->ir[i]->queued = 0;
-
-		fc->it[i]->start = NULL;
-		fc->ir[i]->start = NULL;
-
-		fc->it[i]->buf = NULL;
-		fc->ir[i]->buf = NULL;
-
-		fc->it[i]->flag = FWXFERQ_STREAM;
-		fc->ir[i]->flag = FWXFERQ_STREAM;
-
-		STAILQ_INIT(>it[i]->q);
-		STAILQ_INIT(>ir[i]->q);
-	}
-
 	fc->arq->maxq = FWMAXQUEUE;
 	fc->ars->maxq = FWMAXQUEUE;
 	fc->atq->maxq = FWMAXQUEUE;
 	fc->ats->maxq = FWMAXQUEUE;
 
-	for (i = 0; i < fc->nisodma; i++) {
-		fc->ir[i]->maxq = FWMAXQUEUE;
-		fc->it[i]->maxq = FWMAXQUEUE;
-	}
-
 	CSRARC(fc, TOPO_MAP) = 0x3f1 << 16;
 	CSRARC(fc, TOPO_MAP + 4) = 1;
 	CSRARC(fc, SPED_MAP) = 0x3f1 << 16;
@@ -677,6 +655,36 @@ fw_init(struct firewire_comm *fc)
 	fc->crom_src_buf = NULL;
 }
 
+/*
+ * Called by HCI driver when it has determined the number of
+ * isochronous DMA channels.
+ */
+void
+fw_init_isodma(struct firewire_comm *fc)
+{
+	unsigned i;
+
+	for (i = 0; i < fc->nisodma; i++) {
+		fc->it[i]->queued = 0;
+		fc->ir[i]->queued = 0;
+
+		fc->it[i]->start = NULL;
+		fc->ir[i]->start = NULL;
+
+		fc->it[i]->buf = NULL;
+		fc->ir[i]->buf = NULL;
+
+		fc->it[i]->flag = FWXFERQ_STREAM;
+		fc->ir[i]->flag = FWXFERQ_STREAM;
+
+		STAILQ_INIT(>it[i]->q);
+		STAILQ_INIT(>ir[i]->q);
+
+		fc->ir[i]->maxq = FWMAXQUEUE;
+		fc->it[i]->maxq = FWMAXQUEUE;
+	}
+}
+
 void
 fw_destroy(struct firewire_comm *fc)
 {

Index: src/sys/dev/ieee1394/firewirereg.h
diff -u src/sys/dev/ieee1394/firewirereg.h:1.18 src/sys/dev/ieee1394/firewirereg.h:1.19
--- src/sys/dev/ieee1394/firewirereg.h:1.18	Sat Aug  4 03:55:43 2012
+++ src/sys/dev/ieee1394/firewirereg.h	Sun Nov 20 22:36:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewirereg.h,v 1.18 2012/08/04 03:55:43 riastradh Exp $	*/
+/*	$NetBSD: firewirereg.h,v 1.19 2016/11/20 22:36:45 riastradh Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -283,6 +283,7 @@ int fw_xferwait(struct fw_xfer *);
 void fw_drain_txq(struct firewire_comm *);
 void fw_busreset(struct firewire_comm *, uint32_t);
 void fw_init(struct firewire_comm *);
+void fw_init_isodma(struct firewire_comm *);
 void fw_destroy(struct firewire_comm *);
 struct fw_bind *fw_bindlookup(struct firewire_comm *, uint16_t, uint32_t);
 int fw_bindadd(struct firewire_comm *, struct fw_bind *);

Index: src/sys/dev/ieee1394/fwohci.c
diff -u src/sys/dev/ieee1394/fwohci.c:1.137 src/sys/dev/ieee1394/fwohci.c:1.138
--- src/sys/dev/ieee1394/fwohci.c:1.137	Tue Feb 25 18:30:09 2014
+++ src/sys/dev/ieee1394/fwohci.c	Sun Nov 20 22:36:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci.c,v 1.137 2014/02/25 18:30:09 pooka Exp $	*/
+/*	$NetBSD: fwohci.c,v 1.138 2016/11/20 22:36:45 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.137 2014/02/25 18:30:09 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.138 2016/11/20 22:36:45 riastradh Exp $");
 
 #include 
 #include 
@@ -428,6 +428,8 @@ fwohci_attach(struct fwohci_softc *sc)
 	if (i == 0)
 		return ENXIO;
 
+	fw_init_isodma(>fc);
+
 	for (i = 0; i < sc->fc.nisodma; i++) {
 		sc->fc.it[i] = >it[i].xferq;
 		sc->fc.ir[i] = >ir[i].xferq;



CVS commit: src/sys/dev/ieee1394

2014-11-21 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Nov 21 23:37:25 UTC 2014

Modified Files:
src/sys/dev/ieee1394: fwcrom.c

Log Message:
No reason not to make the string const.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ieee1394/fwcrom.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/ieee1394/fwcrom.c
diff -u src/sys/dev/ieee1394/fwcrom.c:1.16 src/sys/dev/ieee1394/fwcrom.c:1.17
--- src/sys/dev/ieee1394/fwcrom.c:1.16	Sun Sep 21 18:03:47 2014
+++ src/sys/dev/ieee1394/fwcrom.c	Fri Nov 21 23:37:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwcrom.c,v 1.16 2014/09/21 18:03:47 christos Exp $	*/
+/*	$NetBSD: fwcrom.c,v 1.17 2014/11/21 23:37:25 joerg Exp $	*/
 /*-
  * Copyright (c) 2002-2003
  * 	Hidetoshi Shimokawa. All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1.16 2014/09/21 18:03:47 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1.17 2014/11/21 23:37:25 joerg Exp $);
 
 #include sys/param.h
 #ifdef _KERNEL
@@ -172,7 +172,7 @@ crom_parse_text(struct crom_context *cc,
 	struct csrtext *textleaf;
 	uint32_t *bp;
 	int i, qlen;
-	static char *nullstr = (char *)(null);
+	static const char nullstr[] = (null);
 
 	if (cc-depth  0)
 		return;



CVS commit: src/sys/dev/ieee1394

2014-11-21 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Nov 21 23:37:25 UTC 2014

Modified Files:
src/sys/dev/ieee1394: fwcrom.c

Log Message:
No reason not to make the string const.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ieee1394/fwcrom.c

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



CVS commit: src/sys/dev/ieee1394

2014-09-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 21 17:10:01 UTC 2014

Modified Files:
src/sys/dev/ieee1394: fwcrom.c

Log Message:
fix cut-n-paste, use arrays instead of separate variables to avoid code
duplication.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ieee1394/fwcrom.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/ieee1394/fwcrom.c
diff -u src/sys/dev/ieee1394/fwcrom.c:1.14 src/sys/dev/ieee1394/fwcrom.c:1.15
--- src/sys/dev/ieee1394/fwcrom.c:1.14	Thu Mar 27 22:16:47 2014
+++ src/sys/dev/ieee1394/fwcrom.c	Sun Sep 21 13:10:00 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwcrom.c,v 1.14 2014/03/28 02:16:47 christos Exp $	*/
+/*	$NetBSD: fwcrom.c,v 1.15 2014/09/21 17:10:00 christos Exp $	*/
 /*-
  * Copyright (c) 2002-2003
  * 	Hidetoshi Shimokawa. All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1.14 2014/03/28 02:16:47 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1.15 2014/09/21 17:10:00 christos Exp $);
 
 #include sys/param.h
 #ifdef _KERNEL
@@ -48,11 +48,11 @@ __KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1
 #include dev/ieee1394/firewire.h
 #include dev/ieee1394/iec13213.h
 
-#define MAX_ROM (1024 - sizeof(uint32_t) * 5)
+#define MAX_ROM (1024 - sizeof(uint[2]2_t) * 5)
 #define CROM_END(cc) ((char *)(cc)-stack[0].dir + MAX_ROM - 1)
 
 void
-crom_init_context(struct crom_context *cc, uint32_t *p)
+crom_init_context(struct crom_context *cc, uint[2]2_t *p)
 {
 	struct csrhdr *hdr;
 
@@ -139,7 +139,7 @@ crom_search_key(struct crom_context *cc,
 }
 
 int
-crom_has_specver(uint32_t *p, uint32_t spec, uint32_t ver)
+crom_has_specver(uint[2]2_t *p, uint[2]2_t spec, uint[2]2_t ver)
 {
 	struct csrreg *reg;
 	struct crom_context c, *cc;
@@ -170,7 +170,7 @@ crom_parse_text(struct crom_context *cc,
 {
 	struct csrreg *reg;
 	struct csrtext *textleaf;
-	uint32_t *bp;
+	uint[2]2_t *bp;
 	int i, qlen;
 	static char *nullstr = (char *)(null);
 
@@ -198,7 +198,7 @@ crom_parse_text(struct crom_context *cc,
 
 	/* XXX should check spec and type */
 
-	bp = (uint32_t *)buf;
+	bp = (uint[2]2_t *)buf;
 	qlen = textleaf-crc_len - 2;
 	if (len  qlen * 4)
 		qlen = len/4;
@@ -212,10 +212,10 @@ crom_parse_text(struct crom_context *cc,
 }
 
 uint16_t
-crom_crc(uint32_t *ptr, int len)
+crom_crc(uint[2]2_t *ptr, int len)
 {
 	int i, shift;
-	uint32_t data, sum, crc = 0;
+	uint[2]2_t data, sum, crc = 0;
 
 	for (i = 0; i  len; i++) {
 		data = ptr[i];
@@ -230,7 +230,7 @@ crom_crc(uint32_t *ptr, int len)
 
 #if !defined(_KERNEL)  !defined(_BOOT)
 static void
-crom_desc_specver(uint32_t spec, uint32_t ver, char *buf, int len)
+crom_desc_specver(uint[2]2_t spec, uint[2]2_t ver, char *buf, int len)
 {
 	const char *s = NULL;
 
@@ -308,7 +308,7 @@ crom_desc(struct crom_context *cc, char 
 		/* XXX fall through */
 	case CSRTYPE_D:
 		dir = (struct csrdirectory *) (reg + reg-val);
-		crc = crom_crc((uint32_t *)dir-entry, dir-crc_len);
+		crc = crom_crc((uint[2]2_t *)dir-entry, dir-crc_len);
 		l += snprintf(buf + l, len - l, len=%d crc=0x%04x ,
 		dir-crc_len, crc);
 
@@ -396,7 +396,7 @@ crom_desc(struct crom_context *cc, char 
 #if defined(_KERNEL) || defined(_BOOT) || defined(TEST)
 
 int
-crom_add_quad(struct crom_chunk *chunk, uint32_t entry)
+crom_add_quad(struct crom_chunk *chunk, uint[2]2_t entry)
 {
 	int index;
 
@@ -415,7 +415,7 @@ crom_add_entry(struct crom_chunk *chunk,
 {
 	union {
 		struct csrreg reg;
-		uint32_t i;
+		uint[2]2_t i;
 	} foo;
 
 	foo.reg.key = key;
@@ -450,7 +450,7 @@ crom_add_simple_text(struct crom_src *sr
 		 struct crom_chunk *chunk, const char *buf)
 {
 	struct csrtext *tl;
-	uint32_t *p;
+	uint[2]2_t *p;
 	int len, i;
 	char t[MAX_TEXT];
 
@@ -461,38 +461,38 @@ crom_add_simple_text(struct crom_src *sr
 	}
 
 	tl = (struct csrtext *) chunk-data;
-	tl-crc_len = howmany(sizeof(struct csrtext) + len, sizeof(uint32_t));
+	tl-crc_len = howmany(sizeof(struct csrtext) + len, sizeof(uint[2]2_t));
 	tl-spec_id = 0;
 	tl-spec_type = 0;
 	tl-lang_id = 0;
-	memset(t, 0, roundup2(len, sizeof(uint32_t)));
+	memset(t, 0, roundup2(len, sizeof(uint[2]2_t)));
 	memcpy(t, buf, len);
-	p = (uint32_t *)t;
-	for (i = 0; i  howmany(len, sizeof(uint32_t)); i++)
+	p = (uint[2]2_t *)t;
+	for (i = 0; i  howmany(len, sizeof(uint[2]2_t)); i++)
 		tl-text[i] = ntohl(*p++);
 	return crom_add_chunk(src, parent, chunk, CROM_TEXTLEAF);
 }
 
 static int
-crom_copy(uint32_t *src, uint32_t *dst, int *offset, int len, int maxlen)
+crom_copy(uint[2]2_t *src, uint[2]2_t *dst, int *offset, int len, int maxlen)
 {
 
 	if (*offset + len  maxlen) {
 		printf(Config. ROM is too large for the buffer\n);
 		return -1;
 	}
-	memcpy((char *)(dst + *offset), src, len * sizeof(uint32_t));
+	memcpy((char *)(dst + *offset), src, len * sizeof(uint[2]2_t));
 	*offset += len;
 	return 0;
 }
 
 int
-crom_load(struct crom_src *src, 

CVS commit: src/sys/dev/ieee1394

2014-09-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 21 18:03:47 UTC 2014

Modified Files:
src/sys/dev/ieee1394: fwcrom.c

Log Message:
ran sed too agressively.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ieee1394/fwcrom.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/ieee1394/fwcrom.c
diff -u src/sys/dev/ieee1394/fwcrom.c:1.15 src/sys/dev/ieee1394/fwcrom.c:1.16
--- src/sys/dev/ieee1394/fwcrom.c:1.15	Sun Sep 21 13:10:00 2014
+++ src/sys/dev/ieee1394/fwcrom.c	Sun Sep 21 14:03:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwcrom.c,v 1.15 2014/09/21 17:10:00 christos Exp $	*/
+/*	$NetBSD: fwcrom.c,v 1.16 2014/09/21 18:03:47 christos Exp $	*/
 /*-
  * Copyright (c) 2002-2003
  * 	Hidetoshi Shimokawa. All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1.15 2014/09/21 17:10:00 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1.16 2014/09/21 18:03:47 christos Exp $);
 
 #include sys/param.h
 #ifdef _KERNEL
@@ -48,11 +48,11 @@ __KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1
 #include dev/ieee1394/firewire.h
 #include dev/ieee1394/iec13213.h
 
-#define MAX_ROM (1024 - sizeof(uint[2]2_t) * 5)
+#define MAX_ROM (1024 - sizeof(uint32_t) * 5)
 #define CROM_END(cc) ((char *)(cc)-stack[0].dir + MAX_ROM - 1)
 
 void
-crom_init_context(struct crom_context *cc, uint[2]2_t *p)
+crom_init_context(struct crom_context *cc, uint32_t *p)
 {
 	struct csrhdr *hdr;
 
@@ -139,7 +139,7 @@ crom_search_key(struct crom_context *cc,
 }
 
 int
-crom_has_specver(uint[2]2_t *p, uint[2]2_t spec, uint[2]2_t ver)
+crom_has_specver(uint32_t *p, uint32_t spec, uint32_t ver)
 {
 	struct csrreg *reg;
 	struct crom_context c, *cc;
@@ -170,7 +170,7 @@ crom_parse_text(struct crom_context *cc,
 {
 	struct csrreg *reg;
 	struct csrtext *textleaf;
-	uint[2]2_t *bp;
+	uint32_t *bp;
 	int i, qlen;
 	static char *nullstr = (char *)(null);
 
@@ -198,7 +198,7 @@ crom_parse_text(struct crom_context *cc,
 
 	/* XXX should check spec and type */
 
-	bp = (uint[2]2_t *)buf;
+	bp = (uint32_t *)buf;
 	qlen = textleaf-crc_len - 2;
 	if (len  qlen * 4)
 		qlen = len/4;
@@ -212,10 +212,10 @@ crom_parse_text(struct crom_context *cc,
 }
 
 uint16_t
-crom_crc(uint[2]2_t *ptr, int len)
+crom_crc(uint32_t *ptr, int len)
 {
 	int i, shift;
-	uint[2]2_t data, sum, crc = 0;
+	uint32_t data, sum, crc = 0;
 
 	for (i = 0; i  len; i++) {
 		data = ptr[i];
@@ -230,7 +230,7 @@ crom_crc(uint[2]2_t *ptr, int len)
 
 #if !defined(_KERNEL)  !defined(_BOOT)
 static void
-crom_desc_specver(uint[2]2_t spec, uint[2]2_t ver, char *buf, int len)
+crom_desc_specver(uint32_t spec, uint32_t ver, char *buf, int len)
 {
 	const char *s = NULL;
 
@@ -308,7 +308,7 @@ crom_desc(struct crom_context *cc, char 
 		/* XXX fall through */
 	case CSRTYPE_D:
 		dir = (struct csrdirectory *) (reg + reg-val);
-		crc = crom_crc((uint[2]2_t *)dir-entry, dir-crc_len);
+		crc = crom_crc((uint32_t *)dir-entry, dir-crc_len);
 		l += snprintf(buf + l, len - l, len=%d crc=0x%04x ,
 		dir-crc_len, crc);
 
@@ -396,7 +396,7 @@ crom_desc(struct crom_context *cc, char 
 #if defined(_KERNEL) || defined(_BOOT) || defined(TEST)
 
 int
-crom_add_quad(struct crom_chunk *chunk, uint[2]2_t entry)
+crom_add_quad(struct crom_chunk *chunk, uint32_t entry)
 {
 	int index;
 
@@ -415,7 +415,7 @@ crom_add_entry(struct crom_chunk *chunk,
 {
 	union {
 		struct csrreg reg;
-		uint[2]2_t i;
+		uint32_t i;
 	} foo;
 
 	foo.reg.key = key;
@@ -450,7 +450,7 @@ crom_add_simple_text(struct crom_src *sr
 		 struct crom_chunk *chunk, const char *buf)
 {
 	struct csrtext *tl;
-	uint[2]2_t *p;
+	uint32_t *p;
 	int len, i;
 	char t[MAX_TEXT];
 
@@ -461,38 +461,38 @@ crom_add_simple_text(struct crom_src *sr
 	}
 
 	tl = (struct csrtext *) chunk-data;
-	tl-crc_len = howmany(sizeof(struct csrtext) + len, sizeof(uint[2]2_t));
+	tl-crc_len = howmany(sizeof(struct csrtext) + len, sizeof(uint32_t));
 	tl-spec_id = 0;
 	tl-spec_type = 0;
 	tl-lang_id = 0;
-	memset(t, 0, roundup2(len, sizeof(uint[2]2_t)));
+	memset(t, 0, roundup2(len, sizeof(uint32_t)));
 	memcpy(t, buf, len);
-	p = (uint[2]2_t *)t;
-	for (i = 0; i  howmany(len, sizeof(uint[2]2_t)); i++)
+	p = (uint32_t *)t;
+	for (i = 0; i  howmany(len, sizeof(uint32_t)); i++)
 		tl-text[i] = ntohl(*p++);
 	return crom_add_chunk(src, parent, chunk, CROM_TEXTLEAF);
 }
 
 static int
-crom_copy(uint[2]2_t *src, uint[2]2_t *dst, int *offset, int len, int maxlen)
+crom_copy(uint32_t *src, uint32_t *dst, int *offset, int len, int maxlen)
 {
 
 	if (*offset + len  maxlen) {
 		printf(Config. ROM is too large for the buffer\n);
 		return -1;
 	}
-	memcpy((char *)(dst + *offset), src, len * sizeof(uint[2]2_t));
+	memcpy((char *)(dst + *offset), src, len * sizeof(uint32_t));
 	*offset += len;
 	return 0;
 }
 
 int
-crom_load(struct crom_src *src, uint[2]2_t *buf, int maxlen)
+crom_load(struct crom_src 

CVS commit: src/sys/dev/ieee1394

2014-09-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 21 18:03:47 UTC 2014

Modified Files:
src/sys/dev/ieee1394: fwcrom.c

Log Message:
ran sed too agressively.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ieee1394/fwcrom.c

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



CVS commit: src/sys/dev/ieee1394

2014-03-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 28 02:16:47 UTC 2014

Modified Files:
src/sys/dev/ieee1394: fwcrom.c

Log Message:
Deal with snprintf more gracefully.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ieee1394/fwcrom.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/ieee1394/fwcrom.c
diff -u src/sys/dev/ieee1394/fwcrom.c:1.13 src/sys/dev/ieee1394/fwcrom.c:1.14
--- src/sys/dev/ieee1394/fwcrom.c:1.13	Thu Aug 26 03:36:53 2010
+++ src/sys/dev/ieee1394/fwcrom.c	Thu Mar 27 22:16:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwcrom.c,v 1.13 2010/08/26 07:36:53 cegger Exp $	*/
+/*	$NetBSD: fwcrom.c,v 1.14 2014/03/28 02:16:47 christos Exp $	*/
 /*-
  * Copyright (c) 2002-2003
  * 	Hidetoshi Shimokawa. All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1.13 2010/08/26 07:36:53 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1.14 2014/03/28 02:16:47 christos Exp $);
 
 #include sys/param.h
 #ifdef _KERNEL
@@ -283,44 +283,45 @@ crom_desc_specver(uint32_t spec, uint32_
 }
 
 const char *
-crom_desc(struct crom_context *cc, char *buf, int len)
+crom_desc(struct crom_context *cc, char *buf, size_t len)
 {
 	struct csrreg *reg;
 	struct csrdirectory *dir;
 	const char *desc;
 	uint16_t crc;
+	size_t l = 0;
 
 	reg = crom_get(cc);
 	switch (reg-key  CSRTYPE_MASK) {
 	case CSRTYPE_I:
 #if 0
-		len -= snprintf(buf, len, 0x%x, reg-val);
-		buf += strlen(buf);
+		l += snprintf(buf + l, len - l, 0x%x, reg-val);
 #else
 		*buf = '\0';
 #endif
 		break;
 	case CSRTYPE_C:
-		len -=
-		snprintf(buf, len, offset=0x%04x(%d), reg-val, reg-val);
-		buf += strlen(buf);
+		l += snprintf(buf + l, len - l, offset=0x%04x(%d),
+		reg-val, reg-val);
 		break;
 	case CSRTYPE_L:
 		/* XXX fall through */
 	case CSRTYPE_D:
 		dir = (struct csrdirectory *) (reg + reg-val);
 		crc = crom_crc((uint32_t *)dir-entry, dir-crc_len);
-		len -= snprintf(buf, len, len=%d crc=0x%04x ,
+		l += snprintf(buf + l, len - l, len=%d crc=0x%04x ,
 		dir-crc_len, crc);
-		buf += strlen(buf);
 
+		if (l  len)
+			l = len;
 		if (crc == dir-crc)
-			len -= snprintf(buf, len, (OK) );
+			l += snprintf(buf + l, len - l, (OK) );
 		else
-			len -= snprintf(buf, len, (NG, 0x%x) ,
+			l += snprintf(buf + l, len - l, (NG, 0x%x) ,
 			dir-crc);
-		buf += strlen(buf);
 	}
+	if (l  len)
+		l = len;
 	switch (reg-key) {
 	case CSRKEY_VENDOR: /* 0x03 */
 		desc = module_vendor_ID;
@@ -374,7 +375,7 @@ crom_desc(struct crom_context *cc, char 
 	case CROM_TEXTLEAF: /* 0x81 */
 	case CROM_TEXTLEAF2: /* 0x82 */
 		desc = text_leaf;
-		crom_parse_text(cc, buf + strlen(buf), len);
+		crom_parse_text(cc, buf + l, len - l);
 		break;
 	case CROM_NODEID: /* 0x8d */
 		desc = node_unique_ID;



CVS commit: src/sys/dev/ieee1394

2014-03-27 Thread Hisashi T Fujinaka
Module Name:src
Committed By:   htodd
Date:   Fri Mar 28 04:09:19 UTC 2014

Modified Files:
src/sys/dev/ieee1394: iec13213.h

Log Message:
Fix build.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ieee1394/iec13213.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/ieee1394/iec13213.h
diff -u src/sys/dev/ieee1394/iec13213.h:1.5 src/sys/dev/ieee1394/iec13213.h:1.6
--- src/sys/dev/ieee1394/iec13213.h:1.5	Thu Aug 26 07:36:53 2010
+++ src/sys/dev/ieee1394/iec13213.h	Fri Mar 28 04:09:19 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: iec13213.h,v 1.5 2010/08/26 07:36:53 cegger Exp $	*/
+/*	$NetBSD: iec13213.h,v 1.6 2014/03/28 04:09:19 htodd Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -224,7 +224,7 @@ struct csrreg *crom_search_key(struct cr
 int crom_has_specver(uint32_t *, uint32_t, uint32_t);
 
 #ifndef _KERNEL
-const char *crom_desc(struct crom_context *, char *, int);
+const char *crom_desc(struct crom_context *, char *, size_t);
 #endif
 
 /* For CROM build */



CVS commit: src/sys/dev/ieee1394

2014-03-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 28 02:16:47 UTC 2014

Modified Files:
src/sys/dev/ieee1394: fwcrom.c

Log Message:
Deal with snprintf more gracefully.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ieee1394/fwcrom.c

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



CVS commit: src/sys/dev/ieee1394

2014-03-27 Thread Hisashi T Fujinaka
Module Name:src
Committed By:   htodd
Date:   Fri Mar 28 04:09:19 UTC 2014

Modified Files:
src/sys/dev/ieee1394: iec13213.h

Log Message:
Fix build.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ieee1394/iec13213.h

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



CVS commit: src/sys/dev/ieee1394

2013-10-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 16 17:40:55 UTC 2013

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
add missing ifdefs


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/dev/ieee1394/fwohci.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/ieee1394/fwohci.c
diff -u src/sys/dev/ieee1394/fwohci.c:1.135 src/sys/dev/ieee1394/fwohci.c:1.136
--- src/sys/dev/ieee1394/fwohci.c:1.135	Thu Sep 12 16:16:51 2013
+++ src/sys/dev/ieee1394/fwohci.c	Wed Oct 16 13:40:55 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci.c,v 1.135 2013/09/12 20:16:51 martin Exp $	*/
+/*	$NetBSD: fwohci.c,v 1.136 2013/10/16 17:40:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  *
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwohci.c,v 1.135 2013/09/12 20:16:51 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwohci.c,v 1.136 2013/10/16 17:40:55 christos Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -2645,9 +2645,9 @@ fwohci_arcv_swap(struct fw_pkt *fp, int 
 {
 	struct fw_pkt *fp0;
 	uint32_t ld0;
-	int slen, hlen;
+	int hlen;
 #if BYTE_ORDER == BIG_ENDIAN
-	int i;
+	int slen, i;
 #endif
 
 	ld0 = FWOHCI_DMA_READ(fp-mode.ld[0]);
@@ -2662,7 +2662,9 @@ fwohci_arcv_swap(struct fw_pkt *fp, int 
 	case FWTCODE_WREQQ:
 	case FWTCODE_RRESQ:
 	case FWOHCITCODE_PHY:
+#if BYTE_ORDER == BIG_ENDIAN
 		slen = 12;
+#endif
 		break;
 
 	case FWTCODE_RREQB:
@@ -2670,7 +2672,9 @@ fwohci_arcv_swap(struct fw_pkt *fp, int 
 	case FWTCODE_LREQ:
 	case FWTCODE_RRESB:
 	case FWTCODE_LRES:
+#if BYTE_ORDER == BIG_ENDIAN
 		slen = 16;
+#endif
 		break;
 
 	default:



CVS commit: src/sys/dev/ieee1394

2013-10-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 16 17:40:55 UTC 2013

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
add missing ifdefs


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/dev/ieee1394/fwohci.c

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



CVS commit: src/sys/dev/ieee1394

2013-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 15 13:52:23 UTC 2013

Modified Files:
src/sys/dev/ieee1394: sbp.c

Log Message:
Remove unused variables


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ieee1394/sbp.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/ieee1394/sbp.c
diff -u src/sys/dev/ieee1394/sbp.c:1.34 src/sys/dev/ieee1394/sbp.c:1.35
--- src/sys/dev/ieee1394/sbp.c:1.34	Sun Apr 29 20:27:31 2012
+++ src/sys/dev/ieee1394/sbp.c	Sun Sep 15 13:52:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbp.c,v 1.34 2012/04/29 20:27:31 dsl Exp $	*/
+/*	$NetBSD: sbp.c,v 1.35 2013/09/15 13:52:23 martin Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sbp.c,v 1.34 2012/04/29 20:27:31 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: sbp.c,v 1.35 2013/09/15 13:52:23 martin Exp $);
 
 
 #include sys/param.h
@@ -1112,7 +1112,6 @@ static void
 sbp_mgm_callback(struct fw_xfer *xfer)
 {
 	struct sbp_dev *sdev;
-	int resp;
 
 	sdev = (struct sbp_dev *)xfer-sc;
 
@@ -1120,7 +1119,6 @@ SBP_DEBUG(1)
 	printf(%s: sbp_mgm_callback: %s\n,
 	device_xname(sdev-target-sbp-sc_fd.dev), sdev-bustgtlun);
 END_DEBUG
-	resp = xfer-resp;
 	sbp_xfer_free(xfer);
 	return;
 }
@@ -2140,12 +2138,10 @@ END_DEBUG
 static void
 sbp_target_reset(struct sbp_dev *sdev, int method)
 {
-	struct sbp_softc *sc;
 	struct sbp_target *target = sdev-target;
 	struct sbp_dev *tsdev;
 	int i;
 
-	sc = target-sbp;
 	for (i = 0; i  target-num_lun; i++) {
 		tsdev = target-luns[i];
 		if (tsdev == NULL)
@@ -2408,7 +2404,6 @@ sbp_dequeue_ocb(struct sbp_dev *sdev, st
 	struct sbp_ocb *ocb;
 	struct sbp_ocb *next;
 	int order = 0;
-	int flags;
 
 SBP_DEBUG(1)
 	printf(%s:%s:%s: 0x%08x src %d\n, device_xname(sc-sc_fd.dev),
@@ -2418,7 +2413,6 @@ END_DEBUG
 	mutex_enter(sc-sc_mtx);
 	for (ocb = STAILQ_FIRST(sdev-ocbs); ocb != NULL; ocb = next) {
 		next = STAILQ_NEXT(ocb, ocb);
-		flags = ocb-flags;
 		if (OCB_MATCH(ocb, sbp_status)) {
 			/* found */
 			SBP_ORB_DMA_SYNC(sdev-dma, ocb-index,



CVS commit: src/sys/dev/ieee1394

2013-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 15 13:52:23 UTC 2013

Modified Files:
src/sys/dev/ieee1394: sbp.c

Log Message:
Remove unused variables


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ieee1394/sbp.c

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



CVS commit: src/sys/dev/ieee1394

2013-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 12 20:16:51 UTC 2013

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
Make it compilable with gcc 4.8.1


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/dev/ieee1394/fwohci.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/ieee1394/fwohci.c
diff -u src/sys/dev/ieee1394/fwohci.c:1.134 src/sys/dev/ieee1394/fwohci.c:1.135
--- src/sys/dev/ieee1394/fwohci.c:1.134	Sun Apr  7 07:42:20 2013
+++ src/sys/dev/ieee1394/fwohci.c	Thu Sep 12 20:16:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci.c,v 1.134 2013/04/07 07:42:20 kiyohara Exp $	*/
+/*	$NetBSD: fwohci.c,v 1.135 2013/09/12 20:16:51 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  *
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwohci.c,v 1.134 2013/04/07 07:42:20 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwohci.c,v 1.135 2013/09/12 20:16:51 martin Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -919,13 +919,10 @@ fwohci_itxbuf_enable(struct firewire_com
 	struct fw_xferq *it;
 	uint32_t stat;
 	int cycle_match, cycle_now, ldesc, err = 0;
-	unsigned short tag, ich;
 
 	dbch = sc-it[dmach];
 	it = dbch-xferq;
 
-	tag = (it-flag  6)  3;
-	ich = it-flag  0x3f;
 	if ((dbch-flags  FWOHCI_DBCH_INIT) == 0) {
 		dbch-ndb = it-bnpacket * it-bnchunk;
 		dbch-ndesc = 3;
@@ -2194,7 +2191,10 @@ fwohci_tbuf_update(struct fwohci_softc *
 	struct fwohcidb *db;
 	struct fw_bulkxfer *chunk;
 	struct fw_xferq *it;
-	uint32_t stat, count;
+	uint32_t stat;
+#if 0
+	uint32_t count;
+#endif
 	int w = 0, ldesc;
 
 	it = fc-it[dmach];
@@ -2209,8 +2209,12 @@ fwohci_tbuf_update(struct fwohci_softc *
 		FWOHCI_DMA_READ(db[ldesc].db.desc.res)  OHCI_STATUS_SHIFT;
 		db = ((struct fwohcidb_tr *)(chunk-start))-db;
 		/* timestamp */
+#if 0
 		count =
 		FWOHCI_DMA_READ(db[ldesc].db.desc.res)  OHCI_COUNT_MASK;
+#else
+		(void)FWOHCI_DMA_READ(db[ldesc].db.desc.res);
+#endif
 		if (stat == 0)
 			break;
 		STAILQ_REMOVE_HEAD(it-stdma, link);
@@ -2344,8 +2348,12 @@ static void
 dump_db(struct fwohci_softc *sc, uint32_t ch)
 {
 	struct fwohci_dbch *dbch;
-	struct fwohcidb_tr *cp = NULL, *pp, *np = NULL;
-	struct fwohcidb *curr = NULL, *prev, *next = NULL;
+	struct fwohcidb_tr *cp = NULL, *pp;
+	struct fwohcidb *curr = NULL;
+#if 0
+	struct fwohcidb_tr *np = NULL;
+	struct fwohcidb *prev, *next = NULL;
+#endif
 	int idb, jdb;
 	uint32_t cmd;
 
@@ -2368,21 +2376,27 @@ dump_db(struct fwohci_softc *sc, uint32_
 		return;
 	}
 	pp = dbch-top;
+#if 0
 	prev = pp-db;
+#endif
 	for (idb = 0; idb  dbch-ndb; idb++) {
 		cp = STAILQ_NEXT(pp, link);
 		if (cp == NULL) {
 			curr = NULL;
 			goto outdb;
 		}
+#if 0
 		np = STAILQ_NEXT(cp, link);
+#endif
 		for (jdb = 0; jdb  dbch-ndesc; jdb++)
 			if ((cmd  0xfff0) == cp-bus_addr) {
 curr = cp-db;
+#if 0
 if (np != NULL)
 	next = np-db;
 else
 	next = NULL;
+#endif
 goto outdb;
 			}
 		pp = STAILQ_NEXT(pp, link);
@@ -2390,7 +2404,9 @@ dump_db(struct fwohci_softc *sc, uint32_
 			curr = NULL;
 			goto outdb;
 		}
+#if 0
 		prev = pp-db;
+#endif
 	}
 outdb:
 	if (curr != NULL) {
@@ -2486,7 +2502,7 @@ print_db(struct fwohcidb_tr *db_tr, stru
 static void
 fwohci_txbufdb(struct fwohci_softc *sc, int dmach, struct fw_bulkxfer *bulkxfer)
 {
-	struct fwohcidb_tr *db_tr, *fdb_tr;
+	struct fwohcidb_tr *db_tr /*, *fdb_tr */;
 	struct fwohci_dbch *dbch;
 	struct fwohcidb *db;
 	struct fw_pkt *fp;
@@ -2500,8 +2516,8 @@ fwohci_txbufdb(struct fwohci_softc *sc, 
 	chtag = sc-it[dmach].xferq.flag  0xff;
 
 	db_tr = (struct fwohcidb_tr *)(bulkxfer-start);
-	fdb_tr = (struct fwohcidb_tr *)(bulkxfer-end);
 /*
+	fdb_tr = (struct fwohcidb_tr *)(bulkxfer-end);
 aprint_normal(sc-fc.dev, DB %08x %08x %08x\n, bulkxfer, db_tr-bus_addr, fdb_tr-bus_addr);
 */
 	for (idb = 0; idb  dbch-xferq.bnpacket; idb++) {



CVS commit: src/sys/dev/ieee1394

2013-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 12 20:16:51 UTC 2013

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
Make it compilable with gcc 4.8.1


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/dev/ieee1394/fwohci.c

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



CVS commit: src/sys/dev/ieee1394

2013-04-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Apr  7 07:42:20 UTC 2013

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
Add '\n' to tail of printing string.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/dev/ieee1394/fwohci.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/ieee1394/fwohci.c
diff -u src/sys/dev/ieee1394/fwohci.c:1.133 src/sys/dev/ieee1394/fwohci.c:1.134
--- src/sys/dev/ieee1394/fwohci.c:1.133	Sat Aug  4 03:55:43 2012
+++ src/sys/dev/ieee1394/fwohci.c	Sun Apr  7 07:42:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci.c,v 1.133 2012/08/04 03:55:43 riastradh Exp $	*/
+/*	$NetBSD: fwohci.c,v 1.134 2013/04/07 07:42:20 kiyohara Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  *
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwohci.c,v 1.133 2012/08/04 03:55:43 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwohci.c,v 1.134 2013/04/07 07:42:20 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -448,7 +448,7 @@ fwohci_attach(struct fwohci_softc *sc)
 	sc-fc.config_rom = fwdma_alloc_setup(sc-fc.dev, sc-fc.dmat,
 	CROMSIZE, sc-crom_dma, CROMSIZE, BUS_DMA_NOWAIT);
 	if (sc-fc.config_rom == NULL) {
-		aprint_error_dev(sc-fc.dev, config_rom alloc failed.);
+		aprint_error_dev(sc-fc.dev, config_rom alloc failed.\n);
 		return ENOMEM;
 	}
 



CVS commit: src/sys/dev/ieee1394

2013-04-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Apr  7 07:42:20 UTC 2013

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
Add '\n' to tail of printing string.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/dev/ieee1394/fwohci.c

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



CVS commit: src/sys/dev/ieee1394

2012-08-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  5 02:36:16 UTC 2012

Modified Files:
src/sys/dev/ieee1394: firewire.c

Log Message:
Restore config pending stuff, adjusted to avoid the race.

Leave a note about what this code probably should look like for
anyone who comes rummaging around with the intent to really fix it.
I would do that myself if I had time and resources to test this at
the moment, and more comfort with our firewire stack, but I don't.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/ieee1394/firewire.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.40 src/sys/dev/ieee1394/firewire.c:1.41
--- src/sys/dev/ieee1394/firewire.c:1.40	Sat Aug  4 03:55:43 2012
+++ src/sys/dev/ieee1394/firewire.c	Sun Aug  5 02:36:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.40 2012/08/04 03:55:43 riastradh Exp $	*/
+/*	$NetBSD: firewire.c,v 1.41 2012/08/05 02:36:16 riastradh Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.40 2012/08/04 03:55:43 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.41 2012/08/05 02:36:16 riastradh Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -255,6 +255,9 @@ firewireattach(device_t parent, device_t
 
 	callout_schedule(fc-timeout_callout, hz);
 
+	/* Tell config we will have started a thread to scan the bus.  */
+	config_pending_incr();
+
 	/* create thread */
 	if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL, fw_bus_probe_thread,
 	fc, fc-probe_thread, fw%dprobe, device_unit(fc-bdev)))
@@ -1943,6 +1946,22 @@ fw_bus_probe_thread(void *arg)
 {
 	struct firewire_comm *fc = (struct firewire_comm *)arg;
 
+	/*
+	 * Tell config we've scanned the bus.
+	 *
+	 * XXX This is not right -- we haven't actually scanned it.  We
+	 * probably ought to call this after the first bus exploration.
+	 *
+	 * bool once = false;
+	 * ...
+	 * 	fw_attach_dev(fc);
+	 * 	if (!once) {
+	 * 		config_pending_decr();
+	 * 		once = true;
+	 * 	}
+	 */
+	config_pending_decr();
+
 	mutex_enter(fc-wait_lock);
 	while (fc-status != FWBUSDETACH) {
 		if (fc-status == FWBUSEXPLORE) {



CVS commit: src/sys/dev/ieee1394

2012-08-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  5 02:47:52 UTC 2012

Modified Files:
src/sys/dev/ieee1394: firewire.c

Log Message:
...and be sure to config_pending_decr if kthread_create fails.

This error branch looks suspect, though.  Shouldn't we bail at this
point rather than blithely try to proceed?


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/ieee1394/firewire.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.41 src/sys/dev/ieee1394/firewire.c:1.42
--- src/sys/dev/ieee1394/firewire.c:1.41	Sun Aug  5 02:36:16 2012
+++ src/sys/dev/ieee1394/firewire.c	Sun Aug  5 02:47:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.41 2012/08/05 02:36:16 riastradh Exp $	*/
+/*	$NetBSD: firewire.c,v 1.42 2012/08/05 02:47:52 riastradh Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.41 2012/08/05 02:36:16 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.42 2012/08/05 02:47:52 riastradh Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -260,8 +260,10 @@ firewireattach(device_t parent, device_t
 
 	/* create thread */
 	if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL, fw_bus_probe_thread,
-	fc, fc-probe_thread, fw%dprobe, device_unit(fc-bdev)))
+	fc, fc-probe_thread, fw%dprobe, device_unit(fc-bdev))) {
 		aprint_error_dev(self, kthread_create failed\n);
+		config_pending_decr();
+	}
 
 	devlist = malloc(sizeof(struct firewire_dev_list), M_DEVBUF, M_NOWAIT);
 	if (devlist == NULL) {



CVS commit: src/sys/dev/ieee1394

2012-08-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  5 02:36:16 UTC 2012

Modified Files:
src/sys/dev/ieee1394: firewire.c

Log Message:
Restore config pending stuff, adjusted to avoid the race.

Leave a note about what this code probably should look like for
anyone who comes rummaging around with the intent to really fix it.
I would do that myself if I had time and resources to test this at
the moment, and more comfort with our firewire stack, but I don't.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/ieee1394/firewire.c

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



CVS commit: src/sys/dev/ieee1394

2012-08-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  5 02:47:52 UTC 2012

Modified Files:
src/sys/dev/ieee1394: firewire.c

Log Message:
...and be sure to config_pending_decr if kthread_create fails.

This error branch looks suspect, though.  Shouldn't we bail at this
point rather than blithely try to proceed?


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/ieee1394/firewire.c

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



CVS commit: src/sys/dev/ieee1394

2012-04-29 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Apr 29 18:31:41 UTC 2012

Modified Files:
src/sys/dev/ieee1394: firewire.c firewirereg.h fwdev.c fwmem.c
fwohcivar.h if_fwip.c

Log Message:
Change to consistently use M_FW for all malloc/free.
It probably doesn't matter any more, but the code doesn't appear to
have matched its mallocs and frees - so the stats would have been awol.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ieee1394/firewirereg.h \
src/sys/dev/ieee1394/fwmem.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/ieee1394/fwdev.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ieee1394/fwohcivar.h
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ieee1394/if_fwip.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.38 src/sys/dev/ieee1394/firewire.c:1.39
--- src/sys/dev/ieee1394/firewire.c:1.38	Tue Sep  7 07:26:54 2010
+++ src/sys/dev/ieee1394/firewire.c	Sun Apr 29 18:31:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.38 2010/09/07 07:26:54 cegger Exp $	*/
+/*	$NetBSD: firewire.c,v 1.39 2012/04/29 18:31:40 dsl Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.38 2010/09/07 07:26:54 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.39 2012/04/29 18:31:40 dsl Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -128,7 +128,6 @@ err:
 }
 
 MALLOC_DEFINE(M_FW, ieee1394, IEEE1394);
-MALLOC_DEFINE(M_FWXFER, fw_xfer, XFER/IEEE1394);
 
 #define FW_MAXASYRTY 4
 
@@ -1139,7 +1138,7 @@ fw_rcv(struct fw_rcv_buf *rb)
 cannot respond(bus reset)!\n);
 return;
 			}
-			rb-xfer = fw_xfer_alloc(M_FWXFER);
+			rb-xfer = fw_xfer_alloc(M_FW);
 			if (rb-xfer == NULL)
 return;
 			rb-xfer-send.spd = rb-spd;
@@ -1543,7 +1542,7 @@ fw_phy_config(struct firewire_comm *fc, 
 
 	fc-status = FWBUSPHYCONF;
 
-	xfer = fw_xfer_alloc(M_FWXFER);
+	xfer = fw_xfer_alloc(M_FW);
 	if (xfer == NULL)
 		return;
 	xfer-fc = fc;
@@ -2250,7 +2249,7 @@ fw_try_bmr(void *arg)
 	struct fw_pkt *fp;
 	int err = 0;
 
-	xfer = fw_xfer_alloc_buf(M_FWXFER, 8, 4);
+	xfer = fw_xfer_alloc_buf(M_FW, 8, 4);
 	if (xfer == NULL)
 		return;
 	xfer-send.spd = 0;

Index: src/sys/dev/ieee1394/firewirereg.h
diff -u src/sys/dev/ieee1394/firewirereg.h:1.16 src/sys/dev/ieee1394/firewirereg.h:1.17
--- src/sys/dev/ieee1394/firewirereg.h:1.16	Sun Apr 24 18:52:26 2011
+++ src/sys/dev/ieee1394/firewirereg.h	Sun Apr 29 18:31:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewirereg.h,v 1.16 2011/04/24 18:52:26 rmind Exp $	*/
+/*	$NetBSD: firewirereg.h,v 1.17 2012/04/29 18:31:40 dsl Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -323,6 +323,5 @@ extern int firewire_phydma_enable;
 #include sys/mallocvar.h
 
 MALLOC_DECLARE(M_FW);
-MALLOC_DECLARE(M_FWXFER);
 
 #endif	/* _FIREWIREREG_H_ */
Index: src/sys/dev/ieee1394/fwmem.c
diff -u src/sys/dev/ieee1394/fwmem.c:1.16 src/sys/dev/ieee1394/fwmem.c:1.17
--- src/sys/dev/ieee1394/fwmem.c:1.16	Sun Jul 31 13:51:53 2011
+++ src/sys/dev/ieee1394/fwmem.c	Sun Apr 29 18:31:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwmem.c,v 1.16 2011/07/31 13:51:53 uebayasi Exp $	*/
+/*	$NetBSD: fwmem.c,v 1.17 2012/04/29 18:31:40 dsl Exp $	*/
 /*-
  * Copyright (c) 2002-2003
  * 	Hidetoshi Shimokawa. All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwmem.c,v 1.16 2011/07/31 13:51:53 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwmem.c,v 1.17 2012/04/29 18:31:40 dsl Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -155,8 +155,6 @@ sysctl_fwmem_verify_speed(SYSCTLFN_ARGS)
 	return sysctl_fwmem_verify(SYSCTLFN_CALL(rnode), 0, FWSPD_S400);
 }
 
-MALLOC_DEFINE(M_FWMEM, fwmem, fwmem/IEEE1394);
-
 #define MAXLEN (512  fwmem_speed)
 
 struct fwmem_softc {
@@ -187,7 +185,7 @@ fwmem_open(dev_t dev, int flags, int fmt
 	} else {
 		sc-si_drv1 = (void *)-1;
 		sc-si_drv1 = malloc(sizeof(struct fwmem_softc),
-		M_FWMEM, M_WAITOK);
+		M_FW, M_WAITOK);
 		if (sc-si_drv1 == NULL)
 			return ENOMEM;
 		fms = (struct fwmem_softc *)sc-si_drv1;
@@ -195,7 +193,7 @@ fwmem_open(dev_t dev, int flags, int fmt
 		fms-sc = sc;
 		fms-refcount = 1;
 		STAILQ_INIT(fms-xferlist);
-		xfer = fw_xfer_alloc(M_FWMEM);
+		xfer = fw_xfer_alloc(M_FW);
 		STAILQ_INSERT_TAIL(fms-xferlist, xfer, link);
 	}
 	if (fwmem_debug)
@@ -457,7 +455,7 @@ fwmem_xfer_req(struct fw_device *fwdev, 
 {
 	struct fw_xfer *xfer;
 
-	xfer = fw_xfer_alloc(M_FWMEM);
+	xfer = fw_xfer_alloc(M_FW);
 	if (xfer == NULL)
 		return NULL;
 

Index: src/sys/dev/ieee1394/fwdev.c
diff -u src/sys/dev/ieee1394/fwdev.c:1.26 

CVS commit: src/sys/dev/ieee1394

2012-04-29 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Apr 29 18:31:41 UTC 2012

Modified Files:
src/sys/dev/ieee1394: firewire.c firewirereg.h fwdev.c fwmem.c
fwohcivar.h if_fwip.c

Log Message:
Change to consistently use M_FW for all malloc/free.
It probably doesn't matter any more, but the code doesn't appear to
have matched its mallocs and frees - so the stats would have been awol.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ieee1394/firewirereg.h \
src/sys/dev/ieee1394/fwmem.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/ieee1394/fwdev.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ieee1394/fwohcivar.h
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ieee1394/if_fwip.c

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



CVS commit: src/sys/dev/ieee1394

2011-04-24 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Apr 24 18:52:26 UTC 2011

Modified Files:
src/sys/dev/ieee1394: firewirereg.h

Log Message:
Inclusion for malloc decls (missed in previous commit).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ieee1394/firewirereg.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/ieee1394/firewirereg.h
diff -u src/sys/dev/ieee1394/firewirereg.h:1.15 src/sys/dev/ieee1394/firewirereg.h:1.16
--- src/sys/dev/ieee1394/firewirereg.h:1.15	Sun Nov 14 15:47:20 2010
+++ src/sys/dev/ieee1394/firewirereg.h	Sun Apr 24 18:52:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewirereg.h,v 1.15 2010/11/14 15:47:20 uebayasi Exp $	*/
+/*	$NetBSD: firewirereg.h,v 1.16 2011/04/24 18:52:26 rmind Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -320,6 +320,8 @@
 #define BIO_READ B_READ
 #define BIO_WRITE B_WRITE
 
+#include sys/mallocvar.h
+
 MALLOC_DECLARE(M_FW);
 MALLOC_DECLARE(M_FWXFER);
 



CVS commit: src/sys/dev/ieee1394

2011-04-24 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Apr 24 18:52:26 UTC 2011

Modified Files:
src/sys/dev/ieee1394: firewirereg.h

Log Message:
Inclusion for malloc decls (missed in previous commit).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ieee1394/firewirereg.h

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



CVS commit: src/sys/dev/ieee1394

2010-11-14 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sun Nov 14 15:47:20 UTC 2010

Modified Files:
src/sys/dev/ieee1394: firewire.h firewirereg.h

Log Message:
Include dependencies directly.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ieee1394/firewire.h
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ieee1394/firewirereg.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/ieee1394/firewire.h
diff -u src/sys/dev/ieee1394/firewire.h:1.5 src/sys/dev/ieee1394/firewire.h:1.6
--- src/sys/dev/ieee1394/firewire.h:1.5	Mon Mar 29 03:05:27 2010
+++ src/sys/dev/ieee1394/firewire.h	Sun Nov 14 15:47:20 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.h,v 1.5 2010/03/29 03:05:27 kiyohara Exp $	*/
+/*	$NetBSD: firewire.h,v 1.6 2010/11/14 15:47:20 uebayasi Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -39,6 +39,8 @@
 #ifndef _FIREWIRE_H_
 #define _FIREWIRE_H_
 
+#include sys/ioccom.h
+
 #define	DEV_DEF  0
 #define	DEV_DV   2
 

Index: src/sys/dev/ieee1394/firewirereg.h
diff -u src/sys/dev/ieee1394/firewirereg.h:1.14 src/sys/dev/ieee1394/firewirereg.h:1.15
--- src/sys/dev/ieee1394/firewirereg.h:1.14	Tue Sep  7 07:26:54 2010
+++ src/sys/dev/ieee1394/firewirereg.h	Sun Nov 14 15:47:20 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewirereg.h,v 1.14 2010/09/07 07:26:54 cegger Exp $	*/
+/*	$NetBSD: firewirereg.h,v 1.15 2010/11/14 15:47:20 uebayasi Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -38,6 +38,7 @@
 #ifndef _FIREWIREREG_H_
 #define _FIREWIREREG_H_
 
+#include sys/selinfo.h
 #include sys/uio.h
 
 #define PROJECT_STR		The NetBSD Project



CVS commit: src/sys/dev/ieee1394

2010-11-14 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sun Nov 14 15:47:20 UTC 2010

Modified Files:
src/sys/dev/ieee1394: firewire.h firewirereg.h

Log Message:
Include dependencies directly.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ieee1394/firewire.h
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ieee1394/firewirereg.h

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



CVS commit: src/sys/dev/ieee1394

2010-09-07 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Tue Sep  7 07:19:46 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
convert tsleep to kpause


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/dev/ieee1394/fwohci.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/ieee1394/fwohci.c
diff -u src/sys/dev/ieee1394/fwohci.c:1.129 src/sys/dev/ieee1394/fwohci.c:1.130
--- src/sys/dev/ieee1394/fwohci.c:1.129	Sun Aug 29 21:15:26 2010
+++ src/sys/dev/ieee1394/fwohci.c	Tue Sep  7 07:19:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci.c,v 1.129 2010/08/29 21:15:26 cegger Exp $	*/
+/*	$NetBSD: fwohci.c,v 1.130 2010/09/07 07:19:45 cegger Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  *
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwohci.c,v 1.129 2010/08/29 21:15:26 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwohci.c,v 1.130 2010/09/07 07:19:45 cegger Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -882,13 +882,12 @@
 fwohci_irx_disable(struct firewire_comm *fc, int dmach)
 {
 	struct fwohci_softc *sc = (struct fwohci_softc *)fc;
-	int sleepch;
 
 	OWRITE(sc, OHCI_IRCTLCLR(dmach), OHCI_CNTL_DMA_RUN);
 	OWRITE(sc, OHCI_IR_MASKCLR, 1  dmach);
 	OWRITE(sc, OHCI_IR_STATCLR, 1  dmach);
 	/* XXX we cannot free buffers until the DMA really stops */
-	tsleep((void *)sleepch, FWPRI, fwirxd, hz);
+	kpause(fwirxd, true, hz, NULL);
 	fwohci_db_free(sc, sc-ir[dmach]);
 	sc-ir[dmach].xferq.flag = ~FWXFERQ_RUNNING;
 	return 0;
@@ -1016,14 +1015,13 @@
 fwohci_itx_disable(struct firewire_comm *fc, int dmach)
 {
 	struct fwohci_softc *sc = (struct fwohci_softc *)fc;
-	int sleepch;
 
 	OWRITE(sc, OHCI_ITCTLCLR(dmach),
 	OHCI_CNTL_DMA_RUN | OHCI_CNTL_CYCMATCH_S);
 	OWRITE(sc, OHCI_IT_MASKCLR, 1  dmach);
 	OWRITE(sc, OHCI_IT_STATCLR, 1  dmach);
 	/* XXX we cannot free buffers until the DMA really stops */
-	tsleep((void *)sleepch, FWPRI, fwitxd, hz);
+	kpause(fwitxd, true, hz, NULL);
 	fwohci_db_free(sc, sc-it[dmach]);
 	sc-it[dmach].xferq.flag = ~FWXFERQ_RUNNING;
 	return 0;



CVS commit: src/sys/dev/ieee1394

2010-09-07 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Tue Sep  7 07:26:54 UTC 2010

Modified Files:
src/sys/dev/ieee1394: firewire.c firewirereg.h

Log Message:
do not assume all fw devices speak sbp.
teach the fw attach code to deal with different fw device classes.
this allows other fw drivers than sbp to attach


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ieee1394/firewirereg.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.37 src/sys/dev/ieee1394/firewire.c:1.38
--- src/sys/dev/ieee1394/firewire.c:1.37	Thu Aug 26 08:56:15 2010
+++ src/sys/dev/ieee1394/firewire.c	Tue Sep  7 07:26:54 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.37 2010/08/26 08:56:15 cegger Exp $	*/
+/*	$NetBSD: firewire.c,v 1.38 2010/09/07 07:26:54 cegger Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.37 2010/08/26 08:56:15 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.38 2010/09/07 07:26:54 cegger Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -1959,6 +1959,45 @@
 	/* NOTREACHED */
 }
 
+static const char *
+fw_get_devclass(struct fw_device *fwdev)
+{
+	struct crom_context cc;
+	struct csrreg *reg;
+
+	crom_init_context(cc, fwdev-csrrom);
+	reg = crom_search_key(cc, CSRKEY_VER);
+	if (reg == NULL)
+		return null;
+
+	switch (reg-val) {
+	case CSR_PROTAVC:
+		return av/c;
+	case CSR_PROTCAL:
+		return cal;
+	case CSR_PROTEHS:
+		return ehs;
+	case CSR_PROTHAVI:
+		return havi;
+	case CSR_PROTCAM104:
+		return cam104;
+	case CSR_PROTCAM120:
+		return cam120;
+	case CSR_PROTCAM130:
+		return cam130;
+	case CSR_PROTDPP:
+		return printer;
+	case CSR_PROTIICP:
+		return iicp;
+	case CSRVAL_T10SBP2:
+		return sbp;
+	default:
+		if (firewire_debug)
+			printf(%s: reg-val 0x%x\n,
+__func__, reg-val);
+		return sbp;
+	}
+}
 
 /*
  * To attach sub-devices layer onto IEEE1394 bus.
@@ -1973,7 +2012,7 @@
 	struct fw_attach_args fwa;
 	int locs[IEEE1394IFCF_NLOCS];
 
-	fwa.name = sbp;
+	fwa.name = null;
 	fwa.fc = fc;
 
 	mutex_enter(fc-fc_mtx);
@@ -1993,16 +2032,17 @@
 			locs[IEEE1394IFCF_EUIHI] = fwdev-eui.hi;
 			locs[IEEE1394IFCF_EUILO] = fwdev-eui.lo;
 
+			fwa.name = fw_get_devclass(fwdev);
 			fwa.fwdev = fwdev;
-			fwdev-sbp = config_found_sm_loc(sc-dev, ieee1394if,
+			fwdev-dev = config_found_sm_loc(sc-dev, ieee1394if,
 			locs, fwa, firewire_print, config_stdsubmatch);
-			if (fwdev-sbp == NULL) {
+			if (fwdev-dev == NULL) {
 free(devlist, M_DEVBUF);
 break;
 			}
 
 			devlist-fwdev = fwdev;
-			devlist-dev = fwdev-sbp;
+			devlist-dev = fwdev-dev;
 
 			mutex_enter(fc-fc_mtx);
 			if (SLIST_EMPTY(sc-devlist))
@@ -2064,7 +2104,7 @@
 			link);
 			free(devlist, M_DEVBUF);
 
-			if (config_detach(fwdev-sbp, DETACH_FORCE) != 0)
+			if (config_detach(fwdev-dev, DETACH_FORCE) != 0)
 return;
 
 			STAILQ_REMOVE(fc-devices, fwdev, fw_device, link);

Index: src/sys/dev/ieee1394/firewirereg.h
diff -u src/sys/dev/ieee1394/firewirereg.h:1.13 src/sys/dev/ieee1394/firewirereg.h:1.14
--- src/sys/dev/ieee1394/firewirereg.h:1.13	Sun May 23 18:56:58 2010
+++ src/sys/dev/ieee1394/firewirereg.h	Tue Sep  7 07:26:54 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewirereg.h,v 1.13 2010/05/23 18:56:58 christos Exp $	*/
+/*	$NetBSD: firewirereg.h,v 1.14 2010/09/07 07:26:54 cegger Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -63,7 +63,7 @@
 #define FWDEVATTACHED	2
 #define FWDEVINVAL	3
 	STAILQ_ENTRY(fw_device) link;
-	device_t sbp;
+	device_t dev;
 };
 
 struct firewire_softc {



CVS commit: src/sys/dev/ieee1394

2010-09-07 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Tue Sep  7 07:26:54 UTC 2010

Modified Files:
src/sys/dev/ieee1394: firewire.c firewirereg.h

Log Message:
do not assume all fw devices speak sbp.
teach the fw attach code to deal with different fw device classes.
this allows other fw drivers than sbp to attach


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ieee1394/firewirereg.h

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



Converting to condvar(9) [Was: Re: CVS commit: src/sys/dev/ieee1394]

2010-09-05 Thread Mindaugas Rasiukevicius
Christoph Egger christoph_eg...@gmx.de wrote:
  Log Message:
  don't call tsleep() with any mutexes hold
 
 
  To generate a diff of this commit:
  cvs rdiff -u -r1.23 -r1.24 src/sys/dev/ieee1394/fwdev.c
  
  The right fix would be to use condvar(9).  Generally, tsleep(9) should
  be replaced and removed in the longer term.
 
 Sure. Two questions hold me back from doing this:
 1. Which cv_*wait* variant should be used?
 2. Where should I add the corresponding cv_signal/cv_broadcast ?
 
 Is it possible to have an conversion example in the tsleep(9) manpage?

OK, some notes.  The ltsleep(9)/tsleep(9)/mtsleep(9) and wakeup(9) pairs
should generally be replaced by cv_wait*(9) and cv_broadcast(9) pairs, as
the former API is obsolete.

It depends which cv_wait*(9) variant to use.  Simplistic way - look at the
corresponding ltsleep(9) usage.  There are two arguments of interest: timo
and priority.  The priority value may have ORed such flags: PNORELOCK and
PCATCH.  The PCATCH means that blocking thread should be awoken on signal,
which would be done by cv_wait_sig(9).  The timo value, if it is not zero,
indicates how long to sleep - replace it with cv_timedwait(9).  If both
specified, there is cv_timedwait_sig(9), and if none - there is cv_wait(9).
Interlock (mutex) must be held across cv_wait*/cv_broadcast calls, in order
to protect our state. Which means that some old code might require amending
(to remove PNORELOCK or replace simple_lock(9) use) or addition of locking.

That is simplistic, because converting should not be done mechanically
i.e. blindly.  Code logic should be understood before changing, and it
may also need to be revisited for the change.  Please also read condvar(9)
and ltsleep(9) manual pages - all the details are well described there.

-- 
Mindaugas


Re: CVS commit: src/sys/dev/ieee1394

2010-08-31 Thread Christoph Egger
On 26.08.10 16:31, Mindaugas Rasiukevicius wrote:
 Module Name:src
 Committed By:   cegger
 Date:   Thu Aug 26 12:48:19 UTC 2010

 Modified Files:
 src/sys/dev/ieee1394: fwdev.c

 Log Message:
 don't call tsleep() with any mutexes hold


 To generate a diff of this commit:
 cvs rdiff -u -r1.23 -r1.24 src/sys/dev/ieee1394/fwdev.c
 
 The right fix would be to use condvar(9).  Generally, tsleep(9) should
 be replaced and removed in the longer term.

Sure. Two questions hold me back from doing this:
1. Which cv_*wait* variant should be used?
2. Where should I add the corresponding cv_signal/cv_broadcast ?

Is it possible to have an conversion example in the tsleep(9) manpage?

Christoph


CVS commit: src/sys/dev/ieee1394

2010-08-29 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Sun Aug 29 21:14:16 UTC 2010

Modified Files:
src/sys/dev/ieee1394: sbp.h

Log Message:
Confilict - Conflict


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ieee1394/sbp.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/ieee1394/sbp.h
diff -u src/sys/dev/ieee1394/sbp.h:1.5 src/sys/dev/ieee1394/sbp.h:1.6
--- src/sys/dev/ieee1394/sbp.h:1.5	Thu Apr 29 06:51:26 2010
+++ src/sys/dev/ieee1394/sbp.h	Sun Aug 29 21:14:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbp.h,v 1.5 2010/04/29 06:51:26 kiyohara Exp $	*/
+/*	$NetBSD: sbp.h,v 1.6 2010/08/29 21:14:16 cegger Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -147,7 +147,7 @@
 /* 6: Busy retry limit exceeded: ack_busy_B */
 /* 7-A: Reserved for future standardization */
 /* B: Tardy retry limit exceeded */
-/* C: Confilict error */
+/* C: Conflict error */
 /* D: Data error */
 /* E: Type error */
 /* F: Address error */



CVS commit: src/sys/dev/ieee1394

2010-08-29 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Sun Aug 29 21:15:26 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
fix grammar in error message


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/dev/ieee1394/fwohci.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/ieee1394/fwohci.c
diff -u src/sys/dev/ieee1394/fwohci.c:1.128 src/sys/dev/ieee1394/fwohci.c:1.129
--- src/sys/dev/ieee1394/fwohci.c:1.128	Sun May 23 18:56:58 2010
+++ src/sys/dev/ieee1394/fwohci.c	Sun Aug 29 21:15:26 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci.c,v 1.128 2010/05/23 18:56:58 christos Exp $	*/
+/*	$NetBSD: fwohci.c,v 1.129 2010/08/29 21:15:26 cegger Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  *
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwohci.c,v 1.128 2010/05/23 18:56:58 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwohci.c,v 1.129 2010/08/29 21:15:26 cegger Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -2104,7 +2104,7 @@
 #endif
 			OWRITE(sc, FWOHCI_INTMASKCLR, OHCI_INT_CYC_LOST);
 			aprint_error_dev(fc-dev, too many cycle lost, 
-			no cycle master presents?\n);
+			no cycle master present?\n);
 		}
 	}
 	if (stat  OHCI_INT_DMA_ATRQ)



CVS commit: src/sys/dev/ieee1394

2010-08-29 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Sun Aug 29 21:14:16 UTC 2010

Modified Files:
src/sys/dev/ieee1394: sbp.h

Log Message:
Confilict - Conflict


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ieee1394/sbp.h

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



CVS commit: src/sys/dev/ieee1394

2010-08-29 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Sun Aug 29 21:15:26 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
fix grammar in error message


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/dev/ieee1394/fwohci.c

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



Re: CVS commit: src/sys/dev/ieee1394

2010-08-26 Thread Mindaugas Rasiukevicius
 Module Name:src
 Committed By:   cegger
 Date:   Thu Aug 26 12:48:19 UTC 2010
 
 Modified Files:
 src/sys/dev/ieee1394: fwdev.c
 
 Log Message:
 don't call tsleep() with any mutexes hold
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.23 -r1.24 src/sys/dev/ieee1394/fwdev.c

The right fix would be to use condvar(9).  Generally, tsleep(9) should
be replaced and removed in the longer term.

-- 
Mindaugas


CVS commit: src/sys/dev/ieee1394

2010-08-26 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Thu Aug 26 07:36:53 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwcrom.c iec13213.h

Log Message:
- print expected crc when it does not match
- add and print secondary text leaf. This prints the model name of my webcam.
- add csr keys that are printed as 'unknown' otherwise


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ieee1394/fwcrom.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ieee1394/iec13213.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/ieee1394/fwcrom.c
diff -u src/sys/dev/ieee1394/fwcrom.c:1.12 src/sys/dev/ieee1394/fwcrom.c:1.13
--- src/sys/dev/ieee1394/fwcrom.c:1.12	Sat Apr 24 21:34:29 2010
+++ src/sys/dev/ieee1394/fwcrom.c	Thu Aug 26 07:36:53 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwcrom.c,v 1.12 2010/04/24 21:34:29 cegger Exp $	*/
+/*	$NetBSD: fwcrom.c,v 1.13 2010/08/26 07:36:53 cegger Exp $	*/
 /*-
  * Copyright (c) 2002-2003
  * 	Hidetoshi Shimokawa. All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1.12 2010/04/24 21:34:29 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1.13 2010/08/26 07:36:53 cegger Exp $);
 
 #include sys/param.h
 #ifdef _KERNEL
@@ -178,10 +178,16 @@
 		return;
 
 	reg = crom_get(cc);
-	if (reg-key != CROM_TEXTLEAF ||
-	(char *)(reg + reg-val)  CROM_END(cc)) {
-		strncpy(buf, nullstr, len);
-		return;
+	switch (reg-key) {
+	case CROM_TEXTLEAF:
+	case CROM_TEXTLEAF2:
+		break;
+	default:
+		if ((char *)(reg + reg-val)  CROM_END(cc)) {
+			strncpy(buf, nullstr, len);
+			return;
+		}
+		break;
 	}
 	textleaf = (struct csrtext *)(reg + reg-val);
 
@@ -288,7 +294,7 @@
 	switch (reg-key  CSRTYPE_MASK) {
 	case CSRTYPE_I:
 #if 0
-		len -= snprintf(buf, len, %d, reg-val);
+		len -= snprintf(buf, len, 0x%x, reg-val);
 		buf += strlen(buf);
 #else
 		*buf = '\0';
@@ -304,33 +310,43 @@
 	case CSRTYPE_D:
 		dir = (struct csrdirectory *) (reg + reg-val);
 		crc = crom_crc((uint32_t *)dir-entry, dir-crc_len);
-		len -= snprintf(buf, len, len=%d crc=0x%04x(%s) ,
-		dir-crc_len, dir-crc, (crc == dir-crc) ? OK : NG);
+		len -= snprintf(buf, len, len=%d crc=0x%04x ,
+		dir-crc_len, crc);
+		buf += strlen(buf);
+
+		if (crc == dir-crc)
+			len -= snprintf(buf, len, (OK) );
+		else
+			len -= snprintf(buf, len, (NG, 0x%x) ,
+			dir-crc);
 		buf += strlen(buf);
 	}
 	switch (reg-key) {
-	case 0x03:
+	case CSRKEY_VENDOR: /* 0x03 */
 		desc = module_vendor_ID;
 		break;
-	case 0x04:
+	case CSRKEY_HW: /* 0x04 */
 		desc = hardware_version;
 		break;
-	case 0x0c:
+	case CSRKEY_NCAP: /* 0x0c */
 		desc = node_capabilities;
 		break;
-	case 0x12:
+	case CSRKEY_SPEC: /* 0x12 */
 		desc = unit_spec_ID;
 		break;
-	case 0x13:
+	case CSRKEY_VER: /* 0x13 */
 		desc = unit_sw_version;
 		crom_desc_specver(0, reg-val, buf, len);
 		break;
-	case 0x14:
+	case CSRKEY_DINFO: /* 0x14 */
 		desc = logical_unit_number;
 		break;
-	case 0x17:
+	case CSRKEY_MODEL: /* 0x17 */
 		desc = model_ID;
 		break;
+	case CSRKEY_REV: /* 0x21 */
+		desc = revision_ID;
+		break;
 	case 0x38:
 		desc = command_set_spec_ID;
 		break;
@@ -349,13 +365,20 @@
 	case 0x3d:
 		desc = reconnect_timeout;
 		break;
+	case 0x40:
+		desc = command_regs_base;
+		break;
 	case 0x54:
 		desc = management_agent;
 		break;
-	case 0x81:
+	case CROM_TEXTLEAF: /* 0x81 */
+	case CROM_TEXTLEAF2: /* 0x82 */
 		desc = text_leaf;
 		crom_parse_text(cc, buf + strlen(buf), len);
 		break;
+	case CROM_NODEID: /* 0x8d */
+		desc = node_unique_ID;
+		break;
 	case 0xd1:
 		desc = unit_directory;
 		break;

Index: src/sys/dev/ieee1394/iec13213.h
diff -u src/sys/dev/ieee1394/iec13213.h:1.4 src/sys/dev/ieee1394/iec13213.h:1.5
--- src/sys/dev/ieee1394/iec13213.h:1.4	Mon Mar 29 03:05:28 2010
+++ src/sys/dev/ieee1394/iec13213.h	Thu Aug 26 07:36:53 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: iec13213.h,v 1.4 2010/03/29 03:05:28 kiyohara Exp $	*/
+/*	$NetBSD: iec13213.h,v 1.5 2010/08/26 07:36:53 cegger Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -105,8 +105,10 @@
 
 #define CROM_UDIR	(CSRTYPE_D | CSRKEY_UNIT)  /* 0x81 Unit directory */
 #define CROM_TEXTLEAF	(CSRTYPE_L | CSRKEY_DESC)  /* 0x81 Text leaf */
+#define CROM_TEXTLEAF2	(CSRTYPE_L | CSRKEY_BDINFO)/* 0x82 Text leaf2 */
 #define CROM_LUN	(CSRTYPE_I | CSRKEY_DINFO) /* 0x14 Logical unit num. */
 #define CROM_MGM	(CSRTYPE_C | CSRKEY_DINFO) /* 0x54 Management agent */
+#define CROM_NODEID	0x8d /* only valid for IEEE 1394-1995 digital camera */
 
 #define CSRVAL_VENDOR_PRIVATE	0xacde48
 #define CSRVAL_1394TA	0x00a02d



CVS commit: src/sys/dev/ieee1394

2010-08-26 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Thu Aug 26 08:56:16 UTC 2010

Modified Files:
src/sys/dev/ieee1394: firewire.c

Log Message:
fix crash when detaching/re-attaching a cable where three firewire devices are 
on the bus.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ieee1394/firewire.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.36 src/sys/dev/ieee1394/firewire.c:1.37
--- src/sys/dev/ieee1394/firewire.c:1.36	Sat Aug 14 18:28:59 2010
+++ src/sys/dev/ieee1394/firewire.c	Thu Aug 26 08:56:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.36 2010/08/14 18:28:59 jym Exp $	*/
+/*	$NetBSD: firewire.c,v 1.37 2010/08/26 08:56:15 cegger Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.36 2010/08/14 18:28:59 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.37 2010/08/26 08:56:15 cegger Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -2053,6 +2053,10 @@
 			SLIST_FOREACH(devlist, sc-devlist, link)
 if (devlist-fwdev == fwdev)
 	break;
+
+			if (devlist == NULL)
+continue;
+
 			if (devlist-fwdev != fwdev)
 panic(already detached);
 



CVS commit: src/sys/dev/ieee1394

2010-08-26 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Thu Aug 26 07:36:53 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwcrom.c iec13213.h

Log Message:
- print expected crc when it does not match
- add and print secondary text leaf. This prints the model name of my webcam.
- add csr keys that are printed as 'unknown' otherwise


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ieee1394/fwcrom.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ieee1394/iec13213.h

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



CVS commit: src/sys/dev/ieee1394

2010-08-26 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Thu Aug 26 12:48:19 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwdev.c

Log Message:
don't call tsleep() with any mutexes hold


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/ieee1394/fwdev.c

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



CVS commit: src/sys/dev/ieee1394

2010-08-16 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Mon Aug 16 06:05:07 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwdev.c

Log Message:
do not hold mutexes when calling tsleep(9).
Fixes LOCKDEBUG panics


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ieee1394/fwdev.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/ieee1394/fwdev.c
diff -u src/sys/dev/ieee1394/fwdev.c:1.22 src/sys/dev/ieee1394/fwdev.c:1.23
--- src/sys/dev/ieee1394/fwdev.c:1.22	Sun May 23 18:56:58 2010
+++ src/sys/dev/ieee1394/fwdev.c	Mon Aug 16 06:05:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwdev.c,v 1.22 2010/05/23 18:56:58 christos Exp $	*/
+/*	$NetBSD: fwdev.c,v 1.23 2010/08/16 06:05:07 cegger Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwdev.c,v 1.22 2010/05/23 18:56:58 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwdev.c,v 1.23 2010/08/16 06:05:07 cegger Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -248,7 +248,9 @@
 		if (slept == 0) {
 			slept = 1;
 			ir-flag |= FWXFERQ_WAKEUP;
+			mutex_exit(fc-fc_mtx);
 			err = tsleep(ir, FWPRI, fw_read, hz);
+			mutex_enter(fc-fc_mtx);
 			ir-flag = ~FWXFERQ_WAKEUP;
 			if (err == 0)
 goto readloop;
@@ -324,7 +326,9 @@
 			if (err)
 goto out;
 #endif
+			mutex_exit(fc-fc_mtx);
 			err = tsleep(it, FWPRI, fw_write, hz);
+			mutex_enter(fc-fc_mtx);
 			if (err)
 goto out;
 			goto isoloop;



CVS commit: src/sys/dev/ieee1394

2010-08-16 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Mon Aug 16 06:05:07 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwdev.c

Log Message:
do not hold mutexes when calling tsleep(9).
Fixes LOCKDEBUG panics


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ieee1394/fwdev.c

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



CVS commit: src/sys/dev/ieee1394

2010-08-14 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Sat Aug 14 10:39:36 UTC 2010

Modified Files:
src/sys/dev/ieee1394: sbp.c

Log Message:
Fix sbp attach/detach.
When plugging a firewire webcam, sbp attaches.
sbpattach() calls sbp_alloc_target().
In sbp_alloc_target, crom_search_key() fails and sbp_alloc_target() returns 
NULL.
Move mutex and list initializations up in sbpattach() and in sbp_alloc_target()
so that destroyal of them through sbpdetach() does not cause
LOCKDEBUG panics when unplugging the firewire webcam.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ieee1394/sbp.c

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



Re: CVS commit: src/sys/dev/ieee1394

2010-05-25 Thread Jun Ebihara
Hello Christos!

From: chris...@zoulas.com (Christos Zoulas)
Subject: Re: CVS commit: src/sys/dev/ieee1394
Date: Mon, 24 May 2010 10:36:49 -0400

 | In many cases, there is a case that cannot be fixed in several days.  For
 | instance, MIPS cannot be booted since merge mips64.
 This is not also not acceptable it has pissed off everyone owning a MIPS box
 who cannot boot current. If I had a MIPS box and could test this, I would
 have reverted the MIPS changes too. (Hi Matt!).

You can test with gxemul.

cd /usr/pkgsrc/emulators/gxemul
make package
gxemul -e mobilepro770 -X -M 512 hpcmipskernel/netbsd20091130  ... boot OK
gxemul -e mobilepro770 -X -M 512 hpcmipskernel/netbsd20091231  ... boot FAIL

see more information;
http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=42934

--
jun ebihara


Re: CVS commit: src/sys/dev/ieee1394

2010-05-25 Thread Christos Zoulas
On May 25,  4:33pm, j...@soum.co.jp (Jun Ebihara) wrote:
-- Subject: Re: CVS commit: src/sys/dev/ieee1394

| Hello Christos!
| 
| From: chris...@zoulas.com (Christos Zoulas)
| Subject: Re: CVS commit: src/sys/dev/ieee1394
| Date: Mon, 24 May 2010 10:36:49 -0400
| 
|  | In many cases, there is a case that cannot be fixed in several days.  For
|  | instance, MIPS cannot be booted since merge mips64.
|  This is not also not acceptable it has pissed off everyone owning a MIPS box
|  who cannot boot current. If I had a MIPS box and could test this, I would
|  have reverted the MIPS changes too. (Hi Matt!).
| 
| You can test with gxemul.
| 
| cd /usr/pkgsrc/emulators/gxemul
| make package
| gxemul -e mobilepro770 -X -M 512 hpcmipskernel/netbsd20091130  ... boot OK
| gxemul -e mobilepro770 -X -M 512 hpcmipskernel/netbsd20091231  ... boot FAIL
| 
| see more information;
| http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=42934

Good idea!

christos


Re: CVS commit: src/sys/dev/ieee1394

2010-05-25 Thread Mindaugas Rasiukevicius
chris...@zoulas.com (Christos Zoulas) wrote:
 | Yes. It knows I was broken, too. However, it worked on my ofppc and
 | it booted my amd64.
 
 Try booting with DIAGNOSTIC. If you make any changes to the kernel you
 should be really compiling with DIAGNOSTIC.

It should be tested both with DEBUG and DIAGNOSTIC enabled.  If involves
locking, then also LOCKDEBUG.

-- 
Mindaugas


Re: CVS commit: src/sys/dev/ieee1394

2010-05-24 Thread Christos Zoulas
On May 24,  2:23pm, kiyoh...@kk.iij4u.or.jp (KIYOHARA Takashi) wrote:
-- Subject: Re: CVS commit: src/sys/dev/ieee1394

| Hi! Christos,
| 
| 
| From: Christos Zoulas chris...@netbsd.org
| Date: Sun, 23 May 2010 14:56:59 -0400
| 
|  Module Name:src
|  Committed By:   christos
|  Date:   Sun May 23 18:56:59 UTC 2010
|  
|  Modified Files:
|  src/sys/dev/ieee1394: firewire.c firewirereg.h fwdev.c fwdma.c fwmem.c
|  fwohci.c fwohcivar.h if_fwip.c sbp.c
|  
|  Log Message:
|  Revert all previous kmem_ commits. This needs to be done in a different way
|  because we cannot call kmem_ from an interrupt context. I opened PR/43341 
for
|  it.
| 
| Why you revert it all?
| I had been investigating the problem of kmem since last week.  Was not
| I reading the message from you?

It is all in CVS, none of the changes are lost so I don't see the
problem.  If you sent mail saying that you were working on it and
when you expected to have it fixed, sorry I missed it. The code
has been broken since the 15th, so I thought I should do something.

christos


Re: CVS commit: src/sys/dev/ieee1394

2010-05-24 Thread Izumi Tsutsui
 Why you revert it all?

Wasn't it broken?

 I had been investigating the problem of kmem since last week.  Was not

There is no reason to leave kernels broken even if
you have some idea for proper fixes.
You can put them even after you (or other guys) revert
the previous changes, can't you?
---
Izumi Tsutsui


Re: CVS commit: src/sys/dev/ieee1394

2010-05-24 Thread KIYOHARA Takashi
Hi!


From: Izumi Tsutsui tsut...@ceres.dti.ne.jp
Date: Mon, 24 May 2010 22:08:21 +0900

  Why you revert it all?
 
 Wasn't it broken?

Yes. It knows I was broken, too. However, it worked on my ofppc and
it booted my amd64.


  I had been investigating the problem of kmem since last week.  Was not
 
 There is no reason to leave kernels broken even if
 you have some idea for proper fixes.

In many cases, there is a case that cannot be fixed in several days.  For
instance, MIPS cannot be booted since merge mips64.

Thanks,
--
kiyohara


Re: CVS commit: src/sys/dev/ieee1394

2010-05-24 Thread Izumi Tsutsui
 In many cases, there is a case that cannot be fixed in several days.  For

In any case you should revert your changes first
if you know you broke the tree and you can't fix it soon.
---
Izumi Tsutsui


Re: CVS commit: src/sys/dev/ieee1394

2010-05-24 Thread Christos Zoulas
On May 24, 10:32pm, kiyoh...@kk.iij4u.or.jp (KIYOHARA Takashi) wrote:
-- Subject: Re: CVS commit: src/sys/dev/ieee1394

| Hi!
| 
| 
| From: Izumi Tsutsui tsut...@ceres.dti.ne.jp
| Date: Mon, 24 May 2010 22:08:21 +0900
| 
|   Why you revert it all?
|  
|  Wasn't it broken?
| 
| Yes. It knows I was broken, too. However, it worked on my ofppc and
| it booted my amd64.

Try booting with DIAGNOSTIC. If you make any changes to the kernel you should
be really compiling with DIAGNOSTIC.

|   I had been investigating the problem of kmem since last week.  Was not
|  
|  There is no reason to leave kernels broken even if
|  you have some idea for proper fixes.
| 
| In many cases, there is a case that cannot be fixed in several days.  For
| instance, MIPS cannot be booted since merge mips64.

This is not also not acceptable it has pissed off everyone owning a MIPS box
who cannot boot current. If I had a MIPS box and could test this, I would
have reverted the MIPS changes too. (Hi Matt!).

I just want to highlight that this is not personal and it does not matter
who makes the changes. If you break HEAD and you leave it broken for days,
without communicating status, consider your changes a candidate for backout.

I want to also stress that I tried to fix the firewire code; I fixed two
issues already, and then I saw that it would require a lot of reworking
to fix the xfer code. I filed a PR, and I backed out the changes because
in my judgement there is no quick and easy fix for it. Prove me wrong
and commit today or tomorrow a change that works.

christos


Re: CVS commit: src/sys/dev/ieee1394

2010-05-23 Thread KIYOHARA Takashi
Hi! Christos,


From: Christos Zoulas chris...@netbsd.org
Date: Sun, 23 May 2010 14:56:59 -0400

 Module Name:  src
 Committed By: christos
 Date: Sun May 23 18:56:59 UTC 2010
 
 Modified Files:
   src/sys/dev/ieee1394: firewire.c firewirereg.h fwdev.c fwdma.c fwmem.c
   fwohci.c fwohcivar.h if_fwip.c sbp.c
 
 Log Message:
 Revert all previous kmem_ commits. This needs to be done in a different way
 because we cannot call kmem_ from an interrupt context. I opened PR/43341 for
 it.

Why you revert it all?
I had been investigating the problem of kmem since last week.  Was not
I reading the message from you?

Thanks,
--
kiyohara


CVS commit: src/sys/dev/ieee1394

2010-05-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 23 02:24:40 UTC 2010

Modified Files:
src/sys/dev/ieee1394: firewire.c firewirereg.h

Log Message:
don't allocate rom scratch memory from an interrupt context:

fwohci0: BUS reset
panic: kernel diagnostic assertion !cpu_intr_p() failed: file ../../../../ker
n/subr_kmem.c, line 195
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip 8022db1d cs 8 rflags 246 cr2  0 cpl 6 rsp fff
f80fafb08
breakpoint() at netbsd:breakpoint+0x5
panic() at netbsd:panic+0x2ba
kern_assert() at netbsd:kern_assert+0x2d
kmem_alloc() at netbsd:kmem_alloc+0x18a
kmem_zalloc() at netbsd:kmem_zalloc+0xf
fw_busreset() at netbsd:fw_busreset+0x23b
fwohci_intr() at netbsd:fwohci_intr+0xa56
...


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ieee1394/firewirereg.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.33 src/sys/dev/ieee1394/firewire.c:1.34
--- src/sys/dev/ieee1394/firewire.c:1.33	Sat May 15 06:42:51 2010
+++ src/sys/dev/ieee1394/firewire.c	Sat May 22 22:24:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.33 2010/05/15 10:42:51 kiyohara Exp $	*/
+/*	$NetBSD: firewire.c,v 1.34 2010/05/23 02:24:40 christos Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.33 2010/05/15 10:42:51 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.34 2010/05/23 02:24:40 christos Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -548,7 +548,6 @@
 	struct firewire_dev_list *devlist;
 	struct firewire_dev_comm *fdc;
 	struct crom_src *src;
-	uint32_t *newrom;
 
 	if (fc-status == FWBUSMGRELECT)
 		callout_stop(fc-bmr_callout);
@@ -583,15 +582,13 @@
 	 * Configuration ROM.
 	 */
 #define FW_MAX_GENERATION	0xF
-	newrom = kmem_zalloc(CROMSIZE, KM_NOSLEEP);
 	src = fc-crom_src_buf-src;
-	crom_load(src, newrom, CROMSIZE);
-	if (memcmp(newrom, fc-config_rom, CROMSIZE) != 0) {
+	crom_load(src, fc-new_rom, CROMSIZE);
+	if (memcmp(fc-new_rom, fc-config_rom, CROMSIZE) != 0) {
 		if (src-businfo.generation++  FW_MAX_GENERATION)
 			src-businfo.generation = FW_GENERATION_CHANGEABLE;
-		memcpy((void *)fc-config_rom, newrom, CROMSIZE);
+		memcpy(fc-config_rom, fc-new_rom, CROMSIZE);
 	}
-	kmem_free(newrom, CROMSIZE);
 }
 
 /* Call once after reboot */

Index: src/sys/dev/ieee1394/firewirereg.h
diff -u src/sys/dev/ieee1394/firewirereg.h:1.11 src/sys/dev/ieee1394/firewirereg.h:1.12
--- src/sys/dev/ieee1394/firewirereg.h:1.11	Sun Mar 28 23:05:27 2010
+++ src/sys/dev/ieee1394/firewirereg.h	Sat May 22 22:24:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewirereg.h,v 1.11 2010/03/29 03:05:27 kiyohara Exp $	*/
+/*	$NetBSD: firewirereg.h,v 1.12 2010/05/23 02:24:40 christos Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -141,6 +141,7 @@
 	uint32_t csr_arc[CSRSIZE/4];
 #define CROMSIZE 0x400
 	uint32_t *config_rom;
+	uint32_t *new_rom;
 	struct crom_src_buf *crom_src_buf;
 	struct crom_src *crom_src;
 	struct crom_chunk *crom_root;



CVS commit: src/sys/dev/ieee1394

2010-05-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 23 02:24:40 UTC 2010

Modified Files:
src/sys/dev/ieee1394: firewire.c firewirereg.h

Log Message:
don't allocate rom scratch memory from an interrupt context:

fwohci0: BUS reset
panic: kernel diagnostic assertion !cpu_intr_p() failed: file ../../../../ker
n/subr_kmem.c, line 195
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip 8022db1d cs 8 rflags 246 cr2  0 cpl 6 rsp fff
f80fafb08
breakpoint() at netbsd:breakpoint+0x5
panic() at netbsd:panic+0x2ba
kern_assert() at netbsd:kern_assert+0x2d
kmem_alloc() at netbsd:kmem_alloc+0x18a
kmem_zalloc() at netbsd:kmem_zalloc+0xf
fw_busreset() at netbsd:fw_busreset+0x23b
fwohci_intr() at netbsd:fwohci_intr+0xa56
...


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ieee1394/firewirereg.h

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



CVS commit: src/sys/dev/ieee1394

2010-05-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 23 02:25:50 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwohci.c fwohcivar.h

Log Message:
Don't allocate sid scratch memory from an interrupt context:

fwohci0: BUS reset
fwohci0: node_id=0xc800ffc0, gen=1, CYCLEMASTER mode
panic: kernel diagnostic assertion !cpu_intr_p() failed: file ../../../../ker
n/subr_kmem.c, line 195
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip 8022db1d cs 8 rflags 246 cr2  0 cpl 6 rsp fff
f80fafb68
breakpoint() at netbsd:breakpoint+0x5
panic() at netbsd:panic+0x2ba
kern_assert() at netbsd:kern_assert+0x2d
kmem_alloc() at netbsd:kmem_alloc+0x18a
fwohci_intr() at netbsd:fwohci_intr+0xbe2
...

I will send-pr for the next one... Looks like someone did not use DIAGNOSTIC
when made the changes.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/dev/ieee1394/fwohci.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ieee1394/fwohcivar.h

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



CVS commit: src/sys/dev/ieee1394

2010-05-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat May 15 10:42:51 UTC 2010

Modified Files:
src/sys/dev/ieee1394: firewire.c

Log Message:
Add mutex.h.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ieee1394/firewire.c

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



CVS commit: src/sys/dev/ieee1394

2010-05-14 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Fri May 14 12:10:07 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwdev.c

Log Message:
Use kmem(9) instead of malloc(9).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ieee1394/fwdev.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/ieee1394/fwdev.c
diff -u src/sys/dev/ieee1394/fwdev.c:1.20 src/sys/dev/ieee1394/fwdev.c:1.21
--- src/sys/dev/ieee1394/fwdev.c:1.20	Mon May 10 12:17:32 2010
+++ src/sys/dev/ieee1394/fwdev.c	Fri May 14 12:10:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwdev.c,v 1.20 2010/05/10 12:17:32 kiyohara Exp $	*/
+/*	$NetBSD: fwdev.c,v 1.21 2010/05/14 12:10:07 kiyohara Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwdev.c,v 1.20 2010/05/10 12:17:32 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwdev.c,v 1.21 2010/05/14 12:10:07 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -654,7 +654,7 @@
 		err = copyout(ptr, crom_buf-ptr, len);
 		if (fwdev == NULL)
 			/* myself */
-			free(ptr, M_FW);
+			kmem_free(ptr, CROMSIZE);
 		break;
 
 	default:



CVS commit: src/sys/dev/ieee1394

2010-05-14 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Fri May 14 12:25:19 UTC 2010

Modified Files:
src/sys/dev/ieee1394: firewire.c

Log Message:
May be easy to understand 'pay_len  0' more than 'paylaod != NULL'.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ieee1394/firewire.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.31 src/sys/dev/ieee1394/firewire.c:1.32
--- src/sys/dev/ieee1394/firewire.c:1.31	Mon May 10 12:17:32 2010
+++ src/sys/dev/ieee1394/firewire.c	Fri May 14 12:25:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.31 2010/05/10 12:17:32 kiyohara Exp $	*/
+/*	$NetBSD: firewire.c,v 1.32 2010/05/14 12:25:19 kiyohara Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.31 2010/05/10 12:17:32 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.32 2010/05/14 12:25:19 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -920,9 +920,9 @@
 		return;
 	}
 	fw_xfer_unload(xfer);
-	if (xfer-send.payload != NULL)
+	if (xfer-send.pay_len  0)
 		kmem_free(xfer-send.payload, xfer-send.pay_len);
-	if (xfer-recv.payload != NULL)
+	if (xfer-recv.pay_len  0)
 		kmem_free(xfer-recv.payload, xfer-recv.pay_len);
 	cv_destroy(xfer-cv);
 	kmem_free(xfer, sizeof(struct fw_xfer));



CVS commit: src/sys/dev/ieee1394

2010-05-14 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Fri May 14 12:10:07 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwdev.c

Log Message:
Use kmem(9) instead of malloc(9).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ieee1394/fwdev.c

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



CVS commit: src/sys/dev/ieee1394

2010-05-10 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon May 10 12:17:33 UTC 2010

Modified Files:
src/sys/dev/ieee1394: firewire.c fwdev.c fwdma.c fwmem.c fwohci.c
if_fwip.c sbp.c

Log Message:
Use kmem(9) instead of malloc(9).


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ieee1394/firewire.c \
src/sys/dev/ieee1394/sbp.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ieee1394/fwdev.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ieee1394/fwdma.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ieee1394/fwmem.c
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/ieee1394/fwohci.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ieee1394/if_fwip.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.30 src/sys/dev/ieee1394/firewire.c:1.31
--- src/sys/dev/ieee1394/firewire.c:1.30	Tue Apr  6 10:45:15 2010
+++ src/sys/dev/ieee1394/firewire.c	Mon May 10 12:17:32 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.30 2010/04/06 10:45:15 reinoud Exp $	*/
+/*	$NetBSD: firewire.c,v 1.31 2010/05/10 12:17:32 kiyohara Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.30 2010/04/06 10:45:15 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: firewire.c,v 1.31 2010/05/10 12:17:32 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -48,7 +48,7 @@
 #include sys/errno.h
 #include sys/kernel.h
 #include sys/kthread.h
-#include sys/malloc.h
+#include sys/kmem.h
 #include sys/queue.h
 #include sys/sysctl.h
 #include sys/systm.h
@@ -217,28 +217,24 @@
 	if (fc-nisodma  FWMAXNDMA)
 	fc-nisodma = FWMAXNDMA;
 
-	fc-crom_src_buf =
-	(struct crom_src_buf *)malloc(sizeof(struct crom_src_buf),
-	M_FW, M_NOWAIT | M_ZERO);
+	fc-crom_src_buf = kmem_zalloc(sizeof(struct crom_src_buf), KM_NOSLEEP);
 	if (fc-crom_src_buf == NULL) {
-		aprint_error_dev(fc-bdev, Malloc Failure crom src buff\n);
+		aprint_error_dev(fc-bdev,
+		kmem alloc failure crom src buff\n);
 		return;
 	}
 	fc-topology_map =
-	(struct fw_topology_map *)malloc(sizeof(struct fw_topology_map),
-	M_FW, M_NOWAIT | M_ZERO);
+	kmem_zalloc(sizeof(struct fw_topology_map), KM_NOSLEEP);
 	if (fc-topology_map == NULL) {
 		aprint_error_dev(fc-dev, Malloc Failure topology map\n);
-		free(fc-crom_src_buf, M_FW);
+		kmem_free(fc-crom_src_buf, sizeof(struct crom_src_buf));
 		return;
 	}
-	fc-speed_map =
-	(struct fw_speed_map *)malloc(sizeof(struct fw_speed_map),
-	M_FW, M_NOWAIT | M_ZERO);
+	fc-speed_map = kmem_zalloc(sizeof(struct fw_speed_map), KM_NOSLEEP);
 	if (fc-speed_map == NULL) {
 		aprint_error_dev(fc-dev, Malloc Failure speed map\n);
-		free(fc-crom_src_buf, M_FW);
-		free(fc-topology_map, M_FW);
+		kmem_free(fc-crom_src_buf, sizeof(struct crom_src_buf));
+		kmem_free(fc-topology_map, sizeof(struct fw_topology_map));
 		return;
 	}
 
@@ -262,7 +258,7 @@
 		aprint_error_dev(self, kthread_create failed\n);
 	config_pending_incr();
 
-	devlist = malloc(sizeof(struct firewire_dev_list), M_DEVBUF, M_NOWAIT);
+	devlist = kmem_alloc(sizeof(struct firewire_dev_list), KM_NOSLEEP);
 	if (devlist == NULL) {
 		aprint_error_dev(self, device list allocation failed\n);
 		return;
@@ -273,7 +269,7 @@
 	faa.fwdev = NULL;
 	devlist-dev = config_found(sc-dev, faa, firewire_print);
 	if (devlist-dev == NULL)
-		free(devlist, M_DEVBUF);
+		kmem_free(devlist, sizeof(struct firewire_dev_list));
 	else
 		SLIST_INSERT_HEAD(sc-devlist, devlist, link);
 
@@ -315,7 +311,7 @@
 		if ((err = config_detach(devlist-dev, flags)) != 0)
 			return err;
 		SLIST_REMOVE(sc-devlist, devlist, firewire_dev_list, link);
-		free(devlist, M_DEVBUF);
+		kmem_free(devlist, sizeof(struct firewire_dev_list));
 	}
 
 	callout_stop(fc-timeout_callout);
@@ -326,11 +322,11 @@
 	for (fwdev = STAILQ_FIRST(fc-devices); fwdev != NULL;
 	fwdev = fwdev_next) {
 		fwdev_next = STAILQ_NEXT(fwdev, link);
-		free(fwdev, M_FW);
+		kmem_free(fwdev, sizeof(struct fw_device));
 	}
-	free(fc-topology_map, M_FW);
-	free(fc-speed_map, M_FW);
-	free(fc-crom_src_buf, M_FW);
+	kmem_free(fc-topology_map, sizeof(struct fw_topology_map));
+	kmem_free(fc-speed_map, sizeof(struct fw_speed_map));
+	kmem_free(fc-crom_src_buf, sizeof(struct crom_src_buf));
 
 	cv_destroy(fc-fc_cv);
 	mutex_destroy(fc-wait_lock);
@@ -586,7 +582,7 @@
 	 * Configuration ROM.
 	 */
 #define FW_MAX_GENERATION	0xF
-	newrom = malloc(CROMSIZE, M_FW, M_NOWAIT | M_ZERO);
+	newrom = kmem_zalloc(CROMSIZE, KM_NOSLEEP);
 	src = fc-crom_src_buf-src;
 	crom_load(src, newrom, CROMSIZE);
 	if (memcmp(newrom, fc-config_rom, CROMSIZE) != 0) {
@@ -594,7 +590,7 @@
 			src-businfo.generation = FW_GENERATION_CHANGEABLE;
 		memcpy((void *)fc-config_rom, newrom, CROMSIZE);
 	}
-	free(newrom, M_FW);
+	

Re: CVS commit: src/sys/dev/ieee1394

2010-04-29 Thread Adam Hoka
On Thu, 29 Apr 2010 06:56:00 +
KIYOHARA Takashi kiyoh...@netbsd.org wrote:

 Module Name:  src
 Committed By: kiyohara
 Date: Thu Apr 29 06:56:00 UTC 2010
 
 Modified Files:
   src/sys/dev/ieee1394: fwdma.c
 
 Log Message:
 Call malloc(M_ZERO) instead of malloc() and memset().

Why not kmem_zalloc()?


-- 
NetBSD - Simplicity is prerequisite for reliability


Re: CVS commit: src/sys/dev/ieee1394

2010-04-29 Thread KIYOHARA Takashi
Hi!


From: Adam Hoka adam.h...@gmail.com
Date: Thu, 29 Apr 2010 09:38:31 +0200

 On Thu, 29 Apr 2010 06:56:00 +
 KIYOHARA Takashi kiyoh...@netbsd.org wrote:
 
  Module Name:src
  Committed By:   kiyohara
  Date:   Thu Apr 29 06:56:00 UTC 2010
  
  Modified Files:
  src/sys/dev/ieee1394: fwdma.c
  
  Log Message:
  Call malloc(M_ZERO) instead of malloc() and memset().
 
 Why not kmem_zalloc()?

Oops, I learnt kmem(9) just now.
Also malloc(9) says 'These interfaces are being obsoleted and their new
use is discouraged.' in man-page.

Please wait a few days.  ;-)

Thanks,
--
kiyohara


CVS commit: src/sys/dev/ieee1394

2010-04-29 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Thu Apr 29 06:51:26 UTC 2010

Modified Files:
src/sys/dev/ieee1394: sbp.c sbp.h

Log Message:
+ Use structs scsipi_inquiry_data/scsi_sense_data instead of scsi3_inquiry_data/
  scsi3_sense_data.
+ s/switch()/switch ()/.
+ Change args for printf().  (FUNCNAME ...) - (%s ...\n, __func__, ...)
+ Indent.
+ Remove unnecessary cast.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ieee1394/sbp.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ieee1394/sbp.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/ieee1394/sbp.c
diff -u src/sys/dev/ieee1394/sbp.c:1.29 src/sys/dev/ieee1394/sbp.c:1.30
--- src/sys/dev/ieee1394/sbp.c:1.29	Mon Mar 29 03:05:28 2010
+++ src/sys/dev/ieee1394/sbp.c	Thu Apr 29 06:51:26 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbp.c,v 1.29 2010/03/29 03:05:28 kiyohara Exp $	*/
+/*	$NetBSD: sbp.c,v 1.30 2010/04/29 06:51:26 kiyohara Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sbp.c,v 1.29 2010/03/29 03:05:28 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: sbp.c,v 1.30 2010/04/29 06:51:26 kiyohara Exp $);
 
 
 #include sys/param.h
@@ -92,10 +92,10 @@
  * 48-64(16): bus_id, node_id
  */
 #define SBP_BIND_HI 0x1
-#define SBP_DEV2ADDR(u, l) \
-	(((u_int64_t)SBP_BIND_HI  32) \
-	| (((u)  0x3fff)  10) \
-	| (((l)  0xff)  2))
+#define SBP_DEV2ADDR(u, l)		 \
+	(((uint64_t)SBP_BIND_HI  32)	|\
+	 (((u)  0x3fff)  10)		|\
+	 (((l)  0xff)  2))
 #define SBP_ADDR2UNIT(a)	(((a)  10)  0x3fff)
 #define SBP_ADDR2LUN(a)		(((a)  2)  0xff)
 #define SBP_INITIATOR 7
@@ -937,7 +937,7 @@
 	int i;
 
 SBP_DEBUG(1)
-	printf(sbp_probe_target %d\n, target-target_id);
+	printf(%s %d\n, __func__, target-target_id);
 END_DEBUG
 
 	sbp_alloc_lun(target);
@@ -1484,7 +1484,7 @@
 	ocb-flags = OCB_ACT_MGM;
 	ocb-sdev = sdev;
 
-	memset((void *)ocb-orb, 0, sizeof(ocb-orb));
+	memset(ocb-orb, 0, sizeof(ocb-orb));
 	ocb-orb[6] = htonl((nid  16) | SBP_BIND_HI);
 	ocb-orb[7] = htonl(SBP_DEV2ADDR(dv_unit, sdev-lun_id));
 
@@ -1579,8 +1579,7 @@
 sbp_scsi_status(struct sbp_status *sbp_status, struct sbp_ocb *ocb)
 {
 	struct sbp_cmd_status *sbp_cmd_status;
-	scsi3_sense_data_t sense =
-	(scsi3_sense_data_t)ocb-xs-sense.scsi_sense;
+	struct scsi_sense_data *sense = ocb-xs-sense.scsi_sense;
 
 	sbp_cmd_status = (struct sbp_cmd_status *)sbp_status-data;
 
@@ -1608,7 +1607,7 @@
 		else
 			sense-response_code = SSD_RCODE_DEFERRED;
 		if (sbp_cmd_status-valid)
-			sense-response_code |= SSD_RESPONSE_CODE_VALID;
+			sense-response_code |= SSD_RCODE_VALID;
 		sense-flags = sbp_cmd_status-s_key;
 		if (sbp_cmd_status-mark)
 			sense-flags |= SSD_FILEMARK;
@@ -1617,25 +1616,25 @@
 		if (sbp_cmd_status-ill_len)
 			sense-flags |= SSD_ILI;
 
-		memcpy(sense-information, sbp_cmd_status-info, 4);
+		memcpy(sense-info, sbp_cmd_status-info, 4);
 
 		if (sbp_status-len = 1)
 			/* XXX not scsi status. shouldn't be happened */
-			sense-asl = 0;
+			sense-extra_len = 0;
 		else if (sbp_status-len = 4)
 			/* add_sense_code(_qual), info, cmd_spec_info */
-			sense-asl = 6;
+			sense-extra_len = 6;
 		else
 			/* fru, sense_key_spec */
-			sense-asl = 10;
+			sense-extra_len = 10;
 
 		memcpy(sense-csi, sbp_cmd_status-cdb, 4);
 
 		sense-asc = sbp_cmd_status-s_code;
 		sense-ascq = sbp_cmd_status-s_qlfr;
-		sense-fruc = sbp_cmd_status-fru;
+		sense-fru = sbp_cmd_status-fru;
 
-		memcpy(sense-sks, sbp_cmd_status-s_keydep, 3);
+		memcpy(sense-sks.sks_bytes, sbp_cmd_status-s_keydep, 3);
 		ocb-xs-error = XS_SENSE;
 		ocb-xs-xs_status = sbp_cmd_status-status;
 /*
@@ -1663,7 +1662,8 @@
 {
 	struct scsipi_xfer *xs = ocb-xs;
 	struct sbp_dev *sdev;
-	scsi3_inquiry_data_t inq = (scsi3_inquiry_data_t)xs-data;
+	struct scsipi_inquiry_data *inq =
+	(struct scsipi_inquiry_data *)xs-data;
 
 	sdev = ocb-sdev;
 
@@ -1709,9 +1709,9 @@
 	 * XXX CAM also checks SCP_QUEUE_DQUE flag in the control mode page.
 	 */
 	if (sbp_tags  0)
-		inq-flags[1] |= SID_CmdQue;
+		inq-flags3 |= SID_CmdQue;
 	else if (sbp_tags  0)
-		inq-flags[1] = ~SID_CmdQue;
+		inq-flags3 = ~SID_CmdQue;
 
 }
 
@@ -1818,7 +1818,7 @@
 END_DEBUG
 		printf(%s:%s\n, device_xname(sc-sc_fd.dev), sdev-bustgtlun);
 		status = sbp_status-status;
-		switch(sbp_status-resp) {
+		switch (sbp_status-resp) {
 		case SBP_REQ_CMP:
 			if (status  MAX_ORB_STATUS0)
 printf(%s\n, orb_status0[MAX_ORB_STATUS0]);
@@ -1853,17 +1853,17 @@
 	if (ocb == NULL)
 		goto done;
 
-	switch(ntohl(ocb-orb[4])  ORB_FMT_MSK) {
+	switch (ntohl(ocb-orb[4])  ORB_FMT_MSK) {
 	case ORB_FMT_NOP:
 		break;
 	case ORB_FMT_VED:
 		break;
 	case ORB_FMT_STD:
-		switch(ocb-flags) {
+		switch (ocb-flags) {
 		case OCB_ACT_MGM:
 			orb_fun = ntohl(ocb-orb[4])  ORB_FUN_MSK;
 			reset_agent = 0;
-			switch(orb_fun) {
+			

CVS commit: src/sys/dev/ieee1394

2010-04-29 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Thu Apr 29 06:53:13 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
+ Fix typo.
+ Call aprint_error_dev() instead of aprint_error().


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/dev/ieee1394/fwohci.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/ieee1394/fwohci.c
diff -u src/sys/dev/ieee1394/fwohci.c:1.124 src/sys/dev/ieee1394/fwohci.c:1.125
--- src/sys/dev/ieee1394/fwohci.c:1.124	Mon Apr 19 07:00:58 2010
+++ src/sys/dev/ieee1394/fwohci.c	Thu Apr 29 06:53:13 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci.c,v 1.124 2010/04/19 07:00:58 kiyohara Exp $	*/
+/*	$NetBSD: fwohci.c,v 1.125 2010/04/29 06:53:13 kiyohara Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  *
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwohci.c,v 1.124 2010/04/19 07:00:58 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwohci.c,v 1.125 2010/04/29 06:53:13 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -2010,7 +2010,7 @@
 			/* allow from all nodes */
 			OWRITE(sc, OHCI_PREQHI, 0x7fff);
 			OWRITE(sc, OHCI_PREQLO, 0x);
-			/* 0 to 4GB regison */
+			/* 0 to 4GB region */
 			OWRITE(sc, OHCI_PREQUPPER, 0x1);
 		}
 		/* Set ATRetries register */
@@ -2027,7 +2027,7 @@
 		aprint_normal_dev(fc-dev, node_id=0x%08x, gen=%d, ,
 		node_id, (plen  16)  0xff);
 		if (!(node_id  OHCI_NODE_VALID)) {
-			aprint_error(Bus reset failure\n);
+			aprint_error_dev(fc-dev, Bus reset failure\n);
 			goto sidout;
 		}
 



CVS commit: src/sys/dev/ieee1394

2010-04-29 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Thu Apr 29 06:53:49 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwdev.c

Log Message:
Remove unnecessary cast.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ieee1394/fwdev.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/ieee1394/fwdev.c
diff -u src/sys/dev/ieee1394/fwdev.c:1.18 src/sys/dev/ieee1394/fwdev.c:1.19
--- src/sys/dev/ieee1394/fwdev.c:1.18	Mon Mar 29 03:05:27 2010
+++ src/sys/dev/ieee1394/fwdev.c	Thu Apr 29 06:53:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwdev.c,v 1.18 2010/03/29 03:05:27 kiyohara Exp $	*/
+/*	$NetBSD: fwdev.c,v 1.19 2010/04/29 06:53:48 kiyohara Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwdev.c,v 1.18 2010/03/29 03:05:27 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwdev.c,v 1.19 2010/04/29 06:53:48 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -511,10 +511,10 @@
 			break;
 		}
 
-		memcpy((void *)xfer-send.hdr, fp, tinfo-hdr_len);
+		memcpy(xfer-send.hdr, fp, tinfo-hdr_len);
 		if (pay_len  0)
-			memcpy((void *)xfer-send.payload,
-			(char *)fp + tinfo-hdr_len, pay_len);
+			memcpy(xfer-send.payload, (char *)fp + tinfo-hdr_len,
+			pay_len);
 		xfer-send.spd = asyreq-req.sped;
 		xfer-hand = fw_xferwake;
 



CVS commit: src/sys/dev/ieee1394

2010-04-29 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Thu Apr 29 06:56:00 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwdma.c

Log Message:
Call malloc(M_ZERO) instead of malloc() and memset().


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ieee1394/fwdma.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/ieee1394/fwdma.c
diff -u src/sys/dev/ieee1394/fwdma.c:1.13 src/sys/dev/ieee1394/fwdma.c:1.14
--- src/sys/dev/ieee1394/fwdma.c:1.13	Mon Mar 29 03:05:27 2010
+++ src/sys/dev/ieee1394/fwdma.c	Thu Apr 29 06:56:00 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwdma.c,v 1.13 2010/03/29 03:05:27 kiyohara Exp $	*/
+/*	$NetBSD: fwdma.c,v 1.14 2010/04/29 06:56:00 kiyohara Exp $	*/
 /*-
  * Copyright (c) 2003
  * 	Hidetoshi Shimokawa. All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwdma.c,v 1.13 2010/03/29 03:05:27 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwdma.c,v 1.14 2010/04/29 06:56:00 kiyohara Exp $);
 #if defined(__FreeBSD__)
 __FBSDID($FreeBSD: src/sys/dev/firewire/fwdma.c,v 1.9 2007/06/06 14:31:36 simokawa Exp $);
 #endif
@@ -141,7 +141,8 @@
 	struct fwdma_alloc_multi *am;
 	struct fwdma_seg *seg;
 	bus_size_t ssize;
-	int nseg, size;
+	size_t size;
+	int nseg;
 
 	if (esize  PAGE_SIZE) {
 		/* round up to PAGE_SIZE */
@@ -154,12 +155,11 @@
 	}
 	size = sizeof(struct fwdma_alloc_multi) +
 	sizeof(struct fwdma_seg) * nseg;
-	am = (struct fwdma_alloc_multi *)malloc(size, M_FW, M_WAITOK);
+	am = (struct fwdma_alloc_multi *)malloc(size, M_FW, M_WAITOK | M_ZERO);
 	if (am == NULL) {
 		aprint_error_dev(fc-dev, malloc failed\n);
 		return NULL;
 	}
-	memset(am, 0, size);
 	am-ssize = ssize;
 	am-esize = esize;
 	am-nseg = 0;



CVS commit: src/sys/dev/ieee1394

2010-04-29 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Thu Apr 29 06:51:26 UTC 2010

Modified Files:
src/sys/dev/ieee1394: sbp.c sbp.h

Log Message:
+ Use structs scsipi_inquiry_data/scsi_sense_data instead of scsi3_inquiry_data/
  scsi3_sense_data.
+ s/switch()/switch ()/.
+ Change args for printf().  (FUNCNAME ...) - (%s ...\n, __func__, ...)
+ Indent.
+ Remove unnecessary cast.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ieee1394/sbp.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ieee1394/sbp.h

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



CVS commit: src/sys/dev/ieee1394

2010-04-29 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Thu Apr 29 06:53:13 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
+ Fix typo.
+ Call aprint_error_dev() instead of aprint_error().


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/dev/ieee1394/fwohci.c

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



CVS commit: src/sys/dev/ieee1394

2010-04-24 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Sat Apr 24 21:34:29 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwcrom.c

Log Message:
ANSIfy, KNF


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ieee1394/fwcrom.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/ieee1394/fwcrom.c
diff -u src/sys/dev/ieee1394/fwcrom.c:1.11 src/sys/dev/ieee1394/fwcrom.c:1.12
--- src/sys/dev/ieee1394/fwcrom.c:1.11	Mon Mar 29 03:05:27 2010
+++ src/sys/dev/ieee1394/fwcrom.c	Sat Apr 24 21:34:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwcrom.c,v 1.11 2010/03/29 03:05:27 kiyohara Exp $	*/
+/*	$NetBSD: fwcrom.c,v 1.12 2010/04/24 21:34:29 cegger Exp $	*/
 /*-
  * Copyright (c) 2002-2003
  * 	Hidetoshi Shimokawa. All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1.11 2010/03/29 03:05:27 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwcrom.c,v 1.12 2010/04/24 21:34:29 cegger Exp $);
 
 #include sys/param.h
 #ifdef _KERNEL
@@ -524,7 +524,8 @@
 
 #ifdef TEST
 int
-main () {
+main(void)
+{
 	struct crom_src src;
 	struct crom_chunk root, unit1, unit2, unit3;
 	struct crom_chunk text1, text2, text3, text4, text5, text6, text7;



  1   2   >