1 | Index: c/src/lib/libbsp/shared/vmeUniverse/vmeUniverse.c |
---|
2 | =================================================================== |
---|
3 | RCS file: /afs/slac/g/spear/cvsrep/drivers/universe/vmeUniverse.c,v |
---|
4 | retrieving revision 1.34 |
---|
5 | retrieving revision 1.36 |
---|
6 | diff -c -r1.34 -r1.36 |
---|
7 | *** c/src/lib/libbsp/shared/vmeUniverse/vmeUniverse.c 10 Feb 2003 23:20:05 -0000 1.34 |
---|
8 | --- c/src/lib/libbsp/shared/vmeUniverse/vmeUniverse.c 21 Mar 2003 20:54:18 -0000 1.36 |
---|
9 | *************** |
---|
10 | *** 1,4 **** |
---|
11 | ! /* $Id: vmeUniverse.c,v 1.34 2003/02/10 23:20:05 till Exp $ */ |
---|
12 | |
---|
13 | /* Routines to configure the VME interface |
---|
14 | * Author: Till Straumann <strauman@slac.stanford.edu> |
---|
15 | --- 1,4 ---- |
---|
16 | ! /* $Id: vmeUniverse.c,v 1.36 2003/03/21 20:54:18 till Exp $ */ |
---|
17 | |
---|
18 | /* Routines to configure the VME interface |
---|
19 | * Author: Till Straumann <strauman@slac.stanford.edu> |
---|
20 | *************** |
---|
21 | *** 8,13 **** |
---|
22 | --- 8,23 ---- |
---|
23 | #if 0 |
---|
24 | /* |
---|
25 | * $Log: vmeUniverse.c,v $ |
---|
26 | + * Revision 1.36 2003/03/21 20:54:18 till |
---|
27 | + * - modified 'printf()' formats to be compliant with the |
---|
28 | + * cpukit 'printk()' implementation and use the latter |
---|
29 | + * prior to stdio/libc being initialized. |
---|
30 | + * |
---|
31 | + * Revision 1.35 2003/03/06 20:52:44 till |
---|
32 | + * - fix lazy init bug reported by Kate Feng |
---|
33 | + * - rename misspelled dccp/DCCP to dcpp/DCPP ( :-( ) |
---|
34 | + * - added 'packed' attribute (probably not really necessary) |
---|
35 | + * |
---|
36 | * Revision 1.34 2003/02/10 23:20:05 till |
---|
37 | * - added some macro magic to make porting easier (ppcn_60x BSP in mind) |
---|
38 | * - made mgrInstalled public (vmeUniverseIrqMgrInstalled) so BSPs can |
---|
39 | *************** |
---|
40 | *** 309,315 **** |
---|
41 | |
---|
42 | #define UNIV_REV(base) (READ_LE(base,2*sizeof(LERegister)) & 0xff) |
---|
43 | |
---|
44 | ! #ifdef __rtems__ |
---|
45 | static int |
---|
46 | uprintk(char *fmt, va_list ap) |
---|
47 | { |
---|
48 | --- 319,325 ---- |
---|
49 | |
---|
50 | #define UNIV_REV(base) (READ_LE(base,2*sizeof(LERegister)) & 0xff) |
---|
51 | |
---|
52 | ! #if defined(__rtems__) && 0 |
---|
53 | static int |
---|
54 | uprintk(char *fmt, va_list ap) |
---|
55 | { |
---|
56 | *************** |
---|
57 | *** 330,340 **** |
---|
58 | |
---|
59 | |
---|
60 | /* private printing wrapper */ |
---|
61 | ! static int |
---|
62 | uprintf(FILE *f, char *fmt, ...) |
---|
63 | { |
---|
64 | va_list ap; |
---|
65 | - int rval; |
---|
66 | va_start(ap, fmt); |
---|
67 | #ifdef __rtems__ |
---|
68 | if (!f || !_impure_ptr->__sdidinit) { |
---|
69 | --- 340,349 ---- |
---|
70 | |
---|
71 | |
---|
72 | /* private printing wrapper */ |
---|
73 | ! static void |
---|
74 | uprintf(FILE *f, char *fmt, ...) |
---|
75 | { |
---|
76 | va_list ap; |
---|
77 | va_start(ap, fmt); |
---|
78 | #ifdef __rtems__ |
---|
79 | if (!f || !_impure_ptr->__sdidinit) { |
---|
80 | *************** |
---|
81 | *** 343,356 **** |
---|
82 | * There is no vprintk, hence we must assemble |
---|
83 | * to a buffer. |
---|
84 | */ |
---|
85 | ! rval=uprintk(fmt,ap); |
---|
86 | } else |
---|
87 | #endif |
---|
88 | { |
---|
89 | ! rval=vfprintf(f,fmt,ap); |
---|
90 | } |
---|
91 | va_end(ap); |
---|
92 | - return rval; |
---|
93 | } |
---|
94 | |
---|
95 | int |
---|
96 | --- 352,364 ---- |
---|
97 | * There is no vprintk, hence we must assemble |
---|
98 | * to a buffer. |
---|
99 | */ |
---|
100 | ! vprintk(fmt,ap); |
---|
101 | } else |
---|
102 | #endif |
---|
103 | { |
---|
104 | ! vfprintf(f,fmt,ap); |
---|
105 | } |
---|
106 | va_end(ap); |
---|
107 | } |
---|
108 | |
---|
109 | int |
---|
110 | *************** |
---|
111 | *** 466,472 **** |
---|
112 | unsigned long length) |
---|
113 | { |
---|
114 | #define base vmeUniverse0BaseAddr |
---|
115 | ! volatile LERegister *preg=base; |
---|
116 | unsigned long p=port; |
---|
117 | unsigned long mode=0; |
---|
118 | |
---|
119 | --- 474,480 ---- |
---|
120 | unsigned long length) |
---|
121 | { |
---|
122 | #define base vmeUniverse0BaseAddr |
---|
123 | ! volatile LERegister *preg; |
---|
124 | unsigned long p=port; |
---|
125 | unsigned long mode=0; |
---|
126 | |
---|
127 | *************** |
---|
128 | *** 502,507 **** |
---|
129 | --- 510,517 ---- |
---|
130 | return -1; |
---|
131 | } |
---|
132 | |
---|
133 | + preg=base; |
---|
134 | + |
---|
135 | /* find out if we have a rev. II chip */ |
---|
136 | if ( UNIV_REV(base) < 2 ) { |
---|
137 | if (port>3) { |
---|
138 | *************** |
---|
139 | *** 632,641 **** |
---|
140 | offst+=start; /* calc start on the other bus */ |
---|
141 | |
---|
142 | if (ismaster) { |
---|
143 | ! uprintf(f,"%i: 0x%08lx 0x%08lx 0x%08lx ", |
---|
144 | portno,offst,bound-start,start); |
---|
145 | } else { |
---|
146 | ! uprintf(f,"%i: 0x%08lx 0x%08lx 0x%08lx ", |
---|
147 | portno,start,bound-start,offst); |
---|
148 | } |
---|
149 | |
---|
150 | --- 642,651 ---- |
---|
151 | offst+=start; /* calc start on the other bus */ |
---|
152 | |
---|
153 | if (ismaster) { |
---|
154 | ! uprintf(f,"%d: 0x%08lx 0x%08lx 0x%08lx ", |
---|
155 | portno,offst,bound-start,start); |
---|
156 | } else { |
---|
157 | ! uprintf(f,"%d: 0x%08lx 0x%08lx 0x%08lx ", |
---|
158 | portno,start,bound-start,offst); |
---|
159 | } |
---|
160 | |
---|
161 | *************** |
---|
162 | *** 884,890 **** |
---|
163 | if ((rval=vmeUniverseFindPciBase(0,&vmeUniverse0BaseAddr))) { |
---|
164 | uprintf(stderr,"unable to find the universe in pci config space\n"); |
---|
165 | } else { |
---|
166 | ! uprintf(stderr,"Universe II PCI-VME bridge detected at 0x%08x, IRQ %i\n", |
---|
167 | (unsigned int)vmeUniverse0BaseAddr, vmeUniverse0PciIrqLine); |
---|
168 | } |
---|
169 | return rval; |
---|
170 | --- 894,900 ---- |
---|
171 | if ((rval=vmeUniverseFindPciBase(0,&vmeUniverse0BaseAddr))) { |
---|
172 | uprintf(stderr,"unable to find the universe in pci config space\n"); |
---|
173 | } else { |
---|
174 | ! uprintf(stderr,"Universe II PCI-VME bridge detected at 0x%08x, IRQ %d\n", |
---|
175 | (unsigned int)vmeUniverse0BaseAddr, vmeUniverse0PciIrqLine); |
---|
176 | } |
---|
177 | return rval; |
---|
178 | *************** |
---|
179 | *** 1203,1209 **** |
---|
180 | if (specialOut >=0 && specialIrqPicLine < 0) return -3; |
---|
181 | /* give them a chance to override buggy PCI info */ |
---|
182 | if (vmeIrqPicLine >= 0) { |
---|
183 | ! uprintf(stderr,"Overriding main IRQ line PCI info with %i\n", |
---|
184 | vmeIrqPicLine); |
---|
185 | vmeUniverse0PciIrqLine=vmeIrqPicLine; |
---|
186 | } |
---|
187 | --- 1213,1219 ---- |
---|
188 | if (specialOut >=0 && specialIrqPicLine < 0) return -3; |
---|
189 | /* give them a chance to override buggy PCI info */ |
---|
190 | if (vmeIrqPicLine >= 0) { |
---|
191 | ! uprintf(stderr,"Overriding main IRQ line PCI info with %d\n", |
---|
192 | vmeIrqPicLine); |
---|
193 | vmeUniverse0PciIrqLine=vmeIrqPicLine; |
---|
194 | } |
---|
195 | Index: c/src/lib/libbsp/shared/vmeUniverse/vmeUniverse.h |
---|
196 | =================================================================== |
---|
197 | RCS file: /afs/slac/g/spear/cvsrep/drivers/universe/vmeUniverse.h,v |
---|
198 | retrieving revision 1.23 |
---|
199 | retrieving revision 1.25 |
---|
200 | diff -c -r1.23 -r1.25 |
---|
201 | *** c/src/lib/libbsp/shared/vmeUniverse/vmeUniverse.h 8 Jan 2003 00:12:22 -0000 1.23 |
---|
202 | --- c/src/lib/libbsp/shared/vmeUniverse/vmeUniverse.h 6 Mar 2003 21:00:13 -0000 1.25 |
---|
203 | *************** |
---|
204 | *** 1,4 **** |
---|
205 | ! /* $Id: vmeUniverse.h,v 1.23 2003/01/08 00:12:22 till Exp $ */ |
---|
206 | #ifndef VME_UNIVERSE_UTIL_H |
---|
207 | #define VME_UNIVERSE_UTIL_H |
---|
208 | |
---|
209 | --- 1,4 ---- |
---|
210 | ! /* $Id: vmeUniverse.h,v 1.25 2003/03/06 21:00:13 till Exp $ */ |
---|
211 | #ifndef VME_UNIVERSE_UTIL_H |
---|
212 | #define VME_UNIVERSE_UTIL_H |
---|
213 | |
---|
214 | *************** |
---|
215 | *** 39,52 **** |
---|
216 | |
---|
217 | /* NOTE: DMA packet descriptors MUST be 32 byte aligned */ |
---|
218 | typedef struct VmeUniverseDMAPacketRec_ { |
---|
219 | ! LERegister dctl __attribute__((aligned(32))); |
---|
220 | ! LERegister dtbc; |
---|
221 | ! LERegister dla; |
---|
222 | ! LERegister dummy1; |
---|
223 | ! LERegister dva; |
---|
224 | ! LERegister dummy2; |
---|
225 | ! LERegister dccp; |
---|
226 | ! LERegister dummy3; |
---|
227 | } VmeUniverseDMAPacketRec, *VmeUniverseDMAPacket; |
---|
228 | |
---|
229 | /* PCI CSR register */ |
---|
230 | --- 39,52 ---- |
---|
231 | |
---|
232 | /* NOTE: DMA packet descriptors MUST be 32 byte aligned */ |
---|
233 | typedef struct VmeUniverseDMAPacketRec_ { |
---|
234 | ! LERegister dctl __attribute__((aligned(32))); |
---|
235 | ! LERegister dtbc __attribute__((packed)); |
---|
236 | ! LERegister dla __attribute__((packed)); |
---|
237 | ! LERegister dummy1 __attribute__((packed)); |
---|
238 | ! LERegister dva __attribute__((packed)); |
---|
239 | ! LERegister dummy2 __attribute__((packed)); |
---|
240 | ! LERegister dcpp __attribute__((packed)); |
---|
241 | ! LERegister dummy3 __attribute__((packed)); |
---|
242 | } VmeUniverseDMAPacketRec, *VmeUniverseDMAPacket; |
---|
243 | |
---|
244 | /* PCI CSR register */ |
---|
245 | *************** |
---|
246 | *** 149,156 **** |
---|
247 | */ |
---|
248 | #define UNIV_REGOFF_DCPP 0x218 |
---|
249 | /* these bits are only used in linked lists */ |
---|
250 | ! # define UNIV_DCCP_IMG_NULL (1<<0) /* last packet in list */ |
---|
251 | ! # define UNIV_DCCP_IMG_PROCESSED (1<<1) /* packet processed */ |
---|
252 | |
---|
253 | /* DMA Xfer General Control/Status register */ |
---|
254 | #define UNIV_REGOFF_DGCS 0x220 |
---|
255 | --- 149,156 ---- |
---|
256 | */ |
---|
257 | #define UNIV_REGOFF_DCPP 0x218 |
---|
258 | /* these bits are only used in linked lists */ |
---|
259 | ! # define UNIV_DCPP_IMG_NULL (1<<0) /* last packet in list */ |
---|
260 | ! # define UNIV_DCPP_IMG_PROCESSED (1<<1) /* packet processed */ |
---|
261 | |
---|
262 | /* DMA Xfer General Control/Status register */ |
---|
263 | #define UNIV_REGOFF_DGCS 0x220 |
---|