Index: c/src/lib/libbsp/powerpc/ChangeLog
===================================================================
--- c/src/lib/libbsp/powerpc/ChangeLog	(revision 92f93e8f830dee7ab21cfdfd4f0f8b06121ed36f)
+++ c/src/lib/libbsp/powerpc/ChangeLog	(revision 048fd36c9f0f24c970d5286c0bd81c68592fa618)
@@ -1,2 +1,10 @@
+2011-07-15  Till Straumann <strauman@slac.stanford.edu>
+
+	* shared/irq/init_irq.c, shared/irq/openpic_i8259_irq.c,
+	shared/pci/detect_raven_bridge.c: conditionally compile
+	ISA and PCI-interrupt related stuff only if BSP defines
+	BSP_ISA_IRQ_NUMBER > 0 and/or BSP_PCI_IRQ_NUMBER > 0,
+	respectively.
+	
 2011-06-19	Ralf CorsÃ©pius <ralf.corsepius@rtems.org>
 
Index: c/src/lib/libbsp/powerpc/shared/irq/irq_init.c
===================================================================
--- c/src/lib/libbsp/powerpc/shared/irq/irq_init.c	(revision 92f93e8f830dee7ab21cfdfd4f0f8b06121ed36f)
+++ c/src/lib/libbsp/powerpc/shared/irq/irq_init.c	(revision 048fd36c9f0f24c970d5286c0bd81c68592fa618)
@@ -23,6 +23,8 @@
 #include <bsp/pci.h>
 #include <bsp/residual.h>
+#include <bsp/irq.h>
+#if BSP_PCI_IRQ_NUMBER > 0
 #include <bsp/openpic.h>
-#include <bsp/irq.h>
+#endif
 #include <bsp/irq_supp.h>
 #include <bsp.h>
@@ -37,5 +39,7 @@
 
 pci_isa_bridge_device* via_82c586 = 0;
+#ifndef qemu
 static pci_isa_bridge_device bridge;
+#endif
 
 /*
@@ -84,8 +88,10 @@
   255,
   0, 0, 0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+#if BSP_PCI_IRQ_NUMBER > 0
   /*
    * PCI Interrupts
    */
   8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* for raven prio 0 means unactive... */
+#endif
   /*
    * Processor exceptions handled as interrupts
@@ -94,4 +100,5 @@
 };
 
+#if BSP_PCI_IRQ_NUMBER > 0
 #if defined(mvme2100)
 static unsigned char mvme2100_openpic_initpolarities[16] = {
@@ -157,5 +164,7 @@
 };
 #endif
-
+#endif
+
+#if BSP_ISA_IRQ_NUMBER > 0 && !defined(qemu)
 void VIA_isa_bridge_interrupts_setup(void)
 {
@@ -260,4 +269,5 @@
   }
 }
+#endif
 
   /*
@@ -269,5 +279,5 @@
 void BSP_rtems_irq_mng_init(unsigned cpuId)
 {
-#if !defined(mvme2100)
+#if BSP_ISA_IRQ_NUMBER > 0 && !defined(mvme2100)
   int known_cpi_isa_bridge = 0;
 #endif
@@ -286,4 +296,5 @@
   openpic_init(1, mvme2100_openpic_initpolarities, mvme2100_openpic_initsenses, 16, 16, BSP_bus_frequency);
 #else
+#if BSP_PCI_IRQ_NUMBER > 0
 #ifdef TRACE_IRQ_INIT
   printk("Going to initialize raven interrupt controller (openpic compliant)\n");
@@ -293,6 +304,11 @@
   printk("Going to initialize the PCI/ISA bridge IRQ related setting (VIA 82C586)\n");
 #endif
+#endif
+
+#if BSP_ISA_IRQ_NUMBER > 0
   if ( currentBoard == MESQUITE ) {
+#ifndef qemu
     VIA_isa_bridge_interrupts_setup();
+#endif
     known_cpi_isa_bridge = 1;
   }
@@ -315,4 +331,6 @@
 #endif
   BSP_i8259s_init();
+#endif
+
 #endif
 
Index: c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c
===================================================================
--- c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c	(revision 92f93e8f830dee7ab21cfdfd4f0f8b06121ed36f)
+++ c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c	(revision 048fd36c9f0f24c970d5286c0bd81c68592fa618)
@@ -21,5 +21,7 @@
 #include <bsp/VMEConfig.h>
 #endif
+#if BSP_PCI_IRQ_NUMBER > 0
 #include <bsp/openpic.h>
+#endif
 #include <libcpu/io.h>
 #include <bsp/vectors.h>
@@ -27,7 +29,12 @@
 
 #include <rtems/bspIo.h> /* for printk */
