patches against -current for the IBM 7024

Tim Rightnour <[email protected]>
Newsgroups gmane.os.netbsd.ports.prep
Message-ID <[email protected]>
Patches attached.  The only unclean patch here is in pci/pci_machdep.c.  The
version of -current I was working with is very slightly older than HEAD. 
Namely the change of:

-       return (PCI_CONF_DEFAULT);
to
+       return (PCI_CONF_ALL & ~PCI_CONF_MAP_ROM);

should not be there.

---
Tim Rightnour <[email protected]>
NetBSD: Free multi-architecture OS http://www.netbsd.org/
Genecys: Open Source 3D MMORPG: http://www.genecys.org/
7024eisa.patch (application/octet-stream, 30.9 KB)
diff -rNu -x obj -x CVS prep-orig/conf/GENERIC prep/conf/GENERIC
--- prep-orig/conf/GENERIC	2006-02-04 22:02:02.000000000 -0700
+++ prep/conf/GENERIC	2006-02-21 13:02:19.000000000 -0700
@@ -34,6 +34,7 @@
 options 	PLATFORM_IBM_6050		# IBM Personal Power Series 830
 options 	PLATFORM_IBM_7248		# IBM RS/6000 7248-100/120/133
 options 	PLATFORM_IBM_7043_140		# IBM RS/6000 43P 7043-140
+options		PLATFORM_IBM_7024		# IBM RS/6000 7024-E20/E30
 options 	PLATFORM_MOTOROLA_ULMB60XA	# Motorola ULMB60xA (?)
 
 options 	OPENPIC				# OpenPIC support (7043-140)
@@ -207,9 +208,14 @@
 pchb*	at pci? dev ? function ?	# PCI-Host bridges
 ppb*	at pci? dev ? function ?	# PCI-PCI bridges
 pcib*	at pci? dev ? function ?	# PCI-ISA bridges
+pceb*	at pci? dev ? function ?	# PCI-EISA bridges
+
+# EISA bus support
+eisa*	at pceb?
 
 # ISA bus support
 isa*	at pcib?			# ISA on PCI-ISA bridge
+isa*	at pceb?
 
 # PCMCIA bus support
 pcmcia* at pcic? controller ? socket ?
diff -rNu -x obj -x CVS prep-orig/conf/files.prep prep/conf/files.prep
--- prep-orig/conf/files.prep	2005-12-11 05:18:47.000000000 -0700
+++ prep/conf/files.prep	2006-02-20 21:43:03.000000000 -0700
@@ -13,6 +13,7 @@
 			PLATFORM_IBM_6050
 			PLATFORM_IBM_7248
 			PLATFORM_IBM_7043_140
+			PLATFORM_IBM_7024
 			PLATFORM_MOTOROLA_ULMB60XA
 
 # IBM
@@ -22,6 +23,7 @@
 file	arch/prep/prep/ibm_6050.c	platform_ibm_6050
 file	arch/prep/prep/ibm_7248.c	platform_ibm_7248
 file	arch/prep/prep/ibm_7043_140.c	platform_ibm_7043_140
+file	arch/prep/prep/ibm_7024.c	platform_ibm_7024
 
 # Motorola
 file	arch/prep/prep/mot_machdep.c
@@ -101,6 +103,11 @@
 attach	pcib at pci
 file	arch/prep/pci/pcib.c		pcib
 
+# PCI-EISA bridges
+device	pceb: eisabus, isabus
+attach	pceb at pci
+file	arch/prep/pci/pceb.c		pceb
+
 # IBM G10 display on ThinkPad 820
 device	gten: wsemuldisplaydev, rasops8
 attach	gten at pci
@@ -151,6 +158,13 @@
 attach	paud at isa with paud_isa
 file	arch/prep/isa/paud_isa.c	paud_isa
 
+#
+# EISA-only drivers
+#
+
+include	"dev/eisa/files.eisa"
+file	arch/prep/eisa/eisa_machdep.c	eisa
+
 # USB drivers
 include "dev/usb/files.usb"
 
