Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] rio driver rework continued #3

Second large chunk of code cleanup. The split between this and #3 and #4 is
fairly arbitary and due to the message length limit on the list. These
patches continue the process of ripping out macros and typedefs while cleaning
up lots of 32bit assumptions. Several inlines for compatibility also get
removed and that causes a lot of noise.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Alan Cox and committed by
Linus Torvalds
00d83a54 e2b3afd6

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