Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Mar 2001 18:30:37 -0500 (EST)
From:      "Matthew N. Dodd" <winter@jurai.net>
To:        alpha@freebsd.org
Subject:   Fix for AXPPCI33 in -CURRENT. (LCA owners read also).
Message-ID:  <Pine.BSF.4.21.0103181825530.54019-200000@sasami.jurai.net>

index | next in thread | raw e-mail

[-- Attachment #1 --]
Attached is a patch that special cases the handling of the
PCIB_READ_CONFIG() for PCIR_INTLINE register access.  I've taken advantage
of newbus so that the special case is only used on the AXPPCI33, but I'd
appreciate CURRENT users with other LCA machines testing to make sure I
didn't break anything.

Oh, and the chipset/machine code officially sucks rocks. :/

-- 
| Matthew N. Dodd  | '78 Datsun 280Z | '75 Volvo 164E | FreeBSD/NetBSD  |
| winter@jurai.net |       2 x '84 Volvo 245DL        | ix86,sparc,pmax |
| http://www.jurai.net/~winter |  For Great Justice!  | ISO8802.5 4ever |

[-- Attachment #2 --]
Index: alpha/dec_axppci_33.c
===================================================================
RCS file: /cvs/src/sys/alpha/alpha/dec_axppci_33.c,v
retrieving revision 1.11
diff -u -r1.11 dec_axppci_33.c
--- alpha/dec_axppci_33.c	2001/02/01 21:59:00	1.11
+++ alpha/dec_axppci_33.c	2001/03/17 19:50:12
@@ -56,6 +56,7 @@
 void dec_axppci_33_init __P((void));
 static void dec_axppci_33_cons_init __P((void));
 static int dec_axppci_33_intr_route  __P((device_t, device_t, int));
+int dec_axppci_33_intr_map(u_int, int);
 
 extern int siocnattach __P((int, int));
 extern int siogdbattach __P((int, int));
@@ -91,7 +92,7 @@
 			platform.model = alpha_unknown_sysname();
 	}
 
-	platform.iobus = "lca";
+	platform.iobus = "axppci33_lca";
 	platform.cons_init = dec_axppci_33_cons_init;
 	platform.pci_intr_route = dec_axppci_33_intr_route;
 
@@ -120,9 +121,11 @@
 
 	lca_init();
 
+#if 0
 #ifdef DDB
 	siogdbattach(0x2f8, 9600);
 #endif
+#endif
 	ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
 
 	switch (ctb->ctb_term_type) {
@@ -166,10 +169,15 @@
 }
 
 #define	SIO_PCIREG_PIRQ_RTCTRL	0x60	/* PIRQ0 Route Control */
-
 static int
 dec_axppci_33_intr_route(device_t pcib, device_t dev, int pin)
 {
+	return (dec_axppci_33_intr_map(pci_get_slot(dev), pin));
+}
+
+int
+dec_axppci_33_intr_map(u_int s, int pin)
+{
 	int pirq;
 	u_int32_t pirqreg;
 	u_int8_t pirqline;
@@ -182,7 +190,7 @@
 	 * Slot->interrupt translation.  Taken from NetBSD.
 	 */
 
-	switch (pci_get_slot(dev)) {
+	switch (s) {
 	case 6:					/* NCR SCSI */
 		pirq = 3;
 		break;
@@ -234,7 +242,7 @@
 
 	default:
 		printf("dec_axppci_33_intr_map: weird slot number %d\n",
-		       pci_get_slot(dev));
+		       s);
 		return(255);
 	}
 
Index: pci/lca.c
===================================================================
RCS file: /cvs/src/sys/alpha/pci/lca.c,v
retrieving revision 1.14
diff -u -r1.14 lca.c
--- pci/lca.c	2000/08/28 21:48:03	1.14
+++ pci/lca.c	2001/03/17 08:26:36
@@ -142,6 +142,12 @@
 	sizeof(struct lca_softc),
 };
 
+static driver_t axppci33_lca_driver = {
+	"axppci33_lca",
+	lca_methods,
+	sizeof(struct lca_softc),
+};
+
 #define LCA_SGMAP_BASE		(8*1024*1024)
 #define LCA_SGMAP_SIZE		(8*1024*1024)
 
@@ -285,4 +291,4 @@
 }
 
 DRIVER_MODULE(lca, root, lca_driver, lca_devclass, 0, 0);