diff -rNu -x obj -x CVS prep-orig/eisa/eisa_machdep.c prep/eisa/eisa_machdep.c
--- prep-orig/eisa/eisa_machdep.c	1969-12-31 17:00:00.000000000 -0700
+++ prep/eisa/eisa_machdep.c	2006-02-21 13:14:24.000000000 -0700
@@ -0,0 +1,221 @@
+/*	$NetBSD: eisa_machdep.c,v 1.25 2005/12/11 12:17:41 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the NetBSD
+ *	Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christopher G. Demetriou
+ *	for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Machine-specific functions for EISA autoconfiguration.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: eisa_machdep.c,v 1.25 2005/12/11 12:17:41 christos Exp $");
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/systm.h>
+#include <sys/errno.h>
+#include <sys/device.h>
+#include <sys/extent.h>
+
+#define _POWERPC_BUS_DMA_PRIVATE
+#include <machine/bus.h>
+#include <machine/pio.h>
+#include <machine/intr.h>
+
+#include <dev/isa/isareg.h>
+#include <dev/isa/isavar.h>
+#include <dev/eisa/eisavar.h>
+
+/*
+ * EISA doesn't have any special needs; just use the generic versions
+ * of these funcions.
+ */
+struct powerpc_bus_dma_tag eisa_bus_dma_tag = {
+	0,			/* _bounce_thresh */
+	_bus_dmamap_create,
+	_bus_dmamap_destroy,
+	_bus_dmamap_load,
+	_bus_dmamap_load_mbuf,
+	_bus_dmamap_load_uio,
+	_bus_dmamap_load_raw,
+	_bus_dmamap_unload,
+	NULL,			/* _dmamap_sync */
+	_bus_dmamem_alloc,
+	_bus_dmamem_free,
+	_bus_dmamem_map,
+	_bus_dmamem_unmap,
+	_bus_dmamem_mmap,
+};
+
+void
+eisa_attach_hook(struct device *parent, struct device *self,
+    struct eisabus_attach_args *eba)
+{
+	/* Nothing to do. */
+}
+
+int
+eisa_maxslots(eisa_chipset_tag_t ec)
+{
+
+	/*
+	 * Always try 16 slots.
+	 */
+	return (16);
+}
+
+int
+eisa_intr_map(eisa_chipset_tag_t ec, u_int irq, eisa_intr_handle_t *ihp)
+{
+	if (irq >= I8259_INTR_NUM) {
+		printf("eisa_intr_map: bad IRQ %d\n", irq);
+		*ihp = -1;
+		return 1;
+	}
+	if (irq == 2) {
+		printf("eisa_intr_map: changed IRQ 2 to IRQ 9\n");
+		irq = 9;
+	}
+
+	*ihp = irq;
+	return 0;
+}
+
+const char *
+eisa_intr_string(eisa_chipset_tag_t ec, eisa_intr_handle_t ih)
+{
+	static char irqstr[8];		/* 4 + 2 + NULL + sanity */
+
+	if (ih == 0 || (ih & 0xff) >= I8259_INTR_NUM || ih == 2)
+		panic("eisa_intr_string: bogus handle 0x%x", ih);
+
+	snprintf(irqstr, sizeof(irqstr), "irq %d", ih);
+	return (irqstr);
+	
+}
+
+const struct evcnt *
+eisa_intr_evcnt(eisa_chipset_tag_t ec, eisa_intr_handle_t ih)
+{
+
+	/* XXX for now, no evcnt parent reported */
+	return NULL;
+}
+
+void *
+eisa_intr_establish(eisa_chipset_tag_t ec, eisa_intr_handle_t ih,
+    int type, int level, int (*func)(void *), void *arg)
+{
+	int irq;
+
+	irq = ih;
+	return (void *)intr_establish(irq, type, level, func, arg);
+}
+
+void
+eisa_intr_disestablish(eisa_chipset_tag_t ec, void *cookie)
+{
+
+	intr_disestablish(cookie);
+}
+
+int
+eisa_conf_read_mem(eisa_chipset_tag_t ec, int slot, int func, int entry,
+    struct eisa_cfg_mem *ecm)
+{
+
+	/* XXX XXX XXX */
+	return (ENOENT);
+}
+
+int
+eisa_conf_read_irq(eisa_chipset_tag_t ec, int slot, int func, int entry,
+    struct eisa_cfg_irq *eci)
+{
+
+	/* XXX XXX XXX */
+	return (ENOENT);
+}
+
+int
+eisa_conf_read_dma(eisa_chipset_tag_t ec, int slot, int func, int entry,
+    struct eisa_cfg_dma *ecd)
+{
+
+	/* XXX XXX XXX */
+	return (ENOENT);
+}
+
+int
+eisa_conf_read_io(eisa_chipset_tag_t ec, int slot, int func, int entry,
+    struct eisa_cfg_io *ecio)
+{
+
+	/* XXX XXX XXX */
+	return (ENOENT);
+}
diff -rNu -x obj -x CVS prep-orig/include/bus.h prep/include/bus.h
--- prep-orig/include/bus.h	2005-12-11 05:18:47.000000000 -0700
+++ prep/include/bus.h	2006-02-21 11:10:51.000000000 -0700
@@ -120,8 +120,10 @@
 #ifdef _KERNEL
 extern struct powerpc_bus_space prep_io_space_tag;
 extern struct powerpc_bus_space prep_isa_io_space_tag;
