2 ** -----------------------------------------------------------------------------
4 ** Perle Specialix driver for Linux
5 ** Ported from existing RIO Driver for SCO sources.
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 ** Last Modified : 11/6/98 10:33:43
26 ** Retrieved : 11/6/98 10:33:49
28 ** ident @(#)rioinit.c 1.3
30 ** -----------------------------------------------------------------------------
33 static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3";
36 #include <linux/config.h>
37 #include <linux/module.h>
38 #include <linux/slab.h>
39 #include <linux/errno.h>
40 #include <linux/delay.h>
42 #include <asm/system.h>
43 #include <asm/string.h>
44 #include <asm/semaphore.h>
45 #include <asm/uaccess.h>
47 #include <linux/termios.h>
48 #include <linux/serial.h>
50 #include <linux/generic_serial.h>
53 #include "linux_compat.h"
83 #include "rio_linux.h"
86 #define bcopy rio_pcicopy
88 int RIOPCIinit(struct rio_info *p, int Mode);
91 static void RIOAllocateInterrupts(struct rio_info *);
92 static int RIOReport(struct rio_info *);
93 static void RIOStopInterrupts(struct rio_info *, int, int);
96 static int RIOScrub(int, BYTE *, int);
99 extern int rio_intr();
107 struct RioHostInfo * info;
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.
117 rio_dprintk (RIO_DEBUG_INIT, "Allocating and setting up driver data structures\n");
119 RIOAllocDataStructs(p); /* allocate host/port structs */
120 RIOSetupDataStructs(p); /* setup topology structs */
123 RIOInitHosts( p, info ); /* hunt down the hardware */
125 RIOAllocateInterrupts(p); /* allocate interrupts */
126 RIOReport(p); /* show what we found */
130 ** Initialise the Cards
133 RIOInitHosts(p, info)
135 struct RioHostInfo * info;
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.
146 ** Note - for PCI both these will be zero, that's okay because
147 ** RIOPCIInit() fills them in if a card is found.
149 p->RIOHosts[p->RIONumHosts].Ivec = info->vector;
150 p->RIOHosts[p->RIONumHosts].PaddrP = info->location;
153 ** Check that we are able to accommodate another host
155 if ( p->RIONumHosts >= RIO_HOSTS )
161 if ( info->bus & ISA_BUS )
163 rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (ISA)\n", p->RIONumHosts);
164 RIOISAinit(p, p->mode);
168 rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (PCI)\n", p->RIONumHosts);
169 RIOPCIinit(p, RIO_PCI_DEFAULT_MODE);
172 rio_dprintk (RIO_DEBUG_INIT, "Total hosts initialised so far : %d\n", p->RIONumHosts);
175 #ifdef FUTURE_RELEASE
176 if (p->bus & EISA_BUS)
178 RIOEISAinit(p, RIO_EISA_DEFAULT_MODE);
180 if (p->bus & MCA_BUS)
182 RIOMCAinit(p, RIO_MCA_DEFAULT_MODE);
187 ** go through memory for an AT host that we pass in the device info
188 ** structure and initialise
196 /* XXX Need to implement this. */
198 p->intr_tid = iointset(p->RIOHosts[p->RIONumHosts].Ivec,
199 (int (*)())rio_intr, (char*)p->RIONumHosts);
201 rio_dprintk (RIO_DEBUG_INIT, "Set interrupt handler, intr_tid = 0x%x\n", p->intr_tid );
203 if (RIODoAT(p, p->RIOHosts[p->RIONumHosts].PaddrP, mode)) {
207 rio_dprintk (RIO_DEBUG_INIT, "RIODoAT failed\n");
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.
222 RIODoAT(p, Base, mode)
233 ** Check to see if we actually have a board at this physical address.
235 if ((cardAddr = RIOCheckForATCard(Base)) != 0) {
237 ** Now test the board to see if it is working.
239 if (RIOBoardTest(Base, cardAddr, RIO_AT, 0) == RIO_SUCCESS) {
241 ** Fill out a slot in the Rio host structure.
243 if (RIOAssignAT(p, Base, cardAddr, mode)) {
247 RIOMapout(Base, RIO_AT_MEM_SIZE, cardAddr);
253 RIOCheckForATCard(Base)
257 struct DpRam *cardp; /* (Points at the host) */
259 unsigned char RIOSigTab[24];
261 ** Table of values to search for as prom signature of a host card
263 strcpy(RIOSigTab, "JBJGPGGHINSMJPJR");
266 ** Hey! Yes, You reading this code! Yo, grab a load a this:
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.
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");
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.
285 cardp = (struct DpRam *)virtAddr;
287 for (off=0; RIOSigTab[off]; off++) {
288 if ((RBYTE(cardp->DpSignature[off]) & 0xFF) != RIOSigTab[off]) {
290 ** Signature mismatch - card not at this address
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",
300 ** If we get here then we must have found a valid board so return
301 ** its virtual address.
310 ** Fill out the fields in the p->RIOHosts structure now we know we know
311 ** we have a board present.
313 ** bits < 0 indicates 8 bit operation requested,
314 ** bits > 0 indicates 16 bit operation.
317 RIOAssignAT(p, Base, virtAddr, mode)
324 struct DpRam *cardp = (struct DpRam *)virtAddr;
326 if ((Base < ONE_MEG) || (mode & BYTE_ACCESS_MODE))
327 bits = BYTE_OPERATION;
329 bits = WORD_OPERATION;
332 ** Board has passed its scrub test. Fill in all the
335 p->RIOHosts[p->RIONumHosts].Caddr = virtAddr;
336 p->RIOHosts[p->RIONumHosts].CardP = (struct DpRam *)virtAddr;
339 ** Revision 01 AT host cards don't support WORD operations,
341 if ( RBYTE(cardp->DpRevision) == 01 )
342 bits = BYTE_OPERATION;
344 p->RIOHosts[p->RIONumHosts].Type = RIO_AT;
345 p->RIOHosts[p->RIONumHosts].Copy = bcopy;
347 p->RIOHosts[p->RIONumHosts].Slot = -1;
348 p->RIOHosts[p->RIONumHosts].Mode = SLOW_LINKS | SLOW_AT_BUS | bits;
349 WBYTE(p->RIOHosts[p->RIONumHosts].Control,
350 BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
351 p->RIOHosts[p->RIONumHosts].Mode |
353 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff);
354 WBYTE(p->RIOHosts[p->RIONumHosts].Control,
355 BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
356 p->RIOHosts[p->RIONumHosts].Mode |
358 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff);
359 p->RIOHosts[p->RIONumHosts].UniqueNum =
360 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)|
361 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)|
362 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)|
363 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24);
364 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Uniquenum 0x%x\n",p->RIOHosts[p->RIONumHosts].UniqueNum);
367 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Tests Passed at 0x%x\n", Base);
371 #ifdef FUTURE_RELEASE
372 int RIOMCAinit(int Mode)
382 ** Valid mode information for MCA cards
383 ** is only FAST LINKS
385 Mode = (Mode & FAST_LINKS) ? McaTpFastLinks : McaTpSlowLinks;
386 rio_dprintk (RIO_DEBUG_INIT, "RIOMCAinit(%d)\n",Mode);
390 ** Check out each of the slots
392 for (SlotNumber = 0; SlotNumber < McaMaxSlots; SlotNumber++) {
394 ** Enable the slot we want to talk to
396 outb( McaSlotSelect, SlotNumber | McaSlotEnable );
399 ** Read the ID word from the slot
401 if (((inb(McaIdHigh)<< 8)|inb(McaIdLow)) == McaRIOId)
403 rio_dprintk (RIO_DEBUG_INIT, "Potential MCA card in slot %d\n", SlotNumber);
406 ** Card appears to be a RIO MCA card!
408 RIOMachineType |= (1<<RIO_MCA);
411 ** Just check we haven't found too many wonderful objects
413 if ( RIONumHosts >= RIO_HOSTS )
415 Rprintf(RIOMesgTooManyCards);
420 ** McaIrqEnable contains the interrupt vector, and a card
423 Ivec = inb(McaIrqEnable);
425 rio_dprintk (RIO_DEBUG_INIT, "Ivec is %x\n", Ivec);
427 switch ( Ivec & McaIrqMask )
430 rio_dprintk (RIO_DEBUG_INIT, "IRQ9\n");
433 rio_dprintk (RIO_DEBUG_INIT, "IRQ3\n");
436 rio_dprintk (RIO_DEBUG_INIT, "IRQ4\n");
439 rio_dprintk (RIO_DEBUG_INIT, "IRQ7\n");
442 rio_dprintk (RIO_DEBUG_INIT, "IRQ10\n");
445 rio_dprintk (RIO_DEBUG_INIT, "IRQ11\n");
448 rio_dprintk (RIO_DEBUG_INIT, "IRQ12\n");
451 rio_dprintk (RIO_DEBUG_INIT, "IRQ15\n");
456 ** If the card enable bit isn't set, then set it!
458 if ((Ivec & McaCardEnable) != McaCardEnable) {
459 rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable not set - setting!\n");
460 outb(McaIrqEnable,Ivec|McaCardEnable);
462 rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable already set\n");
465 ** Convert the IRQ enable mask into something useful
467 Ivec = RIOMcaToIvec[Ivec & McaIrqMask];
470 ** Find the physical address
472 rio_dprintk (RIO_DEBUG_INIT, "inb(McaMemory) is %x\n", inb(McaMemory));
473 Paddr = McaAddress(inb(McaMemory));
475 rio_dprintk (RIO_DEBUG_INIT, "MCA card has Ivec %d Addr %x\n", Ivec, Paddr);
481 ** Tell the memory mapper that we want to talk to it
483 Handle = RIOMapin( Paddr, RIO_MCA_MEM_SIZE, &Caddr );
485 if ( Handle == -1 ) {
486 rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at %x\n", RIO_MCA_MEM_SIZE, Paddr;
490 rio_dprintk (RIO_DEBUG_INIT, "Board mapped to vaddr 0x%x\n", Caddr);
493 ** And check that it is actually there!
495 if ( RIOBoardTest( Paddr,Caddr,RIO_MCA,SlotNumber ) == RIO_SUCCESS )
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);
502 ** Board has passed its scrub test. Fill in all the
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);
525 ** It failed the test, so ignore it.
527 rio_dprintk (RIO_DEBUG_INIT, "TEST FAILED\n");
528 RIOMapout(Paddr, RIO_MCA_MEM_SIZE, Caddr );
533 rio_dprintk (RIO_DEBUG_INIT, "Slot %d - Paddr zero!\n", SlotNumber);
538 rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber);
542 ** Now we have checked all the slots, turn off the MCA slot selector
544 outb(McaSlotSelect,0);
545 rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber);
549 int RIOEISAinit( int Mode )
551 static int EISADone = 0;
553 int PollIntMixMsgDone = 0;
561 ** The only valid mode information for EISA hosts is fast or slow
564 Mode = (Mode & FAST_LINKS) ? EISA_TP_FAST_LINKS : EISA_TP_SLOW_LINKS;
568 rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit() - already done, return.\n");
574 rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit()\n");
578 ** First check all cards to see if ANY are set for polled mode operation.
579 ** If so, set ALL to polled.
582 for ( EisaSlot=1; EisaSlot<=RIO_MAX_EISA_SLOTS; EisaSlot++ )
584 Ident = (INBZ(EisaSlot,EISA_PRODUCT_IDENT_HI)<<8) |
585 INBZ(EisaSlot,EISA_PRODUCT_IDENT_LO);
587 if ( Ident == RIO_EISA_IDENT )
589 rio_dprintk (RIO_DEBUG_INIT, "Found Specialix product\n");
591 if ( INBZ(EisaSlot,EISA_PRODUCT_NUMBER) != RIO_EISA_PRODUCT_CODE )
593 rio_dprintk (RIO_DEBUG_INIT, "Not Specialix RIO - Product number %x\n",
594 INBZ(EisaSlot, EISA_PRODUCT_NUMBER));
595 continue; /* next slot */
598 ** Its a Specialix RIO!
600 rio_dprintk (RIO_DEBUG_INIT, "RIO Revision %d\n",
601 INBZ(EisaSlot, EISA_REVISION_NUMBER));
603 RIOMachineType |= (1<<RIO_EISA);
606 ** Just check we haven't found too many wonderful objects
608 if ( RIONumHosts >= RIO_HOSTS )
610 Rprintf(RIOMesgTooManyCards);
615 ** Ensure that the enable bit is set!
617 OUTBZ( EisaSlot, EISA_ENABLE, RIO_EISA_ENABLE_BIT );
620 ** EISA_INTERRUPT_VEC contains the interrupt vector.
622 Ivec = INBZ(EisaSlot,EISA_INTERRUPT_VEC);
625 switch ( Ivec & EISA_INTERRUPT_MASK )
628 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 3\n");
631 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 4\n");
634 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 5\n");
637 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 6\n");
640 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 7\n");
643 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 9\n");
646 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 10\n");
649 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 11\n");
652 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 12\n");
655 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 14\n");
658 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 15\n");
661 rio_dprintk (RIO_DEBUG_INIT, "EISA POLLED\n");
664 rio_dprintk (RIO_DEBUG_INIT, NULL,DBG_INIT|DBG_FAIL,"Shagged interrupt number!\n");
665 Ivec &= EISA_CONTROL_MASK;
669 if ( (Ivec & EISA_INTERRUPT_MASK) ==
673 break; /* From EisaSlot loop */
679 ** Do it all again now we know whether to change all cards to polled
683 for ( EisaSlot=1; EisaSlot<=RIO_MAX_EISA_SLOTS; EisaSlot++ )
685 Ident = (INBZ(EisaSlot,EISA_PRODUCT_IDENT_HI)<<8) |
686 INBZ(EisaSlot,EISA_PRODUCT_IDENT_LO);
688 if ( Ident == RIO_EISA_IDENT )
690 if ( INBZ(EisaSlot,EISA_PRODUCT_NUMBER) != RIO_EISA_PRODUCT_CODE )
691 continue; /* next slot */
694 ** Its a Specialix RIO!
698 ** Ensure that the enable bit is set!
700 OUTBZ( EisaSlot, EISA_ENABLE, RIO_EISA_ENABLE_BIT );
703 ** EISA_INTERRUPT_VEC contains the interrupt vector.
705 Ivec = INBZ(EisaSlot,EISA_INTERRUPT_VEC);
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.
716 if ( !PollIntMixMsgDone &&
717 (Ivec & EISA_INTERRUPT_MASK) != EISA_POLLED )
719 Rprintf(RIOMesgAllPolled);
720 PollIntMixMsgDone = 1;
724 ** Ungraciously ignore whatever the board reports as its
725 ** interrupt vector...
728 Ivec &= ~EISA_INTERRUPT_MASK;
731 ** ...and force it to dance to the poll tune.
738 ** Convert the IRQ enable mask into something useful (0-15)
740 Ivec = RIOEisaToIvec(Ivec);
742 rio_dprintk (RIO_DEBUG_INIT, "EISA host in slot %d has Ivec 0x%x\n",
746 ** Find the physical address
748 Paddr = (INBZ(EisaSlot,EISA_MEMORY_BASE_HI)<<24) |
749 (INBZ(EisaSlot,EISA_MEMORY_BASE_LO)<<16);
751 rio_dprintk (RIO_DEBUG_INIT, "EISA card has Ivec %d Addr %x\n", Ivec, Paddr);
755 rio_dprintk (RIO_DEBUG_INIT,
756 "Board in slot %d configured for address zero!\n", EisaSlot);
761 ** Tell the memory mapper that we want to talk to it
763 rio_dprintk (RIO_DEBUG_INIT, "About to map EISA card \n");
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);
771 rio_dprintk (RIO_DEBUG_INIT, "Board mapped to vaddr 0x%x\n", Caddr);
774 ** And check that it is actually there!
776 if ( RIOBoardTest( Paddr,Caddr,RIO_EISA,EisaSlot) == RIO_SUCCESS )
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);
784 ** Board has passed its scrub test. Fill in all the
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;
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.
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);
817 ** It failed the test, so ignore it.
819 rio_dprintk (RIO_DEBUG_INIT, "TEST FAILED\n");
821 RIOMapout(Paddr, RIO_EISA_MEM_SIZE, Caddr );
825 if (RIOMachineType & RIO_EISA)
834 #define CONFIG_ADDRESS 0xcf8
835 #define CONFIG_DATA 0xcfc
836 #define FORWARD_REG 0xcfa
840 read_config(int bus_number, int device_num, int r_number)
846 Build config_address_value:
848 31 24 23 16 15 11 10 8 7 0
849 ------------------------------------------------------
850 |1| 0000000 | bus_number | device # | 000 | register |
851 ------------------------------------------------------
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);
865 write_config(bus_number,device_num,r_number,val)
870 Build config_address_value:
872 31 24 23 16 15 11 10 8 7 0
873 ------------------------------------------------------
874 |1| 0000000 | bus_number | device # | 000 | register |
875 ------------------------------------------------------
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);
888 /* XXX Implement these... */
890 read_config(int bus_number, int device_num, int r_number)
896 write_config(int bus_number, int device_num, int r_number)
908 #define MAX_PCI_SLOT 32
909 #define RIO_PCI_JET_CARD 0x200011CB
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 */
918 rio_dprintk (RIO_DEBUG_INIT, "Search for a RIO PCI card - start at slot %d\n", slot);
921 ** Initialise the search status
923 p->RIOLastPCISearch = RIO_FAIL;
925 while ( (slot < MAX_PCI_SLOT) & (p->RIOLastPCISearch != RIO_SUCCESS) )
927 rio_dprintk (RIO_DEBUG_INIT, "Currently testing slot %d\n", slot);
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 */
934 if ( (Paddr == 0) || ((Paddr & 0xffff0000) == 0xffff0000) ) {
935 rio_dprintk (RIO_DEBUG_INIT, "Goofed up slot\n"); /* what! */
940 p->RIOHosts[p->RIONumHosts].PaddrP = Paddr;
941 Ivec = (read_config(0,slot,0x3c) & 0xff);
943 rio_dprintk (RIO_DEBUG_INIT, "PCI Host at 0x%x, Intr %d\n", (int)Paddr, Ivec);
945 Handle = RIOMapin( Paddr, RIO_PCI_MEM_SIZE, &Caddr );
947 rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at 0x%x\n", RIO_PCI_MEM_SIZE, (int)Paddr);
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);
959 ** Board has passed its scrub test. Fill in all the
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;
972 WBYTE(p->RIOHosts[p->RIONumHosts].Control,
973 BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
974 p->RIOHosts[p->RIONumHosts].Mode |
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 |
981 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff);
983 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff);
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);
991 rio_dprintk (RIO_DEBUG_INIT, "Unique no 0x%x.\n",
992 p->RIOHosts[p->RIONumHosts].UniqueNum);
994 p->RIOLastPCISearch = RIO_SUCCESS;
1001 if ( slot >= MAX_PCI_SLOT ) {
1002 rio_dprintk (RIO_DEBUG_INIT, "All %d PCI slots have tested for RIO cards !!!\n",
1008 ** I don't think we want to do this anymore
1011 if (!p->RIOLastPCISearch == RIO_FAIL ) {
1019 #ifdef FUTURE_RELEASE
1020 void riohalt( void )
1023 for ( host=0; host<p->RIONumHosts; host++ )
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 );
1032 static uchar val[] = {
1033 #ifdef VERY_LONG_TEST
1034 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
1035 0xa5, 0xff, 0x5a, 0x00, 0xff, 0xc9, 0x36,
1039 #define TEST_END sizeof(val)
1042 ** RAM test a board.
1043 ** Nothing too complicated, just enough to check it out.
1046 RIOBoardTest(paddr, caddr, type, slot)
1052 struct DpRam *DpRam = (struct DpRam *)caddr;
1058 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=0x%x, slot=%d\n",
1059 type,(int)DpRam, slot);
1061 RIOHostReset(type, DpRam, slot);
1064 ** Scrub the memory. This comes in several banks:
1065 ** DPsram1 - 7000h bytes
1066 ** DPsram2 - 200h bytes
1067 ** DPsram3 - 7000h bytes
1068 ** scratch - 1000h bytes
1071 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Setup ram/size arrays\n");
1073 size[0] = DP_SRAM1_SIZE;
1074 size[1] = DP_SRAM2_SIZE;
1075 size[2] = DP_SRAM3_SIZE;
1076 size[3] = DP_SCRATCH_SIZE;
1078 ram[0] = (char *)&DpRam->DpSram1[0];
1079 ram[1] = (char *)&DpRam->DpSram2[0];
1080 ram[2] = (char *)&DpRam->DpSram3[0];
1081 nbanks = (type == RIO_PCI) ? 3 : 4;
1083 ram[3] = (char *)&DpRam->DpScratch[0];
1087 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n",
1088 (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2]);
1090 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n",
1091 (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2], (int)ram[3],
1096 ** This scrub operation will test for crosstalk between
1097 ** banks. TEST_END is a magic number, and relates to the offset
1098 ** within the 'val' array used by Scrub.
1100 for (op=0; op<TEST_END; op++) {
1101 for (bank=0; bank<nbanks; bank++) {
1102 if (RIOScrub(op, (BYTE *)ram[bank], size[bank]) == RIO_FAIL) {
1103 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: RIOScrub band %d, op %d failed\n",
1110 rio_dprintk (RIO_DEBUG_INIT, "Test completed\n");
1116 ** Scrub an area of RAM.
1117 ** Define PRETEST and POSTTEST for a more thorough checking of the
1118 ** state of the memory.
1119 ** Call with op set to an index into the above 'val' array to determine
1120 ** which value will be written into memory.
1121 ** Call with op set to zero means that the RAM will not be read and checked
1122 ** before it is written.
1123 ** Call with op not zero, and the RAM will be read and compated with val[op-1]
1124 ** to check that the data from the previous phase was retained.
1127 RIOScrub(op, ram, size)
1133 unsigned char oldbyte;
1134 unsigned char newbyte;
1135 unsigned char invbyte;
1136 unsigned short oldword;
1137 unsigned short newword;
1138 unsigned short invword;
1139 unsigned short swapword;
1142 oldbyte = val[op-1];
1143 oldword = oldbyte | (oldbyte<<8);
1145 oldbyte = oldword = 0; /* Tell the compiler we've initilalized them. */
1147 newword = newbyte | (newbyte<<8);
1149 invword = invbyte | (invbyte<<8);
1152 ** Check that the RAM contains the value that should have been left there
1153 ** by the previous test (not applicable for pass zero)
1156 for (off=0; off<size; off++) {
1157 if (RBYTE(ram[off]) != oldbyte) {
1158 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]));
1162 for (off=0; off<size; off+=2) {
1163 if (*(ushort *)&ram[off] != oldword) {
1164 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]);
1165 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]));
1172 ** Now write the INVERSE of the test data into every location, using
1173 ** BYTE write operations, first checking before each byte is written
1174 ** that the location contains the old value still, and checking after
1175 ** the write that the location contains the data specified - this is
1176 ** the BYTE read/write test.
1178 for (off=0; off<size; off++) {
1179 if (op && (RBYTE(ram[off]) != oldbyte)) {
1180 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]));
1183 WBYTE(ram[off],invbyte);
1184 if (RBYTE(ram[off]) != invbyte) {
1185 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]));
1191 ** now, use WORD operations to write the test value into every location,
1192 ** check as before that the location contains the previous test value
1193 ** before overwriting, and that it contains the data value written
1195 ** This is the WORD operation test.
1197 for (off=0; off<size; off+=2) {
1198 if (*(ushort *)&ram[off] != invword) {
1199 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]);
1200 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]));
1204 *(ushort *)&ram[off] = newword;
1205 if ( *(ushort *)&ram[off] != newword ) {
1206 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]);
1207 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]));
1213 ** now run through the block of memory again, first in byte mode
1214 ** then in word mode, and check that all the locations contain the
1215 ** required test data.
1217 for (off=0; off<size; off++) {
1218 if (RBYTE(ram[off]) != newbyte) {
1219 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]));
1224 for (off=0; off<size; off+=2) {
1225 if ( *(ushort *)&ram[off] != newword ) {
1226 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]);
1227 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]));
1233 ** time to check out byte swapping errors
1235 swapword = invbyte | (newbyte << 8);
1237 for (off=0; off<size; off+=2) {
1238 WBYTE(ram[off],invbyte);
1239 WBYTE(ram[off+1],newbyte);
1242 for ( off=0; off<size; off+=2 ) {
1243 if (*(ushort *)&ram[off] != swapword) {
1244 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]));
1245 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]));
1248 *((ushort *)&ram[off]) = ~swapword;
1251 for (off=0; off<size; off+=2) {
1252 if (RBYTE(ram[off]) != newbyte) {
1253 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]));
1256 if (RBYTE(ram[off+1]) != invbyte) {
1257 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]));
1260 *((ushort *)&ram[off]) = newword;
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.
1274 RIOAllocateInterrupts(p)
1275 struct rio_info * p;
1280 ** Easy case - if we have been told to poll, then we poll.
1282 if (p->mode & POLLED_MODE) {
1283 RIOStopInterrupts(p, 0, 0);
1288 ** check - if any host has been set to polled mode, then all must be.
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 );
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 );
1308 ** something has decided that we can't be doing with these
1309 ** new-fangled interrupt thingies. Set everything up to just
1313 RIOStopInterrupts(p, Reason, Host)
1314 struct rio_info * p;
1318 #ifdef FUTURE_RELEASE
1320 case 0: /* forced into polling by rio_polled */
1322 case 1: /* SCU has set 'Host' into polled mode */
1324 case 2: /* there aren't enough interrupt vectors for 'Host' */
1329 for (Host=0; Host<p->RIONumHosts; Host++ ) {
1330 struct Host *HostP = &p->RIOHosts[Host];
1332 switch (HostP->Type) {
1335 ** The AT host has it's interrupts disabled by clearing the
1338 HostP->Mode &= ~INTERRUPT_ENABLE;
1339 HostP->Ivec = POLLED;
1341 #ifdef FUTURE_RELEASE
1344 ** The EISA host has it's interrupts disabled by setting the
1347 HostP->Ivec = POLLED;
1352 ** The PCI host has it's interrupts disabled by clearing the
1353 ** int_enable bit, like a regular host card.
1355 HostP->Mode &= ~RIO_PCI_INT_ENABLE;
1356 HostP->Ivec = POLLED;
1358 #ifdef FUTURE_RELEASE
1361 ** There's always one, isn't there?
1362 ** The MCA host card cannot have it's interrupts disabled.
1372 ** This function is called at init time to setup the data structures.
1375 RIOAllocDataStructs(p)
1376 struct rio_info * p;
1382 p->RIOPortp = (struct Port *)sysbrk(RIO_PORTS * sizeof(struct Port));
1384 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for port structures\n");
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));
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 */
1402 p->RIOHosts = (struct Host *)sysbrk(RIO_HOSTS * sizeof(struct Host));
1404 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for host structures\n");
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));
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 */
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.
1421 for ( tm = 1; tm && tm <= p->RIOConf.BufferSize; tm <<= 1 )
1424 p->RIOBufferSize = tm;
1425 p->RIOBufferMask = tm ? tm - 1 : 0;
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?)
1433 RIOSetupDataStructs(p)
1434 struct rio_info * p;
1436 int host, entry, rup;
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;
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;
1452 RIODefaultName(p, HostP, rup);
1454 spin_lock_init(&HostP->UnixRups[rup].RupLock);
1461 RIODefaultName(p, HostP, UnitId)
1462 struct rio_info * p;
1463 struct Host * HostP;
1468 CheckUnitId( UnitId );
1470 bcopy("UNKNOWN RTA X-XX",HostP->Mapping[UnitId].Name,17);
1471 HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts);
1472 if ((UnitId+1) > 9) {
1473 HostP->Mapping[UnitId].Name[14]='0'+((UnitId+1)/10);
1474 HostP->Mapping[UnitId].Name[15]='0'+((UnitId+1)%10);
1477 HostP->Mapping[UnitId].Name[14]='1'+UnitId;
1478 HostP->Mapping[UnitId].Name[15]=0;
1483 #define RIO_RELEASE "Linux"
1484 #define RELEASE_ID "1.0"
1489 struct rio_info * p;
1491 char * RIORelease = RIO_RELEASE;
1492 char * RIORelID = RELEASE_ID;
1495 rio_dprintk (RIO_DEBUG_INIT, "RIO : Release: %s ID: %s\n", RIORelease, RIORelID);
1497 if ( p->RIONumHosts==0 ) {
1498 rio_dprintk (RIO_DEBUG_INIT, "\nNo Hosts configured\n");
1502 for ( host=0; host < p->RIONumHosts; host++ ) {
1503 struct Host *HostP = &p->RIOHosts[host];
1504 switch ( HostP->Type ) {
1506 rio_dprintk (RIO_DEBUG_INIT, "AT BUS : found the card at 0x%x\n", HostP->PaddrP);
1513 static struct rioVersion stVersion;
1518 strlcpy(stVersion.version, "RIO driver for linux V1.0",
1519 sizeof(stVersion.version));
1520 strlcpy(stVersion.buildDate, __DATE__,
1521 sizeof(stVersion.buildDate));
1528 RIOMapin(paddr, size, vaddr)
1533 *vaddr = (caddr_t)permap( (long)paddr, size);
1534 return ((int)*vaddr);
1538 RIOMapout(paddr, size, vaddr)
1548 RIOHostReset(Type, DpRamP, Slot)
1550 volatile struct DpRam *DpRamP;
1556 rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: type 0x%x", Type);
1559 rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n");
1560 WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
1561 INTERRUPT_DISABLE | BYTE_OPERATION |
1562 SLOW_LINKS | SLOW_AT_BUS);
1563 WBYTE(DpRamP->DpResetTpu, 0xFF);
1566 rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n");
1567 WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
1568 INTERRUPT_DISABLE | BYTE_OPERATION |
1569 SLOW_LINKS | SLOW_AT_BUS);
1570 WBYTE(DpRamP->DpResetTpu, 0xFF);
1573 #ifdef FUTURE_RELEASE
1576 ** Bet this doesn't work!
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 );
1585 OUTBZ( Slot, EISA_CONTROL_PORT,
1586 EISA_TP_RUN | EISA_TP_BUS_DISABLE |
1587 EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM );
1590 WBYTE(DpRamP->DpControl , McaTpBootFromRam | McaTpBusDisable );
1591 WBYTE(DpRamP->DpResetTpu , 0xFF );
1593 WBYTE(DpRamP->DpControl , McaTpBootFromRam | McaTpBusDisable );
1594 WBYTE(DpRamP->DpResetTpu , 0xFF );
1599 rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n");
1600 DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM;
1601 DpRamP->DpResetInt = 0xFF;
1602 DpRamP->DpResetTpu = 0xFF;
1604 /* for (i=0; i<6000; i++); */
1607 #ifdef FUTURE_RELEASE
1609 Rprintf(RIOMesgNoSupport,Type,DpRamP,Slot);
1614 rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n");