1 | /* irq_init.c |
---|
2 | * |
---|
3 | * This file contains the implementation of rtems initialization |
---|
4 | * related to interrupt handling. |
---|
5 | * |
---|
6 | * CopyRight (C) 1999 valette@crf.canon.fr |
---|
7 | * |
---|
8 | * Enhanced by Jay Kulpinski <jskulpin@eng01.gdds.com> |
---|
9 | * to make it valid for MVME2300 Motorola boards. |
---|
10 | * |
---|
11 | * Till Straumann <strauman@slac.stanford.edu>, 12/20/2001: |
---|
12 | * Use the new interface to openpic_init |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.com/license/LICENSE. |
---|
17 | * |
---|
18 | * $Id$ |
---|
19 | */ |
---|
20 | |
---|
21 | #include <libcpu/io.h> |
---|
22 | #include <libcpu/spr.h> |
---|
23 | #include <bsp/pci.h> |
---|
24 | #include <bsp/residual.h> |
---|
25 | #include <bsp/irq.h> |
---|
26 | #include <bsp.h> |
---|
27 | #include <libcpu/raw_exception.h> |
---|
28 | #include <rtems/bspIo.h> |
---|
29 | |
---|
30 | #define SHOW_ISA_PCI_BRIDGE_SETTINGS 1 |
---|
31 | #define SCAN_PCI_PRINT 1 |
---|
32 | #define TRACE_IRQ_INIT 0 |
---|
33 | |
---|
34 | typedef struct { |
---|
35 | unsigned char bus; /* few chance the PCI/ISA bridge is not on first bus but ... */ |
---|
36 | unsigned char device; |
---|
37 | unsigned char function; |
---|
38 | } pci_isa_bridge_device; |
---|
39 | |
---|
40 | pci_isa_bridge_device* via_82c586 = 0; |
---|
41 | |
---|
42 | extern unsigned int external_exception_vector_prolog_code_size[]; |
---|
43 | extern void external_exception_vector_prolog_code(void); |
---|
44 | extern unsigned int decrementer_exception_vector_prolog_code_size[]; |
---|
45 | extern void decrementer_exception_vector_prolog_code(void); |
---|
46 | |
---|
47 | static void IRQ_Default_rtems_irq_hdl( rtems_irq_hdl_param ptr ) {} |
---|
48 | static void IRQ_Default_rtems_irq_enable (const struct __rtems_irq_connect_data__ *ptr){} |
---|
49 | static void IRQ_Default_rtems_irq_disable(const struct __rtems_irq_connect_data__ *ptr){} |
---|
50 | static int IRQ_Default_rtems_irq_is_enabled(const struct __rtems_irq_connect_data__ *ptr){ return 1; } |
---|
51 | |
---|
52 | static rtems_irq_connect_data rtemsIrq[BSP_IRQ_NUMBER]; |
---|
53 | static rtems_irq_global_settings initial_config; |
---|
54 | |
---|
55 | static rtems_irq_connect_data defaultIrq = { |
---|
56 | /*name, hdl handle on off isOn */ |
---|
57 | 0, IRQ_Default_rtems_irq_hdl, NULL, IRQ_Default_rtems_irq_enable, IRQ_Default_rtems_irq_disable, IRQ_Default_rtems_irq_is_enabled |
---|
58 | }; |
---|
59 | |
---|
60 | static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]; |
---|
61 | |
---|
62 | /* |
---|
63 | * This code assumes the exceptions management setup has already |
---|
64 | * been done. We just need to replace the exceptions that will |
---|
65 | * be handled like interrupt. On mcp750/mpc750 and many PPC processors |
---|
66 | * this means the decrementer exception and the external exception. |
---|
67 | */ |
---|
68 | void BSP_rtems_irq_mng_init(unsigned cpuId) |
---|
69 | { |
---|
70 | int i; |
---|
71 | |
---|
72 | /* |
---|
73 | * First initialize the Interrupt management hardware |
---|
74 | */ |
---|
75 | |
---|
76 | /* |
---|
77 | * Initialize RTEMS management interrupt table |
---|
78 | */ |
---|
79 | /* |
---|
80 | * re-init the rtemsIrq table |
---|
81 | */ |
---|
82 | for (i = 0; i < BSP_IRQ_NUMBER; i++) { |
---|
83 | irqPrioTable[i] = 8; |
---|
84 | rtemsIrq[i] = defaultIrq; |
---|
85 | rtemsIrq[i].name = i; |
---|
86 | #ifdef BSP_SHARED_HANDLER_SUPPORT |
---|
87 | rtemsIrq[i].next_handler = NULL; |
---|
88 | #endif |
---|
89 | } |
---|
90 | |
---|
91 | /* |
---|
92 | * Init initial Interrupt management config |
---|
93 | */ |
---|
94 | initial_config.irqNb = BSP_IRQ_NUMBER; |
---|
95 | initial_config.defaultEntry = defaultIrq; |
---|
96 | initial_config.irqHdlTbl = rtemsIrq; |
---|
97 | initial_config.irqBase = BSP_LOWEST_OFFSET; |
---|
98 | initial_config.irqPrioTbl = irqPrioTable; |
---|
99 | |
---|
100 | if (!BSP_rtems_irq_mngt_set(&initial_config)) { |
---|
101 | /* |
---|
102 | * put something here that will show the failure... |
---|
103 | */ |
---|
104 | BSP_panic("Unable to initialize RTEMS interrupt Management!!! System locked\n"); |
---|
105 | } |
---|
106 | |
---|
107 | #ifdef TRACE_IRQ_INIT |
---|
108 | printk("RTEMS IRQ management is now operational\n"); |
---|
109 | #endif |
---|
110 | } |
---|