diff options
-rw-r--r-- | drivers/char/rio/rioinit.c | 1152 |
1 files changed, 0 insertions, 1152 deletions
diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c index 898a126ae3e6..0d44ef464e6b 100644 --- a/drivers/char/rio/rioinit.c +++ b/drivers/char/rio/rioinit.c | |||
@@ -87,222 +87,8 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; | |||
87 | 87 | ||
88 | int RIOPCIinit(struct rio_info *p, int Mode); | 88 | int RIOPCIinit(struct rio_info *p, int Mode); |
89 | 89 | ||
90 | #if 0 | ||
91 | static void RIOAllocateInterrupts(struct rio_info *); | ||
92 | static int RIOReport(struct rio_info *); | ||
93 | static void RIOStopInterrupts(struct rio_info *, int, int); | ||
94 | #endif | ||
95 | |||
96 | static int RIOScrub(int, BYTE *, int); | 90 | static int RIOScrub(int, BYTE *, int); |
97 | 91 | ||
98 | #if 0 | ||
99 | extern int rio_intr(); | ||
100 | |||
101 | /* | ||
102 | ** Init time code. | ||
103 | */ | ||
104 | void | ||
105 | rioinit( p, info ) | ||
106 | struct rio_info * p; | ||
107 | struct RioHostInfo * info; | ||
108 | { | ||
109 | /* | ||
110 | ** Multi-Host card support - taking the easy way out - sorry ! | ||
111 | ** We allocate and set up the Host and Port structs when the | ||
112 | ** driver is called to 'install' the first host. | ||
113 | ** We check for this first 'call' by testing the RIOPortp pointer. | ||
114 | */ | ||
115 | if ( !p->RIOPortp ) | ||
116 | { | ||
117 | rio_dprintk (RIO_DEBUG_INIT, "Allocating and setting up driver data structures\n"); | ||
118 | |||
119 | RIOAllocDataStructs(p); /* allocate host/port structs */ | ||
120 | RIOSetupDataStructs(p); /* setup topology structs */ | ||
121 | } | ||
122 | |||
123 | RIOInitHosts( p, info ); /* hunt down the hardware */ | ||
124 | |||
125 | RIOAllocateInterrupts(p); /* allocate interrupts */ | ||
126 | RIOReport(p); /* show what we found */ | ||
127 | } | ||
128 | |||
129 | /* | ||
130 | ** Initialise the Cards | ||
131 | */ | ||
132 | void | ||
133 | RIOInitHosts(p, info) | ||
134 | struct rio_info * p; | ||
135 | struct RioHostInfo * info; | ||
136 | { | ||
137 | /* | ||
138 | ** 15.10.1998 ARG - ESIL 0762 part fix | ||
139 | ** If there is no ISA card definition - we always look for PCI cards. | ||
140 | ** As we currently only support one host card this lets an ISA card | ||
141 | ** definition take precedence over PLUG and PLAY. | ||
142 | ** No ISA card - we are PLUG and PLAY with PCI. | ||
143 | */ | ||
144 | |||
145 | /* | ||
146 | ** Note - for PCI both these will be zero, that's okay because | ||
147 | ** RIOPCIInit() fills them in if a card is found. | ||
148 | */ | ||
149 | p->RIOHosts[p->RIONumHosts].Ivec = info->vector; | ||
150 | p->RIOHosts[p->RIONumHosts].PaddrP = info->location; | ||
151 | |||
152 | /* | ||
153 | ** Check that we are able to accommodate another host | ||
154 | */ | ||
155 | if ( p->RIONumHosts >= RIO_HOSTS ) | ||
156 | { | ||
157 | p->RIOFailed++; | ||
158 | return; | ||
159 | } | ||
160 | |||
161 | if ( info->bus & ISA_BUS ) | ||
162 | { | ||
163 | rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (ISA)\n", p->RIONumHosts); | ||
164 | RIOISAinit(p, p->mode); | ||
165 | } | ||
166 | else | ||
167 | { | ||
168 | rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (PCI)\n", p->RIONumHosts); | ||
169 | RIOPCIinit(p, RIO_PCI_DEFAULT_MODE); | ||
170 | } | ||
171 | |||
172 | rio_dprintk (RIO_DEBUG_INIT, "Total hosts initialised so far : %d\n", p->RIONumHosts); | ||
173 | |||
174 | |||
175 | #ifdef FUTURE_RELEASE | ||
176 | if (p->bus & EISA_BUS) | ||
177 | /* EISA card */ | ||
178 | RIOEISAinit(p, RIO_EISA_DEFAULT_MODE); | ||
179 | |||
180 | if (p->bus & MCA_BUS) | ||
181 | /* MCA card */ | ||
182 | RIOMCAinit(p, RIO_MCA_DEFAULT_MODE); | ||
183 | #endif | ||
184 | } | ||
185 | |||
186 | /* | ||
187 | ** go through memory for an AT host that we pass in the device info | ||
188 | ** structure and initialise | ||
189 | */ | ||
190 | void | ||
191 | RIOISAinit(p, mode) | ||
192 | struct rio_info * p; | ||
193 | int mode; | ||
194 | { | ||
195 | |||
196 | /* XXX Need to implement this. */ | ||
197 | #if 0 | ||
198 | p->intr_tid = iointset(p->RIOHosts[p->RIONumHosts].Ivec, | ||
199 | (int (*)())rio_intr, (char*)p->RIONumHosts); | ||
200 | |||
201 | rio_dprintk (RIO_DEBUG_INIT, "Set interrupt handler, intr_tid = 0x%x\n", p->intr_tid ); | ||
202 | |||
203 | if (RIODoAT(p, p->RIOHosts[p->RIONumHosts].PaddrP, mode)) { | ||
204 | return; | ||
205 | } | ||
206 | else { | ||
207 | rio_dprintk (RIO_DEBUG_INIT, "RIODoAT failed\n"); | ||
208 | p->RIOFailed++; | ||
209 | } | ||
210 | #endif | ||
211 | |||
212 | } | ||
213 | |||
214 | /* | ||
215 | ** RIODoAT : | ||
216 | ** | ||
217 | ** Map in a boards physical address, check that the board is there, | ||
218 | ** test the board and if everything is okay assign the board an entry | ||
219 | ** in the Rio Hosts structure. | ||
220 | */ | ||
221 | int | ||
222 | RIODoAT(p, Base, mode) | ||
223 | struct rio_info * p; | ||
224 | int Base; | ||
225 | int mode; | ||
226 | { | ||
227 | #define FOUND 1 | ||
228 | #define NOT_FOUND 0 | ||
229 | |||
230 | caddr_t cardAddr; | ||
231 | |||
232 | /* | ||
233 | ** Check to see if we actually have a board at this physical address. | ||
234 | */ | ||
235 | if ((cardAddr = RIOCheckForATCard(Base)) != 0) { | ||
236 | /* | ||
237 | ** Now test the board to see if it is working. | ||
238 | */ | ||
239 | if (RIOBoardTest(Base, cardAddr, RIO_AT, 0) == RIO_SUCCESS) { | ||
240 | /* | ||
241 | ** Fill out a slot in the Rio host structure. | ||
242 | */ | ||
243 | if (RIOAssignAT(p, Base, cardAddr, mode)) { | ||
244 | return(FOUND); | ||
245 | } | ||
246 | } | ||
247 | RIOMapout(Base, RIO_AT_MEM_SIZE, cardAddr); | ||
248 | } | ||
249 | return(NOT_FOUND); | ||
250 | } | ||
251 | |||
252 | caddr_t | ||
253 | RIOCheckForATCard(Base) | ||
254 | int Base; | ||
255 | { | ||
256 | int off; | ||
257 | struct DpRam *cardp; /* (Points at the host) */ | ||
258 | caddr_t virtAddr; | ||
259 | unsigned char RIOSigTab[24]; | ||
260 | /* | ||
261 | ** Table of values to search for as prom signature of a host card | ||
262 | */ | ||
263 | strcpy(RIOSigTab, "JBJGPGGHINSMJPJR"); | ||
264 | |||
265 | /* | ||
266 | ** Hey! Yes, You reading this code! Yo, grab a load a this: | ||
267 | ** | ||
268 | ** IF the card is using WORD MODE rather than BYTE MODE | ||
269 | ** then it will occupy 128K of PHYSICAL memory area. So, | ||
270 | ** you might think that the following Mapin is wrong. Well, | ||
271 | ** it isn't, because the SECOND 64K of occupied space is an | ||
272 | ** EXACT COPY of the FIRST 64K. (good?), so, we need only | ||
273 | ** map it in in one 64K block. | ||
274 | */ | ||
275 | if (RIOMapin(Base, RIO_AT_MEM_SIZE, &virtAddr) == -1) { | ||
276 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Couldn't map the board in!\n"); | ||
277 | return((caddr_t)0); | ||
278 | } | ||
279 | |||
280 | /* | ||
281 | ** virtAddr points to the DP ram of the system. | ||
282 | ** We now cast this to a pointer to a RIO Host, | ||
283 | ** and have a rummage about in the PROM. | ||
284 | */ | ||
285 | cardp = (struct DpRam *)virtAddr; | ||
286 | |||
287 | for (off=0; RIOSigTab[off]; off++) { | ||
288 | if ((RBYTE(cardp->DpSignature[off]) & 0xFF) != RIOSigTab[off]) { | ||
289 | /* | ||
290 | ** Signature mismatch - card not at this address | ||
291 | */ | ||
292 | RIOMapout(Base, RIO_AT_MEM_SIZE, virtAddr); | ||
293 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Couldn't match the signature 0x%x 0x%x!\n", | ||
294 | (int)cardp, off); | ||
295 | return((caddr_t)0); | ||
296 | } | ||
297 | } | ||
298 | |||
299 | /* | ||
300 | ** If we get here then we must have found a valid board so return | ||
301 | ** its virtual address. | ||
302 | */ | ||
303 | return(virtAddr); | ||
304 | } | ||
305 | #endif | ||
306 | 92 | ||
307 | /** | 93 | /** |
308 | ** RIOAssignAT : | 94 | ** RIOAssignAT : |
@@ -367,667 +153,6 @@ int mode; | |||
367 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Tests Passed at 0x%x\n", Base); | 153 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Tests Passed at 0x%x\n", Base); |
368 | return(1); | 154 | return(1); |
369 | } | 155 | } |
370 | #if 0 | ||
371 | #ifdef FUTURE_RELEASE | ||
372 | int RIOMCAinit(int Mode) | ||
373 | { | ||
374 | uchar SlotNumber; | ||
375 | caddr_t Caddr; | ||
376 | uint Paddr; | ||
377 | uint Ivec; | ||
378 | int Handle; | ||
379 | int ret = 0; | ||
380 | |||
381 | /* | ||
382 | ** Valid mode information for MCA cards | ||
383 | ** is only FAST LINKS | ||
384 | */ | ||
385 | Mode = (Mode & FAST_LINKS) ? McaTpFastLinks : McaTpSlowLinks; | ||
386 | rio_dprintk (RIO_DEBUG_INIT, "RIOMCAinit(%d)\n",Mode); | ||
387 | |||
388 | |||
389 | /* | ||
390 | ** Check out each of the slots | ||
391 | */ | ||
392 | for (SlotNumber = 0; SlotNumber < McaMaxSlots; SlotNumber++) { | ||
393 | /* | ||
394 | ** Enable the slot we want to talk to | ||
395 | */ | ||
396 | outb( McaSlotSelect, SlotNumber | McaSlotEnable ); | ||
397 | |||
398 | /* | ||
399 | ** Read the ID word from the slot | ||
400 | */ | ||
401 | if (((inb(McaIdHigh)<< 8)|inb(McaIdLow)) == McaRIOId) | ||
402 | { | ||
403 | rio_dprintk (RIO_DEBUG_INIT, "Potential MCA card in slot %d\n", SlotNumber); | ||
404 | |||
405 | /* | ||
406 | ** Card appears to be a RIO MCA card! | ||
407 | */ | ||
408 | RIOMachineType |= (1<<RIO_MCA); | ||
409 | |||
410 | /* | ||
411 | ** Just check we haven't found too many wonderful objects | ||
412 | */ | ||
413 | if ( RIONumHosts >= RIO_HOSTS ) | ||
414 | { | ||
415 | Rprintf(RIOMesgTooManyCards); | ||
416 | return(ret); | ||
417 | } | ||
418 | |||
419 | /* | ||
420 | ** McaIrqEnable contains the interrupt vector, and a card | ||
421 | ** enable bit. | ||
422 | */ | ||
423 | Ivec = inb(McaIrqEnable); | ||
424 | |||
425 | rio_dprintk (RIO_DEBUG_INIT, "Ivec is %x\n", Ivec); | ||
426 | |||
427 | switch ( Ivec & McaIrqMask ) | ||
428 | { | ||
429 | case McaIrq9: | ||
430 | rio_dprintk (RIO_DEBUG_INIT, "IRQ9\n"); | ||
431 | break; | ||
432 | case McaIrq3: | ||
433 | rio_dprintk (RIO_DEBUG_INIT, "IRQ3\n"); | ||
434 | break; | ||
435 | case McaIrq4: | ||
436 | rio_dprintk (RIO_DEBUG_INIT, "IRQ4\n"); | ||
437 | break; | ||
438 | case McaIrq7: | ||
439 | rio_dprintk (RIO_DEBUG_INIT, "IRQ7\n"); | ||
440 | break; | ||
441 | case McaIrq10: | ||
442 | rio_dprintk (RIO_DEBUG_INIT, "IRQ10\n"); | ||
443 | break; | ||
444 | case McaIrq11: | ||
445 | rio_dprintk (RIO_DEBUG_INIT, "IRQ11\n"); | ||
446 | break; | ||
447 | case McaIrq12: | ||
448 | rio_dprintk (RIO_DEBUG_INIT, "IRQ12\n"); | ||
449 | break; | ||
450 | case McaIrq15: | ||
451 | rio_dprintk (RIO_DEBUG_INIT, "IRQ15\n"); | ||
452 | break; | ||
453 | } | ||
454 | |||
455 | /* | ||
456 | ** If the card enable bit isn't set, then set it! | ||
457 | */ | ||
458 | if ((Ivec & McaCardEnable) != McaCardEnable) { | ||
459 | rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable not set - setting!\n"); | ||
460 | outb(McaIrqEnable,Ivec|McaCardEnable); | ||
461 | } else | ||
462 | rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable already set\n"); | ||
463 | |||
464 | /* | ||
465 | ** Convert the IRQ enable mask into something useful | ||
466 | */ | ||
467 | Ivec = RIOMcaToIvec[Ivec & McaIrqMask]; | ||
468 | |||
469 | /* | ||
470 | ** Find the physical address | ||
471 | */ | ||
472 | rio_dprintk (RIO_DEBUG_INIT, "inb(McaMemory) is %x\n", inb(McaMemory)); | ||
473 | Paddr = McaAddress(inb(McaMemory)); | ||
474 | |||
475 | rio_dprintk (RIO_DEBUG_INIT, "MCA card has Ivec %d Addr %x\n", Ivec, Paddr); | ||
476 | |||
477 | if ( Paddr != 0 ) | ||
478 | { | ||
479 | |||
480 | /* | ||
481 | ** Tell the memory mapper that we want to talk to it | ||
482 | */ | ||
483 | Handle = RIOMapin( Paddr, RIO_MCA_MEM_SIZE, &Caddr ); | ||
484 | |||
485 | if ( Handle == -1 ) { | ||
486 | rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at %x\n", RIO_MCA_MEM_SIZE, Paddr; | ||
487 | continue; | ||
488 | } | ||
489 | |||
490 | rio_dprintk (RIO_DEBUG_INIT, "Board mapped to vaddr 0x%x\n", Caddr); | ||
491 | |||
492 | /* | ||
493 | ** And check that it is actually there! | ||
494 | */ | ||
495 | if ( RIOBoardTest( Paddr,Caddr,RIO_MCA,SlotNumber ) == RIO_SUCCESS ) | ||
496 | { | ||
497 | rio_dprintk (RIO_DEBUG_INIT, "Board has passed test\n"); | ||
498 | rio_dprintk (RIO_DEBUG_INIT, "Slot %d. Type %d. Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n", | ||
499 | SlotNumber, RIO_MCA, Paddr, Caddr, Mode); | ||
500 | |||
501 | /* | ||
502 | ** Board has passed its scrub test. Fill in all the | ||
503 | ** transient stuff. | ||
504 | */ | ||
505 | p->RIOHosts[RIONumHosts].Slot = SlotNumber; | ||
506 | p->RIOHosts[RIONumHosts].Ivec = Ivec; | ||
507 | p->RIOHosts[RIONumHosts].Type = RIO_MCA; | ||
508 | p->RIOHosts[RIONumHosts].Copy = bcopy; | ||
509 | p->RIOHosts[RIONumHosts].PaddrP = Paddr; | ||
510 | p->RIOHosts[RIONumHosts].Caddr = Caddr; | ||
511 | p->RIOHosts[RIONumHosts].CardP = (struct DpRam *)Caddr; | ||
512 | p->RIOHosts[RIONumHosts].Mode = Mode; | ||
513 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt , 0xff); | ||
514 | p->RIOHosts[RIONumHosts].UniqueNum = | ||
515 | ((RBYTE(p->RIOHosts[RIONumHosts].Unique[0])&0xFF)<<0)| | ||
516 | ((RBYTE(p->RIOHosts[RIONumHosts].Unique[1])&0xFF)<<8)| | ||
517 | ((RBYTE(p->RIOHosts[RIONumHosts].Unique[2])&0xFF)<<16)| | ||
518 | ((RBYTE(p->RIOHosts[RIONumHosts].Unique[3])&0xFF)<<24); | ||
519 | RIONumHosts++; | ||
520 | ret++; | ||
521 | } | ||
522 | else | ||
523 | { | ||
524 | /* | ||
525 | ** It failed the test, so ignore it. | ||
526 | */ | ||
527 | rio_dprintk (RIO_DEBUG_INIT, "TEST FAILED\n"); | ||
528 | RIOMapout(Paddr, RIO_MCA_MEM_SIZE, Caddr ); | ||
529 | } | ||
530 | } | ||
531 | else | ||
532 | { | ||
533 | rio_dprintk (RIO_DEBUG_INIT, "Slot %d - Paddr zero!\n", SlotNumber); | ||
534 | } | ||
535 | } | ||
536 | else | ||
537 | { | ||
538 | rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber); | ||
539 | } | ||
540 | } | ||
541 | /* | ||
542 | ** Now we have checked all the slots, turn off the MCA slot selector | ||
543 | */ | ||
544 | outb(McaSlotSelect,0); | ||
545 | rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber); | ||
546 | return ret; | ||
547 | } | ||
548 | |||
549 | int RIOEISAinit( int Mode ) | ||
550 | { | ||
551 | static int EISADone = 0; | ||
552 | uint Paddr; | ||
553 | int PollIntMixMsgDone = 0; | ||
554 | caddr_t Caddr; | ||
555 | ushort Ident; | ||
556 | uchar EisaSlot; | ||
557 | uchar Ivec; | ||
558 | int ret = 0; | ||
559 | |||
560 | /* | ||
561 | ** The only valid mode information for EISA hosts is fast or slow | ||
562 | ** links. | ||
563 | */ | ||
564 | Mode = (Mode & FAST_LINKS) ? EISA_TP_FAST_LINKS : EISA_TP_SLOW_LINKS; | ||
565 | |||
566 | if ( EISADone ) | ||
567 | { | ||
568 | rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit() - already done, return.\n"); | ||
569 | return(0); | ||
570 | } | ||
571 | |||
572 | EISADone++; | ||
573 | |||
574 | rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit()\n"); | ||
575 | |||
576 | |||
577 | /* | ||
578 | ** First check all cards to see if ANY are set for polled mode operation. | ||
579 | ** If so, set ALL to polled. | ||
580 | */ | ||
581 | |||
582 | for ( EisaSlot=1; EisaSlot<=RIO_MAX_EISA_SLOTS; EisaSlot++ ) | ||
583 | { | ||
584 | Ident = (INBZ(EisaSlot,EISA_PRODUCT_IDENT_HI)<<8) | | ||
585 | INBZ(EisaSlot,EISA_PRODUCT_IDENT_LO); | ||
586 | |||
587 | if ( Ident == RIO_EISA_IDENT ) | ||
588 | { | ||
589 | rio_dprintk (RIO_DEBUG_INIT, "Found Specialix product\n"); | ||
590 | |||
591 | if ( INBZ(EisaSlot,EISA_PRODUCT_NUMBER) != RIO_EISA_PRODUCT_CODE ) | ||
592 | { | ||
593 | rio_dprintk (RIO_DEBUG_INIT, "Not Specialix RIO - Product number %x\n", | ||
594 | INBZ(EisaSlot, EISA_PRODUCT_NUMBER)); | ||
595 | continue; /* next slot */ | ||
596 | } | ||
597 | /* | ||
598 | ** Its a Specialix RIO! | ||
599 | */ | ||
600 | rio_dprintk (RIO_DEBUG_INIT, "RIO Revision %d\n", | ||
601 | INBZ(EisaSlot, EISA_REVISION_NUMBER)); | ||
602 | |||
603 | RIOMachineType |= (1<<RIO_EISA); | ||
604 | |||
605 | /* | ||
606 | ** Just check we haven't found too many wonderful objects | ||
607 | */ | ||
608 | if ( RIONumHosts >= RIO_HOSTS ) | ||
609 | { | ||
610 | Rprintf(RIOMesgTooManyCards); | ||
611 | return 0; | ||
612 | } | ||
613 | |||
614 | /* | ||
615 | ** Ensure that the enable bit is set! | ||
616 | */ | ||
617 | OUTBZ( EisaSlot, EISA_ENABLE, RIO_EISA_ENABLE_BIT ); | ||
618 | |||
619 | /* | ||
620 | ** EISA_INTERRUPT_VEC contains the interrupt vector. | ||
621 | */ | ||
622 | Ivec = INBZ(EisaSlot,EISA_INTERRUPT_VEC); | ||
623 | |||
624 | #ifdef RIODEBUG | ||
625 | switch ( Ivec & EISA_INTERRUPT_MASK ) | ||
626 | { | ||
627 | case EISA_IRQ_3: | ||
628 | rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 3\n"); | ||
629 | break; | ||
630 | case EISA_IRQ_4: | ||
631 | rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 4\n"); | ||
632 | break; | ||
633 | case EISA_IRQ_5: | ||
634 | rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 5\n"); | ||
635 | break; | ||
636 | case EISA_IRQ_6: | ||
637 | rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 6\n"); | ||
638 | break; | ||
639 | case EISA_IRQ_7: | ||
640 | rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 7\n"); | ||
641 | break; | ||
642 | case EISA_IRQ_9: | ||
643 | rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 9\n"); | ||
644 | break; | ||
645 | case EISA_IRQ_10: | ||
646 | rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 10\n"); | ||
647 | break; | ||
648 | case EISA_IRQ_11: | ||
649 | rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 11\n"); | ||
650 | break; | ||
651 | case EISA_IRQ_12: | ||
652 | rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 12\n"); | ||
653 | break; | ||
654 | case EISA_IRQ_14: | ||
655 | rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 14\n"); | ||
656 | break; | ||
657 | case EISA_IRQ_15: | ||
658 | rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 15\n"); | ||
659 | break; | ||
660 | case EISA_POLLED: | ||
661 | rio_dprintk (RIO_DEBUG_INIT, "EISA POLLED\n"); | ||
662 | break; | ||
663 | default: | ||
664 | rio_dprintk (RIO_DEBUG_INIT, NULL,DBG_INIT|DBG_FAIL,"Shagged interrupt number!\n"); | ||
665 | Ivec &= EISA_CONTROL_MASK; | ||
666 | } | ||
667 | #endif | ||
668 | |||
669 | if ( (Ivec & EISA_INTERRUPT_MASK) == | ||
670 | EISA_POLLED ) | ||
671 | { | ||
672 | RIOWillPoll = 1; | ||
673 | break; /* From EisaSlot loop */ | ||
674 | } | ||
675 | } | ||
676 | } | ||
677 | |||
678 | /* | ||
679 | ** Do it all again now we know whether to change all cards to polled | ||
680 | ** mode or not | ||
681 | */ | ||
682 | |||
683 | for ( EisaSlot=1; EisaSlot<=RIO_MAX_EISA_SLOTS; EisaSlot++ ) | ||
684 | { | ||
685 | Ident = (INBZ(EisaSlot,EISA_PRODUCT_IDENT_HI)<<8) | | ||
686 | INBZ(EisaSlot,EISA_PRODUCT_IDENT_LO); | ||
687 | |||
688 | if ( Ident == RIO_EISA_IDENT ) | ||
689 | { | ||
690 | if ( INBZ(EisaSlot,EISA_PRODUCT_NUMBER) != RIO_EISA_PRODUCT_CODE ) | ||
691 | continue; /* next slot */ | ||
692 | |||
693 | /* | ||
694 | ** Its a Specialix RIO! | ||
695 | */ | ||
696 | |||
697 | /* | ||
698 | ** Ensure that the enable bit is set! | ||
699 | */ | ||
700 | OUTBZ( EisaSlot, EISA_ENABLE, RIO_EISA_ENABLE_BIT ); | ||
701 | |||
702 | /* | ||
703 | ** EISA_INTERRUPT_VEC contains the interrupt vector. | ||
704 | */ | ||
705 | Ivec = INBZ(EisaSlot,EISA_INTERRUPT_VEC); | ||
706 | |||
707 | if ( RIOWillPoll ) | ||
708 | { | ||
709 | /* | ||
710 | ** If we are going to operate in polled mode, but this | ||
711 | ** board is configured to be interrupt driven, display | ||
712 | ** the message explaining the situation to the punter, | ||
713 | ** assuming we haven't already done so. | ||
714 | */ | ||
715 | |||
716 | if ( !PollIntMixMsgDone && | ||
717 | (Ivec & EISA_INTERRUPT_MASK) != EISA_POLLED ) | ||
718 | { | ||
719 | Rprintf(RIOMesgAllPolled); | ||
720 | PollIntMixMsgDone = 1; | ||
721 | } | ||
722 | |||
723 | /* | ||
724 | ** Ungraciously ignore whatever the board reports as its | ||
725 | ** interrupt vector... | ||
726 | */ | ||
727 | |||
728 | Ivec &= ~EISA_INTERRUPT_MASK; | ||
729 | |||
730 | /* | ||
731 | ** ...and force it to dance to the poll tune. | ||
732 | */ | ||
733 | |||
734 | Ivec |= EISA_POLLED; | ||
735 | } | ||
736 | |||
737 | /* | ||
738 | ** Convert the IRQ enable mask into something useful (0-15) | ||
739 | */ | ||
740 | Ivec = RIOEisaToIvec(Ivec); | ||
741 | |||
742 | rio_dprintk (RIO_DEBUG_INIT, "EISA host in slot %d has Ivec 0x%x\n", | ||
743 | EisaSlot, Ivec); | ||
744 | |||
745 | /* | ||
746 | ** Find the physical address | ||
747 | */ | ||
748 | Paddr = (INBZ(EisaSlot,EISA_MEMORY_BASE_HI)<<24) | | ||
749 | (INBZ(EisaSlot,EISA_MEMORY_BASE_LO)<<16); | ||
750 | |||
751 | rio_dprintk (RIO_DEBUG_INIT, "EISA card has Ivec %d Addr %x\n", Ivec, Paddr); | ||
752 | |||
753 | if ( Paddr == 0 ) | ||
754 | { | ||
755 | rio_dprintk (RIO_DEBUG_INIT, | ||
756 | "Board in slot %d configured for address zero!\n", EisaSlot); | ||
757 | continue; | ||
758 | } | ||
759 | |||
760 | /* | ||
761 | ** Tell the memory mapper that we want to talk to it | ||
762 | */ | ||
763 | rio_dprintk (RIO_DEBUG_INIT, "About to map EISA card \n"); | ||
764 | |||
765 | if (RIOMapin( Paddr, RIO_EISA_MEM_SIZE, &Caddr) == -1) { | ||
766 | rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at %x\n", | ||
767 | RIO_EISA_MEM_SIZE,Paddr); | ||
768 | continue; | ||
769 | } | ||
770 | |||
771 | rio_dprintk (RIO_DEBUG_INIT, "Board mapped to vaddr 0x%x\n", Caddr); | ||
772 | |||
773 | /* | ||
774 | ** And check that it is actually there! | ||
775 | */ | ||
776 | if ( RIOBoardTest( Paddr,Caddr,RIO_EISA,EisaSlot) == RIO_SUCCESS ) | ||
777 | { | ||
778 | rio_dprintk (RIO_DEBUG_INIT, "Board has passed test\n"); | ||
779 | rio_dprintk (RIO_DEBUG_INIT, | ||
780 | "Slot %d. Ivec %d. Type %d. Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n", | ||
781 | EisaSlot,Ivec,RIO_EISA,Paddr,Caddr,Mode); | ||
782 | |||
783 | /* | ||
784 | ** Board has passed its scrub test. Fill in all the | ||
785 | ** transient stuff. | ||
786 | */ | ||
787 | p->RIOHosts[RIONumHosts].Slot = EisaSlot; | ||
788 | p->RIOHosts[RIONumHosts].Ivec = Ivec; | ||
789 | p->RIOHosts[RIONumHosts].Type = RIO_EISA; | ||
790 | p->RIOHosts[RIONumHosts].Copy = bcopy; | ||
791 | p->RIOHosts[RIONumHosts].PaddrP = Paddr; | ||
792 | p->RIOHosts[RIONumHosts].Caddr = Caddr; | ||
793 | p->RIOHosts[RIONumHosts].CardP = (struct DpRam *)Caddr; | ||
794 | p->RIOHosts[RIONumHosts].Mode = Mode; | ||
795 | /* | ||
796 | ** because the EISA prom is mapped into IO space, we | ||
797 | ** need to copy the unqiue number into the memory area | ||
798 | ** that it would have occupied, so that the download | ||
799 | ** code can determine its ID and card type. | ||
800 | */ | ||
801 | WBYTE(p->RIOHosts[RIONumHosts].Unique[0],INBZ(EisaSlot,EISA_UNIQUE_NUM_0)); | ||
802 | WBYTE(p->RIOHosts[RIONumHosts].Unique[1],INBZ(EisaSlot,EISA_UNIQUE_NUM_1)); | ||
803 | WBYTE(p->RIOHosts[RIONumHosts].Unique[2],INBZ(EisaSlot,EISA_UNIQUE_NUM_2)); | ||
804 | WBYTE(p->RIOHosts[RIONumHosts].Unique[3],INBZ(EisaSlot,EISA_UNIQUE_NUM_3)); | ||
805 | p->RIOHosts[RIONumHosts].UniqueNum = | ||
806 | ((RBYTE(p->RIOHosts[RIONumHosts].Unique[0])&0xFF)<<0)| | ||
807 | ((RBYTE(p->RIOHosts[RIONumHosts].Unique[1])&0xFF)<<8)| | ||
808 | ((RBYTE(p->RIOHosts[RIONumHosts].Unique[2])&0xFF)<<16)| | ||
809 | ((RBYTE(p->RIOHosts[RIONumHosts].Unique[3])&0xFF)<<24); | ||
810 | INBZ(EisaSlot,EISA_INTERRUPT_RESET); | ||
811 | RIONumHosts++; | ||
812 | ret++; | ||
813 | } | ||
814 | else | ||
815 | { | ||
816 | /* | ||
817 | ** It failed the test, so ignore it. | ||
818 | */ | ||
819 | rio_dprintk (RIO_DEBUG_INIT, "TEST FAILED\n"); | ||
820 | |||
821 | RIOMapout(Paddr, RIO_EISA_MEM_SIZE, Caddr ); | ||
822 | } | ||
823 | } | ||
824 | } | ||
825 | if (RIOMachineType & RIO_EISA) | ||
826 | return ret+1; | ||
827 | return ret; | ||
828 | } | ||
829 | #endif | ||
830 | |||
831 | |||
832 | #ifndef linux | ||
833 | |||
834 | #define CONFIG_ADDRESS 0xcf8 | ||
835 | #define CONFIG_DATA 0xcfc | ||
836 | #define FORWARD_REG 0xcfa | ||
837 | |||
838 | |||
839 | static int | ||
840 | read_config(int bus_number, int device_num, int r_number) | ||
841 | { | ||
842 | unsigned int cav; | ||
843 | unsigned int val; | ||
844 | |||
845 | /* | ||
846 | Build config_address_value: | ||
847 | |||
848 | 31 24 23 16 15 11 10 8 7 0 | ||
849 | ------------------------------------------------------ | ||
850 | |1| 0000000 | bus_number | device # | 000 | register | | ||
851 | ------------------------------------------------------ | ||
852 | */ | ||
853 | |||
854 | cav = r_number & 0xff; | ||
855 | cav |= ((device_num & 0x1f) << 11); | ||
856 | cav |= ((bus_number & 0xff) << 16); | ||
857 | cav |= 0x80000000; /* Enable bit */ | ||
858 | outpd(CONFIG_ADDRESS,cav); | ||
859 | val = inpd(CONFIG_DATA); | ||
860 | outpd(CONFIG_ADDRESS,0); | ||
861 | return val; | ||
862 | } | ||
863 | |||
864 | static | ||
865 | write_config(bus_number,device_num,r_number,val) | ||
866 | { | ||
867 | unsigned int cav; | ||
868 | |||
869 | /* | ||
870 | Build config_address_value: | ||
871 | |||
872 | 31 24 23 16 15 11 10 8 7 0 | ||
873 | ------------------------------------------------------ | ||
874 | |1| 0000000 | bus_number | device # | 000 | register | | ||
875 | ------------------------------------------------------ | ||
876 | */ | ||
877 | |||
878 | cav = r_number & 0xff; | ||
879 | cav |= ((device_num & 0x1f) << 11); | ||
880 | cav |= ((bus_number & 0xff) << 16); | ||
881 | cav |= 0x80000000; /* Enable bit */ | ||
882 | outpd(CONFIG_ADDRESS, cav); | ||
883 | outpd(CONFIG_DATA, val); | ||
884 | outpd(CONFIG_ADDRESS, 0); | ||
885 | return val; | ||
886 | } | ||
887 | #else | ||
888 | /* XXX Implement these... */ | ||
889 | static int | ||
890 | read_config(int bus_number, int device_num, int r_number) | ||
891 | { | ||
892 | return 0; | ||
893 | } | ||
894 | |||
895 | static int | ||
896 | write_config(int bus_number, int device_num, int r_number) | ||
897 | { | ||
898 | return 0; | ||
899 | } | ||
900 | |||
901 | #endif | ||
902 | |||
903 | int | ||
904 | RIOPCIinit(p, Mode) | ||
905 | struct rio_info *p; | ||
906 | int Mode; | ||
907 | { | ||
908 | #define MAX_PCI_SLOT 32 | ||
909 | #define RIO_PCI_JET_CARD 0x200011CB | ||
910 | |||
911 | static int slot; /* count of machine's PCI slots searched so far */ | ||
912 | caddr_t Caddr; /* Virtual address of the current PCI host card. */ | ||
913 | unsigned char Ivec; /* interrupt vector for the current PCI host */ | ||
914 | unsigned long Paddr; /* Physical address for the current PCI host */ | ||
915 | int Handle; /* Handle to Virtual memory allocated for current PCI host */ | ||
916 | |||
917 | |||
918 | rio_dprintk (RIO_DEBUG_INIT, "Search for a RIO PCI card - start at slot %d\n", slot); | ||
919 | |||
920 | /* | ||
921 | ** Initialise the search status | ||
922 | */ | ||
923 | p->RIOLastPCISearch = RIO_FAIL; | ||
924 | |||
925 | while ( (slot < MAX_PCI_SLOT) & (p->RIOLastPCISearch != RIO_SUCCESS) ) | ||
926 | { | ||
927 | rio_dprintk (RIO_DEBUG_INIT, "Currently testing slot %d\n", slot); | ||
928 | |||
929 | if (read_config(0,slot,0) == RIO_PCI_JET_CARD) { | ||
930 | p->RIOHosts[p->RIONumHosts].Ivec = 0; | ||
931 | Paddr = read_config(0,slot,0x18); | ||
932 | Paddr = Paddr - (Paddr & 0x1); /* Mask off the io bit */ | ||
933 | |||
934 | if ( (Paddr == 0) || ((Paddr & 0xffff0000) == 0xffff0000) ) { | ||
935 | rio_dprintk (RIO_DEBUG_INIT, "Goofed up slot\n"); /* what! */ | ||
936 | slot++; | ||
937 | continue; | ||
938 | } | ||
939 | |||
940 | p->RIOHosts[p->RIONumHosts].PaddrP = Paddr; | ||
941 | Ivec = (read_config(0,slot,0x3c) & 0xff); | ||
942 | |||
943 | rio_dprintk (RIO_DEBUG_INIT, "PCI Host at 0x%x, Intr %d\n", (int)Paddr, Ivec); | ||
944 | |||
945 | Handle = RIOMapin( Paddr, RIO_PCI_MEM_SIZE, &Caddr ); | ||
946 | if (Handle == -1) { | ||
947 | rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at 0x%x\n", RIO_PCI_MEM_SIZE, (int)Paddr); | ||
948 | slot++; | ||
949 | continue; | ||
950 | } | ||
951 | p->RIOHosts[p->RIONumHosts].Ivec = Ivec + 32; | ||
952 | p->intr_tid = iointset(p->RIOHosts[p->RIONumHosts].Ivec, | ||
953 | (int (*)())rio_intr, (char *)p->RIONumHosts); | ||
954 | if (RIOBoardTest( Paddr, Caddr, RIO_PCI, 0 ) == RIO_SUCCESS) { | ||
955 | rio_dprintk (RIO_DEBUG_INIT, ("Board has passed test\n"); | ||
956 | rio_dprintk (RIO_DEBUG_INIT, ("Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n", Paddr, Caddr, Mode); | ||
957 | |||
958 | /* | ||
959 | ** Board has passed its scrub test. Fill in all the | ||
960 | ** transient stuff. | ||
961 | */ | ||
962 | p->RIOHosts[p->RIONumHosts].Slot = 0; | ||
963 | p->RIOHosts[p->RIONumHosts].Ivec = Ivec + 32; | ||
964 | p->RIOHosts[p->RIONumHosts].Type = RIO_PCI; | ||
965 | p->RIOHosts[p->RIONumHosts].Copy = rio_pcicopy; | ||
966 | p->RIOHosts[p->RIONumHosts].PaddrP = Paddr; | ||
967 | p->RIOHosts[p->RIONumHosts].Caddr = Caddr; | ||
968 | p->RIOHosts[p->RIONumHosts].CardP = (struct DpRam *)Caddr; | ||
969 | p->RIOHosts[p->RIONumHosts].Mode = Mode; | ||
970 | |||
971 | #if 0 | ||
972 | WBYTE(p->RIOHosts[p->RIONumHosts].Control, | ||
973 | BOOT_FROM_RAM | EXTERNAL_BUS_OFF | | ||
974 | p->RIOHosts[p->RIONumHosts].Mode | | ||
975 | INTERRUPT_DISABLE ); | ||
976 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff); | ||
977 | WBYTE(p->RIOHosts[p->RIONumHosts].Control, | ||
978 | BOOT_FROM_RAM | EXTERNAL_BUS_OFF | | ||
979 | p->RIOHosts[p->RIONumHosts].Mode | | ||
980 | INTERRUPT_DISABLE ); | ||
981 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff); | ||
982 | #else | ||
983 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); | ||
984 | #endif | ||
985 | p->RIOHosts[p->RIONumHosts].UniqueNum = | ||
986 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)| | ||
987 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)| | ||
988 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)| | ||
989 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24); | ||
990 | |||
991 | rio_dprintk (RIO_DEBUG_INIT, "Unique no 0x%x.\n", | ||
992 | p->RIOHosts[p->RIONumHosts].UniqueNum); | ||
993 | |||
994 | p->RIOLastPCISearch = RIO_SUCCESS; | ||
995 | p->RIONumHosts++; | ||
996 | } | ||
997 | } | ||
998 | slot++; | ||
999 | } | ||
1000 | |||
1001 | if ( slot >= MAX_PCI_SLOT ) { | ||
1002 | rio_dprintk (RIO_DEBUG_INIT, "All %d PCI slots have tested for RIO cards !!!\n", | ||
1003 | MAX_PCI_SLOT); | ||
1004 | } | ||
1005 | |||
1006 | |||
1007 | /* | ||
1008 | ** I don't think we want to do this anymore | ||
1009 | ** | ||
1010 | |||
1011 | if (!p->RIOLastPCISearch == RIO_FAIL ) { | ||
1012 | p->RIOFailed++; | ||
1013 | } | ||
1014 | |||
1015 | ** | ||
1016 | */ | ||
1017 | } | ||
1018 | |||
1019 | #ifdef FUTURE_RELEASE | ||
1020 | void riohalt( void ) | ||
1021 | { | ||
1022 | int host; | ||
1023 | for ( host=0; host<p->RIONumHosts; host++ ) | ||
1024 | { | ||
1025 | rio_dprintk (RIO_DEBUG_INIT, "Stop host %d\n", host); | ||
1026 | (void)RIOBoardTest( p->RIOHosts[host].PaddrP, p->RIOHosts[host].Caddr, p->RIOHosts[host].Type,p->RIOHosts[host].Slot ); | ||
1027 | } | ||
1028 | } | ||
1029 | #endif | ||
1030 | #endif | ||
1031 | 156 | ||
1032 | static uchar val[] = { | 157 | static uchar val[] = { |
1033 | #ifdef VERY_LONG_TEST | 158 | #ifdef VERY_LONG_TEST |
@@ -1262,200 +387,6 @@ int size; | |||
1262 | return RIO_SUCCESS; | 387 | return RIO_SUCCESS; |
1263 | } | 388 | } |
1264 | 389 | ||
1265 | /* | ||
1266 | ** try to ensure that every host is either in polled mode | ||
1267 | ** or is in interrupt mode. Only allow interrupt mode if | ||
1268 | ** all hosts can interrupt (why?) | ||
1269 | ** and force into polled mode if told to. Patch up the | ||
1270 | ** interrupt vector & salute The Queen when you've done. | ||
1271 | */ | ||
1272 | #if 0 | ||
1273 | static void | ||
1274 | RIOAllocateInterrupts(p) | ||
1275 | struct rio_info * p; | ||
1276 | { | ||
1277 | int Host; | ||
1278 | |||
1279 | /* | ||
1280 | ** Easy case - if we have been told to poll, then we poll. | ||
1281 | */ | ||
1282 | if (p->mode & POLLED_MODE) { | ||
1283 | RIOStopInterrupts(p, 0, 0); | ||
1284 | return; | ||
1285 | } | ||
1286 | |||
1287 | /* | ||
1288 | ** check - if any host has been set to polled mode, then all must be. | ||
1289 | */ | ||
1290 | for (Host=0; Host<p->RIONumHosts; Host++) { | ||
1291 | if ( (p->RIOHosts[Host].Type != RIO_AT) && | ||
1292 | (p->RIOHosts[Host].Ivec == POLLED) ) { | ||
1293 | RIOStopInterrupts(p, 1, Host ); | ||
1294 | return; | ||
1295 | } | ||
1296 | } | ||
1297 | for (Host=0; Host<p->RIONumHosts; Host++) { | ||
1298 | if (p->RIOHosts[Host].Type == RIO_AT) { | ||
1299 | if ( (p->RIOHosts[Host].Ivec - 32) == 0) { | ||
1300 | RIOStopInterrupts(p, 2, Host ); | ||
1301 | return; | ||
1302 | } | ||
1303 | } | ||
1304 | } | ||
1305 | } | ||
1306 | |||
1307 | /* | ||
1308 | ** something has decided that we can't be doing with these | ||
1309 | ** new-fangled interrupt thingies. Set everything up to just | ||
1310 | ** poll. | ||
1311 | */ | ||
1312 | static void | ||
1313 | RIOStopInterrupts(p, Reason, Host) | ||
1314 | struct rio_info * p; | ||
1315 | int Reason; | ||
1316 | int Host; | ||
1317 | { | ||
1318 | #ifdef FUTURE_RELEASE | ||
1319 | switch (Reason) { | ||
1320 | case 0: /* forced into polling by rio_polled */ | ||
1321 | break; | ||
1322 | case 1: /* SCU has set 'Host' into polled mode */ | ||
1323 | break; | ||
1324 | case 2: /* there aren't enough interrupt vectors for 'Host' */ | ||
1325 | break; | ||
1326 | } | ||
1327 | #endif | ||
1328 | |||
1329 | for (Host=0; Host<p->RIONumHosts; Host++ ) { | ||
1330 | struct Host *HostP = &p->RIOHosts[Host]; | ||
1331 | |||
1332 | switch (HostP->Type) { | ||
1333 | case RIO_AT: | ||
1334 | /* | ||
1335 | ** The AT host has it's interrupts disabled by clearing the | ||
1336 | ** int_enable bit. | ||
1337 | */ | ||
1338 | HostP->Mode &= ~INTERRUPT_ENABLE; | ||
1339 | HostP->Ivec = POLLED; | ||
1340 | break; | ||
1341 | #ifdef FUTURE_RELEASE | ||
1342 | case RIO_EISA: | ||
1343 | /* | ||
1344 | ** The EISA host has it's interrupts disabled by setting the | ||
1345 | ** Ivec to zero | ||
1346 | */ | ||
1347 | HostP->Ivec = POLLED; | ||
1348 | break; | ||
1349 | #endif | ||
1350 | case RIO_PCI: | ||
1351 | /* | ||
1352 | ** The PCI host has it's interrupts disabled by clearing the | ||
1353 | ** int_enable bit, like a regular host card. | ||
1354 | */ | ||
1355 | HostP->Mode &= ~RIO_PCI_INT_ENABLE; | ||
1356 | HostP->Ivec = POLLED; | ||
1357 | break; | ||
1358 | #ifdef FUTURE_RELEASE | ||
1359 | case RIO_MCA: | ||
1360 | /* | ||
1361 | ** There's always one, isn't there? | ||
1362 | ** The MCA host card cannot have it's interrupts disabled. | ||
1363 | */ | ||
1364 | RIOPatchVec(HostP); | ||
1365 | break; | ||
1366 | #endif | ||
1367 | } | ||
1368 | } | ||
1369 | } | ||
1370 | |||
1371 | /* | ||
1372 | ** This function is called at init time to setup the data structures. | ||
1373 | */ | ||
1374 | void | ||
1375 | RIOAllocDataStructs(p) | ||
1376 | struct rio_info * p; | ||
1377 | { | ||
1378 | int port, | ||
1379 | host, | ||
1380 | tm; | ||
1381 | |||
1382 | p->RIOPortp = (struct Port *)sysbrk(RIO_PORTS * sizeof(struct Port)); | ||
1383 | if (!p->RIOPortp) { | ||
1384 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for port structures\n"); | ||
1385 | p->RIOFailed++; | ||
1386 | return; | ||
1387 | } | ||
1388 | bzero( p->RIOPortp, sizeof(struct Port) * RIO_PORTS ); | ||
1389 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: allocated and cleared memory for port structs\n"); | ||
1390 | rio_dprintk (RIO_DEBUG_INIT, "First RIO port struct @0x%x, size=0x%x bytes\n", | ||
1391 | (int)p->RIOPortp, sizeof(struct Port)); | ||
1392 | |||
1393 | for( port=0; port<RIO_PORTS; port++ ) { | ||
1394 | p->RIOPortp[port].PortNum = port; | ||
1395 | p->RIOPortp[port].TtyP = &p->channel[port]; | ||
1396 | sreset (p->RIOPortp[port].InUse); /* Let the first guy uses it */ | ||
1397 | p->RIOPortp[port].portSem = -1; /* Let the first guy takes it */ | ||
1398 | p->RIOPortp[port].ParamSem = -1; /* Let the first guy takes it */ | ||
1399 | p->RIOPortp[port].timeout_id = 0; /* Let the first guy takes it */ | ||
1400 | } | ||
1401 | |||
1402 | p->RIOHosts = (struct Host *)sysbrk(RIO_HOSTS * sizeof(struct Host)); | ||
1403 | if (!p->RIOHosts) { | ||
1404 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for host structures\n"); | ||
1405 | p->RIOFailed++; | ||
1406 | return; | ||
1407 | } | ||
1408 | bzero(p->RIOHosts, sizeof(struct Host)*RIO_HOSTS); | ||
1409 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: allocated and cleared memory for host structs\n"); | ||
1410 | rio_dprintk (RIO_DEBUG_INIT, "First RIO host struct @0x%x, size=0x%x bytes\n", | ||
1411 | (int)p->RIOHosts, sizeof(struct Host)); | ||
1412 | |||
1413 | for( host=0; host<RIO_HOSTS; host++ ) { | ||
1414 | spin_lock_init (&p->RIOHosts[host].HostLock); | ||
1415 | p->RIOHosts[host].timeout_id = 0; /* Let the first guy takes it */ | ||
1416 | } | ||
1417 | /* | ||
1418 | ** check that the buffer size is valid, round down to the next power of | ||
1419 | ** two if necessary; if the result is zero, then, hey, no double buffers. | ||
1420 | */ | ||
1421 | for ( tm = 1; tm && tm <= p->RIOConf.BufferSize; tm <<= 1 ) | ||
1422 | ; | ||
1423 | tm >>= 1; | ||
1424 | p->RIOBufferSize = tm; | ||
1425 | p->RIOBufferMask = tm ? tm - 1 : 0; | ||
1426 | } | ||
1427 | |||
1428 | /* | ||
1429 | ** this function gets called whenever the data structures need to be | ||
1430 | ** re-setup, for example, after a riohalt (why did I ever invent it?) | ||
1431 | */ | ||
1432 | void | ||
1433 | RIOSetupDataStructs(p) | ||
1434 | struct rio_info * p; | ||
1435 | { | ||
1436 | int host, entry, rup; | ||
1437 | |||
1438 | for ( host=0; host<RIO_HOSTS; host++ ) { | ||
1439 | struct Host *HostP = &p->RIOHosts[host]; | ||
1440 | for ( entry=0; entry<LINKS_PER_UNIT; entry++ ) { | ||
1441 | HostP->Topology[entry].Unit = ROUTE_DISCONNECT; | ||
1442 | HostP->Topology[entry].Link = NO_LINK; | ||
1443 | } | ||
1444 | bcopy("HOST X", HostP->Name, 7); | ||
1445 | HostP->Name[5] = '1'+host; | ||
1446 | for (rup=0; rup<(MAX_RUP + LINKS_PER_UNIT); rup++) { | ||
1447 | if (rup < MAX_RUP) { | ||
1448 | for (entry=0; entry<LINKS_PER_UNIT; entry++ ) { | ||
1449 | HostP->Mapping[rup].Topology[entry].Unit = ROUTE_DISCONNECT; | ||
1450 | HostP->Mapping[rup].Topology[entry].Link = NO_LINK; | ||
1451 | } | ||
1452 | RIODefaultName(p, HostP, rup); | ||
1453 | } | ||
1454 | spin_lock_init(&HostP->UnixRups[rup].RupLock); | ||
1455 | } | ||
1456 | } | ||
1457 | } | ||
1458 | #endif | ||
1459 | 390 | ||
1460 | int | 391 | int |
1461 | RIODefaultName(p, HostP, UnitId) | 392 | RIODefaultName(p, HostP, UnitId) |
@@ -1463,10 +394,6 @@ struct rio_info * p; | |||
1463 | struct Host * HostP; | 394 | struct Host * HostP; |
1464 | uint UnitId; | 395 | uint UnitId; |
1465 | { | 396 | { |
1466 | #ifdef CHECK | ||
1467 | CheckHost( Host ); | ||
1468 | CheckUnitId( UnitId ); | ||
1469 | #endif | ||
1470 | bcopy("UNKNOWN RTA X-XX",HostP->Mapping[UnitId].Name,17); | 397 | bcopy("UNKNOWN RTA X-XX",HostP->Mapping[UnitId].Name,17); |
1471 | HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts); | 398 | HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts); |
1472 | if ((UnitId+1) > 9) { | 399 | if ((UnitId+1) > 9) { |
@@ -1483,33 +410,6 @@ uint UnitId; | |||
1483 | #define RIO_RELEASE "Linux" | 410 | #define RIO_RELEASE "Linux" |
1484 | #define RELEASE_ID "1.0" | 411 | #define RELEASE_ID "1.0" |
1485 | 412 | ||
1486 | #if 0 | ||
1487 | static int | ||
1488 | RIOReport(p) | ||
1489 | struct rio_info * p; | ||
1490 | { | ||
1491 | char * RIORelease = RIO_RELEASE; | ||
1492 | char * RIORelID = RELEASE_ID; | ||
1493 | int host; | ||
1494 | |||
1495 | rio_dprintk (RIO_DEBUG_INIT, "RIO : Release: %s ID: %s\n", RIORelease, RIORelID); | ||
1496 | |||
1497 | if ( p->RIONumHosts==0 ) { | ||
1498 | rio_dprintk (RIO_DEBUG_INIT, "\nNo Hosts configured\n"); | ||
1499 | return(0); | ||
1500 | } | ||
1501 | |||
1502 | for ( host=0; host < p->RIONumHosts; host++ ) { | ||
1503 | struct Host *HostP = &p->RIOHosts[host]; | ||
1504 | switch ( HostP->Type ) { | ||
1505 | case RIO_AT: | ||
1506 | rio_dprintk (RIO_DEBUG_INIT, "AT BUS : found the card at 0x%x\n", HostP->PaddrP); | ||
1507 | } | ||
1508 | } | ||
1509 | return 0; | ||
1510 | } | ||
1511 | #endif | ||
1512 | |||
1513 | static struct rioVersion stVersion; | 413 | static struct rioVersion stVersion; |
1514 | 414 | ||
1515 | struct rioVersion * | 415 | struct rioVersion * |
@@ -1523,27 +423,6 @@ RIOVersid(void) | |||
1523 | return &stVersion; | 423 | return &stVersion; |
1524 | } | 424 | } |
1525 | 425 | ||
1526 | #if 0 | ||
1527 | int | ||
1528 | RIOMapin(paddr, size, vaddr) | ||
1529 | paddr_t paddr; | ||
1530 | int size; | ||
1531 | caddr_t * vaddr; | ||
1532 | { | ||
1533 | *vaddr = (caddr_t)permap( (long)paddr, size); | ||
1534 | return ((int)*vaddr); | ||
1535 | } | ||
1536 | |||
1537 | void | ||
1538 | RIOMapout(paddr, size, vaddr) | ||
1539 | paddr_t paddr; | ||
1540 | long size; | ||
1541 | caddr_t vaddr; | ||
1542 | { | ||
1543 | } | ||
1544 | #endif | ||
1545 | |||
1546 | |||
1547 | void | 426 | void |
1548 | RIOHostReset(Type, DpRamP, Slot) | 427 | RIOHostReset(Type, DpRamP, Slot) |
1549 | uint Type; | 428 | uint Type; |
@@ -1570,31 +449,6 @@ uint Slot; | |||
1570 | WBYTE(DpRamP->DpResetTpu, 0xFF); | 449 | WBYTE(DpRamP->DpResetTpu, 0xFF); |
1571 | udelay(3); | 450 | udelay(3); |
1572 | break; | 451 | break; |
1573 | #ifdef FUTURE_RELEASE | ||
1574 | case RIO_EISA: | ||
1575 | /* | ||
1576 | ** Bet this doesn't work! | ||
1577 | */ | ||
1578 | OUTBZ( Slot, EISA_CONTROL_PORT, | ||
1579 | EISA_TP_RUN | EISA_TP_BUS_DISABLE | | ||
1580 | EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM ); | ||
1581 | OUTBZ( Slot, EISA_CONTROL_PORT, | ||
1582 | EISA_TP_RESET | EISA_TP_BUS_DISABLE | | ||
1583 | EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM ); | ||
1584 | suspend( 3 ); | ||
1585 | OUTBZ( Slot, EISA_CONTROL_PORT, | ||
1586 | EISA_TP_RUN | EISA_TP_BUS_DISABLE | | ||
1587 | EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM ); | ||
1588 | break; | ||
1589 | case RIO_MCA: | ||
1590 | WBYTE(DpRamP->DpControl , McaTpBootFromRam | McaTpBusDisable ); | ||
1591 | WBYTE(DpRamP->DpResetTpu , 0xFF ); | ||
1592 | suspend( 3 ); | ||
1593 | WBYTE(DpRamP->DpControl , McaTpBootFromRam | McaTpBusDisable ); | ||
1594 | WBYTE(DpRamP->DpResetTpu , 0xFF ); | ||
1595 | suspend( 3 ); | ||
1596 | break; | ||
1597 | #endif | ||
1598 | case RIO_PCI: | 452 | case RIO_PCI: |
1599 | rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n"); | 453 | rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n"); |
1600 | DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM; | 454 | DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM; |
@@ -1604,12 +458,6 @@ uint Slot; | |||
1604 | /* for (i=0; i<6000; i++); */ | 458 | /* for (i=0; i<6000; i++); */ |
1605 | /* suspend( 3 ); */ | 459 | /* suspend( 3 ); */ |
1606 | break; | 460 | break; |
1607 | #ifdef FUTURE_RELEASE | ||
1608 | default: | ||
1609 | Rprintf(RIOMesgNoSupport,Type,DpRamP,Slot); | ||
1610 | return; | ||
1611 | #endif | ||
1612 | |||
1613 | default: | 461 | default: |
1614 | rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n"); | 462 | rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n"); |
1615 | break; | 463 | break; |