diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-03-29 19:58:22 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-03-29 19:58:22 -0500 |
commit | 79072f38909e3d9883317238887460c39ddcc4cb (patch) | |
tree | 28369f5a844535ff836565eefd62695b0e890fa3 /drivers/char/rio/rioinit.c | |
parent | 200d5a7684cc49ef4be40e832daf3f217e70dfbb (diff) | |
parent | 55d8ca4f8094246da6e71889a4e04bfafaa78b10 (diff) |
Merge branch 'upstream'
Diffstat (limited to 'drivers/char/rio/rioinit.c')
-rw-r--r-- | drivers/char/rio/rioinit.c | 199 |
1 files changed, 80 insertions, 119 deletions
diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c index 0d44ef464e6b..24d2992154cc 100644 --- a/drivers/char/rio/rioinit.c +++ b/drivers/char/rio/rioinit.c | |||
@@ -51,15 +51,12 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; | |||
51 | 51 | ||
52 | 52 | ||
53 | #include "linux_compat.h" | 53 | #include "linux_compat.h" |
54 | #include "typdef.h" | ||
55 | #include "pkt.h" | 54 | #include "pkt.h" |
56 | #include "daemon.h" | 55 | #include "daemon.h" |
57 | #include "rio.h" | 56 | #include "rio.h" |
58 | #include "riospace.h" | 57 | #include "riospace.h" |
59 | #include "top.h" | ||
60 | #include "cmdpkt.h" | 58 | #include "cmdpkt.h" |
61 | #include "map.h" | 59 | #include "map.h" |
62 | #include "riotypes.h" | ||
63 | #include "rup.h" | 60 | #include "rup.h" |
64 | #include "port.h" | 61 | #include "port.h" |
65 | #include "riodrvr.h" | 62 | #include "riodrvr.h" |
@@ -72,22 +69,17 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; | |||
72 | #include "unixrup.h" | 69 | #include "unixrup.h" |
73 | #include "board.h" | 70 | #include "board.h" |
74 | #include "host.h" | 71 | #include "host.h" |
75 | #include "error.h" | ||
76 | #include "phb.h" | 72 | #include "phb.h" |
77 | #include "link.h" | 73 | #include "link.h" |
78 | #include "cmdblk.h" | 74 | #include "cmdblk.h" |
79 | #include "route.h" | 75 | #include "route.h" |
80 | #include "control.h" | ||
81 | #include "cirrus.h" | 76 | #include "cirrus.h" |
82 | #include "rioioctl.h" | 77 | #include "rioioctl.h" |
83 | #include "rio_linux.h" | 78 | #include "rio_linux.h" |
84 | 79 | ||
85 | #undef bcopy | ||
86 | #define bcopy rio_pcicopy | ||
87 | |||
88 | int RIOPCIinit(struct rio_info *p, int Mode); | 80 | int RIOPCIinit(struct rio_info *p, int Mode); |
89 | 81 | ||
90 | static int RIOScrub(int, BYTE *, int); | 82 | static int RIOScrub(int, u8 *, int); |
91 | 83 | ||
92 | 84 | ||
93 | /** | 85 | /** |
@@ -99,12 +91,8 @@ static int RIOScrub(int, BYTE *, int); | |||
99 | ** bits < 0 indicates 8 bit operation requested, | 91 | ** bits < 0 indicates 8 bit operation requested, |
100 | ** bits > 0 indicates 16 bit operation. | 92 | ** bits > 0 indicates 16 bit operation. |
101 | */ | 93 | */ |
102 | int | 94 | |
103 | RIOAssignAT(p, Base, virtAddr, mode) | 95 | int RIOAssignAT(struct rio_info *p, int Base, caddr_t virtAddr, int mode) |
104 | struct rio_info * p; | ||
105 | int Base; | ||
106 | caddr_t virtAddr; | ||
107 | int mode; | ||
108 | { | 96 | { |
109 | int bits; | 97 | int bits; |
110 | struct DpRam *cardp = (struct DpRam *)virtAddr; | 98 | struct DpRam *cardp = (struct DpRam *)virtAddr; |
@@ -124,29 +112,25 @@ int mode; | |||
124 | /* | 112 | /* |
125 | ** Revision 01 AT host cards don't support WORD operations, | 113 | ** Revision 01 AT host cards don't support WORD operations, |
126 | */ | 114 | */ |
127 | if ( RBYTE(cardp->DpRevision) == 01 ) | 115 | if (readb(&cardp->DpRevision) == 01) |
128 | bits = BYTE_OPERATION; | 116 | bits = BYTE_OPERATION; |
129 | 117 | ||
130 | p->RIOHosts[p->RIONumHosts].Type = RIO_AT; | 118 | p->RIOHosts[p->RIONumHosts].Type = RIO_AT; |
131 | p->RIOHosts[p->RIONumHosts].Copy = bcopy; | 119 | p->RIOHosts[p->RIONumHosts].Copy = rio_copy_to_card; |
132 | /* set this later */ | 120 | /* set this later */ |
133 | p->RIOHosts[p->RIONumHosts].Slot = -1; | 121 | p->RIOHosts[p->RIONumHosts].Slot = -1; |
134 | p->RIOHosts[p->RIONumHosts].Mode = SLOW_LINKS | SLOW_AT_BUS | bits; | 122 | p->RIOHosts[p->RIONumHosts].Mode = SLOW_LINKS | SLOW_AT_BUS | bits; |
135 | WBYTE(p->RIOHosts[p->RIONumHosts].Control, | 123 | writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE , |
136 | BOOT_FROM_RAM | EXTERNAL_BUS_OFF | | 124 | &p->RIOHosts[p->RIONumHosts].Control); |
137 | p->RIOHosts[p->RIONumHosts].Mode | | 125 | writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); |
138 | INTERRUPT_DISABLE ); | 126 | writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE, |
139 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff); | 127 | &p->RIOHosts[p->RIONumHosts].Control); |
140 | WBYTE(p->RIOHosts[p->RIONumHosts].Control, | 128 | writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); |
141 | BOOT_FROM_RAM | EXTERNAL_BUS_OFF | | ||
142 | p->RIOHosts[p->RIONumHosts].Mode | | ||
143 | INTERRUPT_DISABLE ); | ||
144 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff); | ||
145 | p->RIOHosts[p->RIONumHosts].UniqueNum = | 129 | p->RIOHosts[p->RIONumHosts].UniqueNum = |
146 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)| | 130 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)| |
147 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)| | 131 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)| |
148 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)| | 132 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)| |
149 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24); | 133 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24); |
150 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Uniquenum 0x%x\n",p->RIOHosts[p->RIONumHosts].UniqueNum); | 134 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Uniquenum 0x%x\n",p->RIOHosts[p->RIONumHosts].UniqueNum); |
151 | 135 | ||
152 | p->RIONumHosts++; | 136 | p->RIONumHosts++; |
@@ -154,7 +138,7 @@ int mode; | |||
154 | return(1); | 138 | return(1); |
155 | } | 139 | } |
156 | 140 | ||
157 | static uchar val[] = { | 141 | static u8 val[] = { |
158 | #ifdef VERY_LONG_TEST | 142 | #ifdef VERY_LONG_TEST |
159 | 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, | 143 | 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, |
160 | 0xa5, 0xff, 0x5a, 0x00, 0xff, 0xc9, 0x36, | 144 | 0xa5, 0xff, 0x5a, 0x00, 0xff, 0xc9, 0x36, |
@@ -167,12 +151,7 @@ static uchar val[] = { | |||
167 | ** RAM test a board. | 151 | ** RAM test a board. |
168 | ** Nothing too complicated, just enough to check it out. | 152 | ** Nothing too complicated, just enough to check it out. |
169 | */ | 153 | */ |
170 | int | 154 | int RIOBoardTest(unsigned long paddr, caddr_t caddr, unsigned char type, int slot) |
171 | RIOBoardTest(paddr, caddr, type, slot) | ||
172 | paddr_t paddr; | ||
173 | caddr_t caddr; | ||
174 | uchar type; | ||
175 | int slot; | ||
176 | { | 155 | { |
177 | struct DpRam *DpRam = (struct DpRam *)caddr; | 156 | struct DpRam *DpRam = (struct DpRam *)caddr; |
178 | char *ram[4]; | 157 | char *ram[4]; |
@@ -180,8 +159,8 @@ int slot; | |||
180 | int op, bank; | 159 | int op, bank; |
181 | int nbanks; | 160 | int nbanks; |
182 | 161 | ||
183 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=0x%x, slot=%d\n", | 162 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=%p, slot=%d\n", |
184 | type,(int)DpRam, slot); | 163 | type, DpRam, slot); |
185 | 164 | ||
186 | RIOHostReset(type, DpRam, slot); | 165 | RIOHostReset(type, DpRam, slot); |
187 | 166 | ||
@@ -209,12 +188,11 @@ int slot; | |||
209 | 188 | ||
210 | 189 | ||
211 | if (nbanks == 3) { | 190 | if (nbanks == 3) { |
212 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", | 191 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: %p(0x%x), %p(0x%x), %p(0x%x)\n", |
213 | (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2]); | 192 | ram[0], size[0], ram[1], size[1], ram[2], size[2]); |
214 | } else { | 193 | } else { |
215 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", | 194 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: %p(0x%x), %p(0x%x), %p(0x%x), %p(0x%x)\n", |
216 | (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2], (int)ram[3], | 195 | ram[0], size[0], ram[1], size[1], ram[2], size[2], ram[3], size[3]); |
217 | size[3]); | ||
218 | } | 196 | } |
219 | 197 | ||
220 | /* | 198 | /* |
@@ -224,7 +202,7 @@ int slot; | |||
224 | */ | 202 | */ |
225 | for (op=0; op<TEST_END; op++) { | 203 | for (op=0; op<TEST_END; op++) { |
226 | for (bank=0; bank<nbanks; bank++) { | 204 | for (bank=0; bank<nbanks; bank++) { |
227 | if (RIOScrub(op, (BYTE *)ram[bank], size[bank]) == RIO_FAIL) { | 205 | if (RIOScrub(op, (u8 *)ram[bank], size[bank]) == RIO_FAIL) { |
228 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: RIOScrub band %d, op %d failed\n", | 206 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: RIOScrub band %d, op %d failed\n", |
229 | bank, op); | 207 | bank, op); |
230 | return RIO_FAIL; | 208 | return RIO_FAIL; |
@@ -233,7 +211,7 @@ int slot; | |||
233 | } | 211 | } |
234 | 212 | ||
235 | rio_dprintk (RIO_DEBUG_INIT, "Test completed\n"); | 213 | rio_dprintk (RIO_DEBUG_INIT, "Test completed\n"); |
236 | return RIO_SUCCESS; | 214 | return 0; |
237 | } | 215 | } |
238 | 216 | ||
239 | 217 | ||
@@ -248,13 +226,10 @@ int slot; | |||
248 | ** Call with op not zero, and the RAM will be read and compated with val[op-1] | 226 | ** Call with op not zero, and the RAM will be read and compated with val[op-1] |
249 | ** to check that the data from the previous phase was retained. | 227 | ** to check that the data from the previous phase was retained. |
250 | */ | 228 | */ |
251 | static int | 229 | |
252 | RIOScrub(op, ram, size) | 230 | static int RIOScrub(int op, u8 *ram, int size) |
253 | int op; | ||
254 | BYTE * ram; | ||
255 | int size; | ||
256 | { | 231 | { |
257 | int off; | 232 | int off; |
258 | unsigned char oldbyte; | 233 | unsigned char oldbyte; |
259 | unsigned char newbyte; | 234 | unsigned char newbyte; |
260 | unsigned char invbyte; | 235 | unsigned char invbyte; |
@@ -279,15 +254,15 @@ int size; | |||
279 | */ | 254 | */ |
280 | if (op) { | 255 | if (op) { |
281 | for (off=0; off<size; off++) { | 256 | for (off=0; off<size; off++) { |
282 | if (RBYTE(ram[off]) != oldbyte) { | 257 | if (readb(ram + off) != oldbyte) { |
283 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 1: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, RBYTE(ram[off])); | 258 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 1: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, readb(ram + off)); |
284 | return RIO_FAIL; | 259 | return RIO_FAIL; |
285 | } | 260 | } |
286 | } | 261 | } |
287 | for (off=0; off<size; off+=2) { | 262 | for (off=0; off<size; off+=2) { |
288 | if (*(ushort *)&ram[off] != oldword) { | 263 | if (readw(ram + off) != oldword) { |
289 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: WORD at offset 0x%x should have been=%x, was=%x\n",off,oldword,*(ushort *)&ram[off]); | 264 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: WORD at offset 0x%x should have been=%x, was=%x\n",off,oldword, readw(ram + off)); |
290 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); | 265 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram+off+1)); |
291 | return RIO_FAIL; | 266 | return RIO_FAIL; |
292 | } | 267 | } |
293 | } | 268 | } |
@@ -301,13 +276,13 @@ int size; | |||
301 | ** the BYTE read/write test. | 276 | ** the BYTE read/write test. |
302 | */ | 277 | */ |
303 | for (off=0; off<size; off++) { | 278 | for (off=0; off<size; off++) { |
304 | if (op && (RBYTE(ram[off]) != oldbyte)) { | 279 | if (op && (readb(ram + off) != oldbyte)) { |
305 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, RBYTE(ram[off])); | 280 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, readb(ram + off)); |
306 | return RIO_FAIL; | 281 | return RIO_FAIL; |
307 | } | 282 | } |
308 | WBYTE(ram[off],invbyte); | 283 | writeb(invbyte, ram + off); |
309 | if (RBYTE(ram[off]) != invbyte) { | 284 | if (readb(ram + off) != invbyte) { |
310 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Inv Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, invbyte, RBYTE(ram[off])); | 285 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Inv Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, invbyte, readb(ram + off)); |
311 | return RIO_FAIL; | 286 | return RIO_FAIL; |
312 | } | 287 | } |
313 | } | 288 | } |
@@ -320,16 +295,16 @@ int size; | |||
320 | ** This is the WORD operation test. | 295 | ** This is the WORD operation test. |
321 | */ | 296 | */ |
322 | for (off=0; off<size; off+=2) { | 297 | for (off=0; off<size; off+=2) { |
323 | if (*(ushort *)&ram[off] != invword) { | 298 | if (readw(ram + off) != invword) { |
324 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: WORD at offset 0x%x should have been=%x, was=%x\n", off, invword, *(ushort *)&ram[off]); | 299 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: WORD at offset 0x%x should have been=%x, was=%x\n", off, invword, readw(ram + off)); |
325 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); | 300 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram+off+1)); |
326 | return RIO_FAIL; | 301 | return RIO_FAIL; |
327 | } | 302 | } |
328 | 303 | ||
329 | *(ushort *)&ram[off] = newword; | 304 | writew(newword, ram + off); |
330 | if ( *(ushort *)&ram[off] != newword ) { | 305 | if ( readw(ram + off) != newword ) { |
331 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, *(ushort *)&ram[off]); | 306 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, readw(ram + off)); |
332 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); | 307 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram + off + 1)); |
333 | return RIO_FAIL; | 308 | return RIO_FAIL; |
334 | } | 309 | } |
335 | } | 310 | } |
@@ -340,16 +315,16 @@ int size; | |||
340 | ** required test data. | 315 | ** required test data. |
341 | */ | 316 | */ |
342 | for (off=0; off<size; off++) { | 317 | for (off=0; off<size; off++) { |
343 | if (RBYTE(ram[off]) != newbyte) { | 318 | if (readb(ram + off) != newbyte) { |
344 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Byte Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, RBYTE(ram[off])); | 319 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Byte Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, readb(ram + off)); |
345 | return RIO_FAIL; | 320 | return RIO_FAIL; |
346 | } | 321 | } |
347 | } | 322 | } |
348 | 323 | ||
349 | for (off=0; off<size; off+=2) { | 324 | for (off=0; off<size; off+=2) { |
350 | if ( *(ushort *)&ram[off] != newword ) { | 325 | if (readw(ram + off) != newword ) { |
351 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, *(ushort *)&ram[off]); | 326 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, readw(ram + off)); |
352 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); | 327 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram + off + 1)); |
353 | return RIO_FAIL; | 328 | return RIO_FAIL; |
354 | } | 329 | } |
355 | } | 330 | } |
@@ -360,41 +335,37 @@ int size; | |||
360 | swapword = invbyte | (newbyte << 8); | 335 | swapword = invbyte | (newbyte << 8); |
361 | 336 | ||
362 | for (off=0; off<size; off+=2) { | 337 | for (off=0; off<size; off+=2) { |
363 | WBYTE(ram[off],invbyte); | 338 | writeb(invbyte, &ram[off]); |
364 | WBYTE(ram[off+1],newbyte); | 339 | writeb(newbyte, &ram[off+1]); |
365 | } | 340 | } |
366 | 341 | ||
367 | for ( off=0; off<size; off+=2 ) { | 342 | for ( off=0; off<size; off+=2 ) { |
368 | if (*(ushort *)&ram[off] != swapword) { | 343 | if (readw(ram + off) != swapword) { |
369 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, swapword, *((ushort *)&ram[off])); | 344 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, swapword, readw(ram + off)); |
370 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); | 345 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram + off + 1)); |
371 | return RIO_FAIL; | 346 | return RIO_FAIL; |
372 | } | 347 | } |
373 | *((ushort *)&ram[off]) = ~swapword; | 348 | writew(~swapword, ram + off); |
374 | } | 349 | } |
375 | 350 | ||
376 | for (off=0; off<size; off+=2) { | 351 | for (off=0; off<size; off+=2) { |
377 | if (RBYTE(ram[off]) != newbyte) { | 352 | if (readb(ram + off) != newbyte) { |
378 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, RBYTE(ram[off])); | 353 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, readb(ram + off)); |
379 | return RIO_FAIL; | 354 | return RIO_FAIL; |
380 | } | 355 | } |
381 | if (RBYTE(ram[off+1]) != invbyte) { | 356 | if (readb(ram + off + 1) != invbyte) { |
382 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off+1, invbyte, RBYTE(ram[off+1])); | 357 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off+1, invbyte, readb(ram + off + 1)); |
383 | return RIO_FAIL; | 358 | return RIO_FAIL; |
384 | } | 359 | } |
385 | *((ushort *)&ram[off]) = newword; | 360 | writew(newword, ram + off); |
386 | } | 361 | } |
387 | return RIO_SUCCESS; | 362 | return 0; |
388 | } | 363 | } |
389 | 364 | ||
390 | 365 | ||
391 | int | 366 | int RIODefaultName(struct rio_info *p, struct Host *HostP, unsigned int UnitId) |
392 | RIODefaultName(p, HostP, UnitId) | ||
393 | struct rio_info * p; | ||
394 | struct Host * HostP; | ||
395 | uint UnitId; | ||
396 | { | 367 | { |
397 | bcopy("UNKNOWN RTA X-XX",HostP->Mapping[UnitId].Name,17); | 368 | memcpy(HostP->Mapping[UnitId].Name, "UNKNOWN RTA X-XX", 17); |
398 | HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts); | 369 | HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts); |
399 | if ((UnitId+1) > 9) { | 370 | if ((UnitId+1) > 9) { |
400 | HostP->Mapping[UnitId].Name[14]='0'+((UnitId+1)/10); | 371 | HostP->Mapping[UnitId].Name[14]='0'+((UnitId+1)/10); |
@@ -412,8 +383,7 @@ uint UnitId; | |||
412 | 383 | ||
413 | static struct rioVersion stVersion; | 384 | static struct rioVersion stVersion; |
414 | 385 | ||
415 | struct rioVersion * | 386 | struct rioVersion *RIOVersid(void) |
416 | RIOVersid(void) | ||
417 | { | 387 | { |
418 | strlcpy(stVersion.version, "RIO driver for linux V1.0", | 388 | strlcpy(stVersion.version, "RIO driver for linux V1.0", |
419 | sizeof(stVersion.version)); | 389 | sizeof(stVersion.version)); |
@@ -423,40 +393,31 @@ RIOVersid(void) | |||
423 | return &stVersion; | 393 | return &stVersion; |
424 | } | 394 | } |
425 | 395 | ||
426 | void | 396 | void RIOHostReset(unsigned int Type, struct DpRam *DpRamP, unsigned int Slot) |
427 | RIOHostReset(Type, DpRamP, Slot) | ||
428 | uint Type; | ||
429 | volatile struct DpRam *DpRamP; | ||
430 | uint Slot; | ||
431 | { | 397 | { |
432 | /* | 398 | /* |
433 | ** Reset the Tpu | 399 | ** Reset the Tpu |
434 | */ | 400 | */ |
435 | rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: type 0x%x", Type); | 401 | rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: type 0x%x", Type); |
436 | switch ( Type ) { | 402 | switch ( Type ) { |
437 | case RIO_AT: | 403 | case RIO_AT: |
438 | rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n"); | 404 | rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n"); |
439 | WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF | | 405 | writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | BYTE_OPERATION | |
440 | INTERRUPT_DISABLE | BYTE_OPERATION | | 406 | SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl); |
441 | SLOW_LINKS | SLOW_AT_BUS); | 407 | writeb(0xFF, &DpRamP->DpResetTpu); |
442 | WBYTE(DpRamP->DpResetTpu, 0xFF); | 408 | udelay(3); |
443 | udelay(3); | ||
444 | |||
445 | rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n"); | 409 | rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n"); |
446 | WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF | | 410 | writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | |
447 | INTERRUPT_DISABLE | BYTE_OPERATION | | 411 | BYTE_OPERATION | SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl); |
448 | SLOW_LINKS | SLOW_AT_BUS); | 412 | writeb(0xFF, &DpRamP->DpResetTpu); |
449 | WBYTE(DpRamP->DpResetTpu, 0xFF); | 413 | udelay(3); |
450 | udelay(3); | 414 | break; |
451 | break; | ||
452 | case RIO_PCI: | 415 | case RIO_PCI: |
453 | rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n"); | 416 | rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n"); |
454 | DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM; | 417 | writeb(RIO_PCI_BOOT_FROM_RAM, &DpRamP->DpControl); |
455 | DpRamP->DpResetInt = 0xFF; | 418 | writeb(0xFF, &DpRamP->DpResetInt); |
456 | DpRamP->DpResetTpu = 0xFF; | 419 | writeb(0xFF, &DpRamP->DpResetTpu); |
457 | udelay(100); | 420 | udelay(100); |
458 | /* for (i=0; i<6000; i++); */ | ||
459 | /* suspend( 3 ); */ | ||
460 | break; | 421 | break; |
461 | default: | 422 | default: |
462 | rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n"); | 423 | rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n"); |