Changeset 048fd36 in rtems


Ignore:
Timestamp:
Jul 16, 2011, 1:15:06 AM (8 years ago)
Author:
Till Straumann <strauman@…>
Branches:
4.11, master
Children:
d2e68e07
Parents:
92f93e8
Message:

2011-07-15 Till Straumann <strauman@…>

  • 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.
Location:
c/src/lib/libbsp/powerpc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/ChangeLog

    r92f93e8 r048fd36  
     12011-07-15  Till Straumann <strauman@slac.stanford.edu>
     2
     3        * shared/irq/init_irq.c, shared/irq/openpic_i8259_irq.c,
     4        shared/pci/detect_raven_bridge.c: conditionally compile
     5        ISA and PCI-interrupt related stuff only if BSP defines
     6        BSP_ISA_IRQ_NUMBER > 0 and/or BSP_PCI_IRQ_NUMBER > 0,
     7        respectively.
     8       
    192011-06-19      Ralf Corsépius <ralf.corsepius@rtems.org>
    210
  • c/src/lib/libbsp/powerpc/shared/irq/irq_init.c

    r92f93e8 r048fd36  
    2323#include <bsp/pci.h>
    2424#include <bsp/residual.h>
     25#include <bsp/irq.h>
     26#if BSP_PCI_IRQ_NUMBER > 0
    2527#include <bsp/openpic.h>
    26 #include <bsp/irq.h>
     28#endif
    2729#include <bsp/irq_supp.h>
    2830#include <bsp.h>
     
    3739
    3840pci_isa_bridge_device* via_82c586 = 0;
     41#ifndef qemu
    3942static pci_isa_bridge_device bridge;
     43#endif
    4044
    4145/*
     
    8488  255,
    8589  0, 0, 0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     90#if BSP_PCI_IRQ_NUMBER > 0
    8691  /*
    8792   * PCI Interrupts
    8893   */
    8994  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* for raven prio 0 means unactive... */
     95#endif
    9096  /*
    9197   * Processor exceptions handled as interrupts
     
    94100};
    95101
     102#if BSP_PCI_IRQ_NUMBER > 0
    96103#if defined(mvme2100)
    97104static unsigned char mvme2100_openpic_initpolarities[16] = {
     
    157164};
    158165#endif
    159 
     166#endif
     167
     168#if BSP_ISA_IRQ_NUMBER > 0 && !defined(qemu)
    160169void VIA_isa_bridge_interrupts_setup(void)
    161170{
     
    260269  }
    261270}
     271#endif
    262272
    263273  /*
     
    269279void BSP_rtems_irq_mng_init(unsigned cpuId)
    270280{
    271 #if !defined(mvme2100)
     281#if BSP_ISA_IRQ_NUMBER > 0 && !defined(mvme2100)
    272282  int known_cpi_isa_bridge = 0;
    273283#endif
     
    286296  openpic_init(1, mvme2100_openpic_initpolarities, mvme2100_openpic_initsenses, 16, 16, BSP_bus_frequency);
    287297#else
     298#if BSP_PCI_IRQ_NUMBER > 0
    288299#ifdef TRACE_IRQ_INIT
    289300  printk("Going to initialize raven interrupt controller (openpic compliant)\n");
     
    293304  printk("Going to initialize the PCI/ISA bridge IRQ related setting (VIA 82C586)\n");
    294305#endif
     306#endif
     307
     308#if BSP_ISA_IRQ_NUMBER > 0
    295309  if ( currentBoard == MESQUITE ) {
     310#ifndef qemu
    296311    VIA_isa_bridge_interrupts_setup();
     312#endif
    297313    known_cpi_isa_bridge = 1;
    298314  }
     
    315331#endif
    316332  BSP_i8259s_init();
     333#endif
     334
    317335#endif
    318336
  • c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c

    r92f93e8 r048fd36  
    2121#include <bsp/VMEConfig.h>
    2222#endif
     23#if BSP_PCI_IRQ_NUMBER > 0
    2324#include <bsp/openpic.h>
     25#endif
    2426#include <libcpu/io.h>
    2527#include <bsp/vectors.h>
     
    2729
    2830#include <rtems/bspIo.h> /* for printk */
     31
     32#ifndef qemu
    2933#define RAVEN_INTR_ACK_REG 0xfeff0030
    30 
    31 #ifdef BSP_PCI_ISA_BRIDGE_IRQ
     34#else
     35#define RAVEN_INTR_ACK_REG 0xbffffff0
     36#endif
     37
     38#if BSP_ISA_IRQ_NUMBER > 0
    3239/*
    3340 * pointer to the mask representing the additionnal irq vectors
     
    4855static rtems_irq_connect_data*          rtems_hdl_tbl;
    4956
    50 #ifdef BSP_PCI_ISA_BRIDGE_IRQ
     57#if BSP_ISA_IRQ_NUMBER > 0
    5158/*
    5259 * Check if IRQ is an ISA IRQ
     
    5461static inline int is_isa_irq(const rtems_irq_number irqLine)
    5562{
    56   return (((int) irqLine <= BSP_ISA_IRQ_MAX_OFFSET) &
     63  return (((int) irqLine <= BSP_ISA_IRQ_MAX_OFFSET) &&
    5764          ((int) irqLine >= BSP_ISA_IRQ_LOWEST_OFFSET)
    5865         );
     
    6067#endif
    6168
     69#if BSP_PCI_IRQ_NUMBER > 0
    6270/*
    6371 * Check if IRQ is an OPENPIC IRQ
     
    6573static inline int is_pci_irq(const rtems_irq_number irqLine)
    6674{
    67   return (((int) irqLine <= BSP_PCI_IRQ_MAX_OFFSET) &
     75  return OpenPIC && (((int) irqLine <= BSP_PCI_IRQ_MAX_OFFSET) &&
    6876          ((int) irqLine >= BSP_PCI_IRQ_LOWEST_OFFSET)
    6977         );
    7078}
     79#endif
    7180
    7281/*
     
    7483 */
    7584
    76 #ifdef BSP_PCI_ISA_BRIDGE_IRQ
     85#if BSP_ISA_IRQ_NUMBER > 0
    7786/*
    7887 * Caution : this function assumes the variable "*config"
     
    104113BSP_enable_irq_at_pic(const rtems_irq_number name)
    105114{
    106 #ifdef BSP_PCI_ISA_BRIDGE_IRQ
     115#if BSP_ISA_IRQ_NUMBER > 0
    107116    if (is_isa_irq(name)) {
    108117      /*
     
    113122#endif
    114123
     124#if BSP_PCI_IRQ_NUMBER > 0
    115125    if (is_pci_irq(name)) {
    116126      /*
     
    119129      openpic_enable_irq ((int) name - BSP_PCI_IRQ_LOWEST_OFFSET);
    120130    }
     131#endif
    121132}
    122133
     
    124135BSP_disable_irq_at_pic(const rtems_irq_number name)
    125136{
    126 #ifdef BSP_PCI_ISA_BRIDGE_IRQ
     137#if BSP_ISA_IRQ_NUMBER > 0
    127138    if (is_isa_irq(name)) {
    128139      /*
     
    132143    }
    133144#endif
     145#if BSP_PCI_IRQ_NUMBER > 0
    134146    if (is_pci_irq(name)) {
    135147      /*
     
    138150      return openpic_disable_irq ((int) name - BSP_PCI_IRQ_LOWEST_OFFSET);
    139151    }
     152#endif
    140153        return -1;
    141154}
     
    157170     */
    158171
    159 #ifdef BSP_PCI_ISA_BRIDGE_IRQ
     172#if BSP_ISA_IRQ_NUMBER > 0
    160173    /*
    161174     * start with ISA IRQ
     
    180193#endif
    181194
     195#if BSP_PCI_IRQ_NUMBER > 0
     196        if ( ! OpenPIC )
     197                return 1;
    182198    /*
    183199     * continue with PCI IRQ
     
    198214
    199215#ifdef BSP_PCI_ISA_BRIDGE_IRQ
    200         if ( BSP_ISA_IRQ_NUMBER > 0 ) {
    201         /*
    202              * Must enable PCI/ISA bridge IRQ
    203              */
    204         openpic_enable_irq (0);
    205         }
     216        /*
     217     * Must enable PCI/ISA bridge IRQ
     218     */
     219        openpic_enable_irq (BSP_PCI_ISA_BRIDGE_IRQ);
     220#endif
    206221#endif
    207222
     
    219234{
    220235  register unsigned int irq;
    221 #ifdef BSP_PCI_ISA_BRIDGE_IRQ
     236#if BSP_ISA_IRQ_NUMBER > 0
    222237  register unsigned isaIntr;                  /* boolean */
    223238  register unsigned oldMask = 0;              /* old isa pic masks */
     
    232247
    233248  }
    234   irq = openpic_irq(0);
    235   if (irq == OPENPIC_VEC_SPURIOUS) {
    236     ++BSP_spuriousIntr;
    237     return 0;
    238   }
    239 
    240   /* some BSPs might want to use a different numbering... */
    241   irq = irq - OPENPIC_VEC_SOURCE + BSP_PCI_IRQ_LOWEST_OFFSET;
    242 
     249
     250#if BSP_PCI_IRQ_NUMBER > 0
     251  if ( OpenPIC ) {
     252    irq = openpic_irq(0);
     253    if (irq == OPENPIC_VEC_SPURIOUS) {
     254      ++BSP_spuriousIntr;
     255      return 0;
     256    }
     257
     258    /* some BSPs might want to use a different numbering... */
     259    irq = irq - OPENPIC_VEC_SOURCE + BSP_PCI_IRQ_LOWEST_OFFSET;
     260  } else {
     261#if BSP_ISA_IRQ_NUMBER > 0
    243262#ifdef BSP_PCI_ISA_BRIDGE_IRQ
     263        irq = BSP_PCI_ISA_BRIDGE_IRQ;
     264#else
     265#error "Configuration Error -- BSP with ISA + PCI IRQs MUST define BSP_PCI_ISA_BRIDGE_IRQ"
     266#endif
     267#else
     268        rtems_panic("MUST have an OpenPIC if BSP has PCI IRQs but no ISA IRQs");
     269#endif
     270  }
     271#endif
     272
     273#if BSP_ISA_IRQ_NUMBER > 0
     274#ifdef BSP_PCI_ISA_BRIDGE_IRQ
     275#if 0 == BSP_PCI_IRQ_NUMBER
     276#error "Configuration Error -- BSP w/o PCI IRQs MUST NOT define BSP_PCI_ISA_BRIDGE_IRQ"
     277#endif
    244278  isaIntr = (irq == BSP_PCI_ISA_BRIDGE_IRQ);
     279#else
     280  isaIntr = 1;
     281#endif
    245282  if (isaIntr)  {
    246283    /*
     
    257294    outport_byte(PIC_SLAVE_IMR_IO_PORT, ((i8259s_cache & 0xff00) >> 8));
    258295    BSP_irq_ack_at_i8259s (irq);
    259     openpic_eoi(0);
     296#if BSP_PCI_IRQ_NUMBER > 0
     297        if ( OpenPIC )
     298      openpic_eoi(0);
     299#endif
    260300  }
    261301#endif
     
    264304  bsp_irq_dispatch_list(rtems_hdl_tbl, irq, default_rtems_entry.hdl);
    265305
    266 #ifdef BSP_PCI_ISA_BRIDGE_IRQ
     306#if BSP_ISA_IRQ_NUMBER > 0
    267307  if (isaIntr)  {
    268308    i8259s_cache = oldMask;
     
    273313#endif
    274314  {
     315#if BSP_PCI_IRQ_NUMBER > 0
    275316#ifdef BSP_PCI_VME_DRIVER_DOES_EOI
    276317        /* leave it to the VME bridge driver to do EOI, so
     
    278319     * VME interrupts (-> VME priorities in software)
    279320         */
    280         if (_BSP_vme_bridge_irq != irq)
     321        if (_BSP_vme_bridge_irq != irq && OpenPIC)
    281322#endif
    282323                openpic_eoi(0);
     324#else
     325        do {} while (0);
     326#endif
    283327  }
    284328  return 0;
  • c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c

    r92f93e8 r048fd36  
    1111#include <bsp/residual.h>
    1212#include <bsp/openpic.h>
     13#include <bsp/irq.h>
    1314
    1415#include <rtems/bspIo.h>
     
    188189    }
    189190  }
     191
     192#if BSP_PCI_IRQ_NUMBER > 0
    190193  if (OpenPIC == (volatile struct OpenPIC *)0) {
    191194    BSP_panic("OpenPic Not found\n");
    192195  }
     196#endif
    193197
    194198}
Note: See TracChangeset for help on using the changeset viewer.