1 | /* $Id$ */ |
---|
2 | |
---|
3 | /* Default VME bridge configuration - note that this file |
---|
4 | * is independent of the bridge driver/chip |
---|
5 | */ |
---|
6 | |
---|
7 | /* |
---|
8 | * Authorship |
---|
9 | * ---------- |
---|
10 | * This software was created by |
---|
11 | * Till Straumann <strauman@slac.stanford.edu>, 3/2002, |
---|
12 | * Stanford Linear Accelerator Center, Stanford University. |
---|
13 | * |
---|
14 | * Acknowledgement of sponsorship |
---|
15 | * ------------------------------ |
---|
16 | * This software was produced by |
---|
17 | * the Stanford Linear Accelerator Center, Stanford University, |
---|
18 | * under Contract DE-AC03-76SFO0515 with the Department of Energy. |
---|
19 | * |
---|
20 | * Government disclaimer of liability |
---|
21 | * ---------------------------------- |
---|
22 | * Neither the United States nor the United States Department of Energy, |
---|
23 | * nor any of their employees, makes any warranty, express or implied, or |
---|
24 | * assumes any legal liability or responsibility for the accuracy, |
---|
25 | * completeness, or usefulness of any data, apparatus, product, or process |
---|
26 | * disclosed, or represents that its use would not infringe privately owned |
---|
27 | * rights. |
---|
28 | * |
---|
29 | * Stanford disclaimer of liability |
---|
30 | * -------------------------------- |
---|
31 | * Stanford University makes no representations or warranties, express or |
---|
32 | * implied, nor assumes any liability for the use of this software. |
---|
33 | * |
---|
34 | * Stanford disclaimer of copyright |
---|
35 | * -------------------------------- |
---|
36 | * Stanford University, owner of the copyright, hereby disclaims its |
---|
37 | * copyright and all other rights in this software. Hence, anyone may |
---|
38 | * freely use it for any purpose without restriction. |
---|
39 | * |
---|
40 | * Maintenance of notices |
---|
41 | * ---------------------- |
---|
42 | * In the interest of clarity regarding the origin and status of this |
---|
43 | * SLAC software, this and all the preceding Stanford University notices |
---|
44 | * are to remain affixed to any copy or derivative of this software made |
---|
45 | * or distributed by the recipient and are to be affixed to any copy of |
---|
46 | * software made or distributed by the recipient that contains a copy or |
---|
47 | * derivative of this software. |
---|
48 | * |
---|
49 | * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03 |
---|
50 | */ |
---|
51 | |
---|
52 | #include <bsp.h> |
---|
53 | #include <bsp/VME.h> |
---|
54 | #include <bsp/VMEConfig.h> |
---|
55 | #ifdef BSP_VME_BAT_IDX |
---|
56 | #include <libcpu/bat.h> |
---|
57 | #endif |
---|
58 | #include <rtems/bspIo.h> |
---|
59 | |
---|
60 | extern int BSP_VMEInit(void); |
---|
61 | extern int BSP_VMEIrqMgrInstall(void); |
---|
62 | |
---|
63 | /* Use a weak alias for the VME configuration. |
---|
64 | * This permits individual applications to override |
---|
65 | * this routine. |
---|
66 | * They may even create an 'empty' |
---|
67 | * |
---|
68 | * void BSP_vme_config(void) {} |
---|
69 | * |
---|
70 | * which will avoid linking in the Universe driver |
---|
71 | * at all :-). |
---|
72 | */ |
---|
73 | |
---|
74 | void BSP_vme_config(void) __attribute__ (( weak, alias("__BSP_default_vme_config") )); |
---|
75 | |
---|
76 | void |
---|
77 | __BSP_default_vme_config(void) |
---|
78 | { |
---|
79 | |
---|
80 | if ( BSP_VMEInit() ) { |
---|
81 | printk("Skipping VME initialization...\n"); |
---|
82 | return; |
---|
83 | } |
---|
84 | |
---|
85 | #ifdef BSP_VME_BAT_IDX |
---|
86 | /* setup a PCI area to map the VME bus */ |
---|
87 | setdbat(BSP_VME_BAT_IDX, |
---|
88 | PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI, |
---|
89 | PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI, |
---|
90 | 0x10000000, |
---|
91 | IO_PAGE); |
---|
92 | #endif |
---|
93 | |
---|
94 | /* map VME address ranges */ |
---|
95 | BSP_VMEOutboundPortCfg( |
---|
96 | 0, |
---|
97 | VME_AM_EXT_SUP_DATA, |
---|
98 | _VME_A32_WIN0_ON_VME, |
---|
99 | _VME_A32_WIN0_ON_PCI, |
---|
100 | 0x0e000000); |
---|
101 | BSP_VMEOutboundPortCfg( |
---|
102 | 1, |
---|
103 | VME_AM_STD_SUP_DATA, |
---|
104 | 0x00000000, |
---|
105 | _VME_A24_ON_PCI, |
---|
106 | 0x00ff0000); |
---|
107 | BSP_VMEOutboundPortCfg( |
---|
108 | 2, |
---|
109 | VME_AM_SUP_SHORT_IO, |
---|
110 | 0x00000000, |
---|
111 | _VME_A16_ON_PCI, |
---|
112 | 0x00010000); |
---|
113 | |
---|
114 | #ifdef _VME_CSR_ON_PCI |
---|
115 | /* Map VME64 CSR */ |
---|
116 | BSP_VMEOutboundPortCfg( |
---|
117 | 7, |
---|
118 | VME_AM_CSR, |
---|
119 | 0, |
---|
120 | _VME_CSR_ON_PCI, |
---|
121 | 0x01000000); |
---|
122 | #endif |
---|
123 | |
---|
124 | |
---|
125 | #ifdef _VME_DRAM_OFFSET |
---|
126 | /* map our memory to VME giving the driver a hint that it's ordinary memory |
---|
127 | * so they can enable decoupled cycles which should give better performance... |
---|
128 | */ |
---|
129 | BSP_VMEInboundPortCfg( |
---|
130 | 0, |
---|
131 | VME_AM_EXT_SUP_DATA | VME_AM_IS_MEMORY, |
---|
132 | _VME_DRAM_OFFSET, |
---|
133 | PCI_DRAM_OFFSET, |
---|
134 | BSP_mem_size); |
---|
135 | #endif |
---|
136 | |
---|
137 | /* stdio is not yet initialized; the driver will revert to printk */ |
---|
138 | BSP_VMEOutboundPortsShow(0); |
---|
139 | BSP_VMEInboundPortsShow(0); |
---|
140 | |
---|
141 | BSP_VMEIrqMgrInstall(); |
---|
142 | } |
---|