Subject: Patches for NetBSD 1.5.1 on DEC Multias (UDB)
To: None <port-alpha@netbsd.org>
From: Juergen Weiss <weiss@Uni-Mainz.DE>
List: port-alpha
Date: 07/20/2001 22:40:58
This is just a resubmission of the old NetBSD 1.5 patches for
the multia, which have not been incorporated in NetBSD 1.5.1
because they are multia specific and possibly break other
platforms.  The interrupt handling seems to be quite special on
the multias.

To fix the stray interrupt problem on multias (fixes serial
console) apply the following patch in
/usr/src/sys/arch/alpha/pci

*** sio_pic.c.orig	Tue Jun  6 05:10:13 2000
--- sio_pic.c	Tue Jun  5 22:22:14 2001
***************
*** 121,128 ****
--- 121,135 ----
   * If prom console is broken, must remember the initial interrupt
   * settings and enforce them.  WHEE!
   */
+ #define       INITIALLY_ENABLED(irq) \
+           ((initial_ocw1[(irq) / 8] & (1 << ((irq) % 8))) == 0)
+ #define       INITIALLY_LEVEL_TRIGGERED(irq) \
+           ((initial_elcr[(irq) / 8] & (1 << ((irq) % 8))) != 0)
  u_int8_t initial_ocw1[2];
  u_int8_t initial_elcr[2];
+ #else
+ #define       INITIALLY_ENABLED(irq)          ((irq) == 2 ? 1 : 0)
+ #define       INITIALLY_LEVEL_TRIGGERED(irq)  0
  #endif
  
  void		sio_setirqstat __P((int, int, int));
***************
*** 384,390 ****
  			 * IRQs 0, 1, 8, and 13 must always be
  			 * edge-triggered.
  			 */
! 			sio_setirqstat(i, 0, IST_EDGE);
  			alpha_shared_intr_set_dfltsharetype(sio_intr, i,
  			    IST_EDGE);
  			specific_eoi(i);
--- 391,399 ----
  			 * IRQs 0, 1, 8, and 13 must always be
  			 * edge-triggered.
  			 */
! 			if (INITIALLY_LEVEL_TRIGGERED(i))
! 				printf("sio_intr_setup: %d LT!\n", i);
! 			sio_setirqstat(i, INITIALLY_ENABLED(i), IST_EDGE);
  			alpha_shared_intr_set_dfltsharetype(sio_intr, i,
  			    IST_EDGE);
  			specific_eoi(i);
***************
*** 405,413 ****
  			 * Otherwise, disable the IRQ and set its
  			 * type to (effectively) "unknown."
  			 */
! 			sio_setirqstat(i, 0, IST_NONE);
  			alpha_shared_intr_set_dfltsharetype(sio_intr, i,
! 			    IST_NONE);
  			specific_eoi(i);
  			break;
  		}
--- 414,423 ----
  			 * Otherwise, disable the IRQ and set its
  			 * type to (effectively) "unknown."
  			 */
! 			sio_setirqstat(i, INITIALLY_ENABLED(i),
! 				       INITIALLY_LEVEL_TRIGGERED(i) ? IST_LEVEL : IST_NONE);
  			alpha_shared_intr_set_dfltsharetype(sio_intr, i,
! 							    INITIALLY_LEVEL_TRIGGERED(i) ? IST_LEVEL : IST_NONE);
  			specific_eoi(i);
  			break;
  		}
***************
*** 516,525 ****
  			break;
  
  		default:
! 			ist = IST_NONE;
  			break;
  		}
! 		sio_setirqstat(irq, 0, ist);
  		alpha_shared_intr_set_dfltsharetype(sio_intr, irq, ist);
  	}
  
--- 526,536 ----
  			break;
  
  		default:
! 			ist = INITIALLY_LEVEL_TRIGGERED(irq) ?
! 			    IST_LEVEL : IST_NONE;
  			break;
  		}
! 		sio_setirqstat(irq, INITIALLY_ENABLED(irq), ist);
  		alpha_shared_intr_set_dfltsharetype(sio_intr, irq, ist);
  	}
  


If you want to use the pcmcia slots, the following patch
in /usr/src/sys/dev/isa is necessary.