+extern struct powerpc_bus_space prep_eisa_io_space_tag;
 extern struct powerpc_bus_space prep_mem_space_tag;
 extern struct powerpc_bus_space prep_isa_mem_space_tag;
+extern struct powerpc_bus_space prep_eisa_mem_space_tag;
 #endif
 
 #include <powerpc/bus.h>
diff -rNu -x obj -x CVS prep-orig/include/eisa_machdep.h prep/include/eisa_machdep.h
--- prep-orig/include/eisa_machdep.h	1969-12-31 17:00:00.000000000 -0700
+++ prep/include/eisa_machdep.h	2006-02-20 22:46:56.000000000 -0700
@@ -0,0 +1,82 @@
+/*	$NetBSD: eisa_machdep.h,v 1.10 2003/02/26 21:29:00 fvdl Exp $	*/
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Christopher G. Demetriou
+ *	for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Machine-specific definitions for EISA autoconfiguration.
+ */
+
+/*
+ * prep-specific EISA definitions.
+ * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
+ */
+#define	EISA_ID			"EISA"
+#define	EISA_ID_LEN		(sizeof(EISA_ID) - 1)
+#define	EISA_ID_PADDR		0xfffd9
+
+extern struct powerpc_bus_dma_tag eisa_bus_dma_tag;
+
+/* EISA Edge/Level trigger control registers */
+#define ELCR0   0x4d0                   /* eisa irq 0-7 */
+#define ELCR1   0x4d1                   /* eisa irq 8-15 */
+
+/*
+ * Types provided to machine-independent EISA code.
+ */
+typedef void *eisa_chipset_tag_t;
+typedef int eisa_intr_handle_t;
+
+/*
+ * Functions provided to machine-independent EISA code.
+ */
+void		eisa_attach_hook(struct device *, struct device *,
+		    struct eisabus_attach_args *);
+int		eisa_maxslots(eisa_chipset_tag_t);
+int		eisa_intr_map(eisa_chipset_tag_t, u_int,
+		    eisa_intr_handle_t *);
+const char	*eisa_intr_string(eisa_chipset_tag_t, eisa_intr_handle_t);
+const struct evcnt *eisa_intr_evcnt(eisa_chipset_tag_t, eisa_intr_handle_t);
+void		*eisa_intr_establish(eisa_chipset_tag_t,
+		    eisa_intr_handle_t, int, int, int (*)(void *), void *);
+void		eisa_intr_disestablish(eisa_chipset_tag_t, void *);
+int		eisa_mem_alloc(bus_space_tag_t, bus_size_t, bus_size_t,
+		    bus_addr_t, int, bus_addr_t *, bus_space_handle_t *);
+void		eisa_mem_free(bus_space_tag_t, bus_space_handle_t,
+		    bus_size_t);
+
+int		eisa_conf_read_mem(eisa_chipset_tag_t, int, int, int,
+		    struct eisa_cfg_mem *);
+int		eisa_conf_read_irq(eisa_chipset_tag_t, int, int, int,
+		    struct eisa_cfg_irq *);
+int		eisa_conf_read_dma(eisa_chipset_tag_t, int, int, int,
+		    struct eisa_cfg_dma *);
+int		eisa_conf_read_io(eisa_chipset_tag_t, int, int, int,
+		    struct eisa_cfg_io *);
diff -rNu -x obj -x CVS prep-orig/include/platform.h prep/include/platform.h
--- prep-orig/include/platform.h	2005-12-11 05:18:47.000000000 -0700
+++ prep/include/platform.h	2006-02-20 16:22:21.000000000 -0700
@@ -48,7 +48,7 @@
 	const char	*model;
 	int		(*match)(struct platform *);
 	void		(*pci_get_chipset_tag)(pci_chipset_tag_t);