-
+DRIVER_MODULE(axppci33_lca, root, axppci33_lca_driver, lca_devclass, 0, 0);
Index: pci/lca_pci.c
===================================================================
RCS file: /cvs/src/sys/alpha/pci/lca_pci.c,v
retrieving revision 1.9
diff -u -r1.9 lca_pci.c
--- pci/lca_pci.c	2000/12/08 22:11:23	1.9
+++ pci/lca_pci.c	2001/03/18 03:42:12
@@ -33,9 +33,11 @@
 #include <sys/bus.h>
 #include <machine/bus.h>
 #include <sys/rman.h>
-#include <pci/pcivar.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
 #include <machine/swiz.h>
 #include <machine/md_var.h>
+#include <machine/cpuconf.h>
 
 #include <alpha/pci/lcareg.h>
 #include <alpha/pci/lcavar.h>
@@ -130,7 +132,34 @@
 	return;								  \
 } while (0)
 
+/* XXX should move to a header file somewhere? */
+int dec_axppci_33_intr_map(u_int, int);
+
 u_int32_t
+axppci33_lca_pcib_read_config(device_t dev, u_int b, u_int s, u_int f,
+		     u_int reg, int width)
+{
+	if ((reg == PCIR_INTLINE) && (width == 1)) {
+		switch (s) {
+		case 6:		/* NCR SCSI */
+		case 8:		/* Slot 3 */
+		case 11:	/* Slot 1 */
+		case 12:	/* Slot 2 */
+		{
+			int pin;
+			pin = lca_pcib_read_config(dev, b, s, f, PCIR_INTPIN, 1);
+			return (dec_axppci_33_intr_map(s, pin));
+		}
+		break;
+		default:
+			break;
+		}
+	}
+
+	return (lca_pcib_read_config(dev, b, s, f, reg, width));
+}
+
+u_int32_t
 lca_pcib_read_config(device_t dev, u_int b, u_int s, u_int f,
 		     u_int reg, int width)
 {
@@ -162,6 +191,41 @@
 		CFGWRITE(b, s, f, reg, val, LONG, u_int32_t);
 	}
 }
+
+static device_method_t axppci33_lca_pcib_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe,		lca_pcib_probe),
+	DEVMETHOD(device_attach,	bus_generic_attach),
+
+	/* Bus interface */
+	DEVMETHOD(bus_print_child,	bus_generic_print_child),
+	DEVMETHOD(bus_read_ivar,	lca_pcib_read_ivar),
+	DEVMETHOD(bus_alloc_resource,	bus_generic_alloc_resource),
+	DEVMETHOD(bus_release_resource,	bus_generic_release_resource),
+	DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
+	DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
+	DEVMETHOD(bus_setup_intr,	bus_generic_setup_intr),
+	DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
+
+	/* alphapci interface */
+	DEVMETHOD(alphapci_cvt_dense,	lca_pcib_cvt_dense),
+
+	/* pcib interface */
+	DEVMETHOD(pcib_maxslots,	lca_pcib_maxslots),
+	DEVMETHOD(pcib_read_config,	axppci33_lca_pcib_read_config),
+	DEVMETHOD(pcib_write_config,	lca_pcib_write_config),
+	DEVMETHOD(pcib_route_interrupt,	alpha_pci_route_interrupt),
+
+	{ 0, 0 }
+};
+
+static driver_t axppci33_lca_pcib_driver = {
+	"pcib",
+	axppci33_lca_pcib_methods,
+	1,
+};
+
+DRIVER_MODULE(pcib, axppci33_lca, axppci33_lca_pcib_driver, pcib_devclass, 0, 0);
 
 static device_method_t lca_pcib_methods[] = {
 	/* Device interface */
Index: pci/lcavar.h
===================================================================
RCS file: /cvs/src/sys/alpha/pci/lcavar.h,v
retrieving revision 1.4
diff -u -r1.4 lcavar.h
--- pci/lcavar.h	2000/12/01 15:27:48	1.4
+++ pci/lcavar.h	2001/03/17 05:59:11
@@ -31,3 +31,5 @@
 extern void lca_init(void);
 u_int32_t lca_pcib_read_config(struct device *dev, u_int b, u_int s, u_int f,
 			       u_int reg, int width);
+u_int32_t axppci33_lca_pcib_read_config(struct device *dev, u_int b, u_int s,
+					u_int f, u_int reg, int width);
help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0103181825530.54019-200000>