Subject: pciide_machdep_compat_intr_establish()
To: None <tech-kern@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-kern
Date: 06/03/2001 12:27:39
The pciide_machdep_compat_intr_establish() only does something on
~half the ports that use pciide.  The following patch makes it's use
conditional on having __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
defined in <machine/pci_machdep.h>

I tested this on an alpha pc164 (which uses the function) and
cross-built (but not ran) a macppc kernel (which doesn't use the
function).

Comments?

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD CDs, Support and Service:    http://www.wasabisystems.com/

remove arch/arc/pci/pciide_machdep.c
remove arch/macppc/pci/pciide_machdep.c
remove arch/sgimips/pci/pciide_machdep.c
remove arch/sparc64/dev/pciide_machdep.c

Index: arch/algor/include/pci_machdep.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/algor/include/pci_machdep.h,v
retrieving revision 1.1
diff -d -p -u -r1.1 pci_machdep.h
--- arch/algor/include/pci_machdep.h	2001/05/28 16:22:19	1.1
+++ arch/algor/include/pci_machdep.h	2001/06/03 01:23:24
@@ -30,6 +30,7 @@
 /*
  * Machine-specific definitions for PCI autoconfiguration.
  */
+#define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
 
 /*
  * Types provided to machine-independent PCI code
Index: arch/alpha/include/pci_machdep.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/alpha/include/pci_machdep.h,v
retrieving revision 1.6
diff -d -p -u -r1.6 pci_machdep.h
--- arch/alpha/include/pci_machdep.h	2000/12/28 22:59:06	1.6
+++ arch/alpha/include/pci_machdep.h	2001/06/03 01:23:24
@@ -30,6 +30,7 @@
 /*
  * Machine-specific definitions for PCI autoconfiguration.
  */
+#define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
 
 /*
  * Types provided to machine-independent PCI code
Index: arch/arc/conf/files.arc
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/arc/conf/files.arc,v
retrieving revision 1.30
diff -d -p -u -r1.30 files.arc
--- arch/arc/conf/files.arc	2001/05/22 03:22:49	1.30
+++ arch/arc/conf/files.arc	2001/06/03 01:23:24
@@ -156,8 +156,6 @@ define	pcmcia {}			# XXX dummy decl...
 include	"dev/pci/files.pci"
 include	"dev/isa/files.isa"
 
-file arch/arc/pci/pciide_machdep.c		pciide
-
 #	Real time clock, must have one..
 device	aclock
 attach	aclock at jazzio with aclock_jazzio
Index: arch/arm32/include/pci_machdep.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/arm32/include/pci_machdep.h,v
retrieving revision 1.8
diff -d -p -u -r1.8 pci_machdep.h
--- arch/arm32/include/pci_machdep.h	2001/02/23 21:23:51	1.8
+++ arch/arm32/include/pci_machdep.h	2001/06/03 01:23:24
@@ -1,3 +1,5 @@
 /* $NetBSD: pci_machdep.h,v 1.8 2001/02/23 21:23:51 reinoud Exp $ */
 
 #include <arm/pci_machdep.h>
+
+#define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
Index: arch/atari/include/pci_machdep.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/atari/include/pci_machdep.h,v
retrieving revision 1.7
diff -d -p -u -r1.7 pci_machdep.h
--- arch/atari/include/pci_machdep.h	2000/12/28 22:59:08	1.7
+++ arch/atari/include/pci_machdep.h	2001/06/03 01:23:24
@@ -37,6 +37,11 @@
 #include <atari/atari/intr.h>
 
 /*
+ * Machine-specific definitions for PCI autoconfiguration.
+ */
+#define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
+
+/*
  * Forward declarations.
  */
 struct pci_attach_args;
Index: arch/cobalt/include/pci_machdep.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/cobalt/include/pci_machdep.h,v
retrieving revision 1.3
diff -d -p -u -r1.3 pci_machdep.h
--- arch/cobalt/include/pci_machdep.h	2000/12/28 22:59:09	1.3
+++ arch/cobalt/include/pci_machdep.h	2001/06/03 01:23:24
@@ -33,6 +33,7 @@
 /*
  * Machine-specific definitions for PCI autoconfiguration.
  */
+#define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
 
 /*
  * Forward declarations.
Index: arch/i386/include/pci_machdep.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/include/pci_machdep.h,v
retrieving revision 1.16
diff -d -p -u -r1.16 pci_machdep.h
--- arch/i386/include/pci_machdep.h	2000/12/28 22:59:09	1.16
+++ arch/i386/include/pci_machdep.h	2001/06/03 01:23:24
@@ -33,6 +33,7 @@
 /*
  * Machine-specific definitions for PCI autoconfiguration.
  */