+
+#ifndef qemu
 #define RAVEN_INTR_ACK_REG 0xfeff0030
-
-#ifdef BSP_PCI_ISA_BRIDGE_IRQ
+#else
+#define RAVEN_INTR_ACK_REG 0xbffffff0
+#endif
+
+#if BSP_ISA_IRQ_NUMBER > 0
 /*
  * pointer to the mask representing the additionnal irq vectors
@@ -48,5 +55,5 @@
 static rtems_irq_connect_data*		rtems_hdl_tbl;
 
-#ifdef BSP_PCI_ISA_BRIDGE_IRQ
+#if BSP_ISA_IRQ_NUMBER > 0
 /*
  * Check if IRQ is an ISA IRQ
@@ -54,5 +61,5 @@
 static inline int is_isa_irq(const rtems_irq_number irqLine)
 {
-  return (((int) irqLine <= BSP_ISA_IRQ_MAX_OFFSET) &
+  return (((int) irqLine <= BSP_ISA_IRQ_MAX_OFFSET) &&
 	  ((int) irqLine >= BSP_ISA_IRQ_LOWEST_OFFSET)
 	 );
@@ -60,4 +67,5 @@
 #endif
 
+#if BSP_PCI_IRQ_NUMBER > 0
 /*
  * Check if IRQ is an OPENPIC IRQ
@@ -65,8 +73,9 @@
 static inline int is_pci_irq(const rtems_irq_number irqLine)
 {
-  return (((int) irqLine <= BSP_PCI_IRQ_MAX_OFFSET) &
+  return OpenPIC && (((int) irqLine <= BSP_PCI_IRQ_MAX_OFFSET) &&
 	  ((int) irqLine >= BSP_PCI_IRQ_LOWEST_OFFSET)
 	 );
 }
+#endif
 
 /*
@@ -74,5 +83,5 @@
  */
 
-#ifdef BSP_PCI_ISA_BRIDGE_IRQ
+#if BSP_ISA_IRQ_NUMBER > 0
 /*
  * Caution : this function assumes the variable "*config"
@@ -104,5 +113,5 @@
 BSP_enable_irq_at_pic(const rtems_irq_number name)
 {
-#ifdef BSP_PCI_ISA_BRIDGE_IRQ
+#if BSP_ISA_IRQ_NUMBER > 0
     if (is_isa_irq(name)) {
       /*
@@ -113,4 +122,5 @@
 #endif
 
+#if BSP_PCI_IRQ_NUMBER > 0
     if (is_pci_irq(name)) {
       /*
@@ -119,4 +129,5 @@
       openpic_enable_irq ((int) name - BSP_PCI_IRQ_LOWEST_OFFSET);
     }
+#endif
 }
 
@@ -124,5 +135,5 @@
 BSP_disable_irq_at_pic(const rtems_irq_number name)
 {
-#ifdef BSP_PCI_ISA_BRIDGE_IRQ
+#if BSP_ISA_IRQ_NUMBER > 0
     if (is_isa_irq(name)) {
       /*
@@ -132,4 +143,5 @@
     }
 #endif
+#if BSP_PCI_IRQ_NUMBER > 0
     if (is_pci_irq(name)) {
       /*
@@ -138,4 +150,5 @@
       return openpic_disable_irq ((int) name - BSP_PCI_IRQ_LOWEST_OFFSET);
     }
+#endif
 	return -1;
 }
@@ -157,5 +170,5 @@
      */
 
-#ifdef BSP_PCI_ISA_BRIDGE_IRQ
+#if BSP_ISA_IRQ_NUMBER > 0
     /*
      * start with ISA IRQ
@@ -180,4 +193,7 @@
 #endif
 
+#if BSP_PCI_IRQ_NUMBER > 0
+	if ( ! OpenPIC )
+		return 1;
     /*
      * continue with PCI IRQ
@@ -198,10 +214,9 @@
 
 #ifdef BSP_PCI_ISA_BRIDGE_IRQ
-	if ( BSP_ISA_IRQ_NUMBER > 0 ) {
-    	/*
-	     * Must enable PCI/ISA bridge IRQ
-	     */
-    	openpic_enable_irq (0);
-	}
+   	/*
+     * Must enable PCI/ISA bridge IRQ
+     */
+   	openpic_enable_irq (BSP_PCI_ISA_BRIDGE_IRQ);
+#endif
 #endif
 
