aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/rio/cmdblk.h4
-rw-r--r--drivers/char/rio/func.h51
-rw-r--r--drivers/char/rio/rio.h4
-rw-r--r--drivers/char/rio/rio_linux.c69
-rw-r--r--drivers/char/rio/riocmd.c142
-rw-r--r--drivers/char/rio/rioinit.c186
-rw-r--r--drivers/char/rio/riointr.c311
7 files changed, 232 insertions, 535 deletions
diff --git a/drivers/char/rio/cmdblk.h b/drivers/char/rio/cmdblk.h
index a9a8c45631d7..c46b2fdb6626 100644
--- a/drivers/char/rio/cmdblk.h
+++ b/drivers/char/rio/cmdblk.h
@@ -48,10 +48,10 @@ struct CmdBlk {
48 struct CmdBlk *NextP; /* Pointer to next command block */ 48 struct CmdBlk *NextP; /* Pointer to next command block */
49 struct PKT Packet; /* A packet, to copy to the rup */ 49 struct PKT Packet; /* A packet, to copy to the rup */
50 /* The func to call to check if OK */ 50 /* The func to call to check if OK */
51 int (*PreFuncP) (int, struct CmdBlk *); 51 int (*PreFuncP) (unsigned long, struct CmdBlk *);
52 int PreArg; /* The arg for the func */ 52 int PreArg; /* The arg for the func */
53 /* The func to call when completed */ 53 /* The func to call when completed */
54 int (*PostFuncP) (int, struct CmdBlk *); 54 int (*PostFuncP) (unsigned long, struct CmdBlk *);
55 int PostArg; /* The arg for the func */ 55 int PostArg; /* The arg for the func */
56}; 56};
57 57
diff --git a/drivers/char/rio/func.h b/drivers/char/rio/func.h
index b4778410ec6e..8967772d833d 100644
--- a/drivers/char/rio/func.h
+++ b/drivers/char/rio/func.h
@@ -43,35 +43,34 @@ static char *_func_h_sccs_ = "@(#)func.h 1.3";
43 43
44/* rioboot.c */ 44/* rioboot.c */
45int RIOBootCodeRTA(struct rio_info *, struct DownLoad *); 45int RIOBootCodeRTA(struct rio_info *, struct DownLoad *);
46int RIOBootCodeHOST(struct rio_info *, register struct DownLoad *); 46int RIOBootCodeHOST(struct rio_info *, struct DownLoad *);
47int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *); 47int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *);
48void msec_timeout(struct Host *); 48void msec_timeout(struct Host *);
49int RIOBootRup(struct rio_info *, uint, struct Host *, struct PKT *); 49int RIOBootRup(struct rio_info *, unsigned int, struct Host *, struct PKT *);
50int RIOBootOk(struct rio_info *, struct Host *, ulong); 50int RIOBootOk(struct rio_info *, struct Host *, unsigned long);
51int RIORtaBound(struct rio_info *, uint); 51int RIORtaBound(struct rio_info *, unsigned int);
52void FillSlot(int, int, uint, struct Host *); 52void FillSlot(int, int, unsigned int, struct Host *);
53 53
54/* riocmd.c */ 54/* riocmd.c */
55int RIOFoadRta(struct Host *, struct Map *); 55int RIOFoadRta(struct Host *, struct Map *);
56int RIOZombieRta(struct Host *, struct Map *); 56int RIOZombieRta(struct Host *, struct Map *);
57int RIOCommandRta(struct rio_info *, uint, int (*func) (struct Host *, struct Map *)); 57int RIOCommandRta(struct rio_info *, unsigned long, int (*func) (struct Host *, struct Map *));
58int RIOIdentifyRta(struct rio_info *, caddr_t); 58int RIOIdentifyRta(struct rio_info *, void *);
59int RIOKillNeighbour(struct rio_info *, caddr_t); 59int RIOKillNeighbour(struct rio_info *, void *);
60int RIOSuspendBootRta(struct Host *, int, int); 60int RIOSuspendBootRta(struct Host *, int, int);
61int RIOFoadWakeup(struct rio_info *); 61int RIOFoadWakeup(struct rio_info *);
62struct CmdBlk *RIOGetCmdBlk(void); 62struct CmdBlk *RIOGetCmdBlk(void);
63void RIOFreeCmdBlk(struct CmdBlk *); 63void RIOFreeCmdBlk(struct CmdBlk *);
64int RIOQueueCmdBlk(struct Host *, uint, struct CmdBlk *); 64int RIOQueueCmdBlk(struct Host *, unsigned int, struct CmdBlk *);
65void RIOPollHostCommands(struct rio_info *, struct Host *); 65void RIOPollHostCommands(struct rio_info *, struct Host *);
66int RIOWFlushMark(int, struct CmdBlk *); 66int RIOWFlushMark(unsigned long, struct CmdBlk *);
67int RIORFlushEnable(int, struct CmdBlk *); 67int RIORFlushEnable(unsigned long, struct CmdBlk *);
68int RIOUnUse(int, struct CmdBlk *); 68int RIOUnUse(unsigned long, struct CmdBlk *);
69void ShowPacket(uint, struct PKT *); 69void ShowPacket(unsigned int, struct PKT *);
70 70
71/* rioctrl.c */ 71/* rioctrl.c */
72int copyin(int, caddr_t, int);
73int riocontrol(struct rio_info *, dev_t, int, caddr_t, int); 72int riocontrol(struct rio_info *, dev_t, int, caddr_t, int);
74int RIOPreemptiveCmd(struct rio_info *, struct Port *, uchar); 73int RIOPreemptiveCmd(struct rio_info *, struct Port *, unsigned char);
75 74
76/* rioinit.c */ 75/* rioinit.c */
77void rioinit(struct rio_info *, struct RioHostInfo *); 76void rioinit(struct rio_info *, struct RioHostInfo *);
@@ -80,19 +79,19 @@ void RIOISAinit(struct rio_info *, int);
80int RIODoAT(struct rio_info *, int, int); 79int RIODoAT(struct rio_info *, int, int);
81caddr_t RIOCheckForATCard(int); 80caddr_t RIOCheckForATCard(int);
82int RIOAssignAT(struct rio_info *, int, caddr_t, int); 81int RIOAssignAT(struct rio_info *, int, caddr_t, int);
83int RIOBoardTest(paddr_t, caddr_t, uchar, int); 82int RIOBoardTest(paddr_t, caddr_t, unsigned char, int);
84void RIOAllocDataStructs(struct rio_info *); 83void RIOAllocDataStructs(struct rio_info *);
85void RIOSetupDataStructs(struct rio_info *); 84void RIOSetupDataStructs(struct rio_info *);
86int RIODefaultName(struct rio_info *, struct Host *, uint); 85int RIODefaultName(struct rio_info *, struct Host *, unsigned int);
87struct rioVersion *RIOVersid(void); 86struct rioVersion *RIOVersid(void);
88int RIOMapin(paddr_t, int, caddr_t *); 87int RIOMapin(paddr_t, int, caddr_t *);
89void RIOMapout(paddr_t, long, caddr_t); 88void RIOMapout(paddr_t, long, caddr_t);
90void RIOHostReset(uint, volatile struct DpRam *, uint); 89void RIOHostReset(unsigned int, struct DpRam *, unsigned int);
91 90
92/* riointr.c */ 91/* riointr.c */
93void RIOTxEnable(char *); 92void RIOTxEnable(char *);
94void RIOServiceHost(struct rio_info *, struct Host *, int); 93void RIOServiceHost(struct rio_info *, struct Host *, int);
95int riotproc(struct rio_info *, register struct ttystatics *, int, int); 94int riotproc(struct rio_info *, struct ttystatics *, int, int);
96 95
97/* rioparam.c */ 96/* rioparam.c */
98int RIOParam(struct Port *, int, int, int); 97int RIOParam(struct Port *, int, int, int);
@@ -106,18 +105,18 @@ int can_remove_receive(struct PKT **, struct Port *);
106void remove_receive(struct Port *); 105void remove_receive(struct Port *);
107 106
108/* rioroute.c */ 107/* rioroute.c */
109int RIORouteRup(struct rio_info *, uint, struct Host *, struct PKT *); 108int RIORouteRup(struct rio_info *, unsigned int, struct Host *, struct PKT *);
110void RIOFixPhbs(struct rio_info *, struct Host *, uint); 109void RIOFixPhbs(struct rio_info *, struct Host *, unsigned int);
111uint GetUnitType(uint); 110unsigned int GetUnitType(unsigned int);
112int RIOSetChange(struct rio_info *); 111int RIOSetChange(struct rio_info *);
113int RIOFindFreeID(struct rio_info *, struct Host *, uint *, uint *); 112int RIOFindFreeID(struct rio_info *, struct Host *, unsigned int *, unsigned int *);
114 113
115 114
116/* riotty.c */ 115/* riotty.c */
117 116
118int riotopen(struct tty_struct *tty, struct file *filp); 117int riotopen(struct tty_struct *tty, struct file *filp);
119int riotclose(void *ptr); 118int riotclose(void *ptr);
120int riotioctl(struct rio_info *, struct tty_struct *, register int, register caddr_t); 119int riotioctl(struct rio_info *, struct tty_struct *, int, caddr_t);
121void ttyseth(struct Port *, struct ttystatics *, struct old_sgttyb *sg); 120void ttyseth(struct Port *, struct ttystatics *, struct old_sgttyb *sg);
122 121
123/* riotable.c */ 122/* riotable.c */
@@ -131,7 +130,7 @@ int RIOChangeName(struct rio_info *, struct Map *);
131#if 0 130#if 0
132/* riodrvr.c */ 131/* riodrvr.c */
133struct rio_info *rio_install(struct RioHostInfo *); 132struct rio_info *rio_install(struct RioHostInfo *);
134int rio_uninstall(register struct rio_info *); 133int rio_uninstall(struct rio_info *);
135int rio_open(struct rio_info *, int, struct file *); 134int rio_open(struct rio_info *, int, struct file *);
136int rio_close(struct rio_info *, struct file *); 135int rio_close(struct rio_info *, struct file *);
137int rio_read(struct rio_info *, struct file *, char *, int); 136int rio_read(struct rio_info *, struct file *, char *, int);
@@ -143,7 +142,7 @@ int rio_isr_thread(char *);
143struct rio_info *rio_info_store(int cmd, struct rio_info *p); 142struct rio_info *rio_info_store(int cmd, struct rio_info *p);
144#endif 143#endif
145 144
146extern int rio_pcicopy(char *src, char *dst, int n); 145extern void rio_copy_to_card(void *to, void *from, int len);
147extern int rio_minor(struct tty_struct *tty); 146extern int rio_minor(struct tty_struct *tty);
148extern int rio_ismodem(struct tty_struct *tty); 147extern int rio_ismodem(struct tty_struct *tty);
149 148
diff --git a/drivers/char/rio/rio.h b/drivers/char/rio/rio.h
index 7f45e1ab5332..2d466ffe112d 100644
--- a/drivers/char/rio/rio.h
+++ b/drivers/char/rio/rio.h
@@ -186,8 +186,8 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3";
186** RIO_OBJ takes hostp->Caddr and a UNIX pointer to an object and 186** RIO_OBJ takes hostp->Caddr and a UNIX pointer to an object and
187** returns the offset into the DP RAM area. 187** returns the offset into the DP RAM area.
188*/ 188*/
189#define RIO_PTR(C,O) (((caddr_t)(C))+(0xFFFF&(O))) 189#define RIO_PTR(C,O) (((unsigned char *)(C))+(0xFFFF&(O)))
190#define RIO_OFF(C,O) ((int)(O)-(int)(C)) 190#define RIO_OFF(C,O) ((long)(O)-(long)(C))
191 191
192/* 192/*
193** How to convert from various different device number formats: 193** How to convert from various different device number formats:
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index c9af283a811d..f1e9e9a20c85 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -297,7 +297,7 @@ static void my_hd(void *ad, int len)
297 unsigned char *addr = ad; 297 unsigned char *addr = ad;
298 298
299 for (i = 0; i < len; i += 16) { 299 for (i = 0; i < len; i += 16) {
300 rio_dprintk(RIO_DEBUG_PARAM, "%08x ", (int) addr + i); 300 rio_dprintk(RIO_DEBUG_PARAM, "%08lx ", (unsigned long) addr + i);
301 for (j = 0; j < 16; j++) { 301 for (j = 0; j < 16; j++) {
302 rio_dprintk(RIO_DEBUG_PARAM, "%02x %s", addr[j + i], (j == 7) ? " " : ""); 302 rio_dprintk(RIO_DEBUG_PARAM, "%02x %s", addr[j + i], (j == 7) ? " " : "");
303 } 303 }
@@ -340,13 +340,16 @@ int RIODelay_ni(struct Port *PortP, int njiffies)
340 return !RIO_FAIL; 340 return !RIO_FAIL;
341} 341}
342 342
343void rio_copy_to_card(void *to, void *from, int len)
344{
345 rio_memcpy_toio(NULL, to, from, len);
346}
343 347
344int rio_minor(struct tty_struct *tty) 348int rio_minor(struct tty_struct *tty)
345{ 349{
346 return tty->index + (tty->driver == rio_driver) ? 0 : 256; 350 return tty->index + (tty->driver == rio_driver) ? 0 : 256;
347} 351}
348 352
349
350int rio_ismodem(struct tty_struct *tty) 353int rio_ismodem(struct tty_struct *tty)
351{ 354{
352 return 1; 355 return 1;
@@ -379,7 +382,7 @@ static void rio_reset_interrupt(struct Host *HostP)
379 case RIO_AT: 382 case RIO_AT:
380 case RIO_MCA: 383 case RIO_MCA:
381 case RIO_PCI: 384 case RIO_PCI:
382 WBYTE(HostP->ResetInt, 0xff); 385 writeb(0xFF, &HostP->ResetInt);
383 } 386 }
384 387
385 func_exit(); 388 func_exit();
@@ -397,9 +400,6 @@ static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs)
397 /* AAargh! The order in which to do these things is essential and 400 /* AAargh! The order in which to do these things is essential and
398 not trivial. 401 not trivial.
399 402
400 - Rate limit goes before "recursive". Otherwise a series of
401 recursive calls will hang the machine in the interrupt routine.
402
403 - hardware twiddling goes before "recursive". Otherwise when we 403 - hardware twiddling goes before "recursive". Otherwise when we
404 poll the card, and a recursive interrupt happens, we won't 404 poll the card, and a recursive interrupt happens, we won't
405 ack the card, so it might keep on interrupting us. (especially 405 ack the card, so it might keep on interrupting us. (especially
@@ -414,26 +414,6 @@ static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs)
414 - The initialized test goes before recursive. 414 - The initialized test goes before recursive.
415 */ 415 */
416 416
417
418
419#ifdef IRQ_RATE_LIMIT
420 /* Aaargh! I'm ashamed. This costs more lines-of-code than the
421 actual interrupt routine!. (Well, used to when I wrote that comment) */
422 {
423 static int lastjif;
424 static int nintr = 0;
425
426 if (lastjif == jiffies) {
427 if (++nintr > IRQ_RATE_LIMIT) {
428 free_irq(HostP->Ivec, ptr);
429 printk(KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n", HostP->Ivec);
430 }
431 } else {
432 lastjif = jiffies;
433 nintr = 0;
434 }
435 }
436#endif
437 rio_dprintk(RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n"); 417 rio_dprintk(RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n");
438 if (HostP->Ivec == irq) { 418 if (HostP->Ivec == irq) {
439 /* Tell the card we've noticed the interrupt. */ 419 /* Tell the card we've noticed the interrupt. */
@@ -444,13 +424,13 @@ static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs)
444 return IRQ_HANDLED; 424 return IRQ_HANDLED;
445 425
446 if (test_and_set_bit(RIO_BOARD_INTR_LOCK, &HostP->locks)) { 426 if (test_and_set_bit(RIO_BOARD_INTR_LOCK, &HostP->locks)) {
447 printk(KERN_ERR "Recursive interrupt! (host %d/irq%d)\n", (int) ptr, HostP->Ivec); 427 printk(KERN_ERR "Recursive interrupt! (host %p/irq%d)\n", ptr, HostP->Ivec);
448 return IRQ_HANDLED; 428 return IRQ_HANDLED;
449 } 429 }
450 430
451 RIOServiceHost(p, HostP, irq); 431 RIOServiceHost(p, HostP, irq);
452 432
453 rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n", (int) ptr, HostP->Type); 433 rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %p type %d\n", ptr, HostP->Type);
454 434
455 clear_bit(RIO_BOARD_INTR_LOCK, &HostP->locks); 435 clear_bit(RIO_BOARD_INTR_LOCK, &HostP->locks);
456 rio_dprintk(RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", irq, HostP->Ivec); 436 rio_dprintk(RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", irq, HostP->Ivec);
@@ -873,7 +853,7 @@ static int rio_init_datastructures(void)
873#define HOST_SZ sizeof(struct Host) 853#define HOST_SZ sizeof(struct Host)
874#define PORT_SZ sizeof(struct Port *) 854#define PORT_SZ sizeof(struct Port *)
875#define TMIO_SZ sizeof(struct termios *) 855#define TMIO_SZ sizeof(struct termios *)
876 rio_dprintk(RIO_DEBUG_INIT, "getting : %d %d %d %d %d bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ); 856 rio_dprintk(RIO_DEBUG_INIT, "getting : %Zd %Zd %Zd %Zd %Zd bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ);
877 857
878 if (!(p = ckmalloc(RI_SZ))) 858 if (!(p = ckmalloc(RI_SZ)))
879 goto free0; 859 goto free0;
@@ -963,22 +943,21 @@ static void __exit rio_release_drivers(void)
963 943
964static void fix_rio_pci(struct pci_dev *pdev) 944static void fix_rio_pci(struct pci_dev *pdev)
965{ 945{
966 unsigned int hwbase; 946 unsigned long hwbase;
967 unsigned long rebase; 947 unsigned char *rebase;
968 unsigned int t; 948 unsigned int t;
969 949
970#define CNTRL_REG_OFFSET 0x50 950#define CNTRL_REG_OFFSET 0x50
971#define CNTRL_REG_GOODVALUE 0x18260000 951#define CNTRL_REG_GOODVALUE 0x18260000
972 952
973 pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase); 953 hwbase = pci_resource_start(pdev, 0);
974 hwbase &= PCI_BASE_ADDRESS_MEM_MASK; 954 rebase = ioremap(hwbase, 0x80);
975 rebase = (ulong) ioremap(hwbase, 0x80);
976 t = readl(rebase + CNTRL_REG_OFFSET); 955 t = readl(rebase + CNTRL_REG_OFFSET);
977 if (t != CNTRL_REG_GOODVALUE) { 956 if (t != CNTRL_REG_GOODVALUE) {
978 printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", t, CNTRL_REG_GOODVALUE); 957 printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", t, CNTRL_REG_GOODVALUE);
979 writel(CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET); 958 writel(CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET);
980 } 959 }
981 iounmap((char *) rebase); 960 iounmap(rebase);
982} 961}
983#endif 962#endif
984 963
@@ -1049,7 +1028,7 @@ static int __init rio_init(void)
1049 hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); 1028 hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN);
1050 hp->CardP = (struct DpRam *) hp->Caddr; 1029 hp->CardP = (struct DpRam *) hp->Caddr;
1051 hp->Type = RIO_PCI; 1030 hp->Type = RIO_PCI;
1052 hp->Copy = rio_pcicopy; 1031 hp->Copy = rio_copy_to_card;
1053 hp->Mode = RIO_PCI_BOOT_FROM_RAM; 1032 hp->Mode = RIO_PCI_BOOT_FROM_RAM;
1054 spin_lock_init(&hp->HostLock); 1033 spin_lock_init(&hp->HostLock);
1055 rio_reset_interrupt(hp); 1034 rio_reset_interrupt(hp);
@@ -1058,10 +1037,10 @@ static int __init rio_init(void)
1058 rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); 1037 rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr);
1059 if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { 1038 if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) {
1060 rio_dprintk(RIO_DEBUG_INIT, "Done RIOBoardTest\n"); 1039 rio_dprintk(RIO_DEBUG_INIT, "Done RIOBoardTest\n");
1061 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); 1040 writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt);
1062 p->RIOHosts[p->RIONumHosts].UniqueNum = 1041 p->RIOHosts[p->RIONumHosts].UniqueNum =
1063 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | 1042 ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) |
1064 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); 1043 ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24);
1065 rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); 1044 rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
1066 1045
1067 fix_rio_pci(pdev); 1046 fix_rio_pci(pdev);
@@ -1099,7 +1078,7 @@ static int __init rio_init(void)
1099 hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); 1078 hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN);
1100 hp->CardP = (struct DpRam *) hp->Caddr; 1079 hp->CardP = (struct DpRam *) hp->Caddr;
1101 hp->Type = RIO_PCI; 1080 hp->Type = RIO_PCI;
1102 hp->Copy = rio_pcicopy; 1081 hp->Copy = rio_copy_to_card;
1103 hp->Mode = RIO_PCI_BOOT_FROM_RAM; 1082 hp->Mode = RIO_PCI_BOOT_FROM_RAM;
1104 spin_lock_init(&hp->HostLock); 1083 spin_lock_init(&hp->HostLock);
1105 1084
@@ -1110,10 +1089,10 @@ static int __init rio_init(void)
1110 rio_start_card_running(hp); 1089 rio_start_card_running(hp);
1111 rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); 1090 rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr);
1112 if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { 1091 if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) {
1113 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); 1092 writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt);
1114 p->RIOHosts[p->RIONumHosts].UniqueNum = 1093 p->RIOHosts[p->RIONumHosts].UniqueNum =
1115 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | 1094 ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) |
1116 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); 1095 ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24);
1117 rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); 1096 rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
1118 1097
1119 p->RIOLastPCISearch = RIO_SUCCESS; 1098 p->RIOLastPCISearch = RIO_SUCCESS;
@@ -1137,8 +1116,8 @@ static int __init rio_init(void)
1137 hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); 1116 hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN);
1138 hp->CardP = (struct DpRam *) hp->Caddr; 1117 hp->CardP = (struct DpRam *) hp->Caddr;
1139 hp->Type = RIO_AT; 1118 hp->Type = RIO_AT;
1140 hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL 1119 hp->Copy = rio_copy_to_card; /* AT card PCI???? - PVDL
1141 * -- YES! this is now a normal copy. Only the 1120 * -- YES! this is now a normal copy. Only the
1142 * old PCI card uses the special PCI copy. 1121 * old PCI card uses the special PCI copy.
1143 * Moreover, the ISA card will work with the 1122 * Moreover, the ISA card will work with the
1144 * special PCI copy anyway. -- REW */ 1123 * special PCI copy anyway. -- REW */
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c
index 694bfb9d9378..08fcac1f12de 100644
--- a/drivers/char/rio/riocmd.c
+++ b/drivers/char/rio/riocmd.c
@@ -42,6 +42,7 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2";
42#include <asm/system.h> 42#include <asm/system.h>
43#include <asm/string.h> 43#include <asm/string.h>
44#include <asm/semaphore.h> 44#include <asm/semaphore.h>
45#include <asm/uaccess.h>
45 46
46#include <linux/termios.h> 47#include <linux/termios.h>
47#include <linux/serial.h> 48#include <linux/serial.h>
@@ -143,17 +144,17 @@ int RIOZombieRta(struct Host *HostP, struct Map *MapP)
143 return 0; 144 return 0;
144} 145}
145 146
146int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP)) 147int RIOCommandRta(struct rio_info *p, unsigned long RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP))
147{ 148{
148 uint Host; 149 unsigned int Host;
149 150
150 rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%x func 0x%x\n", RtaUnique, (int) func); 151 rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%lx func 0x%p\n", RtaUnique, func);
151 152
152 if (!RtaUnique) 153 if (!RtaUnique)
153 return (0); 154 return (0);
154 155
155 for (Host = 0; Host < p->RIONumHosts; Host++) { 156 for (Host = 0; Host < p->RIONumHosts; Host++) {
156 uint Rta; 157 unsigned int Rta;
157 struct Host *HostP = &p->RIOHosts[Host]; 158 struct Host *HostP = &p->RIOHosts[Host];
158 159
159 for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { 160 for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) {
@@ -170,7 +171,7 @@ int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host *
170 ** any connections, we can get to it. 171 ** any connections, we can get to it.
171 */ 172 */
172 for (Link = 0; Link < LINKS_PER_UNIT; Link++) { 173 for (Link = 0; Link < LINKS_PER_UNIT; Link++) {
173 if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) { 174 if (MapP->Topology[Link].Unit <= (u8) MAX_RUP) {
174 /* 175 /*
175 ** Its worth trying the operation... 176 ** Its worth trying the operation...
176 */ 177 */
@@ -184,18 +185,18 @@ int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host *
184} 185}
185 186
186 187
187int RIOIdentifyRta(struct rio_info *p, caddr_t arg) 188int RIOIdentifyRta(struct rio_info *p, void * arg)
188{ 189{
189 uint Host; 190 unsigned int Host;
190 191
191 if (copyin((int) arg, (caddr_t) & IdRta, sizeof(IdRta)) == COPYFAIL) { 192 if (copy_from_user(&IdRta, arg, sizeof(IdRta))) {
192 rio_dprintk(RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n"); 193 rio_dprintk(RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n");
193 p->RIOError.Error = COPYIN_FAILED; 194 p->RIOError.Error = COPYIN_FAILED;
194 return -EFAULT; 195 return -EFAULT;
195 } 196 }
196 197
197 for (Host = 0; Host < p->RIONumHosts; Host++) { 198 for (Host = 0; Host < p->RIONumHosts; Host++) {
198 uint Rta; 199 unsigned int Rta;
199 struct Host *HostP = &p->RIOHosts[Host]; 200 struct Host *HostP = &p->RIOHosts[Host];
200 201
201 for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { 202 for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) {
@@ -211,7 +212,7 @@ int RIOIdentifyRta(struct rio_info *p, caddr_t arg)
211 ** any connections, we can get to it. 212 ** any connections, we can get to it.
212 */ 213 */
213 for (Link = 0; Link < LINKS_PER_UNIT; Link++) { 214 for (Link = 0; Link < LINKS_PER_UNIT; Link++) {
214 if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) { 215 if (MapP->Topology[Link].Unit <= (u8) MAX_RUP) {
215 /* 216 /*
216 ** Its worth trying the operation... 217 ** Its worth trying the operation...
217 */ 218 */
@@ -249,7 +250,7 @@ int RIOIdentifyRta(struct rio_info *p, caddr_t arg)
249} 250}
250 251
251 252
252int RIOKillNeighbour(struct rio_info *p, caddr_t arg) 253int RIOKillNeighbour(struct rio_info *p, void * arg)
253{ 254{
254 uint Host; 255 uint Host;
255 uint ID; 256 uint ID;
@@ -258,7 +259,7 @@ int RIOKillNeighbour(struct rio_info *p, caddr_t arg)
258 259
259 rio_dprintk(RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n"); 260 rio_dprintk(RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n");
260 261
261 if (copyin((int) arg, (caddr_t) & KillUnit, sizeof(KillUnit)) == COPYFAIL) { 262 if (copy_from_user(&KillUnit, arg, sizeof(KillUnit))) {
262 rio_dprintk(RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n"); 263 rio_dprintk(RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n");
263 p->RIOError.Error = COPYIN_FAILED; 264 p->RIOError.Error = COPYIN_FAILED;
264 return -EFAULT; 265 return -EFAULT;
@@ -344,7 +345,7 @@ int RIOSuspendBootRta(struct Host *HostP, int ID, int Link)
344int RIOFoadWakeup(struct rio_info *p) 345int RIOFoadWakeup(struct rio_info *p)
345{ 346{
346 int port; 347 int port;
347 register struct Port *PortP; 348 struct Port *PortP;
348 unsigned long flags; 349 unsigned long flags;
349 350
350 for (port = 0; port < RIO_PORTS; port++) { 351 for (port = 0; port < RIO_PORTS; port++) {
@@ -379,10 +380,10 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
379 struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; 380 struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data;
380 struct Port *PortP; 381 struct Port *PortP;
381 struct UnixRup *UnixRupP; 382 struct UnixRup *UnixRupP;
382 ushort SysPort; 383 unsigned short SysPort;
383 ushort ReportedModemStatus; 384 unsigned short ReportedModemStatus;
384 ushort rup; 385 unsigned short rup;
385 ushort subCommand; 386 unsigned short subCommand;
386 unsigned long flags; 387 unsigned long flags;
387 388
388 func_enter(); 389 func_enter();
@@ -395,18 +396,18 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
395 ** we can use PhbNum to get the rup number for the appropriate 8 port 396 ** we can use PhbNum to get the rup number for the appropriate 8 port
396 ** block (for the first block, this should be equal to 'Rup'). 397 ** block (for the first block, this should be equal to 'Rup').
397 */ 398 */
398 rup = RBYTE(PktCmdP->PhbNum) / (ushort) PORTS_PER_RTA; 399 rup = readb(&PktCmdP->PhbNum) / (unsigned short) PORTS_PER_RTA;
399 UnixRupP = &HostP->UnixRups[rup]; 400 UnixRupP = &HostP->UnixRups[rup];
400 SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA); 401 SysPort = UnixRupP->BaseSysPort + (readb(&PktCmdP->PhbNum) % (unsigned short) PORTS_PER_RTA);
401 rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort); 402 rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort);
402 403
403 if (UnixRupP->BaseSysPort == NO_PORT) { 404 if (UnixRupP->BaseSysPort == NO_PORT) {
404 rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); 405 rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n");
405 rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); 406 rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n");
406 rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", HostP - p->RIOHosts, HostP->Name); 407 rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %Zd, name ``%s''\n", HostP - p->RIOHosts, HostP->Name);
407 rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup); 408 rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup);
408 409
409 if (Rup >= (ushort) MAX_RUP) { 410 if (Rup >= (unsigned short) MAX_RUP) {
410 rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name); 411 rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name);
411 } else 412 } else
412 rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name); 413 rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name);
@@ -421,7 +422,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
421 } 422 }
422 PortP = p->RIOPortp[SysPort]; 423 PortP = p->RIOPortp[SysPort];
423 rio_spin_lock_irqsave(&PortP->portSem, flags); 424 rio_spin_lock_irqsave(&PortP->portSem, flags);
424 switch (RBYTE(PktCmdP->Command)) { 425 switch (readb(&PktCmdP->Command)) {
425 case BREAK_RECEIVED: 426 case BREAK_RECEIVED:
426 rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n"); 427 rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n");
427 /* If the current line disc. is not multi-threading and 428 /* If the current line disc. is not multi-threading and
@@ -434,15 +435,15 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
434 break; 435 break;
435 436
436 case COMPLETE: 437 case COMPLETE:
437 rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", RBYTE(PktCmdP->PhbNum), HostP - p->RIOHosts); 438 rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %Zd\n", readb(&PktCmdP->PhbNum), HostP - p->RIOHosts);
438 subCommand = 1; 439 subCommand = 1;
439 switch (RBYTE(PktCmdP->SubCommand)) { 440 switch (readb(&PktCmdP->SubCommand)) {
440 case MEMDUMP: 441 case MEMDUMP:
441 rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr)); 442 rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", readb(&PktCmdP->SubCommand), readw(&PktCmdP->SubAddr));
442 break; 443 break;
443 case READ_REGISTER: 444 case READ_REGISTER:
444 rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr)); 445 rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", readw(&PktCmdP->SubAddr));
445 p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST); 446 p->CdRegister = (readb(&PktCmdP->ModemStatus) & MSVR1_HOST);
446 break; 447 break;
447 default: 448 default:
448 subCommand = 0; 449 subCommand = 0;
@@ -450,10 +451,10 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
450 } 451 }
451 if (subCommand) 452 if (subCommand)
452 break; 453 break;
453 rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", RBYTE(PktCmdP->PortStatus), PortP->PortState); 454 rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", readb(&PktCmdP->PortStatus), PortP->PortState);
454 if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) { 455 if (PortP->PortState != readb(&PktCmdP->PortStatus)) {
455 rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n"); 456 rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n");
456 PortP->PortState = RBYTE(PktCmdP->PortStatus); 457 PortP->PortState = readb(&PktCmdP->PortStatus);
457 /* What should we do here ... 458 /* What should we do here ...
458 wakeup( &PortP->PortState ); 459 wakeup( &PortP->PortState );
459 */ 460 */
@@ -467,7 +468,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
467 ** to the check for modem status change (they're just there because 468 ** to the check for modem status change (they're just there because
468 ** it's a convenient place to put them!). 469 ** it's a convenient place to put them!).
469 */ 470 */
470 ReportedModemStatus = RBYTE(PktCmdP->ModemStatus); 471 ReportedModemStatus = readb(&PktCmdP->ModemStatus);
471 if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) { 472 if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) {
472 rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState); 473 rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState);
473 /* 474 /*
@@ -514,9 +515,6 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
514 */ 515 */
515 if (PortP->State & (PORT_ISOPEN | RIO_WOPEN)) 516 if (PortP->State & (PORT_ISOPEN | RIO_WOPEN))
516 wake_up_interruptible(&PortP->gs.open_wait); 517 wake_up_interruptible(&PortP->gs.open_wait);
517#ifdef STATS
518 PortP->Stat.ModemOnCnt++;
519#endif
520 } 518 }
521 } else { 519 } else {
522 /* 520 /*
@@ -527,9 +525,6 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
527 tty_hangup(PortP->gs.tty); 525 tty_hangup(PortP->gs.tty);
528 PortP->State &= ~RIO_CARR_ON; 526 PortP->State &= ~RIO_CARR_ON;
529 rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n"); 527 rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n");
530#ifdef STATS
531 PortP->Stat.ModemOffCnt++;
532#endif
533 } 528 }
534 } 529 }
535 } 530 }
@@ -539,7 +534,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
539 break; 534 break;
540 535
541 default: 536 default:
542 rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", RBYTE(PktCmdP->Command), HostP - p->RIOHosts); 537 rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %Zd\n", readb(&PktCmdP->Command), HostP - p->RIOHosts);
543 break; 538 break;
544 } 539 }
545 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 540 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
@@ -566,10 +561,9 @@ struct CmdBlk *RIOGetCmdBlk(void)
566{ 561{
567 struct CmdBlk *CmdBlkP; 562 struct CmdBlk *CmdBlkP;
568 563
569 CmdBlkP = (struct CmdBlk *) sysbrk(sizeof(struct CmdBlk)); 564 CmdBlkP = (struct CmdBlk *)kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC);
570 if (CmdBlkP) 565 if (CmdBlkP)
571 bzero(CmdBlkP, sizeof(struct CmdBlk)); 566 memset(CmdBlkP, 0, sizeof(struct CmdBlk));
572
573 return CmdBlkP; 567 return CmdBlkP;
574} 568}
575 569
@@ -578,7 +572,7 @@ struct CmdBlk *RIOGetCmdBlk(void)
578*/ 572*/
579void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP) 573void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP)
580{ 574{
581 sysfree((void *) CmdBlkP, sizeof(struct CmdBlk)); 575 kfree(CmdBlkP);
582} 576}
583 577
584/* 578/*
@@ -591,7 +585,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
591 struct UnixRup *UnixRupP; 585 struct UnixRup *UnixRupP;
592 unsigned long flags; 586 unsigned long flags;
593 587
594 if (Rup >= (ushort) (MAX_RUP + LINKS_PER_UNIT)) { 588 if (Rup >= (unsigned short) (MAX_RUP + LINKS_PER_UNIT)) {
595 rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup); 589 rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup);
596 RIOFreeCmdBlk(CmdBlkP); 590 RIOFreeCmdBlk(CmdBlkP);
597 return RIO_FAIL; 591 return RIO_FAIL;
@@ -605,7 +599,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
605 ** If the RUP is currently inactive, then put the request 599 ** If the RUP is currently inactive, then put the request
606 ** straight on the RUP.... 600 ** straight on the RUP....
607 */ 601 */
608 if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) 602 if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP)
609 : TRUE)) { 603 : TRUE)) {
610 rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]); 604 rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]);
611 605
@@ -622,7 +616,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
622 /* 616 /*
623 ** set the command register 617 ** set the command register
624 */ 618 */
625 WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY); 619 writew(TX_PACKET_READY, &UnixRupP->RupP->txcontrol);
626 620
627 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); 621 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
628 622
@@ -634,20 +628,20 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
634 rio_dprintk(RIO_DEBUG_CMD, "Rup active - command waiting\n"); 628 rio_dprintk(RIO_DEBUG_CMD, "Rup active - command waiting\n");
635 if (UnixRupP->CmdPendingP != NULL) 629 if (UnixRupP->CmdPendingP != NULL)
636 rio_dprintk(RIO_DEBUG_CMD, "Rup active - command pending\n"); 630 rio_dprintk(RIO_DEBUG_CMD, "Rup active - command pending\n");
637 if (RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE) 631 if (readw(&UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE)
638 rio_dprintk(RIO_DEBUG_CMD, "Rup active - command rup not ready\n"); 632 rio_dprintk(RIO_DEBUG_CMD, "Rup active - command rup not ready\n");
639 633
640 Base = &UnixRupP->CmdsWaitingP; 634 Base = &UnixRupP->CmdsWaitingP;
641 635
642 rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); 636 rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk 0x%p at 0x%p\n", CmdBlkP, Base);
643 637
644 while (*Base) { 638 while (*Base) {
645 rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int) (*Base)); 639 rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk 0x%p here\n", *Base);
646 Base = &((*Base)->NextP); 640 Base = &((*Base)->NextP);
647 rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); 641 rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%p at 0x%p\n", CmdBlkP, Base);
648 } 642 }
649 643
650 rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); 644 rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk 0x%p at 0x%p\n", CmdBlkP, Base);
651 645
652 *Base = CmdBlkP; 646 *Base = CmdBlkP;
653 647
@@ -664,10 +658,10 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
664*/ 658*/
665void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) 659void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
666{ 660{
667 register struct CmdBlk *CmdBlkP; 661 struct CmdBlk *CmdBlkP;
668 register struct UnixRup *UnixRupP; 662 struct UnixRup *UnixRupP;
669 struct PKT *PacketP; 663 struct PKT *PacketP;
670 ushort Rup; 664 unsigned short Rup;
671 unsigned long flags; 665 unsigned long flags;
672 666
673 667
@@ -684,16 +678,16 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
684 /* 678 /*
685 ** First check for incoming commands: 679 ** First check for incoming commands:
686 */ 680 */
687 if (RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) { 681 if (readw(&UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) {
688 int FreeMe; 682 int FreeMe;
689 683
690 PacketP = (PKT *) RIO_PTR(HostP->Caddr, RWORD(UnixRupP->RupP->rxpkt)); 684 PacketP = (PKT *) RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->rxpkt));
691 685
692 ShowPacket(DBG_CMD, PacketP); 686 ShowPacket(DBG_CMD, PacketP);
693 687
694 switch (RBYTE(PacketP->dest_port)) { 688 switch (readb(&PacketP->dest_port)) {
695 case BOOT_RUP: 689 case BOOT_RUP:
696 rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", RBYTE(PacketP->len) & 0x80 ? "Command" : "Data", RBYTE(PacketP->data[0])); 690 rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", readb(&PacketP->len) & 0x80 ? "Command" : "Data", readb(&PacketP->data[0]));
697 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); 691 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
698 FreeMe = RIOBootRup(p, Rup, HostP, PacketP); 692 FreeMe = RIOBootRup(p, Rup, HostP, PacketP);
699 rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); 693 rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
@@ -708,7 +702,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
708 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); 702 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
709 FreeMe = RIOCommandRup(p, Rup, HostP, PacketP); 703 FreeMe = RIOCommandRup(p, Rup, HostP, PacketP);
710 if (PacketP->data[5] == MEMDUMP) { 704 if (PacketP->data[5] == MEMDUMP) {
711 rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(ushort *) & (PacketP->data[6])); 705 rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(unsigned short *) & (PacketP->data[6]));
712 HostP->Copy((caddr_t) & (PacketP->data[8]), (caddr_t) p->RIOMemDump, 32); 706 HostP->Copy((caddr_t) & (PacketP->data[8]), (caddr_t) p->RIOMemDump, 32);
713 } 707 }
714 rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); 708 rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
@@ -721,7 +715,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
721 break; 715 break;
722 716
723 default: 717 default:
724 rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port)); 718 rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", readb(&PacketP->dest_port));
725 FreeMe = 1; 719 FreeMe = 1;
726 break; 720 break;
727 } 721 }
@@ -730,11 +724,11 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
730 rio_dprintk(RIO_DEBUG_CMD, "Free processed incoming command packet\n"); 724 rio_dprintk(RIO_DEBUG_CMD, "Free processed incoming command packet\n");
731 put_free_end(HostP, PacketP); 725 put_free_end(HostP, PacketP);
732 726
733 WWORD(UnixRupP->RupP->rxcontrol, RX_RUP_INACTIVE); 727 writew(RX_RUP_INACTIVE, &UnixRupP->RupP->rxcontrol);
734 728
735 if (RWORD(UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) { 729 if (readw(&UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) {
736 rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup); 730 rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup);
737 WWORD(UnixRupP->RupP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); 731 writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &UnixRupP->RupP->handshake);
738 } 732 }
739 } 733 }
740 } 734 }
@@ -744,7 +738,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
744 ** and it has completed, then tidy it up. 738 ** and it has completed, then tidy it up.
745 */ 739 */
746 if ((CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */ 740 if ((CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */
747 (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { 741 (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
748 /* 742 /*
749 ** we are idle. 743 ** we are idle.
750 ** there is a command in pending. 744 ** there is a command in pending.
@@ -755,7 +749,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
755 if (CmdBlkP->Packet.dest_port == BOOT_RUP) 749 if (CmdBlkP->Packet.dest_port == BOOT_RUP)
756 rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]); 750 rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]);
757 751
758 rio_dprintk(RIO_DEBUG_CMD, "Command 0x%x completed\n", (int) CmdBlkP); 752 rio_dprintk(RIO_DEBUG_CMD, "Command 0x%p completed\n", CmdBlkP);
759 753
760 /* 754 /*
761 ** Clear the Rup lock to prevent mutual exclusion. 755 ** Clear the Rup lock to prevent mutual exclusion.
@@ -782,16 +776,16 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
782 ** is idle, then process the command 776 ** is idle, then process the command
783 */ 777 */
784 if ((CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */ 778 if ((CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */
785 (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { 779 (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
786 /* 780 /*
787 ** if the pre-function is non-zero, call it. 781 ** if the pre-function is non-zero, call it.
788 ** If it returns RIO_FAIL then don't 782 ** If it returns RIO_FAIL then don't
789 ** send this command yet! 783 ** send this command yet!
790 */ 784 */
791 if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) { 785 if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) {
792 rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%x\n", (int) CmdBlkP); 786 rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%p\n", CmdBlkP);
793 } else { 787 } else {
794 rio_dprintk(RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n", (int) CmdBlkP, CmdBlkP->Packet.data[0]); 788 rio_dprintk(RIO_DEBUG_CMD, "Start new command 0x%p Cmd byte is 0x%x\n", CmdBlkP, CmdBlkP->Packet.data[0]);
795 /* 789 /*
796 ** Whammy! blat that pack! 790 ** Whammy! blat that pack!
797 */ 791 */
@@ -810,7 +804,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
810 /* 804 /*
811 ** set the command register 805 ** set the command register
812 */ 806 */
813 WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY); 807 writew(TX_PACKET_READY, &UnixRupP->RupP->txcontrol);
814 808
815 /* 809 /*
816 ** the command block will be freed 810 ** the command block will be freed
@@ -822,7 +816,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
822 } while (Rup); 816 } while (Rup);
823} 817}
824 818
825int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP) 819int RIOWFlushMark(unsigned long iPortP, struct CmdBlk *CmdBlkP)
826{ 820{
827 struct Port *PortP = (struct Port *) iPortP; 821 struct Port *PortP = (struct Port *) iPortP;
828 unsigned long flags; 822 unsigned long flags;
@@ -834,7 +828,7 @@ int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP)
834 return RIOUnUse(iPortP, CmdBlkP); 828 return RIOUnUse(iPortP, CmdBlkP);
835} 829}
836 830
837int RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP) 831int RIORFlushEnable(unsigned long iPortP, struct CmdBlk *CmdBlkP)
838{ 832{
839 struct Port *PortP = (struct Port *) iPortP; 833 struct Port *PortP = (struct Port *) iPortP;
840 PKT *PacketP; 834 PKT *PacketP;
@@ -848,19 +842,19 @@ int RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP)
848 put_free_end(PortP->HostP, PacketP); 842 put_free_end(PortP->HostP, PacketP);
849 } 843 }
850 844
851 if (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) { 845 if (readw(&PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) {
852 /* 846 /*
853 ** MAGIC! (Basically, handshake the RX buffer, so that 847 ** MAGIC! (Basically, handshake the RX buffer, so that
854 ** the RTAs upstream can be re-enabled.) 848 ** the RTAs upstream can be re-enabled.)
855 */ 849 */
856 rio_dprintk(RIO_DEBUG_CMD, "Util: Set RX handshake bit\n"); 850 rio_dprintk(RIO_DEBUG_CMD, "Util: Set RX handshake bit\n");
857 WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); 851 writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &PortP->PhbP->handshake);
858 } 852 }
859 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 853 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
860 return RIOUnUse(iPortP, CmdBlkP); 854 return RIOUnUse(iPortP, CmdBlkP);
861} 855}
862 856
863int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP) 857int RIOUnUse(unsigned long iPortP, struct CmdBlk *CmdBlkP)
864{ 858{
865 struct Port *PortP = (struct Port *) iPortP; 859 struct Port *PortP = (struct Port *) iPortP;
866 unsigned long flags; 860 unsigned long flags;
@@ -890,7 +884,7 @@ int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP)
890 ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data 884 ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data
891 ** hanging around in the transmit buffer is sent immediately. 885 ** hanging around in the transmit buffer is sent immediately.
892 */ 886 */
893 WWORD(PortP->HostP->ParmMapP->tx_intr, 1); 887 writew(1, &PortP->HostP->ParmMapP->tx_intr);
894 /* What to do here .. 888 /* What to do here ..
895 wakeup( (caddr_t)&(PortP->InUse) ); 889 wakeup( (caddr_t)&(PortP->InUse) );
896 */ 890 */
diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c
index 0d44ef464e6b..1d73c4646bbd 100644
--- a/drivers/char/rio/rioinit.c
+++ b/drivers/char/rio/rioinit.c
@@ -82,9 +82,6 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3";
82#include "rioioctl.h" 82#include "rioioctl.h"
83#include "rio_linux.h" 83#include "rio_linux.h"
84 84
85#undef bcopy
86#define bcopy rio_pcicopy
87
88int RIOPCIinit(struct rio_info *p, int Mode); 85int RIOPCIinit(struct rio_info *p, int Mode);
89 86
90static int RIOScrub(int, BYTE *, int); 87static int RIOScrub(int, BYTE *, int);
@@ -99,12 +96,8 @@ static int RIOScrub(int, BYTE *, int);
99** bits < 0 indicates 8 bit operation requested, 96** bits < 0 indicates 8 bit operation requested,
100** bits > 0 indicates 16 bit operation. 97** bits > 0 indicates 16 bit operation.
101*/ 98*/
102int 99
103RIOAssignAT(p, Base, virtAddr, mode) 100int RIOAssignAT(struct rio_info *p, int Base, caddr_t virtAddr, int mode)
104struct rio_info * p;
105int Base;
106caddr_t virtAddr;
107int mode;
108{ 101{
109 int bits; 102 int bits;
110 struct DpRam *cardp = (struct DpRam *)virtAddr; 103 struct DpRam *cardp = (struct DpRam *)virtAddr;
@@ -124,29 +117,25 @@ int mode;
124 /* 117 /*
125 ** Revision 01 AT host cards don't support WORD operations, 118 ** Revision 01 AT host cards don't support WORD operations,
126 */ 119 */
127 if ( RBYTE(cardp->DpRevision) == 01 ) 120 if (readb(&cardp->DpRevision) == 01)
128 bits = BYTE_OPERATION; 121 bits = BYTE_OPERATION;
129 122
130 p->RIOHosts[p->RIONumHosts].Type = RIO_AT; 123 p->RIOHosts[p->RIONumHosts].Type = RIO_AT;
131 p->RIOHosts[p->RIONumHosts].Copy = bcopy; 124 p->RIOHosts[p->RIONumHosts].Copy = rio_copy_to_card;
132 /* set this later */ 125 /* set this later */
133 p->RIOHosts[p->RIONumHosts].Slot = -1; 126 p->RIOHosts[p->RIONumHosts].Slot = -1;
134 p->RIOHosts[p->RIONumHosts].Mode = SLOW_LINKS | SLOW_AT_BUS | bits; 127 p->RIOHosts[p->RIONumHosts].Mode = SLOW_LINKS | SLOW_AT_BUS | bits;
135 WBYTE(p->RIOHosts[p->RIONumHosts].Control, 128 writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE ,
136 BOOT_FROM_RAM | EXTERNAL_BUS_OFF | 129 &p->RIOHosts[p->RIONumHosts].Control);
137 p->RIOHosts[p->RIONumHosts].Mode | 130 writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt);
138 INTERRUPT_DISABLE ); 131 writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE,
139 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff); 132 &p->RIOHosts[p->RIONumHosts].Control);
140 WBYTE(p->RIOHosts[p->RIONumHosts].Control, 133 writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt);
141 BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
142 p->RIOHosts[p->RIONumHosts].Mode |
143 INTERRUPT_DISABLE );
144 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff);
145 p->RIOHosts[p->RIONumHosts].UniqueNum = 134 p->RIOHosts[p->RIONumHosts].UniqueNum =
146 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)| 135 ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)|
147 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)| 136 ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)|
148 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)| 137 ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)|
149 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24); 138 ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24);
150 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Uniquenum 0x%x\n",p->RIOHosts[p->RIONumHosts].UniqueNum); 139 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Uniquenum 0x%x\n",p->RIOHosts[p->RIONumHosts].UniqueNum);
151 140
152 p->RIONumHosts++; 141 p->RIONumHosts++;
@@ -154,7 +143,7 @@ int mode;
154 return(1); 143 return(1);
155} 144}
156 145
157static uchar val[] = { 146static u8 val[] = {
158#ifdef VERY_LONG_TEST 147#ifdef VERY_LONG_TEST
159 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 148 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
160 0xa5, 0xff, 0x5a, 0x00, 0xff, 0xc9, 0x36, 149 0xa5, 0xff, 0x5a, 0x00, 0xff, 0xc9, 0x36,
@@ -167,12 +156,7 @@ static uchar val[] = {
167** RAM test a board. 156** RAM test a board.
168** Nothing too complicated, just enough to check it out. 157** Nothing too complicated, just enough to check it out.
169*/ 158*/
170int 159int RIOBoardTest(paddr_t paddr, caddr_t caddr, unsigned char type, int slot)
171RIOBoardTest(paddr, caddr, type, slot)
172paddr_t paddr;
173caddr_t caddr;
174uchar type;
175int slot;
176{ 160{
177 struct DpRam *DpRam = (struct DpRam *)caddr; 161 struct DpRam *DpRam = (struct DpRam *)caddr;
178 char *ram[4]; 162 char *ram[4];
@@ -180,8 +164,8 @@ int slot;
180 int op, bank; 164 int op, bank;
181 int nbanks; 165 int nbanks;
182 166
183 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=0x%x, slot=%d\n", 167 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=0x%p, slot=%d\n",
184 type,(int)DpRam, slot); 168 type, DpRam, slot);
185 169
186 RIOHostReset(type, DpRam, slot); 170 RIOHostReset(type, DpRam, slot);
187 171
@@ -209,12 +193,11 @@ int slot;
209 193
210 194
211 if (nbanks == 3) { 195 if (nbanks == 3) {
212 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", 196 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: 0x%p(0x%x), 0x%p(0x%x), 0x%p(0x%x)\n",
213 (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2]); 197 ram[0], size[0], ram[1], size[1], ram[2], size[2]);
214 } else { 198 } else {
215 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", 199 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: 0x%p(0x%x), 0x%p(0x%x), 0x%p(0x%x), 0x%p(0x%x)\n",
216 (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2], (int)ram[3], 200 ram[0], size[0], ram[1], size[1], ram[2], size[2], ram[3], size[3]);
217 size[3]);
218 } 201 }
219 202
220 /* 203 /*
@@ -248,13 +231,10 @@ int slot;
248** Call with op not zero, and the RAM will be read and compated with val[op-1] 231** Call with op not zero, and the RAM will be read and compated with val[op-1]
249** to check that the data from the previous phase was retained. 232** to check that the data from the previous phase was retained.
250*/ 233*/
251static int 234
252RIOScrub(op, ram, size) 235static int RIOScrub(int op, BYTE *ram, int size)
253int op;
254BYTE * ram;
255int size;
256{ 236{
257 int off; 237 int off;
258 unsigned char oldbyte; 238 unsigned char oldbyte;
259 unsigned char newbyte; 239 unsigned char newbyte;
260 unsigned char invbyte; 240 unsigned char invbyte;
@@ -279,15 +259,15 @@ int size;
279 */ 259 */
280 if (op) { 260 if (op) {
281 for (off=0; off<size; off++) { 261 for (off=0; off<size; off++) {
282 if (RBYTE(ram[off]) != oldbyte) { 262 if (readb(ram + off) != oldbyte) {
283 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 1: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, RBYTE(ram[off])); 263 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 1: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, readb(ram + off));
284 return RIO_FAIL; 264 return RIO_FAIL;
285 } 265 }
286 } 266 }
287 for (off=0; off<size; off+=2) { 267 for (off=0; off<size; off+=2) {
288 if (*(ushort *)&ram[off] != oldword) { 268 if (readw(ram + off) != oldword) {
289 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: WORD at offset 0x%x should have been=%x, was=%x\n",off,oldword,*(ushort *)&ram[off]); 269 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: WORD at offset 0x%x should have been=%x, was=%x\n",off,oldword, readw(ram + off));
290 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); 270 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram+off+1));
291 return RIO_FAIL; 271 return RIO_FAIL;
292 } 272 }
293 } 273 }
@@ -301,13 +281,13 @@ int size;
301 ** the BYTE read/write test. 281 ** the BYTE read/write test.
302 */ 282 */
303 for (off=0; off<size; off++) { 283 for (off=0; off<size; off++) {
304 if (op && (RBYTE(ram[off]) != oldbyte)) { 284 if (op && (readb(ram + off) != oldbyte)) {
305 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, RBYTE(ram[off])); 285 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, readb(ram + off));
306 return RIO_FAIL; 286 return RIO_FAIL;
307 } 287 }
308 WBYTE(ram[off],invbyte); 288 writeb(invbyte, ram + off);
309 if (RBYTE(ram[off]) != invbyte) { 289 if (readb(ram + off) != invbyte) {
310 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Inv Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, invbyte, RBYTE(ram[off])); 290 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Inv Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, invbyte, readb(ram + off));
311 return RIO_FAIL; 291 return RIO_FAIL;
312 } 292 }
313 } 293 }
@@ -320,16 +300,16 @@ int size;
320 ** This is the WORD operation test. 300 ** This is the WORD operation test.
321 */ 301 */
322 for (off=0; off<size; off+=2) { 302 for (off=0; off<size; off+=2) {
323 if (*(ushort *)&ram[off] != invword) { 303 if (readw(ram + off) != invword) {
324 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: WORD at offset 0x%x should have been=%x, was=%x\n", off, invword, *(ushort *)&ram[off]); 304 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: WORD at offset 0x%x should have been=%x, was=%x\n", off, invword, readw(ram + off));
325 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); 305 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram+off+1));
326 return RIO_FAIL; 306 return RIO_FAIL;
327 } 307 }
328 308
329 *(ushort *)&ram[off] = newword; 309 writew(newword, ram + off);
330 if ( *(ushort *)&ram[off] != newword ) { 310 if ( readw(ram + off) != newword ) {
331 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, *(ushort *)&ram[off]); 311 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, readw(ram + off));
332 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); 312 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram + off + 1));
333 return RIO_FAIL; 313 return RIO_FAIL;
334 } 314 }
335 } 315 }
@@ -340,16 +320,16 @@ int size;
340 ** required test data. 320 ** required test data.
341 */ 321 */
342 for (off=0; off<size; off++) { 322 for (off=0; off<size; off++) {
343 if (RBYTE(ram[off]) != newbyte) { 323 if (readb(ram + off) != newbyte) {
344 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Byte Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, RBYTE(ram[off])); 324 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Byte Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, readb(ram + off));
345 return RIO_FAIL; 325 return RIO_FAIL;
346 } 326 }
347 } 327 }
348 328
349 for (off=0; off<size; off+=2) { 329 for (off=0; off<size; off+=2) {
350 if ( *(ushort *)&ram[off] != newword ) { 330 if (readw(ram + off) != newword ) {
351 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, *(ushort *)&ram[off]); 331 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, readw(ram + off));
352 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); 332 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram + off + 1));
353 return RIO_FAIL; 333 return RIO_FAIL;
354 } 334 }
355 } 335 }
@@ -360,41 +340,37 @@ int size;
360 swapword = invbyte | (newbyte << 8); 340 swapword = invbyte | (newbyte << 8);
361 341
362 for (off=0; off<size; off+=2) { 342 for (off=0; off<size; off+=2) {
363 WBYTE(ram[off],invbyte); 343 writeb(invbyte, &ram[off]);
364 WBYTE(ram[off+1],newbyte); 344 writeb(newbyte, &ram[off+1]);
365 } 345 }
366 346
367 for ( off=0; off<size; off+=2 ) { 347 for ( off=0; off<size; off+=2 ) {
368 if (*(ushort *)&ram[off] != swapword) { 348 if (readw(ram + off) != swapword) {
369 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, swapword, *((ushort *)&ram[off])); 349 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, swapword, readw(ram + off));
370 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); 350 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram + off + 1));
371 return RIO_FAIL; 351 return RIO_FAIL;
372 } 352 }
373 *((ushort *)&ram[off]) = ~swapword; 353 writew(~swapword, ram + off);
374 } 354 }
375 355
376 for (off=0; off<size; off+=2) { 356 for (off=0; off<size; off+=2) {
377 if (RBYTE(ram[off]) != newbyte) { 357 if (readb(ram + off) != newbyte) {
378 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, RBYTE(ram[off])); 358 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, readb(ram + off));
379 return RIO_FAIL; 359 return RIO_FAIL;
380 } 360 }
381 if (RBYTE(ram[off+1]) != invbyte) { 361 if (readb(ram + off + 1) != invbyte) {
382 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off+1, invbyte, RBYTE(ram[off+1])); 362 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off+1, invbyte, readb(ram + off + 1));
383 return RIO_FAIL; 363 return RIO_FAIL;
384 } 364 }
385 *((ushort *)&ram[off]) = newword; 365 writew(newword, ram + off);
386 } 366 }
387 return RIO_SUCCESS; 367 return RIO_SUCCESS;
388} 368}
389 369
390 370
391int 371int RIODefaultName(struct rio_info *p, struct Host *HostP, unsigned int UnitId)
392RIODefaultName(p, HostP, UnitId)
393struct rio_info * p;
394struct Host * HostP;
395uint UnitId;
396{ 372{
397 bcopy("UNKNOWN RTA X-XX",HostP->Mapping[UnitId].Name,17); 373 memcpy(HostP->Mapping[UnitId].Name, "UNKNOWN RTA X-XX", 17);
398 HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts); 374 HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts);
399 if ((UnitId+1) > 9) { 375 if ((UnitId+1) > 9) {
400 HostP->Mapping[UnitId].Name[14]='0'+((UnitId+1)/10); 376 HostP->Mapping[UnitId].Name[14]='0'+((UnitId+1)/10);
@@ -412,8 +388,7 @@ uint UnitId;
412 388
413static struct rioVersion stVersion; 389static struct rioVersion stVersion;
414 390
415struct rioVersion * 391struct rioVersion *RIOVersid(void)
416RIOVersid(void)
417{ 392{
418 strlcpy(stVersion.version, "RIO driver for linux V1.0", 393 strlcpy(stVersion.version, "RIO driver for linux V1.0",
419 sizeof(stVersion.version)); 394 sizeof(stVersion.version));
@@ -423,40 +398,31 @@ RIOVersid(void)
423 return &stVersion; 398 return &stVersion;
424} 399}
425 400
426void 401void RIOHostReset(unsigned int Type, struct DpRam *DpRamP, unsigned int Slot)
427RIOHostReset(Type, DpRamP, Slot)
428uint Type;
429volatile struct DpRam *DpRamP;
430uint Slot;
431{ 402{
432 /* 403 /*
433 ** Reset the Tpu 404 ** Reset the Tpu
434 */ 405 */
435 rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: type 0x%x", Type); 406 rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: type 0x%x", Type);
436 switch ( Type ) { 407 switch ( Type ) {
437 case RIO_AT: 408 case RIO_AT:
438 rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n"); 409 rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n");
439 WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF | 410 writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | BYTE_OPERATION |
440 INTERRUPT_DISABLE | BYTE_OPERATION | 411 SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl);
441 SLOW_LINKS | SLOW_AT_BUS); 412 writeb(0xFF, &DpRamP->DpResetTpu);
442 WBYTE(DpRamP->DpResetTpu, 0xFF); 413 udelay(3);
443 udelay(3);
444
445 rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n"); 414 rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n");
446 WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF | 415 writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE |
447 INTERRUPT_DISABLE | BYTE_OPERATION | 416 BYTE_OPERATION | SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl);
448 SLOW_LINKS | SLOW_AT_BUS); 417 writeb(0xFF, &DpRamP->DpResetTpu);
449 WBYTE(DpRamP->DpResetTpu, 0xFF); 418 udelay(3);
450 udelay(3); 419 break;
451 break;
452 case RIO_PCI: 420 case RIO_PCI:
453 rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n"); 421 rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n");
454 DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM; 422 writeb(RIO_PCI_BOOT_FROM_RAM, &DpRamP->DpControl);
455 DpRamP->DpResetInt = 0xFF; 423 writeb(0xFF, &DpRamP->DpResetInt);
456 DpRamP->DpResetTpu = 0xFF; 424 writeb(0xFF, &DpRamP->DpResetTpu);
457 udelay(100); 425 udelay(100);
458 /* for (i=0; i<6000; i++); */
459 /* suspend( 3 ); */
460 break; 426 break;
461 default: 427 default:
462 rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n"); 428 rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n");
diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c
index 34d8787557a1..ec415ccbc4f0 100644
--- a/drivers/char/rio/riointr.c
+++ b/drivers/char/rio/riointr.c
@@ -101,8 +101,7 @@ static char *firstchars(char *p, int nch)
101 101
102#define INCR( P, I ) ((P) = (((P)+(I)) & p->RIOBufferMask)) 102#define INCR( P, I ) ((P) = (((P)+(I)) & p->RIOBufferMask))
103/* Enable and start the transmission of packets */ 103/* Enable and start the transmission of packets */
104void RIOTxEnable(en) 104void RIOTxEnable(char *en)
105char *en;
106{ 105{
107 struct Port *PortP; 106 struct Port *PortP;
108 struct rio_info *p; 107 struct rio_info *p;
@@ -186,10 +185,8 @@ char *en;
186static int RupIntr; 185static int RupIntr;
187static int RxIntr; 186static int RxIntr;
188static int TxIntr; 187static int TxIntr;
189void RIOServiceHost(p, HostP, From) 188
190struct rio_info *p; 189void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From)
191struct Host *HostP;
192int From;
193{ 190{
194 rio_spin_lock(&HostP->HostLock); 191 rio_spin_lock(&HostP->HostLock);
195 if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { 192 if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
@@ -201,22 +198,22 @@ int From;
201 } 198 }
202 rio_spin_unlock(&HostP->HostLock); 199 rio_spin_unlock(&HostP->HostLock);
203 200
204 if (RWORD(HostP->ParmMapP->rup_intr)) { 201 if (readw(&HostP->ParmMapP->rup_intr)) {
205 WWORD(HostP->ParmMapP->rup_intr, 0); 202 writew(0, &HostP->ParmMapP->rup_intr);
206 p->RIORupCount++; 203 p->RIORupCount++;
207 RupIntr++; 204 RupIntr++;
208 rio_dprintk(RIO_DEBUG_INTR, "rio: RUP interrupt on host %d\n", HostP - p->RIOHosts); 205 rio_dprintk(RIO_DEBUG_INTR, "rio: RUP interrupt on host %Zd\n", HostP - p->RIOHosts);
209 RIOPollHostCommands(p, HostP); 206 RIOPollHostCommands(p, HostP);
210 } 207 }
211 208
212 if (RWORD(HostP->ParmMapP->rx_intr)) { 209 if (readw(&HostP->ParmMapP->rx_intr)) {
213 int port; 210 int port;
214 211
215 WWORD(HostP->ParmMapP->rx_intr, 0); 212 writew(0, &HostP->ParmMapP->rx_intr);
216 p->RIORxCount++; 213 p->RIORxCount++;
217 RxIntr++; 214 RxIntr++;
218 215
219 rio_dprintk(RIO_DEBUG_INTR, "rio: RX interrupt on host %d\n", HostP - p->RIOHosts); 216 rio_dprintk(RIO_DEBUG_INTR, "rio: RX interrupt on host %Zd\n", HostP - p->RIOHosts);
220 /* 217 /*
221 ** Loop through every port. If the port is mapped into 218 ** Loop through every port. If the port is mapped into
222 ** the system ( i.e. has /dev/ttyXXXX associated ) then it is 219 ** the system ( i.e. has /dev/ttyXXXX associated ) then it is
@@ -277,26 +274,26 @@ int From;
277 ** it's handshake bit is set, then we must clear the handshake, 274 ** it's handshake bit is set, then we must clear the handshake,
278 ** so that that downstream RTA is re-enabled. 275 ** so that that downstream RTA is re-enabled.
279 */ 276 */
280 if (!can_remove_receive(&PacketP, PortP) && (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET)) { 277 if (!can_remove_receive(&PacketP, PortP) && (readw(&PortP->PhbP->handshake) == PHB_HANDSHAKE_SET)) {
281 /* 278 /*
282 ** MAGIC! ( Basically, handshake the RX buffer, so that 279 ** MAGIC! ( Basically, handshake the RX buffer, so that
283 ** the RTAs upstream can be re-enabled. ) 280 ** the RTAs upstream can be re-enabled. )
284 */ 281 */
285 rio_dprintk(RIO_DEBUG_INTR, "Set RX handshake bit\n"); 282 rio_dprintk(RIO_DEBUG_INTR, "Set RX handshake bit\n");
286 WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); 283 writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &PortP->PhbP->handshake);
287 } 284 }
288 rio_spin_unlock(&PortP->portSem); 285 rio_spin_unlock(&PortP->portSem);
289 } 286 }
290 } 287 }
291 288
292 if (RWORD(HostP->ParmMapP->tx_intr)) { 289 if (readw(&HostP->ParmMapP->tx_intr)) {
293 int port; 290 int port;
294 291
295 WWORD(HostP->ParmMapP->tx_intr, 0); 292 writew(0, &HostP->ParmMapP->tx_intr);
296 293
297 p->RIOTxCount++; 294 p->RIOTxCount++;
298 TxIntr++; 295 TxIntr++;
299 rio_dprintk(RIO_DEBUG_INTR, "rio: TX interrupt on host %d\n", HostP - p->RIOHosts); 296 rio_dprintk(RIO_DEBUG_INTR, "rio: TX interrupt on host %Zd\n", HostP - p->RIOHosts);
300 297
301 /* 298 /*
302 ** Loop through every port. 299 ** Loop through every port.
@@ -445,9 +442,9 @@ int From;
445 */ 442 */
446 PktCmdP = (struct PktCmd *) &PacketP->data[0]; 443 PktCmdP = (struct PktCmd *) &PacketP->data[0];
447 444
448 WBYTE(PktCmdP->Command, WFLUSH); 445 writeb(WFLUSH, &PktCmdP->Command);
449 446
450 p = PortP->HostPort % (ushort) PORTS_PER_RTA; 447 p = PortP->HostPort % (u16) PORTS_PER_RTA;
451 448
452 /* 449 /*
453 ** If second block of ports for 16 port RTA, add 8 450 ** If second block of ports for 16 port RTA, add 8
@@ -456,27 +453,27 @@ int From;
456 if (PortP->SecondBlock) 453 if (PortP->SecondBlock)
457 p += PORTS_PER_RTA; 454 p += PORTS_PER_RTA;
458 455
459 WBYTE(PktCmdP->PhbNum, p); 456 writeb(p, &PktCmdP->PhbNum);
460 457
461 /* 458 /*
462 ** to make debuggery easier 459 ** to make debuggery easier
463 */ 460 */
464 WBYTE(PacketP->data[2], 'W'); 461 writeb('W', &PacketP->data[2]);
465 WBYTE(PacketP->data[3], 'F'); 462 writeb('F', &PacketP->data[3]);
466 WBYTE(PacketP->data[4], 'L'); 463 writeb('L', &PacketP->data[4]);
467 WBYTE(PacketP->data[5], 'U'); 464 writeb('U', &PacketP->data[5]);
468 WBYTE(PacketP->data[6], 'S'); 465 writeb('S', &PacketP->data[6]);
469 WBYTE(PacketP->data[7], 'H'); 466 writeb('H', &PacketP->data[7]);
470 WBYTE(PacketP->data[8], ' '); 467 writeb(' ', &PacketP->data[8]);
471 WBYTE(PacketP->data[9], '0' + PortP->WflushFlag); 468 writeb('0' + PortP->WflushFlag, &PacketP->data[9]);
472 WBYTE(PacketP->data[10], ' '); 469 writeb(' ', &PacketP->data[10]);
473 WBYTE(PacketP->data[11], ' '); 470 writeb(' ', &PacketP->data[11]);
474 WBYTE(PacketP->data[12], '\0'); 471 writeb('\0', &PacketP->data[12]);
475 472
476 /* 473 /*
477 ** its two bytes long! 474 ** its two bytes long!
478 */ 475 */
479 WBYTE(PacketP->len, PKT_CMD_BIT | 2); 476 writeb(PKT_CMD_BIT | 2, &PacketP->len);
480 477
481 /* 478 /*
482 ** queue it! 479 ** queue it!
@@ -529,19 +526,15 @@ int From;
529} 526}
530 527
531/* 528/*
532** Routine for handling received data for clist drivers. 529** Routine for handling received data for tty drivers
533** NB: Called with the tty locked. The spl from the lockb( ) is passed.
534** we return the ttySpl level that we re-locked at.
535*/ 530*/
536static void RIOReceive(p, PortP) 531static void RIOReceive(struct rio_info *p, struct Port *PortP)
537struct rio_info *p;
538struct Port *PortP;
539{ 532{
540 struct tty_struct *TtyP; 533 struct tty_struct *TtyP;
541 register ushort transCount; 534 unsigned short transCount;
542 struct PKT *PacketP; 535 struct PKT *PacketP;
543 register uint DataCnt; 536 register unsigned int DataCnt;
544 uchar *ptr; 537 unsigned char *ptr;
545 unsigned char *buf; 538 unsigned char *buf;
546 int copied = 0; 539 int copied = 0;
547 540
@@ -594,9 +587,6 @@ struct Port *PortP;
594 transCount = 1; 587 transCount = 1;
595 while (can_remove_receive(&PacketP, PortP) 588 while (can_remove_receive(&PacketP, PortP)
596 && transCount) { 589 && transCount) {
597#ifdef STATS
598 PortP->Stat.RxIntCnt++;
599#endif /* STATS */
600 RxIntCnt++; 590 RxIntCnt++;
601 591
602 /* 592 /*
@@ -642,28 +632,15 @@ struct Port *PortP;
642 ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the 632 ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the
643 ** driver). 633 ** driver).
644 */ 634 */
645#undef ___DEBUG_IT___ 635 ptr = (unsigned char *) PacketP->data + PortP->RxDataStart;
646#ifdef ___DEBUG_IT___
647 kkprintf("I:%d R:%d P:%d Q:%d C:%d F:%x ", intCount, RxIntCnt, PortP->PortNum, TtyP->rxqueue.count, transCount, TtyP->flags);
648#endif
649 ptr = (uchar *) PacketP->data + PortP->RxDataStart;
650 636
651 tty_prepare_flip_string(TtyP, &buf, transCount); 637 tty_prepare_flip_string(TtyP, &buf, transCount);
652 rio_memcpy_fromio(buf, ptr, transCount); 638 rio_memcpy_fromio(buf, ptr, transCount);
653#ifdef STATS
654 /*
655 ** keep a count for statistical purposes
656 */
657 PortP->Stat.RxCharCnt += transCount;
658#endif
659 PortP->RxDataStart += transCount; 639 PortP->RxDataStart += transCount;
660 PacketP->len -= transCount; 640 PacketP->len -= transCount;
661 copied += transCount; 641 copied += transCount;
662 642
663 643
664#ifdef ___DEBUG_IT___
665 kkprintf("T:%d L:%d\n", DataCnt, PacketP->len);
666#endif
667 644
668 if (PacketP->len == 0) { 645 if (PacketP->len == 0) {
669 /* 646 /*
@@ -674,12 +651,6 @@ struct Port *PortP;
674 remove_receive(PortP); 651 remove_receive(PortP);
675 put_free_end(PortP->HostP, PacketP); 652 put_free_end(PortP->HostP, PacketP);
676 PortP->RxDataStart = 0; 653 PortP->RxDataStart = 0;
677#ifdef STATS
678 /*
679 ** more lies ( oops, I mean statistics )
680 */
681 PortP->Stat.RxPktCnt++;
682#endif /* STATS */
683 } 654 }
684 } 655 }
685 } 656 }
@@ -691,215 +662,3 @@ struct Port *PortP;
691 return; 662 return;
692} 663}
693 664
694#ifdef FUTURE_RELEASE
695/*
696** The proc routine called by the line discipline to do the work for it.
697** The proc routine works hand in hand with the interrupt routine.
698*/
699int riotproc(p, tp, cmd, port)
700struct rio_info *p;
701register struct ttystatics *tp;
702int cmd;
703int port;
704{
705 register struct Port *PortP;
706 int SysPort;
707 struct PKT *PacketP;
708
709 SysPort = port; /* Believe me, it works. */
710
711 if (SysPort < 0 || SysPort >= RIO_PORTS) {
712 rio_dprintk(RIO_DEBUG_INTR, "Illegal port %d derived from TTY in riotproc()\n", SysPort);
713 return 0;
714 }
715 PortP = p->RIOPortp[SysPort];
716
717 if ((uint) PortP->PhbP < (uint) PortP->Caddr || (uint) PortP->PhbP >= (uint) PortP->Caddr + SIXTY_FOUR_K) {
718 rio_dprintk(RIO_DEBUG_INTR, "RIO: NULL or BAD PhbP on sys port %d in proc routine\n", SysPort);
719 rio_dprintk(RIO_DEBUG_INTR, " PortP = 0x%x\n", PortP);
720 rio_dprintk(RIO_DEBUG_INTR, " PortP->PhbP = 0x%x\n", PortP->PhbP);
721 rio_dprintk(RIO_DEBUG_INTR, " PortP->Caddr = 0x%x\n", PortP->PhbP);
722 rio_dprintk(RIO_DEBUG_INTR, " PortP->HostPort = 0x%x\n", PortP->HostPort);
723 return 0;
724 }
725
726 switch (cmd) {
727 case T_WFLUSH:
728 rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH\n");
729 /*
730 ** Because of the spooky way the RIO works, we don't need
731 ** to issue a flush command on any of the SET*F commands,
732 ** as that causes trouble with getty and login, which issue
733 ** these commands to incur a READ flush, and rely on the fact
734 ** that the line discipline does a wait for drain for them.
735 ** As the rio doesn't wait for drain, the write flush would
736 ** destroy the Password: prompt. This isn't very friendly, so
737 ** here we only issue a WFLUSH command if we are in the interrupt
738 ** routine, or we aren't executing a SET*F command.
739 */
740 if (PortP->HostP->InIntr || !PortP->FlushCmdBodge) {
741 /*
742 ** form a wflush packet - 1 byte long, no data
743 */
744 if (PortP->State & RIO_DELETED) {
745 rio_dprintk(RIO_DEBUG_INTR, "WFLUSH on deleted RTA\n");
746 } else {
747 if (RIOPreemptiveCmd(p, PortP, WFLUSH) == RIO_FAIL) {
748 rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command failed\n");
749 } else
750 rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command\n");
751 }
752 /*
753 ** WFLUSH operation - flush the data!
754 */
755 PortP->TxBufferIn = PortP->TxBufferOut = 0;
756 } else {
757 rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command ignored\n");
758 }
759 /*
760 ** sort out the line discipline
761 */
762 if (PortP->CookMode == COOK_WELL)
763 goto start;
764 break;
765
766 case T_RESUME:
767 rio_dprintk(RIO_DEBUG_INTR, "T_RESUME\n");
768 /*
769 ** send pre-emptive resume packet
770 */
771 if (PortP->State & RIO_DELETED) {
772 rio_dprintk(RIO_DEBUG_INTR, "RESUME on deleted RTA\n");
773 } else {
774 if (RIOPreemptiveCmd(p, PortP, RESUME) == RIO_FAIL) {
775 rio_dprintk(RIO_DEBUG_INTR, "T_RESUME Command failed\n");
776 }
777 }
778 /*
779 ** and re-start the sender software!
780 */
781 if (PortP->CookMode == COOK_WELL)
782 goto start;
783 break;
784
785 case T_TIME:
786 rio_dprintk(RIO_DEBUG_INTR, "T_TIME\n");
787 /*
788 ** T_TIME is called when xDLY is set in oflags and
789 ** the line discipline timeout has expired. It's
790 ** function in life is to clear the TIMEOUT flag
791 ** and to re-start output to the port.
792 */
793 /*
794 ** Fall through and re-start output
795 */
796 case T_OUTPUT:
797 start:
798 if (PortP->MagicFlags & MAGIC_FLUSH) {
799 PortP->MagicFlags |= MORE_OUTPUT_EYGOR;
800 return 0;
801 }
802 RIOTxEnable((char *) PortP);
803 PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR;
804 /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"T_OUTPUT finished\n"); */
805 break;
806
807 case T_SUSPEND:
808 rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND\n");
809 /*
810 ** send a suspend pre-emptive packet.
811 */
812 if (PortP->State & RIO_DELETED) {
813 rio_dprintk(RIO_DEBUG_INTR, "SUSPEND deleted RTA\n");
814 } else {
815 if (RIOPreemptiveCmd(p, PortP, SUSPEND) == RIO_FAIL) {
816 rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND Command failed\n");
817 }
818 }
819 /*
820 ** done!
821 */
822 break;
823
824 case T_BLOCK:
825 rio_dprintk(RIO_DEBUG_INTR, "T_BLOCK\n");
826 break;
827
828 case T_RFLUSH:
829 rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH\n");
830 if (PortP->State & RIO_DELETED) {
831 rio_dprintk(RIO_DEBUG_INTR, "RFLUSH on deleted RTA\n");
832 PortP->RxDataStart = 0;
833 } else {
834 if (RIOPreemptiveCmd(p, PortP, RFLUSH) == RIO_FAIL) {
835 rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH Command failed\n");
836 return 0;
837 }
838 PortP->RxDataStart = 0;
839 while (can_remove_receive(&PacketP, PortP)) {
840 remove_receive(PortP);
841 ShowPacket(DBG_PROC, PacketP);
842 put_free_end(PortP->HostP, PacketP);
843 }
844 if (PortP->PhbP->handshake == PHB_HANDSHAKE_SET) {
845 /*
846 ** MAGIC!
847 */
848 rio_dprintk(RIO_DEBUG_INTR, "Set receive handshake bit\n");
849 PortP->PhbP->handshake |= PHB_HANDSHAKE_RESET;
850 }
851 }
852 break;
853 /* FALLTHROUGH */
854 case T_UNBLOCK:
855 rio_dprintk(RIO_DEBUG_INTR, "T_UNBLOCK\n");
856 /*
857 ** If there is any data to receive set a timeout to service it.
858 */
859 RIOReceive(p, PortP);
860 break;
861
862 case T_BREAK:
863 rio_dprintk(RIO_DEBUG_INTR, "T_BREAK\n");
864 /*
865 ** Send a break command. For Sys V
866 ** this is a timed break, so we
867 ** send a SBREAK[time] packet
868 */
869 /*
870 ** Build a BREAK command
871 */
872 if (PortP->State & RIO_DELETED) {
873 rio_dprintk(RIO_DEBUG_INTR, "BREAK on deleted RTA\n");
874 } else {
875 if (RIOShortCommand(PortP, SBREAK, 2, p->RIOConf.BreakInterval) == RIO_FAIL) {
876 rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
877 }
878 }
879
880 /*
881 ** done!
882 */
883 break;
884
885 case T_INPUT:
886 rio_dprintk(RIO_DEBUG_INTR, "Proc T_INPUT called - I don't know what to do!\n");
887 break;
888 case T_PARM:
889 rio_dprintk(RIO_DEBUG_INTR, "Proc T_PARM called - I don't know what to do!\n");
890 break;
891
892 case T_SWTCH:
893 rio_dprintk(RIO_DEBUG_INTR, "Proc T_SWTCH called - I don't know what to do!\n");
894 break;
895
896 default:
897 rio_dprintk(RIO_DEBUG_INTR, "Proc UNKNOWN command %d\n", cmd);
898 }
899 /*
900 ** T_OUTPUT returns without passing through this point!
901 */
902 /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"riotproc done\n"); */
903 return (0);
904}
905#endif