Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Jun 2004 21:36:14 +0200 (CEST)
From:      Michael Kukat <michael@unixiron.org>
To:        freebsd-alpha@freebsd.org
Subject:   Alphastation 200 (and others) PCI-PCI bridge fix
Message-ID:  <20040627212654.Q437@calchas.unixiron.org>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Hello,

okay, for my problems with quadport NICs, i stick in the following situation
currently:

- fixed intpin/irq mapping stuff in dec_2100_a50.c, seems to work okay with
  my ANA-6944, but this card just maps all 4 NICs to INTA of the first chip,
  so this doesn't prove the functionality of this fix.

- ANA-62044 really wants 4 INT lines, but due to the architecture of the PCI
  bus in the AlphaStation 200, it just gets 2 of them. IRQs are mapped to the
  ISA IRQs, which are not shareable. But 2 of the NIC chips on the card need to
  share interrupts when plugged into the AS200 (INTD is INTA on the connetor,
  and INTC is the same as onboard LAN).

Another problem in my diagnosis of the problems i have with the ANA-62044:
kernel doesn't panic when this card is in the AS200. So the problem with
crashing with access faults just exists on the PC164. Maybe i should try a
32bit slot.

I attached my fix for this interrupt problem, maybe someone can use it. And if
someone with more clue about PCI has a look in this, maybe it's useable for the
repository. Patch applies to 4.9 sources.

Known problems: this fix just handles bridges on pci0. It doesn't handle
bridges on bridged buses :)

Hope it helps someone. It's not tested very well, feedback welcome.

...Michael

-- 
http://www.unixiron.org/    Home Powered by: (Net|Open|Free)BSD IRIX NonStop-UX
Solaris AIX HP-UX Tru64 MUNIX Ultrix VMS SINIX Dolphin_Unix OpenStep MacOS A/UX
[-- Attachment #2 --]
diff -Naru sys.orig/alpha/alpha/dec_2100_a50.c sys/alpha/alpha/dec_2100_a50.c
--- sys.orig/alpha/alpha/dec_2100_a50.c	Thu Jul 20 08:12:12 2000
+++ sys/alpha/alpha/dec_2100_a50.c	Sun Jun 27 19:12:20 2004
@@ -164,29 +164,47 @@
 	u_int8_t pirqline;
 	u_int32_t pirqreg;
 	int pirq;
+	int slot, intpin;
 	pcicfgregs *cfg;
 
 	pirq = 0;  /* gcc -Wuninitialized XXX */
 	cfg = (pcicfgregs *)arg;
 
 	/*
+	 * If we don't live on bus 0, we are behind a bridge. Handle this.
+	 */
+
+	slot = cfg->slot;
+	intpin = cfg->intpin;
+	if(cfg->bus > 0) {
+		cfg = pci_devlist_get_parent(cfg);
+		if(cfg == NULL) {
+			printf("failed to get bridge configuration!\n");
+		} else {
+			intpin = (slot + (intpin - 1)) % 4 + 1;
+			slot = cfg->slot;
+		}
+		cfg = (pcicfgregs *)arg;
+	}
+
+	/*
 	 * Slot->interrupt translation.  Taken from NetBSD.
 	 */
 
-	if(cfg->intpin == 0)
+	if(intpin == 0)
 		return;
 
-	if(cfg->intpin > 4)
-		panic("dec_2100_a50_intr_map: bad intpin %d",cfg->intpin);
+	if(intpin > 4)
+		panic("dec_2100_a50_intr_map: bad intpin %d",intpin);
 
-	switch (cfg->slot) {
+	switch (slot) {
 	case 6:					/*  NCR SCSI */
 		pirq = 3;
 		break;
 
 	case 11:				/* slot 1 */
 	case 14:				/* slot 3 */
-		switch(cfg->intpin) {
+		switch(intpin) {
 		case 1:
 		case 4:
 			pirq = 0;
@@ -199,12 +217,12 @@
 			break;
 		default:
 			panic("dec_2100_a50_intr_map bogus PCI pin %d\n",
-			    cfg->intpin);
+			    intpin);
 
 		}
 		break;
 	case 12:				/* slot 2 */
-		switch (cfg->intpin) {
+		switch (intpin) {
 		case 1:
 		case 4:
 			pirq = 1;
@@ -217,13 +235,13 @@
 			break;
 		default:
 			panic("dec_2100_a50_intr_map bogus PCI pin %d\n",
-			    cfg->intpin);
+			    intpin);
 
 		};
 		break;
 
 	case 13:				/* slot 3 */
-		switch (cfg->intpin) {
+		switch (intpin) {
 		case 1:
 		case 4:
 			pirq = 2;
@@ -238,7 +256,7 @@
 		break;
 default:
 		printf("dec_2100_a50_intr_map: weird slot %d\n",
-		    cfg->slot);
+		    slot);
 
 		/* return; */
         }

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040627212654.Q437>