@@ -219,5 +234,5 @@
 {
   register unsigned int irq;
-#ifdef BSP_PCI_ISA_BRIDGE_IRQ
+#if BSP_ISA_IRQ_NUMBER > 0
   register unsigned isaIntr;                  /* boolean */
   register unsigned oldMask = 0;	      /* old isa pic masks */
@@ -232,15 +247,37 @@
 
   }
-  irq = openpic_irq(0);
-  if (irq == OPENPIC_VEC_SPURIOUS) {
-    ++BSP_spuriousIntr;
-    return 0;
-  }
-
-  /* some BSPs might want to use a different numbering... */
-  irq = irq - OPENPIC_VEC_SOURCE + BSP_PCI_IRQ_LOWEST_OFFSET;
-
+
+#if BSP_PCI_IRQ_NUMBER > 0
+  if ( OpenPIC ) {
+    irq = openpic_irq(0);
+    if (irq == OPENPIC_VEC_SPURIOUS) {
+      ++BSP_spuriousIntr;
+      return 0;
+    }
+
+    /* some BSPs might want to use a different numbering... */
+    irq = irq - OPENPIC_VEC_SOURCE + BSP_PCI_IRQ_LOWEST_OFFSET;
+  } else {
+#if BSP_ISA_IRQ_NUMBER > 0
 #ifdef BSP_PCI_ISA_BRIDGE_IRQ
+	irq = BSP_PCI_ISA_BRIDGE_IRQ;
+#else
+#error "Configuration Error -- BSP with ISA + PCI IRQs MUST define BSP_PCI_ISA_BRIDGE_IRQ"
+#endif
+#else
+	rtems_panic("MUST have an OpenPIC if BSP has PCI IRQs but no ISA IRQs");
+#endif
+  }
+#endif
+
+#if BSP_ISA_IRQ_NUMBER > 0
+#ifdef BSP_PCI_ISA_BRIDGE_IRQ
+#if 0 == BSP_PCI_IRQ_NUMBER 
+#error "Configuration Error -- BSP w/o PCI IRQs MUST NOT define BSP_PCI_ISA_BRIDGE_IRQ"
+#endif
   isaIntr = (irq == BSP_PCI_ISA_BRIDGE_IRQ);
+#else
+  isaIntr = 1;
+#endif
   if (isaIntr)  {
     /*
@@ -257,5 +294,8 @@
     outport_byte(PIC_SLAVE_IMR_IO_PORT, ((i8259s_cache & 0xff00) >> 8));
     BSP_irq_ack_at_i8259s (irq);
-    openpic_eoi(0);
+#if BSP_PCI_IRQ_NUMBER > 0
+	if ( OpenPIC )
+      openpic_eoi(0);
+#endif
   }
 #endif
@@ -264,5 +304,5 @@
   bsp_irq_dispatch_list(rtems_hdl_tbl, irq, default_rtems_entry.hdl);
 
-#ifdef BSP_PCI_ISA_BRIDGE_IRQ
+#if BSP_ISA_IRQ_NUMBER > 0
   if (isaIntr)  {
     i8259s_cache = oldMask;
@@ -273,4 +313,5 @@
 #endif
   {
+#if BSP_PCI_IRQ_NUMBER > 0
 #ifdef BSP_PCI_VME_DRIVER_DOES_EOI
 	/* leave it to the VME bridge driver to do EOI, so
@@ -278,7 +319,10 @@
      * VME interrupts (-> VME priorities in software)
 	 */
-	if (_BSP_vme_bridge_irq != irq)
+	if (_BSP_vme_bridge_irq != irq && OpenPIC)
 #endif
     		openpic_eoi(0);
+#else
+	do {} while (0);
+#endif
   }
   return 0;
Index: c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c
===================================================================
--- c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c	(revision 92f93e8f830dee7ab21cfdfd4f0f8b06121ed36f)
+++ c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c	(revision 048fd36c9f0f24c970d5286c0bd81c68592fa618)
@@ -11,4 +11,5 @@
 #include <bsp/residual.h>
 #include <bsp/openpic.h>
+#include <bsp/irq.h>
 
 #include <rtems/bspIo.h>
@@ -188,7 +189,10 @@
     }
   }
+
+#if BSP_PCI_IRQ_NUMBER > 0
   if (OpenPIC == (volatile struct OpenPIC *)0) {
     BSP_panic("OpenPic Not found\n");
   }
+#endif
 
 }
