CVS commit: src/sys/arch/i386/pci

2022-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 22 11:38:12 UTC 2022

Modified Files:
src/sys/arch/i386/pci: glxsb.c

Log Message:
glxsb(4): Prune dead branches.  Assert session id validity.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/pci/glxsb.c

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

Modified files:

Index: src/sys/arch/i386/pci/glxsb.c
diff -u src/sys/arch/i386/pci/glxsb.c:1.17 src/sys/arch/i386/pci/glxsb.c:1.18
--- src/sys/arch/i386/pci/glxsb.c:1.17	Sun May 22 11:35:21 2022
+++ src/sys/arch/i386/pci/glxsb.c	Sun May 22 11:38:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: glxsb.c,v 1.17 2022/05/22 11:35:21 riastradh Exp $	*/
+/*	$NetBSD: glxsb.c,v 1.18 2022/05/22 11:38:12 riastradh Exp $	*/
 /* $OpenBSD: glxsb.c,v 1.7 2007/02/12 14:31:45 tom Exp $ */
 
 /*
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.17 2022/05/22 11:35:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.18 2022/05/22 11:38:12 riastradh Exp $");
 
 #include 
 #include 
@@ -314,8 +314,7 @@ glxsb_crypto_newsession(void *aux, uint3
 	struct glxsb_session *ses = NULL;
 	int sesn;
 
-	if (sc == NULL || sidp == NULL || cri == NULL ||
-	cri->cri_next != NULL || cri->cri_alg != CRYPTO_AES_CBC ||
+	if (cri->cri_next != NULL || cri->cri_alg != CRYPTO_AES_CBC ||
 	cri->cri_klen != 128)
 		return (EINVAL);
 
@@ -360,11 +359,10 @@ glxsb_crypto_freesession(void *aux, uint
 	int sesn;
 	uint32_t sid = ((uint32_t)tid) & 0x;
 
-	if (sc == NULL)
-		return (EINVAL);
 	sesn = GLXSB_SESSION(sid);
-	if (sesn >= sc->sc_nsessions)
-		return (EINVAL);
+	KASSERTMSG(sesn < sc->sc_nsessions, "sesn=%d nsessions=%d",
+	sesn, sc->sc_nsessions);
+
 	memset(>sc_sessions[sesn], 0, sizeof(sc->sc_sessions[sesn]));
 	return (0);
 }



CVS commit: src/sys/arch/i386/pci

2022-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 22 11:38:12 UTC 2022

Modified Files:
src/sys/arch/i386/pci: glxsb.c

Log Message:
glxsb(4): Prune dead branches.  Assert session id validity.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/pci/glxsb.c

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



CVS commit: src/sys/arch/i386/pci

2022-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 22 11:35:21 UTC 2022

Modified Files:
src/sys/arch/i386/pci: glxsb.c

Log Message:
glxsb(4): Return zero, not error, if we've issued crypto_done.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/pci/glxsb.c

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

Modified files:

Index: src/sys/arch/i386/pci/glxsb.c
diff -u src/sys/arch/i386/pci/glxsb.c:1.16 src/sys/arch/i386/pci/glxsb.c:1.17
--- src/sys/arch/i386/pci/glxsb.c:1.16	Mon Jun 29 23:32:24 2020
+++ src/sys/arch/i386/pci/glxsb.c	Sun May 22 11:35:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: glxsb.c,v 1.16 2020/06/29 23:32:24 riastradh Exp $	*/
+/*	$NetBSD: glxsb.c,v 1.17 2022/05/22 11:35:21 riastradh Exp $	*/
 /* $OpenBSD: glxsb.c,v 1.7 2007/02/12 14:31:45 tom Exp $ */
 
 /*
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.16 2020/06/29 23:32:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.17 2022/05/22 11:35:21 riastradh Exp $");
 
 #include 
 #include 
@@ -581,7 +581,7 @@ out:
 	crp->crp_etype = err;
 	crypto_done(crp);
 	splx(s);
-	return (err);
+	return 0;
 }
 
 int



CVS commit: src/sys/arch/i386/pci

2022-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 22 11:35:21 UTC 2022

Modified Files:
src/sys/arch/i386/pci: glxsb.c

Log Message:
glxsb(4): Return zero, not error, if we've issued crypto_done.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/pci/glxsb.c

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



CVS commit: src/sys/arch/i386/pci

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:19:11 UTC 2020

Modified Files:
src/sys/arch/i386/pci: glxsb.c

Log Message:
glxsb(4): Don't use prev msg's last block as IV for next msg in CBC.

This violates the security contract of the CBC construction, which
requires that the IV be unpredictable in advance; an adaptive adversary
can exploit this to verify plaintext guesses.

XXX Compile-tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/pci/glxsb.c

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



CVS commit: src/sys/arch/i386/pci

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:19:11 UTC 2020

Modified Files:
src/sys/arch/i386/pci: glxsb.c

Log Message:
glxsb(4): Don't use prev msg's last block as IV for next msg in CBC.

This violates the security contract of the CBC construction, which
requires that the IV be unpredictable in advance; an adaptive adversary
can exploit this to verify plaintext guesses.

XXX Compile-tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/pci/glxsb.c

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

Modified files:

Index: src/sys/arch/i386/pci/glxsb.c
diff -u src/sys/arch/i386/pci/glxsb.c:1.14 src/sys/arch/i386/pci/glxsb.c:1.15
--- src/sys/arch/i386/pci/glxsb.c:1.14	Thu Jul 14 10:19:05 2016
+++ src/sys/arch/i386/pci/glxsb.c	Sun Jun 14 23:19:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: glxsb.c,v 1.14 2016/07/14 10:19:05 msaitoh Exp $	*/
+/*	$NetBSD: glxsb.c,v 1.15 2020/06/14 23:19:11 riastradh Exp $	*/
 /* $OpenBSD: glxsb.c,v 1.7 2007/02/12 14:31:45 tom Exp $ */
 
 /*
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.14 2016/07/14 10:19:05 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.15 2020/06/14 23:19:11 riastradh Exp $");
 
 #include 
 #include 
@@ -149,7 +149,6 @@ struct glxsb_dma_map {
 };
 struct glxsb_session {
 	uint32_t	ses_key[4];
-	uint8_t		ses_iv[SB_AES_BLOCK_SIZE];
 	int		ses_klen;
 	int		ses_used;
 };
@@ -346,7 +345,6 @@ glxsb_crypto_newsession(void *aux, uint3
 	memset(ses, 0, sizeof(*ses));
 	ses->ses_used = 1;
 
-	cprng_fast(ses->ses_iv, sizeof(ses->ses_iv));
 	ses->ses_klen = cri->cri_klen;
 
 	/* Copy the key (Geode LX wants the primary key only) */