-	void		(*pci_intr_fixup)(int, int, int, int *);
+	void		(*pci_intr_fixup)(int, int, int, int, int *);
 	void		(*init_intr)(void);
 	void		(*cpu_setup)(struct device *);
 	void		(*reset)(void);
@@ -65,7 +65,7 @@
 
 int ident_platform(void);
 int platform_generic_match(struct platform *);
-void pci_intr_nofixup(int, int, int, int *);
+void pci_intr_nofixup(int, int, int, int, int *);
 void cpu_setup_unknown(struct device *);
 void reset_unknown(void);
 void reset_prep_generic(void);
@@ -77,6 +77,7 @@
 extern struct platform platform_ibm_6050;
 extern struct platform platform_ibm_7248;
 extern struct platform platform_ibm_7043_140;
+extern struct platform platform_ibm_7024;
 
 void cpu_setup_ibm_generic(struct device *);
 
diff -rNu -x obj -x CVS prep-orig/pci/pceb.c prep/pci/pceb.c
--- prep-orig/pci/pceb.c	1969-12-31 17:00:00.000000000 -0700
+++ prep/pci/pceb.c	2006-02-21 11:29:01.000000000 -0700
@@ -0,0 +1,159 @@
+/*	$NetBSD: pceb.c,v 1.16 2005/12/11 12:17:43 christos Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: pceb.c,v 1.16 2005/12/11 12:17:43 christos Exp $");
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+
+#include <dev/isa/isavar.h>
+#include <dev/eisa/eisavar.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+
+#include <dev/pci/pcidevs.h>
+
+#include "eisa.h"
+#include "isa.h"
+
+int	pcebmatch(struct device *, struct cfdata *, void *);
+void	pcebattach(struct device *, struct device *, void *);
+
+CFATTACH_DECL(pceb, sizeof(struct device),
+    pcebmatch, pcebattach, NULL, NULL);
+
+void	pceb_callback(struct device *);
+
+union pceb_attach_args {
+	const char *ea_name;			/* XXX should be common */
+	struct isabus_attach_args ea_iba;
+	struct eisabus_attach_args ea_eba;
+};
+
+int
+pcebmatch(struct device *parent, struct cfdata *match, void *aux)
+{
+	struct pci_attach_args *pa = aux;
+
+	/*
+	 * Match anything which claims to be PCI-EISA bridge.
+	 */
+	if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
+	    PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_EISA)
+		return (1);
+
+	/*
+	 * Match some known PCI-EISA bridges explicitly.
+	 * XXX this is probably not necessary, should be matched by above
+	 * condition
+	 */
+	switch (PCI_VENDOR(pa->pa_id)) {
+	case PCI_VENDOR_INTEL:
+		switch (PCI_PRODUCT(pa->pa_id)) {
+		case PCI_PRODUCT_INTEL_PCEB:
+			return (1);
+		}
+		break;
+	}
+
+	return (0);
+}
+
+void
+pcebattach(struct device *parent, struct device *self, void *aux)
+{
+	struct pci_attach_args *pa = aux;
+	char devinfo[256];
+	int error;
+
+	printf("\n");
+
+	/*
+	 * Just print out a description and defer configuration
+	 * until all PCI devices have been attached.
+	 */
+	pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo));
+	printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo,
+	    PCI_REVISION(pa->pa_class));
+
+	prep_eisa_io_space_tag.pbs_extent = prep_io_space_tag.pbs_extent;
+	error = bus_space_init(&prep_eisa_io_space_tag, "eisa-ioport", NULL, 0);
+	if (error)
+		panic("prep_bus_space_init: can't init eisa io tag");
+
+	prep_eisa_mem_space_tag.pbs_extent = prep_mem_space_tag.pbs_extent;
+	error = bus_space_init(&prep_eisa_mem_space_tag, "eisa-iomem", NULL, 0);
+	if (error)
+		panic("prep_bus_space_init: can't init eisa mem tag");
+
+	config_defer(self, pceb_callback);
+}
+
+void
+pceb_callback(struct device *self)
+{
+	union pceb_attach_args ea;
+
+	/*
+	 * Attach the EISA bus behind this bridge.
+	 */
+	memset(&ea, 0, sizeof(ea));
+	ea.ea_eba.eba_iot = &prep_eisa_io_space_tag;
+	ea.ea_eba.eba_memt = &prep_eisa_mem_space_tag;
+#if NEISA > 0
+	ea.ea_eba.eba_dmat = &eisa_bus_dma_tag;
+#endif
+	config_found_ia(self, "eisabus", &ea.ea_eba, eisabusprint);
+
+	/*
+	 * Attach the ISA bus behind this bridge.
+	 */
+	memset(&ea, 0, sizeof(ea));
+	ea.ea_iba.iba_iot = &prep_isa_io_space_tag;
+	ea.ea_iba.iba_memt = &prep_isa_mem_space_tag;
+#if NISA > 0
+	ea.ea_iba.iba_dmat = &isa_bus_dma_tag;
+#endif
+	config_found_ia(self, "isabus", &ea.ea_iba, isabusprint);
+}
diff -rNu -x obj -x CVS prep-orig/pci/pci_machdep.c prep/pci/pci_machdep.c
--- prep-orig/pci/pci_machdep.c	2006-02-10 13:52:57.000000000 -0700
+++ prep/pci/pci_machdep.c	2006-02-20 16:27:57.000000000 -0700
@@ -192,7 +192,7 @@
     int swiz, int *iline)
 {
 
-	(*platform->pci_intr_fixup)(bus, dev, swiz, iline);
+	(*platform->pci_intr_fixup)(bus, dev, pin, swiz, iline);
 }
 
 int