*** i82365_isasubr.c.orig	Tue May  9 22:20:25 2000
--- i82365_isasubr.c	Sun Dec  3 17:28:35 2000
***************
*** 237,243 ****
  		/* Clear any pending interrupt. */
  		(void) pcic_read(h, PCIC_CSC);
  
! 		if ((sc->ih = isa_intr_establish(ic, irq, IST_EDGE, IPL_TTY,
  		    pcic_isa_count_intr, h)) == NULL)
  			panic("cant get interrupt");
  
--- 237,243 ----
  		/* Clear any pending interrupt. */
  		(void) pcic_read(h, PCIC_CSC);
  
! 		if ((sc->ih = isa_intr_establish(ic, irq, IST_LEVEL, IPL_TTY,
  		    pcic_isa_count_intr, h)) == NULL)
  			panic("cant get interrupt");
  
***************
*** 268,274 ****
  	}
  	sc->intr_mask[h->chip] = mask;
  
! 	printf("%s\n", sc->intr_mask ? "" : " none");
  }
  
  /*
--- 268,274 ----
  	}
  	sc->intr_mask[h->chip] = mask;
  
! 	printf("%s\n", sc->intr_mask[h->chip] ? "" : " none");
  }
  
  /*
***************
*** 339,345 ****
  				    "detected as available\n",
  				    sc->dev.dv_xname, sc->irq);
  		} else if (chipmask == 0 ||
! 		    isa_intr_alloc(ic, chipmask, IST_EDGE, &sc->irq)) {
  			printf("%s: no available irq; ", sc->dev.dv_xname);
  			sc->irq = IRQUNK;
  		} else if ((chipmask & ~(1 << sc->irq)) == 0 && chipuniq == 0) {
--- 339,345 ----
  				    "detected as available\n",
  				    sc->dev.dv_xname, sc->irq);
  		} else if (chipmask == 0 ||
! 		    isa_intr_alloc(ic, chipmask, IST_LEVEL, &sc->irq)) {
  			printf("%s: no available irq; ", sc->dev.dv_xname);
  			sc->irq = IRQUNK;
  		} else if ((chipmask & ~(1 << sc->irq)) == 0 && chipuniq == 0) {
***************
*** 353,359 ****
  	}
  
  	if (sc->irq != IRQUNK) {
! 		sc->ih = isa_intr_establish(ic, sc->irq, IST_EDGE, IPL_TTY,
  		    pcic_intr, sc);
  		if (sc->ih == NULL) {
  			printf("%s: can't establish interrupt",
--- 353,359 ----
  	}
  
  	if (sc->irq != IRQUNK) {
! 		sc->ih = isa_intr_establish(ic, sc->irq, IST_LEVEL, IPL_TTY,
  		    pcic_intr, sc);
  		if (sc->ih == NULL) {
  			printf("%s: can't establish interrupt",
***************
*** 478,484 ****
  	int reg;
  
  	if (pf->cfe->flags & PCMCIA_CFE_IRQLEVEL)
! 		ist = IST_EDGE;
  	else if (pf->cfe->flags & PCMCIA_CFE_IRQPULSE)
  		ist = IST_PULSE;
  	else
--- 478,484 ----
  	int reg;
  
  	if (pf->cfe->flags & PCMCIA_CFE_IRQLEVEL)
! 		ist = IST_LEVEL;
  	else if (pf->cfe->flags & PCMCIA_CFE_IRQPULSE)
  		ist = IST_PULSE;
  	else


Here are some lines for the config file:

pcic0   at      isa? port 0x3e0 iomem 0xd0000 iosiz 0x4000
#pcic1  at      isa? port 0x3e2 iomem 0xcc000 iosiz 0x10000
pcmcia* at      pcic? controller ? socket ?
options PCIC_ISA_ALLOC_IOBASE=0x300
options PCIC_ISA_ALLOC_IOSIZE=0x0ff
options PCIC_ISA_INTR_ALLOC_MASK=0x4020

wss*    at      isa? port 0x530 irq 9 drq 3 drq2 1 # Windows Sound System
audio*  at      wss?

-- 
Juergen Weiss	  | Universitaet Mainz, Zentrum fuer Datenverarbeitung,
weiss@uni-mainz.de| 55099 Mainz, Tel: +49(6131)39-26361, FAX: +49(6131)39-26407