CVS commit: src/sys/dev/cardbus

2022-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 25 17:33:19 UTC 2022

Modified Files:
src/sys/dev/cardbus: adv_cardbus.c if_ath_cardbus.c if_athn_cardbus.c
if_atw_cardbus.c if_bwi_cardbus.c if_fxp_cardbus.c if_ral_cardbus.c
if_rtk_cardbus.c if_rtw_cardbus.c if_tlp_cardbus.c rbus_ppb.c
siisata_cardbus.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/cardbus/adv_cardbus.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/cardbus/if_ath_cardbus.c \
src/sys/dev/cardbus/if_rtw_cardbus.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/cardbus/if_athn_cardbus.c \
src/sys/dev/cardbus/if_bwi_cardbus.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/cardbus/if_atw_cardbus.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/cardbus/if_fxp_cardbus.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/cardbus/if_ral_cardbus.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/cardbus/if_rtk_cardbus.c
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/cardbus/if_tlp_cardbus.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/cardbus/rbus_ppb.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/cardbus/siisata_cardbus.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/cardbus

2022-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 25 17:33:19 UTC 2022

Modified Files:
src/sys/dev/cardbus: adv_cardbus.c if_ath_cardbus.c if_athn_cardbus.c
if_atw_cardbus.c if_bwi_cardbus.c if_fxp_cardbus.c if_ral_cardbus.c
if_rtk_cardbus.c if_rtw_cardbus.c if_tlp_cardbus.c rbus_ppb.c
siisata_cardbus.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/cardbus/adv_cardbus.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/cardbus/if_ath_cardbus.c \
src/sys/dev/cardbus/if_rtw_cardbus.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/cardbus/if_athn_cardbus.c \
src/sys/dev/cardbus/if_bwi_cardbus.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/cardbus/if_atw_cardbus.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/cardbus/if_fxp_cardbus.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/cardbus/if_ral_cardbus.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/cardbus/if_rtk_cardbus.c
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/cardbus/if_tlp_cardbus.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/cardbus/rbus_ppb.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/cardbus/siisata_cardbus.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/cardbus/adv_cardbus.c
diff -u src/sys/dev/cardbus/adv_cardbus.c:1.30 src/sys/dev/cardbus/adv_cardbus.c:1.31
--- src/sys/dev/cardbus/adv_cardbus.c:1.30	Thu Jul 14 10:19:06 2016
+++ src/sys/dev/cardbus/adv_cardbus.c	Sun Sep 25 17:33:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: adv_cardbus.c,v 1.30 2016/07/14 10:19:06 msaitoh Exp $	*/
+/*	$NetBSD: adv_cardbus.c,v 1.31 2022/09/25 17:33:19 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,11 +36,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adv_cardbus.c,v 1.30 2016/07/14 10:19:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adv_cardbus.c,v 1.31 2022/09/25 17:33:19 thorpej Exp $");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Index: src/sys/dev/cardbus/if_ath_cardbus.c
diff -u src/sys/dev/cardbus/if_ath_cardbus.c:1.45 src/sys/dev/cardbus/if_ath_cardbus.c:1.46
--- src/sys/dev/cardbus/if_ath_cardbus.c:1.45	Fri Oct  7 20:47:42 2011
+++ src/sys/dev/cardbus/if_ath_cardbus.c	Sun Sep 25 17:33:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ath_cardbus.c,v 1.45 2011/10/07 20:47:42 dyoung Exp $ */
+/*	$NetBSD: if_ath_cardbus.c,v 1.46 2022/09/25 17:33:19 thorpej Exp $ */
 /*
  * Copyright (c) 2003
  *	Ichiro FUKUHARA .
@@ -30,14 +30,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ath_cardbus.c,v 1.45 2011/10/07 20:47:42 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ath_cardbus.c,v 1.46 2022/09/25 17:33:19 thorpej Exp $");
 
 #include "opt_inet.h"
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
Index: src/sys/dev/cardbus/if_rtw_cardbus.c
diff -u src/sys/dev/cardbus/if_rtw_cardbus.c:1.45 src/sys/dev/cardbus/if_rtw_cardbus.c:1.46
--- src/sys/dev/cardbus/if_rtw_cardbus.c:1.45	Thu Jul  7 06:55:41 2016
+++ src/sys/dev/cardbus/if_rtw_cardbus.c	Sun Sep 25 17:33:19 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: if_rtw_cardbus.c,v 1.45 2016/07/07 06:55:41 msaitoh Exp $ */
+/* $NetBSD: if_rtw_cardbus.c,v 1.46 2022/09/25 17:33:19 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2004, 2005 David Young.  All rights reserved.
@@ -64,14 +64,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rtw_cardbus.c,v 1.45 2016/07/07 06:55:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rtw_cardbus.c,v 1.46 2022/09/25 17:33:19 thorpej Exp $");
 
 #include "opt_inet.h"
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Index: src/sys/dev/cardbus/if_athn_cardbus.c
diff -u src/sys/dev/cardbus/if_athn_cardbus.c:1.2 src/sys/dev/cardbus/if_athn_cardbus.c:1.3
--- src/sys/dev/cardbus/if_athn_cardbus.c:1.2	Wed Apr  3 14:20:02 2013
+++ src/sys/dev/cardbus/if_athn_cardbus.c	Sun Sep 25 17:33:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_cardbus.c,v 1.2 2013/04/03 14:20:02 christos Exp $	*/
+/*	$NetBSD: if_athn_cardbus.c,v 1.3 2022/09/25 17:33:19 thorpej Exp $	*/
 /*	$OpenBSD: if_athn_cardbus.c,v 1.13 2011/01/08 10:02:32 damien Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_athn_cardbus.c,v 1.2 2013/04/03 14:20:02 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_cardbus.c,v 1.3 2022/09/25 17:33:19 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -32,7 +32,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_athn_card
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
Index: src/sys/dev/cardbus/if_bwi_cardbus.c
diff -u src/sys/dev/cardbus/if_bwi_cardbus.c:1.2 src/sys/dev/cardbus/if_bwi_cardbus.c:1.3
--- src/sys/dev/cardbus/if_bwi_cardbus.c:1.2	Thu Apr 12 12:52:58 2012
+++ src/sys/dev/cardbus/if_bwi_cardbus.c	Sun Sep 25 17:33:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bwi_cardbus.c,v 1.2 2012/04/12 12:52:58 nakayama Exp $ */
+/*	$NetBSD: if_bwi_cardbus.c,v 1.3 2022/09/25 17:33:19 

CVS commit: src/sys/dev/cardbus

2022-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar 26 13:41:16 UTC 2022

Modified Files:
src/sys/dev/cardbus: cardbus.c

Log Message:
When reading CIS tuples from a BAR, do not blindly copy 2k of data (or
to the end of the BAR space), but instead follow the tuples and stop
reading once we reach the end of the list.
I have a card

bwi0 at cardbus0 function 0: Broadcom Wireless
bwi0: BBP id 0x4306, BBP rev 0x2, BBP pkg 0

where the BAR claims 8k space but seems to only implement 6k (but that
is impossible to report as the spec only allows 2^n sizes) and the CIS
starts at a bit over 4k (so the old code tried reading beyound the 6k
limit and caused pci bus errors).

An alternative would be to avoid reporting bus errors during this access,
but since we are only interested in the CIS chain anyway (and that ends
way earlier) this is a simpler solution.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/cardbus/cardbus.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/cardbus

2022-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar 26 13:41:16 UTC 2022

Modified Files:
src/sys/dev/cardbus: cardbus.c

Log Message:
When reading CIS tuples from a BAR, do not blindly copy 2k of data (or
to the end of the BAR space), but instead follow the tuples and stop
reading once we reach the end of the list.
I have a card

bwi0 at cardbus0 function 0: Broadcom Wireless
bwi0: BBP id 0x4306, BBP rev 0x2, BBP pkg 0

where the BAR claims 8k space but seems to only implement 6k (but that
is impossible to report as the spec only allows 2^n sizes) and the CIS
starts at a bit over 4k (so the old code tried reading beyound the 6k
limit and caused pci bus errors).

An alternative would be to avoid reporting bus errors during this access,
but since we are only interested in the CIS chain anyway (and that ends
way earlier) this is a simpler solution.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/cardbus/cardbus.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/cardbus/cardbus.c
diff -u src/sys/dev/cardbus/cardbus.c:1.113 src/sys/dev/cardbus/cardbus.c:1.114
--- src/sys/dev/cardbus/cardbus.c:1.113	Mon Nov  1 21:28:03 2021
+++ src/sys/dev/cardbus/cardbus.c	Sat Mar 26 13:41:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cardbus.c,v 1.113 2021/11/01 21:28:03 andvar Exp $	*/
+/*	$NetBSD: cardbus.c,v 1.114 2022/03/26 13:41:16 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999 and 2000
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.113 2021/11/01 21:28:03 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.114 2022/03/26 13:41:16 martin Exp $");
 
 #include "opt_cardbus.h"
 
@@ -163,6 +163,7 @@ cardbus_read_tuples(struct cardbus_attac
 	pcireg_t reg;
 	int found = 0;
 	int cardbus_space = cis_ptr & CARDBUS_CIS_ASIMASK;
+	size_t mlen, n, tlen;
 	int i, j;
 
 	memset(tuples, 0, len);
@@ -262,10 +263,28 @@ cardbus_read_tuples(struct cardbus_attac
 			cardbus_conf_write(cc, cf, tag,
 			PCI_COMMAND_STATUS_REG,
 			command | PCI_COMMAND_MEM_ENABLE);
-			/* XXX byte order? */
-			bus_space_read_region_1(bar_tag, bar_memh,
-			cis_ptr, tuples,
-			MIN(bar_size - MIN(bar_size, cis_ptr), len));
+
+			mlen = MIN(bar_size - MIN(bar_size, cis_ptr), len);
+			for (n = 0; n < mlen; ) {
+tuples[n] = bus_space_read_1(bar_tag, bar_memh,
+cis_ptr+n);
+if (tuples[n] == PCMCIA_CISTPL_END)
+	break;
+if (tuples[n] == PCMCIA_CISTPL_NULL) {
+	n++;
+	continue;
+}
+n++;
+tuples[n] = bus_space_read_1(bar_tag, bar_memh,
+cis_ptr+n);
+tlen = tuples[n];
+n++;
+if (n+tlen >= mlen)
+	break;
+bus_space_read_region_1(bar_tag, bar_memh,
+cis_ptr+n, tuples+n, tlen);
+n += tlen;
+			}
 			found++;
 		}
 		command = cardbus_conf_read(cc, cf, tag,



CVS commit: src/sys/dev/cardbus

2010-03-10 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar 10 21:00:36 UTC 2010

Modified Files:
src/sys/dev/cardbus: if_ex_cardbus.c

Log Message:
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

Tested by me.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/cardbus/if_ex_cardbus.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/cardbus

2010-03-10 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar 10 21:00:36 UTC 2010

Modified Files:
src/sys/dev/cardbus: if_ex_cardbus.c

Log Message:
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

Tested by me.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/cardbus/if_ex_cardbus.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/cardbus/if_ex_cardbus.c
diff -u src/sys/dev/cardbus/if_ex_cardbus.c:1.50 src/sys/dev/cardbus/if_ex_cardbus.c:1.51
--- src/sys/dev/cardbus/if_ex_cardbus.c:1.50	Fri Feb 26 00:57:02 2010
+++ src/sys/dev/cardbus/if_ex_cardbus.c	Wed Mar 10 21:00:36 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ex_cardbus.c,v 1.50 2010/02/26 00:57:02 dyoung Exp $	*/
+/*	$NetBSD: if_ex_cardbus.c,v 1.51 2010/03/10 21:00:36 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998 and 1999
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ex_cardbus.c,v 1.50 2010/02/26 00:57:02 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ex_cardbus.c,v 1.51 2010/03/10 21:00:36 dyoung Exp $);
 
 /* #define EX_DEBUG 4 */	/* define to report information for debugging */
 
@@ -215,10 +215,6 @@
 	struct ex_softc *sc = csc-sc_softc;
 	struct cardbus_attach_args *ca = aux;
 	cardbus_devfunc_t ct = ca-ca_ct;
-#if rbus
-#else
-	cardbus_chipset_tag_t cc = ct-ct_cc;
-#endif
 	const struct ex_cardbus_product *ecp;
 	bus_addr_t adr, adr1;
 
@@ -244,10 +240,6 @@
 
 	if (Cardbus_mapreg_map(ct, PCI_BAR0, PCI_MAPREG_TYPE_IO, 0,
 		sc-sc_iot, sc-sc_ioh, adr, csc-sc_mapsize) == 0) {
-#if rbus
-#else
-		(*ct-ct_cf-cardbus_io_open)(cc, 0, adr, adr + csc-sc_mapsize);
-#endif
 		csc-sc_bar_reg = PCI_BAR0;
 		csc-sc_bar_val = adr | PCI_MAPREG_TYPE_IO;
 
@@ -326,7 +318,7 @@
 		/*
 		 * Unhook the interrupt handler.
 		 */
-		cardbus_intr_disestablish(ct-ct_cc, ct-ct_cf, sc-sc_ih);
+		Cardbus_intr_disestablish(ct, sc-sc_ih);
 
 		if (csc-sc_cardtype == EX_CB_CYCLONE) {
 			Cardbus_mapreg_unmap(ct,
@@ -344,13 +336,11 @@
 ex_cardbus_enable(struct ex_softc *sc)
 {
 	struct ex_cardbus_softc *csc = (struct ex_cardbus_softc *)sc;
-	cardbus_function_tag_t cf = csc-sc_ct-ct_cf;
-	cardbus_chipset_tag_t cc = csc-sc_ct-ct_cc;
 
 	Cardbus_function_enable(csc-sc_ct);
 	ex_cardbus_setup(csc);
 
-	sc-sc_ih = cardbus_intr_establish(cc, cf, csc-sc_intrline,
+	sc-sc_ih = Cardbus_intr_establish(csc-sc_ct, csc-sc_intrline,
 	IPL_NET, ex_intr, sc);
 	if (NULL == sc-sc_ih) {
 		aprint_error_dev(sc-sc_dev, couldn't establish interrupt\n);



CVS commit: src/sys/dev/cardbus

2010-03-09 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar 10 00:21:10 UTC 2010

Modified Files:
src/sys/dev/cardbus: ehci_cardbus.c if_tlp_cardbus.c ohci_cardbus.c

Log Message:
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

Tested by Klaus Heinz.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/cardbus/ehci_cardbus.c
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/cardbus/if_tlp_cardbus.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/cardbus/ohci_cardbus.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/cardbus

2010-03-09 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar 10 00:21:10 UTC 2010

Modified Files:
src/sys/dev/cardbus: ehci_cardbus.c if_tlp_cardbus.c ohci_cardbus.c

Log Message:
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

Tested by Klaus Heinz.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/cardbus/ehci_cardbus.c
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/cardbus/if_tlp_cardbus.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/cardbus/ohci_cardbus.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/cardbus/ehci_cardbus.c
diff -u src/sys/dev/cardbus/ehci_cardbus.c:1.27 src/sys/dev/cardbus/ehci_cardbus.c:1.28
--- src/sys/dev/cardbus/ehci_cardbus.c:1.27	Fri Feb 26 00:57:01 2010
+++ src/sys/dev/cardbus/ehci_cardbus.c	Wed Mar 10 00:21:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_cardbus.c,v 1.27 2010/02/26 00:57:01 dyoung Exp $	*/
+/*	$NetBSD: ehci_cardbus.c,v 1.28 2010/03/10 00:21:10 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ehci_cardbus.c,v 1.27 2010/02/26 00:57:01 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: ehci_cardbus.c,v 1.28 2010/03/10 00:21:10 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -153,11 +153,6 @@
 	sc-sc_ct = ct;
 	sc-sc.sc_bus.dmatag = ca-ca_dmat;
 
-#if rbus
-#else
-XXX	(ct-ct_cf-cardbus_mem_open)(cc, 0, iob, iob + 0x40);
-#endif
-
 	/* Enable the device. */
 	csr = Cardbus_conf_read(ct, ca-ca_tag, PCI_COMMAND_STATUS_REG);
 	Cardbus_conf_write(ct, ca-ca_tag, PCI_COMMAND_STATUS_REG,
@@ -169,7 +164,7 @@
 	DPRINTF((%s: offs=%d\n, devname, sc-sc.sc_offs));
 	EOWRITE2(sc-sc, EHCI_USBINTR, 0);
 
-	sc-sc_ih = cardbus_intr_establish(cc, cf, ca-ca_intrline,
+	sc-sc_ih = Cardbus_intr_establish(ct, ca-ca_intrline,
 	   IPL_USB, ehci_intr, sc);
 	if (sc-sc_ih == NULL) {
 		printf(%s: couldn't establish interrupt\n, devname);
@@ -206,7 +201,7 @@
 		printf(%s: init failed, error=%d\n, devname, r);
 
 		/* Avoid spurious interrupts. */
-		cardbus_intr_disestablish(sc-sc_cc, sc-sc_cf, sc-sc_ih);
+		Cardbus_intr_disestablish(ct, sc-sc_ih);
 		sc-sc_ih = NULL;
 
 		return;
@@ -231,7 +226,7 @@
 	if (rv)
 		return (rv);
 	if (sc-sc_ih != NULL) {
-		cardbus_intr_disestablish(sc-sc_cc, sc-sc_cf, sc-sc_ih);
+		Cardbus_intr_disestablish(ct, sc-sc_ih);
 		sc-sc_ih = NULL;
 	}
 	if (sc-sc.sc_size) {

Index: src/sys/dev/cardbus/if_tlp_cardbus.c
diff -u src/sys/dev/cardbus/if_tlp_cardbus.c:1.66 src/sys/dev/cardbus/if_tlp_cardbus.c:1.67
--- src/sys/dev/cardbus/if_tlp_cardbus.c:1.66	Fri Feb 26 00:57:02 2010
+++ src/sys/dev/cardbus/if_tlp_cardbus.c	Wed Mar 10 00:21:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tlp_cardbus.c,v 1.66 2010/02/26 00:57:02 dyoung Exp $	*/
+/*	$NetBSD: if_tlp_cardbus.c,v 1.67 2010/03/10 00:21:10 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_tlp_cardbus.c,v 1.66 2010/02/26 00:57:02 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_tlp_cardbus.c,v 1.67 2010/03/10 00:21:10 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -307,20 +307,12 @@
 	if (Cardbus_mapreg_map(ct, TULIP_PCI_MMBA,
 	PCI_MAPREG_TYPE_MEM, 0, sc-sc_st, sc-sc_sh, adr,
 	csc-sc_mapsize) == 0) {
-#if rbus
-#else
-		(*ct-ct_cf-cardbus_mem_open)(cc, 0, adr, adr+csc-sc_mapsize);
-#endif
 		csc-sc_csr |= PCI_COMMAND_MEM_ENABLE;
 		csc-sc_bar_reg = TULIP_PCI_MMBA;
 		csc-sc_bar_val = adr | PCI_MAPREG_TYPE_MEM;
 	} else if (Cardbus_mapreg_map(ct, TULIP_PCI_IOBA,
 	PCI_MAPREG_TYPE_IO, 0, sc-sc_st, sc-sc_sh, adr,
 	csc-sc_mapsize) == 0) {
-#if rbus
-#else
-		(*ct-ct_cf-cardbus_io_open)(cc, 0, adr, adr+csc-sc_mapsize);
-#endif
 		csc-sc_csr |= PCI_COMMAND_IO_ENABLE;
 		csc-sc_bar_reg = TULIP_PCI_IOBA;
 		csc-sc_bar_val = adr | PCI_MAPREG_TYPE_IO;
@@ -472,7 +464,7 @@
 	 * Unhook the interrupt handler.
 	 */
 	if (csc-sc_ih != NULL)
-		cardbus_intr_disestablish(ct-ct_cc, ct-ct_cf, csc-sc_ih);
+		Cardbus_intr_disestablish(ct, csc-sc_ih);
 
 	/*
 	 * Release bus space and close window.
@@ -489,8 +481,6 @@
 {
 	struct tulip_cardbus_softc *csc = (void *) sc;
 	cardbus_devfunc_t ct = csc-sc_ct;
-	cardbus_chipset_tag_t cc = ct-ct_cc;
-	cardbus_function_tag_t cf = ct-ct_cf;
 
 	/*
 	 * Power on the socket.
@@ -505,7 +495,7 @@
 	/*
 	 * Map and establish the interrupt.
 	 */
-	csc-sc_ih = cardbus_intr_establish(cc, cf, csc-sc_intrline, IPL_NET,
+	csc-sc_ih = Cardbus_intr_establish(ct, csc-sc_intrline, IPL_NET,
 	tlp_intr, sc);
 	if (csc-sc_ih == NULL) {
 		aprint_error_dev(sc-sc_dev,
@@ 

CVS commit: src/sys/dev/cardbus

2010-03-05 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar  5 22:47:03 UTC 2010

Modified Files:
src/sys/dev/cardbus: rbus_ppb.c

Log Message:
Remove dead code (it is commented out).

Delete the detach routine, it's obviously not finished.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/cardbus/rbus_ppb.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/cardbus/rbus_ppb.c
diff -u src/sys/dev/cardbus/rbus_ppb.c:1.38 src/sys/dev/cardbus/rbus_ppb.c:1.39
--- src/sys/dev/cardbus/rbus_ppb.c:1.38	Thu Mar  4 18:49:14 2010
+++ src/sys/dev/cardbus/rbus_ppb.c	Fri Mar  5 22:47:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rbus_ppb.c,v 1.38 2010/03/04 18:49:14 dyoung Exp $	*/
+/*	$NetBSD: rbus_ppb.c,v 1.39 2010/03/05 22:47:03 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rbus_ppb.c,v 1.38 2010/03/04 18:49:14 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: rbus_ppb.c,v 1.39 2010/03/05 22:47:03 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -78,7 +78,6 @@
 
 static int  ppb_cardbus_match(device_t, cfdata_t, void *);
 static void ppb_cardbus_attach(device_t, device_t, void *);
-static int  ppb_cardbus_detach(device_t  self, int flags);
 static int  ppb_activate(device_t, enum devact);
 int rppbprint(void *, const char *);
 int rbus_intr_fixup(pci_chipset_tag_t, int, int, int);
@@ -104,7 +103,7 @@
 };
 
 CFATTACH_DECL_NEW(rbus_ppb, sizeof(struct ppb_cardbus_softc),
-ppb_cardbus_match, ppb_cardbus_attach, ppb_cardbus_detach, ppb_activate);
+ppb_cardbus_match, ppb_cardbus_attach, NULL, ppb_activate);
 
 #ifdef  CBB_DEBUG
 int rbus_ppb_debug = 0;   /* hack with kdb */
@@ -509,8 +508,6 @@
 int bus, device, function, command;
 	struct rbus_pci_addr_fixup_context *rct =
 	  (struct rbus_pci_addr_fixup_context *)context;
-	//cardbus_chipset_tag_t ct = rct-ct;
-	//	struct cardbus_softc *sc = rct-sc;
 
 	pci_decompose_tag(pc, tag, bus, device, function);
 
@@ -731,45 +728,6 @@
 	config_found_ia(self, pcibus, pba, rppbprint);
 }
 
-static int
-ppb_cardbus_detach(device_t self, int flags)
-{
-  /* struct ppb_softc *sc = device_private(self);*/
-	struct ppb_cardbus_softc *csc = device_private(self);
-
-#if 0
-	struct cardbus_devfunc *ct = csc-ct;
-	int rv, reg;
-
-#ifdef DIAGNOSTIC
-	if (ct == NULL)
-		panic(%s: data structure lacks, device_xname(sc-sc_dev));
-#endif
-
-	rv = fxp_detach(sc);
-	if (rv == 0) {
-		/*
-		 * Unhook the interrupt handler.
-		 */
-		Cardbus_intr_disestablish(ct, sc-sc_ih);
-
-		/*
-		 * release bus space and close window
-		 */
-		if (csc-base0_reg)
-			reg = PCI_BAR0;
-		else
-			reg = PCI_BAR1;
-		Cardbus_mapreg_unmap(ct, reg, sc-sc_st, sc-sc_sh, csc-size);
-	}
-	return (rv);
-
-#endif
-	csc-foo=1;
-	return 0;
-
-}
-
 int
 ppb_activate(device_t self, enum devact act)
 {



CVS commit: src/sys/dev/cardbus

2010-03-05 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar  5 22:47:03 UTC 2010

Modified Files:
src/sys/dev/cardbus: rbus_ppb.c

Log Message:
Remove dead code (it is commented out).

Delete the detach routine, it's obviously not finished.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/cardbus/rbus_ppb.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/cardbus

2010-03-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Mar  4 16:40:54 UTC 2010

Modified Files:
src/sys/dev/cardbus: siisata_cardbus.c

Log Message:
Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

Tested by kiyoh...@.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/cardbus/siisata_cardbus.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/cardbus/siisata_cardbus.c
diff -u src/sys/dev/cardbus/siisata_cardbus.c:1.10 src/sys/dev/cardbus/siisata_cardbus.c:1.11
--- src/sys/dev/cardbus/siisata_cardbus.c:1.10	Fri Feb 26 00:57:02 2010
+++ src/sys/dev/cardbus/siisata_cardbus.c	Thu Mar  4 16:40:54 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata_cardbus.c,v 1.10 2010/02/26 00:57:02 dyoung Exp $ */
+/* $NetBSD: siisata_cardbus.c,v 1.11 2010/03/04 16:40:54 dyoung Exp $ */
 /* Id: siisata_pci.c,v 1.11 2008/05/21 16:20:11 jakllsch Exp  */
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: siisata_cardbus.c,v 1.10 2010/02/26 00:57:02 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: siisata_cardbus.c,v 1.11 2010/03/04 16:40:54 dyoung Exp $);
 
 #include sys/types.h
 #include sys/malloc.h
@@ -225,7 +225,7 @@
 	sc-sc_dmat = ca-ca_dmat;
 
 	/* map interrupt */
-	csc-sc_ih = cardbus_intr_establish(cc, cf, ca-ca_intrline, IPL_BIO,
+	csc-sc_ih = Cardbus_intr_establish(ct, ca-ca_intrline, IPL_BIO,
 	siisata_intr, sc);
 	if (csc-sc_ih == NULL) {
 		Cardbus_conf_write(ct, ca-ca_tag, SIISATA_CARDBUS_BAR0, 0);
@@ -287,7 +287,7 @@
 	if (rv)
 		return (rv);
 	if (csc-sc_ih != NULL) {
-		cardbus_intr_disestablish(csc-sc_cc, csc-sc_cf, csc-sc_ih);
+		Cardbus_intr_disestablish(ct, csc-sc_ih);
 		csc-sc_ih = NULL;
 	}
 	if (csc-sc_grsize) {



CVS commit: src/sys/dev/cardbus

2010-03-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Mar  4 18:31:57 UTC 2010

Modified Files:
src/sys/dev/cardbus: rbus_ppb.c

Log Message:
Delete unfinished and unreachable code: ppb_cardbus_setup(),
ppb_cardbus_enable(), ppb_cardbus_disable().


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/cardbus/rbus_ppb.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/cardbus

2010-03-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Mar  4 18:31:57 UTC 2010

Modified Files:
src/sys/dev/cardbus: rbus_ppb.c

Log Message:
Delete unfinished and unreachable code: ppb_cardbus_setup(),
ppb_cardbus_enable(), ppb_cardbus_disable().


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/cardbus/rbus_ppb.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/cardbus/rbus_ppb.c
diff -u src/sys/dev/cardbus/rbus_ppb.c:1.36 src/sys/dev/cardbus/rbus_ppb.c:1.37
--- src/sys/dev/cardbus/rbus_ppb.c:1.36	Wed Mar  3 00:56:41 2010
+++ src/sys/dev/cardbus/rbus_ppb.c	Thu Mar  4 18:31:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rbus_ppb.c,v 1.36 2010/03/03 00:56:41 dyoung Exp $	*/
+/*	$NetBSD: rbus_ppb.c,v 1.37 2010/03/04 18:31:57 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rbus_ppb.c,v 1.36 2010/03/03 00:56:41 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: rbus_ppb.c,v 1.37 2010/03/04 18:31:57 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -78,9 +78,6 @@
 static int  ppb_cardbus_match(device_t, cfdata_t, void *);
 static void ppb_cardbus_attach(device_t, device_t, void *);
 static int  ppb_cardbus_detach(device_t  self, int flags);
-/*static*/ void ppb_cardbus_setup(struct ppb_softc * sc);
-/*static*/ int  ppb_cardbus_enable(struct ppb_softc * sc);
-/*static*/ void ppb_cardbus_disable(struct ppb_softc * sc);
 static int  ppb_activate(device_t, enum devact);
 int rppbprint(void *, const char *);
 int rbus_intr_fixup(pci_chipset_tag_t, int, int, int);
@@ -729,83 +726,6 @@
 	config_found_ia(self, pcibus, pba, rppbprint);
 }
 
-void
-ppb_cardbus_setup(struct ppb_softc * sc)
-{
-	struct ppb_cardbus_softc *csc = (struct ppb_cardbus_softc *) sc;
-#if 0
-	cardbus_chipset_tag_t cc  = psc-sc_cc;
-	cardbus_function_tag_t cf = psc-sc_cf;
-#endif
-
-	/* shut up compiler */
-	csc-foo=2;
-
-	printf(ppb_cardbus_setup called\n);
-#if 0
-	/* not sure what to do here */
-	pcitag_t tag = csc-sc_tag;
-
-	command = Cardbus_conf_read(csc-ct, tag, PCI_COMMAND_STATUS_REG);
-	if (csc-base0_reg) {
-		Cardbus_conf_write(csc-ct, tag,
-		PCI_BAR0, csc-base0_reg);
-		command |= PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE;
-	} else if (csc-base1_reg) {
-		Cardbus_conf_write(csc-ct, tag,
-		PCI_BAR1, csc-base1_reg);
-		command |= (PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MASTER_ENABLE);
-	}
-
-	/* enable the card */
-	Cardbus_conf_write(csc-ct, tag, PCI_COMMAND_STATUS_REG, command);
-#endif
-}
-
-int
-ppb_cardbus_enable(struct ppb_softc * sc)
-{
-#if 0
-	struct ppb_cardbus_softc *csc = (struct ppb_cardbus_softc *) sc;
-	struct cardbus_softc *psc = device_private(device_parent(sc-sc_dev));
-	cardbus_chipset_tag_t cc = psc-sc_cc;
-	cardbus_function_tag_t cf = psc-sc_cf;
-
-	Cardbus_function_enable(csc-ct);
-
-	fxp_cardbus_setup(sc);
-
-	/* Map and establish the interrupt. */
-
-	sc-sc_ih = Cardbus_intr_establish(ct, psc-sc_intrline, IPL_NET,
-	fxp_intr, sc);
-	if (NULL == sc-sc_ih) {
-		aprint_error_dev(sc-sc_dev, couldn't establish interrupt\n);
-		return 1;
-	}
-
-	printf(%s: interrupting at %d\n, device_xname(sc-sc_dev),
-	psc-sc_intrline);
-
-#endif
-	return 0;
-}
-
-void
-ppb_cardbus_disable(struct ppb_softc * sc)
-{
-#if 0
-	struct cardbus_softc *psc = device_private(device_parent(sc-sc_dev));
-	cardbus_chipset_tag_t cc = psc-sc_cc;
-	cardbus_function_tag_t cf = psc-sc_cf;
-
-	/* Remove interrupt handler. */
-	Cardbus_intr_disestablish(ct, sc-sc_ih);
-
-	Cardbus_function_disable(((struct fxp_cardbus_softc *) sc)-ct);
-#endif
-}
-
 static int
 ppb_cardbus_detach(device_t self, int flags)
 {



CVS commit: src/sys/dev/cardbus

2010-03-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Mar  4 18:49:14 UTC 2010

Modified Files:
src/sys/dev/cardbus: rbus_ppb.c

Log Message:
It turns out that ppb at cardbus was not even in ALL.  It has probably
not been compiled in a very long time.  With some minor changes, it was
possible to make it compile:

Use kmem_zalloc()/kmem_free() instead of alloca()/memset().

Use %zu and %zx for printf'ing bus_size_t.

Delete the declaration of an unused local variable.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/cardbus/rbus_ppb.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/cardbus

2010-03-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Mar  4 18:49:14 UTC 2010

Modified Files:
src/sys/dev/cardbus: rbus_ppb.c

Log Message:
It turns out that ppb at cardbus was not even in ALL.  It has probably
not been compiled in a very long time.  With some minor changes, it was
possible to make it compile:

Use kmem_zalloc()/kmem_free() instead of alloca()/memset().

Use %zu and %zx for printf'ing bus_size_t.

Delete the declaration of an unused local variable.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/cardbus/rbus_ppb.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/cardbus/rbus_ppb.c
diff -u src/sys/dev/cardbus/rbus_ppb.c:1.37 src/sys/dev/cardbus/rbus_ppb.c:1.38
--- src/sys/dev/cardbus/rbus_ppb.c:1.37	Thu Mar  4 18:31:57 2010
+++ src/sys/dev/cardbus/rbus_ppb.c	Thu Mar  4 18:49:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rbus_ppb.c,v 1.37 2010/03/04 18:31:57 dyoung Exp $	*/
+/*	$NetBSD: rbus_ppb.c,v 1.38 2010/03/04 18:49:14 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rbus_ppb.c,v 1.37 2010/03/04 18:31:57 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: rbus_ppb.c,v 1.38 2010/03/04 18:49:14 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -45,6 +45,7 @@
 #include sys/ioctl.h
 #include sys/errno.h
 #include sys/device.h
+#include sys/kmem.h
 
 #if NRND  0
 #include sys/rnd.h
@@ -231,10 +232,11 @@
 		struct cardbus_softc *sc,
 		pci_chipset_tag_t pc,
 		struct cardbus_attach_args *caa,
-		int minbus, int maxbus)
+		int minbus, const int maxbus)
 {
 	struct rbus_pci_addr_fixup_context rct;
-	intsize, busnum;
+	const size_t size = sizeof(bus_size_t[maxbus+1]);
+	int busnum;
 	bus_addr_t start;
 	bus_space_handle_t handle;
 	u_int32_t reg;
@@ -245,14 +247,13 @@
 	rct.caa=caa;
 	rct.minbus = minbus;
 	rct.maxbus = maxbus;
-	size = sizeof(bus_size_t)*(maxbus+1);
-	rct.bussize_ioreqs  = alloca(size);
-	rct.bussize_memreqs = alloca(size);
-	rct.iobustags = alloca(maxbus * sizeof(rbus_tag_t));
-	rct.membustags = alloca(maxbus * sizeof(rbus_tag_t));
-
-	memset(rct.bussize_ioreqs, 0, size);
-	memset(rct.bussize_memreqs, 0, size);
+	if ((rct.bussize_ioreqs  = kmem_zalloc(size, KM_SLEEP)) == NULL ||
+	(rct.bussize_memreqs = kmem_zalloc(size, KM_SLEEP)) == NULL ||
+	(rct.iobustags =
+	 kmem_zalloc(maxbus * sizeof(rbus_tag_t), KM_SLEEP)) == NULL ||
+	(rct.membustags =
+	 kmem_zalloc(maxbus * sizeof(rbus_tag_t), KM_SLEEP)) == NULL)
+		panic(%s: memory allocation failed, __func__);
 
 	printf(%s: sizing buses %d-%d\n,
 	   device_xname(rct.csc-sc_dev),
@@ -297,7 +298,7 @@
 	rct.bussize_memreqs[minbus] =
 	  rbus_round_up(rct.bussize_memreqs[minbus], 8);
 
-	printf(%s: total needs IO %08lx and MEM %08lx\n,
+	printf(%s: total needs IO %08zx and MEM %08zx\n,
 	   device_xname(rct.csc-sc_dev),
 	   rct.bussize_ioreqs[minbus], rct.bussize_memreqs[minbus]);
 
@@ -313,7 +314,7 @@
 			  /* flags */ 0,
 			  start,
 			  handle) != 0) {
-	panic(rbus_ppb: can not allocate %ld bytes in IO bus %d,
+	panic(rbus_ppb: can not allocate %zu bytes in IO bus %d,
 		  rct.bussize_ioreqs[minbus], minbus);
 	  }
 	  rct.iobustags[minbus]=rbus_new(caa-ca_rbus_iot,
@@ -332,7 +333,7 @@
 			  /* flags */ 0,
 			  start,
 			  handle) != 0) {
-	panic(%s: can not allocate %ld bytes in MEM bus %d,
+	panic(%s: can not allocate %zu bytes in MEM bus %d,
 		  device_xname(rct.csc-sc_dev),
 		  rct.bussize_memreqs[minbus], minbus);
 	  }
@@ -350,7 +351,7 @@
 
 	  busparent = pci_bus_parent[busnum];
 
-	  printf(%s: bus %d (parent=%d) needs IO %08lx and MEM %08lx\n,
+	  printf(%s: bus %d (parent=%d) needs IO %08zx and MEM %08zx\n,
 		 device_xname(rct.csc-sc_dev),
 		 busnum,
 		 busparent,
@@ -370,7 +371,7 @@
 /* flags */ 0,
 start,
 handle) != 0) {
-	  panic(rbus_ppb: can not allocate %ld bytes in IO bus %d,
+	  panic(rbus_ppb: can not allocate %zu bytes in IO bus %d,
 		rct.bussize_ioreqs[busnum], busnum);
 	}
 	rct.iobustags[busnum]=rbus_new(rct.iobustags[busparent],
@@ -407,7 +408,7 @@
 /* flags */ 0,
 start,
 handle) != 0) {
-	  panic(rbus_ppb: can not allocate %ld bytes in MEM bus %d,
+	  panic(rbus_ppb: can not allocate %zu bytes in MEM bus %d,
 		rct.bussize_memreqs[busnum], busnum);
 	}
 	rct.membustags[busnum]=rbus_new(rct.membustags[busparent],
@@ -453,6 +454,11 @@
 	   minbus, maxbus);
 	pci_device_foreach_min(pc, minbus, maxbus,
 			   rbus_pci_phys_allocate, rct);
+
+	kmem_free(rct.bussize_ioreqs, size);
+	kmem_free(rct.bussize_memreqs, size);
+	kmem_free(rct.iobustags, maxbus * sizeof(rbus_tag_t));
+	kmem_free(rct.membustags, maxbus * sizeof(rbus_tag_t));
 }
 
 static void
@@ -624,7 +630,6 @@
 	struct 

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

2010-03-04 Thread Jason Thorpe

On Mar 4, 2010, at 10:49 AM, David Young wrote:

 Use %zu and %zx for printf'ing bus_size_t.

These aren't quite right.  We should probably define PRIxxx macros for the 
bus.h scalar types.

-- thorpej



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

2010-03-04 Thread Matt Thomas

On Mar 4, 2010, at 11:13 AM, Jason Thorpe wrote:

 
 On Mar 4, 2010, at 10:49 AM, David Young wrote:
 
 Use %zu and %zx for printf'ing bus_size_t.
 
 These aren't quite right.  We should probably define PRIxxx macros for the 
 bus.h scalar types.

For mips, I made bus_space_handle_t intptr_t and defined PRIxBSH as PRIxPTR and 
PRIxBUSADDR as PRIxPADDR.

CVS commit: src/sys/dev/cardbus

2010-03-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Mar  4 22:33:12 UTC 2010

Modified Files:
src/sys/dev/cardbus: if_rtw_cardbus.c

Log Message:
Remove unnecessary #ifdef INET-enclosed #includes.

This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/cardbus/if_rtw_cardbus.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/cardbus/if_rtw_cardbus.c
diff -u src/sys/dev/cardbus/if_rtw_cardbus.c:1.38 src/sys/dev/cardbus/if_rtw_cardbus.c:1.39
--- src/sys/dev/cardbus/if_rtw_cardbus.c:1.38	Fri Feb 26 01:12:56 2010
+++ src/sys/dev/cardbus/if_rtw_cardbus.c	Thu Mar  4 22:33:12 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: if_rtw_cardbus.c,v 1.38 2010/02/26 01:12:56 dyoung Exp $ */
+/* $NetBSD: if_rtw_cardbus.c,v 1.39 2010/03/04 22:33:12 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2004, 2005 David Young.  All rights reserved.
@@ -64,7 +64,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_rtw_cardbus.c,v 1.38 2010/02/26 01:12:56 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_rtw_cardbus.c,v 1.39 2010/03/04 22:33:12 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -89,12 +89,6 @@
 #include net80211/ieee80211_radiotap.h
 #include net80211/ieee80211_var.h
 
-#ifdef INET
-#include netinet/in.h
-#include netinet/if_inarp.h
-#endif
-
-
 #include sys/bus.h
 #include sys/intr.h
 
@@ -246,10 +240,6 @@
 		RTW_DPRINTF(RTW_DEBUG_ATTACH,
 		(%s: %s mapped % PRIuMAX  bytes mem space\n,
 		 device_xname(self), __func__, (uintmax_t)regs-r_sz));
-#if rbus
-#else
-		(*ct-ct_cf-cardbus_mem_open)(cc, 0, adr, adr+csc-sc_mapsize);
-#endif
 		csc-sc_csr |= PCI_COMMAND_MEM_ENABLE;
 		csc-sc_bar_reg = RTW_PCI_MMBA;
 		csc-sc_bar_val = adr | PCI_MAPREG_TYPE_MEM;
@@ -258,10 +248,6 @@
 		RTW_DPRINTF(RTW_DEBUG_ATTACH,
 		(%s: %s mapped % PRIuMAX  bytes I/O space\n,
 		 device_xname(self), __func__, (uintmax_t)regs-r_sz));
-#if rbus
-#else
-		(*ct-ct_cf-cardbus_io_open)(cc, 0, adr, adr+csc-sc_mapsize);
-#endif
 		csc-sc_csr |= PCI_COMMAND_IO_ENABLE;
 		csc-sc_bar_reg = RTW_PCI_IOBA;
 		csc-sc_bar_val = adr | PCI_MAPREG_TYPE_IO;



CVS commit: src/sys/dev/cardbus

2010-03-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Mar  4 22:33:12 UTC 2010

Modified Files:
src/sys/dev/cardbus: if_rtw_cardbus.c

Log Message:
Remove unnecessary #ifdef INET-enclosed #includes.

This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/cardbus/if_rtw_cardbus.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/cardbus

2010-03-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Mar  4 22:42:22 UTC 2010

Modified Files:
src/sys/dev/cardbus: cardbus_map.c

Log Message:
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/cardbus/cardbus_map.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/cardbus

2010-03-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Mar  4 22:42:22 UTC 2010

Modified Files:
src/sys/dev/cardbus: cardbus_map.c

Log Message:
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/cardbus/cardbus_map.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/cardbus/cardbus_map.c
diff -u src/sys/dev/cardbus/cardbus_map.c:1.34 src/sys/dev/cardbus/cardbus_map.c:1.35
--- src/sys/dev/cardbus/cardbus_map.c:1.34	Fri Feb 26 00:57:01 2010
+++ src/sys/dev/cardbus/cardbus_map.c	Thu Mar  4 22:42:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cardbus_map.c,v 1.34 2010/02/26 00:57:01 dyoung Exp $	*/
+/*	$NetBSD: cardbus_map.c,v 1.35 2010/03/04 22:42:22 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999 and 2000
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cardbus_map.c,v 1.34 2010/02/26 00:57:01 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: cardbus_map.c,v 1.35 2010/03/04 22:42:22 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -231,9 +231,7 @@
 	cardbus_chipset_tag_t cc = sc-sc_cc;
 	cardbus_function_tag_t cf = sc-sc_cf;
 	bus_space_tag_t bustag;
-#if rbus
 	rbus_tag_t rbustag;
-#endif
 	bus_space_handle_t handle;
 	bus_addr_t base;
 	bus_size_t size;
@@ -254,20 +252,15 @@
 			status = 1;
 		}
 		bustag = sc-sc_iot;
-#if rbus
 		rbustag = sc-sc_rbus_iot;
-#endif
 	} else {
 		if (cardbus_mem_find(cc, cf, tag, reg, type, base, size, flags)){
 			status = 1;
 		}
 		bustag = sc-sc_memt;
-#if rbus
 		rbustag = sc-sc_rbus_memt;
-#endif
 	}
 	if (status == 0) {
-#if rbus
 		bus_addr_t mask = size - 1;
 		if (base != 0) {
 			mask = 0x;
@@ -276,17 +269,6 @@
 		size, busflags | flags, base, handle)) {
 			panic(io alloc);
 		}
-#else
-		bus_addr_t start = 0x8300;
-		bus_addr_t end = 0x8400;
-		if (base != 0) {
-			bus_addr_t start = base;
-			bus_addr_t end = base + size;
-		}
-		if (bus_space_alloc(bustag, start, end, size, size, 0, 0, base, handle)) {
-			panic(io alloc);
-		}
-#endif
 	}
 	cardbus_conf_write(cc, cf, tag, reg, base);
 
@@ -332,7 +314,6 @@
 	cardbus_function_tag_t cf = sc-sc_cf;
 	int st = 1;
 	pcitag_t cardbustag;
-#if rbus
 	rbus_tag_t rbustag;
 
 	if (sc-sc_iot == tag) {
@@ -346,15 +327,12 @@
 	} else {
 		return 1;
 	}
-#endif
 
 	cardbustag = cardbus_make_tag(cc, cf, sc-sc_bus, func);
 
 	cardbus_conf_write(cc, cf, cardbustag, reg, 0);
 
-#if rbus
 	(*cf-cardbus_space_free)(cc, rbustag, handle, size);
-#endif
 
 	return st;
 }



CVS commit: src/sys/dev/cardbus

2010-03-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar  5 00:36:06 UTC 2010

Modified Files:
src/sys/dev/cardbus: fwohci_cardbus.c

Log Message:
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Make a few changes of this kind:

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

Tested by plugging a Syba CardBus to FireWire adapter into an HP
Pavilion N3270, adding an address (169.254.0.7/16) to fwip0, attaching
and pinging a MacBook Pro.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/cardbus/fwohci_cardbus.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/cardbus/fwohci_cardbus.c
diff -u src/sys/dev/cardbus/fwohci_cardbus.c:1.30 src/sys/dev/cardbus/fwohci_cardbus.c:1.31
--- src/sys/dev/cardbus/fwohci_cardbus.c:1.30	Fri Feb 26 00:57:01 2010
+++ src/sys/dev/cardbus/fwohci_cardbus.c	Fri Mar  5 00:36:06 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci_cardbus.c,v 1.30 2010/02/26 00:57:01 dyoung Exp $	*/
+/*	$NetBSD: fwohci_cardbus.c,v 1.31 2010/03/05 00:36:06 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fwohci_cardbus.c,v 1.30 2010/02/26 00:57:01 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: fwohci_cardbus.c,v 1.31 2010/03/05 00:36:06 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -115,11 +115,6 @@
 	sc-sc_cf = cf;
 	sc-sc_ct = ct;
 
-#if rbus
-#else
-XXX	(ct-ct_cf-cardbus_mem_open)(cc, 0, iob, iob + 0x40);
-#endif
-
 	/* Disable interrupts, so we don't get any spurious ones. */
 	OHCI_CSR_WRITE(sc-sc_sc, FWOHCI_INTMASKCLR, OHCI_INT_EN);
 
@@ -128,7 +123,7 @@
 	Cardbus_conf_write(ct, ca-ca_tag, PCI_COMMAND_STATUS_REG,
 	csr | PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_MEM_ENABLE);
 
-	sc-sc_ih = cardbus_intr_establish(cc, cf, ca-ca_intrline,
+	sc-sc_ih = Cardbus_intr_establish(ct, ca-ca_intrline,
 	   IPL_BIO, fwohci_filt, sc);
 	if (sc-sc_ih == NULL) {
 		aprint_error_dev(self, couldn't establish interrupt\n);
@@ -137,7 +132,7 @@
 
 	/* XXX NULL should be replaced by some call to Cardbus coed */
 	if (fwohci_init(sc-sc_sc, sc-sc_sc.fc.dev) != 0) {
-		cardbus_intr_disestablish(cc, cf, sc-sc_ih);
+		Cardbus_intr_disestablish(ct, sc-sc_ih);
 		sc-sc_ih = NULL;
 	}
 }
@@ -154,7 +149,7 @@
 	if (rv)
 		return (rv);
 	if (sc-sc_ih != NULL) {
-		cardbus_intr_disestablish(ct-ct_cc, ct-ct_cf, sc-sc_ih);
+		Cardbus_intr_disestablish(ct, sc-sc_ih);
 		sc-sc_ih = NULL;
 	}
 	if (sc-sc_sc.bssize) {



CVS commit: src/sys/dev/cardbus

2010-03-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar  5 00:54:01 UTC 2010

Modified Files:
src/sys/dev/cardbus: if_rtw_cardbus.c

Log Message:
Simplify this a bit (and reduce differences with if_rtw_pci.c): we
don't have to save the base address or write it to the BAR.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/cardbus/if_rtw_cardbus.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/cardbus

2010-03-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar  5 00:54:01 UTC 2010

Modified Files:
src/sys/dev/cardbus: if_rtw_cardbus.c

Log Message:
Simplify this a bit (and reduce differences with if_rtw_pci.c): we
don't have to save the base address or write it to the BAR.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/cardbus/if_rtw_cardbus.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/cardbus/if_rtw_cardbus.c
diff -u src/sys/dev/cardbus/if_rtw_cardbus.c:1.39 src/sys/dev/cardbus/if_rtw_cardbus.c:1.40
--- src/sys/dev/cardbus/if_rtw_cardbus.c:1.39	Thu Mar  4 22:33:12 2010
+++ src/sys/dev/cardbus/if_rtw_cardbus.c	Fri Mar  5 00:54:01 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: if_rtw_cardbus.c,v 1.39 2010/03/04 22:33:12 dyoung Exp $ */
+/* $NetBSD: if_rtw_cardbus.c,v 1.40 2010/03/05 00:54:01 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2004, 2005 David Young.  All rights reserved.
@@ -64,7 +64,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_rtw_cardbus.c,v 1.39 2010/03/04 22:33:12 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_rtw_cardbus.c,v 1.40 2010/03/05 00:54:01 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -120,8 +120,7 @@
 		 * region
 		 */
 
-	int			sc_bar_reg;	/* which BAR to use */
-	pcireg_t		sc_bar_val;	/* value of the BAR */
+	int			sc_bar;	/* which BAR to use */
 
 	cardbus_intr_line_t	sc_intrline;	/* interrupt line */
 };
@@ -241,16 +240,14 @@
 		(%s: %s mapped % PRIuMAX  bytes mem space\n,
 		 device_xname(self), __func__, (uintmax_t)regs-r_sz));
 		csc-sc_csr |= PCI_COMMAND_MEM_ENABLE;
-		csc-sc_bar_reg = RTW_PCI_MMBA;
-		csc-sc_bar_val = adr | PCI_MAPREG_TYPE_MEM;
+		csc-sc_bar = RTW_PCI_MMBA;
 	} else if (Cardbus_mapreg_map(ct, RTW_PCI_IOBA, PCI_MAPREG_TYPE_IO,
 	0, regs-r_bt, regs-r_bh, adr, regs-r_sz) == 0) {
 		RTW_DPRINTF(RTW_DEBUG_ATTACH,
 		(%s: %s mapped % PRIuMAX  bytes I/O space\n,
 		 device_xname(self), __func__, (uintmax_t)regs-r_sz));
 		csc-sc_csr |= PCI_COMMAND_IO_ENABLE;
-		csc-sc_bar_reg = RTW_PCI_IOBA;
-		csc-sc_bar_val = adr | PCI_MAPREG_TYPE_IO;
+		csc-sc_bar = RTW_PCI_IOBA;
 	} else {
 		aprint_error_dev(self, unable to map device registers\n);
 		return;
@@ -312,8 +309,8 @@
 	/*
 	 * Release bus space and close window.
 	 */
-	if (csc-sc_bar_reg != 0)
-		Cardbus_mapreg_unmap(ct, csc-sc_bar_reg,
+	if (csc-sc_bar != 0)
+		Cardbus_mapreg_unmap(ct, csc-sc_bar,
 		regs-r_bt, regs-r_bh, regs-r_sz);
 
 	return 0;
@@ -386,9 +383,6 @@
 		Cardbus_conf_write(ct, tag, PCI_BHLC_REG, bhlc);
 	}
 
-	/* Program the BAR. */
-	Cardbus_conf_write(ct, tag, csc-sc_bar_reg, csc-sc_bar_val);
-
 	/* Enable the appropriate bits in the PCI CSR. */
 	csr = Cardbus_conf_read(ct, tag, PCI_COMMAND_STATUS_REG);
 	csr = ~(PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MEM_ENABLE);



re: CVS commit: src/sys/dev/cardbus

2010-03-04 Thread matthew green

   
   On Mar 4, 2010, at 10:49 AM, David Young wrote:
   
Use %zu and %zx for printf'ing bus_size_t.
   
   These aren't quite right.  We should probably define PRIxxx macros for the 
bus.h scalar types.

infact, they're quite wrong on IPL32 systems with 64 bit bus addresses.
x86 PAE, sparc*, mips, ppc come to mind...


.mrg.


CVS commit: src/sys/dev/cardbus

2010-03-02 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Mar  2 20:31:14 UTC 2010

Modified Files:
src/sys/dev/cardbus: if_ath_cardbus.c if_atw_cardbus.c

Log Message:
Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

Tested with ath  atw units on a Soekris net4521.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/cardbus/if_ath_cardbus.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/cardbus/if_atw_cardbus.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/cardbus

2010-03-02 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Mar  2 20:31:14 UTC 2010

Modified Files:
src/sys/dev/cardbus: if_ath_cardbus.c if_atw_cardbus.c

Log Message:
Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

Tested with ath  atw units on a Soekris net4521.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/cardbus/if_ath_cardbus.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/cardbus/if_atw_cardbus.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/cardbus/if_ath_cardbus.c
diff -u src/sys/dev/cardbus/if_ath_cardbus.c:1.40 src/sys/dev/cardbus/if_ath_cardbus.c:1.41
--- src/sys/dev/cardbus/if_ath_cardbus.c:1.40	Thu Feb 25 23:40:39 2010
+++ src/sys/dev/cardbus/if_ath_cardbus.c	Tue Mar  2 20:31:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ath_cardbus.c,v 1.40 2010/02/25 23:40:39 dyoung Exp $ */
+/*	$NetBSD: if_ath_cardbus.c,v 1.41 2010/03/02 20:31:14 dyoung Exp $ */
 /*
  * Copyright (c) 2003
  *	Ichiro FUKUHARA ich...@ichiro.org.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ath_cardbus.c,v 1.40 2010/02/25 23:40:39 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ath_cardbus.c,v 1.41 2010/03/02 20:31:14 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -115,8 +115,7 @@
 
 	ath_suspend(csc-sc_ath);
 	if (csc-sc_ih != NULL) {
-		cardbus_intr_disestablish(csc-sc_ct-ct_cc, csc-sc_ct-ct_cf,
-		csc-sc_ih);
+		Cardbus_intr_disestablish(csc-sc_ct, csc-sc_ih);
 		csc-sc_ih = NULL;
 	}
 	return true;
@@ -127,8 +126,8 @@
 {
 	struct ath_cardbus_softc *csc = device_private(self);
 
-	csc-sc_ih = cardbus_intr_establish(csc-sc_ct-ct_cc,
-	csc-sc_ct-ct_cf, csc-sc_intrline, IPL_NET, ath_intr,
+	csc-sc_ih = Cardbus_intr_establish(csc-sc_ct,
+	csc-sc_intrline, IPL_NET, ath_intr,
 	csc-sc_ath);
 
 	if (csc-sc_ih == NULL) {
@@ -235,7 +234,7 @@
 	 * Unhook the interrupt handler.
 	 */
 	if (csc-sc_ih != NULL) {
-		cardbus_intr_disestablish(ct-ct_cc, ct-ct_cf, csc-sc_ih);
+		Cardbus_intr_disestablish(ct, csc-sc_ih);
 		csc-sc_ih = NULL;
 	}
 

Index: src/sys/dev/cardbus/if_atw_cardbus.c
diff -u src/sys/dev/cardbus/if_atw_cardbus.c:1.32 src/sys/dev/cardbus/if_atw_cardbus.c:1.33
--- src/sys/dev/cardbus/if_atw_cardbus.c:1.32	Thu Feb 25 23:40:39 2010
+++ src/sys/dev/cardbus/if_atw_cardbus.c	Tue Mar  2 20:31:14 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: if_atw_cardbus.c,v 1.32 2010/02/25 23:40:39 dyoung Exp $ */
+/* $NetBSD: if_atw_cardbus.c,v 1.33 2010/03/02 20:31:14 dyoung Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_atw_cardbus.c,v 1.32 2010/02/25 23:40:39 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_atw_cardbus.c,v 1.33 2010/03/02 20:31:14 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -308,7 +308,7 @@
 	 * Unhook the interrupt handler.
 	 */
 	if (csc-sc_ih != NULL)
-		cardbus_intr_disestablish(ct-ct_cc, ct-ct_cf, csc-sc_ih);
+		Cardbus_intr_disestablish(ct, csc-sc_ih);
 
 	/*
 	 * Release bus space and close window.
@@ -326,13 +326,11 @@
 	struct atw_cardbus_softc *csc = device_private(self);
 	struct atw_softc *sc = csc-sc_atw;
 	cardbus_devfunc_t ct = csc-sc_ct;
-	cardbus_chipset_tag_t cc = ct-ct_cc;
-	cardbus_function_tag_t cf = ct-ct_cf;
 
 	/*
 	 * Map and establish the interrupt.
 	 */
-	csc-sc_ih = cardbus_intr_establish(cc, cf, csc-sc_intrline, IPL_NET,
+	csc-sc_ih = Cardbus_intr_establish(ct, csc-sc_intrline, IPL_NET,
 	atw_intr, sc);
 	if (csc-sc_ih == NULL) {
 		aprint_error_dev(sc-sc_dev, unable to establish interrupt\n);
@@ -347,11 +345,9 @@
 {
 	struct atw_cardbus_softc *csc = device_private(self);
 	cardbus_devfunc_t ct = csc-sc_ct;
-	cardbus_chipset_tag_t cc = ct-ct_cc;
-	cardbus_function_tag_t cf = ct-ct_cf;
 
 	/* Unhook the interrupt handler. */
-	cardbus_intr_disestablish(cc, cf, csc-sc_ih);
+	Cardbus_intr_disestablish(ct, csc-sc_ih);
 	csc-sc_ih = NULL;
 
 	return atw_suspend(self, qual);



CVS commit: src/sys/dev/cardbus

2010-03-02 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar  3 00:56:41 UTC 2010

Modified Files:
src/sys/dev/cardbus: rbus_ppb.c

Log Message:
Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

Compiles.  Untested.  Let me know if you use this hardware with NetBSD
any longer.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/cardbus/rbus_ppb.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/cardbus

2010-03-02 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar  3 00:56:41 UTC 2010

Modified Files:
src/sys/dev/cardbus: rbus_ppb.c

Log Message:
Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

Compiles.  Untested.  Let me know if you use this hardware with NetBSD
any longer.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/cardbus/rbus_ppb.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/cardbus/rbus_ppb.c
diff -u src/sys/dev/cardbus/rbus_ppb.c:1.35 src/sys/dev/cardbus/rbus_ppb.c:1.36
--- src/sys/dev/cardbus/rbus_ppb.c:1.35	Fri Feb 26 00:57:02 2010
+++ src/sys/dev/cardbus/rbus_ppb.c	Wed Mar  3 00:56:41 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rbus_ppb.c,v 1.35 2010/02/26 00:57:02 dyoung Exp $	*/
+/*	$NetBSD: rbus_ppb.c,v 1.36 2010/03/03 00:56:41 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rbus_ppb.c,v 1.35 2010/02/26 00:57:02 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: rbus_ppb.c,v 1.36 2010/03/03 00:56:41 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -777,7 +777,7 @@
 
 	/* Map and establish the interrupt. */
 
-	sc-sc_ih = cardbus_intr_establish(cc, cf, psc-sc_intrline, IPL_NET,
+	sc-sc_ih = Cardbus_intr_establish(ct, psc-sc_intrline, IPL_NET,
 	fxp_intr, sc);
 	if (NULL == sc-sc_ih) {
 		aprint_error_dev(sc-sc_dev, couldn't establish interrupt\n);
@@ -800,7 +800,7 @@
 	cardbus_function_tag_t cf = psc-sc_cf;
 
 	/* Remove interrupt handler. */
-	cardbus_intr_disestablish(cc, cf, sc-sc_ih);
+	Cardbus_intr_disestablish(ct, sc-sc_ih);
 
 	Cardbus_function_disable(((struct fxp_cardbus_softc *) sc)-ct);
 #endif
@@ -826,7 +826,7 @@
 		/*
 		 * Unhook the interrupt handler.
 		 */
-		cardbus_intr_disestablish(ct-ct_cc, ct-ct_cf, sc-sc_ih);
+		Cardbus_intr_disestablish(ct, sc-sc_ih);
 
 		/*
 		 * release bus space and close window



CVS commit: src/sys/dev/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Feb 25 20:36:31 UTC 2010

Modified Files:
src/sys/dev/cardbus: com_cardbus.c if_fxp_cardbus.c rbus_ppb.c
siisata_cardbus.c

Log Message:
Don't create the device's PCI tag with Cardbus_make_tag(9), but save and
use the tag found in the cardbus_attach_args.  Compile-tested, only.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/cardbus/com_cardbus.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/cardbus/if_fxp_cardbus.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/cardbus/rbus_ppb.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/cardbus/siisata_cardbus.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/cardbus/com_cardbus.c
diff -u src/sys/dev/cardbus/com_cardbus.c:1.24 src/sys/dev/cardbus/com_cardbus.c:1.25
--- src/sys/dev/cardbus/com_cardbus.c:1.24	Wed Feb 24 19:52:51 2010
+++ src/sys/dev/cardbus/com_cardbus.c	Thu Feb 25 20:36:31 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: com_cardbus.c,v 1.24 2010/02/24 19:52:51 dyoung Exp $ */
+/* $NetBSD: com_cardbus.c,v 1.25 2010/02/25 20:36:31 dyoung Exp $ */
 
 /*
  * Copyright (c) 2000 Johan Danielsson
@@ -40,7 +40,7 @@
updated below.  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: com_cardbus.c,v 1.24 2010/02/24 19:52:51 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: com_cardbus.c,v 1.25 2010/02/25 20:36:31 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -212,7 +212,7 @@
 
 	sc-sc_dev = self;
 	csc-cc_ct = ca-ca_ct;
-	csc-cc_tag = Cardbus_make_tag(csc-cc_ct);
+	csc-cc_tag = ca-ca_tag;
 
 	if(gofigure(ca, csc) != 0)
 		return;

Index: src/sys/dev/cardbus/if_fxp_cardbus.c
diff -u src/sys/dev/cardbus/if_fxp_cardbus.c:1.42 src/sys/dev/cardbus/if_fxp_cardbus.c:1.43
--- src/sys/dev/cardbus/if_fxp_cardbus.c:1.42	Wed Feb 24 23:38:40 2010
+++ src/sys/dev/cardbus/if_fxp_cardbus.c	Thu Feb 25 20:36:31 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_fxp_cardbus.c,v 1.42 2010/02/24 23:38:40 dyoung Exp $	*/
+/*	$NetBSD: if_fxp_cardbus.c,v 1.43 2010/02/25 20:36:31 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_fxp_cardbus.c,v 1.42 2010/02/24 23:38:40 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_fxp_cardbus.c,v 1.43 2010/02/25 20:36:31 dyoung Exp $);
 
 #include opt_inet.h
 #include rnd.h
@@ -91,6 +91,7 @@
 struct fxp_cardbus_softc {
 	struct fxp_softc sc;
 	cardbus_devfunc_t ct;
+	pcitag_t tag;
 	pcireg_t base0_reg;
 	pcireg_t base1_reg;
 	bus_size_t size;
@@ -133,6 +134,7 @@
 
 	sc-sc_dev = self;
 	csc-ct = ca-ca_ct;
+	csc-tag = ca-ca_tag;
 
 	/*
  * Map control/status registers.
@@ -193,8 +195,7 @@
 	cardbus_function_tag_t cf = psc-sc_cf;
 	pcireg_t command;
 
-	pcitag_t tag = cardbus_make_tag(cc, cf, csc-ct-ct_bus,
-	csc-ct-ct_func);
+	pcitag_t tag = csc-tag;
 
 	command = Cardbus_conf_read(csc-ct, tag, CARDBUS_COMMAND_STATUS_REG);
 	if (csc-base0_reg) {

Index: src/sys/dev/cardbus/rbus_ppb.c
diff -u src/sys/dev/cardbus/rbus_ppb.c:1.32 src/sys/dev/cardbus/rbus_ppb.c:1.33
--- src/sys/dev/cardbus/rbus_ppb.c:1.32	Wed Feb 24 19:52:52 2010
+++ src/sys/dev/cardbus/rbus_ppb.c	Thu Feb 25 20:36:31 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rbus_ppb.c,v 1.32 2010/02/24 19:52:52 dyoung Exp $	*/
+/*	$NetBSD: rbus_ppb.c,v 1.33 2010/02/25 20:36:31 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rbus_ppb.c,v 1.32 2010/02/24 19:52:52 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: rbus_ppb.c,v 1.33 2010/02/25 20:36:31 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -744,8 +744,7 @@
 	printf(ppb_cardbus_setup called\n);
 #if 0
 	/* not sure what to do here */
-	pcitag_t tag = cardbus_make_tag(cc, cf, csc-ct-ct_bus,
-	csc-ct-ct_dev, csc-ct-ct_func);
+	pcitag_t tag = csc-sc_tag;
 
 	command = Cardbus_conf_read(csc-ct, tag, CARDBUS_COMMAND_STATUS_REG);
 	if (csc-base0_reg) {

Index: src/sys/dev/cardbus/siisata_cardbus.c
diff -u src/sys/dev/cardbus/siisata_cardbus.c:1.6 src/sys/dev/cardbus/siisata_cardbus.c:1.7
--- src/sys/dev/cardbus/siisata_cardbus.c:1.6	Thu Feb 25 00:47:39 2010
+++ src/sys/dev/cardbus/siisata_cardbus.c	Thu Feb 25 20:36:31 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata_cardbus.c,v 1.6 2010/02/25 00:47:39 dyoung Exp $ */
+/* $NetBSD: siisata_cardbus.c,v 1.7 2010/02/25 20:36:31 dyoung Exp $ */
 /* Id: siisata_pci.c,v 1.11 2008/05/21 16:20:11 jakllsch Exp  */
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: siisata_cardbus.c,v 1.6 2010/02/25 00:47:39 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: siisata_cardbus.c,v 1.7 2010/02/25 20:36:31 dyoung Exp $);
 
 #include sys/types.h
 #include sys/malloc.h
@@ -73,6 +73,7 @@
 	cardbus_chipset_tag_t sc_cc;
 	cardbus_function_tag_t sc_cf;
 	cardbus_devfunc_t sc_ct;
+	pcitag_t sc_tag;
 
 	bus_size_t sc_grsize;
 	

CVS commit: src/sys/dev/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Feb 25 20:36:31 UTC 2010

Modified Files:
src/sys/dev/cardbus: com_cardbus.c if_fxp_cardbus.c rbus_ppb.c
siisata_cardbus.c

Log Message:
Don't create the device's PCI tag with Cardbus_make_tag(9), but save and
use the tag found in the cardbus_attach_args.  Compile-tested, only.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/cardbus/com_cardbus.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/cardbus/if_fxp_cardbus.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/cardbus/rbus_ppb.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/cardbus/siisata_cardbus.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/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Feb 25 21:18:35 UTC 2010

Modified Files:
src/sys/dev/cardbus: cardbus.c cardbusreg.h njata_cardbus.c
njs_cardbus.c siisata_cardbus.c

Log Message:
Phase out some CardBus constants and types.  Use the equivalent PCI
constants and types, instead:

CARDBUS_CLASS_REG - PCI_CLASS_REG
CARDBUS_ID_REG - PCI_ID_REG
cardbus_product_id_t - pci_product_id_t
cardbus_vendor_id_t - pci_vendor_id_t


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/dev/cardbus/cardbus.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/cardbus/cardbusreg.h
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/cardbus/njata_cardbus.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/cardbus/njs_cardbus.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/cardbus/siisata_cardbus.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/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Feb 25 21:18:35 UTC 2010

Modified Files:
src/sys/dev/cardbus: cardbus.c cardbusreg.h njata_cardbus.c
njs_cardbus.c siisata_cardbus.c

Log Message:
Phase out some CardBus constants and types.  Use the equivalent PCI
constants and types, instead:

CARDBUS_CLASS_REG - PCI_CLASS_REG
CARDBUS_ID_REG - PCI_ID_REG
cardbus_product_id_t - pci_product_id_t
cardbus_vendor_id_t - pci_vendor_id_t


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/dev/cardbus/cardbus.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/cardbus/cardbusreg.h
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/cardbus/njata_cardbus.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/cardbus/njs_cardbus.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/cardbus/siisata_cardbus.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/cardbus/cardbus.c
diff -u src/sys/dev/cardbus/cardbus.c:1.103 src/sys/dev/cardbus/cardbus.c:1.104
--- src/sys/dev/cardbus/cardbus.c:1.103	Thu Feb 25 00:47:39 2010
+++ src/sys/dev/cardbus/cardbus.c	Thu Feb 25 21:18:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cardbus.c,v 1.103 2010/02/25 00:47:39 dyoung Exp $	*/
+/*	$NetBSD: cardbus.c,v 1.104 2010/02/25 21:18:35 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999 and 2000
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cardbus.c,v 1.103 2010/02/25 00:47:39 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: cardbus.c,v 1.104 2010/02/25 21:18:35 dyoung Exp $);
 
 #include opt_cardbus.h
 
@@ -460,7 +460,7 @@
 		int i;
 
 		for (i = 0; i  5; ++i) {
-			id = cardbus_conf_read(cc, cf, tag, CARDBUS_ID_REG);
+			id = cardbus_conf_read(cc, cf, tag, PCI_ID_REG);
 			if (id != 0x  id != 0) {
 break;
 			}
@@ -497,8 +497,8 @@
 
 		tag = cardbus_make_tag(cc, cf, sc-sc_bus, function);
 
-		id = cardbus_conf_read(cc, cf, tag, CARDBUS_ID_REG);
-		class = cardbus_conf_read(cc, cf, tag, CARDBUS_CLASS_REG);
+		id = cardbus_conf_read(cc, cf, tag, PCI_ID_REG);
+		class = cardbus_conf_read(cc, cf, tag, PCI_CLASS_REG);
 		cis_ptr = cardbus_conf_read(cc, cf, tag, CARDBUS_CIS_REG);
 
 		/* Invalid vendor ID value? */

Index: src/sys/dev/cardbus/cardbusreg.h
diff -u src/sys/dev/cardbus/cardbusreg.h:1.4 src/sys/dev/cardbus/cardbusreg.h:1.5
--- src/sys/dev/cardbus/cardbusreg.h:1.4	Wed Feb 24 23:38:40 2010
+++ src/sys/dev/cardbus/cardbusreg.h	Thu Feb 25 21:18:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cardbusreg.h,v 1.4 2010/02/24 23:38:40 dyoung Exp $ */
+/*	$NetBSD: cardbusreg.h,v 1.5 2010/02/25 21:18:35 dyoung Exp $ */
 
 /*
  * Copyright (c) 2001
@@ -33,11 +33,6 @@
 
 typedef int cardbus_intr_line_t;
 
-#define CARDBUS_ID_REG  0x00
-
-typedef u_int16_t cardbus_vendor_id_t;
-typedef u_int16_t cardbus_product_id_t;
-
 #  define CARDBUS_VENDOR_SHIFT  0
 #  define CARDBUS_VENDOR_MASK   0x
 #  define CARDBUS_VENDOR(id) \
@@ -63,8 +58,6 @@
 #  define CARDBUS_COMMAND_BACKTOBACK_ENABLE  0x0200
 
 
-#define CARDBUS_CLASS_REG   0x08
-
 #define	CARDBUS_CLASS_SHIFT24
 #define	CARDBUS_CLASS_MASK0xff
 #define	CARDBUS_CLASS(cr) \

Index: src/sys/dev/cardbus/njata_cardbus.c
diff -u src/sys/dev/cardbus/njata_cardbus.c:1.9 src/sys/dev/cardbus/njata_cardbus.c:1.10
--- src/sys/dev/cardbus/njata_cardbus.c:1.9	Wed Feb 24 19:52:52 2010
+++ src/sys/dev/cardbus/njata_cardbus.c	Thu Feb 25 21:18:35 2010
@@ -1,4 +1,4 @@
-/*	$Id: njata_cardbus.c,v 1.9 2010/02/24 19:52:52 dyoung Exp $	*/
+/*	$Id: njata_cardbus.c,v 1.10 2010/02/25 21:18:35 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2006 ITOH Yasufumi it...@netbsd.org.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: njata_cardbus.c,v 1.9 2010/02/24 19:52:52 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: njata_cardbus.c,v 1.10 2010/02/25 21:18:35 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -71,8 +71,8 @@
 njata_cardbus_match, njata_cardbus_attach, njata_cardbus_detach, NULL);
 
 static const struct njata32_cardbus_product {
-	cardbus_vendor_id_t	p_vendor;
-	cardbus_product_id_t	p_product;
+	pci_vendor_id_t		p_vendor;
+	pci_product_id_t	p_product;
 	uint8_t			p_flags;
 #define NJATA32_FL_IOMAP_ONLY	1	/* registers are only in the I/O map */
 } njata32_cardbus_products[] = {

Index: src/sys/dev/cardbus/njs_cardbus.c
diff -u src/sys/dev/cardbus/njs_cardbus.c:1.12 src/sys/dev/cardbus/njs_cardbus.c:1.13
--- src/sys/dev/cardbus/njs_cardbus.c:1.12	Wed Feb 24 19:52:52 2010
+++ src/sys/dev/cardbus/njs_cardbus.c	Thu Feb 25 21:18:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: njs_cardbus.c,v 1.12 2010/02/24 19:52:52 dyoung Exp $	*/
+/*	$NetBSD: njs_cardbus.c,v 1.13 2010/02/25 21:18:35 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: njs_cardbus.c,v 1.12 2010/02/24 19:52:52 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: 

CVS commit: src/sys/dev/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Feb 25 22:31:51 UTC 2010

Modified Files:
src/sys/dev/cardbus: com_cardbus.c if_fxp_cardbus.c

Log Message:
Don't use the cardbus_softc.  Compile-tested, only.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/cardbus/com_cardbus.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/cardbus/if_fxp_cardbus.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/cardbus/com_cardbus.c
diff -u src/sys/dev/cardbus/com_cardbus.c:1.25 src/sys/dev/cardbus/com_cardbus.c:1.26
--- src/sys/dev/cardbus/com_cardbus.c:1.25	Thu Feb 25 20:36:31 2010
+++ src/sys/dev/cardbus/com_cardbus.c	Thu Feb 25 22:31:51 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: com_cardbus.c,v 1.25 2010/02/25 20:36:31 dyoung Exp $ */
+/* $NetBSD: com_cardbus.c,v 1.26 2010/02/25 22:31:51 dyoung Exp $ */
 
 /*
  * Copyright (c) 2000 Johan Danielsson
@@ -40,7 +40,7 @@
updated below.  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: com_cardbus.c,v 1.25 2010/02/25 20:36:31 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: com_cardbus.c,v 1.26 2010/02/25 22:31:51 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -57,6 +57,7 @@
 
 struct com_cardbus_softc {
 	struct com_softc	cc_com;
+	cardbus_intr_line_t	cc_intrline;
 	void			*cc_ih;
 	cardbus_devfunc_t	cc_ct;
 	bus_addr_t		cc_addr;
@@ -211,6 +212,7 @@
 	bus_space_tag_t		iot;
 
 	sc-sc_dev = self;
+	csc-cc_intrline = ca-ca_intrline;
 	csc-cc_ct = ca-ca_ct;
 	csc-cc_tag = ca-ca_tag;
 
@@ -297,17 +299,16 @@
 com_cardbus_enable(struct com_softc *sc)
 {
 	struct com_cardbus_softc *csc = (struct com_cardbus_softc*)sc;
-	struct cardbus_softc *psc =
-		device_private(device_parent(sc-sc_dev));
-	cardbus_chipset_tag_t cc = psc-sc_cc;
-	cardbus_function_tag_t cf = psc-sc_cf;
+	cardbus_devfunc_t ct = csc-cc_ct;
+	cardbus_chipset_tag_t cc = ct-ct_cc;
+	cardbus_function_tag_t cf = ct-ct_cf;
 
-	Cardbus_function_enable(csc-cc_ct);
+	Cardbus_function_enable(ct);
 
 	com_cardbus_setup(csc);
 
 	/* establish the interrupt. */
-	csc-cc_ih = cardbus_intr_establish(cc, cf, psc-sc_intrline,
+	csc-cc_ih = cardbus_intr_establish(cc, cf, csc-cc_intrline,
 	IPL_SERIAL, comintr, sc);
 	if (csc-cc_ih == NULL) {
 		aprint_error_dev(DEVICET(csc),
@@ -322,15 +323,14 @@
 com_cardbus_disable(struct com_softc *sc)
 {
 	struct com_cardbus_softc *csc = (struct com_cardbus_softc*)sc;
-	struct cardbus_softc *psc =
-		device_private(device_parent(sc-sc_dev));
-	cardbus_chipset_tag_t cc = psc-sc_cc;
-	cardbus_function_tag_t cf = psc-sc_cf;
+	cardbus_devfunc_t ct = csc-cc_ct;
+	cardbus_chipset_tag_t cc = ct-ct_cc;
+	cardbus_function_tag_t cf = ct-ct_cf;
 
 	cardbus_intr_disestablish(cc, cf, csc-cc_ih);
 	csc-cc_ih = NULL;
 
-	Cardbus_function_disable(csc-cc_ct);
+	Cardbus_function_disable(ct);
 }
 
 static int
@@ -338,14 +338,14 @@
 {
 	struct com_cardbus_softc *csc = device_private(self);
 	struct com_softc *sc = device_private(self);
-	struct cardbus_softc *psc = device_private(device_parent(self));
+	cardbus_devfunc_t ct = csc-cc_ct;
 	int error;
 
 	if ((error = com_detach(self, flags)) != 0)
 		return error;
 
 	if (csc-cc_ih != NULL)
-		cardbus_intr_disestablish(psc-sc_cc, psc-sc_cf, csc-cc_ih);
+		cardbus_intr_disestablish(ct-ct_cc, ct-ct_cf, csc-cc_ih);
 
 	Cardbus_mapreg_unmap(csc-cc_ct, csc-cc_reg, sc-sc_regs.cr_iot,
 	sc-sc_regs.cr_ioh, csc-cc_size);

Index: src/sys/dev/cardbus/if_fxp_cardbus.c
diff -u src/sys/dev/cardbus/if_fxp_cardbus.c:1.43 src/sys/dev/cardbus/if_fxp_cardbus.c:1.44
--- src/sys/dev/cardbus/if_fxp_cardbus.c:1.43	Thu Feb 25 20:36:31 2010
+++ src/sys/dev/cardbus/if_fxp_cardbus.c	Thu Feb 25 22:31:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_fxp_cardbus.c,v 1.43 2010/02/25 20:36:31 dyoung Exp $	*/
+/*	$NetBSD: if_fxp_cardbus.c,v 1.44 2010/02/25 22:31:51 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_fxp_cardbus.c,v 1.43 2010/02/25 20:36:31 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_fxp_cardbus.c,v 1.44 2010/02/25 22:31:51 dyoung Exp $);
 
 #include opt_inet.h
 #include rnd.h
@@ -91,6 +91,7 @@
 struct fxp_cardbus_softc {
 	struct fxp_softc sc;
 	cardbus_devfunc_t ct;
+	cardbus_intr_line_t intrline;
 	pcitag_t tag;
 	pcireg_t base0_reg;
 	pcireg_t base1_reg;
@@ -133,6 +134,7 @@
 	bus_size_t size;
 
 	sc-sc_dev = self;
+	csc-intrline = ca-ca_intrline;
 	csc-ct = ca-ca_ct;
 	csc-tag = ca-ca_tag;
 
@@ -190,9 +192,8 @@
 fxp_cardbus_setup(struct fxp_softc * sc)
 {
 	struct fxp_cardbus_softc *csc = (struct fxp_cardbus_softc *)sc;
-	struct cardbus_softc *psc = device_private(device_parent(sc-sc_dev));
-	cardbus_chipset_tag_t cc = psc-sc_cc;
-	cardbus_function_tag_t cf = psc-sc_cf;
+	cardbus_chipset_tag_t cc = csc-ct-ct_cc;
+	cardbus_function_tag_t cf = csc-ct-ct_cf;
 	pcireg_t command;
 
 	pcitag_t tag = csc-tag;
@@ -222,9 +223,8 @@
 

CVS commit: src/sys/dev/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Feb 25 22:31:51 UTC 2010

Modified Files:
src/sys/dev/cardbus: com_cardbus.c if_fxp_cardbus.c

Log Message:
Don't use the cardbus_softc.  Compile-tested, only.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/cardbus/com_cardbus.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/cardbus/if_fxp_cardbus.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/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Feb 25 22:40:16 UTC 2010

Modified Files:
src/sys/dev/cardbus: siisata_cardbus.c

Log Message:
Copy values from the cardbus_attach_args and use them instead of values
from the cardbus_softc.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/cardbus/siisata_cardbus.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/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Feb 25 22:40:16 UTC 2010

Modified Files:
src/sys/dev/cardbus: siisata_cardbus.c

Log Message:
Copy values from the cardbus_attach_args and use them instead of values
from the cardbus_softc.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/cardbus/siisata_cardbus.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/cardbus/siisata_cardbus.c
diff -u src/sys/dev/cardbus/siisata_cardbus.c:1.8 src/sys/dev/cardbus/siisata_cardbus.c:1.9
--- src/sys/dev/cardbus/siisata_cardbus.c:1.8	Thu Feb 25 21:18:35 2010
+++ src/sys/dev/cardbus/siisata_cardbus.c	Thu Feb 25 22:40:16 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata_cardbus.c,v 1.8 2010/02/25 21:18:35 dyoung Exp $ */
+/* $NetBSD: siisata_cardbus.c,v 1.9 2010/02/25 22:40:16 dyoung Exp $ */
 /* Id: siisata_pci.c,v 1.11 2008/05/21 16:20:11 jakllsch Exp  */
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: siisata_cardbus.c,v 1.8 2010/02/25 21:18:35 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: siisata_cardbus.c,v 1.9 2010/02/25 22:40:16 dyoung Exp $);
 
 #include sys/types.h
 #include sys/malloc.h
@@ -74,6 +74,12 @@
 	cardbus_function_tag_t sc_cf;
 	cardbus_devfunc_t sc_ct;
 	pcitag_t sc_tag;
+	bus_space_tag_t sc_iot;		/* CardBus I/O space tag */
+	bus_space_tag_t sc_memt;	/* CardBus MEM space tag */
+#if rbus
+	rbus_tag_t sc_rbus_iot;		/* CardBus i/o rbus tag */
+	rbus_tag_t sc_rbus_memt;	/* CardBus mem rbus tag */
+#endif
 
 	bus_size_t sc_grsize;
 	bus_size_t sc_prsize;
@@ -134,7 +140,6 @@
 siisata_cardbus_attach(device_t parent, device_t self, void *aux)
 {
 	struct cardbus_attach_args *ca = aux;
-	struct cardbus_softc *cbsc = device_private(parent);
 	struct siisata_cardbus_softc *csc = device_private(self);
 	struct siisata_softc *sc = csc-si_sc;
 	cardbus_devfunc_t ct = ca-ca_ct;
@@ -156,6 +161,13 @@
 	csc-sc_ct = ct;
 	csc-sc_tag = ca-ca_tag;
 
+	csc-sc_iot = ca-ca_iot;
+	csc-sc_memt = ca-ca_memt;
+#if rbus
+	csc-sc_rbus_iot = ca-ca_rbus_iot;
+	csc-sc_rbus_memt = ca-ca_rbus_memt;
+#endif
+
 	cardbus_devinfo(ca-ca_id, ca-ca_class, 0, devinfo, sizeof(devinfo));
 	aprint_naive(: SATA-II HBA\n);
 	aprint_normal(: %s\n, devinfo);
@@ -172,8 +184,8 @@
 		csr =
 		cardbus_conf_read(cc, cf, ca-ca_tag, SIISATA_CARDBUS_BAR0);
 		base = PCI_MAPREG_MEM_ADDR(csr);
-		memt = cbsc-sc_memt;
-		if ((*cf-cardbus_space_alloc)(cc, cbsc-sc_rbus_memt, base,
+		memt = csc-sc_memt;
+		if ((*cf-cardbus_space_alloc)(cc, csc-sc_rbus_memt, base,
 		grsize, grsize - 1, grsize, 0, base, memh)) {
 			aprint_error(
 			%s: unable to map device global registers\n,
@@ -193,12 +205,12 @@
 		prsize = SIISATA_BAR1_SIZE;
 		base = PCI_MAPREG_MEM_ADDR(cardbus_conf_read(cc, cf, ca-ca_tag,
 		SIISATA_CARDBUS_BAR1));
-		memt = cbsc-sc_memt;
-		if ((*cf-cardbus_space_alloc)(cc, cbsc-sc_rbus_memt, base,
+		memt = csc-sc_memt;
+		if ((*cf-cardbus_space_alloc)(cc, csc-sc_rbus_memt, base,
 		prsize, prsize - 1, prsize, 0, base, memh)) {
 			cardbus_conf_write(cc, cf, ca-ca_tag,
 			SIISATA_CARDBUS_BAR0, 0);
-			(*cf-cardbus_space_free)(cc, cbsc-sc_rbus_memt,
+			(*cf-cardbus_space_free)(cc, csc-sc_rbus_memt,
 			sc-sc_grh, grsize);
 			aprint_error(
 			%s: unable to map device port registers\n,
@@ -219,10 +231,10 @@
 	siisata_intr, sc);
 	if (csc-sc_ih == NULL) {
 		cardbus_conf_write(cc, cf, ca-ca_tag, SIISATA_CARDBUS_BAR0, 0);
-		(*cf-cardbus_space_free)(cc, cbsc-sc_rbus_memt, sc-sc_grh,
+		(*cf-cardbus_space_free)(cc, csc-sc_rbus_memt, sc-sc_grh,
 		grsize);
 		cardbus_conf_write(cc, cf, ca-ca_tag, SIISATA_CARDBUS_BAR1, 0);
-		(*cf-cardbus_space_free)(cc, cbsc-sc_rbus_memt, sc-sc_prh,
+		(*cf-cardbus_space_free)(cc, csc-sc_rbus_memt, sc-sc_prh,
 		prsize);
 		aprint_error(%s: couldn't establish interrupt\n,
 		SIISATANAME(sc));
@@ -265,7 +277,6 @@
 static int
 siisata_cardbus_detach(device_t self, int flags)
 {
-	struct cardbus_softc *cbsc = device_private(device_parent(self));
 	struct siisata_cardbus_softc *csc = device_private(self);
 	struct siisata_softc *sc = csc-si_sc;
 	struct cardbus_devfunc *ct = csc-sc_ct;
@@ -283,13 +294,13 @@
 	}
 	if (csc-sc_grsize) {
 		cardbus_conf_write(cc, cf, ctag, SIISATA_CARDBUS_BAR0, 0);
-		(*cf-cardbus_space_free)(cc, cbsc-sc_rbus_memt, sc-sc_grh,
+		(*cf-cardbus_space_free)(cc, csc-sc_rbus_memt, sc-sc_grh,
 		csc-sc_grsize);
 		csc-sc_grsize = 0;
 	}
 	if (csc-sc_prsize) {
 		cardbus_conf_write(cc, cf, ctag, SIISATA_CARDBUS_BAR1, 0);
-		(*cf-cardbus_space_free)(cc, cbsc-sc_rbus_memt, sc-sc_prh,
+		(*cf-cardbus_space_free)(cc, csc-sc_rbus_memt, sc-sc_prh,
 		csc-sc_prsize);
 		csc-sc_prsize = 0;
 	}



CVS commit: src/sys/dev/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Feb 25 23:01:48 UTC 2010

Modified Files:
src/sys/dev/cardbus: if_rtw_cardbus.c

Log Message:
Use PCI_ constants instead of CARDBUS_ constants.  Use Cardbus_conf_*()
functions instead of cardbus_conf_*() functions to simplify some
code.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/cardbus/if_rtw_cardbus.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/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Feb 26 00:01:27 UTC 2010

Modified Files:
src/sys/dev/cardbus: adv_cardbus.c ahc_cardbus.c if_ex_cardbus.c
if_re_cardbus.c if_rtk_cardbus.c if_tlp_cardbus.c

Log Message:
sc_csr is read  written from the PCI Command  Status Register,
so make its type pcireg_t.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/cardbus/adv_cardbus.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/cardbus/ahc_cardbus.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/cardbus/if_ex_cardbus.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/cardbus/if_re_cardbus.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/cardbus/if_rtk_cardbus.c
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/cardbus/if_tlp_cardbus.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/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Feb 26 00:01:27 UTC 2010

Modified Files:
src/sys/dev/cardbus: adv_cardbus.c ahc_cardbus.c if_ex_cardbus.c
if_re_cardbus.c if_rtk_cardbus.c if_tlp_cardbus.c

Log Message:
sc_csr is read  written from the PCI Command  Status Register,
so make its type pcireg_t.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/cardbus/adv_cardbus.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/cardbus/ahc_cardbus.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/cardbus/if_ex_cardbus.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/cardbus/if_re_cardbus.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/cardbus/if_rtk_cardbus.c
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/cardbus/if_tlp_cardbus.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/cardbus/adv_cardbus.c
diff -u src/sys/dev/cardbus/adv_cardbus.c:1.24 src/sys/dev/cardbus/adv_cardbus.c:1.25
--- src/sys/dev/cardbus/adv_cardbus.c:1.24	Thu Feb 25 23:40:39 2010
+++ src/sys/dev/cardbus/adv_cardbus.c	Fri Feb 26 00:01:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: adv_cardbus.c,v 1.24 2010/02/25 23:40:39 dyoung Exp $	*/
+/*	$NetBSD: adv_cardbus.c,v 1.25 2010/02/26 00:01:27 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: adv_cardbus.c,v 1.24 2010/02/25 23:40:39 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: adv_cardbus.c,v 1.25 2010/02/26 00:01:27 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -77,7 +77,7 @@
 	pcitag_t sc_tag;
 
 	int	sc_bar;
-	int	sc_csr;			/* CSR bits */
+	pcireg_t	sc_csr;
 	bus_size_t sc_size;
 };
 

Index: src/sys/dev/cardbus/ahc_cardbus.c
diff -u src/sys/dev/cardbus/ahc_cardbus.c:1.31 src/sys/dev/cardbus/ahc_cardbus.c:1.32
--- src/sys/dev/cardbus/ahc_cardbus.c:1.31	Thu Feb 25 23:40:39 2010
+++ src/sys/dev/cardbus/ahc_cardbus.c	Fri Feb 26 00:01:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahc_cardbus.c,v 1.31 2010/02/25 23:40:39 dyoung Exp $	*/
+/*	$NetBSD: ahc_cardbus.c,v 1.32 2010/02/26 00:01:27 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2005 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ahc_cardbus.c,v 1.31 2010/02/25 23:40:39 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: ahc_cardbus.c,v 1.32 2010/02/26 00:01:27 dyoung Exp $);
 
 #include opt_ahc_cardbus.h
 
@@ -80,7 +80,7 @@
 	pcitag_t sc_tag;
 
 	int	sc_bar;
-	int	sc_csr;			/* CSR bits */
+	pcireg_t	sc_csr;
 	bus_size_t sc_size;
 };
 

Index: src/sys/dev/cardbus/if_ex_cardbus.c
diff -u src/sys/dev/cardbus/if_ex_cardbus.c:1.48 src/sys/dev/cardbus/if_ex_cardbus.c:1.49
--- src/sys/dev/cardbus/if_ex_cardbus.c:1.48	Thu Feb 25 23:40:39 2010
+++ src/sys/dev/cardbus/if_ex_cardbus.c	Fri Feb 26 00:01:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ex_cardbus.c,v 1.48 2010/02/25 23:40:39 dyoung Exp $	*/
+/*	$NetBSD: if_ex_cardbus.c,v 1.49 2010/02/26 00:01:27 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998 and 1999
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ex_cardbus.c,v 1.48 2010/02/25 23:40:39 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ex_cardbus.c,v 1.49 2010/02/26 00:01:27 dyoung Exp $);
 
 /* #define EX_DEBUG 4 */	/* define to report information for debugging */
 
@@ -106,7 +106,7 @@
 
 	pcitag_t sc_tag;
 
-	int	sc_csr;			/* CSR bits */
+	pcireg_t	sc_csr;
 	int	sc_bar_reg;		/* which BAR to use */
 	pcireg_t sc_bar_val;		/* value of the BAR */
 	int	sc_bar_reg1;		/* which BAR to use */

Index: src/sys/dev/cardbus/if_re_cardbus.c
diff -u src/sys/dev/cardbus/if_re_cardbus.c:1.22 src/sys/dev/cardbus/if_re_cardbus.c:1.23
--- src/sys/dev/cardbus/if_re_cardbus.c:1.22	Thu Feb 25 23:40:39 2010
+++ src/sys/dev/cardbus/if_re_cardbus.c	Fri Feb 26 00:01:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_re_cardbus.c,v 1.22 2010/02/25 23:40:39 dyoung Exp $	*/
+/*	$NetBSD: if_re_cardbus.c,v 1.23 2010/02/26 00:01:27 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2004 Jonathan Stone
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_re_cardbus.c,v 1.22 2010/02/25 23:40:39 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_re_cardbus.c,v 1.23 2010/02/26 00:01:27 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -92,7 +92,7 @@
 	void *sc_ih;
 	cardbus_devfunc_t sc_ct;
 	pcitag_t sc_tag;
-	int sc_csr;
+	pcireg_t sc_csr;
 	int sc_bar_reg;
 	pcireg_t sc_bar_val;
 	bus_size_t sc_mapsize;

Index: src/sys/dev/cardbus/if_rtk_cardbus.c
diff -u src/sys/dev/cardbus/if_rtk_cardbus.c:1.41 src/sys/dev/cardbus/if_rtk_cardbus.c:1.42
--- src/sys/dev/cardbus/if_rtk_cardbus.c:1.41	Thu Feb 25 23:40:39 2010
+++ src/sys/dev/cardbus/if_rtk_cardbus.c	Fri Feb 26 00:01:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rtk_cardbus.c,v 1.41 2010/02/25 23:40:39 dyoung Exp $	*/
+/*	$NetBSD: if_rtk_cardbus.c,v 1.42 2010/02/26 00:01:27 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2000 Masanori Kanaoka
@@ 

CVS commit: src/sys/dev/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Feb 26 00:57:02 UTC 2010

Modified Files:
src/sys/dev/cardbus: adv_cardbus.c ahc_cardbus.c cardbus.c
cardbus_map.c cardbusreg.h com_cardbus.c ehci_cardbus.c
fwohci_cardbus.c if_ex_cardbus.c if_fxp_cardbus.c if_ral_cardbus.c
if_re_cardbus.c if_rtk_cardbus.c if_tlp_cardbus.c njata_cardbus.c
njs_cardbus.c ohci_cardbus.c rbus_ppb.c siisata_cardbus.c
uhci_cardbus.c

Log Message:
Use PCI_ constants and macros instead of CARDBUS_.  Use
Cardbus_conf_{read,write}() instead of cardbus_conf_{read,write}().
Delete all of the CARDBUS_ constants and macros that replicate PCI_.

Compile-tested, only.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/cardbus/adv_cardbus.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/cardbus/ahc_cardbus.c
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/cardbus/cardbus.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/cardbus/cardbus_map.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/cardbus/cardbusreg.h
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/cardbus/com_cardbus.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/cardbus/ehci_cardbus.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/cardbus/fwohci_cardbus.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/cardbus/if_ex_cardbus.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/cardbus/if_fxp_cardbus.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/cardbus/if_ral_cardbus.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/cardbus/if_re_cardbus.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/cardbus/if_rtk_cardbus.c
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/cardbus/if_tlp_cardbus.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/cardbus/njata_cardbus.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/cardbus/njs_cardbus.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/cardbus/ohci_cardbus.c \
src/sys/dev/cardbus/rbus_ppb.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/cardbus/siisata_cardbus.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/cardbus/uhci_cardbus.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/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Feb 26 01:12:56 UTC 2010

Modified Files:
src/sys/dev/cardbus: cardbus.c cardbusvar.h if_rtw_cardbus.c

Log Message:
Introduce Cardbus_intr_establish(cardbus_devfunc_t, ...) and
Cardbus_intr_disestablish(cardbus_devfunc_t, ...) and start using them.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/cardbus/cardbus.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/cardbus/cardbusvar.h
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/cardbus/if_rtw_cardbus.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/cardbus/cardbus.c
diff -u src/sys/dev/cardbus/cardbus.c:1.105 src/sys/dev/cardbus/cardbus.c:1.106
--- src/sys/dev/cardbus/cardbus.c:1.105	Fri Feb 26 00:57:01 2010
+++ src/sys/dev/cardbus/cardbus.c	Fri Feb 26 01:12:56 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cardbus.c,v 1.105 2010/02/26 00:57:01 dyoung Exp $	*/
+/*	$NetBSD: cardbus.c,v 1.106 2010/02/26 01:12:56 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999 and 2000
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cardbus.c,v 1.105 2010/02/26 00:57:01 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: cardbus.c,v 1.106 2010/02/26 01:12:56 dyoung Exp $);
 
 #include opt_cardbus.h
 
@@ -710,6 +710,14 @@
 	free(ct, M_DEVBUF);
 }
 
+void *
+Cardbus_intr_establish(cardbus_devfunc_t ct,
+cardbus_intr_line_t irq, int level, int (*func)(void *), void *arg)
+{
+	return cardbus_intr_establish(ct-ct_cc, ct-ct_cf, irq, level, func,
+	arg);
+}
+
 /*
  * void *cardbus_intr_establish(cc, cf, irq, level, func, arg)
  *   Interrupt handler of pccard.
@@ -726,6 +734,12 @@
 	return ((*cf-cardbus_intr_establish)(cc, irq, level, func, arg));
 }
 
+void
+Cardbus_intr_disestablish(cardbus_devfunc_t ct, void *handler)
+{
+	cardbus_intr_disestablish(ct-ct_cc, ct-ct_cf, handler);
+}
+
 /*
  * void cardbus_intr_disestablish(cc, cf, handler)
  *   Interrupt handler of pccard.

Index: src/sys/dev/cardbus/cardbusvar.h
diff -u src/sys/dev/cardbus/cardbusvar.h:1.47 src/sys/dev/cardbus/cardbusvar.h:1.48
--- src/sys/dev/cardbus/cardbusvar.h:1.47	Thu Feb 25 00:47:39 2010
+++ src/sys/dev/cardbus/cardbusvar.h	Fri Feb 26 01:12:56 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cardbusvar.h,v 1.47 2010/02/25 00:47:39 dyoung Exp $	*/
+/*	$NetBSD: cardbusvar.h,v 1.48 2010/02/26 01:12:56 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 and 2000
@@ -303,6 +303,10 @@
 
 int cardbus_attach_card(struct cardbus_softc *);
 void cardbus_detach_card(struct cardbus_softc *);
+void *
+Cardbus_intr_establish(cardbus_devfunc_t,
+cardbus_intr_line_t, int, int (*)(void *), void *);
+void Cardbus_intr_disestablish(cardbus_devfunc_t, void *);
 void *cardbus_intr_establish(cardbus_chipset_tag_t, cardbus_function_tag_t,
 cardbus_intr_line_t, int, int (*) (void *), void *arg);
 void cardbus_intr_disestablish(cardbus_chipset_tag_t,

Index: src/sys/dev/cardbus/if_rtw_cardbus.c
diff -u src/sys/dev/cardbus/if_rtw_cardbus.c:1.37 src/sys/dev/cardbus/if_rtw_cardbus.c:1.38
--- src/sys/dev/cardbus/if_rtw_cardbus.c:1.37	Thu Feb 25 23:01:48 2010
+++ src/sys/dev/cardbus/if_rtw_cardbus.c	Fri Feb 26 01:12:56 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: if_rtw_cardbus.c,v 1.37 2010/02/25 23:01:48 dyoung Exp $ */
+/* $NetBSD: if_rtw_cardbus.c,v 1.38 2010/02/26 01:12:56 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2004, 2005 David Young.  All rights reserved.
@@ -64,7 +64,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_rtw_cardbus.c,v 1.37 2010/02/25 23:01:48 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_rtw_cardbus.c,v 1.38 2010/02/26 01:12:56 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -321,7 +321,7 @@
 	 * Unhook the interrupt handler.
 	 */
 	if (csc-sc_ih != NULL)
-		cardbus_intr_disestablish(ct-ct_cc, ct-ct_cf, csc-sc_ih);
+		Cardbus_intr_disestablish(ct, csc-sc_ih);
 
 	/*
 	 * Release bus space and close window.
@@ -339,13 +339,11 @@
 	struct rtw_cardbus_softc *csc = device_private(self);
 	struct rtw_softc *sc = csc-sc_rtw;
 	cardbus_devfunc_t ct = csc-sc_ct;
-	cardbus_chipset_tag_t cc = ct-ct_cc;
-	cardbus_function_tag_t cf = ct-ct_cf;
 
 	/*
 	 * Map and establish the interrupt.
 	 */
-	csc-sc_ih = cardbus_intr_establish(cc, cf, csc-sc_intrline, IPL_NET,
+	csc-sc_ih = Cardbus_intr_establish(ct, csc-sc_intrline, IPL_NET,
 	rtw_intr, sc);
 	if (csc-sc_ih == NULL) {
 		aprint_error_dev(sc-sc_dev,
@@ -367,8 +365,6 @@
 	struct rtw_cardbus_softc *csc = device_private(self);
 	struct rtw_softc *sc = csc-sc_rtw;
 	cardbus_devfunc_t ct = csc-sc_ct;
-	cardbus_chipset_tag_t cc = ct-ct_cc;
-	cardbus_function_tag_t cf = ct-ct_cf;
 
 	if (!rtw_suspend(self, qual))
 		return false;
@@ -379,7 +375,7 @@
 	rtw_cardbus_funcregen(sc-sc_regs, 0);
 
 	/* Unhook the interrupt handler. */
-	cardbus_intr_disestablish(cc, cf, csc-sc_ih);
+	Cardbus_intr_disestablish(ct, csc-sc_ih);
 	csc-sc_ih = NULL;
 	return true;
 }



CVS commit: src/sys/dev/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Feb 26 01:12:56 UTC 2010

Modified Files:
src/sys/dev/cardbus: cardbus.c cardbusvar.h if_rtw_cardbus.c

Log Message:
Introduce Cardbus_intr_establish(cardbus_devfunc_t, ...) and
Cardbus_intr_disestablish(cardbus_devfunc_t, ...) and start using them.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/cardbus/cardbus.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/cardbus/cardbusvar.h
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/cardbus/if_rtw_cardbus.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/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Feb 26 01:15:08 UTC 2010

Modified Files:
src/sys/dev/cardbus: cardbusvar.h

Log Message:
Cosmetic: join a line.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/cardbus/cardbusvar.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/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Feb 26 01:15:08 UTC 2010

Modified Files:
src/sys/dev/cardbus: cardbusvar.h

Log Message:
Cosmetic: join a line.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/cardbus/cardbusvar.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/cardbus/cardbusvar.h
diff -u src/sys/dev/cardbus/cardbusvar.h:1.48 src/sys/dev/cardbus/cardbusvar.h:1.49
--- src/sys/dev/cardbus/cardbusvar.h:1.48	Fri Feb 26 01:12:56 2010
+++ src/sys/dev/cardbus/cardbusvar.h	Fri Feb 26 01:15:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cardbusvar.h,v 1.48 2010/02/26 01:12:56 dyoung Exp $	*/
+/*	$NetBSD: cardbusvar.h,v 1.49 2010/02/26 01:15:08 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 and 2000
@@ -303,8 +303,7 @@
 
 int cardbus_attach_card(struct cardbus_softc *);
 void cardbus_detach_card(struct cardbus_softc *);
-void *
-Cardbus_intr_establish(cardbus_devfunc_t,
+void *Cardbus_intr_establish(cardbus_devfunc_t,
 cardbus_intr_line_t, int, int (*)(void *), void *);
 void Cardbus_intr_disestablish(cardbus_devfunc_t, void *);
 void *cardbus_intr_establish(cardbus_chipset_tag_t, cardbus_function_tag_t,



CVS commit: src/sys/dev/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Feb 26 01:16:09 UTC 2010

Modified Files:
src/sys/dev/cardbus: cardbusvar.h

Log Message:
Cosmetic: re-wrap some line.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/cardbus/cardbusvar.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/cardbus

2010-02-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Feb 26 01:16:09 UTC 2010

Modified Files:
src/sys/dev/cardbus: cardbusvar.h

Log Message:
Cosmetic: re-wrap some line.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/cardbus/cardbusvar.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/cardbus/cardbusvar.h
diff -u src/sys/dev/cardbus/cardbusvar.h:1.49 src/sys/dev/cardbus/cardbusvar.h:1.50
--- src/sys/dev/cardbus/cardbusvar.h:1.49	Fri Feb 26 01:15:08 2010
+++ src/sys/dev/cardbus/cardbusvar.h	Fri Feb 26 01:16:09 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cardbusvar.h,v 1.49 2010/02/26 01:15:08 dyoung Exp $	*/
+/*	$NetBSD: cardbusvar.h,v 1.50 2010/02/26 01:16:09 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 and 2000
@@ -308,8 +308,8 @@
 void Cardbus_intr_disestablish(cardbus_devfunc_t, void *);
 void *cardbus_intr_establish(cardbus_chipset_tag_t, cardbus_function_tag_t,
 cardbus_intr_line_t, int, int (*) (void *), void *arg);
-void cardbus_intr_disestablish(cardbus_chipset_tag_t,
-cardbus_function_tag_t, void *);
+void cardbus_intr_disestablish(cardbus_chipset_tag_t, cardbus_function_tag_t,
+void *);
 
 int cardbus_mapreg_map(struct cardbus_softc *, int, int, pcireg_t,
 int, bus_space_tag_t *, bus_space_handle_t *, bus_addr_t *, bus_size_t *);



CVS commit: src/sys/dev/cardbus

2010-01-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jan 18 18:52:35 UTC 2010

Modified Files:
src/sys/dev/cardbus: if_ath_cardbus.c if_atw_cardbus.c if_fxp_cardbus.c
if_ral_cardbus.c if_rtk_cardbus.c if_rtw_cardbus.c if_tlp_cardbus.c

Log Message:
Remove conditional inclusion of unused bpf.h


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/cardbus/if_ath_cardbus.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/cardbus/if_atw_cardbus.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/cardbus/if_fxp_cardbus.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/cardbus/if_ral_cardbus.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/cardbus/if_rtk_cardbus.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/cardbus/if_rtw_cardbus.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/cardbus/if_tlp_cardbus.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/cardbus

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

Modified Files:
src/sys/dev/cardbus: cardbus.c ehci_cardbus.c if_ath_cardbus.c
if_atw_cardbus.c if_rtw_cardbus.c siisata_cardbus.c

Log Message:
Expand PMF_FN_* macros.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/cardbus/cardbus.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/cardbus/ehci_cardbus.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/cardbus/if_ath_cardbus.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/cardbus/if_atw_cardbus.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/cardbus/if_rtw_cardbus.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/cardbus/siisata_cardbus.c

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