@@ -207,5 +207,11 @@
 	    PCI_PRODUCT(id) == PCI_PRODUCT_WEITEK_P9100)
 		return 0;
 
-	return (PCI_CONF_DEFAULT);
+	/* We have allready mapped the MPIC2 if we have one, so leave it
+	   alone */
+	if (PCI_VENDOR(id) == PCI_VENDOR_IBM &&
+	    PCI_PRODUCT(id) == PCI_PRODUCT_IBM_MPIC2)
+		return 0;
+
+	return (PCI_CONF_ALL & ~PCI_CONF_MAP_ROM);
 }
diff -rNu -x obj -x CVS prep-orig/prep/ibm_6015.c prep/prep/ibm_6015.c
--- prep-orig/prep/ibm_6015.c	2005-12-11 05:18:48.000000000 -0700
+++ prep/prep/ibm_6015.c	2006-02-20 15:41:09.000000000 -0700
@@ -41,7 +41,7 @@
 #include <machine/intr.h>
 #include <machine/platform.h>
 
-void pci_intr_fixup_ibm_6015(int, int, int, int *);
+void pci_intr_fixup_ibm_6015(int, int, int, int, int *);
 
 struct platform platform_ibm_6015 = {
 	"IBM PPS Model 6015",			/* model */
@@ -55,7 +55,7 @@
 };
 
 void
