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>
41 #include <asm/system.h>
42 #include <asm/string.h>
43 #include <asm/semaphore.h>
44 #include <asm/uaccess.h>
46 #include <linux/termios.h>
47 #include <linux/serial.h>
49 #include <linux/generic_serial.h>
52 #include "linux_compat.h"
82 #include "rio_linux.h"
85 #define bcopy rio_pcicopy
88 RIOPCIinit(struct rio_info *p, int Mode);
92 extern int rio_intr();
100 struct RioHostInfo * info;
103 ** Multi-Host card support - taking the easy way out - sorry !
104 ** We allocate and set up the Host and Port structs when the
105 ** driver is called to 'install' the first host.
106 ** We check for this first 'call' by testing the RIOPortp pointer.
110 rio_dprintk (RIO_DEBUG_INIT, "Allocating and setting up driver data structures\n");
112 RIOAllocDataStructs(p); /* allocate host/port structs */
113 RIOSetupDataStructs(p); /* setup topology structs */
116 RIOInitHosts( p, info ); /* hunt down the hardware */
118 RIOAllocateInterrupts(p); /* allocate interrupts */
119 RIOReport(p); /* show what we found */
123 ** Initialise the Cards
126 RIOInitHosts(p, info)
128 struct RioHostInfo * info;
131 ** 15.10.1998 ARG - ESIL 0762 part fix
132 ** If there is no ISA card definition - we always look for PCI cards.
133 ** As we currently only support one host card this lets an ISA card
134 ** definition take precedence over PLUG and PLAY.
135 ** No ISA card - we are PLUG and PLAY with PCI.
139 ** Note - for PCI both these will be zero, that's okay because
140 ** RIOPCIInit() fills them in if a card is found.
142 p->RIOHosts[p->RIONumHosts].Ivec = info->vector;
143 p->RIOHosts[p->RIONumHosts].PaddrP = info->location;
146 ** Check that we are able to accommodate another host
148 if ( p->RIONumHosts >= RIO_HOSTS )
154 if ( info->bus & ISA_BUS )
156 rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (ISA)\n", p->RIONumHosts);
157 RIOISAinit(p, p->mode);
161 rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (PCI)\n", p->RIONumHosts);
162 RIOPCIinit(p, RIO_PCI_DEFAULT_MODE);
165 rio_dprintk (RIO_DEBUG_INIT, "Total hosts initialised so far : %d\n", p->RIONumHosts);
168 #ifdef FUTURE_RELEASE
169 if (p->bus & EISA_BUS)
171 RIOEISAinit(p, RIO_EISA_DEFAULT_MODE);
173 if (p->bus & MCA_BUS)
175 RIOMCAinit(p, RIO_MCA_DEFAULT_MODE);
180 ** go through memory for an AT host that we pass in the device info
181 ** structure and initialise
189 /* XXX Need to implement this. */
191 p->intr_tid = iointset(p->RIOHosts[p->RIONumHosts].Ivec,
192 (int (*)())rio_intr, (char*)p->RIONumHosts);
194 rio_dprintk (RIO_DEBUG_INIT, "Set interrupt handler, intr_tid = 0x%x\n", p->intr_tid );
196 if (RIODoAT(p, p->RIOHosts[p->RIONumHosts].PaddrP, mode)) {
200 rio_dprintk (RIO_DEBUG_INIT, "RIODoAT failed\n");
210 ** Map in a boards physical address, check that the board is there,
211 ** test the board and if everything is okay assign the board an entry
212 ** in the Rio Hosts structure.
215 RIODoAT(p, Base, mode)
226 ** Check to see if we actually have a board at this physical address.
228 if ((cardAddr = RIOCheckForATCard(Base)) != 0) {
230 ** Now test the board to see if it is working.
232 if (RIOBoardTest(Base, cardAddr, RIO_AT, 0) == RIO_SUCCESS) {
234 ** Fill out a slot in the Rio host structure.
236 if (RIOAssignAT(p, Base, cardAddr, mode)) {
240 RIOMapout(Base, RIO_AT_MEM_SIZE, cardAddr);
246 RIOCheckForATCard(Base)
250 struct DpRam *cardp; /* (Points at the host) */
252 unsigned char RIOSigTab[24];
254 ** Table of values to search for as prom signature of a host card
256 strcpy(RIOSigTab, "JBJGPGGHINSMJPJR");
259 ** Hey! Yes, You reading this code! Yo, grab a load a this:
261 ** IF the card is using WORD MODE rather than BYTE MODE
262 ** then it will occupy 128K of PHYSICAL memory area. So,
263 ** you might think that the following Mapin is wrong. Well,
264 ** it isn't, because the SECOND 64K of occupied space is an
265 ** EXACT COPY of the FIRST 64K. (good?), so, we need only
266 ** map it in in one 64K block.
268 if (RIOMapin(Base, RIO_AT_MEM_SIZE, &virtAddr) == -1) {
269 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Couldn't map the board in!\n");
274 ** virtAddr points to the DP ram of the system.
275 ** We now cast this to a pointer to a RIO Host,
276 ** and have a rummage about in the PROM.
278 cardp = (struct DpRam *)virtAddr;
280 for (off=0; RIOSigTab[off]; off++) {
281 if ((RBYTE(cardp->DpSignature[off]) & 0xFF) != RIOSigTab[off]) {
283 ** Signature mismatch - card not at this address
285 RIOMapout(Base, RIO_AT_MEM_SIZE, virtAddr);
286 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Couldn't match the signature 0x%x 0x%x!\n",
293 ** If we get here then we must have found a valid board so return
294 ** its virtual address.
303 ** Fill out the fields in the p->RIOHosts structure now we know we know
304 ** we have a board present.
306 ** bits < 0 indicates 8 bit operation requested,
307 ** bits > 0 indicates 16 bit operation.
310 RIOAssignAT(p, Base, virtAddr, mode)
317 struct DpRam *cardp = (struct DpRam *)virtAddr;
319 if ((Base < ONE_MEG) || (mode & BYTE_ACCESS_MODE))
320 bits = BYTE_OPERATION;
322 bits = WORD_OPERATION;
325 ** Board has passed its scrub test. Fill in all the
328 p->RIOHosts[p->RIONumHosts].Caddr = virtAddr;
329 p->RIOHosts[p->RIONumHosts].CardP = (struct DpRam *)virtAddr;
332 ** Revision 01 AT host cards don't support WORD operations,
334 if ( RBYTE(cardp->DpRevision) == 01 )
335 bits = BYTE_OPERATION;
337 p->RIOHosts[p->RIONumHosts].Type = RIO_AT;
338 p->RIOHosts[p->RIONumHosts].Copy = bcopy;
340 p->RIOHosts[p->RIONumHosts].Slot = -1;
341 p->RIOHosts[p->RIONumHosts].Mode = SLOW_LINKS | SLOW_AT_BUS | bits;
342 WBYTE(p->RIOHosts[p->RIONumHosts].Control,
343 BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
344 p->RIOHosts[p->RIONumHosts].Mode |
346 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff);
347 WBYTE(p->RIOHosts[p->RIONumHosts].Control,
348 BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
349 p->RIOHosts[p->RIONumHosts].Mode |
351 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff);
352 p->RIOHosts[p->RIONumHosts].UniqueNum =
353 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)|
354 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)|
355 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)|
356 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24);
357 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Uniquenum 0x%x\n",p->RIOHosts[p->RIONumHosts].UniqueNum);
360 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Tests Passed at 0x%x\n", Base);
364 #ifdef FUTURE_RELEASE
365 int RIOMCAinit(int Mode)
375 ** Valid mode information for MCA cards
376 ** is only FAST LINKS
378 Mode = (Mode & FAST_LINKS) ? McaTpFastLinks : McaTpSlowLinks;
379 rio_dprintk (RIO_DEBUG_INIT, "RIOMCAinit(%d)\n",Mode);
383 ** Check out each of the slots
385 for (SlotNumber = 0; SlotNumber < McaMaxSlots; SlotNumber++) {
387 ** Enable the slot we want to talk to
389 outb( McaSlotSelect, SlotNumber | McaSlotEnable );
392 ** Read the ID word from the slot
394 if (((inb(McaIdHigh)<< 8)|inb(McaIdLow)) == McaRIOId)
396 rio_dprintk (RIO_DEBUG_INIT, "Potential MCA card in slot %d\n", SlotNumber);
399 ** Card appears to be a RIO MCA card!
401 RIOMachineType |= (1<<RIO_MCA);
404 ** Just check we haven't found too many wonderful objects
406 if ( RIONumHosts >= RIO_HOSTS )
408 Rprintf(RIOMesgTooManyCards);
413 ** McaIrqEnable contains the interrupt vector, and a card
416 Ivec = inb(McaIrqEnable);
418 rio_dprintk (RIO_DEBUG_INIT, "Ivec is %x\n", Ivec);
420 switch ( Ivec & McaIrqMask )
423 rio_dprintk (RIO_DEBUG_INIT, "IRQ9\n");
426 rio_dprintk (RIO_DEBUG_INIT, "IRQ3\n");
429 rio_dprintk (RIO_DEBUG_INIT, "IRQ4\n");
432 rio_dprintk (RIO_DEBUG_INIT, "IRQ7\n");
435 rio_dprintk (RIO_DEBUG_INIT, "IRQ10\n");
438 rio_dprintk (RIO_DEBUG_INIT, "IRQ11\n");
441 rio_dprintk (RIO_DEBUG_INIT, "IRQ12\n");
444 rio_dprintk (RIO_DEBUG_INIT, "IRQ15\n");
449 ** If the card enable bit isn't set, then set it!
451 if ((Ivec & McaCardEnable) != McaCardEnable) {
452 rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable not set - setting!\n");
453 outb(McaIrqEnable,Ivec|McaCardEnable);
455 rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable already set\n");
458 ** Convert the IRQ enable mask into something useful
460 Ivec = RIOMcaToIvec[Ivec & McaIrqMask];
463 ** Find the physical address
465 rio_dprintk (RIO_DEBUG_INIT, "inb(McaMemory) is %x\n", inb(McaMemory));
466 Paddr = McaAddress(inb(McaMemory));
468 rio_dprintk (RIO_DEBUG_INIT, "MCA card has Ivec %d Addr %x\n", Ivec, Paddr);
474 ** Tell the memory mapper that we want to talk to it
476 Handle = RIOMapin( Paddr, RIO_MCA_MEM_SIZE, &Caddr );
478 if ( Handle == -1 ) {
479 rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at %x\n", RIO_MCA_MEM_SIZE, Paddr;
483 rio_dprintk (RIO_DEBUG_INIT, "Board mapped to vaddr 0x%x\n", Caddr);
486 ** And check that it is actually there!
488 if ( RIOBoardTest( Paddr,Caddr,RIO_MCA,SlotNumber ) == RIO_SUCCESS )
490 rio_dprintk (RIO_DEBUG_INIT, "Board has passed test\n");
491 rio_dprintk (RIO_DEBUG_INIT, "Slot %d. Type %d. Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n",
492 SlotNumber, RIO_MCA, Paddr, Caddr, Mode);
495 ** Board has passed its scrub test. Fill in all the
498 p->RIOHosts[RIONumHosts].Slot = SlotNumber;
499 p->RIOHosts[RIONumHosts].Ivec = Ivec;
500 p->RIOHosts[RIONumHosts].Type = RIO_MCA;
501 p->RIOHosts[RIONumHosts].Copy = bcopy;
502 p->RIOHosts[RIONumHosts].PaddrP = Paddr;
503 p->RIOHosts[RIONumHosts].Caddr = Caddr;
504 p->RIOHosts[RIONumHosts].CardP = (struct DpRam *)Caddr;
505 p->RIOHosts[RIONumHosts].Mode = Mode;
506 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt , 0xff);
507 p->RIOHosts[RIONumHosts].UniqueNum =
508 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[0])&0xFF)<<0)|
509 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[1])&0xFF)<<8)|
510 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[2])&0xFF)<<16)|
511 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[3])&0xFF)<<24);
518 ** It failed the test, so ignore it.
520 rio_dprintk (RIO_DEBUG_INIT, "TEST FAILED\n");
521 RIOMapout(Paddr, RIO_MCA_MEM_SIZE, Caddr );
526 rio_dprintk (RIO_DEBUG_INIT, "Slot %d - Paddr zero!\n", SlotNumber);
531 rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber);
535 ** Now we have checked all the slots, turn off the MCA slot selector
537 outb(McaSlotSelect,0);
538 rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber);
542 int RIOEISAinit( int Mode )
544 static int EISADone = 0;
546 int PollIntMixMsgDone = 0;
554 ** The only valid mode information for EISA hosts is fast or slow
557 Mode = (Mode & FAST_LINKS) ? EISA_TP_FAST_LINKS : EISA_TP_SLOW_LINKS;
561 rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit() - already done, return.\n");
567 rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit()\n");
571 ** First check all cards to see if ANY are set for polled mode operation.
572 ** If so, set ALL to polled.
575 for ( EisaSlot=1; EisaSlot<=RIO_MAX_EISA_SLOTS; EisaSlot++ )
577 Ident = (INBZ(EisaSlot,EISA_PRODUCT_IDENT_HI)<<8) |
578 INBZ(EisaSlot,EISA_PRODUCT_IDENT_LO);
580 if ( Ident == RIO_EISA_IDENT )
582 rio_dprintk (RIO_DEBUG_INIT, "Found Specialix product\n");
584 if ( INBZ(EisaSlot,EISA_PRODUCT_NUMBER) != RIO_EISA_PRODUCT_CODE )
586 rio_dprintk (RIO_DEBUG_INIT, "Not Specialix RIO - Product number %x\n",
587 INBZ(EisaSlot, EISA_PRODUCT_NUMBER));
588 continue; /* next slot */
591 ** Its a Specialix RIO!
593 rio_dprintk (RIO_DEBUG_INIT, "RIO Revision %d\n",
594 INBZ(EisaSlot, EISA_REVISION_NUMBER));
596 RIOMachineType |= (1<<RIO_EISA);
599 ** Just check we haven't found too many wonderful objects
601 if ( RIONumHosts >= RIO_HOSTS )
603 Rprintf(RIOMesgTooManyCards);
608 ** Ensure that the enable bit is set!
610 OUTBZ( EisaSlot, EISA_ENABLE, RIO_EISA_ENABLE_BIT );
613 ** EISA_INTERRUPT_VEC contains the interrupt vector.
615 Ivec = INBZ(EisaSlot,EISA_INTERRUPT_VEC);
618 switch ( Ivec & EISA_INTERRUPT_MASK )
621 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 3\n");
624 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 4\n");
627 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 5\n");
630 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 6\n");
633 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 7\n");
636 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 9\n");
639 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 10\n");
642 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 11\n");
645 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 12\n");
648 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 14\n");
651 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 15\n");
654 rio_dprintk (RIO_DEBUG_INIT, "EISA POLLED\n");
657 rio_dprintk (RIO_DEBUG_INIT, NULL,DBG_INIT|DBG_FAIL,"Shagged interrupt number!\n");
658 Ivec &= EISA_CONTROL_MASK;
662 if ( (Ivec & EISA_INTERRUPT_MASK) ==
666 break; /* From EisaSlot loop */
672 ** Do it all again now we know whether to change all cards to polled
676 for ( EisaSlot=1; EisaSlot<=RIO_MAX_EISA_SLOTS; EisaSlot++ )
678 Ident = (INBZ(EisaSlot,EISA_PRODUCT_IDENT_HI)<<8) |
679 INBZ(EisaSlot,EISA_PRODUCT_IDENT_LO);
681 if ( Ident == RIO_EISA_IDENT )
683 if ( INBZ(EisaSlot,EISA_PRODUCT_NUMBER) != RIO_EISA_PRODUCT_CODE )
684 continue; /* next slot */
687 ** Its a Specialix RIO!
691 ** Ensure that the enable bit is set!
693 OUTBZ( EisaSlot, EISA_ENABLE, RIO_EISA_ENABLE_BIT );
696 ** EISA_INTERRUPT_VEC contains the interrupt vector.
698 Ivec = INBZ(EisaSlot,EISA_INTERRUPT_VEC);
703 ** If we are going to operate in polled mode, but this
704 ** board is configured to be interrupt driven, display
705 ** the message explaining the situation to the punter,
706 ** assuming we haven't already done so.
709 if ( !PollIntMixMsgDone &&
710 (Ivec & EISA_INTERRUPT_MASK) != EISA_POLLED )
712 Rprintf(RIOMesgAllPolled);
713 PollIntMixMsgDone = 1;
717 ** Ungraciously ignore whatever the board reports as its
718 ** interrupt vector...
721 Ivec &= ~EISA_INTERRUPT_MASK;
724 ** ...and force it to dance to the poll tune.
731 ** Convert the IRQ enable mask into something useful (0-15)
733 Ivec = RIOEisaToIvec(Ivec);
735 rio_dprintk (RIO_DEBUG_INIT, "EISA host in slot %d has Ivec 0x%x\n",
739 ** Find the physical address
741 Paddr = (INBZ(EisaSlot,EISA_MEMORY_BASE_HI)<<24) |
742 (INBZ(EisaSlot,EISA_MEMORY_BASE_LO)<<16);
744 rio_dprintk (RIO_DEBUG_INIT, "EISA card has Ivec %d Addr %x\n", Ivec, Paddr);
748 rio_dprintk (RIO_DEBUG_INIT,
749 "Board in slot %d configured for address zero!\n", EisaSlot);
754 ** Tell the memory mapper that we want to talk to it
756 rio_dprintk (RIO_DEBUG_INIT, "About to map EISA card \n");
758 if (RIOMapin( Paddr, RIO_EISA_MEM_SIZE, &Caddr) == -1) {
759 rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at %x\n",
760 RIO_EISA_MEM_SIZE,Paddr);
764 rio_dprintk (RIO_DEBUG_INIT, "Board mapped to vaddr 0x%x\n", Caddr);
767 ** And check that it is actually there!
769 if ( RIOBoardTest( Paddr,Caddr,RIO_EISA,EisaSlot) == RIO_SUCCESS )
771 rio_dprintk (RIO_DEBUG_INIT, "Board has passed test\n");
772 rio_dprintk (RIO_DEBUG_INIT,
773 "Slot %d. Ivec %d. Type %d. Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n",
774 EisaSlot,Ivec,RIO_EISA,Paddr,Caddr,Mode);
777 ** Board has passed its scrub test. Fill in all the
780 p->RIOHosts[RIONumHosts].Slot = EisaSlot;
781 p->RIOHosts[RIONumHosts].Ivec = Ivec;
782 p->RIOHosts[RIONumHosts].Type = RIO_EISA;
783 p->RIOHosts[RIONumHosts].Copy = bcopy;
784 p->RIOHosts[RIONumHosts].PaddrP = Paddr;
785 p->RIOHosts[RIONumHosts].Caddr = Caddr;
786 p->RIOHosts[RIONumHosts].CardP = (struct DpRam *)Caddr;
787 p->RIOHosts[RIONumHosts].Mode = Mode;
789 ** because the EISA prom is mapped into IO space, we
790 ** need to copy the unqiue number into the memory area
791 ** that it would have occupied, so that the download
792 ** code can determine its ID and card type.
794 WBYTE(p->RIOHosts[RIONumHosts].Unique[0],INBZ(EisaSlot,EISA_UNIQUE_NUM_0));
795 WBYTE(p->RIOHosts[RIONumHosts].Unique[1],INBZ(EisaSlot,EISA_UNIQUE_NUM_1));
796 WBYTE(p->RIOHosts[RIONumHosts].Unique[2],INBZ(EisaSlot,EISA_UNIQUE_NUM_2));
797 WBYTE(p->RIOHosts[RIONumHosts].Unique[3],INBZ(EisaSlot,EISA_UNIQUE_NUM_3));
798 p->RIOHosts[RIONumHosts].UniqueNum =
799 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[0])&0xFF)<<0)|
800 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[1])&0xFF)<<8)|
801 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[2])&0xFF)<<16)|
802 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[3])&0xFF)<<24);
803 INBZ(EisaSlot,EISA_INTERRUPT_RESET);
810 ** It failed the test, so ignore it.
812 rio_dprintk (RIO_DEBUG_INIT, "TEST FAILED\n");
814 RIOMapout(Paddr, RIO_EISA_MEM_SIZE, Caddr );
818 if (RIOMachineType & RIO_EISA)
827 #define CONFIG_ADDRESS 0xcf8
828 #define CONFIG_DATA 0xcfc
829 #define FORWARD_REG 0xcfa
833 read_config(int bus_number, int device_num, int r_number)
839 Build config_address_value:
841 31 24 23 16 15 11 10 8 7 0
842 ------------------------------------------------------
843 |1| 0000000 | bus_number | device # | 000 | register |
844 ------------------------------------------------------
847 cav = r_number & 0xff;
848 cav |= ((device_num & 0x1f) << 11);
849 cav |= ((bus_number & 0xff) << 16);
850 cav |= 0x80000000; /* Enable bit */
851 outpd(CONFIG_ADDRESS,cav);
852 val = inpd(CONFIG_DATA);
853 outpd(CONFIG_ADDRESS,0);
858 write_config(bus_number,device_num,r_number,val)
863 Build config_address_value:
865 31 24 23 16 15 11 10 8 7 0
866 ------------------------------------------------------
867 |1| 0000000 | bus_number | device # | 000 | register |
868 ------------------------------------------------------
871 cav = r_number & 0xff;
872 cav |= ((device_num & 0x1f) << 11);
873 cav |= ((bus_number & 0xff) << 16);
874 cav |= 0x80000000; /* Enable bit */
875 outpd(CONFIG_ADDRESS, cav);
876 outpd(CONFIG_DATA, val);
877 outpd(CONFIG_ADDRESS, 0);
881 /* XXX Implement these... */
883 read_config(int bus_number, int device_num, int r_number)
889 write_config(int bus_number, int device_num, int r_number)
901 #define MAX_PCI_SLOT 32
902 #define RIO_PCI_JET_CARD 0x200011CB
904 static int slot; /* count of machine's PCI slots searched so far */
905 caddr_t Caddr; /* Virtual address of the current PCI host card. */
906 unsigned char Ivec; /* interrupt vector for the current PCI host */
907 unsigned long Paddr; /* Physical address for the current PCI host */
908 int Handle; /* Handle to Virtual memory allocated for current PCI host */
911 rio_dprintk (RIO_DEBUG_INIT, "Search for a RIO PCI card - start at slot %d\n", slot);
914 ** Initialise the search status
916 p->RIOLastPCISearch = RIO_FAIL;
918 while ( (slot < MAX_PCI_SLOT) & (p->RIOLastPCISearch != RIO_SUCCESS) )
920 rio_dprintk (RIO_DEBUG_INIT, "Currently testing slot %d\n", slot);
922 if (read_config(0,slot,0) == RIO_PCI_JET_CARD) {
923 p->RIOHosts[p->RIONumHosts].Ivec = 0;
924 Paddr = read_config(0,slot,0x18);
925 Paddr = Paddr - (Paddr & 0x1); /* Mask off the io bit */
927 if ( (Paddr == 0) || ((Paddr & 0xffff0000) == 0xffff0000) ) {
928 rio_dprintk (RIO_DEBUG_INIT, "Goofed up slot\n"); /* what! */
933 p->RIOHosts[p->RIONumHosts].PaddrP = Paddr;
934 Ivec = (read_config(0,slot,0x3c) & 0xff);
936 rio_dprintk (RIO_DEBUG_INIT, "PCI Host at 0x%x, Intr %d\n", (int)Paddr, Ivec);
938 Handle = RIOMapin( Paddr, RIO_PCI_MEM_SIZE, &Caddr );
940 rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at 0x%x\n", RIO_PCI_MEM_SIZE, (int)Paddr);
944 p->RIOHosts[p->RIONumHosts].Ivec = Ivec + 32;
945 p->intr_tid = iointset(p->RIOHosts[p->RIONumHosts].Ivec,
946 (int (*)())rio_intr, (char *)p->RIONumHosts);
947 if (RIOBoardTest( Paddr, Caddr, RIO_PCI, 0 ) == RIO_SUCCESS) {
948 rio_dprintk (RIO_DEBUG_INIT, ("Board has passed test\n");
949 rio_dprintk (RIO_DEBUG_INIT, ("Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n", Paddr, Caddr, Mode);
952 ** Board has passed its scrub test. Fill in all the
955 p->RIOHosts[p->RIONumHosts].Slot = 0;
956 p->RIOHosts[p->RIONumHosts].Ivec = Ivec + 32;
957 p->RIOHosts[p->RIONumHosts].Type = RIO_PCI;
958 p->RIOHosts[p->RIONumHosts].Copy = rio_pcicopy;
959 p->RIOHosts[p->RIONumHosts].PaddrP = Paddr;
960 p->RIOHosts[p->RIONumHosts].Caddr = Caddr;
961 p->RIOHosts[p->RIONumHosts].CardP = (struct DpRam *)Caddr;
962 p->RIOHosts[p->RIONumHosts].Mode = Mode;
965 WBYTE(p->RIOHosts[p->RIONumHosts].Control,
966 BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
967 p->RIOHosts[p->RIONumHosts].Mode |
969 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff);
970 WBYTE(p->RIOHosts[p->RIONumHosts].Control,
971 BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
972 p->RIOHosts[p->RIONumHosts].Mode |
974 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff);
976 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff);
978 p->RIOHosts[p->RIONumHosts].UniqueNum =
979 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)|
980 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)|
981 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)|
982 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24);
984 rio_dprintk (RIO_DEBUG_INIT, "Unique no 0x%x.\n",
985 p->RIOHosts[p->RIONumHosts].UniqueNum);
987 p->RIOLastPCISearch = RIO_SUCCESS;
994 if ( slot >= MAX_PCI_SLOT ) {
995 rio_dprintk (RIO_DEBUG_INIT, "All %d PCI slots have tested for RIO cards !!!\n",
1001 ** I don't think we want to do this anymore
1004 if (!p->RIOLastPCISearch == RIO_FAIL ) {
1012 #ifdef FUTURE_RELEASE
1013 void riohalt( void )
1016 for ( host=0; host<p->RIONumHosts; host++ )
1018 rio_dprintk (RIO_DEBUG_INIT, "Stop host %d\n", host);
1019 (void)RIOBoardTest( p->RIOHosts[host].PaddrP, p->RIOHosts[host].Caddr, p->RIOHosts[host].Type,p->RIOHosts[host].Slot );
1025 static uchar val[] = {
1026 #ifdef VERY_LONG_TEST
1027 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
1028 0xa5, 0xff, 0x5a, 0x00, 0xff, 0xc9, 0x36,
1032 #define TEST_END sizeof(val)
1035 ** RAM test a board.
1036 ** Nothing too complicated, just enough to check it out.
1039 RIOBoardTest(paddr, caddr, type, slot)
1045 struct DpRam *DpRam = (struct DpRam *)caddr;
1051 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=0x%x, slot=%d\n",
1052 type,(int)DpRam, slot);
1054 RIOHostReset(type, DpRam, slot);
1057 ** Scrub the memory. This comes in several banks:
1058 ** DPsram1 - 7000h bytes
1059 ** DPsram2 - 200h bytes
1060 ** DPsram3 - 7000h bytes
1061 ** scratch - 1000h bytes
1064 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Setup ram/size arrays\n");
1066 size[0] = DP_SRAM1_SIZE;
1067 size[1] = DP_SRAM2_SIZE;
1068 size[2] = DP_SRAM3_SIZE;
1069 size[3] = DP_SCRATCH_SIZE;
1071 ram[0] = (char *)&DpRam->DpSram1[0];
1072 ram[1] = (char *)&DpRam->DpSram2[0];
1073 ram[2] = (char *)&DpRam->DpSram3[0];
1074 nbanks = (type == RIO_PCI) ? 3 : 4;
1076 ram[3] = (char *)&DpRam->DpScratch[0];
1080 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n",
1081 (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2]);
1083 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n",
1084 (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2], (int)ram[3],
1089 ** This scrub operation will test for crosstalk between
1090 ** banks. TEST_END is a magic number, and relates to the offset
1091 ** within the 'val' array used by Scrub.
1093 for (op=0; op<TEST_END; op++) {
1094 for (bank=0; bank<nbanks; bank++) {
1095 if (RIOScrub(op, (BYTE *)ram[bank], size[bank]) == RIO_FAIL) {
1096 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: RIOScrub band %d, op %d failed\n",
1103 rio_dprintk (RIO_DEBUG_INIT, "Test completed\n");
1109 ** Scrub an area of RAM.
1110 ** Define PRETEST and POSTTEST for a more thorough checking of the
1111 ** state of the memory.
1112 ** Call with op set to an index into the above 'val' array to determine
1113 ** which value will be written into memory.
1114 ** Call with op set to zero means that the RAM will not be read and checked
1115 ** before it is written.
1116 ** Call with op not zero, and the RAM will be read and compated with val[op-1]
1117 ** to check that the data from the previous phase was retained.
1120 RIOScrub(op, ram, size)
1126 unsigned char oldbyte;
1127 unsigned char newbyte;
1128 unsigned char invbyte;
1129 unsigned short oldword;
1130 unsigned short newword;
1131 unsigned short invword;
1132 unsigned short swapword;
1135 oldbyte = val[op-1];
1136 oldword = oldbyte | (oldbyte<<8);
1138 oldbyte = oldword = 0; /* Tell the compiler we've initilalized them. */
1140 newword = newbyte | (newbyte<<8);
1142 invword = invbyte | (invbyte<<8);
1145 ** Check that the RAM contains the value that should have been left there
1146 ** by the previous test (not applicable for pass zero)
1149 for (off=0; off<size; off++) {
1150 if (RBYTE(ram[off]) != oldbyte) {
1151 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]));
1155 for (off=0; off<size; off+=2) {
1156 if (*(ushort *)&ram[off] != oldword) {
1157 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]);
1158 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]));
1165 ** Now write the INVERSE of the test data into every location, using
1166 ** BYTE write operations, first checking before each byte is written
1167 ** that the location contains the old value still, and checking after
1168 ** the write that the location contains the data specified - this is
1169 ** the BYTE read/write test.
1171 for (off=0; off<size; off++) {
1172 if (op && (RBYTE(ram[off]) != oldbyte)) {
1173 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]));
1176 WBYTE(ram[off],invbyte);
1177 if (RBYTE(ram[off]) != invbyte) {
1178 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]));
1184 ** now, use WORD operations to write the test value into every location,
1185 ** check as before that the location contains the previous test value
1186 ** before overwriting, and that it contains the data value written
1188 ** This is the WORD operation test.
1190 for (off=0; off<size; off+=2) {
1191 if (*(ushort *)&ram[off] != invword) {
1192 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]);
1193 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]));
1197 *(ushort *)&ram[off] = newword;
1198 if ( *(ushort *)&ram[off] != newword ) {
1199 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]);
1200 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]));
1206 ** now run through the block of memory again, first in byte mode
1207 ** then in word mode, and check that all the locations contain the
1208 ** required test data.
1210 for (off=0; off<size; off++) {
1211 if (RBYTE(ram[off]) != newbyte) {
1212 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]));
1217 for (off=0; off<size; off+=2) {
1218 if ( *(ushort *)&ram[off] != newword ) {
1219 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]);
1220 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]));
1226 ** time to check out byte swapping errors
1228 swapword = invbyte | (newbyte << 8);
1230 for (off=0; off<size; off+=2) {
1231 WBYTE(ram[off],invbyte);
1232 WBYTE(ram[off+1],newbyte);
1235 for ( off=0; off<size; off+=2 ) {
1236 if (*(ushort *)&ram[off] != swapword) {
1237 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]));
1238 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]));
1241 *((ushort *)&ram[off]) = ~swapword;
1244 for (off=0; off<size; off+=2) {
1245 if (RBYTE(ram[off]) != newbyte) {
1246 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]));
1249 if (RBYTE(ram[off+1]) != invbyte) {
1250 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]));
1253 *((ushort *)&ram[off]) = newword;
1259 ** try to ensure that every host is either in polled mode
1260 ** or is in interrupt mode. Only allow interrupt mode if
1261 ** all hosts can interrupt (why?)
1262 ** and force into polled mode if told to. Patch up the
1263 ** interrupt vector & salute The Queen when you've done.
1266 RIOAllocateInterrupts(p)
1267 struct rio_info * p;
1272 ** Easy case - if we have been told to poll, then we poll.
1274 if (p->mode & POLLED_MODE) {
1275 RIOStopInterrupts(p, 0, 0);
1280 ** check - if any host has been set to polled mode, then all must be.
1282 for (Host=0; Host<p->RIONumHosts; Host++) {
1283 if ( (p->RIOHosts[Host].Type != RIO_AT) &&
1284 (p->RIOHosts[Host].Ivec == POLLED) ) {
1285 RIOStopInterrupts(p, 1, Host );
1289 for (Host=0; Host<p->RIONumHosts; Host++) {
1290 if (p->RIOHosts[Host].Type == RIO_AT) {
1291 if ( (p->RIOHosts[Host].Ivec - 32) == 0) {
1292 RIOStopInterrupts(p, 2, Host );
1300 ** something has decided that we can't be doing with these
1301 ** new-fangled interrupt thingies. Set everything up to just
1305 RIOStopInterrupts(p, Reason, Host)
1306 struct rio_info * p;
1310 #ifdef FUTURE_RELEASE
1312 case 0: /* forced into polling by rio_polled */
1314 case 1: /* SCU has set 'Host' into polled mode */
1316 case 2: /* there aren't enough interrupt vectors for 'Host' */
1321 for (Host=0; Host<p->RIONumHosts; Host++ ) {
1322 struct Host *HostP = &p->RIOHosts[Host];
1324 switch (HostP->Type) {
1327 ** The AT host has it's interrupts disabled by clearing the
1330 HostP->Mode &= ~INTERRUPT_ENABLE;
1331 HostP->Ivec = POLLED;
1333 #ifdef FUTURE_RELEASE
1336 ** The EISA host has it's interrupts disabled by setting the
1339 HostP->Ivec = POLLED;
1344 ** The PCI host has it's interrupts disabled by clearing the
1345 ** int_enable bit, like a regular host card.
1347 HostP->Mode &= ~RIO_PCI_INT_ENABLE;
1348 HostP->Ivec = POLLED;
1350 #ifdef FUTURE_RELEASE
1353 ** There's always one, isn't there?
1354 ** The MCA host card cannot have it's interrupts disabled.
1365 ** This function is called at init time to setup the data structures.
1368 RIOAllocDataStructs(p)
1369 struct rio_info * p;
1375 p->RIOPortp = (struct Port *)sysbrk(RIO_PORTS * sizeof(struct Port));
1377 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for port structures\n");
1381 bzero( p->RIOPortp, sizeof(struct Port) * RIO_PORTS );
1382 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: allocated and cleared memory for port structs\n");
1383 rio_dprintk (RIO_DEBUG_INIT, "First RIO port struct @0x%x, size=0x%x bytes\n",
1384 (int)p->RIOPortp, sizeof(struct Port));
1386 for( port=0; port<RIO_PORTS; port++ ) {
1387 p->RIOPortp[port].PortNum = port;
1388 p->RIOPortp[port].TtyP = &p->channel[port];
1389 sreset (p->RIOPortp[port].InUse); /* Let the first guy uses it */
1390 p->RIOPortp[port].portSem = -1; /* Let the first guy takes it */
1391 p->RIOPortp[port].ParamSem = -1; /* Let the first guy takes it */
1392 p->RIOPortp[port].timeout_id = 0; /* Let the first guy takes it */
1395 p->RIOHosts = (struct Host *)sysbrk(RIO_HOSTS * sizeof(struct Host));
1397 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for host structures\n");
1401 bzero(p->RIOHosts, sizeof(struct Host)*RIO_HOSTS);
1402 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: allocated and cleared memory for host structs\n");
1403 rio_dprintk (RIO_DEBUG_INIT, "First RIO host struct @0x%x, size=0x%x bytes\n",
1404 (int)p->RIOHosts, sizeof(struct Host));
1406 for( host=0; host<RIO_HOSTS; host++ ) {
1407 spin_lock_init (&p->RIOHosts[host].HostLock);
1408 p->RIOHosts[host].timeout_id = 0; /* Let the first guy takes it */
1411 ** check that the buffer size is valid, round down to the next power of
1412 ** two if necessary; if the result is zero, then, hey, no double buffers.
1414 for ( tm = 1; tm && tm <= p->RIOConf.BufferSize; tm <<= 1 )
1417 p->RIOBufferSize = tm;
1418 p->RIOBufferMask = tm ? tm - 1 : 0;
1422 ** this function gets called whenever the data structures need to be
1423 ** re-setup, for example, after a riohalt (why did I ever invent it?)
1426 RIOSetupDataStructs(p)
1427 struct rio_info * p;
1429 int host, entry, rup;
1431 for ( host=0; host<RIO_HOSTS; host++ ) {
1432 struct Host *HostP = &p->RIOHosts[host];
1433 for ( entry=0; entry<LINKS_PER_UNIT; entry++ ) {
1434 HostP->Topology[entry].Unit = ROUTE_DISCONNECT;
1435 HostP->Topology[entry].Link = NO_LINK;
1437 bcopy("HOST X", HostP->Name, 7);
1438 HostP->Name[5] = '1'+host;
1439 for (rup=0; rup<(MAX_RUP + LINKS_PER_UNIT); rup++) {
1440 if (rup < MAX_RUP) {
1441 for (entry=0; entry<LINKS_PER_UNIT; entry++ ) {
1442 HostP->Mapping[rup].Topology[entry].Unit = ROUTE_DISCONNECT;
1443 HostP->Mapping[rup].Topology[entry].Link = NO_LINK;
1445 RIODefaultName(p, HostP, rup);
1447 HostP->UnixRups[rup].RupLock = SPIN_LOCK_UNLOCKED;
1454 RIODefaultName(p, HostP, UnitId)
1455 struct rio_info * p;
1456 struct Host * HostP;
1461 CheckUnitId( UnitId );
1463 bcopy("UNKNOWN RTA X-XX",HostP->Mapping[UnitId].Name,17);
1464 HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts);
1465 if ((UnitId+1) > 9) {
1466 HostP->Mapping[UnitId].Name[14]='0'+((UnitId+1)/10);
1467 HostP->Mapping[UnitId].Name[15]='0'+((UnitId+1)%10);
1470 HostP->Mapping[UnitId].Name[14]='1'+UnitId;
1471 HostP->Mapping[UnitId].Name[15]=0;
1476 #define RIO_RELEASE "Linux"
1477 #define RELEASE_ID "1.0"
1481 struct rio_info * p;
1483 char * RIORelease = RIO_RELEASE;
1484 char * RIORelID = RELEASE_ID;
1487 rio_dprintk (RIO_DEBUG_INIT, "RIO : Release: %s ID: %s\n", RIORelease, RIORelID);
1489 if ( p->RIONumHosts==0 ) {
1490 rio_dprintk (RIO_DEBUG_INIT, "\nNo Hosts configured\n");
1494 for ( host=0; host < p->RIONumHosts; host++ ) {
1495 struct Host *HostP = &p->RIOHosts[host];
1496 switch ( HostP->Type ) {
1498 rio_dprintk (RIO_DEBUG_INIT, "AT BUS : found the card at 0x%x\n", HostP->PaddrP);
1505 ** This function returns release/version information as used by ioctl() calls
1506 ** It returns a MAX_VERSION_LEN byte string, null terminated.
1509 OLD_RIOVersid( void )
1511 static char Info[MAX_VERSION_LEN];
1512 char * RIORelease = RIO_RELEASE;
1516 for ( ct=0; RIORelease[ct] && ct<MAX_VERSION_LEN; ct++ )
1517 Info[ct] = RIORelease[ct];
1518 if ( ct>=MAX_VERSION_LEN ) {
1519 Info[MAX_VERSION_LEN-1] = '\0';
1523 if ( ct>=MAX_VERSION_LEN ) {
1524 Info[MAX_VERSION_LEN-1] = '\0';
1528 cp=""; /* Fill the RCS Id here */
1530 while ( *cp && ct<MAX_VERSION_LEN )
1532 if ( ct<MAX_VERSION_LEN-1 )
1534 Info[MAX_VERSION_LEN-1] = '\0';
1539 static struct rioVersion stVersion;
1544 strlcpy(stVersion.version, "RIO driver for linux V1.0",
1545 sizeof(stVersion.version));
1546 strlcpy(stVersion.buildDate, __DATE__,
1547 sizeof(stVersion.buildDate));
1554 RIOMapin(paddr, size, vaddr)
1559 *vaddr = (caddr_t)permap( (long)paddr, size);
1560 return ((int)*vaddr);
1564 RIOMapout(paddr, size, vaddr)
1574 RIOHostReset(Type, DpRamP, Slot)
1576 volatile struct DpRam *DpRamP;
1582 rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: type 0x%x", Type);
1585 rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n");
1586 WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
1587 INTERRUPT_DISABLE | BYTE_OPERATION |
1588 SLOW_LINKS | SLOW_AT_BUS);
1589 WBYTE(DpRamP->DpResetTpu, 0xFF);
1592 rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n");
1593 WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
1594 INTERRUPT_DISABLE | BYTE_OPERATION |
1595 SLOW_LINKS | SLOW_AT_BUS);
1596 WBYTE(DpRamP->DpResetTpu, 0xFF);
1599 #ifdef FUTURE_RELEASE
1602 ** Bet this doesn't work!
1604 OUTBZ( Slot, EISA_CONTROL_PORT,
1605 EISA_TP_RUN | EISA_TP_BUS_DISABLE |
1606 EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM );
1607 OUTBZ( Slot, EISA_CONTROL_PORT,
1608 EISA_TP_RESET | EISA_TP_BUS_DISABLE |
1609 EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM );
1611 OUTBZ( Slot, EISA_CONTROL_PORT,
1612 EISA_TP_RUN | EISA_TP_BUS_DISABLE |
1613 EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM );
1616 WBYTE(DpRamP->DpControl , McaTpBootFromRam | McaTpBusDisable );
1617 WBYTE(DpRamP->DpResetTpu , 0xFF );
1619 WBYTE(DpRamP->DpControl , McaTpBootFromRam | McaTpBusDisable );
1620 WBYTE(DpRamP->DpResetTpu , 0xFF );
1625 rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n");
1626 DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM;
1627 DpRamP->DpResetInt = 0xFF;
1628 DpRamP->DpResetTpu = 0xFF;
1630 /* for (i=0; i<6000; i++); */
1633 #ifdef FUTURE_RELEASE
1635 Rprintf(RIOMesgNoSupport,Type,DpRamP,Slot);
1640 rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n");