@@ -450,7 +448,7 @@ glxsb_crypto_process(void *aux, struct c
 	struct cryptodesc *crd;
 	char *op_src, *op_dst;
 	uint32_t op_psrc, op_pdst;
-	uint8_t op_iv[SB_AES_BLOCK_SIZE], *piv;
+	uint8_t op_iv[SB_AES_BLOCK_SIZE];
 	int sesn, err = 0;
 	int len, tlen, xlen;
 	int offset;
@@ -497,7 +495,7 @@ glxsb_crypto_process(void *aux, struct c
 		if (crd->crd_flags & CRD_F_IV_EXPLICIT)
 			memcpy(op_iv, crd->crd_iv, sizeof(op_iv));
 		else
-			memcpy(op_iv, ses->ses_iv, sizeof(op_iv));
+			cprng_fast(op_iv, sizeof(op_iv));
 
 		if ((crd->crd_flags & CRD_F_IV_PRESENT) == 0) {
 			if (crp->crp_flags & CRYPTO_F_IMBUF)
@@ -530,7 +528,6 @@ glxsb_crypto_process(void *aux, struct c
 
 	offset = 0;
 	tlen = crd->crd_len;
-	piv = op_iv;
 
 	/* Process the data in GLXSB_MAX_AES_LEN chunks */
 	while (tlen > 0) {
@@ -566,25 +563,13 @@ glxsb_crypto_process(void *aux, struct c
 		offset += len;
 		tlen -= len;
 
-		if (tlen <= 0) {	/* Ideally, just == 0 */
-			/* Finished - put the IV in session IV */
-			piv = ses->ses_iv;
-		}
-
-		/*
-		 * Copy out last block for use as next iteration/session IV.
-		 *
-		 * piv is set to op_iv[] before the loop starts, but is
-		 * set to ses->ses_iv if we're going to exit the loop this
-		 * time.
-		 */
 		if (crd->crd_flags & CRD_F_ENCRYPT) {
-			memcpy(piv, op_dst + len - sizeof(op_iv),
+			memcpy(op_iv, op_dst + len - sizeof(op_iv),
 			sizeof(op_iv));
 		} else {
 			/* Decryption, only need this if another iteration */
 			if (tlen > 0) {
-memcpy(piv, op_src + len - sizeof(op_iv),
+memcpy(op_iv, op_src + len - sizeof(op_iv),
 sizeof(op_iv));
 			}
 		}



CVS commit: src/sys/arch/i386/pci

2019-10-18 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Oct 18 15:00:15 UTC 2019

Modified Files:
src/sys/arch/i386/pci: piixpcib.c

Log Message:
Add missing include -- kernel ALL/i386 compiles.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/pci/piixpcib.c

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

Modified files:

Index: src/sys/arch/i386/pci/piixpcib.c
diff -u src/sys/arch/i386/pci/piixpcib.c:1.23 src/sys/arch/i386/pci/piixpcib.c:1.24
--- src/sys/arch/i386/pci/piixpcib.c:1.23	Fri Oct 18 01:00:25 2019
+++ src/sys/arch/i386/pci/piixpcib.c	Fri Oct 18 15:00:15 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpcib.c,v 1.23 2019/10/18 01:00:25 manu Exp $ */
+/* $NetBSD: piixpcib.c,v 1.24 2019/10/18 15:00:15 hannken Exp $ */
 
 /*-
  * Copyright (c) 2004, 2006 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: piixpcib.c,v 1.23 2019/10/18 01:00:25 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpcib.c,v 1.24 2019/10/18 15:00:15 hannken Exp $");
 
 #include 
 #include 
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: piixpcib.c,v
 
 #include 
 #include 
+#include 
 
 #include 
 #include 



CVS commit: src/sys/arch/i386/pci

2019-10-18 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Oct 18 15:00:15 UTC 2019

Modified Files:
src/sys/arch/i386/pci: piixpcib.c

Log Message:
Add missing include -- kernel ALL/i386 compiles.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/pci/piixpcib.c

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



CVS commit: src/sys/arch/i386/pci

2015-04-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Apr 13 16:21:54 UTC 2015

Modified Files:
src/sys/arch/i386/pci: glxsb.c

Log Message:
Need sys/rndsource.h, not sys/cprng.h, for rnd source stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/pci/glxsb.c

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



CVS commit: src/sys/arch/i386/pci

2015-04-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Apr 13 16:21:54 UTC 2015

Modified Files:
src/sys/arch/i386/pci: glxsb.c

Log Message:
Need sys/rndsource.h, not sys/cprng.h, for rnd source stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/pci/glxsb.c

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

Modified files:

Index: src/sys/arch/i386/pci/glxsb.c
diff -u src/sys/arch/i386/pci/glxsb.c:1.12 src/sys/arch/i386/pci/glxsb.c:1.13
--- src/sys/arch/i386/pci/glxsb.c:1.12	Sun Aug 10 16:44:34 2014
+++ src/sys/arch/i386/pci/glxsb.c	Mon Apr 13 16:21:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: glxsb.c,v 1.12 2014/08/10 16:44:34 tls Exp $	*/
+/*	$NetBSD: glxsb.c,v 1.13 2015/04/13 16:21:54 riastradh Exp $	*/
 /* $OpenBSD: glxsb.c,v 1.7 2007/02/12 14:31:45 tom Exp $ */
 
 /*
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: glxsb.c,v 1.12 2014/08/10 16:44:34 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: glxsb.c,v 1.13 2015/04/13 16:21:54 riastradh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -36,6 +36,7 @@ __KERNEL_RCSID(0, $NetBSD: glxsb.c,v 1.
 #include sys/callout.h
 #include sys/bus.h
 #include sys/cprng.h
+#include sys/rndsource.h
 
 #include machine/cpufunc.h
 



CVS commit: src/sys/arch/i386/pci

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

Modified Files:
src/sys/arch/i386/pci: gcscehci.c

Log Message:
adjust for the new findvendor


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/pci/gcscehci.c

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

Modified files:

Index: src/sys/arch/i386/pci/gcscehci.c
diff -u src/sys/arch/i386/pci/gcscehci.c:1.10 src/sys/arch/i386/pci/gcscehci.c:1.11
--- src/sys/arch/i386/pci/gcscehci.c:1.10	Sat Mar 29 15:28:28 2014
+++ src/sys/arch/i386/pci/gcscehci.c	Sun Sep 21 13:59:52 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: gcscehci.c,v 1.10 2014/03/29 19:28:28 christos Exp $ */
+/* $NetBSD: gcscehci.c,v 1.11 2014/09/21 17:59:52 christos Exp $ */
 
 /*
  * Copyright (c) 2001, 2002, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gcscehci.c,v 1.10 2014/03/29 19:28:28 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: gcscehci.c,v 1.11 2014/09/21 17:59:52 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -96,7 +96,6 @@ gcscehci_attach(device_t parent, device_
 	pcitag_t tag = pa-pa_tag;
 	char const *intrstr;
 	pci_intr_handle_t ih;
-	const char *vendor;
 	const char *devname = device_xname(self);
 	char devinfo[256];
 	usbd_status r;
@@ -151,13 +150,9 @@ gcscehci_attach(device_t parent, device_
 	sc-sc.sc_bus.usbrev = USBREV_2_0;
 
 	/* Figure out vendor for root hub descriptor. */
-	vendor = pci_findvendor(pa-pa_id);
 	sc-sc.sc_id_vendor = PCI_VENDOR(pa-pa_id);
-	if (vendor)
-		strlcpy(sc-sc.sc_vendor, vendor, sizeof(sc-sc.sc_vendor));
-	else
-		snprintf(sc-sc.sc_vendor, sizeof(sc-sc.sc_vendor),
-		vendor 0x%04x, PCI_VENDOR(pa-pa_id));
+	pci_findvendor(sc-sc.sc_vendor, sizeof(sc-sc.sc_vendor),
+	sc-sc.sc_id_vendor);
 
 	/*
 	 * Find companion controllers.  According to the spec they always



CVS commit: src/sys/arch/i386/pci

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

Modified Files:
src/sys/arch/i386/pci: gcscehci.c

Log Message:
adjust for the new findvendor


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/pci/gcscehci.c

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



CVS commit: src/sys/arch/i386/pci

2014-09-09 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Tue Sep  9 06:38:33 UTC 2014

Modified Files:
src/sys/arch/i386/pci: pci_intr_fixup.c

Log Message:
__USE(id) in the !PCIBIOSVERBOSE case.
Fixes PR 49181.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/i386/pci/pci_intr_fixup.c

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

Modified files:

Index: src/sys/arch/i386/pci/pci_intr_fixup.c
diff -u src/sys/arch/i386/pci/pci_intr_fixup.c:1.49 src/sys/arch/i386/pci/pci_intr_fixup.c:1.50
--- src/sys/arch/i386/pci/pci_intr_fixup.c:1.49	Fri Jul  1 17:37:26 2011
+++ src/sys/arch/i386/pci/pci_intr_fixup.c	Tue Sep  9 06:38:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_intr_fixup.c,v 1.49 2011/07/01 17:37:26 dyoung Exp $	*/
+/*	$NetBSD: pci_intr_fixup.c,v 1.50 2014/09/09 06:38:33 apb Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_intr_fixup.c,v 1.49 2011/07/01 17:37:26 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_intr_fixup.c,v 1.50 2014/09/09 06:38:33 apb Exp $);
 
 #include opt_pcibios.h
 #include opt_pcifixup.h
@@ -719,6 +719,8 @@ pciintr_do_header_fixup(pci_chipset_tag_
 			PCIBIOS_PRINTV(( %3d, l-irq));
 		PCIBIOS_PRINTV((  %d   , l-fixup_stage));
 	}
+#else
+	__USE(id);
 #endif
 	
 	/*



CVS commit: src/sys/arch/i386/pci

2014-09-09 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Tue Sep  9 06:38:33 UTC 2014

Modified Files:
src/sys/arch/i386/pci: pci_intr_fixup.c

Log Message:
__USE(id) in the !PCIBIOSVERBOSE case.
Fixes PR 49181.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/i386/pci/pci_intr_fixup.c

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



CVS commit: src/sys/arch/i386/pci

2014-01-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 25 21:11:03 UTC 2014

Modified Files:
src/sys/arch/i386/pci: via8231.c

Log Message:
remove unused


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/pci/via8231.c

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

Modified files:

Index: src/sys/arch/i386/pci/via8231.c
diff -u src/sys/arch/i386/pci/via8231.c:1.4 src/sys/arch/i386/pci/via8231.c:1.5
--- src/sys/arch/i386/pci/via8231.c:1.4	Fri Jul  1 13:37:27 2011
+++ src/sys/arch/i386/pci/via8231.c	Sat Jan 25 16:11:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: via8231.c,v 1.4 2011/07/01 17:37:27 dyoung Exp $	*/
+/*	$NetBSD: via8231.c,v 1.5 2014/01/25 21:11:03 christos Exp $	*/
 /*	OpenBSD: via8231.c,v 1.6 2005/10/27 16:41:06 mickey Exp 	*/
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: via8231.c,v 1.4 2011/07/01 17:37:27 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: via8231.c,v 1.5 2014/01/25 21:11:03 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -258,7 +258,7 @@ int
 via8231_set_trigger(pciintr_icu_handle_t v, int irq, int trigger)
 {
 	struct via8231_handle *ph = v;
-	int reg, clink, m, pciirq;
+	int reg, clink, pciirq;
 
 	if (VIA8231_PIRQ_LEGAL(irq) == 0 || VIA8231_TRIG_LEGAL(trigger) == 0)
 		return (1);
@@ -268,7 +268,6 @@ via8231_set_trigger(pciintr_icu_handle_t
 	via8231_pir_dump(via8231_set_trig: , ph);
 #endif
 
-	m = ph-flags  VT8237? VIA8237_LINK_MAX : VIA8231_LINK_MAX;
 	for (clink = 0; clink = VIA8231_LINK_MAX; clink++) {
 		via8231_get_intr(v, clink, pciirq);
 		if (pciirq == irq) {



CVS commit: src/sys/arch/i386/pci

2014-01-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 25 21:11:03 UTC 2014

Modified Files:
src/sys/arch/i386/pci: via8231.c

Log Message:
remove unused


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/pci/via8231.c

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



CVS commit: src/sys/arch/i386/pci

2011-11-13 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sun Nov 13 09:17:56 UTC 2011

Modified Files:
src/sys/arch/i386/pci: gscpcib.c

Log Message:
Pickup NGPIO.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/pci/gscpcib.c

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

Modified files:

Index: src/sys/arch/i386/pci/gscpcib.c
diff -u src/sys/arch/i386/pci/gscpcib.c:1.17 src/sys/arch/i386/pci/gscpcib.c:1.18
--- src/sys/arch/i386/pci/gscpcib.c:1.17	Sun Sep  4 15:05:26 2011
+++ src/sys/arch/i386/pci/gscpcib.c	Sun Nov 13 09:17:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: gscpcib.c,v 1.17 2011/09/04 15:05:26 sborrill Exp $	*/
+/*	$NetBSD: gscpcib.c,v 1.18 2011/11/13 09:17:56 mbalmer Exp $	*/
 /*	$OpenBSD: gscpcib.c,v 1.3 2004/10/05 19:02:33 grange Exp $	*/
 /*
  * Copyright (c) 2004 Alexander Yurchenko gra...@openbsd.org
@@ -23,7 +23,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gscpcib.c,v 1.17 2011/09/04 15:05:26 sborrill Exp $);
+__KERNEL_RCSID(0, $NetBSD: gscpcib.c,v 1.18 2011/11/13 09:17:56 mbalmer Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -42,6 +42,8 @@ __KERNEL_RCSID(0, $NetBSD: gscpcib.c,v 
 #include i386/pci/gscpcibreg.h
 #include arch/x86/pci/pcibvar.h
 
+#include gpio.h
+
 struct gscpcib_softc {
 	struct pcib_softc sc_pcib;
 



CVS commit: src/sys/arch/i386/pci

2011-09-04 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Sun Sep  4 15:05:27 UTC 2011

Modified Files:
src/sys/arch/i386/pci: gscpcib.c

Log Message:
Don't attach GPIO framework if NGPIO = 0


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/pci/gscpcib.c

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

Modified files:

Index: src/sys/arch/i386/pci/gscpcib.c
diff -u src/sys/arch/i386/pci/gscpcib.c:1.16 src/sys/arch/i386/pci/gscpcib.c:1.17
--- src/sys/arch/i386/pci/gscpcib.c:1.16	Fri Jul  1 17:37:26 2011
+++ src/sys/arch/i386/pci/gscpcib.c	Sun Sep  4 15:05:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: gscpcib.c,v 1.16 2011/07/01 17:37:26 dyoung Exp $	*/
+/*	$NetBSD: gscpcib.c,v 1.17 2011/09/04 15:05:26 sborrill Exp $	*/
 /*	$OpenBSD: gscpcib.c,v 1.3 2004/10/05 19:02:33 grange Exp $	*/
 /*
  * Copyright (c) 2004 Alexander Yurchenko gra...@openbsd.org
@@ -23,7 +23,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gscpcib.c,v 1.16 2011/07/01 17:37:26 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: gscpcib.c,v 1.17 2011/09/04 15:05:26 sborrill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -85,6 +85,7 @@
 int
 gscpcib_rescan(device_t self, const char *ifattr, const int *loc)
 {
+#if NGPIO  0
 	struct gscpcib_softc *sc = device_private(self);
 
 	/* Attach GPIO framework */
@@ -100,6 +101,8 @@
 		gba, gpiobus_print, NULL);
 		return 0;
 	}
+#endif
+
 	return pcibrescan(self, ifattr, loc);
 }
 



CVS commit: src/sys/arch/i386/pci

2011-09-04 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Sun Sep  4 15:05:27 UTC 2011

Modified Files:
src/sys/arch/i386/pci: gscpcib.c

Log Message:
Don't attach GPIO framework if NGPIO = 0


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/pci/gscpcib.c

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



CVS commit: src/sys/arch/i386/pci

2011-07-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Jul  5 07:08:18 UTC 2011

Modified Files:
src/sys/arch/i386/pci: viapcib.c

Log Message:
avoid an uninitialised variable warning GCC 4.5 -O3 picks up.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/pci/viapcib.c

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

Modified files:

Index: src/sys/arch/i386/pci/viapcib.c
diff -u src/sys/arch/i386/pci/viapcib.c:1.13 src/sys/arch/i386/pci/viapcib.c:1.14
--- src/sys/arch/i386/pci/viapcib.c:1.13	Wed Jun  8 22:43:10 2011
+++ src/sys/arch/i386/pci/viapcib.c	Tue Jul  5 07:08:17 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: viapcib.c,v 1.13 2011/06/08 22:43:10 rmind Exp $ */
+/* $NetBSD: viapcib.c,v 1.14 2011/07/05 07:08:17 mrg Exp $ */
 /* $FreeBSD: src/sys/pci/viapm.c,v 1.10 2005/05/29 04:42:29 nyan Exp $ */
 
 /*-
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: viapcib.c,v 1.13 2011/06/08 22:43:10 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: viapcib.c,v 1.14 2011/07/05 07:08:17 mrg Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -232,7 +232,7 @@
 viapcib_wait(struct viapcib_softc *sc)
 {
 	int rv, timeout;
-	uint8_t val;
+	uint8_t val = 0;
 
 	timeout = VIAPCIB_SMBUS_TIMEOUT;
 	rv = 0;



CVS commit: src/sys/arch/i386/pci

2011-07-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Jul  5 07:08:18 UTC 2011

Modified Files:
src/sys/arch/i386/pci: viapcib.c

Log Message:
avoid an uninitialised variable warning GCC 4.5 -O3 picks up.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/pci/viapcib.c

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



CVS commit: src/sys/arch/i386/pci

2011-07-01 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Jul  1 17:37:27 UTC 2011

Modified Files:
src/sys/arch/i386/pci: ali1543.c amd756.c elan520.c gcscehci.c geode.c
geodecntr.c geodewdg.c gscpcib.c opti82c558.c opti82c700.c pceb.c
pci_intr_fixup.c pcmb.c piix.c piixpcib.c sis85c503.c via8231.c
via82c586.c

Log Message:
#include sys/bus.h instead of machine/bus.h.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/pci/ali1543.c \
src/sys/arch/i386/pci/via82c586.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/pci/amd756.c \
src/sys/arch/i386/pci/gcscehci.c src/sys/arch/i386/pci/geodecntr.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/i386/pci/elan520.c \
src/sys/arch/i386/pci/pci_intr_fixup.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/pci/geode.c \
src/sys/arch/i386/pci/piix.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/pci/geodewdg.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/pci/gscpcib.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/pci/opti82c558.c \
src/sys/arch/i386/pci/opti82c700.c src/sys/arch/i386/pci/sis85c503.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/pci/pceb.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/pci/pcmb.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/pci/piixpcib.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/pci/via8231.c

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

Modified files:

Index: src/sys/arch/i386/pci/ali1543.c
diff -u src/sys/arch/i386/pci/ali1543.c:1.11 src/sys/arch/i386/pci/ali1543.c:1.12
--- src/sys/arch/i386/pci/ali1543.c:1.11	Tue Dec 15 22:17:12 2009
+++ src/sys/arch/i386/pci/ali1543.c	Fri Jul  1 17:37:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ali1543.c,v 1.11 2009/12/15 22:17:12 snj Exp $	*/
+/*	$NetBSD: ali1543.c,v 1.12 2011/07/01 17:37:26 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2001
@@ -84,7 +84,7 @@
 /* HAYAKAWA Koichi wrote ALi 1543 PCI ICU code basing on VIA82C586 driver */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ali1543.c,v 1.11 2009/12/15 22:17:12 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: ali1543.c,v 1.12 2011/07/01 17:37:26 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -94,7 +94,7 @@
 #include sys/proc.h
 
 #include machine/intr.h
-#include machine/bus.h
+#include sys/bus.h
 
 #include dev/pci/pcivar.h
 #include dev/pci/pcireg.h
Index: src/sys/arch/i386/pci/via82c586.c
diff -u src/sys/arch/i386/pci/via82c586.c:1.11 src/sys/arch/i386/pci/via82c586.c:1.12
--- src/sys/arch/i386/pci/via82c586.c:1.11	Mon Apr 28 20:23:25 2008
+++ src/sys/arch/i386/pci/via82c586.c	Fri Jul  1 17:37:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: via82c586.c,v 1.11 2008/04/28 20:23:25 martin Exp $	*/
+/*	$NetBSD: via82c586.c,v 1.12 2011/07/01 17:37:27 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -60,14 +60,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: via82c586.c,v 1.11 2008/04/28 20:23:25 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: via82c586.c,v 1.12 2011/07/01 17:37:27 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/device.h
 
 #include machine/intr.h
-#include machine/bus.h
+#include sys/bus.h
 
 #include dev/pci/pcivar.h
 #include dev/pci/pcireg.h

Index: src/sys/arch/i386/pci/amd756.c
diff -u src/sys/arch/i386/pci/amd756.c:1.8 src/sys/arch/i386/pci/amd756.c:1.9
--- src/sys/arch/i386/pci/amd756.c:1.8	Mon Apr 28 20:23:24 2008
+++ src/sys/arch/i386/pci/amd756.c	Fri Jul  1 17:37:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd756.c,v 1.8 2008/04/28 20:23:24 martin Exp $	*/
+/*	$NetBSD: amd756.c,v 1.9 2011/07/01 17:37:26 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: amd756.c,v 1.8 2008/04/28 20:23:24 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: amd756.c,v 1.9 2011/07/01 17:37:26 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -68,7 +68,7 @@
 #include sys/malloc.h
 
 #include machine/intr.h
-#include machine/bus.h
+#include sys/bus.h
 
 #include dev/pci/pcivar.h
 #include dev/pci/pcireg.h
Index: src/sys/arch/i386/pci/gcscehci.c
diff -u src/sys/arch/i386/pci/gcscehci.c:1.8 src/sys/arch/i386/pci/gcscehci.c:1.9
--- src/sys/arch/i386/pci/gcscehci.c:1.8	Tue May 25 08:37:10 2010
+++ src/sys/arch/i386/pci/gcscehci.c	Fri Jul  1 17:37:26 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: gcscehci.c,v 1.8 2010/05/25 08:37:10 pgoyette Exp $ */
+/* $NetBSD: gcscehci.c,v 1.9 2011/07/01 17:37:26 dyoung Exp $ */
 
 /*
  * Copyright (c) 2001, 2002, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gcscehci.c,v 1.8 2010/05/25 08:37:10 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: gcscehci.c,v 1.9 2011/07/01 17:37:26 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -40,7 +40,7 @@
 #include sys/proc.h
 #include sys/queue.h
 
-#include machine/bus.h
+#include sys/bus.h
 #include 

CVS commit: src/sys/arch/i386/pci

2011-07-01 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Jul  1 17:37:27 UTC 2011

Modified Files:
src/sys/arch/i386/pci: ali1543.c amd756.c elan520.c gcscehci.c geode.c
geodecntr.c geodewdg.c gscpcib.c opti82c558.c opti82c700.c pceb.c
pci_intr_fixup.c pcmb.c piix.c piixpcib.c sis85c503.c via8231.c
via82c586.c

Log Message:
#include sys/bus.h instead of machine/bus.h.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/pci/ali1543.c \
src/sys/arch/i386/pci/via82c586.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/pci/amd756.c \
src/sys/arch/i386/pci/gcscehci.c src/sys/arch/i386/pci/geodecntr.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/i386/pci/elan520.c \
src/sys/arch/i386/pci/pci_intr_fixup.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/pci/geode.c \
src/sys/arch/i386/pci/piix.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/pci/geodewdg.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/pci/gscpcib.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/pci/opti82c558.c \
src/sys/arch/i386/pci/opti82c700.c src/sys/arch/i386/pci/sis85c503.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/pci/pceb.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/pci/pcmb.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/pci/piixpcib.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/pci/via8231.c

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



CVS commit: src/sys/arch/i386/pci

2011-06-08 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed Jun  8 22:43:10 UTC 2011

Modified Files:
src/sys/arch/i386/pci: viapcib.c

Log Message:
Convert simple_lock to mutex.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/pci/viapcib.c

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

Modified files:

Index: src/sys/arch/i386/pci/viapcib.c
diff -u src/sys/arch/i386/pci/viapcib.c:1.12 src/sys/arch/i386/pci/viapcib.c:1.13
--- src/sys/arch/i386/pci/viapcib.c:1.12	Fri Oct  2 21:27:45 2009
+++ src/sys/arch/i386/pci/viapcib.c	Wed Jun  8 22:43:10 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: viapcib.c,v 1.12 2009/10/02 21:27:45 jmcneill Exp $ */
+/* $NetBSD: viapcib.c,v 1.13 2011/06/08 22:43:10 rmind Exp $ */
 /* $FreeBSD: src/sys/pci/viapm.c,v 1.10 2005/05/29 04:42:29 nyan Exp $ */
 
 /*-
@@ -55,14 +55,13 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: viapcib.c,v 1.12 2009/10/02 21:27:45 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: viapcib.c,v 1.13 2011/06/08 22:43:10 rmind Exp $);
 
 #include sys/types.h
 #include sys/param.h
 #include sys/systm.h
 #include sys/device.h
-#include sys/proc.h
-#include sys/simplelock.h
+#include sys/mutex.h
 #include sys/bus.h
 
 #include dev/pci/pcireg.h
@@ -92,7 +91,7 @@
 
 	int sc_revision;
 
-	struct simplelock sc_lock;
+	kmutex_t sc_lock;
 };
 
 static int	viapcib_match(device_t, cfdata_t, void *);
@@ -172,7 +171,7 @@
 		goto core_pcib;
 	}
 
-	simple_lock_init(sc-sc_lock);
+	mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_NONE);
 
 	val = pci_conf_read(pa-pa_pc, pa-pa_tag, SMB_HOST_CONFIG);
 	if ((val  0x1) == 0) {
@@ -281,13 +280,10 @@
 static int
 viapcib_acquire_bus(void *opaque, int flags)
 {
-	struct viapcib_softc *sc;
+	struct viapcib_softc *sc = (struct viapcib_softc *)opaque;
 
 	DPRINTF((viapcib_i2c_acquire_bus(%p, 0x%x)\n, opaque, flags));
-
-	sc = (struct viapcib_softc *)opaque;
-
-	simple_lock(sc-sc_lock);
+	mutex_enter(sc-sc_lock);
 
 	return 0;
 }
@@ -295,15 +291,10 @@
 static void
 viapcib_release_bus(void *opaque, int flags)
 {
-	struct viapcib_softc *sc;
+	struct viapcib_softc *sc = (struct viapcib_softc *)opaque;
 
+	mutex_exit(sc-sc_lock);
 	DPRINTF((viapcib_i2c_release_bus(%p, 0x%x)\n, opaque, flags));
-
-	sc = (struct viapcib_softc *)opaque;
-
-	simple_unlock(sc-sc_lock);
-
-	return;
 }
 
 static int



CVS commit: src/sys/arch/i386/pci

2011-06-08 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed Jun  8 22:43:10 UTC 2011

Modified Files:
src/sys/arch/i386/pci: viapcib.c

Log Message:
Convert simple_lock to mutex.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/pci/viapcib.c

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



CVS commit: src/sys/arch/i386/pci

2010-01-08 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Jan  8 19:45:28 UTC 2010

Modified Files:
src/sys/arch/i386/pci: elan520.c piixpcib.c

Log Message:
Expand PMF_FN_* macros.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/i386/pci/elan520.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/pci/piixpcib.c

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



CVS commit: src/sys/arch/i386/pci

2010-01-08 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Jan  8 19:45:28 UTC 2010

Modified Files:
src/sys/arch/i386/pci: elan520.c piixpcib.c

Log Message:
Expand PMF_FN_* macros.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/i386/pci/elan520.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/pci/piixpcib.c

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

Modified files:

Index: src/sys/arch/i386/pci/elan520.c
diff -u src/sys/arch/i386/pci/elan520.c:1.45 src/sys/arch/i386/pci/elan520.c:1.46
--- src/sys/arch/i386/pci/elan520.c:1.45	Fri Jan  8 00:09:44 2010
+++ src/sys/arch/i386/pci/elan520.c	Fri Jan  8 19:45:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: elan520.c,v 1.45 2010/01/08 00:09:44 dyoung Exp $	*/
+/*	$NetBSD: elan520.c,v 1.46 2010/01/08 19:45:28 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: elan520.c,v 1.45 2010/01/08 00:09:44 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: elan520.c,v 1.46 2010/01/08 19:45:28 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -847,7 +847,7 @@
 }
 
 static bool
-elansc_suspend(device_t dev PMF_FN_ARGS)
+elansc_suspend(device_t dev, pmf_qual_t qual)
 {
 	bool rc;
 	struct elansc_softc *sc = device_private(dev);
@@ -861,7 +861,7 @@
 }
 
 static bool
-elansc_resume(device_t dev PMF_FN_ARGS)
+elansc_resume(device_t dev, pmf_qual_t qual)
 {
 	struct elansc_softc *sc = device_private(dev);
 
@@ -947,7 +947,7 @@
 }
 
 static bool
-elanpex_resume(device_t self PMF_FN_ARGS)
+elanpex_resume(device_t self, pmf_qual_t qual)
 {
 	struct elansc_softc *sc = device_private(device_parent(self));
 
@@ -956,7 +956,7 @@
 }
 
 static bool
-elanpex_suspend(device_t self PMF_FN_ARGS)
+elanpex_suspend(device_t self, pmf_qual_t qual)
 {
 	struct elansc_softc *sc = device_private(device_parent(self));
 
@@ -966,7 +966,7 @@
 }
 
 static bool
-elanpar_resume(device_t self PMF_FN_ARGS)
+elanpar_resume(device_t self, pmf_qual_t qual)
 {
 	struct elansc_softc *sc = device_private(device_parent(self));
 
@@ -975,7 +975,7 @@
 }
 
 static bool
-elanpar_suspend(device_t self PMF_FN_ARGS)
+elanpar_suspend(device_t self, pmf_qual_t qual)
 {
 	struct elansc_softc *sc = device_private(device_parent(self));
 

Index: src/sys/arch/i386/pci/piixpcib.c
diff -u src/sys/arch/i386/pci/piixpcib.c:1.16 src/sys/arch/i386/pci/piixpcib.c:1.17
--- src/sys/arch/i386/pci/piixpcib.c:1.16	Sun Jul 20 16:52:33 2008
+++ src/sys/arch/i386/pci/piixpcib.c	Fri Jan  8 19:45:28 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpcib.c,v 1.16 2008/07/20 16:52:33 martin Exp $ */
+/* $NetBSD: piixpcib.c,v 1.17 2010/01/08 19:45:28 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2004, 2006 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: piixpcib.c,v 1.16 2008/07/20 16:52:33 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: piixpcib.c,v 1.17 2010/01/08 19:45:28 dyoung Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -79,8 +79,8 @@
 static int piixpcibmatch(device_t, cfdata_t, void *);
 static void piixpcibattach(device_t, device_t, void *);
 
-static bool piixpcib_suspend(device_t PMF_FN_PROTO);
-static bool piixpcib_resume(device_t PMF_FN_PROTO);
+static bool piixpcib_suspend(device_t, pmf_qual_t);
+static bool piixpcib_resume(device_t, pmf_qual_t);
 
 static void speedstep_configure(struct piixpcib_softc *,
 struct pci_attach_args *);
@@ -144,7 +144,7 @@
 }
 
 static bool
-piixpcib_suspend(device_t dv PMF_FN_ARGS)
+piixpcib_suspend(device_t dv, pmf_qual_t qual)
 {
 	struct piixpcib_softc *sc = device_private(dv);
 
@@ -160,7 +160,7 @@
 }
 
 static bool
-piixpcib_resume(device_t dv PMF_FN_ARGS)
+piixpcib_resume(device_t dv, pmf_qual_t qual)
 {
 	struct piixpcib_softc *sc = device_private(dv);
 



CVS commit: src/sys/arch/i386/pci

2009-11-30 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Dec  1 01:08:45 UTC 2009

Modified Files:
src/sys/arch/i386/pci: elan520.c

Log Message:
KNF: define struct pareg near the top of the file.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/i386/pci/elan520.c

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

Modified files:

Index: src/sys/arch/i386/pci/elan520.c
diff -u src/sys/arch/i386/pci/elan520.c:1.43 src/sys/arch/i386/pci/elan520.c:1.44
--- src/sys/arch/i386/pci/elan520.c:1.43	Thu Sep 17 20:21:54 2009
+++ src/sys/arch/i386/pci/elan520.c	Tue Dec  1 01:08:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elan520.c,v 1.43 2009/09/17 20:21:54 dyoung Exp $	*/
+/*	$NetBSD: elan520.c,v 1.44 2009/12/01 01:08:45 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: elan520.c,v 1.43 2009/09/17 20:21:54 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: elan520.c,v 1.44 2009/12/01 01:08:45 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -108,6 +108,11 @@
 #endif
 };
 
+struct pareg {
+	paddr_t start;
+	paddr_t end;
+};
+
 static bool elansc_attached = false;
 int elansc_wpvnmi = 1;
 int elansc_pcinmi = 1;
@@ -647,11 +652,6 @@
 	bus_space_write_4(memt, memh, MMCR_PAR(idx), par);
 }
 
-struct pareg {
-	paddr_t start;
-	paddr_t end;
-};
-
 static int
 region_paddr_to_par(struct pareg *region0, struct pareg *regions, uint32_t unit)
 {



CVS commit: src/sys/arch/i386/pci

2009-10-20 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Tue Oct 20 17:29:06 UTC 2009

Modified Files:
src/sys/arch/i386/pci: geodevar.h

Log Message:
update copyright to 2 clause version of the NetBSD Foundation


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/pci/geodevar.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/arch/i386/pci/geodevar.h
diff -u src/sys/arch/i386/pci/geodevar.h:1.3 src/sys/arch/i386/pci/geodevar.h:1.4
--- src/sys/arch/i386/pci/geodevar.h:1.3	Mon May  5 11:49:40 2008
+++ src/sys/arch/i386/pci/geodevar.h	Tue Oct 20 17:29:06 2009
@@ -1,9 +1,8 @@
-/*	$NetBSD: geodevar.h,v 1.3 2008/05/05 11:49:40 xtraeme Exp $	*/
+/*	$NetBSD: geodevar.h,v 1.4 2009/10/20 17:29:06 kardel Exp $	*/
 
 /*-
- * Copyright (c) 2006 Frank Kardel  All rights reserved.
- *
- * This code was written by Frank Kardel
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -13,27 +12,21 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *	This product includes software developed by David Young.
- * 4. The name of David Young may not be used to endorse or promote
- *products derived from this software without specific prior
- *written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DAVID
- * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
+
 /*
  * Register definitions for the AMD Geode SC1100.
  */



CVS commit: src/sys/arch/i386/pci

2009-10-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Oct  2 21:27:45 UTC 2009

Modified Files:
src/sys/arch/i386/pci: viapcib.c

Log Message:
match VT8237A


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/pci/viapcib.c

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

Modified files:

Index: src/sys/arch/i386/pci/viapcib.c
diff -u src/sys/arch/i386/pci/viapcib.c:1.11 src/sys/arch/i386/pci/viapcib.c:1.12
--- src/sys/arch/i386/pci/viapcib.c:1.11	Sun Jul 20 16:59:53 2008
+++ src/sys/arch/i386/pci/viapcib.c	Fri Oct  2 21:27:45 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: viapcib.c,v 1.11 2008/07/20 16:59:53 martin Exp $ */
+/* $NetBSD: viapcib.c,v 1.12 2009/10/02 21:27:45 jmcneill Exp $ */
 /* $FreeBSD: src/sys/pci/viapm.c,v 1.10 2005/05/29 04:42:29 nyan Exp $ */
 
 /*-
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: viapcib.c,v 1.11 2008/07/20 16:59:53 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: viapcib.c,v 1.12 2009/10/02 21:27:45 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -148,6 +148,7 @@
 	switch (PCI_PRODUCT(pa-pa_id)) {
 	case PCI_PRODUCT_VIATECH_VT8235:
 	case PCI_PRODUCT_VIATECH_VT8237:
+	case PCI_PRODUCT_VIATECH_VT8237A_ISA:
 		return 2; /* match above generic pcib(4) */
 	}
 



CVS commit: src/sys/arch/i386/pci

2009-09-27 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Sep 27 18:31:58 UTC 2009

Modified Files:
src/sys/arch/i386/pci: gcscpcib.c

Log Message:
Make this build without gpio(4).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/pci/gcscpcib.c

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

Modified files:

Index: src/sys/arch/i386/pci/gcscpcib.c
diff -u src/sys/arch/i386/pci/gcscpcib.c:1.7 src/sys/arch/i386/pci/gcscpcib.c:1.8
--- src/sys/arch/i386/pci/gcscpcib.c:1.7	Mon May  4 12:41:09 2009
+++ src/sys/arch/i386/pci/gcscpcib.c	Sun Sep 27 18:31:58 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: gcscpcib.c,v 1.7 2009/05/04 12:41:09 cegger Exp $ */
+/* $NetBSD: gcscpcib.c,v 1.8 2009/09/27 18:31:58 jakllsch Exp $ */
 /* $OpenBSD: gcscpcib.c,v 1.6 2007/11/17 17:02:47 mbalmer Exp $	*/
 
 /*
@@ -24,7 +24,7 @@
  * AMD CS5535/CS5536 series LPC bridge also containing timer, watchdog and GPIO.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gcscpcib.c,v 1.7 2009/05/04 12:41:09 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: gcscpcib.c,v 1.8 2009/09/27 18:31:58 jakllsch Exp $);
 
 #include gpio.h
 
@@ -87,11 +87,13 @@
 	struct sysmon_wdog	sc_smw;
 	int			sc_wdt_mfgpt;
 
+#if NGPIO  0
 	/* GPIO interface */
 	bus_space_tag_t		sc_gpio_iot;
 	bus_space_handle_t	sc_gpio_ioh;
 	struct gpio_chipset_tag	sc_gpio_gc;
 	gpio_pin_t		sc_gpio_pins[AMD553X_GPIO_NPINS];
+#endif
 
 	/* SMbus/i2c interface */ 
 #if 0
@@ -159,7 +161,9 @@
 	sc-sc_pcib.sc_pc = pa-pa_pc;
 	sc-sc_pcib.sc_tag = pa-pa_tag;
 	sc-sc_iot = pa-pa_iot;
+#if NGPIO  0
 	sc-sc_gpio_iot = pa-pa_iot;
+#endif
 
 	/* Attach the PCI-ISA bridge at first */
 	pcibattach(parent, self, aux);



Re: CVS commit: src/sys/arch/i386/pci

2009-09-21 Thread David Young
On Sun, Sep 20, 2009 at 08:35:45AM +0100, Marc Balmer wrote:
 
 Am 17.09.2009 um 21:21 schrieb David Young:
 
 Module Name: src
 Committed By:dyoung
 Date:Thu Sep 17 20:21:54 UTC 2009
 
 Modified Files:
  src/sys/arch/i386/pci: elan520.c
 
 Log Message:
 As Jonathan Kollasch points out, elansc_attach() does not actually
 use gba after filling it out.  Delete it.
 
 I am not sure if this is the right fix.  Does the gpio device still
 attach now?
 
 Shouldn't there just be a
 
 config_found_ia(self, gpiobus, gba, gpiobus_print);

The call is in elansc_rescan().  elansc_attach() calls that.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


CVS commit: src/sys/arch/i386/pci

2009-09-17 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Sep 17 20:21:54 UTC 2009

Modified Files:
src/sys/arch/i386/pci: elan520.c

Log Message:
As Jonathan Kollasch points out, elansc_attach() does not actually
use gba after filling it out.  Delete it.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/i386/pci/elan520.c

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

Modified files:

Index: src/sys/arch/i386/pci/elan520.c
diff -u src/sys/arch/i386/pci/elan520.c:1.42 src/sys/arch/i386/pci/elan520.c:1.43
--- src/sys/arch/i386/pci/elan520.c:1.42	Wed Apr 29 23:50:53 2009
+++ src/sys/arch/i386/pci/elan520.c	Thu Sep 17 20:21:54 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elan520.c,v 1.42 2009/04/29 23:50:53 dyoung Exp $	*/
+/*	$NetBSD: elan520.c,v 1.43 2009/09/17 20:21:54 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: elan520.c,v 1.42 2009/04/29 23:50:53 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: elan520.c,v 1.43 2009/09/17 20:21:54 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1262,7 +1262,6 @@
 	uint16_t rev;
 	uint8_t cpuctl, picicr, ressta;
 #if NGPIO  0
-	struct gpiobus_attach_args gba;
 	int pin, reg, shift;
 	uint16_t data;
 #endif
@@ -1387,10 +1386,6 @@
 	sc-sc_gpio_gc.gp_pin_write = elansc_gpio_pin_write;
 	sc-sc_gpio_gc.gp_pin_ctl = elansc_gpio_pin_ctl;
 
-	gba.gba_gc = sc-sc_gpio_gc;
-	gba.gba_pins = sc-sc_gpio_pins;
-	gba.gba_npins = ELANSC_PIO_NPINS;
-
 #endif /* NGPIO */
 
 	elansc_rescan(sc-sc_dev, elanparbus, NULL);



CVS commit: src/sys/arch/i386/pci

2009-08-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Aug 18 19:51:45 UTC 2009

Modified Files:
src/sys/arch/i386/pci: gscpcib.c

Log Message:
Fix the gscpcib(4) detachment routine: add a call to pcibdetach().

Write child-detachment and rescan routines to let us detach and
re-attach gpio0 and isa0 at gscpcib0:

# drvctl -d isa0
# drvctl -d gpio0
# drvctl -r -a isabus gscpcib0
# drvctl -r -a gpiobus gscpcib0


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/pci/gscpcib.c

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

Modified files:

Index: src/sys/arch/i386/pci/gscpcib.c
diff -u src/sys/arch/i386/pci/gscpcib.c:1.13 src/sys/arch/i386/pci/gscpcib.c:1.14
--- src/sys/arch/i386/pci/gscpcib.c:1.13	Mon Aug 17 14:18:58 2009
+++ src/sys/arch/i386/pci/gscpcib.c	Tue Aug 18 19:51:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: gscpcib.c,v 1.13 2009/08/17 14:18:58 mbalmer Exp $	*/
+/*	$NetBSD: gscpcib.c,v 1.14 2009/08/18 19:51:45 dyoung Exp $	*/
 /*	$OpenBSD: gscpcib.c,v 1.3 2004/10/05 19:02:33 grange Exp $	*/
 /*
  * Copyright (c) 2004 Alexander Yurchenko gra...@openbsd.org
@@ -23,7 +23,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gscpcib.c,v 1.13 2009/08/17 14:18:58 mbalmer Exp $);
+__KERNEL_RCSID(0, $NetBSD: gscpcib.c,v 1.14 2009/08/18 19:51:45 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -46,6 +46,7 @@
 	struct pcib_softc sc_pcib;
 
 	bool sc_gpio_present;
+	device_t sc_gpiobus;
 
 	/* GPIO interface */
 	bus_space_tag_t sc_gpio_iot;
@@ -57,19 +58,58 @@
 int	gscpcib_match(device_t, cfdata_t, void *);
 void	gscpcib_attach(device_t, device_t, void *);
 int	gscpcib_detach(device_t, int);
+int	gscpcib_rescan(device_t, const char *, const int *);
+void	gscpcib_childdetached(device_t, device_t);
 
 int	gscpcib_gpio_pin_read(void *, int);
 void	gscpcib_gpio_pin_write(void *, int, int);
 void	gscpcib_gpio_pin_ctl(void *, int, int);
 
-/* arch/x86/pci/pcib.c */
-voidpcibattach(device_t, device_t, void *);
-
-CFATTACH_DECL_NEW(gscpcib, sizeof(struct gscpcib_softc),
-	gscpcib_match, gscpcib_attach, gscpcib_detach, NULL);
+CFATTACH_DECL3_NEW(gscpcib, sizeof(struct gscpcib_softc),
+	gscpcib_match, gscpcib_attach, gscpcib_detach, NULL, gscpcib_rescan,
+	gscpcib_childdetached, DVF_DETACH_SHUTDOWN);
 
 extern struct cfdriver gscpcib_cd;
 
+void
+gscpcib_childdetached(device_t self, device_t child)
+{
+	struct gscpcib_softc *sc = device_private(self);
+
+	if (sc-sc_gpiobus == child)
+		sc-sc_gpiobus = NULL;
+	else
+		pcibchilddet(self, child);
+}
+
+/* XXX share this with sys/arch/i386/pci/elan520.c */
+static bool
+ifattr_match(const char *snull, const char *t)
+{
+	return (snull == NULL) || strcmp(snull, t) == 0;
+}
+
+int
+gscpcib_rescan(device_t self, const char *ifattr, const int *loc)
+{
+	struct gscpcib_softc *sc = device_private(self);
+
+	/* Attach GPIO framework */
+	if (sc-sc_gpio_present  ifattr_match(ifattr, gpiobus) 
+	sc-sc_gpiobus == NULL) {
+		struct gpiobus_attach_args gba;
+
+		gba.gba_gc = sc-sc_gpio_gc;
+		gba.gba_pins = sc-sc_gpio_pins;
+		gba.gba_npins = GSCGPIO_NPINS;
+
+		sc-sc_gpiobus = config_found_sm_loc(self, gpiobus, loc,
+		gba, gpiobus_print, NULL);
+		return 0;
+	}
+	return pcibrescan(self, ifattr, loc);
+}
+
 int
 gscpcib_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -91,7 +131,6 @@
 {
 	struct gscpcib_softc *sc = device_private(self);
 	struct pci_attach_args *pa = aux;
-	struct gpiobus_attach_args gba;
 	pcireg_t gpiobase;
 	int i;
 
@@ -125,19 +164,13 @@
 	sc-sc_gpio_gc.gp_pin_write = gscpcib_gpio_pin_write;
 	sc-sc_gpio_gc.gp_pin_ctl = gscpcib_gpio_pin_ctl;
 
-	gba.gba_gc = sc-sc_gpio_gc;
-	gba.gba_pins = sc-sc_gpio_pins;
-	gba.gba_npins = GSCGPIO_NPINS;
-
 	sc-sc_gpio_present = true;
 
 corepcib:
 	/* Provide core pcib(4) functionality */
 	pcibattach(parent, self, aux);
 
-	/* Attach GPIO framework */
-	if (sc-sc_gpio_present)
-		config_found_ia(self, gpiobus, gba, gpiobus_print);
+	gscpcib_rescan(self, gpiobus, NULL);
 }
 
 int
@@ -149,6 +182,9 @@
 	if ((rc = config_detach_children(self, flags)) != 0)
 		return rc;
 
+	if ((rc = pcibdetach(self, flags)) != 0)
+		return rc;
+
 	if (sc-sc_gpio_present)
 		bus_space_unmap(sc-sc_gpio_iot, sc-sc_gpio_ioh, GSCGPIO_SIZE);
 



CVS commit: src/sys/arch/i386/pci

2009-08-17 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Mon Aug 17 14:18:58 UTC 2009

Modified Files:
src/sys/arch/i386/pci: gscpcib.c

Log Message:
Add struct pcib_softc to the gscpcib's softc, it is needed since we call
pcibattach() later.  This fixes the driver and lets the GPIO pins attach.
While here, remove the empty gscpcib_childdetach function.  Fixes GPIO
on my Soekris net4801 where I can now control the error LED...

please commit joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/pci/gscpcib.c

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

Modified files:

Index: src/sys/arch/i386/pci/gscpcib.c
diff -u src/sys/arch/i386/pci/gscpcib.c:1.12 src/sys/arch/i386/pci/gscpcib.c:1.13
--- src/sys/arch/i386/pci/gscpcib.c:1.12	Mon May  4 12:41:09 2009
+++ src/sys/arch/i386/pci/gscpcib.c	Mon Aug 17 14:18:58 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: gscpcib.c,v 1.12 2009/05/04 12:41:09 cegger Exp $	*/
+/*	$NetBSD: gscpcib.c,v 1.13 2009/08/17 14:18:58 mbalmer Exp $	*/
 /*	$OpenBSD: gscpcib.c,v 1.3 2004/10/05 19:02:33 grange Exp $	*/
 /*
  * Copyright (c) 2004 Alexander Yurchenko gra...@openbsd.org
@@ -23,7 +23,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gscpcib.c,v 1.12 2009/05/04 12:41:09 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: gscpcib.c,v 1.13 2009/08/17 14:18:58 mbalmer Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -40,8 +40,11 @@
 #include dev/gpio/gpiovar.h
 
 #include i386/pci/gscpcibreg.h
+#include arch/x86/pci/pcibvar.h
 
 struct gscpcib_softc {
+	struct pcib_softc sc_pcib;
+
 	bool sc_gpio_present;
 
 	/* GPIO interface */
@@ -54,29 +57,19 @@
 int	gscpcib_match(device_t, cfdata_t, void *);
 void	gscpcib_attach(device_t, device_t, void *);
 int	gscpcib_detach(device_t, int);
-void	gscpcib_childdetached(device_t, device_t);
 
 int	gscpcib_gpio_pin_read(void *, int);
 void	gscpcib_gpio_pin_write(void *, int, int);
 void	gscpcib_gpio_pin_ctl(void *, int, int);
 
-/* arch/i386/pci/pcib.c */
+/* arch/x86/pci/pcib.c */
 voidpcibattach(device_t, device_t, void *);
 
-CFATTACH_DECL2_NEW(gscpcib, sizeof(struct gscpcib_softc),
-	gscpcib_match, gscpcib_attach, gscpcib_detach, NULL, NULL,
-	gscpcib_childdetached);
+CFATTACH_DECL_NEW(gscpcib, sizeof(struct gscpcib_softc),
+	gscpcib_match, gscpcib_attach, gscpcib_detach, NULL);
 
 extern struct cfdriver gscpcib_cd;
 
-void
-gscpcib_childdetached(device_t self, device_t child)
-{
-	/* We hold no pointers to child devices, so there is nothing
-	 * to do here.
-	 */
-}
-
 int
 gscpcib_match(device_t parent, cfdata_t match, void *aux)
 {



CVS commit: src/sys/arch/i386/pci

2009-05-04 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Mon May  4 12:15:51 UTC 2009

Modified Files:
src/sys/arch/i386/pci: gcscehci.c p64h2apic.c

Log Message:
struct device * - device_t, use device_private()
No functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/pci/gcscehci.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/pci/p64h2apic.c

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

Modified files:

Index: src/sys/arch/i386/pci/gcscehci.c
diff -u src/sys/arch/i386/pci/gcscehci.c:1.4 src/sys/arch/i386/pci/gcscehci.c:1.5
--- src/sys/arch/i386/pci/gcscehci.c:1.4	Sun Jul  6 08:01:15 2008
+++ src/sys/arch/i386/pci/gcscehci.c	Mon May  4 12:15:51 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: gcscehci.c,v 1.4 2008/07/06 08:01:15 cegger Exp $ */
+/* $NetBSD: gcscehci.c,v 1.5 2009/05/04 12:15:51 cegger Exp $ */
 
 /*
  * Copyright (c) 2001, 2002, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gcscehci.c,v 1.4 2008/07/06 08:01:15 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: gcscehci.c,v 1.5 2009/05/04 12:15:51 cegger Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -73,7 +73,7 @@
 };
 
 static int
-gcscehci_match(struct device *parent, struct cfdata *match, void *aux)
+gcscehci_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct pci_attach_args *pa = (struct pci_attach_args *) aux;
 
@@ -88,7 +88,7 @@
 }
 
 static void
-gcscehci_attach(struct device *parent, struct device *self, void *aux)
+gcscehci_attach(device_t parent, device_t self, void *aux)
 {
 	struct gcscehci_softc *sc = device_private(self);
 	struct pci_attach_args *pa = (struct pci_attach_args *)aux;

Index: src/sys/arch/i386/pci/p64h2apic.c
diff -u src/sys/arch/i386/pci/p64h2apic.c:1.14 src/sys/arch/i386/pci/p64h2apic.c:1.15
--- src/sys/arch/i386/pci/p64h2apic.c:1.14	Wed Jul  9 20:45:33 2008
+++ src/sys/arch/i386/pci/p64h2apic.c	Mon May  4 12:15:51 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: p64h2apic.c,v 1.14 2008/07/09 20:45:33 joerg Exp $ */
+/* $NetBSD: p64h2apic.c,v 1.15 2009/05/04 12:15:51 cegger Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: p64h2apic.c,v 1.14 2008/07/09 20:45:33 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: p64h2apic.c,v 1.15 2009/05/04 12:15:51 cegger Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -49,8 +49,8 @@
 #include dev/pci/pcivar.h
 #include dev/pci/pcidevs.h
 
-static int	p64h2match(struct device *, struct cfdata *, void *);
-static void	p64h2attach(struct device *, struct device *, void *);
+static int	p64h2match(device_t, cfdata_t, void *);
+static void	p64h2attach(device_t, device_t, void *);
 
 struct p64h2apic_softc {
 	pcitag_t sc_tag;



CVS commit: src/sys/arch/i386/pci

2009-05-04 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Mon May  4 12:41:09 UTC 2009

Modified Files:
src/sys/arch/i386/pci: gcscpcib.c gscpcib.c

Log Message:
struct cfdata * - cfdata_t


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/pci/gcscpcib.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/pci/gscpcib.c

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

Modified files:

Index: src/sys/arch/i386/pci/gcscpcib.c
diff -u src/sys/arch/i386/pci/gcscpcib.c:1.6 src/sys/arch/i386/pci/gcscpcib.c:1.7
--- src/sys/arch/i386/pci/gcscpcib.c:1.6	Sun Jul 20 22:57:19 2008
+++ src/sys/arch/i386/pci/gcscpcib.c	Mon May  4 12:41:09 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: gcscpcib.c,v 1.6 2008/07/20 22:57:19 martin Exp $ */
+/* $NetBSD: gcscpcib.c,v 1.7 2009/05/04 12:41:09 cegger Exp $ */
 /* $OpenBSD: gcscpcib.c,v 1.6 2007/11/17 17:02:47 mbalmer Exp $	*/
 
 /*
@@ -24,7 +24,7 @@
  * AMD CS5535/CS5536 series LPC bridge also containing timer, watchdog and GPIO.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gcscpcib.c,v 1.6 2008/07/20 22:57:19 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: gcscpcib.c,v 1.7 2009/05/04 12:41:09 cegger Exp $);
 
 #include gpio.h
 
@@ -103,7 +103,7 @@
 #endif
 };
 
-static int	gcscpcib_match(device_t, struct cfdata *, void *);
+static int	gcscpcib_match(device_t, cfdata_t, void *);
 static void	gcscpcib_attach(device_t, device_t, void *);
 
 CFATTACH_DECL_NEW(gcscpcib, sizeof(struct gcscpcib_softc),
@@ -125,7 +125,7 @@
 #endif
 
 static int
-gcscpcib_match(device_t parent, struct cfdata *match, void *aux)
+gcscpcib_match(device_t parent, cfdata_t match, void *aux)
 { 
 	struct pci_attach_args *pa = aux;
 

Index: src/sys/arch/i386/pci/gscpcib.c
diff -u src/sys/arch/i386/pci/gscpcib.c:1.11 src/sys/arch/i386/pci/gscpcib.c:1.12
--- src/sys/arch/i386/pci/gscpcib.c:1.11	Mon May  5 11:49:40 2008
+++ src/sys/arch/i386/pci/gscpcib.c	Mon May  4 12:41:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: gscpcib.c,v 1.11 2008/05/05 11:49:40 xtraeme Exp $	*/
+/*	$NetBSD: gscpcib.c,v 1.12 2009/05/04 12:41:09 cegger Exp $	*/
 /*	$OpenBSD: gscpcib.c,v 1.3 2004/10/05 19:02:33 grange Exp $	*/
 /*
  * Copyright (c) 2004 Alexander Yurchenko gra...@openbsd.org
@@ -23,7 +23,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gscpcib.c,v 1.11 2008/05/05 11:49:40 xtraeme Exp $);
+__KERNEL_RCSID(0, $NetBSD: gscpcib.c,v 1.12 2009/05/04 12:41:09 cegger Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -78,7 +78,7 @@
 }
 
 int
-gscpcib_match(device_t parent, struct cfdata *match, void *aux)
+gscpcib_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct pci_attach_args *pa = aux;
 



CVS commit: src/sys/arch/i386/pci

2009-04-29 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Apr 29 23:18:09 UTC 2009

Modified Files:
src/sys/arch/i386/pci: elan520.c

Log Message:
Delete dead code.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/i386/pci/elan520.c

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

Modified files:

Index: src/sys/arch/i386/pci/elan520.c
diff -u src/sys/arch/i386/pci/elan520.c:1.40 src/sys/arch/i386/pci/elan520.c:1.41
--- src/sys/arch/i386/pci/elan520.c:1.40	Wed Apr  8 23:53:10 2009
+++ src/sys/arch/i386/pci/elan520.c	Wed Apr 29 23:18:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elan520.c,v 1.40 2009/04/08 23:53:10 dyoung Exp $	*/
+/*	$NetBSD: elan520.c,v 1.41 2009/04/29 23:18:09 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: elan520.c,v 1.40 2009/04/08 23:53:10 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: elan520.c,v 1.41 2009/04/29 23:18:09 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -749,15 +749,7 @@
 
 	protsize = end_pa - start_pa;
 
-#if 0
-	/* set PG_SZ, attribute, target, size, address. */
-	par = MMCR_PAR_TARGET_SDRAM | MMCR_PAR_ATTR_NOWRITE | MMCR_PAR_PG_SZ;
-	par |= __SHIFTIN(protsize / sfkb - 1, MMCR_PAR_64KB_SZ);
-	par |= __SHIFTIN(start_pa / sfkb, MMCR_PAR_64KB_ST_ADR);
-	bus_space_write_4(memt, memh, MMCR_PAR(pidx), par);
-#else
 	elansc_protect(sc, pidx, start_pa, protsize);
-#endif
 
 	sc-sc_textpar[tidx++] = pidx;
 
@@ -840,15 +832,7 @@
 
 	aprint_debug_dev(self, protect page 0\n);
 
-#if 0
-	/* set PG_SZ, attribute, target, size, address. */
-	par = MMCR_PAR_TARGET_SDRAM | MMCR_PAR_ATTR_NOWRITE;
-	par |= __SHIFTIN(PG0_PROT_SIZE / PAGE_SIZE - 1, MMCR_PAR_4KB_SZ);
-	par |= __SHIFTIN(pg0_paddr / PAGE_SIZE, MMCR_PAR_4KB_ST_ADR);
-	bus_space_write_4(memt, memh, MMCR_PAR(pidx), par);
-#else
 	elansc_protect(sc, pidx, pg0_paddr, PG0_PROT_SIZE);
-#endif
 	return pidx;
 }
 
@@ -1413,19 +1397,7 @@
 		unable to register watchdog with sysmon\n);
 	}
 	elansc_attached = true;
-#if 0
-	pba.pba_iot = sc-sc_iot;
-	pba.pba_memt = sc-sc_memt;
-	pba.pba_dmat = sc-sc_dmat;
-	pba.pba_dmat64 = sc-sc_dmat64;
-	pba.pba_pc = sc-sc_pc;
-	pba.pba_flags = sc-sc_pciflags;
-	pba.pba_bus = 0;
-	pba.pba_bridgetag = NULL;
-	sc-sc_pci = config_found_ia(self, pcibus, pba, pcibusprint);
-#else
 	elansc_rescan(sc-sc_dev, pcibus, NULL);
-#endif
 }
 
 static int



CVS commit: src/sys/arch/i386/pci

2009-04-29 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Apr 29 23:50:53 UTC 2009

Modified Files:
src/sys/arch/i386/pci: elan520.c

Log Message:
Add elansc_shutdown() for turning off the watchdog.

Don't try to unregister the watchdog in elansc_detach() if we are
shutting the system down, because unregistering is designed to fail if
the watchdog is armed.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/i386/pci/elan520.c

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

Modified files:

Index: src/sys/arch/i386/pci/elan520.c
diff -u src/sys/arch/i386/pci/elan520.c:1.41 src/sys/arch/i386/pci/elan520.c:1.42
--- src/sys/arch/i386/pci/elan520.c:1.41	Wed Apr 29 23:18:09 2009
+++ src/sys/arch/i386/pci/elan520.c	Wed Apr 29 23:50:53 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elan520.c,v 1.41 2009/04/29 23:18:09 dyoung Exp $	*/
+/*	$NetBSD: elan520.c,v 1.42 2009/04/29 23:50:53 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: elan520.c,v 1.41 2009/04/29 23:18:09 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: elan520.c,v 1.42 2009/04/29 23:50:53 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -131,6 +131,7 @@
 static int elansc_rescan(device_t, const char *, const int *);
 
 static void elansc_protect(struct elansc_softc *, int, paddr_t, uint32_t);
+static bool elansc_shutdown(device_t, int);
 
 static const uint32_t sfkb = 64 * 1024, fkb = 4 * 1024;
 
@@ -877,6 +878,20 @@
 	return true;
 }
 
+static bool
+elansc_shutdown(device_t self, int how)
+{
+	struct elansc_softc *sc = device_private(self);
+
+	/* Set up the watchdog registers with some defaults. */
+	elansc_wdogctl_write(sc, WDTMRCTL_WRST_ENB | WDTMRCTL_EXP_SEL30);
+
+	/* ...and clear it. */
+	elansc_wdogctl_reset(sc);
+
+	return true;
+}
+
 static int
 elansc_detach(device_t self, int flags)
 {
@@ -888,7 +903,8 @@
 
 	pmf_device_deregister(self);
 
-	if ((rc = sysmon_wdog_unregister(sc-sc_smw)) != 0) {
+	if ((flags  DETACH_SHUTDOWN) == 0 
+	(rc = sysmon_wdog_unregister(sc-sc_smw)) != 0) {
 		if (rc == ERESTART)
 			rc = EINTR;
 		return rc;
@@ -896,11 +912,7 @@
 
 	mutex_enter(sc-sc_mtx);
 
-	/* Set up the watchdog registers with some defaults. */
-	elansc_wdogctl_write(sc, WDTMRCTL_WRST_ENB | WDTMRCTL_EXP_SEL30);
-
-	/* ...and clear it. */
-	elansc_wdogctl_reset(sc);
+	(void)elansc_shutdown(self, 0);
 
 	bus_space_write_1(sc-sc_memt, sc-sc_memh, MMCR_PICICR, sc-sc_picicr);
 	bus_space_write_1(sc-sc_memt, sc-sc_memh, MMCR_MPICMODE,
@@ -1344,7 +1356,8 @@
 	elansc_wdogctl_reset(sc);
 	mutex_exit(sc-sc_mtx);
 
-	if (!pmf_device_register(self, elansc_suspend, elansc_resume))
+	if (!pmf_device_register1(self, elansc_suspend, elansc_resume,
+	elansc_shutdown))
 		aprint_error_dev(self, could not establish power hooks\n);
 
 #if NGPIO  0