-pci_intr_fixup_ibm_6015(int bus, int dev, int swiz, int *line)
+pci_intr_fixup_ibm_6015(int bus, int dev, int pin, int swiz, int *line)
 {
 	if (bus != 0)
 		return;
diff -rNu -x obj -x CVS prep-orig/prep/ibm_6040.c prep/prep/ibm_6040.c
--- prep-orig/prep/ibm_6040.c	2005-12-11 05:18:48.000000000 -0700
+++ prep/prep/ibm_6040.c	2006-02-20 15:41:24.000000000 -0700
@@ -45,7 +45,7 @@
 #include <machine/platform.h>
 
 /*
-static void pci_intr_fixup_ibm_6040(int, int, int, int *);
+static void pci_intr_fixup_ibm_6040(int, int, int, int, int *);
 */
 
 static const char *obiodevs_ibm_6040[] = {
diff -rNu -x obj -x CVS prep-orig/prep/ibm_6050.c prep/prep/ibm_6050.c
--- prep-orig/prep/ibm_6050.c	2005-12-11 05:18:48.000000000 -0700
+++ prep/prep/ibm_6050.c	2006-02-20 15:41:48.000000000 -0700
@@ -44,7 +44,7 @@
 #include <machine/intr.h>
 #include <machine/platform.h>
 
-static void pci_intr_fixup_ibm_6050(int, int, int, int *);
+static void pci_intr_fixup_ibm_6050(int, int, int, int, int *);
 
 static const char *obiodevs_ibm_6050[] = {
 	"wdc",
@@ -63,7 +63,7 @@
 };
 
 static void
-pci_intr_fixup_ibm_6050(int bus, int dev, int swiz, int *line)
+pci_intr_fixup_ibm_6050(int bus, int dev, int pin, int swiz, int *line)
 {
 	if (bus != 0)
 		return;
diff -rNu -x obj -x CVS prep-orig/prep/ibm_7024.c prep/prep/ibm_7024.c
--- prep-orig/prep/ibm_7024.c	1969-12-31 17:00:00.000000000 -0700
+++ prep/prep/ibm_7024.c	2006-02-20 20:35:47.000000000 -0700
@@ -0,0 +1,147 @@
+/*	$NetBSD: ibm_7043_140.c,v 1.5 2005/12/11 12:18:48 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by NONAKA Kimihiro.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the NetBSD
+ *	Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: ibm_7043_140.c,v 1.5 2005/12/11 12:18:48 christos Exp $");
+
+#include "opt_openpic.h"
+#if !defined(OPENPIC)
+#error RS/6000 7024 require "options OPENPIC" in kernel config file!
+#endif
+
+#include "pci.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+
+#include <machine/intr.h>
+#include <machine/platform.h>
+
+#include <powerpc/openpic.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcidevs.h>
+
+void pci_intr_fixup_ibm_7024(int, int, int, int, int *);
+void init_intr_mpic2(void);
+
+struct platform platform_ibm_7024 = {
+	"IBM Model 7024E20 (c0ED)",		/* model */
+	platform_generic_match,			/* match */
+	prep_pci_get_chipset_tag_indirect,	/* pci_get_chipset_tag */
+	pci_intr_fixup_ibm_7024,		/* pci_intr_fixup */
+	init_intr_mpic2,			/* init_intr */
+	cpu_setup_unknown,			/* cpu_setup */
+	reset_prep_generic,			/* reset */
+	obiodevs_nodev,				/* obiodevs */
+};
+
+
+/*
+  XXX:
+   The 7024 defines it's interrupt map in residual data.  The array below
+   is the interrupt map of a 7024 Model E20.  This will likely break given
+   a PCI card with it's own pci bridge.
+*/
+void
+pci_intr_fixup_ibm_7024(int bus, int dev, int pin, int swiz, int *line)
+{
+	static int irqmap[2][5][4] = {
+	      { { 0, 0, 0, 0 },
+		{ 0, 0, 0, 0 },
+		{ 0, 0, 0, 0 },
+		{ 2, 3, 2, 3 },
+		{ 4, 5, 4, 5 },
+	      },
+	      { { 1, 0, 0, 0 },
+		{ 8, 9, 8, 9 },
+		{ 10, 11, 10, 11 },
+		{ 12, 13, 12, 13 },
+		{ 14, 15, 14, 15 }
+	      }
+	};
+
+	if (bus < 2 && dev < 5 && pin < 5)
+		*line = irqmap[bus][dev][pin-1] + I8259_INTR_NUM;
+}
+
+
+void
+init_intr_mpic2(void)
+{
+	unsigned char *baseaddr = (unsigned char *)0xC0006800;	/* XXX */
+#if NPCI > 0
+	struct prep_pci_chipset pc;
+	pcitag_t tag;
+	pcireg_t id, address;
+
+	(*platform->pci_get_chipset_tag)(&pc);
+
+	tag = pci_make_tag(&pc, 0, 13, 0);
+	id = pci_conf_read(&pc, tag, PCI_ID_REG);
+
+	if (PCI_VENDOR(id) == PCI_VENDOR_IBM
+	    && PCI_PRODUCT(id) == PCI_PRODUCT_IBM_MPIC2) {
+		address = pci_conf_read(&pc, tag, 0x10);
+		if ((address & PCI_MAPREG_TYPE_MASK) == PCI_MAPREG_TYPE_MEM) {
+			address &= PCI_MAPREG_MEM_ADDR_MASK;
+			/*
+			 * PReP PCI memory space is from 0xc0000000 to
+			 * 0xffffffff but machdep.c maps only 0xc0000000 to
+			 * 0xcfffffff of PCI memory space. So look if the 
+			 * address offset is bigger then 0xfffffff. If it is
+			 * we are outside the already mapped region and we need
+			 * to add an additional mapping for the OpenPIC.
+			 * The OpenPIC register window is always 256kB.
+			 */
+			if (address > 0xfffffff)
+				baseaddr = (unsigned char *) mapiodev(
+				    PREP_BUS_SPACE_MEM | address, 0x40000);
+			else
+				baseaddr = (unsigned char *)
+				    (PREP_BUS_SPACE_MEM | address);
+		} else if ((address & PCI_MAPREG_TYPE_MASK) == PCI_MAPREG_TYPE_IO) {
+			address &= PCI_MAPREG_IO_ADDR_MASK;
+			baseaddr = (unsigned char *) mapiodev(
+			    PREP_BUS_SPACE_IO | address, 0x40000);
+		}
+	}
+#endif
+	openpic_init(baseaddr);
+}
diff -rNu -x obj -x CVS prep-orig/prep/ibm_7043_140.c prep/prep/ibm_7043_140.c
--- prep-orig/prep/ibm_7043_140.c	2005-12-11 05:18:48.000000000 -0700
+++ prep/prep/ibm_7043_140.c	2006-02-20 15:42:28.000000000 -0700
@@ -58,7 +58,7 @@
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcidevs.h>
 
-void pci_intr_fixup_ibm_7043_140(int, int, int, int *);
+void pci_intr_fixup_ibm_7043_140(int, int, int, int, int *);
 void init_intr_mpic(void);
 
 struct platform platform_ibm_7043_140 = {
@@ -73,7 +73,7 @@
 };
 
 void
-pci_intr_fixup_ibm_7043_140(int bus, int dev, int swiz, int *line)
+pci_intr_fixup_ibm_7043_140(int bus, int dev, int pin, int swiz, int *line)
 {
 
 	if (*line >= 1 && *line < OPENPIC_INTR_NUM - 3)
diff -rNu -x obj -x CVS prep-orig/prep/ibm_7248.c prep/prep/ibm_7248.c
--- prep-orig/prep/ibm_7248.c	2005-12-11 05:18:48.000000000 -0700
+++ prep/prep/ibm_7248.c	2006-02-20 15:42:49.000000000 -0700
@@ -44,7 +44,7 @@
 #include <machine/intr.h>
 #include <machine/platform.h>
 
-static void pci_intr_fixup_ibm_7248(int, int, int, int *);
+static void pci_intr_fixup_ibm_7248(int, int, int, int, int *);
 
 struct platform platform_ibm_7248 = {
 	"IBM PPS Model 7248 (E)",		/* model */
@@ -58,7 +58,7 @@
 };
 
 static void
-pci_intr_fixup_ibm_7248(int bus, int dev, int swiz, int *line)
+pci_intr_fixup_ibm_7248(int bus, int dev, int pin, int swiz, int *line)
 {
 	if (bus != 0)
 		return;
diff -rNu -x obj -x CVS prep-orig/prep/ibm_machdep.c prep/prep/ibm_machdep.c
--- prep-orig/prep/ibm_machdep.c	2005-12-11 05:18:48.000000000 -0700
+++ prep/prep/ibm_machdep.c	2006-02-20 15:59:58.000000000 -0700
@@ -63,6 +63,9 @@
 #if defined(PLATFORM_IBM_7043_140)
 	&platform_ibm_7043_140,
 #endif
+#if defined(PLATFORM_IBM_7024)
+	&platform_ibm_7024,
+#endif
 	NULL
 };
 
diff -rNu -x obj -x CVS prep-orig/prep/machdep.c prep/prep/machdep.c
--- prep-orig/prep/machdep.c	2005-12-24 16:24:01.000000000 -0700
+++ prep/prep/machdep.c	2006-02-21 11:02:36.000000000 -0700
@@ -399,6 +399,10 @@
 	_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_IO_TYPE,
 	0x80000000, 0x00000000, 0x00010000,
 };
+struct powerpc_bus_space prep_eisa_io_space_tag = {
+	_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_IO_TYPE,
+	0x80000000, 0x00000000, 0x0000f000,
+};
 struct powerpc_bus_space prep_mem_space_tag = {
 	_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
 	0xC0000000, 0x00000000, 0x3f000000,
@@ -407,6 +411,10 @@
 	_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
 	0xC0000000, 0x00000000, 0x01000000,
 };
+struct powerpc_bus_space prep_eisa_mem_space_tag = {
+	_BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
+	0xC0000000, 0x00000000, 0x3f000000,
+};
 
 static char ex_storage[2][EXTENT_FIXED_STORAGE_SIZE(8)]
     __attribute__((aligned(8)));
diff -rNu -x obj -x CVS prep-orig/prep/mot_ulmb60xa.c prep/prep/mot_ulmb60xa.c
--- prep-orig/prep/mot_ulmb60xa.c	2005-12-24 13:07:31.000000000 -0700
+++ prep/prep/mot_ulmb60xa.c	2006-02-20 15:43:23.000000000 -0700
@@ -75,7 +75,7 @@
 
 
 static int mot_ulmb60xa_match(struct platform *);
-static void pci_intr_fixup_mot_ulmb60xa(int, int, int, int *);
+static void pci_intr_fixup_mot_ulmb60xa(int, int, int, int, int *);
 
 struct platform platform_mot_ulmb60xa = {
 	"BULL ESTRELLA (e0)         (e0)",	/* model */ /* XXX */
@@ -107,7 +107,7 @@
 }
 
 static void
-pci_intr_fixup_mot_ulmb60xa(int bus, int dev, int swiz, int *line)
+pci_intr_fixup_mot_ulmb60xa(int bus, int dev, int pin, int swiz, int *line)
 {
 
 	if (bus == 0) {
diff -rNu -x obj -x CVS prep-orig/prep/platform.c prep/prep/platform.c
--- prep-orig/prep/platform.c	2005-12-24 15:45:36.000000000 -0700
+++ prep/prep/platform.c	2006-02-20 16:22:11.000000000 -0700
@@ -114,7 +114,7 @@
 
 /* ARGUSED */
 void
-pci_intr_nofixup(int busno, int device, int swiz, int *intr)
+pci_intr_nofixup(int busno, int device, int pin, int swiz, int *intr)
 {
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.