RTEMS: bsps/powerpc/motorola_powerpc/include/bsp/VMEConfig.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
VMEConfig.h
1#ifndef RTEMS_BSP_VME_CONFIG_H
2#define RTEMS_BSP_VME_CONFIG_H
3
4/* BSP specific address space configuration parameters */
5
6/*
7 * Authorship
8 * ----------
9 * This software was created by
10 * Till Straumann <strauman@slac.stanford.edu>, 2002,
11 * Stanford Linear Accelerator Center, Stanford University.
12 *
13 * Acknowledgement of sponsorship
14 * ------------------------------
15 * This software was produced by
16 * the Stanford Linear Accelerator Center, Stanford University,
17 * under Contract DE-AC03-76SFO0515 with the Department of Energy.
18 *
19 * Government disclaimer of liability
20 * ----------------------------------
21 * Neither the United States nor the United States Department of Energy,
22 * nor any of their employees, makes any warranty, express or implied, or
23 * assumes any legal liability or responsibility for the accuracy,
24 * completeness, or usefulness of any data, apparatus, product, or process
25 * disclosed, or represents that its use would not infringe privately owned
26 * rights.
27 *
28 * Stanford disclaimer of liability
29 * --------------------------------
30 * Stanford University makes no representations or warranties, express or
31 * implied, nor assumes any liability for the use of this software.
32 *
33 * Stanford disclaimer of copyright
34 * --------------------------------
35 * Stanford University, owner of the copyright, hereby disclaims its
36 * copyright and all other rights in this software. Hence, anyone may
37 * freely use it for any purpose without restriction.
38 *
39 * Maintenance of notices
40 * ----------------------
41 * In the interest of clarity regarding the origin and status of this
42 * SLAC software, this and all the preceding Stanford University notices
43 * are to remain affixed to any copy or derivative of this software made
44 * or distributed by the recipient and are to be affixed to any copy of
45 * software made or distributed by the recipient that contains a copy or
46 * derivative of this software.
47 *
48 * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
49 */
50
51/*
52 * The BSP maps VME address ranges into
53 * one BAT.
54 * NOTE: the BSP (startup/bspstart.c) uses
55 * hardcoded window lengths that match this
56 * layout:
57 *
58 * BSP_VME_BAT_IDX defines
59 * which BAT to use for mapping the VME bus.
60 * If this is undefined, no extra BAT will be
61 * configured and VME has to share the available
62 * PCI address space with PCI devices.
63 *
64 * If you do define BSP_VME_BAT_IDX you must
65 * make sure the corresponding BAT is really
66 * available and unused!
67 */
68
69#if defined(mvme2100)
70#define _VME_A32_WIN0_ON_PCI 0x90000000
71#define _VME_A24_ON_PCI 0x9f000000
72#define _VME_A16_ON_PCI 0x9fff0000
73#define BSP_VME_BAT_IDX 1
74#else
75#define _VME_A32_WIN0_ON_PCI 0x10000000
76#define _VME_A24_ON_PCI 0x1f000000
77#define _VME_A16_ON_PCI 0x1fff0000
78#define BSP_VME_BAT_IDX 0
79#endif
80
81/* start of the A32 window on the VME bus
82 * TODO: this should perhaps be a run-time configuration option
83 */
84#define _VME_A32_WIN0_ON_VME 0x20000000
85
86/* if _VME_DRAM_OFFSET is defined, the BSP
87 * will map the board RAM onto the VME bus, starting
88 * at _VME_DRAM_OFFSET
89 */
90#define _VME_DRAM_OFFSET 0xc0000000
91
92/* Define BSP_PCI_VME_DRIVER_DOES_EOI to let the vmeUniverse
93 * driver (Tsi148 driver doesn't implement this) implement
94 * VME IRQ priorities in software.
95 *
96 * Here's how this works:
97 *
98 * 1) VME IRQ happens
99 * 2) universe propagates IRQ to PCI/PPC/main interrupt
100 * controller ('PIC' - programmable interrupt controller).
101 * 3) PIC driver dispatches universe driver's ISR
102 * 4) universe driver ISR acknowledges IRQ on VME,
103 * determines VME vector.
104 * ++++++++++++ stuff between ++ signs is related to SW priorities +++++++++
105 * 5) universe driver *masks* all VME IRQ levels <= interrupting
106 * level.
107 * 6) universe driver calls PIC driver's 'EOI' routine.
108 * This effectively re-enables PCI and hence higher
109 * level VME interrupts.
110 * 7) universe driver dispatches user VME ISR.
111 *
112 * ++>> HIGHER PRIORITY VME IRQ COULD HAPPEN HERE and would be handled <<++
113 *
114 * 8) user ISR returns, universe driver re-enables lower
115 * level VME interrupts, returns.
116 * 9) universe driver ISR returns control to PIC driver
117 * 10) PIC driver *omits* regular EOI sequence since this
118 * was already done by universe driver (step 6).
119 * ++++++++++++ end of special handling (SW priorities) ++++++++++++++++++++
120 * 11) PIC driver ISR dispatcher returns.
121 *
122 * Note that the BSP *MUST* provide the following hooks
123 * in order for this to work:
124 * a) bsp.h must define the symbol BSP_PIC_DO_EOI to
125 * a sequence of instructions that terminates an
126 * interrupt at the interrupt controller.
127 * b) The interrupt controller driver must check the
128 * interrupt source and *must omit* running the EOI
129 * sequence if the interrupt source is the vmeUniverse
130 * (because the universe driver already ran BSP_PIC_DO_EOI)
131 * The interrupt controller must define the variable
132 *
133 * int _BSP_vme_bridge_irq = -1;
134 *
135 * which is assigned the universe's interrupt line information
136 * by vme_universe.c:BSP_VMEIrqMgrInstall(). The interrupt
137 * controller driver may use this variable to determine
138 * if an IRQ was caused by the universe.
139 *
140 * c) define BSP_PCI_VME_DRIVER_DOES_EOI
141 *
142 * NOTE: If a) and b) are not implemented by the BSP
143 * BSP_PCI_VME_DRIVER_DOES_EOI must be *undefined*.
144 */
145#define BSP_PCI_VME_DRIVER_DOES_EOI
146
147#ifdef BSP_PCI_VME_DRIVER_DOES_EOI
148/* don't reference vmeUniverse0PciIrqLine directly from the irq
149 * controller driver - leave it up to BSP_VMEIrqMgrInstall() to
150 * set _BSP_vme_bridge_irq. That way, we can avoid linking
151 * the universe driver if VME is unused...
152 */
153extern int _BSP_vme_bridge_irq;
154#endif
155
156/* If your BSP requires a non-standard way to configure
157 * the VME interrupt manager then define the symbol
158 *
159 * BSP_VME_UNIVERSE_INSTALL_IRQ_MGR
160 *
161 * to a proper instruction sequence that installs the
162 * universe interrupt manager. This requires knowledge
163 * of the wiring between the universe and the PIC (main
164 * interrupt controller), i.e., which IRQ 'pins' of the
165 * universe are wired to which 'lines'/inputs at the PIC.
166 * (consult vmeUniverse.h for more information).
167 *
168 * When installing the universe IRQ manager it is also
169 * possible to specify whether it should try to share
170 * PIC interrupts with other sources. This might not
171 * be supported by all BSPs (but the unverse driver
172 * recognizes that).
173 *
174 * If BSP_VME_UNIVERSE_INSTALL_IRQ_MGR is undefined then
175 * the default algorithm is used (vme_universe.c):
176 *
177 * This default setup uses only a single wire. It reads
178 * the PIC 'line' from PCI configuration space and assumes
179 * this to be wired to the first (LIRQ0) IRQ input at the
180 * universe. The default setup tries to use interrupt
181 * sharing.
182 */
183
184#include <bsp/motorola.h>
185#include <bsp/pci.h>
186
187#define BSP_VME_UNIVERSE_INSTALL_IRQ_MGR(err) \
188do { \
189int bus, dev, i = 0, j; \
190const struct _int_map *bspmap; \
191 /* install the VME interrupt manager; \
192 * if there's a bsp route map, use it to \
193 * configure additional lines... \
194 */ \
195 err = -1; \
196 if (0 == pci_find_device(0x10e3, 0x0000, 0, &bus, &dev, &i)){ \
197 if ( (bspmap = motorolaIntMap(currentBoard)) ) { \
198 for ( i=0; bspmap[i].bus >= 0; i++ ) { \
199 if ( bspmap[i].bus == bus && bspmap[i].slot == dev ) { \
200 int pins[5], names[4]; \
201 /* found it; use info here... */ \
202 /* copy up to 4 entries; terminated with -1 pin */ \
203 for ( j=0; \
204 j<5 && (pins[j]=bspmap[i].pin_route[j].pin-1)>=0; \
205 j++) { \
206 names[j] = bspmap[i].pin_route[j].int_name[0]; \
207 } \
208 pins[4] = -1; \
209 if ( 0 == vmeUniverseInstallIrqMgrAlt( \
210 VMEUNIVERSE_IRQ_MGR_FLAG_SHARED, /* shared IRQs */\
211 pins[0], names[0], \
212 pins[1], names[1], \
213 pins[2], names[2], \
214 pins[3], names[3], \
215 -1) ) { \
216 i = -1; \
217 break; \
218 } \
219 } \
220 } \
221 } \
222 if ( i >= 0 ) \
223 err = vmeUniverseInstallIrqMgrAlt( \
224 VMEUNIVERSE_IRQ_MGR_FLAG_SHARED, \
225 0,-1, \
226 -1); \
227 } \
228} while (0)
229
230extern int BSP_VMEInit(void);
231extern int BSP_VMEIrqMgrInstall(void);
232
233#endif