aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rio/riotable.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/rio/riotable.c')
-rw-r--r--drivers/char/rio/riotable.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c
index f1d50142b91d..d3abe0d37d64 100644
--- a/drivers/char/rio/riotable.c
+++ b/drivers/char/rio/riotable.c
@@ -53,15 +53,12 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2";
53 53
54#include "linux_compat.h" 54#include "linux_compat.h"
55#include "rio_linux.h" 55#include "rio_linux.h"
56#include "typdef.h"
57#include "pkt.h" 56#include "pkt.h"
58#include "daemon.h" 57#include "daemon.h"
59#include "rio.h" 58#include "rio.h"
60#include "riospace.h" 59#include "riospace.h"
61#include "top.h"
62#include "cmdpkt.h" 60#include "cmdpkt.h"
63#include "map.h" 61#include "map.h"
64#include "riotypes.h"
65#include "rup.h" 62#include "rup.h"
66#include "port.h" 63#include "port.h"
67#include "riodrvr.h" 64#include "riodrvr.h"
@@ -74,17 +71,13 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2";
74#include "unixrup.h" 71#include "unixrup.h"
75#include "board.h" 72#include "board.h"
76#include "host.h" 73#include "host.h"
77#include "error.h"
78#include "phb.h" 74#include "phb.h"
79#include "link.h" 75#include "link.h"
80#include "cmdblk.h" 76#include "cmdblk.h"
81#include "route.h" 77#include "route.h"
82#include "control.h"
83#include "cirrus.h" 78#include "cirrus.h"
84#include "rioioctl.h" 79#include "rioioctl.h"
85#include "param.h" 80#include "param.h"
86#include "list.h"
87#include "sam.h"
88#include "protsts.h" 81#include "protsts.h"
89 82
90/* 83/*
@@ -136,7 +129,7 @@ int RIONewTable(struct rio_info *p)
136 cptr = MapP->Name; /* (2) */ 129 cptr = MapP->Name; /* (2) */
137 cptr[MAX_NAME_LEN - 1] = '\0'; 130 cptr[MAX_NAME_LEN - 1] = '\0';
138 if (cptr[0] == '\0') { 131 if (cptr[0] == '\0') {
139 bcopy(MapP->RtaUniqueNum ? "RTA NN" : "HOST NN", MapP->Name, 8); 132 memcpy(MapP->Name, MapP->RtaUniqueNum ? "RTA NN" : "HOST NN", 8);
140 MapP->Name[5] = '0' + Entry / 10; 133 MapP->Name[5] = '0' + Entry / 10;
141 MapP->Name[6] = '0' + Entry % 10; 134 MapP->Name[6] = '0' + Entry % 10;
142 } 135 }
@@ -325,7 +318,7 @@ int RIONewTable(struct rio_info *p)
325 */ 318 */
326 if (MapP->ID == 0) { 319 if (MapP->ID == 0) {
327 rio_dprintk(RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name); 320 rio_dprintk(RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name);
328 bcopy(MapP->Name, HostP->Name, MAX_NAME_LEN); 321 memcpy(HostP->Name, MapP->Name, MAX_NAME_LEN);
329 continue; 322 continue;
330 } 323 }
331 324
@@ -369,7 +362,7 @@ int RIONewTable(struct rio_info *p)
369 } 362 }
370 } 363 }
371 if (!p->RIOHosts[Host].Name[0]) { 364 if (!p->RIOHosts[Host].Name[0]) {
372 bcopy("HOST 1", p->RIOHosts[Host].Name, 7); 365 memcpy(p->RIOHosts[Host].Name, "HOST 1", 7);
373 p->RIOHosts[Host].Name[5] += Host; 366 p->RIOHosts[Host].Name[5] += Host;
374 } 367 }
375 /* 368 /*
@@ -397,7 +390,7 @@ int RIONewTable(struct rio_info *p)
397 */ 390 */
398 if (Host1 != Host) { 391 if (Host1 != Host) {
399 rio_dprintk(RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name); 392 rio_dprintk(RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name);
400 bcopy("HOST 1", p->RIOHosts[Host].Name, 7); 393 memcpy(p->RIOHosts[Host].Name, "HOST 1", 7);
401 p->RIOHosts[Host].Name[5] += Host1; 394 p->RIOHosts[Host].Name[5] += Host1;
402 } 395 }
403 rio_dprintk(RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name); 396 rio_dprintk(RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name);
@@ -440,7 +433,7 @@ int RIOApel(struct rio_info *p)
440 MapP->SysPort = NO_PORT; 433 MapP->SysPort = NO_PORT;
441 for (link = 0; link < LINKS_PER_UNIT; link++) 434 for (link = 0; link < LINKS_PER_UNIT; link++)
442 MapP->Topology[link] = HostP->Topology[link]; 435 MapP->Topology[link] = HostP->Topology[link];
443 bcopy(HostP->Name, MapP->Name, MAX_NAME_LEN); 436 memcpy(MapP->Name, HostP->Name, MAX_NAME_LEN);
444 for (Rup = 0; Rup < MAX_RUP; Rup++) { 437 for (Rup = 0; Rup < MAX_RUP; Rup++) {
445 if (HostP->Mapping[Rup].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) { 438 if (HostP->Mapping[Rup].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) {
446 p->RIOConnectTable[Next] = HostP->Mapping[Rup]; 439 p->RIOConnectTable[Next] = HostP->Mapping[Rup];
@@ -539,10 +532,10 @@ int RIODeleteRta(struct rio_info *p, struct Map *MapP)
539 ** the phb to port mappings in RIORouteRup. 532 ** the phb to port mappings in RIORouteRup.
540 */ 533 */
541 if (PortP->SecondBlock) { 534 if (PortP->SecondBlock) {
542 ushort dest_unit = HostMapP->ID; 535 u16 dest_unit = HostMapP->ID;
543 ushort dest_port = port - SysPort; 536 u16 dest_port = port - SysPort;
544 u16 *TxPktP; 537 u16 *TxPktP;
545 PKT *Pkt; 538 struct PKT *Pkt;
546 539
547 for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) { 540 for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) {
548 /* 541 /*
@@ -552,7 +545,7 @@ int RIODeleteRta(struct rio_info *p, struct Map *MapP)
552 ** a 32 bit pointer so it can be 545 ** a 32 bit pointer so it can be
553 ** accessed from the driver. 546 ** accessed from the driver.
554 */ 547 */
555 Pkt = (PKT *) RIO_PTR(HostP->Caddr, readw(&*TxPktP)); 548 Pkt = (struct PKT *) RIO_PTR(HostP->Caddr, readw(&*TxPktP));
556 rio_dprintk(RIO_DEBUG_TABLE, "Tx packet (%x) destination: Old %x:%x New %x:%x\n", *TxPktP, Pkt->dest_unit, Pkt->dest_port, dest_unit, dest_port); 549 rio_dprintk(RIO_DEBUG_TABLE, "Tx packet (%x) destination: Old %x:%x New %x:%x\n", *TxPktP, Pkt->dest_unit, Pkt->dest_port, dest_unit, dest_port);
557 writew(dest_unit, &Pkt->dest_unit); 550 writew(dest_unit, &Pkt->dest_unit);
558 writew(dest_port, &Pkt->dest_port); 551 writew(dest_port, &Pkt->dest_port);
@@ -600,7 +593,7 @@ int RIOAssignRta(struct rio_info *p, struct Map *MapP)
600 593
601 rio_dprintk(RIO_DEBUG_TABLE, "Assign entry on host %x, rta %x, ID %d, Sysport %d\n", MapP->HostUniqueNum, MapP->RtaUniqueNum, MapP->ID, (int) MapP->SysPort); 594 rio_dprintk(RIO_DEBUG_TABLE, "Assign entry on host %x, rta %x, ID %d, Sysport %d\n", MapP->HostUniqueNum, MapP->RtaUniqueNum, MapP->ID, (int) MapP->SysPort);
602 595
603 if ((MapP->ID != (ushort) - 1) && ((int) MapP->ID < (int) 1 || (int) MapP->ID > MAX_RUP)) { 596 if ((MapP->ID != (u16) - 1) && ((int) MapP->ID < (int) 1 || (int) MapP->ID > MAX_RUP)) {
604 rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); 597 rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n");
605 p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; 598 p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
606 return -EINVAL; 599 return -EINVAL;
@@ -646,7 +639,7 @@ int RIOAssignRta(struct rio_info *p, struct Map *MapP)
646 ** Now we have a host we need to allocate an ID 639 ** Now we have a host we need to allocate an ID
647 ** if the entry does not already have one. 640 ** if the entry does not already have one.
648 */ 641 */
649 if (MapP->ID == (ushort) - 1) { 642 if (MapP->ID == (u16) - 1) {
650 int nNewID; 643 int nNewID;
651 644
652 rio_dprintk(RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", MapP->Name); 645 rio_dprintk(RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", MapP->Name);
@@ -665,7 +658,7 @@ int RIOAssignRta(struct rio_info *p, struct Map *MapP)
665 p->RIOError.Error = COULDNT_FIND_ENTRY; 658 p->RIOError.Error = COULDNT_FIND_ENTRY;
666 return -EBUSY; 659 return -EBUSY;
667 } 660 }
668 MapP->ID = (ushort) nNewID + 1; 661 MapP->ID = (u16) nNewID + 1;
669 rio_dprintk(RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID); 662 rio_dprintk(RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID);
670 HostMapP = &p->RIOHosts[host].Mapping[nNewID]; 663 HostMapP = &p->RIOHosts[host].Mapping[nNewID];
671 HostMapP->RtaUniqueNum = MapP->RtaUniqueNum; 664 HostMapP->RtaUniqueNum = MapP->RtaUniqueNum;
@@ -706,7 +699,7 @@ int RIOAssignRta(struct rio_info *p, struct Map *MapP)
706 */ 699 */
707 HostMapP->SysPort = MapP->SysPort; 700 HostMapP->SysPort = MapP->SysPort;
708 if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) 701 if ((MapP->Flags & RTA16_SECOND_SLOT) == 0)
709 CCOPY(MapP->Name, HostMapP->Name, MAX_NAME_LEN); 702 memcpy(HostMapP->Name, MapP->Name, MAX_NAME_LEN);
710 HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED; 703 HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED;
711#ifdef NEED_TO_FIX 704#ifdef NEED_TO_FIX
712 RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID - 1]); 705 RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID - 1]);
@@ -743,10 +736,10 @@ int RIOAssignRta(struct rio_info *p, struct Map *MapP)
743int RIOReMapPorts(struct rio_info *p, struct Host *HostP, struct Map *HostMapP) 736int RIOReMapPorts(struct rio_info *p, struct Host *HostP, struct Map *HostMapP)
744{ 737{
745 struct Port *PortP; 738 struct Port *PortP;
746 uint SubEnt; 739 unsigned int SubEnt;
747 uint HostPort; 740 unsigned int HostPort;
748 uint SysPort; 741 unsigned int SysPort;
749 ushort RtaType; 742 u16 RtaType;
750 unsigned long flags; 743 unsigned long flags;
751 744
752 rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID); 745 rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID);
@@ -808,10 +801,10 @@ int RIOReMapPorts(struct rio_info *p, struct Host *HostP, struct Map *HostMapP)
808 PortP->RupNum = HostMapP->ID - 1; 801 PortP->RupNum = HostMapP->ID - 1;
809 if (HostMapP->Flags & RTA16_SECOND_SLOT) { 802 if (HostMapP->Flags & RTA16_SECOND_SLOT) {
810 PortP->ID2 = HostMapP->ID2 - 1; 803 PortP->ID2 = HostMapP->ID2 - 1;
811 PortP->SecondBlock = TRUE; 804 PortP->SecondBlock = 1;
812 } else { 805 } else {
813 PortP->ID2 = 0; 806 PortP->ID2 = 0;
814 PortP->SecondBlock = FALSE; 807 PortP->SecondBlock = 0;
815 } 808 }
816 PortP->RtaUniqueNum = HostMapP->RtaUniqueNum; 809 PortP->RtaUniqueNum = HostMapP->RtaUniqueNum;
817 810
@@ -931,7 +924,7 @@ int RIOChangeName(struct rio_info *p, struct Map *MapP)
931 return -ENXIO; 924 return -ENXIO;
932 } 925 }
933 if (MapP->ID == 0) { 926 if (MapP->ID == 0) {
934 CCOPY(MapP->Name, p->RIOHosts[host].Name, MAX_NAME_LEN); 927 memcpy(p->RIOHosts[host].Name, MapP->Name, MAX_NAME_LEN);
935 return 0; 928 return 0;
936 } 929 }
937 930
@@ -941,7 +934,7 @@ int RIOChangeName(struct rio_info *p, struct Map *MapP)
941 p->RIOError.Error = RTA_NUMBER_WRONG; 934 p->RIOError.Error = RTA_NUMBER_WRONG;
942 return -ENXIO; 935 return -ENXIO;
943 } 936 }
944 CCOPY(MapP->Name, HostMapP->Name, MAX_NAME_LEN); 937 memcpy(HostMapP->Name, MapP->Name, MAX_NAME_LEN);
945 return 0; 938 return 0;
946 } 939 }
947 } 940 }