+#define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
 
 /*
  * Many i386 PCI systems only work properly with I/O mapped space, in
Index: arch/macppc/conf/files.macppc
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/macppc/conf/files.macppc,v
retrieving revision 1.42
diff -d -p -u -r1.42 files.macppc
--- arch/macppc/conf/files.macppc	2001/05/16 10:56:43	1.42
+++ arch/macppc/conf/files.macppc	2001/06/03 01:23:25
@@ -99,8 +99,6 @@ file arch/macppc/pci/uninorth.c			uninor
 # PCI bus support
 include "dev/pci/files.pci"
 
-file arch/macppc/pci/pciide_machdep.c		pciide
-
 # network devices MII bus
 include "dev/mii/files.mii"
 
Index: arch/macppc/include/pci_machdep.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/macppc/include/pci_machdep.h,v
retrieving revision 1.13
diff -d -p -u -r1.13 pci_machdep.h
--- arch/macppc/include/pci_machdep.h	2000/12/28 22:59:09	1.13
+++ arch/macppc/include/pci_machdep.h	2001/06/03 01:23:25
@@ -63,8 +63,8 @@ struct pci_bridge {
 	int bus;
 	bus_space_tag_t memt;
 	bus_space_tag_t iot;
-	pcireg_t (*conf_read)();
-	void (*conf_write)();
+	pcireg_t (*conf_read)(pci_chipset_tag_t, pcitag_t, int);
+	void (*conf_write)(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
 };
 
 extern struct macppc_bus_dma_tag pci_bus_dma_tag;
@@ -92,3 +92,4 @@ void		pci_intr_disestablish(pci_chipset_
  * Internal functions.
  */
 void		pci_init(int);
+int		pcidev_to_ofdev(pci_chipset_tag_t, pcitag_t);
Index: arch/netwinder/include/pci_machdep.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/netwinder/include/pci_machdep.h,v
retrieving revision 1.1
diff -d -p -u -r1.1 pci_machdep.h
--- arch/netwinder/include/pci_machdep.h	2001/04/19 07:11:03	1.1
+++ arch/netwinder/include/pci_machdep.h	2001/06/03 01:23:25
@@ -1,3 +1,5 @@
 /* $NetBSD: pci_machdep.h,v 1.1 2001/04/19 07:11:03 matt Exp $ */
 
 #include <arm/pci_machdep.h>
+
+#define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
Index: arch/sgimips/include/pci_machdep.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sgimips/include/pci_machdep.h,v
retrieving revision 1.2
diff -d -p -u -r1.2 pci_machdep.h
--- arch/sgimips/include/pci_machdep.h	2000/12/28 22:59:10	1.2
+++ arch/sgimips/include/pci_machdep.h	2001/06/03 01:23:25
@@ -33,6 +33,7 @@
 /*
  * Machine-specific definitions for PCI autoconfiguration.
  */
+#define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
 
 /*
  * Forward declarations.
Index: arch/sparc64/conf/files.sparc64
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sparc64/conf/files.sparc64,v
retrieving revision 1.46
diff -d -p -u -r1.46 files.sparc64
--- arch/sparc64/conf/files.sparc64	2001/04/13 16:26:41	1.46
+++ arch/sparc64/conf/files.sparc64	2001/06/03 01:23:25
@@ -53,7 +53,6 @@ attach  simba at pci
 file	arch/sparc64/dev/simba.c		simba
 
 include "dev/ata/files.ata"
-file	arch/sparc64/dev/pciide_machdep.c	pciide
 
 device ebus {[addr = -1]}: pcibus
 attach ebus at pci
Index: dev/pci/pciide.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pci/pciide.c,v
retrieving revision 1.118
diff -d -p -u -r1.118 pciide.c
--- dev/pci/pciide.c	2001/05/30 20:30:02	1.118
+++ dev/pci/pciide.c	2001/06/03 01:23:28
@@ -1258,13 +1258,17 @@ pciide_map_compat_intr(pa, cp, compatcha
 	if ((interface & PCIIDE_INTERFACE_PCI(wdc_cp->channel)) != 0)
 		return;
 
+#ifdef __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
 	cp->ih = pciide_machdep_compat_intr_establish(&sc->sc_wdcdev.sc_dev,
 	    pa, compatchan, pciide_compat_intr, cp);
 	if (cp->ih == NULL) {
+#endif
 		printf("%s: no compatibility interrupt for use by %s "
 		    "channel\n", sc->sc_wdcdev.sc_dev.dv_xname, cp->name);
 		cp->hw_ok = 0;
+#ifdef __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
 	}
+#endif
 }
 
 void
Index: dev/pci/pciidevar.h
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pci/pciidevar.h,v
retrieving revision 1.6
diff -d -p -u -r1.6 pciidevar.h
--- dev/pci/pciidevar.h	2001/01/12 16:04:00	1.6
+++ dev/pci/pciidevar.h	2001/06/03 01:23:28
@@ -83,5 +83,7 @@ struct pciide_softc {
  */
 
 /* Attach compat interrupt handler, returning handle or NULL if failed. */
+#ifdef __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
 void	*pciide_machdep_compat_intr_establish __P((struct device *,
 	    struct pci_attach_args *, int, int (*)(void *), void *));
+#endif