aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rio/riocmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/rio/riocmd.c')
-rw-r--r--drivers/char/rio/riocmd.c896
1 files changed, 423 insertions, 473 deletions
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c
index 533085ec6f1b..b97dd9fdb6ba 100644
--- a/drivers/char/rio/riocmd.c
+++ b/drivers/char/rio/riocmd.c
@@ -83,102 +83,98 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2";
83static struct IdentifyRta IdRta; 83static struct IdentifyRta IdRta;
84static struct KillNeighbour KillUnit; 84static struct KillNeighbour KillUnit;
85 85
86int 86int RIOFoadRta(struct Host *HostP, struct Map *MapP)
87RIOFoadRta(struct Host *HostP, struct Map *MapP)
88{ 87{
89 struct CmdBlk *CmdBlkP; 88 struct CmdBlk *CmdBlkP;
90 89
91 rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA\n"); 90 rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA\n");
92 91
93 CmdBlkP = RIOGetCmdBlk(); 92 CmdBlkP = RIOGetCmdBlk();
94 93
95 if ( !CmdBlkP ) { 94 if (!CmdBlkP) {
96 rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n"); 95 rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n");
97 return -ENXIO; 96 return -ENXIO;
98 } 97 }
99 98
100 CmdBlkP->Packet.dest_unit = MapP->ID; 99 CmdBlkP->Packet.dest_unit = MapP->ID;
101 CmdBlkP->Packet.dest_port = BOOT_RUP; 100 CmdBlkP->Packet.dest_port = BOOT_RUP;
102 CmdBlkP->Packet.src_unit = 0; 101 CmdBlkP->Packet.src_unit = 0;
103 CmdBlkP->Packet.src_port = BOOT_RUP; 102 CmdBlkP->Packet.src_port = BOOT_RUP;
104 CmdBlkP->Packet.len = 0x84; 103 CmdBlkP->Packet.len = 0x84;
105 CmdBlkP->Packet.data[0] = IFOAD; 104 CmdBlkP->Packet.data[0] = IFOAD;
106 CmdBlkP->Packet.data[1] = 0; 105 CmdBlkP->Packet.data[1] = 0;
107 CmdBlkP->Packet.data[2] = IFOAD_MAGIC & 0xFF; 106 CmdBlkP->Packet.data[2] = IFOAD_MAGIC & 0xFF;
108 CmdBlkP->Packet.data[3] = (IFOAD_MAGIC >> 8) & 0xFF; 107 CmdBlkP->Packet.data[3] = (IFOAD_MAGIC >> 8) & 0xFF;
109 108
110 if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { 109 if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
111 rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n"); 110 rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n");
112 return -EIO; 111 return -EIO;
113 } 112 }
114 return 0; 113 return 0;
115} 114}
116 115
117int 116int RIOZombieRta(struct Host *HostP, struct Map *MapP)
118RIOZombieRta(struct Host *HostP, struct Map *MapP)
119{ 117{
120 struct CmdBlk *CmdBlkP; 118 struct CmdBlk *CmdBlkP;
121 119
122 rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA\n"); 120 rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA\n");
123 121
124 CmdBlkP = RIOGetCmdBlk(); 122 CmdBlkP = RIOGetCmdBlk();
125 123
126 if ( !CmdBlkP ) { 124 if (!CmdBlkP) {
127 rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n"); 125 rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n");
128 return -ENXIO; 126 return -ENXIO;
129 } 127 }
130 128
131 CmdBlkP->Packet.dest_unit = MapP->ID; 129 CmdBlkP->Packet.dest_unit = MapP->ID;
132 CmdBlkP->Packet.dest_port = BOOT_RUP; 130 CmdBlkP->Packet.dest_port = BOOT_RUP;
133 CmdBlkP->Packet.src_unit = 0; 131 CmdBlkP->Packet.src_unit = 0;
134 CmdBlkP->Packet.src_port = BOOT_RUP; 132 CmdBlkP->Packet.src_port = BOOT_RUP;
135 CmdBlkP->Packet.len = 0x84; 133 CmdBlkP->Packet.len = 0x84;
136 CmdBlkP->Packet.data[0] = ZOMBIE; 134 CmdBlkP->Packet.data[0] = ZOMBIE;
137 CmdBlkP->Packet.data[1] = 0; 135 CmdBlkP->Packet.data[1] = 0;
138 CmdBlkP->Packet.data[2] = ZOMBIE_MAGIC & 0xFF; 136 CmdBlkP->Packet.data[2] = ZOMBIE_MAGIC & 0xFF;
139 CmdBlkP->Packet.data[3] = (ZOMBIE_MAGIC >> 8) & 0xFF; 137 CmdBlkP->Packet.data[3] = (ZOMBIE_MAGIC >> 8) & 0xFF;
140 138
141 if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { 139 if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
142 rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n"); 140 rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n");
143 return -EIO; 141 return -EIO;
144 } 142 }
145 return 0; 143 return 0;
146} 144}
147 145
148int 146int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP))
149RIOCommandRta(struct rio_info *p, uint RtaUnique,
150 int (* func)(struct Host *HostP, struct Map *MapP))
151{ 147{
152 uint Host; 148 uint Host;
153 149
154 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%x func 0x%x\n", RtaUnique, (int) func);
155 151
156 if ( !RtaUnique ) 152 if (!RtaUnique)
157 return(0); 153 return (0);
158 154
159 for ( Host = 0; Host < p->RIONumHosts; Host++ ) { 155 for (Host = 0; Host < p->RIONumHosts; Host++) {
160 uint Rta; 156 uint Rta;
161 struct Host *HostP = &p->RIOHosts[Host]; 157 struct Host *HostP = &p->RIOHosts[Host];
162 158
163 for ( Rta = 0; Rta < RTAS_PER_HOST; Rta++ ) { 159 for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) {
164 struct Map *MapP = &HostP->Mapping[Rta]; 160 struct Map *MapP = &HostP->Mapping[Rta];
165 161
166 if ( MapP->RtaUniqueNum == RtaUnique ) { 162 if (MapP->RtaUniqueNum == RtaUnique) {
167 uint Link; 163 uint Link;
168 164
169 /* 165 /*
170 ** now, lets just check we have a route to it... 166 ** now, lets just check we have a route to it...
171 ** IF the routing stuff is working, then one of the 167 ** IF the routing stuff is working, then one of the
172 ** topology entries for this unit will have a legit 168 ** topology entries for this unit will have a legit
173 ** route *somewhere*. We care not where - if its got 169 ** route *somewhere*. We care not where - if its got
174 ** any connections, we can get to it. 170 ** any connections, we can get to it.
175 */ 171 */
176 for ( Link = 0; Link < LINKS_PER_UNIT; Link++ ) { 172 for (Link = 0; Link < LINKS_PER_UNIT; Link++) {
177 if ( MapP->Topology[Link].Unit <= (uchar)MAX_RUP ) { 173 if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) {
178 /* 174 /*
179 ** Its worth trying the operation... 175 ** Its worth trying the operation...
180 */ 176 */
181 return (*func)( HostP, MapP ); 177 return (*func) (HostP, MapP);
182 } 178 }
183 } 179 }
184 } 180 }
@@ -188,60 +184,59 @@ RIOCommandRta(struct rio_info *p, uint RtaUnique,
188} 184}
189 185
190 186
191int 187int RIOIdentifyRta(struct rio_info *p, caddr_t arg)
192RIOIdentifyRta(struct rio_info *p, caddr_t arg)
193{ 188{
194 uint Host; 189 uint Host;
195 190
196 if ( copyin( (int)arg, (caddr_t)&IdRta, sizeof(IdRta) ) == COPYFAIL ) { 191 if (copyin((int) arg, (caddr_t) & IdRta, sizeof(IdRta)) == COPYFAIL) {
197 rio_dprintk (RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n"); 192 rio_dprintk(RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n");
198 p->RIOError.Error = COPYIN_FAILED; 193 p->RIOError.Error = COPYIN_FAILED;
199 return -EFAULT; 194 return -EFAULT;
200 } 195 }
201 196
202 for ( Host = 0 ; Host < p->RIONumHosts; Host++ ) { 197 for (Host = 0; Host < p->RIONumHosts; Host++) {
203 uint Rta; 198 uint Rta;
204 struct Host *HostP = &p->RIOHosts[Host]; 199 struct Host *HostP = &p->RIOHosts[Host];
205 200
206 for ( Rta = 0; Rta < RTAS_PER_HOST; Rta++ ) { 201 for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) {
207 struct Map *MapP = &HostP->Mapping[Rta]; 202 struct Map *MapP = &HostP->Mapping[Rta];
208 203
209 if ( MapP->RtaUniqueNum == IdRta.RtaUnique ) { 204 if (MapP->RtaUniqueNum == IdRta.RtaUnique) {
210 uint Link; 205 uint Link;
211 /* 206 /*
212 ** now, lets just check we have a route to it... 207 ** now, lets just check we have a route to it...
213 ** IF the routing stuff is working, then one of the 208 ** IF the routing stuff is working, then one of the
214 ** topology entries for this unit will have a legit 209 ** topology entries for this unit will have a legit
215 ** route *somewhere*. We care not where - if its got 210 ** route *somewhere*. We care not where - if its got
216 ** any connections, we can get to it. 211 ** any connections, we can get to it.
217 */ 212 */
218 for ( Link = 0; Link < LINKS_PER_UNIT; Link++ ) { 213 for (Link = 0; Link < LINKS_PER_UNIT; Link++) {
219 if ( MapP->Topology[Link].Unit <= (uchar)MAX_RUP ) { 214 if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) {
220 /* 215 /*
221 ** Its worth trying the operation... 216 ** Its worth trying the operation...
222 */ 217 */
223 struct CmdBlk *CmdBlkP; 218 struct CmdBlk *CmdBlkP;
224 219
225 rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA\n"); 220 rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA\n");
226 221
227 CmdBlkP = RIOGetCmdBlk(); 222 CmdBlkP = RIOGetCmdBlk();
228 223
229 if ( !CmdBlkP ) { 224 if (!CmdBlkP) {
230 rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n"); 225 rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n");
231 return -ENXIO; 226 return -ENXIO;
232 } 227 }
233 228
234 CmdBlkP->Packet.dest_unit = MapP->ID; 229 CmdBlkP->Packet.dest_unit = MapP->ID;
235 CmdBlkP->Packet.dest_port = BOOT_RUP; 230 CmdBlkP->Packet.dest_port = BOOT_RUP;
236 CmdBlkP->Packet.src_unit = 0; 231 CmdBlkP->Packet.src_unit = 0;
237 CmdBlkP->Packet.src_port = BOOT_RUP; 232 CmdBlkP->Packet.src_port = BOOT_RUP;
238 CmdBlkP->Packet.len = 0x84; 233 CmdBlkP->Packet.len = 0x84;
239 CmdBlkP->Packet.data[0] = IDENTIFY; 234 CmdBlkP->Packet.data[0] = IDENTIFY;
240 CmdBlkP->Packet.data[1] = 0; 235 CmdBlkP->Packet.data[1] = 0;
241 CmdBlkP->Packet.data[2] = IdRta.ID; 236 CmdBlkP->Packet.data[2] = IdRta.ID;
242 237
243 if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { 238 if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
244 rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n"); 239 rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n");
245 return -EIO; 240 return -EIO;
246 } 241 }
247 return 0; 242 return 0;
@@ -249,114 +244,110 @@ RIOIdentifyRta(struct rio_info *p, caddr_t arg)
249 } 244 }
250 } 245 }
251 } 246 }
252 } 247 }
253 return -ENOENT; 248 return -ENOENT;
254} 249}
255 250
256 251
257int 252int RIOKillNeighbour(struct rio_info *p, caddr_t arg)
258RIOKillNeighbour(struct rio_info *p, caddr_t arg)
259{ 253{
260 uint Host; 254 uint Host;
261 uint ID; 255 uint ID;
262 struct Host *HostP; 256 struct Host *HostP;
263 struct CmdBlk *CmdBlkP; 257 struct CmdBlk *CmdBlkP;
264 258
265 rio_dprintk (RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n"); 259 rio_dprintk(RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n");
266 260
267 if ( copyin( (int)arg, (caddr_t)&KillUnit, sizeof(KillUnit) ) == COPYFAIL ) { 261 if (copyin((int) arg, (caddr_t) & KillUnit, sizeof(KillUnit)) == COPYFAIL) {
268 rio_dprintk (RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n"); 262 rio_dprintk(RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n");
269 p->RIOError.Error = COPYIN_FAILED; 263 p->RIOError.Error = COPYIN_FAILED;
270 return -EFAULT; 264 return -EFAULT;
271 } 265 }
272 266
273 if ( KillUnit.Link > 3 ) 267 if (KillUnit.Link > 3)
274 return -ENXIO; 268 return -ENXIO;
275 269
276 CmdBlkP = RIOGetCmdBlk(); 270 CmdBlkP = RIOGetCmdBlk();
277 271
278 if ( !CmdBlkP ) { 272 if (!CmdBlkP) {
279 rio_dprintk (RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n"); 273 rio_dprintk(RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n");
280 return -ENXIO; 274 return -ENXIO;
281 } 275 }
282 276
283 CmdBlkP->Packet.dest_unit = 0; 277 CmdBlkP->Packet.dest_unit = 0;
284 CmdBlkP->Packet.src_unit = 0; 278 CmdBlkP->Packet.src_unit = 0;
285 CmdBlkP->Packet.dest_port = BOOT_RUP; 279 CmdBlkP->Packet.dest_port = BOOT_RUP;
286 CmdBlkP->Packet.src_port = BOOT_RUP; 280 CmdBlkP->Packet.src_port = BOOT_RUP;
287 CmdBlkP->Packet.len = 0x84; 281 CmdBlkP->Packet.len = 0x84;
288 CmdBlkP->Packet.data[0] = UFOAD; 282 CmdBlkP->Packet.data[0] = UFOAD;
289 CmdBlkP->Packet.data[1] = KillUnit.Link; 283 CmdBlkP->Packet.data[1] = KillUnit.Link;
290 CmdBlkP->Packet.data[2] = UFOAD_MAGIC & 0xFF; 284 CmdBlkP->Packet.data[2] = UFOAD_MAGIC & 0xFF;
291 CmdBlkP->Packet.data[3] = (UFOAD_MAGIC >> 8) & 0xFF; 285 CmdBlkP->Packet.data[3] = (UFOAD_MAGIC >> 8) & 0xFF;
292 286
293 for ( Host = 0; Host < p->RIONumHosts; Host++ ) { 287 for (Host = 0; Host < p->RIONumHosts; Host++) {
294 ID = 0; 288 ID = 0;
295 HostP = &p->RIOHosts[Host]; 289 HostP = &p->RIOHosts[Host];
296 290
297 if ( HostP->UniqueNum == KillUnit.UniqueNum ) { 291 if (HostP->UniqueNum == KillUnit.UniqueNum) {
298 if ( RIOQueueCmdBlk( HostP, RTAS_PER_HOST+KillUnit.Link, 292 if (RIOQueueCmdBlk(HostP, RTAS_PER_HOST + KillUnit.Link, CmdBlkP) == RIO_FAIL) {
299 CmdBlkP) == RIO_FAIL ) { 293 rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
300 rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
301 return -EIO; 294 return -EIO;
302 } 295 }
303 return 0; 296 return 0;
304 } 297 }
305 298
306 for ( ID=0; ID < RTAS_PER_HOST; ID++ ) { 299 for (ID = 0; ID < RTAS_PER_HOST; ID++) {
307 if ( HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum ) { 300 if (HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum) {
308 CmdBlkP->Packet.dest_unit = ID+1; 301 CmdBlkP->Packet.dest_unit = ID + 1;
309 if ( RIOQueueCmdBlk( HostP, ID, CmdBlkP) == RIO_FAIL ) { 302 if (RIOQueueCmdBlk(HostP, ID, CmdBlkP) == RIO_FAIL) {
310 rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); 303 rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
311 return -EIO; 304 return -EIO;
312 } 305 }
313 return 0; 306 return 0;
314 } 307 }
315 } 308 }
316 } 309 }
317 RIOFreeCmdBlk( CmdBlkP ); 310 RIOFreeCmdBlk(CmdBlkP);
318 return -ENXIO; 311 return -ENXIO;
319} 312}
320 313
321int 314int RIOSuspendBootRta(struct Host *HostP, int ID, int Link)
322RIOSuspendBootRta(struct Host *HostP, int ID, int Link)
323{ 315{
324 struct CmdBlk *CmdBlkP; 316 struct CmdBlk *CmdBlkP;
325 317
326 rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link); 318 rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link);
327 319
328 CmdBlkP = RIOGetCmdBlk(); 320 CmdBlkP = RIOGetCmdBlk();
329 321
330 if ( !CmdBlkP ) { 322 if (!CmdBlkP) {
331 rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n"); 323 rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n");
332 return -ENXIO; 324 return -ENXIO;
333 } 325 }
334 326
335 CmdBlkP->Packet.dest_unit = ID; 327 CmdBlkP->Packet.dest_unit = ID;
336 CmdBlkP->Packet.dest_port = BOOT_RUP; 328 CmdBlkP->Packet.dest_port = BOOT_RUP;
337 CmdBlkP->Packet.src_unit = 0; 329 CmdBlkP->Packet.src_unit = 0;
338 CmdBlkP->Packet.src_port = BOOT_RUP; 330 CmdBlkP->Packet.src_port = BOOT_RUP;
339 CmdBlkP->Packet.len = 0x84; 331 CmdBlkP->Packet.len = 0x84;
340 CmdBlkP->Packet.data[0] = IWAIT; 332 CmdBlkP->Packet.data[0] = IWAIT;
341 CmdBlkP->Packet.data[1] = Link; 333 CmdBlkP->Packet.data[1] = Link;
342 CmdBlkP->Packet.data[2] = IWAIT_MAGIC & 0xFF; 334 CmdBlkP->Packet.data[2] = IWAIT_MAGIC & 0xFF;
343 CmdBlkP->Packet.data[3] = (IWAIT_MAGIC >> 8) & 0xFF; 335 CmdBlkP->Packet.data[3] = (IWAIT_MAGIC >> 8) & 0xFF;
344 336
345 if ( RIOQueueCmdBlk( HostP, ID - 1, CmdBlkP) == RIO_FAIL ) { 337 if (RIOQueueCmdBlk(HostP, ID - 1, CmdBlkP) == RIO_FAIL) {
346 rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n"); 338 rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n");
347 return -EIO; 339 return -EIO;
348 } 340 }
349 return 0; 341 return 0;
350} 342}
351 343
352int 344int RIOFoadWakeup(struct rio_info *p)
353RIOFoadWakeup(struct rio_info *p)
354{ 345{
355 int port; 346 int port;
356 register struct Port *PortP; 347 register struct Port *PortP;
357 unsigned long flags; 348 unsigned long flags;
358 349
359 for ( port=0; port<RIO_PORTS; port++) { 350 for (port = 0; port < RIO_PORTS; port++) {
360 PortP = p->RIOPortp[port]; 351 PortP = p->RIOPortp[port];
361 352
362 rio_spin_lock_irqsave(&PortP->portSem, flags); 353 rio_spin_lock_irqsave(&PortP->portSem, flags);
@@ -377,16 +368,15 @@ RIOFoadWakeup(struct rio_info *p)
377 PortP->TxBufferOut = 0; 368 PortP->TxBufferOut = 0;
378 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 369 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
379 } 370 }
380 return(0); 371 return (0);
381} 372}
382 373
383/* 374/*
384** Incoming command on the COMMAND_RUP to be processed. 375** Incoming command on the COMMAND_RUP to be processed.
385*/ 376*/
386static int 377static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
387RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
388{ 378{
389 struct PktCmd *PktCmdP = (struct PktCmd *)PacketP->data; 379 struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data;
390 struct Port *PortP; 380 struct Port *PortP;
391 struct UnixRup *UnixRupP; 381 struct UnixRup *UnixRupP;
392 ushort SysPort; 382 ushort SysPort;
@@ -395,128 +385,114 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
395 ushort subCommand; 385 ushort subCommand;
396 unsigned long flags; 386 unsigned long flags;
397 387
398 func_enter (); 388 func_enter();
399 389
400#ifdef CHECK 390#ifdef CHECK
401 CheckHost( Host ); 391 CheckHost(Host);
402 CheckHostP( HostP ); 392 CheckHostP(HostP);
403 CheckPacketP( PacketP ); 393 CheckPacketP(PacketP);
404#endif 394#endif
405 395
406 /* 396 /*
407 ** 16 port RTA note: 397 ** 16 port RTA note:
408 ** Command rup packets coming from the RTA will have pkt->data[1] (which 398 ** Command rup packets coming from the RTA will have pkt->data[1] (which
409 ** translates to PktCmdP->PhbNum) set to the host port number for the 399 ** translates to PktCmdP->PhbNum) set to the host port number for the
410 ** particular unit. To access the correct BaseSysPort for a 16 port RTA, 400 ** particular unit. To access the correct BaseSysPort for a 16 port RTA,
411 ** we can use PhbNum to get the rup number for the appropriate 8 port 401 ** we can use PhbNum to get the rup number for the appropriate 8 port
412 ** block (for the first block, this should be equal to 'Rup'). 402 ** block (for the first block, this should be equal to 'Rup').
413 */ 403 */
414 rup = RBYTE(PktCmdP->PhbNum) / (ushort)PORTS_PER_RTA; 404 rup = RBYTE(PktCmdP->PhbNum) / (ushort) PORTS_PER_RTA;
415 UnixRupP = &HostP->UnixRups[rup]; 405 UnixRupP = &HostP->UnixRups[rup];
416 SysPort = UnixRupP->BaseSysPort + 406 SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA);
417 (RBYTE(PktCmdP->PhbNum) % (ushort)PORTS_PER_RTA); 407 rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort);
418 rio_dprintk (RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort);
419 408
420#ifdef CHECK 409#ifdef CHECK
421 CheckRup( rup ); 410 CheckRup(rup);
422 CheckUnixRupP( UnixRupP ); 411 CheckUnixRupP(UnixRupP);
423#endif 412#endif
424 if ( UnixRupP->BaseSysPort == NO_PORT ) { 413 if (UnixRupP->BaseSysPort == NO_PORT) {
425 rio_dprintk (RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); 414 rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n");
426 rio_dprintk (RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); 415 rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n");
427 rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", 416 rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", HostP - p->RIOHosts, HostP->Name);
428 HostP-p->RIOHosts, HostP->Name ); 417 rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup);
429 rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup); 418
430 419 if (Rup >= (ushort) MAX_RUP) {
431 if ( Rup >= (ushort)MAX_RUP ) { 420 rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name);
432 rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n",
433 HostP->Mapping[Rup].Name);
434 } else 421 } else
435 rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", 422 rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name);
436 ('A' + Rup - MAX_RUP), HostP->Name); 423
437 424 rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", PacketP->dest_unit, PacketP->dest_port);
438 rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", 425 rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", PacketP->src_unit, PacketP->src_port);
439 PacketP->dest_unit, PacketP->dest_port ); 426 rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", PacketP->len, PacketP->len);
440 rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", 427 rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control);
441 PacketP->src_unit, PacketP->src_port ); 428 rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum);
442 rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", PacketP->len,PacketP->len ); 429 rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command);
443 rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control);
444 rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum );
445 rio_dprintk (RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, "
446 "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command );
447 return TRUE; 430 return TRUE;
448 } 431 }
449
450#ifdef CHECK 432#ifdef CHECK
451 CheckSysPort( SysPort ); 433 CheckSysPort(SysPort);
452#endif 434#endif
453 PortP = p->RIOPortp[ SysPort ]; 435 PortP = p->RIOPortp[SysPort];
454 rio_spin_lock_irqsave(&PortP->portSem, flags); 436 rio_spin_lock_irqsave(&PortP->portSem, flags);
455 switch( RBYTE(PktCmdP->Command) ) { 437 switch (RBYTE(PktCmdP->Command)) {
456 case BREAK_RECEIVED: 438 case BREAK_RECEIVED:
457 rio_dprintk (RIO_DEBUG_CMD, "Received a break!\n"); 439 rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n");
458 /* If the current line disc. is not multi-threading and 440 /* If the current line disc. is not multi-threading and
459 the current processor is not the default, reset rup_intr 441 the current processor is not the default, reset rup_intr
460 and return FALSE to ensure that the command packet is 442 and return FALSE to ensure that the command packet is
461 not freed. */ 443 not freed. */
462 /* Call tmgr HANGUP HERE */ 444 /* Call tmgr HANGUP HERE */
463 /* Fix this later when every thing works !!!! RAMRAJ */ 445 /* Fix this later when every thing works !!!! RAMRAJ */
464 gs_got_break (&PortP->gs); 446 gs_got_break(&PortP->gs);
447 break;
448
449 case COMPLETE:
450 rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", RBYTE(PktCmdP->PhbNum), HostP - p->RIOHosts);
451 subCommand = 1;
452 switch (RBYTE(PktCmdP->SubCommand)) {
453 case MEMDUMP:
454 rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr));
465 break; 455 break;
456 case READ_REGISTER:
457 rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr));
458 p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST);
459 break;
460 default:
461 subCommand = 0;
462 break;
463 }
464 if (subCommand)
465 break;
466 rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", RBYTE(PktCmdP->PortStatus), PortP->PortState);
467 if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) {
468 rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n");
469 PortP->PortState = RBYTE(PktCmdP->PortStatus);
470 /* What should we do here ...
471 wakeup( &PortP->PortState );
472 */
473 } else
474 rio_dprintk(RIO_DEBUG_CMD, "No change\n");
466 475
467 case COMPLETE: 476 /* FALLTHROUGH */
468 rio_dprintk (RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", 477 case MODEM_STATUS:
469 RBYTE(PktCmdP->PhbNum), HostP-p->RIOHosts); 478 /*
470 subCommand = 1; 479 ** Knock out the tbusy and tstop bits, as these are not relevant
471 switch (RBYTE(PktCmdP->SubCommand)) { 480 ** to the check for modem status change (they're just there because
472 case MEMDUMP : 481 ** it's a convenient place to put them!).
473 rio_dprintk (RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", 482 */
474 RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr)); 483 ReportedModemStatus = RBYTE(PktCmdP->ModemStatus);
475 break; 484 if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) {
476 case READ_REGISTER : 485 rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState);
477 rio_dprintk (RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr));
478 p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST);
479 break;
480 default :
481 subCommand = 0;
482 break;
483 }
484 if (subCommand)
485 break;
486 rio_dprintk (RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n",
487 RBYTE(PktCmdP->PortStatus),PortP->PortState);
488 if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) {
489 rio_dprintk (RIO_DEBUG_CMD, "Mark status & wakeup\n");
490 PortP->PortState = RBYTE(PktCmdP->PortStatus);
491 /* What should we do here ...
492 wakeup( &PortP->PortState );
493 */
494 } else
495 rio_dprintk (RIO_DEBUG_CMD, "No change\n");
496
497 /* FALLTHROUGH */
498 case MODEM_STATUS:
499 /* 486 /*
500 ** Knock out the tbusy and tstop bits, as these are not relevant 487 ** Update ModemState just in case tbusy or tstop states have
501 ** to the check for modem status change (they're just there because 488 ** changed.
502 ** it's a convenient place to put them!). 489 */
503 */ 490 PortP->ModemState = ReportedModemStatus;
504 ReportedModemStatus = RBYTE(PktCmdP->ModemStatus); 491 } else {
505 if ((PortP->ModemState & MSVR1_HOST) == 492 rio_dprintk(RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n", PortP->ModemState, ReportedModemStatus);
506 (ReportedModemStatus & MSVR1_HOST)) { 493 PortP->ModemState = ReportedModemStatus;
507 rio_dprintk (RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState);
508 /*
509 ** Update ModemState just in case tbusy or tstop states have
510 ** changed.
511 */
512 PortP->ModemState = ReportedModemStatus;
513 }
514 else {
515 rio_dprintk (RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n",
516 PortP->ModemState, ReportedModemStatus);
517 PortP->ModemState = ReportedModemStatus;
518#ifdef MODEM_SUPPORT 494#ifdef MODEM_SUPPORT
519 if ( PortP->Mapped ) { 495 if (PortP->Mapped) {
520 /***********************************************************\ 496 /***********************************************************\
521 ************************************************************* 497 *************************************************************
522 *** *** 498 *** ***
@@ -525,68 +501,67 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
525 ************************************************************* 501 *************************************************************
526 \***********************************************************/ 502 \***********************************************************/
527 /* 503 /*
528 ** If the device is a modem, then check the modem 504 ** If the device is a modem, then check the modem
529 ** carrier. 505 ** carrier.
530 */ 506 */
531 if (PortP->gs.tty == NULL) 507 if (PortP->gs.tty == NULL)
532 break; 508 break;
533 if (PortP->gs.tty->termios == NULL) 509 if (PortP->gs.tty->termios == NULL)
534 break; 510 break;
535
536 if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) &&
537 ((PortP->State & (RIO_MOPEN|RIO_WOPEN)))) {
538 511
539 rio_dprintk (RIO_DEBUG_CMD, "Is there a Carrier?\n"); 512 if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) {
540 /* 513
541 ** Is there a carrier? 514 rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n");
542 */ 515 /*
543 if ( PortP->ModemState & MSVR1_CD ) { 516 ** Is there a carrier?
544 /* 517 */
545 ** Has carrier just appeared? 518 if (PortP->ModemState & MSVR1_CD) {
546 */ 519 /*
520 ** Has carrier just appeared?
521 */
547 if (!(PortP->State & RIO_CARR_ON)) { 522 if (!(PortP->State & RIO_CARR_ON)) {
548 rio_dprintk (RIO_DEBUG_CMD, "Carrier just came up.\n"); 523 rio_dprintk(RIO_DEBUG_CMD, "Carrier just came up.\n");
549 PortP->State |= RIO_CARR_ON; 524 PortP->State |= RIO_CARR_ON;
550 /* 525 /*
551 ** wakeup anyone in WOPEN 526 ** wakeup anyone in WOPEN
552 */ 527 */
553 if (PortP->State & (PORT_ISOPEN | RIO_WOPEN) ) 528 if (PortP->State & (PORT_ISOPEN | RIO_WOPEN))
554 wake_up_interruptible (&PortP->gs.open_wait); 529 wake_up_interruptible(&PortP->gs.open_wait);
555#ifdef STATS 530#ifdef STATS
556 PortP->Stat.ModemOnCnt++; 531 PortP->Stat.ModemOnCnt++;
557#endif 532#endif
558 } 533 }
559 } else { 534 } else {
560 /* 535 /*
561 ** Has carrier just dropped? 536 ** Has carrier just dropped?
562 */ 537 */
563 if (PortP->State & RIO_CARR_ON) { 538 if (PortP->State & RIO_CARR_ON) {
564 if (PortP->State & (PORT_ISOPEN|RIO_WOPEN|RIO_MOPEN)) 539 if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN))
565 tty_hangup (PortP->gs.tty); 540 tty_hangup(PortP->gs.tty);
566 PortP->State &= ~RIO_CARR_ON; 541 PortP->State &= ~RIO_CARR_ON;
567 rio_dprintk (RIO_DEBUG_CMD, "Carrirer just went down\n"); 542 rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n");
568#ifdef STATS 543#ifdef STATS
569 PortP->Stat.ModemOffCnt++; 544 PortP->Stat.ModemOffCnt++;
570#endif 545#endif
546 }
547 }
548 }
571 } 549 }
572 }
573 }
574 }
575#endif 550#endif
576 } 551 }
577 break; 552 break;
578 553
579 default: 554 default:
580 rio_dprintk (RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", 555 rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", RBYTE(PktCmdP->Command), HostP - p->RIOHosts);
581 RBYTE(PktCmdP->Command),HostP-p->RIOHosts); 556 break;
582 break;
583 } 557 }
584 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 558 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
585 559
586 func_exit (); 560 func_exit();
587 561
588 return TRUE; 562 return TRUE;
589} 563}
564
590/* 565/*
591** The command mechanism: 566** The command mechanism:
592** Each rup has a chain of commands associated with it. 567** Each rup has a chain of commands associated with it.
@@ -600,12 +575,11 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
600/* 575/*
601** Allocate an empty command block. 576** Allocate an empty command block.
602*/ 577*/
603struct CmdBlk * 578struct CmdBlk *RIOGetCmdBlk(void)
604RIOGetCmdBlk(void)
605{ 579{
606 struct CmdBlk *CmdBlkP; 580 struct CmdBlk *CmdBlkP;
607 581
608 CmdBlkP = (struct CmdBlk *)sysbrk(sizeof(struct CmdBlk)); 582 CmdBlkP = (struct CmdBlk *) sysbrk(sizeof(struct CmdBlk));
609 if (CmdBlkP) 583 if (CmdBlkP)
610 bzero(CmdBlkP, sizeof(struct CmdBlk)); 584 bzero(CmdBlkP, sizeof(struct CmdBlk));
611 585
@@ -615,31 +589,29 @@ RIOGetCmdBlk(void)
615/* 589/*
616** Return a block to the head of the free list. 590** Return a block to the head of the free list.
617*/ 591*/
618void 592void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP)
619RIOFreeCmdBlk(struct CmdBlk *CmdBlkP)
620{ 593{
621 sysfree((void *)CmdBlkP, sizeof(struct CmdBlk)); 594 sysfree((void *) CmdBlkP, sizeof(struct CmdBlk));
622} 595}
623 596
624/* 597/*
625** attach a command block to the list of commands to be performed for 598** attach a command block to the list of commands to be performed for
626** a given rup. 599** a given rup.
627*/ 600*/
628int 601int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
629RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
630{ 602{
631 struct CmdBlk **Base; 603 struct CmdBlk **Base;
632 struct UnixRup *UnixRupP; 604 struct UnixRup *UnixRupP;
633 unsigned long flags; 605 unsigned long flags;
634 606
635#ifdef CHECK 607#ifdef CHECK
636 CheckHostP( HostP ); 608 CheckHostP(HostP);
637 CheckRup( Rup ); 609 CheckRup(Rup);
638 CheckCmdBlkP( CmdBlkP ); 610 CheckCmdBlkP(CmdBlkP);
639#endif 611#endif
640 if ( Rup >= (ushort)(MAX_RUP+LINKS_PER_UNIT) ) { 612 if (Rup >= (ushort) (MAX_RUP + LINKS_PER_UNIT)) {
641 rio_dprintk (RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n",Rup); 613 rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup);
642 RIOFreeCmdBlk( CmdBlkP ); 614 RIOFreeCmdBlk(CmdBlkP);
643 return RIO_FAIL; 615 return RIO_FAIL;
644 } 616 }
645 617
@@ -648,57 +620,52 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
648 rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); 620 rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
649 621
650 /* 622 /*
651 ** If the RUP is currently inactive, then put the request 623 ** If the RUP is currently inactive, then put the request
652 ** straight on the RUP.... 624 ** straight on the RUP....
653 */ 625 */
654 if ( (UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && 626 if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP)
655 (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE ) && 627 : TRUE)) {
656 (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP)(CmdBlkP->PreArg,CmdBlkP) 628 rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]);
657 :TRUE)) {
658 rio_dprintk (RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n",
659 CmdBlkP->Packet.data[0]);
660 629
661 /* 630 /*
662 ** Whammy! blat that pack! 631 ** Whammy! blat that pack!
663 */ 632 */
664 HostP->Copy( (caddr_t)&CmdBlkP->Packet, 633 HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
665 RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt ), sizeof(PKT) );
666 634
667 /* 635 /*
668 ** place command packet on the pending position. 636 ** place command packet on the pending position.
669 */ 637 */
670 UnixRupP->CmdPendingP = CmdBlkP; 638 UnixRupP->CmdPendingP = CmdBlkP;
671 639
672 /* 640 /*
673 ** set the command register 641 ** set the command register
674 */ 642 */
675 WWORD(UnixRupP->RupP->txcontrol , TX_PACKET_READY); 643 WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY);
676 644
677 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); 645 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
678 646
679 return RIO_SUCCESS; 647 return RIO_SUCCESS;
680 } 648 }
681 rio_dprintk (RIO_DEBUG_CMD, "RUP active - en-queing\n"); 649 rio_dprintk(RIO_DEBUG_CMD, "RUP active - en-queing\n");
682 650
683 if ( UnixRupP->CmdsWaitingP != NULL) 651 if (UnixRupP->CmdsWaitingP != NULL)
684 rio_dprintk (RIO_DEBUG_CMD, "Rup active - command waiting\n"); 652 rio_dprintk(RIO_DEBUG_CMD, "Rup active - command waiting\n");
685 if ( UnixRupP->CmdPendingP != NULL ) 653 if (UnixRupP->CmdPendingP != NULL)
686 rio_dprintk (RIO_DEBUG_CMD, "Rup active - command pending\n"); 654 rio_dprintk(RIO_DEBUG_CMD, "Rup active - command pending\n");
687 if ( RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE ) 655 if (RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE)
688 rio_dprintk (RIO_DEBUG_CMD, "Rup active - command rup not ready\n"); 656 rio_dprintk(RIO_DEBUG_CMD, "Rup active - command rup not ready\n");
689 657
690 Base = &UnixRupP->CmdsWaitingP; 658 Base = &UnixRupP->CmdsWaitingP;
691 659
692 rio_dprintk (RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int)CmdBlkP,(int)Base); 660 rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base);
693 661
694 while ( *Base ) { 662 while (*Base) {
695 rio_dprintk (RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int)(*Base)); 663 rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int) (*Base));
696 Base = &((*Base)->NextP); 664 Base = &((*Base)->NextP);
697 rio_dprintk (RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n", 665 rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base);
698 (int)CmdBlkP,(int)Base);
699 } 666 }
700 667
701 rio_dprintk (RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n",(int)CmdBlkP,(int)Base); 668 rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base);
702 669
703 *Base = CmdBlkP; 670 *Base = CmdBlkP;
704 671
@@ -713,8 +680,7 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
713** Here we go - if there is an empty rup, fill it! 680** Here we go - if there is an empty rup, fill it!
714** must be called at splrio() or higher. 681** must be called at splrio() or higher.
715*/ 682*/
716void 683void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
717RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
718{ 684{
719 register struct CmdBlk *CmdBlkP; 685 register struct CmdBlk *CmdBlkP;
720 register struct UnixRup *UnixRupP; 686 register struct UnixRup *UnixRupP;
@@ -723,262 +689,246 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
723 unsigned long flags; 689 unsigned long flags;
724 690
725 691
726 Rup = MAX_RUP+LINKS_PER_UNIT; 692 Rup = MAX_RUP + LINKS_PER_UNIT;
727 693
728 do { /* do this loop for each RUP */ 694 do { /* do this loop for each RUP */
729 /* 695 /*
730 ** locate the rup we are processing & lock it 696 ** locate the rup we are processing & lock it
731 */ 697 */
732 UnixRupP = &HostP->UnixRups[--Rup]; 698 UnixRupP = &HostP->UnixRups[--Rup];
733 699
734 spin_lock_irqsave(&UnixRupP->RupLock, flags); 700 spin_lock_irqsave(&UnixRupP->RupLock, flags);
735 701
736 /* 702 /*
737 ** First check for incoming commands: 703 ** First check for incoming commands:
738 */ 704 */
739 if ( RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE ) { 705 if (RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) {
740 int FreeMe; 706 int FreeMe;
741 707
742 PacketP =(PKT *)RIO_PTR(HostP->Caddr,RWORD(UnixRupP->RupP->rxpkt)); 708 PacketP = (PKT *) RIO_PTR(HostP->Caddr, RWORD(UnixRupP->RupP->rxpkt));
743 709
744 ShowPacket( DBG_CMD, PacketP ); 710 ShowPacket(DBG_CMD, PacketP);
745 711
746 switch ( RBYTE(PacketP->dest_port) ) { 712 switch (RBYTE(PacketP->dest_port)) {
747 case BOOT_RUP: 713 case BOOT_RUP:
748 rio_dprintk (RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", 714 rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", RBYTE(PacketP->len) & 0x80 ? "Command" : "Data", RBYTE(PacketP->data[0]));
749 RBYTE(PacketP->len) & 0x80 ? "Command":"Data", 715 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
750 RBYTE(PacketP->data[0])); 716 FreeMe = RIOBootRup(p, Rup, HostP, PacketP);
751 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); 717 rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
752 FreeMe= RIOBootRup(p, Rup,HostP,PacketP); 718 break;
753 rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
754 break;
755 719
756 case COMMAND_RUP: 720 case COMMAND_RUP:
757 /* 721 /*
758 ** Free the RUP lock as loss of carrier causes a 722 ** Free the RUP lock as loss of carrier causes a
759 ** ttyflush which will (eventually) call another 723 ** ttyflush which will (eventually) call another
760 ** routine that uses the RUP lock. 724 ** routine that uses the RUP lock.
761 */ 725 */
762 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); 726 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
763 FreeMe= RIOCommandRup(p, Rup,HostP,PacketP); 727 FreeMe = RIOCommandRup(p, Rup, HostP, PacketP);
764 if (PacketP->data[5] == MEMDUMP) { 728 if (PacketP->data[5] == MEMDUMP) {
765 rio_dprintk (RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", 729 rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(ushort *) & (PacketP->data[6]));
766 *(ushort *) &(PacketP->data[6])); 730 HostP->Copy((caddr_t) & (PacketP->data[8]), (caddr_t) p->RIOMemDump, 32);
767 HostP->Copy( (caddr_t)&(PacketP->data[8]), 731 }
768 (caddr_t)p->RIOMemDump, 32 ); 732 rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
769 } 733 break;
770 rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
771 break;
772 734
773 case ROUTE_RUP: 735 case ROUTE_RUP:
774 rio_spin_unlock_irqrestore( &UnixRupP->RupLock, flags); 736 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
775 FreeMe = RIORouteRup(p, Rup, HostP, PacketP ); 737 FreeMe = RIORouteRup(p, Rup, HostP, PacketP);
776 rio_spin_lock_irqsave( &UnixRupP->RupLock, flags ); 738 rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
777 break; 739 break;
778 740
779 default: 741 default:
780 rio_dprintk (RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port)); 742 rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port));
781 FreeMe = 1; 743 FreeMe = 1;
782 break; 744 break;
783 } 745 }
784 746
785 if ( FreeMe ) { 747 if (FreeMe) {
786 rio_dprintk (RIO_DEBUG_CMD, "Free processed incoming command packet\n"); 748 rio_dprintk(RIO_DEBUG_CMD, "Free processed incoming command packet\n");
787 put_free_end(HostP,PacketP); 749 put_free_end(HostP, PacketP);
788 750
789 WWORD(UnixRupP->RupP->rxcontrol , RX_RUP_INACTIVE); 751 WWORD(UnixRupP->RupP->rxcontrol, RX_RUP_INACTIVE);
790 752
791 if ( RWORD(UnixRupP->RupP->handshake)==PHB_HANDSHAKE_SET ) { 753 if (RWORD(UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) {
792 rio_dprintk (RIO_DEBUG_CMD, "Handshake rup %d\n",Rup); 754 rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup);
793 WWORD(UnixRupP->RupP->handshake, 755 WWORD(UnixRupP->RupP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET);
794 PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET);
795 } 756 }
796 } 757 }
797 } 758 }
798 759
799 /* 760 /*
800 ** IF a command was running on the port, 761 ** IF a command was running on the port,
801 ** and it has completed, then tidy it up. 762 ** and it has completed, then tidy it up.
802 */ 763 */
803 if ( (CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */ 764 if ((CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */
804 (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { 765 (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
805 /* 766 /*
806 ** we are idle. 767 ** we are idle.
807 ** there is a command in pending. 768 ** there is a command in pending.
808 ** Therefore, this command has finished. 769 ** Therefore, this command has finished.
809 ** So, wakeup whoever is waiting for it (and tell them 770 ** So, wakeup whoever is waiting for it (and tell them
810 ** what happened). 771 ** what happened).
811 */ 772 */
812 if ( CmdBlkP->Packet.dest_port == BOOT_RUP ) 773 if (CmdBlkP->Packet.dest_port == BOOT_RUP)
813 rio_dprintk (RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", 774 rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]);
814 CmdBlkP->Packet.len & 0x80 ? "Command":"Data", 775
815 CmdBlkP->Packet.data[0]); 776 rio_dprintk(RIO_DEBUG_CMD, "Command 0x%x completed\n", (int) CmdBlkP);
816
817 rio_dprintk (RIO_DEBUG_CMD, "Command 0x%x completed\n",(int)CmdBlkP);
818 777
819 /* 778 /*
820 ** Clear the Rup lock to prevent mutual exclusion. 779 ** Clear the Rup lock to prevent mutual exclusion.
821 */ 780 */
822 if ( CmdBlkP->PostFuncP ) { 781 if (CmdBlkP->PostFuncP) {
823 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); 782 rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
824 (*CmdBlkP->PostFuncP) (CmdBlkP->PostArg,CmdBlkP); 783 (*CmdBlkP->PostFuncP) (CmdBlkP->PostArg, CmdBlkP);
825 rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); 784 rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
826 } 785 }
827 786
828 /* 787 /*
829 ** ....clear the pending flag.... 788 ** ....clear the pending flag....
830 */ 789 */
831 UnixRupP->CmdPendingP = NULL; 790 UnixRupP->CmdPendingP = NULL;
832 791
833 /* 792 /*
834 ** ....and return the command block to the freelist. 793 ** ....and return the command block to the freelist.
835 */ 794 */
836 RIOFreeCmdBlk( CmdBlkP ); 795 RIOFreeCmdBlk(CmdBlkP);
837 } 796 }
838 797
839 /* 798 /*
840 ** If there is a command for this rup, and the rup 799 ** If there is a command for this rup, and the rup
841 ** is idle, then process the command 800 ** is idle, then process the command
842 */ 801 */
843 if ( (CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */ 802 if ((CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */
844 (UnixRupP->CmdPendingP == NULL) && 803 (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
845 (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
846 /* 804 /*
847 ** if the pre-function is non-zero, call it. 805 ** if the pre-function is non-zero, call it.
848 ** If it returns RIO_FAIL then don't 806 ** If it returns RIO_FAIL then don't
849 ** send this command yet! 807 ** send this command yet!
850 */ 808 */
851#ifdef CHECK 809#ifdef CHECK
852 CheckCmdBlkP (CmdBlkP); 810 CheckCmdBlkP(CmdBlkP);
853#endif 811#endif
854 if ( !(CmdBlkP->PreFuncP ? 812 if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) {
855 (*CmdBlkP->PreFuncP)(CmdBlkP->PreArg, CmdBlkP) : TRUE)) { 813 rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%x\n", (int) CmdBlkP);
856 rio_dprintk (RIO_DEBUG_CMD, "Not ready to start command 0x%x\n",(int)CmdBlkP); 814 } else {
857 } 815 rio_dprintk(RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n", (int) CmdBlkP, CmdBlkP->Packet.data[0]);
858 else {
859 rio_dprintk (RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n",
860 (int)CmdBlkP, CmdBlkP->Packet.data[0]);
861 /* 816 /*
862 ** Whammy! blat that pack! 817 ** Whammy! blat that pack!
863 */ 818 */
864#ifdef CHECK 819#ifdef CHECK
865 CheckPacketP ((PKT *)RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt)); 820 CheckPacketP((PKT *) RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt));
866#endif 821#endif
867 HostP->Copy( (caddr_t)&CmdBlkP->Packet, 822 HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
868 RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
869 823
870 /* 824 /*
871 ** remove the command from the rup command queue... 825 ** remove the command from the rup command queue...
872 */ 826 */
873 UnixRupP->CmdsWaitingP = CmdBlkP->NextP; 827 UnixRupP->CmdsWaitingP = CmdBlkP->NextP;
874 828
875 /* 829 /*
876 ** ...and place it on the pending position. 830 ** ...and place it on the pending position.
877 */ 831 */
878 UnixRupP->CmdPendingP = CmdBlkP; 832 UnixRupP->CmdPendingP = CmdBlkP;
879 833
880 /* 834 /*
881 ** set the command register 835 ** set the command register
882 */ 836 */
883 WWORD(UnixRupP->RupP->txcontrol,TX_PACKET_READY); 837 WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY);
884 838
885 /* 839 /*
886 ** the command block will be freed 840 ** the command block will be freed
887 ** when the command has been processed. 841 ** when the command has been processed.
888 */ 842 */
889 } 843 }
890 } 844 }
891 spin_unlock_irqrestore(&UnixRupP->RupLock, flags); 845 spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
892 } while ( Rup ); 846 } while (Rup);
893} 847}
894 848
895int 849int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP)
896RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP)
897{ 850{
898 struct Port * PortP = (struct Port *)iPortP; 851 struct Port *PortP = (struct Port *) iPortP;
899 unsigned long flags; 852 unsigned long flags;
900 853
901 rio_spin_lock_irqsave(&PortP->portSem, flags); 854 rio_spin_lock_irqsave(&PortP->portSem, flags);
902#ifdef CHECK 855#ifdef CHECK
903 CheckPortP( PortP ); 856 CheckPortP(PortP);
904#endif 857#endif
905 PortP->WflushFlag++; 858 PortP->WflushFlag++;
906 PortP->MagicFlags |= MAGIC_FLUSH; 859 PortP->MagicFlags |= MAGIC_FLUSH;
907 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 860 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
908 return RIOUnUse( iPortP, CmdBlkP ); 861 return RIOUnUse(iPortP, CmdBlkP);
909} 862}
910 863
911int 864int RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP)
912RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP)
913{ 865{
914 struct Port * PortP = (struct Port *)iPortP; 866 struct Port *PortP = (struct Port *) iPortP;
915 PKT *PacketP; 867 PKT *PacketP;
916 unsigned long flags; 868 unsigned long flags;
917 869
918 rio_spin_lock_irqsave(&PortP->portSem, flags); 870 rio_spin_lock_irqsave(&PortP->portSem, flags);
919 871
920 while ( can_remove_receive(&PacketP, PortP) ) { 872 while (can_remove_receive(&PacketP, PortP)) {
921 remove_receive(PortP); 873 remove_receive(PortP);
922 ShowPacket(DBG_PROC, PacketP ); 874 ShowPacket(DBG_PROC, PacketP);
923 put_free_end( PortP->HostP, PacketP ); 875 put_free_end(PortP->HostP, PacketP);
924 } 876 }
925 877
926 if ( RWORD(PortP->PhbP->handshake)==PHB_HANDSHAKE_SET ) { 878 if (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) {
927 /* 879 /*
928 ** MAGIC! (Basically, handshake the RX buffer, so that 880 ** MAGIC! (Basically, handshake the RX buffer, so that
929 ** the RTAs upstream can be re-enabled.) 881 ** the RTAs upstream can be re-enabled.)
930 */ 882 */
931 rio_dprintk (RIO_DEBUG_CMD, "Util: Set RX handshake bit\n"); 883 rio_dprintk(RIO_DEBUG_CMD, "Util: Set RX handshake bit\n");
932 WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET); 884 WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET);
933 } 885 }
934 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 886 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
935 return RIOUnUse( iPortP, CmdBlkP ); 887 return RIOUnUse(iPortP, CmdBlkP);
936} 888}
937 889
938int 890int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP)
939RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP)
940{ 891{
941 struct Port * PortP = (struct Port *)iPortP; 892 struct Port *PortP = (struct Port *) iPortP;
942 unsigned long flags; 893 unsigned long flags;
943 894
944 rio_spin_lock_irqsave(&PortP->portSem, flags); 895 rio_spin_lock_irqsave(&PortP->portSem, flags);
945 896
946#ifdef CHECK 897#ifdef CHECK
947 CheckPortP( PortP ); 898 CheckPortP(PortP);
948#endif 899#endif
949 rio_dprintk (RIO_DEBUG_CMD, "Decrement in use count for port\n"); 900 rio_dprintk(RIO_DEBUG_CMD, "Decrement in use count for port\n");
950 901
951 if (PortP->InUse) { 902 if (PortP->InUse) {
952 if ( --PortP->InUse != NOT_INUSE ) { 903 if (--PortP->InUse != NOT_INUSE) {
953 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 904 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
954 return 0; 905 return 0;
955 } 906 }
956 } 907 }
957 /* 908 /*
958 ** While PortP->InUse is set (i.e. a preemptive command has been sent to 909 ** While PortP->InUse is set (i.e. a preemptive command has been sent to
959 ** the RTA and is awaiting completion), any transmit data is prevented from 910 ** the RTA and is awaiting completion), any transmit data is prevented from
960 ** being transferred from the write queue into the transmit packets 911 ** being transferred from the write queue into the transmit packets
961 ** (add_transmit) and no furthur transmit interrupt will be sent for that 912 ** (add_transmit) and no furthur transmit interrupt will be sent for that
962 ** data. The next interrupt will occur up to 500ms later (RIOIntr is called 913 ** data. The next interrupt will occur up to 500ms later (RIOIntr is called
963 ** twice a second as a saftey measure). This was the case when kermit was 914 ** twice a second as a saftey measure). This was the case when kermit was
964 ** used to send data into a RIO port. After each packet was sent, TCFLSH 915 ** used to send data into a RIO port. After each packet was sent, TCFLSH
965 ** was called to flush the read queue preemptively. PortP->InUse was 916 ** was called to flush the read queue preemptively. PortP->InUse was
966 ** incremented, thereby blocking the 6 byte acknowledgement packet 917 ** incremented, thereby blocking the 6 byte acknowledgement packet
967 ** transmitted back. This acknowledgment hung around for 500ms before 918 ** transmitted back. This acknowledgment hung around for 500ms before
968 ** being sent, thus reducing input performance substantially!. 919 ** being sent, thus reducing input performance substantially!.
969 ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data 920 ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data
970 ** hanging around in the transmit buffer is sent immediately. 921 ** hanging around in the transmit buffer is sent immediately.
971 */ 922 */
972 WWORD(PortP->HostP->ParmMapP->tx_intr, 1); 923 WWORD(PortP->HostP->ParmMapP->tx_intr, 1);
973 /* What to do here .. 924 /* What to do here ..
974 wakeup( (caddr_t)&(PortP->InUse) ); 925 wakeup( (caddr_t)&(PortP->InUse) );
975 */ 926 */
976 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 927 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
977 return 0; 928 return 0;
978} 929}
979 930
980void 931void ShowPacket(uint Flags, struct PKT *PacketP)
981ShowPacket(uint Flags, struct PKT *PacketP)
982{ 932{
983} 933}
984 934