source: rtems/c/src/lib/libbsp/powerpc/ep1a/irq/irq_init.c @ 7a4c4f4

4.115
Last change on this file since 7a4c4f4 was 7a4c4f4, checked in by Joel Sherrill <joel.sherrill@…>, on 10/13/14 at 15:28:44

powerpc/ep1a: Fix warnings

  • Property mode set to 100644
File size: 5.8 KB
Line 
1/*
2 *  This file contains the implementation of rtems initialization
3 *  related to interrupt handling.
4 */
5
6/*
7 *  CopyRight (C) 1999 valette@crf.canon.fr
8 *
9 * Enhanced by Jay Kulpinski <jskulpin@eng01.gdds.com>
10 * to make it valid for MVME2300 Motorola boards.
11 *
12 * Till Straumann <strauman@slac.stanford.edu>, 12/20/2001:
13 * Use the new interface to openpic_init
14 *
15 *  COPYRIGHT (c) 1989-2008.
16 *  On-Line Applications Research Corporation (OAR).
17 *
18 *  The license and distribution terms for this file may be
19 *  found in the file LICENSE in this distribution or at
20 *  http://www.rtems.org/license/LICENSE.
21 */
22
23#include <libcpu/io.h>
24#include <libcpu/spr.h>
25#include <bsp/pci.h>
26#include <bsp/residual.h>
27#include <bsp/openpic.h>
28#include <bsp/irq.h>
29#include <bsp.h>
30#include <bsp/vectors.h>
31#include <bsp/motorola.h>
32#include <rtems/bspIo.h>
33
34/*
35#define SHOW_ISA_PCI_BRIDGE_SETTINGS
36*/
37#define TRACE_IRQ_INIT
38
39static void IRQ_Default_rtems_irq_hdl(
40  rtems_irq_hdl_param ptr
41)
42{
43}
44
45static void IRQ_Default_rtems_irq_enable(
46  const struct __rtems_irq_connect_data__ *ptr
47)
48{
49}
50
51static void IRQ_Default_rtems_irq_disable(
52  const struct __rtems_irq_connect_data__ *ptr
53)
54{
55}
56
57static int  IRQ_Default_rtems_irq_is_enabled(
58  const struct __rtems_irq_connect_data__ *ptr)
59{
60  return 1;
61}
62
63static rtems_irq_connect_data           rtemsIrq[BSP_IRQ_NUMBER];
64static rtems_irq_global_settings        initial_config;
65
66static rtems_irq_connect_data defaultIrq = {
67  .name   = 0,
68  .hdl    = IRQ_Default_rtems_irq_hdl,
69  .handle = NULL,
70  .on     = IRQ_Default_rtems_irq_enable,
71  .on     = IRQ_Default_rtems_irq_disable,
72  .isOn   = IRQ_Default_rtems_irq_is_enabled
73};
74
75static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={
76  /*
77   * actual rpiorities for interrupt :
78   *    0   means that only current interrupt is masked
79   *    255 means all other interrupts are masked
80   */
81  /*
82   * ISA interrupts.
83   * The second entry has a priority of 255 because
84   * it is the slave pic entry and is should always remain
85   * unmasked.
86   */
87  0,0,
88  255,
89  0, 0, 0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
90  /*
91   * PCI Interrupts
92   */
93  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* for raven prio 0 means unactive... */
94  /*
95   * Processor exceptions handled as interrupts
96   */
97  0
98};
99
100static unsigned char mcp750_openpic_initpolarities[] = {
101    1,  /*  0 8259 cascade */
102    0,  /*  1 all the rest of them */
103    0,  /*  2 all the rest of them */
104    0,  /*  3 all the rest of them */
105    0,  /*  4 all the rest of them */
106    0,  /*  5 all the rest of them */
107    0,  /*  6 all the rest of them */
108    0,  /*  7 all the rest of them */
109    0,  /*  8 all the rest of them */
110    0,  /*  9 all the rest of them */
111    0,  /* 10 all the rest of them */
112    0,  /* 11 all the rest of them */
113    0,  /* 12 all the rest of them */
114    0,  /* 13 all the rest of them */
115    0,  /* 14 all the rest of them */
116    0,  /* 15 all the rest of them */
117    0,  /* 16 all the rest of them */
118    0,  /* 17 all the rest of them */
119    1,  /* 18 all the rest of them */
120    1,  /* 19 all the rest of them */
121    1,  /* 20 all the rest of them */
122    1,  /* 21 all the rest of them */
123    1,  /* 22 all the rest of them */
124    1,  /* 23 all the rest of them */
125    1,  /* 24 all the rest of them */
126    1,  /* 25 all the rest of them */
127};
128
129static unsigned char mcp750_openpic_initsenses[] = {
130    1,  /* 0 MCP750_INT_PCB(8259) */
131    0,  /* 1 MCP750_INT_FALCON_ECC_ERR */
132    1,  /* 2 MCP750_INT_PCI_ETHERNET */
133    1,  /* 3 MCP750_INT_PCI_PMC */
134    1,  /* 4 MCP750_INT_PCI_WATCHDOG_TIMER1 */
135    1,  /* 5 MCP750_INT_PCI_PRST_SIGNAL */
136    1,  /* 6 MCP750_INT_PCI_FALL_SIGNAL */
137    1,  /* 7 MCP750_INT_PCI_DEG_SIGNAL */
138    1,  /* 8 MCP750_INT_PCI_BUS1_INTA */
139    1,  /* 9 MCP750_INT_PCI_BUS1_INTB */
140    1,  /*10 MCP750_INT_PCI_BUS1_INTC */
141    1,  /*11 MCP750_INT_PCI_BUS1_INTD */
142    1,  /*12 MCP750_INT_PCI_BUS2_INTA */
143    1,  /*13 MCP750_INT_PCI_BUS2_INTB */
144    1,  /*14 MCP750_INT_PCI_BUS2_INTC */
145    1,  /*15 MCP750_INT_PCI_BUS2_INTD */
146    1,
147    1,
148    1,
149    1,
150    1,
151    1,
152    1,
153    1,
154    1,
155    1
156};
157
158  /*
159   * This code assumes the exceptions management setup has already
160   * been done. We just need to replace the exceptions that will
161   * be handled like interrupt. On mcp750/mpc750 and many PPC processors
162   * this means the decrementer exception and the external exception.
163   */
164void BSP_rtems_irq_mng_init(unsigned cpuId)
165{
166  int i;
167
168  /*
169   * First initialize the Interrupt management hardware
170   */
171#ifdef TRACE_IRQ_INIT
172  printk("Going to initialize openpic compliant device\n");
173#endif
174  /* FIXME (t.s.): we should probably setup the EOI delay by
175   * passing a non-zero 'epic_freq' argument (frequency of the
176   * EPIC serial interface) but I don't know the value on this
177   * board (8245 SDRAM freq, IIRC)...
178   */
179  openpic_init(1, mcp750_openpic_initpolarities, mcp750_openpic_initsenses, 0, 16, 0 /* epic_freq */);
180
181#ifdef TRACE_IRQ_INIT
182  printk("Going to initialize the PCI/ISA bridge IRQ related setting (VIA 82C586)\n");
183#endif
184
185  /*
186   * Initialize Rtems management interrupt table
187   */
188    /*
189     * re-init the rtemsIrq table
190     */
191    for (i = 0; i < BSP_IRQ_NUMBER; i++) {
192      rtemsIrq[i]      = defaultIrq;
193      rtemsIrq[i].name = i;
194    }
195    /*
196     * Init initial Interrupt management config
197     */
198    initial_config.irqNb        = BSP_IRQ_NUMBER;
199    initial_config.defaultEntry = defaultIrq;
200    initial_config.irqHdlTbl    = rtemsIrq;
201    initial_config.irqBase      = BSP_LOWEST_OFFSET;
202    initial_config.irqPrioTbl   = irqPrioTable;
203
204printk("Call BSP_rtems_irq_mngt_set\n");
205    if (!BSP_rtems_irq_mngt_set(&initial_config)) {
206      /*
207       * put something here that will show the failure...
208       */
209      BSP_panic("Unable to initialize RTEMS interrupt Management!!! System locked\n");
210    }
211
212#ifdef TRACE_IRQ_INIT
213    printk("RTEMS IRQ management is now operationnal\n");
214#endif
215}
216
Note: See TracBrowser for help on using the repository browser.