Commit 8d8706e2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] lindent rio drivers

Run all rio files through indent -kr -i8 -bri0 -l255, as requested by Alan.

rioboot.c and rioinit.c were skipped due to worrisome lindent warnings.

Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a9415644
...@@ -52,8 +52,7 @@ static char *_board_h_sccs_ = "@(#)board.h 1.2"; ...@@ -52,8 +52,7 @@ static char *_board_h_sccs_ = "@(#)board.h 1.2";
/* /*
** The shape of the Host Control area, at offset 0x7C00, Write Only ** The shape of the Host Control area, at offset 0x7C00, Write Only
*/ */
struct s_Ctrl struct s_Ctrl {
{
BYTE DpCtl; /* 7C00 */ BYTE DpCtl; /* 7C00 */
BYTE Dp_Unused2_[127]; BYTE Dp_Unused2_[127];
BYTE DpIntSet; /* 7C80 */ BYTE DpIntSet; /* 7C80 */
...@@ -67,8 +66,7 @@ struct s_Ctrl ...@@ -67,8 +66,7 @@ struct s_Ctrl
/* /*
** The PROM data area on the host (0x7C00), Read Only ** The PROM data area on the host (0x7C00), Read Only
*/ */
struct s_Prom struct s_Prom {
{
WORD DpSlxCode[2]; WORD DpSlxCode[2];
WORD DpRev; WORD DpRev;
WORD Dp_Unused6_; WORD Dp_Unused6_;
...@@ -83,8 +81,7 @@ struct s_Prom ...@@ -83,8 +81,7 @@ struct s_Prom
/* /*
** Union of the Ctrl and Prom areas ** Union of the Ctrl and Prom areas
*/ */
union u_CtrlProm /* This is the control/PROM area (0x7C00) */ union u_CtrlProm { /* This is the control/PROM area (0x7C00) */
{
struct s_Ctrl DpCtrl; struct s_Ctrl DpCtrl;
struct s_Prom DpProm; struct s_Prom DpProm;
}; };
...@@ -92,22 +89,19 @@ union u_CtrlProm /* This is the control/PROM area (0x7C00) */ ...@@ -92,22 +89,19 @@ union u_CtrlProm /* This is the control/PROM area (0x7C00) */
/* /*
** The top end of memory! ** The top end of memory!
*/ */
struct s_ParmMapS /* Area containing Parm Map Pointer */ struct s_ParmMapS { /* Area containing Parm Map Pointer */
{
BYTE Dp_Unused8_[DP_PARMMAP_ADDR]; BYTE Dp_Unused8_[DP_PARMMAP_ADDR];
WORD DpParmMapAd; WORD DpParmMapAd;
}; };
struct s_StartUpS struct s_StartUpS {
{
BYTE Dp_Unused9_[DP_STARTUP_ADDR]; BYTE Dp_Unused9_[DP_STARTUP_ADDR];
BYTE Dp_LongJump[0x4]; BYTE Dp_LongJump[0x4];
BYTE Dp_Unused10_[2]; BYTE Dp_Unused10_[2];
BYTE Dp_ShortJump[0x2]; BYTE Dp_ShortJump[0x2];
}; };
union u_Sram2ParmMap /* This is the top of memory (0x7E00-0x7FFF) */ union u_Sram2ParmMap { /* This is the top of memory (0x7E00-0x7FFF) */
{
BYTE DpSramMem[DP_SRAM2_SIZE]; BYTE DpSramMem[DP_SRAM2_SIZE];
struct s_ParmMapS DpParmMapS; struct s_ParmMapS DpParmMapS;
struct s_StartUpS DpStartUpS; struct s_StartUpS DpStartUpS;
...@@ -116,8 +110,7 @@ union u_Sram2ParmMap /* This is the top of memory (0x7E00-0x7FFF) */ ...@@ -116,8 +110,7 @@ union u_Sram2ParmMap /* This is the top of memory (0x7E00-0x7FFF) */
/* /*
** This is the DP RAM overlay. ** This is the DP RAM overlay.
*/ */
struct DpRam struct DpRam {
{
BYTE DpSram1[DP_SRAM1_SIZE]; /* 0000 - 7BFF */ BYTE DpSram1[DP_SRAM1_SIZE]; /* 0000 - 7BFF */
union u_CtrlProm DpCtrlProm; /* 7C00 - 7DFF */ union u_CtrlProm DpCtrlProm; /* 7C00 - 7DFF */
union u_Sram2ParmMap DpSram2ParmMap; /* 7E00 - 7FFF */ union u_Sram2ParmMap DpSram2ParmMap; /* 7E00 - 7FFF */
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS #ifdef SCCS
static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h 1.1" ; static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h 1.1";
#endif #endif
#endif #endif
...@@ -49,14 +49,13 @@ static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h 1.1" ; ...@@ -49,14 +49,13 @@ static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h 1.1" ;
* Overlayed onto the Data fields of a regular * Overlayed onto the Data fields of a regular
* Packet * Packet
************************************************/ ************************************************/
typedef struct BOOT_PKT BOOT_PKT ; typedef struct BOOT_PKT BOOT_PKT;
struct BOOT_PKT { struct BOOT_PKT {
short seq_num ; short seq_num;
char data[10] ; char data[10];
} ; };
#endif #endif
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -97,9 +97,8 @@ ...@@ -97,9 +97,8 @@
#define MAX_RATE B2000 #define MAX_RATE B2000
struct baud_rate /* Tag for baud rates */ struct baud_rate { /* Tag for baud rates */
{ /* short host_rate, *//* As passed by the driver */
/* short host_rate,*/ /* As passed by the driver */
short divisor, /* The divisor */ short divisor, /* The divisor */
prescaler; /* The pre-scaler */ prescaler; /* The pre-scaler */
}; };
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS #ifdef SCCS
static char *_rio_chan_h_sccs = "@(#)chan.h 1.1" ; static char *_rio_chan_h_sccs = "@(#)chan.h 1.1";
#endif #endif
#endif #endif
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
#define ticr 0x45 /* Transmit Interrupting Channel Reg */ #define ticr 0x45 /* Transmit Interrupting Channel Reg */
#define micr 0x46 /* Modem Interrupting Channel Register */ #define micr 0x46 /* Modem Interrupting Channel Register */
#define gcr 0x4b /* Global configuration register*/ #define gcr 0x4b /* Global configuration register */
#define misr 0x4c /* Modem interrupt status register */ #define misr 0x4c /* Modem interrupt status register */
#define rbusr 0x59 #define rbusr 0x59
...@@ -162,15 +162,15 @@ ...@@ -162,15 +162,15 @@
#define tir 0x6a /* Transmit Interrupt Register */ #define tir 0x6a /* Transmit Interrupt Register */
#define rir 0x6b /* Receive Interrupt Register */ #define rir 0x6b /* Receive Interrupt Register */
#define msvr1 0x6c /* Modem Signal Value Register 1 */ #define msvr1 0x6c /* Modem Signal Value Register 1 */
#define msvr2 0x6d /* Modem Signal Value Register 2*/ #define msvr2 0x6d /* Modem Signal Value Register 2 */
#define psvr 0x6f /* Printer Signal Value Register*/ #define psvr 0x6f /* Printer Signal Value Register */
#define tbpr 0x72 /* Transmit Baud Rate Period Register */ #define tbpr 0x72 /* Transmit Baud Rate Period Register */
#define tcor 0x76 /* Transmit Clock Option Register */ #define tcor 0x76 /* Transmit Clock Option Register */
#define rbpr 0x78 /* Receive Baud Rate Period Register */ #define rbpr 0x78 /* Receive Baud Rate Period Register */
#define rber 0x7a /* Receive Baud Rate Extension Register */ #define rber 0x7a /* Receive Baud Rate Extension Register */
#define rcor 0x7c /* Receive Clock Option Register*/ #define rcor 0x7c /* Receive Clock Option Register */
#define ppr 0x7e /* Prescalar Period Register */ #define ppr 0x7e /* Prescalar Period Register */
/* Misc registers used for forcing the 1400 out of its reset woes */ /* Misc registers used for forcing the 1400 out of its reset woes */
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS #ifdef SCCS
static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1" ; static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1";
#endif #endif
#endif #endif
...@@ -81,4 +81,3 @@ static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1" ; ...@@ -81,4 +81,3 @@ static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1" ;
#endif #endif
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -44,15 +44,14 @@ static char *_cmdblk_h_sccs_ = "@(#)cmdblk.h 1.2"; ...@@ -44,15 +44,14 @@ static char *_cmdblk_h_sccs_ = "@(#)cmdblk.h 1.2";
** a rup. ** a rup.
*/ */
struct CmdBlk struct CmdBlk {
{
struct CmdBlk *NextP; /* Pointer to next command block */ struct CmdBlk *NextP; /* Pointer to next command block */
struct PKT Packet; /* A packet, to copy to the rup */ struct PKT Packet; /* A packet, to copy to the rup */
/* The func to call to check if OK */ /* The func to call to check if OK */
int (*PreFuncP)(int, struct CmdBlk *); int (*PreFuncP) (int, struct CmdBlk *);
int PreArg; /* The arg for the func */ int PreArg; /* The arg for the func */
/* The func to call when completed */ /* The func to call when completed */
int (*PostFuncP)(int, struct CmdBlk *); int (*PostFuncP) (int, struct CmdBlk *);
int PostArg; /* The arg for the func */ int PostArg; /* The arg for the func */
}; };
......
...@@ -54,8 +54,7 @@ static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h 1.2"; ...@@ -54,8 +54,7 @@ static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h 1.2";
** This structure overlays a PktCmd->CmdData structure, and so starts ** This structure overlays a PktCmd->CmdData structure, and so starts
** at Data[2] in the actual pkt! ** at Data[2] in the actual pkt!
*/ */
struct BootSequence struct BootSequence {
{
WORD NumPackets; WORD NumPackets;
WORD LoadBase; WORD LoadBase;
WORD CodeSize; WORD CodeSize;
...@@ -63,17 +62,14 @@ struct BootSequence ...@@ -63,17 +62,14 @@ struct BootSequence
#define BOOT_SEQUENCE_LEN 8 #define BOOT_SEQUENCE_LEN 8
struct SamTop struct SamTop {
{
BYTE Unit; BYTE Unit;
BYTE Link; BYTE Link;
}; };
struct CmdHdr struct CmdHdr {
{
BYTE PcCommand; BYTE PcCommand;
union union {
{
BYTE PcPhbNum; BYTE PcPhbNum;
BYTE PcLinkNum; BYTE PcLinkNum;
BYTE PcIDNum; BYTE PcIDNum;
...@@ -81,28 +77,22 @@ struct CmdHdr ...@@ -81,28 +77,22 @@ struct CmdHdr
}; };
struct PktCmd struct PktCmd {
{ union {
union struct {
{
struct
{
struct CmdHdr CmdHdr; struct CmdHdr CmdHdr;
struct BootSequence PcBootSequence; struct BootSequence PcBootSequence;
} S1; } S1;
struct struct {
{
WORD PcSequence; WORD PcSequence;
BYTE PcBootData[RTA_BOOT_DATA_SIZE]; BYTE PcBootData[RTA_BOOT_DATA_SIZE];
} S2; } S2;
struct struct {
{
WORD __crud__; WORD __crud__;
BYTE PcUniqNum[4]; /* this is really a uint. */ BYTE PcUniqNum[4]; /* this is really a uint. */
BYTE PcModuleTypes; /* what modules are fitted */ BYTE PcModuleTypes; /* what modules are fitted */
} S3; } S3;
struct struct {
{
struct CmdHdr CmdHdr; struct CmdHdr CmdHdr;
BYTE __undefined__; BYTE __undefined__;
BYTE PcModemStatus; BYTE PcModemStatus;
...@@ -111,57 +101,46 @@ struct PktCmd ...@@ -111,57 +101,46 @@ struct PktCmd
WORD PcSubAddr; /* Address for command */ WORD PcSubAddr; /* Address for command */
BYTE PcSubData[64]; /* Date area for command */ BYTE PcSubData[64]; /* Date area for command */
} S4; } S4;
struct struct {
{
struct CmdHdr CmdHdr; struct CmdHdr CmdHdr;
BYTE PcCommandText[1]; BYTE PcCommandText[1];
BYTE __crud__[20]; BYTE __crud__[20];
BYTE PcIDNum2; /* It had to go somewhere! */ BYTE PcIDNum2; /* It had to go somewhere! */
} S5; } S5;
struct struct {
{
struct CmdHdr CmdHdr; struct CmdHdr CmdHdr;
struct SamTop Topology[LINKS_PER_UNIT]; struct SamTop Topology[LINKS_PER_UNIT];
} S6; } S6;
} U1; } U1;
}; };
struct PktCmd_M struct PktCmd_M {
{ union {
union struct {
{ struct {
struct
{
struct
{
uchar PcCommand; uchar PcCommand;
union union {
{
uchar PcPhbNum; uchar PcPhbNum;
uchar PcLinkNum; uchar PcLinkNum;
uchar PcIDNum; uchar PcIDNum;
} U0; } U0;
} CmdHdr; } CmdHdr;
struct struct {
{
ushort NumPackets; ushort NumPackets;
ushort LoadBase; ushort LoadBase;
ushort CodeSize; ushort CodeSize;
} PcBootSequence; } PcBootSequence;
} S1; } S1;
struct struct {
{
ushort PcSequence; ushort PcSequence;
uchar PcBootData[RTA_BOOT_DATA_SIZE]; uchar PcBootData[RTA_BOOT_DATA_SIZE];
} S2; } S2;
struct struct {
{
ushort __crud__; ushort __crud__;
uchar PcUniqNum[4]; /* this is really a uint. */ uchar PcUniqNum[4]; /* this is really a uint. */
uchar PcModuleTypes; /* what modules are fitted */ uchar PcModuleTypes; /* what modules are fitted */
} S3; } S3;
struct struct {
{
ushort __cmd_hdr__; ushort __cmd_hdr__;
uchar __undefined__; uchar __undefined__;
uchar PcModemStatus; uchar PcModemStatus;
...@@ -170,15 +149,13 @@ struct PktCmd_M ...@@ -170,15 +149,13 @@ struct PktCmd_M
ushort PcSubAddr; ushort PcSubAddr;
uchar PcSubData[64]; uchar PcSubData[64];
} S4; } S4;
struct struct {
{
ushort __cmd_hdr__; ushort __cmd_hdr__;
uchar PcCommandText[1]; uchar PcCommandText[1];
uchar __crud__[20]; uchar __crud__[20];
uchar PcIDNum2; /* Tacked on end */ uchar PcIDNum2; /* Tacked on end */
} S5; } S5;
struct struct {
{
ushort __cmd_hdr__; ushort __cmd_hdr__;
struct Top Topology[LINKS_PER_UNIT]; struct Top Topology[LINKS_PER_UNIT];
} S6; } S6;
......
...@@ -59,4 +59,3 @@ ...@@ -59,4 +59,3 @@
#endif #endif
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -44,15 +44,13 @@ static char *_daemon_h_sccs_ = "@(#)daemon.h 1.3"; ...@@ -44,15 +44,13 @@ static char *_daemon_h_sccs_ = "@(#)daemon.h 1.3";
** structures used on /dev/rio ** structures used on /dev/rio
*/ */
struct Error struct Error {
{
uint Error; uint Error;
uint Entry; uint Entry;
uint Other; uint Other;
}; };
struct DownLoad struct DownLoad {
{
char *DataP; char *DataP;
uint Count; uint Count;
uint ProductCode; uint ProductCode;
...@@ -69,8 +67,7 @@ struct DownLoad ...@@ -69,8 +67,7 @@ struct DownLoad
#define MAX_XP_CTRL_LEN 16 /* ALSO IN PORT.H */ #define MAX_XP_CTRL_LEN 16 /* ALSO IN PORT.H */
#endif #endif
struct PortSetup struct PortSetup {
{
uint From; /* Set/Clear XP & IXANY Control from this port.... */ uint From; /* Set/Clear XP & IXANY Control from this port.... */
uint To; /* .... to this port */ uint To; /* .... to this port */
uint XpCps; /* at this speed */ uint XpCps; /* at this speed */
...@@ -83,28 +80,24 @@ struct PortSetup ...@@ -83,28 +80,24 @@ struct PortSetup
uchar Drain; /* close only when drained */ uchar Drain; /* close only when drained */
}; };
struct LpbReq struct LpbReq {
{
uint Host; uint Host;
uint Link; uint Link;
struct LPB *LpbP; struct LPB *LpbP;
}; };
struct RupReq struct RupReq {
{
uint HostNum; uint HostNum;
uint RupNum; uint RupNum;
struct RUP *RupP; struct RUP *RupP;
}; };
struct PortReq struct PortReq {
{
uint SysPort; uint SysPort;
struct Port *PortP; struct Port *PortP;
}; };
struct StreamInfo struct StreamInfo {
{
uint SysPort; uint SysPort;
#if 0 #if 0
queue_t RQueue; queue_t RQueue;
...@@ -115,59 +108,50 @@ struct StreamInfo ...@@ -115,59 +108,50 @@ struct StreamInfo
#endif #endif
}; };
struct HostReq struct HostReq {
{
uint HostNum; uint HostNum;
struct Host *HostP; struct Host *HostP;
}; };
struct HostDpRam struct HostDpRam {
{
uint HostNum; uint HostNum;
struct DpRam *DpRamP; struct DpRam *DpRamP;
}; };
struct DebugCtrl struct DebugCtrl {
{
uint SysPort; uint SysPort;
uint Debug; uint Debug;
uint Wait; uint Wait;
}; };
struct MapInfo struct MapInfo {
{
uint FirstPort; /* 8 ports, starting from this (tty) number */ uint FirstPort; /* 8 ports, starting from this (tty) number */
uint RtaUnique; /* reside on this RTA (unique number) */ uint RtaUnique; /* reside on this RTA (unique number) */
}; };
struct MapIn struct MapIn {
{
uint NumEntries; /* How many port sets are we mapping? */ uint NumEntries; /* How many port sets are we mapping? */
struct MapInfo *MapInfoP; /* Pointer to (user space) info */ struct MapInfo *MapInfoP; /* Pointer to (user space) info */
}; };
struct SendPack struct SendPack {
{
unsigned int PortNum; unsigned int PortNum;
unsigned char Len; unsigned char Len;
unsigned char Data[PKT_MAX_DATA_LEN]; unsigned char Data[PKT_MAX_DATA_LEN];
}; };
struct SpecialRupCmd struct SpecialRupCmd {
{
struct PKT Packet; struct PKT Packet;
unsigned short Host; unsigned short Host;
unsigned short RupNum; unsigned short RupNum;
}; };
struct IdentifyRta struct IdentifyRta {
{
ulong RtaUnique; ulong RtaUnique;
uchar ID; uchar ID;
}; };
struct KillNeighbour struct KillNeighbour {
{
ulong UniqueNum; ulong UniqueNum;
uchar Link; uchar Link;
}; };
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS #ifdef SCCS
static char *_rio_defaults_h_sccs = "@(#)defaults.h 1.1" ; static char *_rio_defaults_h_sccs = "@(#)defaults.h 1.1";
#endif #endif
#endif #endif
...@@ -56,4 +56,3 @@ static char *_rio_defaults_h_sccs = "@(#)defaults.h 1.1" ; ...@@ -56,4 +56,3 @@ static char *_rio_defaults_h_sccs = "@(#)defaults.h 1.1" ;
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS #ifdef SCCS
static char *_rio_enable_h_sccs = "@(#)enable.h 1.1" ; static char *_rio_enable_h_sccs = "@(#)enable.h 1.1";
#endif #endif
#endif #endif
...@@ -46,5 +46,3 @@ static char *_rio_enable_h_sccs = "@(#)enable.h 1.1" ; ...@@ -46,5 +46,3 @@ static char *_rio_enable_h_sccs = "@(#)enable.h 1.1" ;
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -80,6 +80,3 @@ ...@@ -80,6 +80,3 @@
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -41,114 +41,113 @@ ...@@ -41,114 +41,113 @@
#ifndef lint #ifndef lint
#ifdef SCCS #ifdef SCCS
static char *_rio_formpkt_h_sccs = "@(#)formpkt.h 1.1" ; static char *_rio_formpkt_h_sccs = "@(#)formpkt.h 1.1";
#endif #endif
#endif #endif
typedef struct FORM_BOOT_PKT_1 FORM_BOOT_PKT_1 ; typedef struct FORM_BOOT_PKT_1 FORM_BOOT_PKT_1;
struct FORM_BOOT_PKT_1 { struct FORM_BOOT_PKT_1 {
ushort pkt_number ; ushort pkt_number;
ushort pkt_total ; ushort pkt_total;
ushort boot_top ; ushort boot_top;
} ; };
typedef struct FORM_BOOT_PKT_2 FORM_BOOT_PKT_2 ; typedef struct FORM_BOOT_PKT_2 FORM_BOOT_PKT_2;
struct FORM_BOOT_PKT_2 { struct FORM_BOOT_PKT_2 {
ushort pkt_number ; ushort pkt_number;
char boot_data[10] ; char boot_data[10];
} ; };
typedef struct FORM_ATTACH_RTA FORM_ATTACH_RTA ; typedef struct FORM_ATTACH_RTA FORM_ATTACH_RTA;
struct FORM_ATTACH_RTA { struct FORM_ATTACH_RTA {
char cmd_code ; char cmd_code;
char booter_serial[4] ; char booter_serial[4];
char booter_link ; char booter_link;
char bootee_serial[4] ; char bootee_serial[4];
char bootee_link ; char bootee_link;
} ; };
typedef struct FORM_BOOT_ID FORM_BOOT_ID ; typedef struct FORM_BOOT_ID FORM_BOOT_ID;
struct FORM_BOOT_ID { struct FORM_BOOT_ID {
char cmd_code ; char cmd_code;
char bootee_serial[4] ; char bootee_serial[4];
char bootee_prod_id ; char bootee_prod_id;
char bootee_link ; char bootee_link;
} ; };
typedef struct FORM_ROUTE_1 FORM_ROUTE_1 ; typedef struct FORM_ROUTE_1 FORM_ROUTE_1;
struct FORM_ROUTE_1 { struct FORM_ROUTE_1 {
char cmd_code ; char cmd_code;
char pkt_number ; char pkt_number;
char total_in_sequence ; char total_in_sequence;
char unit_id ; char unit_id;
char host_unit_id ; char host_unit_id;
} ; };
typedef struct FORM_ROUTE_2 FORM_ROUTE_2 ; typedef struct FORM_ROUTE_2 FORM_ROUTE_2;
struct FORM_ROUTE_2 { struct FORM_ROUTE_2 {
char cmd_code ; char cmd_code;
char pkt_number ; char pkt_number;
char total_in_sequence ; char total_in_sequence;
char route_data[9] ; char route_data[9];
} ; };
typedef struct FORM_ROUTE_REQ FORM_ROUTE_REQ ; typedef struct FORM_ROUTE_REQ FORM_ROUTE_REQ;
struct FORM_ROUTE_REQ { struct FORM_ROUTE_REQ {
char cmd_code ; char cmd_code;
char pkt_number ; char pkt_number;
char total_in_sequence ; char total_in_sequence;
char route_data[10] ; char route_data[10];
} ; };
typedef struct FORM_ERROR FORM_ERROR ; typedef struct FORM_ERROR FORM_ERROR;
struct FORM_ERROR { struct FORM_ERROR {
char cmd_code ; char cmd_code;
char error_code ; char error_code;
} ; };
typedef struct FORM_STATUS FORM_STATUS ; typedef struct FORM_STATUS FORM_STATUS;
struct FORM_STATUS { struct FORM_STATUS {
char cmd_code ; char cmd_code;
char status_code ; char status_code;
char last_packet_valid ; char last_packet_valid;
char tx_buffer ; char tx_buffer;
char rx_buffer ; char rx_buffer;
char port_status ; char port_status;
char phb_status ; char phb_status;
} ; };
typedef struct FORM_LINK_STATUS FORM_LINK_STATUS ; typedef struct FORM_LINK_STATUS FORM_LINK_STATUS;
struct FORM_LINK_STATUS { struct FORM_LINK_STATUS {
char cmd_code ; char cmd_code;
char status_code ; char status_code;
char link_number ; char link_number;
ushort rx_errors ; ushort rx_errors;
ushort tx_errors ; ushort tx_errors;
ushort csum_errors ; ushort csum_errors;
ushort disconnects ; ushort disconnects;
} ; };
typedef struct FORM_PARTITION FORM_PARTITION ; typedef struct FORM_PARTITION FORM_PARTITION;
struct FORM_PARTITION { struct FORM_PARTITION {
char cmd_code ; char cmd_code;
char status_code ; char status_code;
char port_number ; char port_number;
char tx_max ; char tx_max;
char rx_max ; char rx_max;
char rx_limit ; char rx_limit;
} ; };
#endif #endif
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -47,20 +47,19 @@ int RIOBootCodeHOST(struct rio_info *, register struct DownLoad *); ...@@ -47,20 +47,19 @@ int RIOBootCodeHOST(struct rio_info *, register struct DownLoad *);
int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *); int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *);
void msec_timeout(struct Host *); void msec_timeout(struct Host *);
int RIOBootRup(struct rio_info *, uint, struct Host *, struct PKT *); int RIOBootRup(struct rio_info *, uint, struct Host *, struct PKT *);
int RIOBootOk(struct rio_info *,struct Host *, ulong); int RIOBootOk(struct rio_info *, struct Host *, ulong);
int RIORtaBound(struct rio_info *, uint); int RIORtaBound(struct rio_info *, uint);
void FillSlot(int, int, uint, struct Host *); void FillSlot(int, int, uint, struct Host *);
/* riocmd.c */ /* riocmd.c */
int RIOFoadRta(struct Host *, struct Map *); int RIOFoadRta(struct Host *, struct Map *);
int RIOZombieRta(struct Host *, struct Map *); int RIOZombieRta(struct Host *, struct Map *);
int RIOCommandRta(struct rio_info *, uint, int (* func)( struct Host *, int RIOCommandRta(struct rio_info *, uint, int (*func) (struct Host *, struct Map *));
struct Map *));
int RIOIdentifyRta(struct rio_info *, caddr_t); int RIOIdentifyRta(struct rio_info *, caddr_t);
int RIOKillNeighbour(struct rio_info *, caddr_t); int RIOKillNeighbour(struct rio_info *, caddr_t);
int RIOSuspendBootRta(struct Host *, int, int); int RIOSuspendBootRta(struct Host *, int, int);
int RIOFoadWakeup(struct rio_info *); int RIOFoadWakeup(struct rio_info *);
struct CmdBlk * RIOGetCmdBlk(void); struct CmdBlk *RIOGetCmdBlk(void);
void RIOFreeCmdBlk(struct CmdBlk *); void RIOFreeCmdBlk(struct CmdBlk *);
int RIOQueueCmdBlk(struct Host *, uint, struct CmdBlk *); int RIOQueueCmdBlk(struct Host *, uint, struct CmdBlk *);
void RIOPollHostCommands(struct rio_info *, struct Host *); void RIOPollHostCommands(struct rio_info *, struct Host *);
...@@ -71,13 +70,13 @@ void ShowPacket(uint, struct PKT *); ...@@ -71,13 +70,13 @@ void ShowPacket(uint, struct PKT *);
/* rioctrl.c */ /* rioctrl.c */
int copyin(int, caddr_t, int); int copyin(int, caddr_t, int);
int riocontrol(struct rio_info *, dev_t,int,caddr_t,int); int riocontrol(struct rio_info *, dev_t, int, caddr_t, int);
int RIOPreemptiveCmd(struct rio_info *,struct Port *,uchar); int RIOPreemptiveCmd(struct rio_info *, struct Port *, uchar);
/* rioinit.c */ /* rioinit.c */
void rioinit(struct rio_info *, struct RioHostInfo *); void rioinit(struct rio_info *, struct RioHostInfo *);
void RIOInitHosts(struct rio_info *, struct RioHostInfo *); void RIOInitHosts(struct rio_info *, struct RioHostInfo *);
void RIOISAinit(struct rio_info *,int); void RIOISAinit(struct rio_info *, int);
int RIODoAT(struct rio_info *, int, int); int RIODoAT(struct rio_info *, int, int);
caddr_t RIOCheckForATCard(int); caddr_t RIOCheckForATCard(int);
int RIOAssignAT(struct rio_info *, int, caddr_t, int); int RIOAssignAT(struct rio_info *, int, caddr_t, int);
...@@ -85,7 +84,7 @@ int RIOBoardTest(paddr_t, caddr_t, uchar, int); ...@@ -85,7 +84,7 @@ int RIOBoardTest(paddr_t, caddr_t, uchar, int);
void RIOAllocDataStructs(struct rio_info *); void RIOAllocDataStructs(struct rio_info *);
void RIOSetupDataStructs(struct rio_info *); void RIOSetupDataStructs(struct rio_info *);
int RIODefaultName(struct rio_info *, struct Host *, uint); int RIODefaultName(struct rio_info *, struct Host *, uint);
struct rioVersion * RIOVersid(void); struct rioVersion *RIOVersid(void);
int RIOMapin(paddr_t, int, caddr_t *); int RIOMapin(paddr_t, int, caddr_t *);
void RIOMapout(paddr_t, long, caddr_t); void RIOMapout(paddr_t, long, caddr_t);
void RIOHostReset(uint, volatile struct DpRam *, uint); void RIOHostReset(uint, volatile struct DpRam *, uint);
...@@ -116,7 +115,7 @@ int RIOFindFreeID(struct rio_info *, struct Host *, uint *, uint *); ...@@ -116,7 +115,7 @@ int RIOFindFreeID(struct rio_info *, struct Host *, uint *, uint *);
/* riotty.c */ /* riotty.c */
int riotopen(struct tty_struct * tty, struct file * filp); int riotopen(struct tty_struct *tty, struct file *filp);
int riotclose(void *ptr); int riotclose(void *ptr);
int riotioctl(struct rio_info *, struct tty_struct *, register int, register caddr_t); int riotioctl(struct rio_info *, struct tty_struct *, register int, register caddr_t);
void ttyseth(struct Port *, struct ttystatics *, struct old_sgttyb *sg); void ttyseth(struct Port *, struct ttystatics *, struct old_sgttyb *sg);
...@@ -127,27 +126,27 @@ int RIOApel(struct rio_info *); ...@@ -127,27 +126,27 @@ int RIOApel(struct rio_info *);
int RIODeleteRta(struct rio_info *, struct Map *); int RIODeleteRta(struct rio_info *, struct Map *);
int RIOAssignRta(struct rio_info *, struct Map *); int RIOAssignRta(struct rio_info *, struct Map *);
int RIOReMapPorts(struct rio_info *, struct Host *, struct Map *); int RIOReMapPorts(struct rio_info *, struct Host *, struct Map *);
int RIOChangeName(struct rio_info *, struct Map*); int RIOChangeName(struct rio_info *, struct Map *);
#if 0 #if 0
/* riodrvr.c */ /* riodrvr.c */
struct rio_info * rio_install(struct RioHostInfo *); struct rio_info *rio_install(struct RioHostInfo *);
int rio_uninstall(register struct rio_info *); int rio_uninstall(register struct rio_info *);
int rio_open(struct rio_info *, int, struct file *); int rio_open(struct rio_info *, int, struct file *);
int rio_close(struct rio_info *, struct file *); int rio_close(struct rio_info *, struct file *);
int rio_read(struct rio_info *, struct file *, char *, int); int rio_read(struct rio_info *, struct file *, char *, int);
int rio_write(struct rio_info *, struct file * f, char *, int); int rio_write(struct rio_info *, struct file *f, char *, int);
int rio_ioctl(struct rio_info *, struct file *, int, char *); int rio_ioctl(struct rio_info *, struct file *, int, char *);
int rio_select(struct rio_info *, struct file * f, int, struct sel *); int rio_select(struct rio_info *, struct file *f, int, struct sel *);
int rio_intr(char *); int rio_intr(char *);
int rio_isr_thread(char *); int rio_isr_thread(char *);
struct rio_info * rio_info_store( int cmd, struct rio_info * p); struct rio_info *rio_info_store(int cmd, struct rio_info *p);
#endif #endif
extern int rio_pcicopy(char *src, char *dst, int n); extern int rio_pcicopy(char *src, char *dst, int n);
extern int rio_minor (struct tty_struct *tty); extern int rio_minor(struct tty_struct *tty);
extern int rio_ismodem (struct tty_struct *tty); extern int rio_ismodem(struct tty_struct *tty);
extern void rio_start_card_running (struct Host * HostP); extern void rio_start_card_running(struct Host *HostP);
#endif /* __func_h_def */ #endif /* __func_h_def */
...@@ -49,8 +49,7 @@ static char *_host_h_sccs_ = "@(#)host.h 1.2"; ...@@ -49,8 +49,7 @@ static char *_host_h_sccs_ = "@(#)host.h 1.2";
** Host data structure. This is used for the software equiv. of ** Host data structure. This is used for the software equiv. of
** the host. ** the host.
*/ */
struct Host struct Host {
{
uchar Type; /* RIO_EISA, RIO_MCA, ... */ uchar Type; /* RIO_EISA, RIO_MCA, ... */
uchar Ivec; /* POLLED or ivec number */ uchar Ivec; /* POLLED or ivec number */
uchar Mode; /* Control stuff */ uchar Mode; /* Control stuff */
...@@ -65,8 +64,8 @@ struct Host ...@@ -65,8 +64,8 @@ struct Host
/*struct lockb HostLock; *//* Lock structure for MPX */ /*struct lockb HostLock; *//* Lock structure for MPX */
uint WorkToBeDone; /* set to true each interrupt */ uint WorkToBeDone; /* set to true each interrupt */
uint InIntr; /* Being serviced? */ uint InIntr; /* Being serviced? */
uint IntSrvDone;/* host's interrupt has been serviced */ uint IntSrvDone; /* host's interrupt has been serviced */
int (*Copy)( caddr_t, caddr_t, int ); /* copy func */ int (*Copy) (caddr_t, caddr_t, int); /* copy func */
struct timer_list timer; struct timer_list timer;
/* /*
** I M P O R T A N T ! ** I M P O R T A N T !
...@@ -97,7 +96,7 @@ struct Host ...@@ -97,7 +96,7 @@ struct Host
struct Map Mapping[MAX_RUP]; /* Mappings for host */ struct Map Mapping[MAX_RUP]; /* Mappings for host */
struct PHB *PhbP; /* Pointer to the PHB array */ struct PHB *PhbP; /* Pointer to the PHB array */
ushort *PhbNumP; /* Ptr to Number of PHB's */ ushort *PhbNumP; /* Ptr to Number of PHB's */
struct LPB *LinkStrP ; /* Link Structure Array */ struct LPB *LinkStrP; /* Link Structure Array */
struct RUP *RupP; /* Sixteen real rups here */ struct RUP *RupP; /* Sixteen real rups here */
struct PARM_MAP *ParmMapP; /* points to the parmmap */ struct PARM_MAP *ParmMapP; /* points to the parmmap */
uint ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */ uint ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */
...@@ -107,9 +106,9 @@ struct Host ...@@ -107,9 +106,9 @@ struct Host
** The first sixteen are the real Rup entries (above), the last four ** The first sixteen are the real Rup entries (above), the last four
** are the link RUPs. ** are the link RUPs.
*/ */
struct UnixRup UnixRups[MAX_RUP+LINKS_PER_UNIT]; struct UnixRup UnixRups[MAX_RUP + LINKS_PER_UNIT];
int timeout_id; /* For calling 100 ms delays */ int timeout_id; /* For calling 100 ms delays */
int timeout_sem;/* For calling 100 ms delays */ int timeout_sem; /* For calling 100 ms delays */
long locks; /* long req'd for set_bit --RR */ long locks; /* long req'd for set_bit --RR */
char ____end_marker____; char ____end_marker____;
}; };
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS_LABELS #ifdef SCCS_LABELS
static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2" ; static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2";
#endif #endif
#endif #endif
...@@ -53,5 +53,3 @@ static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2" ; ...@@ -53,5 +53,3 @@ static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2" ;
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -119,29 +119,29 @@ ...@@ -119,29 +119,29 @@
#endif /* RTA */ #endif /* RTA */
struct LPB { struct LPB {
WORD link_number ; /* Link Number */ WORD link_number; /* Link Number */
Channel_ptr in_ch ; /* Link In Channel */ Channel_ptr in_ch; /* Link In Channel */
Channel_ptr out_ch ; /* Link Out Channel */ Channel_ptr out_ch; /* Link Out Channel */
#ifdef RTA #ifdef RTA
uchar stat_led ; /* Port open leds */ uchar stat_led; /* Port open leds */
uchar led ; /* True, light led! */ uchar led; /* True, light led! */
#endif #endif
BYTE attached_serial[4]; /* Attached serial number */ BYTE attached_serial[4]; /* Attached serial number */
BYTE attached_host_serial[4]; BYTE attached_host_serial[4];
/* Serial number of Host who /* Serial number of Host who
booted the other end */ booted the other end */
WORD descheduled ; /* Currently Descheduled */ WORD descheduled; /* Currently Descheduled */
WORD state; /* Current state */ WORD state; /* Current state */
WORD send_poll ; /* Send a Poll Packet */ WORD send_poll; /* Send a Poll Packet */
Process_ptr ltt_p ; /* Process Descriptor */ Process_ptr ltt_p; /* Process Descriptor */
Process_ptr lrt_p ; /* Process Descriptor */ Process_ptr lrt_p; /* Process Descriptor */
WORD lrt_status ; /* Current lrt status */ WORD lrt_status; /* Current lrt status */
WORD ltt_status ; /* Current ltt status */ WORD ltt_status; /* Current ltt status */
WORD timeout ; /* Timeout value */ WORD timeout; /* Timeout value */
WORD topology; /* Topology bits */ WORD topology; /* Topology bits */
WORD mon_ltt ; WORD mon_ltt;
WORD mon_lrt ; WORD mon_lrt;
WORD WaitNoBoot ; /* Secs to hold off booting */ WORD WaitNoBoot; /* Secs to hold off booting */
PKT_ptr add_packet_list; /* Add packets to here */ PKT_ptr add_packet_list; /* Add packets to here */
PKT_ptr remove_packet_list; /* Send packets from here */ PKT_ptr remove_packet_list; /* Send packets from here */
#ifdef RTA #ifdef RTA
...@@ -150,38 +150,38 @@ struct LPB { ...@@ -150,38 +150,38 @@ struct LPB {
#else #else
#define QBUFS_PER_REDIRECT (8 / PKTS_PER_BUFFER + 1) #define QBUFS_PER_REDIRECT (8 / PKTS_PER_BUFFER + 1)
#endif #endif
PKT_ptr_ptr rd_add ; /* Add a new Packet here */ PKT_ptr_ptr rd_add; /* Add a new Packet here */
Q_BUF_ptr rd_add_qb; /* Pointer to the add Q buf */ Q_BUF_ptr rd_add_qb; /* Pointer to the add Q buf */
PKT_ptr_ptr rd_add_st_qbb ; /* Pointer to start of the Q's buf */ PKT_ptr_ptr rd_add_st_qbb; /* Pointer to start of the Q's buf */
PKT_ptr_ptr rd_add_end_qbb ; /* Pointer to the end of the Q's buf */ PKT_ptr_ptr rd_add_end_qbb; /* Pointer to the end of the Q's buf */
PKT_ptr_ptr rd_remove ; /* Remove a Packet here */ PKT_ptr_ptr rd_remove; /* Remove a Packet here */
Q_BUF_ptr rd_remove_qb ; /* Pointer to the remove Q buf */ Q_BUF_ptr rd_remove_qb; /* Pointer to the remove Q buf */
PKT_ptr_ptr rd_remove_st_qbb ; /* Pointer to the start of the Q buf */ PKT_ptr_ptr rd_remove_st_qbb; /* Pointer to the start of the Q buf */
PKT_ptr_ptr rd_remove_end_qbb ; /* Pointer to the end of the Q buf */ PKT_ptr_ptr rd_remove_end_qbb; /* Pointer to the end of the Q buf */
ushort pkts_in_q ; /* Packets in queue */ ushort pkts_in_q; /* Packets in queue */
#endif #endif
Channel_ptr lrt_fail_chan ; /* Lrt's failure channel */ Channel_ptr lrt_fail_chan; /* Lrt's failure channel */
Channel_ptr ltt_fail_chan ; /* Ltt's failure channel */ Channel_ptr ltt_fail_chan; /* Ltt's failure channel */
#if defined (HOST) || defined (INKERNEL) #if defined (HOST) || defined (INKERNEL)
/* RUP structure for HOST to driver communications */ /* RUP structure for HOST to driver communications */
struct RUP rup ; struct RUP rup;
#endif #endif
struct RUP link_rup; /* RUP for the link (POLL, struct RUP link_rup; /* RUP for the link (POLL,
topology etc.) */ topology etc.) */
WORD attached_link ; /* Number of attached link */ WORD attached_link; /* Number of attached link */
WORD csum_errors ; /* csum errors */ WORD csum_errors; /* csum errors */
WORD num_disconnects ; /* number of disconnects */ WORD num_disconnects; /* number of disconnects */
WORD num_sync_rcvd ; /* # sync's received */ WORD num_sync_rcvd; /* # sync's received */
WORD num_sync_rqst ; /* # sync requests */ WORD num_sync_rqst; /* # sync requests */
WORD num_tx ; /* Num pkts sent */ WORD num_tx; /* Num pkts sent */
WORD num_rx ; /* Num pkts received */ WORD num_rx; /* Num pkts received */
WORD module_attached; /* Module tpyes of attached */ WORD module_attached; /* Module tpyes of attached */
WORD led_timeout; /* LED timeout */ WORD led_timeout; /* LED timeout */
WORD first_port; /* First port to service */ WORD first_port; /* First port to service */
WORD last_port; /* Last port to service */ WORD last_port; /* Last port to service */
} ; };
#endif #endif
......
...@@ -118,5 +118,3 @@ the definitions from Linux, and is incompatible... */ ...@@ -118,5 +118,3 @@ the definitions from Linux, and is incompatible... */
#define RIO_B64000 0x12 /* 64000 baud */ #define RIO_B64000 0x12 /* 64000 baud */
#define RIO_B115200 0x13 /* 115200 baud */ #define RIO_B115200 0x13 /* 115200 baud */
#define RIO_B2000 0x14 /* 2000 baud */ #define RIO_B2000 0x14 /* 2000 baud */
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#ifdef SCCS_LABELS #ifdef SCCS_LABELS
#ifndef lint #ifndef lint
static char *_rio_list_h_sccs = "@(#)list.h 1.9" ; static char *_rio_list_h_sccs = "@(#)list.h 1.9";
#endif #endif
#endif #endif
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS_LABELS #ifdef SCCS_LABELS
static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1" ; static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1";
#endif #endif
#endif #endif
...@@ -50,6 +50,3 @@ static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1" ; ...@@ -50,6 +50,3 @@ static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1" ;
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS_LABELS #ifdef SCCS_LABELS
static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1" ; static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1";
#endif #endif
#endif #endif
...@@ -50,6 +50,3 @@ static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1" ; ...@@ -50,6 +50,3 @@ static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1" ;
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS_LABELS #ifdef SCCS_LABELS
static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1" ; static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1";
#endif #endif
#endif #endif
...@@ -48,6 +48,3 @@ static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1" ; ...@@ -48,6 +48,3 @@ static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1" ;
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -46,8 +46,7 @@ static char *_map_h_sccs_ = "@(#)map.h 1.2"; ...@@ -46,8 +46,7 @@ static char *_map_h_sccs_ = "@(#)map.h 1.2";
#define TOTAL_MAP_ENTRIES (MAX_MAP_ENTRY*RIO_SLOTS) #define TOTAL_MAP_ENTRIES (MAX_MAP_ENTRY*RIO_SLOTS)
#define MAX_NAME_LEN 32 #define MAX_NAME_LEN 32
struct Map struct Map {
{
uint HostUniqueNum; /* Supporting hosts unique number */ uint HostUniqueNum; /* Supporting hosts unique number */
uint RtaUniqueNum; /* Unique number */ uint RtaUniqueNum; /* Unique number */
/* /*
......
...@@ -42,8 +42,7 @@ static char *_param_h_sccs_ = "@(#)param.h 1.2"; ...@@ -42,8 +42,7 @@ static char *_param_h_sccs_ = "@(#)param.h 1.2";
** the param command block, as used in OPEN and PARAM calls. ** the param command block, as used in OPEN and PARAM calls.
*/ */
struct phb_param struct phb_param {
{
BYTE Cmd; /* It is very important that these line up */ BYTE Cmd; /* It is very important that these line up */
BYTE Cor1; /* with what is expected at the other end. */ BYTE Cor1; /* with what is expected at the other end. */
BYTE Cor2; /* to confirm that you've got it right, */ BYTE Cor2; /* to confirm that you've got it right, */
......
...@@ -44,53 +44,50 @@ ...@@ -44,53 +44,50 @@
#endif #endif
#endif #endif
typedef struct PARM_MAP PARM_MAP ; typedef struct PARM_MAP PARM_MAP;
struct PARM_MAP struct PARM_MAP {
{ PHB_ptr phb_ptr; /* Pointer to the PHB array */
PHB_ptr phb_ptr ; /* Pointer to the PHB array */ WORD_ptr phb_num_ptr; /* Ptr to Number of PHB's */
WORD_ptr phb_num_ptr ; /* Ptr to Number of PHB's */ FREE_LIST_ptr free_list; /* Free List pointer */
FREE_LIST_ptr free_list; /* Free List pointer */ FREE_LIST_ptr free_list_end; /* Free List End pointer */
FREE_LIST_ptr free_list_end; /* Free List End pointer */ Q_BUF_ptr_ptr q_free_list_ptr; /* Ptr to Q_BUF variable */
Q_BUF_ptr_ptr q_free_list_ptr ; /* Ptr to Q_BUF variable */ BYTE_ptr unit_id_ptr; /* Unit Id */
BYTE_ptr unit_id_ptr ; /* Unit Id */ LPB_ptr link_str_ptr; /* Link Structure Array */
LPB_ptr link_str_ptr ; /* Link Structure Array */ BYTE_ptr bootloader_1; /* 1st Stage Boot Loader */
BYTE_ptr bootloader_1 ; /* 1st Stage Boot Loader */ BYTE_ptr bootloader_2; /* 2nd Stage Boot Loader */
BYTE_ptr bootloader_2 ; /* 2nd Stage Boot Loader */ WORD_ptr port_route_map_ptr; /* Port Route Map */
WORD_ptr port_route_map_ptr ; /* Port Route Map */ ROUTE_STR_ptr route_ptr; /* Unit Route Map */
ROUTE_STR_ptr route_ptr ; /* Unit Route Map */ NUMBER_ptr map_present; /* Route Map present */
NUMBER_ptr map_present ; /* Route Map present */ NUMBER pkt_num; /* Total number of packets */
NUMBER pkt_num ; /* Total number of packets */ NUMBER q_num; /* Total number of Q packets */
NUMBER q_num ; /* Total number of Q packets */ WORD buffers_per_port; /* Number of buffers per port */
WORD buffers_per_port ; /* Number of buffers per port */ WORD heap_size; /* Initial size of heap */
WORD heap_size ; /* Initial size of heap */ WORD heap_left; /* Current Heap left */
WORD heap_left ; /* Current Heap left */ WORD error; /* Error code */
WORD error ; /* Error code */ WORD tx_max; /* Max number of tx pkts per phb */
WORD tx_max; /* Max number of tx pkts per phb */ WORD rx_max; /* Max number of rx pkts per phb */
WORD rx_max; /* Max number of rx pkts per phb */ WORD rx_limit; /* For high / low watermarks */
WORD rx_limit; /* For high / low watermarks */ NUMBER links; /* Links to use */
NUMBER links ; /* Links to use */ NUMBER timer; /* Interrupts per second */
NUMBER timer ; /* Interrupts per second */ RUP_ptr rups; /* Pointer to the RUPs */
RUP_ptr rups ; /* Pointer to the RUPs */ WORD max_phb; /* Mostly for debugging */
WORD max_phb ; /* Mostly for debugging */ WORD living; /* Just increments!! */
WORD living ; /* Just increments!! */ WORD init_done; /* Initialisation over */
WORD init_done ; /* Initialisation over */ WORD booting_link;
WORD booting_link ; WORD idle_count; /* Idle time counter */
WORD idle_count ; /* Idle time counter */ WORD busy_count; /* Busy counter */
WORD busy_count ; /* Busy counter */ WORD idle_control; /* Control Idle Process */
WORD idle_control ; /* Control Idle Process */
#if defined(HOST) || defined(INKERNEL) #if defined(HOST) || defined(INKERNEL)
WORD tx_intr; /* TX interrupt pending */ WORD tx_intr; /* TX interrupt pending */
WORD rx_intr; /* RX interrupt pending */ WORD rx_intr; /* RX interrupt pending */
WORD rup_intr; /* RUP interrupt pending */ WORD rup_intr; /* RUP interrupt pending */
#endif #endif
#if defined(RTA) #if defined(RTA)
WORD dying_count; /* Count of processes dead */ WORD dying_count; /* Count of processes dead */
#endif #endif
} ; };
#endif #endif
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
#define rx_end u4.s1.rx_end_ptr_ptr #define rx_end u4.s1.rx_end_ptr_ptr
#define rx_remove u4.s1.rx_remove_ptr_ptr #define rx_remove u4.s1.rx_remove_ptr_ptr
#endif #endif
typedef struct PHB PHB ; typedef struct PHB PHB;
struct PHB { struct PHB {
#ifdef RTA #ifdef RTA
ushort port; ushort port;
...@@ -163,28 +163,24 @@ struct PHB { ...@@ -163,28 +163,24 @@ struct PHB {
#ifdef INKERNEL #ifdef INKERNEL
WORD source; WORD source;
#else #else
union union {
{
ushort source; /* Complete source */ ushort source; /* Complete source */
struct struct {
{
unsigned char unit; /* Source unit */ unsigned char unit; /* Source unit */
unsigned char port; /* Source port */ unsigned char port; /* Source port */
} s2; } s2;
} u2; } u2;
#endif #endif
WORD handshake ; WORD handshake;
WORD status ; WORD status;
NUMBER timeout ; /* Maximum of 1.9 seconds */ NUMBER timeout; /* Maximum of 1.9 seconds */
WORD link ; /* Send down this link */ WORD link; /* Send down this link */
#ifdef INKERNEL #ifdef INKERNEL
WORD destination; WORD destination;
#else #else
union union {
{
ushort destination; /* Complete destination */ ushort destination; /* Complete destination */
struct struct {
{
unsigned char unit; /* Destination unit */ unsigned char unit; /* Destination unit */
unsigned char port; /* Destination port */ unsigned char port; /* Destination port */
} s1; } s1;
...@@ -193,39 +189,36 @@ struct PHB { ...@@ -193,39 +189,36 @@ struct PHB {
#ifdef RTA #ifdef RTA
ushort tx_pkts_added; ushort tx_pkts_added;
ushort tx_pkts_removed; ushort tx_pkts_removed;
Q_BUF_ptr tx_q_start ; /* Start of the Q list chain */ Q_BUF_ptr tx_q_start; /* Start of the Q list chain */
short num_tx_q_bufs ; /* Number of Q buffers in the chain */ short num_tx_q_bufs; /* Number of Q buffers in the chain */
PKT_ptr_ptr tx_add ; /* Add a new Packet here */ PKT_ptr_ptr tx_add; /* Add a new Packet here */
Q_BUF_ptr tx_add_qb; /* Pointer to the add Q buf */ Q_BUF_ptr tx_add_qb; /* Pointer to the add Q buf */
PKT_ptr_ptr tx_add_st_qbb ; /* Pointer to start of the Q's buf */ PKT_ptr_ptr tx_add_st_qbb; /* Pointer to start of the Q's buf */
PKT_ptr_ptr tx_add_end_qbb ; /* Pointer to the end of the Q's buf */ PKT_ptr_ptr tx_add_end_qbb; /* Pointer to the end of the Q's buf */
PKT_ptr_ptr tx_remove ; /* Remove a Packet here */ PKT_ptr_ptr tx_remove; /* Remove a Packet here */
Q_BUF_ptr tx_remove_qb ; /* Pointer to the remove Q buf */ Q_BUF_ptr tx_remove_qb; /* Pointer to the remove Q buf */
PKT_ptr_ptr tx_remove_st_qbb ; /* Pointer to the start of the Q buf */ PKT_ptr_ptr tx_remove_st_qbb; /* Pointer to the start of the Q buf */
PKT_ptr_ptr tx_remove_end_qbb ; /* Pointer to the end of the Q buf */ PKT_ptr_ptr tx_remove_end_qbb; /* Pointer to the end of the Q buf */
#endif #endif
#ifdef INKERNEL #ifdef INKERNEL
PKT_ptr_ptr tx_start ; PKT_ptr_ptr tx_start;
PKT_ptr_ptr tx_end ; PKT_ptr_ptr tx_end;
PKT_ptr_ptr tx_add ; PKT_ptr_ptr tx_add;
PKT_ptr_ptr tx_remove ; PKT_ptr_ptr tx_remove;
#endif #endif
#ifdef HOST #ifdef HOST
union union {
{ struct {
struct
{
PKT_ptr_ptr tx_start_ptr_ptr; PKT_ptr_ptr tx_start_ptr_ptr;
PKT_ptr_ptr tx_end_ptr_ptr; PKT_ptr_ptr tx_end_ptr_ptr;
PKT_ptr_ptr tx_add_ptr_ptr; PKT_ptr_ptr tx_add_ptr_ptr;
PKT_ptr_ptr tx_remove_ptr_ptr; PKT_ptr_ptr tx_remove_ptr_ptr;
} s1; } s1;
struct struct {
{ ushort *tx_start_ptr;
ushort * tx_start_ptr; ushort *tx_end_ptr;
ushort * tx_end_ptr; ushort *tx_add_ptr;
ushort * tx_add_ptr; ushort *tx_remove_ptr;
ushort * tx_remove_ptr;
} s2; } s2;
} u3; } u3;
#endif #endif
...@@ -233,39 +226,36 @@ struct PHB { ...@@ -233,39 +226,36 @@ struct PHB {
#ifdef RTA #ifdef RTA
ushort rx_pkts_added; ushort rx_pkts_added;
ushort rx_pkts_removed; ushort rx_pkts_removed;
Q_BUF_ptr rx_q_start ; /* Start of the Q list chain */ Q_BUF_ptr rx_q_start; /* Start of the Q list chain */
short num_rx_q_bufs ; /* Number of Q buffers in the chain */ short num_rx_q_bufs; /* Number of Q buffers in the chain */
PKT_ptr_ptr rx_add ; /* Add a new Packet here */ PKT_ptr_ptr rx_add; /* Add a new Packet here */
Q_BUF_ptr rx_add_qb ; /* Pointer to the add Q buf */ Q_BUF_ptr rx_add_qb; /* Pointer to the add Q buf */
PKT_ptr_ptr rx_add_st_qbb ; /* Pointer to start of the Q's buf */ PKT_ptr_ptr rx_add_st_qbb; /* Pointer to start of the Q's buf */
PKT_ptr_ptr rx_add_end_qbb ; /* Pointer to the end of the Q's buf */ PKT_ptr_ptr rx_add_end_qbb; /* Pointer to the end of the Q's buf */
PKT_ptr_ptr rx_remove ; /* Remove a Packet here */ PKT_ptr_ptr rx_remove; /* Remove a Packet here */
Q_BUF_ptr rx_remove_qb ; /* Pointer to the remove Q buf */ Q_BUF_ptr rx_remove_qb; /* Pointer to the remove Q buf */
PKT_ptr_ptr rx_remove_st_qbb ; /* Pointer to the start of the Q buf */ PKT_ptr_ptr rx_remove_st_qbb; /* Pointer to the start of the Q buf */
PKT_ptr_ptr rx_remove_end_qbb ; /* Pointer to the end of the Q buf */ PKT_ptr_ptr rx_remove_end_qbb; /* Pointer to the end of the Q buf */
#endif #endif
#ifdef INKERNEL #ifdef INKERNEL
PKT_ptr_ptr rx_start ; PKT_ptr_ptr rx_start;
PKT_ptr_ptr rx_end ; PKT_ptr_ptr rx_end;
PKT_ptr_ptr rx_add ; PKT_ptr_ptr rx_add;
PKT_ptr_ptr rx_remove ; PKT_ptr_ptr rx_remove;
#endif #endif
#ifdef HOST #ifdef HOST
union union {
{ struct {
struct
{
PKT_ptr_ptr rx_start_ptr_ptr; PKT_ptr_ptr rx_start_ptr_ptr;
PKT_ptr_ptr rx_end_ptr_ptr; PKT_ptr_ptr rx_end_ptr_ptr;
PKT_ptr_ptr rx_add_ptr_ptr; PKT_ptr_ptr rx_add_ptr_ptr;
PKT_ptr_ptr rx_remove_ptr_ptr; PKT_ptr_ptr rx_remove_ptr_ptr;
} s1; } s1;
struct struct {
{ ushort *rx_start_ptr;
ushort * rx_start_ptr; ushort *rx_end_ptr;
ushort * rx_end_ptr; ushort *rx_add_ptr;
ushort * rx_add_ptr; ushort *rx_remove_ptr;
ushort * rx_remove_ptr;
} s2; } s2;
} u4; } u4;
#endif #endif
...@@ -285,9 +275,8 @@ struct PHB { ...@@ -285,9 +275,8 @@ struct PHB {
ushort MonitorTstate; /* TRUE if monitoring tstop */ ushort MonitorTstate; /* TRUE if monitoring tstop */
#endif #endif
} ; };
#endif #endif
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -71,50 +71,42 @@ ...@@ -71,50 +71,42 @@
struct PKT { struct PKT {
#ifdef INKERNEL #ifdef INKERNEL
BYTE dest_unit ; /* Destination Unit Id */ BYTE dest_unit; /* Destination Unit Id */
BYTE dest_port ; /* Destination POrt */ BYTE dest_port; /* Destination POrt */
BYTE src_unit ; /* Source Unit Id */ BYTE src_unit; /* Source Unit Id */
BYTE src_port ; /* Source POrt */ BYTE src_port; /* Source POrt */
#else #else
union union {
{
ushort destination; /* Complete destination */ ushort destination; /* Complete destination */
struct struct {
{
unsigned char unit; /* Destination unit */ unsigned char unit; /* Destination unit */
unsigned char port; /* Destination port */ unsigned char port; /* Destination port */
} s1; } s1;
} u1; } u1;
union union {
{
ushort source; /* Complete source */ ushort source; /* Complete source */
struct struct {
{
unsigned char unit; /* Source unit */ unsigned char unit; /* Source unit */
unsigned char port; /* Source port */ unsigned char port; /* Source port */
} s2; } s2;
} u2; } u2;
#endif #endif
#ifdef INKERNEL #ifdef INKERNEL
BYTE len ; BYTE len;
BYTE control; BYTE control;
#else #else
union union {
{
ushort control; ushort control;
struct struct {
{
unsigned char len; unsigned char len;
unsigned char control; unsigned char control;
} s3; } s3;
} u3; } u3;
#endif #endif
BYTE data[PKT_MAX_DATA_LEN] ; BYTE data[PKT_MAX_DATA_LEN];
/* Actual data :-) */ /* Actual data :-) */
WORD csum ; /* C-SUM */ WORD csum; /* C-SUM */
} ; };
#endif #endif
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS_LABELS #ifdef SCCS_LABELS
static char *_rio_poll_h_sccs = "@(#)poll.h 1.2" ; static char *_rio_poll_h_sccs = "@(#)poll.h 1.2";
#endif #endif
#endif #endif
...@@ -71,6 +71,3 @@ static char *_rio_poll_h_sccs = "@(#)poll.h 1.2" ; ...@@ -71,6 +71,3 @@ static char *_rio_poll_h_sccs = "@(#)poll.h 1.2" ;
#endif #endif
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -46,8 +46,7 @@ static char *_port_h_sccs_ = "@(#)port.h 1.3"; ...@@ -46,8 +46,7 @@ static char *_port_h_sccs_ = "@(#)port.h 1.3";
*/ */
#ifdef STATS #ifdef STATS
struct RIOStats struct RIOStats {
{
/* /*
** interrupt statistics ** interrupt statistics
*/ */
...@@ -91,8 +90,7 @@ struct RIOStats ...@@ -91,8 +90,7 @@ struct RIOStats
/* /*
** Port data structure ** Port data structure
*/ */
struct Port struct Port {
{
struct gs_port gs; struct gs_port gs;
int PortNum; /* RIO port no., 0-511 */ int PortNum; /* RIO port no., 0-511 */
struct Host *HostP; struct Host *HostP;
...@@ -177,8 +175,7 @@ struct Port ...@@ -177,8 +175,7 @@ struct Port
/* /*
** Transparent print stuff ** Transparent print stuff
*/ */
struct Xprint struct Xprint {
{
#ifndef MAX_XP_CTRL_LEN #ifndef MAX_XP_CTRL_LEN
#define MAX_XP_CTRL_LEN 16 /* ALSO IN DAEMON.H */ #define MAX_XP_CTRL_LEN 16 /* ALSO IN DAEMON.H */
#endif #endif
...@@ -221,13 +218,12 @@ struct Port ...@@ -221,13 +218,12 @@ struct Port
spinlock_t portSem; /* Lock using this sem */ spinlock_t portSem; /* Lock using this sem */
int MonitorTstate; /* Monitoring ? */ int MonitorTstate; /* Monitoring ? */
int timeout_id; /* For calling 100 ms delays */ int timeout_id; /* For calling 100 ms delays */
int timeout_sem;/* For calling 100 ms delays */ int timeout_sem; /* For calling 100 ms delays */
int firstOpen; /* First time open ? */ int firstOpen; /* First time open ? */
char * p; /* save the global struc here .. */ char *p; /* save the global struc here .. */
}; };
struct ModuleInfo struct ModuleInfo {
{
char *Name; char *Name;
uint Flags[4]; /* one per port on a module */ uint Flags[4]; /* one per port on a module */
}; };
......
...@@ -23,15 +23,15 @@ ...@@ -23,15 +23,15 @@
/* /*
** boot.c ** boot.c
*/ */
void init_boot( char *p, short stage); void init_boot(char *p, short stage);
/* /*
** disconct.c ** disconct.c
*/ */
void kill_boot ( LPB *link ); void kill_boot(LPB * link);
void disconnected( LPB *link ); void disconnected(LPB * link);
short boot_3( LPB *link, PKT *pkt ); short boot_3(LPB * link, PKT * pkt);
short send_3_pkt( LPB *link, PKT *pkt); short send_3_pkt(LPB * link, PKT * pkt);
/* /*
** error.c ** error.c
...@@ -41,116 +41,116 @@ void du_error(void); ...@@ -41,116 +41,116 @@ void du_error(void);
/* /*
** formpkt.c ** formpkt.c
*/ */
ushort sum_it( PKT *pkt ) ; ushort sum_it(PKT * pkt);
void form_rup_pkt( RUP *form_rup, PKT *pkt ); void form_rup_pkt(RUP * form_rup, PKT * pkt);
void form_poll_pkt ( int type, LPB *link, int node ); void form_poll_pkt(int type, LPB * link, int node);
void form_route_pkt ( int type, PKT *pkt, LPB *link ); void form_route_pkt(int type, PKT * pkt, LPB * link);
/* /*
** idle.c ** idle.c
*/ */
void idle( Process *idle_p ); void idle(Process * idle_p);
/* /*
** init.c ** init.c
*/ */
void general_init(void); void general_init(void);
void mem_halt( int error); void mem_halt(int error);
/* /*
** linkinit.c ** linkinit.c
*/ */
void initlink( u_short number, LPB *link); void initlink(u_short number, LPB * link);
void runlink( LPB *link); void runlink(LPB * link);
/* /*
** list.c ** list.c
*/ */
PKT *get_free_start(void); PKT *get_free_start(void);
void put_free_start( PKT *pkt); void put_free_start(PKT * pkt);
#ifdef HOST #ifdef HOST
int can_remove_transmit ( PKT **pkt, PKT *pointer ); int can_remove_transmit(PKT ** pkt, PKT * pointer);
#endif #endif
#ifdef RTA #ifdef RTA
int spl7 ( void ); int spl7(void);
int spl0 ( void ); int spl0(void);
Q_BUF *get_free_q( void ); Q_BUF *get_free_q(void);
PKT *get_free_end(void); PKT *get_free_end(void);
int add_end( PKT *pkt, PHB *phb, int type); int add_end(PKT * pkt, PHB * phb, int type);
unsigned short free_packets( PHB *phb, int type); unsigned short free_packets(PHB * phb, int type);
int can_remove_start( PKT **pkt, PHB *phb, int type); int can_remove_start(PKT ** pkt, PHB * phb, int type);
int can_add_start( PHB *phb, int type); int can_add_start(PHB * phb, int type);
int can_add_end( PHB *phb, int type); int can_add_end(PHB * phb, int type);
void put_free_end( PKT *pkt); void put_free_end(PKT * pkt);
int remove_start( PKT **pkt, PHB *phb, int type); int remove_start(PKT ** pkt, PHB * phb, int type);
#endif #endif
/* /*
** Lrt.c ** Lrt.c
*/ */
void lrt( Process *lrt_p, LPB *link ); void lrt(Process * lrt_p, LPB * link);
#ifdef RTA #ifdef RTA
void set_led_red ( LPB *link ); void set_led_red(LPB * link);
#endif #endif
/* /*
** ltt.c ** ltt.c
*/ */
void ltt( Process *ltt_p, LPB *link, PHB *phb_ptr[] ); void ltt(Process * ltt_p, LPB * link, PHB * phb_ptr[]);
void send_poll ( LPB *link ); void send_poll(LPB * link);
void request_id ( LPB *link ); void request_id(LPB * link);
void send_topology_update ( LPB *link ); void send_topology_update(LPB * link);
void send_topology ( LPB *link ); void send_topology(LPB * link);
void supply_id ( LPB *link ); void supply_id(LPB * link);
#ifdef RTA #ifdef RTA
void redirect_queue ( LPB *link, ushort flush ); void redirect_queue(LPB * link, ushort flush);
int obtain_rup ( int rup_number, PKT **pkt_address, LPB *link ); int obtain_rup(int rup_number, PKT ** pkt_address, LPB * link);
#endif #endif
#ifdef TESTING_PERF #ifdef TESTING_PERF
int consume_cpu( void ); int consume_cpu(void);
#endif #endif
/* /*
** lttwake.c ** lttwake.c
*/ */
#ifdef HOST #ifdef HOST
void ltt_wakeup( Process *ltt_wakeup_p ); void ltt_wakeup(Process * ltt_wakeup_p);
#endif #endif
/* /*
** mapgen.c ** mapgen.c
*/ */
void generate_id_map( short mapping, ROUTE_STR route[] ); void generate_id_map(short mapping, ROUTE_STR route[]);
void gen_map( int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl ); void gen_map(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl);
void adjust_ttl( int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl); void adjust_ttl(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl);
void init_sys_map(void); void init_sys_map(void);
/* /*
** mmu.c ** mmu.c
*/ */
char *rio_malloc( unsigned int amount); char *rio_malloc(unsigned int amount);
char *rio_calloc( unsigned int num, unsigned int size); char *rio_calloc(unsigned int num, unsigned int size);
ERROR rio_mmu_init( uint total_mem ); ERROR rio_mmu_init(uint total_mem);
/* /*
** partn.c ** partn.c
*/ */
void partition_tx( struct PHB *phb, u_short tx_size, u_short rx_size, u_short rx_limit); void partition_tx(struct PHB *phb, u_short tx_size, u_short rx_size, u_short rx_limit);
/* /*
** poll.c ** poll.c
*/ */
void tx_poll( Process *tx_poll_p); void tx_poll(Process * tx_poll_p);
/* /*
** process.c ** process.c
*/ */
int get_proc_space( Process **pd, int **pws, int wssize); int get_proc_space(Process ** pd, int **pws, int wssize);
/* /*
** readrom.c ** readrom.c
...@@ -160,12 +160,12 @@ void read_serial_number(char *buf); ...@@ -160,12 +160,12 @@ void read_serial_number(char *buf);
/* /*
** rio.c ** rio.c
*/ */
int main( void ); int main(void);
/* /*
** route.c ** route.c
*/ */
void route_update ( PKT *pkt, LPB *link); void route_update(PKT * pkt, LPB * link);
/* /*
** rtainit.c ** rtainit.c
...@@ -177,68 +177,68 @@ void rta_init(ushort RtaType); ...@@ -177,68 +177,68 @@ void rta_init(ushort RtaType);
/* /*
** rupboot.c ** rupboot.c
*/ */
void rup_boot( PKT *pkt, RUP *this_rup, LPB *link); void rup_boot(PKT * pkt, RUP * this_rup, LPB * link);
#ifdef RTA #ifdef RTA
void kill_your_neighbour( int link_to_kill ); void kill_your_neighbour(int link_to_kill);
#endif #endif
/* /*
** rupcmd.c ** rupcmd.c
*/ */
void rup_command( PKT *pkt, struct RUP *this_rup, LPB *link); void rup_command(PKT * pkt, struct RUP *this_rup, LPB * link);
/* /*
** ruperr.c ** ruperr.c
*/ */
void rup_error( PKT *pkt, RUP *this_rup, LPB *link ); void rup_error(PKT * pkt, RUP * this_rup, LPB * link);
void illegal_cmd( PKT *src_pkt ); void illegal_cmd(PKT * src_pkt);
/* /*
** ruppoll.c ** ruppoll.c
*/ */
void rup_poll( PKT *pkt, RUP *this_rup, LPB *link ); void rup_poll(PKT * pkt, RUP * this_rup, LPB * link);
/* /*
** ruppower.c ** ruppower.c
*/ */
void rup_power( PKT *pkt, RUP *this_rup, LPB *link ); void rup_power(PKT * pkt, RUP * this_rup, LPB * link);
/* /*
** ruprm.c ** ruprm.c
*/ */
void rup_route_map( PKT *pkt, RUP *this_rup, LPB *link); void rup_route_map(PKT * pkt, RUP * this_rup, LPB * link);
/* /*
** rupstat.c ** rupstat.c
*/ */
void rup_status( PKT *pkt, RUP *this_rup, LPB *link); void rup_status(PKT * pkt, RUP * this_rup, LPB * link);
/* /*
** rupsync.c ** rupsync.c
*/ */
void rup_sync( PKT *pkt); void rup_sync(PKT * pkt);
/* /*
** rxpkt.c ** rxpkt.c
*/ */
ERROR rx_pkt( PKT_ptr_ptr pkt_address, LPB *link); ERROR rx_pkt(PKT_ptr_ptr pkt_address, LPB * link);
/* /*
** sendsts.c ** sendsts.c
*/ */
void send_status( PKT *requesting_pkt, RUP *this_rup); void send_status(PKT * requesting_pkt, RUP * this_rup);
/* /*
** serial.c ** serial.c
*/ */
void assign_serial ( char *ser_in, char *ser_out); void assign_serial(char *ser_in, char *ser_out);
int cmp_serial ( char *ser_1, char *ser_2); int cmp_serial(char *ser_1, char *ser_2);
/* /*
** txpkt.c ** txpkt.c
*/ */
ERROR tx_pkt( PKT *pkt, LPB *link); ERROR tx_pkt(PKT * pkt, LPB * link);
short send_sync( LPB *link); short send_sync(LPB * link);
#endif /* _prototypes_h */ #endif /* _prototypes_h */
...@@ -115,5 +115,3 @@ ...@@ -115,5 +115,3 @@
#endif #endif
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS_LABELS #ifdef SCCS_LABELS
static char *_rio_qbuf_h_sccs = "@(#)qbuf.h 1.1" ; static char *_rio_qbuf_h_sccs = "@(#)qbuf.h 1.1";
#endif #endif
#endif #endif
...@@ -52,16 +52,15 @@ static char *_rio_qbuf_h_sccs = "@(#)qbuf.h 1.1" ; ...@@ -52,16 +52,15 @@ static char *_rio_qbuf_h_sccs = "@(#)qbuf.h 1.1" ;
#define PKTS_PER_BUFFER (220 / PKT_LENGTH) #define PKTS_PER_BUFFER (220 / PKT_LENGTH)
#endif #endif
typedef struct Q_BUF Q_BUF ; typedef struct Q_BUF Q_BUF;
struct Q_BUF { struct Q_BUF {
Q_BUF_ptr next ; Q_BUF_ptr next;
Q_BUF_ptr prev ; Q_BUF_ptr prev;
PKT_ptr buf[PKTS_PER_BUFFER] ; PKT_ptr buf[PKTS_PER_BUFFER];
} ; };
#endif #endif
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -216,8 +216,7 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; ...@@ -216,8 +216,7 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3";
#define RIO_PRI (PZERO+10) #define RIO_PRI (PZERO+10)
#define RIO_CLOSE_PRI PZERO-1 /* uninterruptible sleeps for close */ #define RIO_CLOSE_PRI PZERO-1 /* uninterruptible sleeps for close */
typedef struct DbInf typedef struct DbInf {
{
uint Flag; uint Flag;
char Name[8]; char Name[8];
} DbInf; } DbInf;
......
...@@ -145,29 +145,46 @@ more than 512 ports.... */ ...@@ -145,29 +145,46 @@ more than 512 ports.... */
/* These constants are derived from SCO Source */ /* These constants are derived from SCO Source */
static struct Conf static struct Conf
RIOConf = RIOConf = {
{
/* locator */ "RIO Config here", /* locator */ "RIO Config here",
/* startuptime */ HZ*2, /* how long to wait for card to run */ /* startuptime */ HZ * 2,
/* slowcook */ 0, /* TRUE -> always use line disc. */ /* how long to wait for card to run */
/* intrpolltime */ 1, /* The frequency of OUR polls */ /* slowcook */ 0,
/* breakinterval */ 25, /* x10 mS XXX: units seem to be 1ms not 10! -- REW*/ /* TRUE -> always use line disc. */
/* timer */ 10, /* mS */ /* intrpolltime */ 1,
/* The frequency of OUR polls */
/* breakinterval */ 25,
/* x10 mS XXX: units seem to be 1ms not 10! -- REW */
/* timer */ 10,
/* mS */
/* RtaLoadBase */ 0x7000, /* RtaLoadBase */ 0x7000,
/* HostLoadBase */ 0x7C00, /* HostLoadBase */ 0x7C00,
/* XpHz */ 5, /* number of Xprint hits per second */ /* XpHz */ 5,
/* XpCps */ 120, /* Xprint characters per second */ /* number of Xprint hits per second */
/* XpOn */ "\033d#", /* start Xprint for a wyse 60 */ /* XpCps */ 120,
/* XpOff */ "\024", /* end Xprint for a wyse 60 */ /* Xprint characters per second */
/* MaxXpCps */ 2000, /* highest Xprint speed */ /* XpOn */ "\033d#",
/* MinXpCps */ 10, /* slowest Xprint speed */ /* start Xprint for a wyse 60 */
/* SpinCmds */ 1, /* non-zero for mega fast boots */ /* XpOff */ "\024",
/* First Addr */ 0x0A0000, /* First address to look at */ /* end Xprint for a wyse 60 */
/* Last Addr */ 0xFF0000, /* Last address looked at */ /* MaxXpCps */ 2000,
/* BufferSize */ 1024, /* Bytes per port of buffering */ /* highest Xprint speed */
/* LowWater */ 256, /* how much data left before wakeup */ /* MinXpCps */ 10,
/* LineLength */ 80, /* how wide is the console? */ /* slowest Xprint speed */
/* CmdTimeout */ HZ, /* how long a close command may take */ /* SpinCmds */ 1,
/* non-zero for mega fast boots */
/* First Addr */ 0x0A0000,
/* First address to look at */
/* Last Addr */ 0xFF0000,
/* Last address looked at */
/* BufferSize */ 1024,
/* Bytes per port of buffering */
/* LowWater */ 256,
/* how much data left before wakeup */
/* LineLength */ 80,
/* how wide is the console? */
/* CmdTimeout */ HZ,
/* how long a close command may take */
}; };
...@@ -175,21 +192,20 @@ RIOConf = ...@@ -175,21 +192,20 @@ RIOConf =
/* Function prototypes */ /* Function prototypes */
static void rio_disable_tx_interrupts (void * ptr); static void rio_disable_tx_interrupts(void *ptr);
static void rio_enable_tx_interrupts (void * ptr); static void rio_enable_tx_interrupts(void *ptr);
static void rio_disable_rx_interrupts (void * ptr); static void rio_disable_rx_interrupts(void *ptr);
static void rio_enable_rx_interrupts (void * ptr); static void rio_enable_rx_interrupts(void *ptr);
static int rio_get_CD (void * ptr); static int rio_get_CD(void *ptr);
static void rio_shutdown_port (void * ptr); static void rio_shutdown_port(void *ptr);
static int rio_set_real_termios (void *ptr); static int rio_set_real_termios(void *ptr);
static void rio_hungup (void *ptr); static void rio_hungup(void *ptr);
static void rio_close (void *ptr); static void rio_close(void *ptr);
static int rio_chars_in_buffer (void * ptr); static int rio_chars_in_buffer(void *ptr);
static int rio_fw_ioctl (struct inode *inode, struct file *filp, static int rio_fw_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
unsigned int cmd, unsigned long arg);
static int rio_init_drivers(void); static int rio_init_drivers(void);
static void my_hd (void *addr, int len); static void my_hd(void *addr, int len);
static struct tty_driver *rio_driver, *rio_driver2; static struct tty_driver *rio_driver, *rio_driver2;
...@@ -209,7 +225,7 @@ static int rio_poll = 1; ...@@ -209,7 +225,7 @@ static int rio_poll = 1;
/* These are the only open spaces in my computer. Yours may have more /* These are the only open spaces in my computer. Yours may have more
or less.... */ or less.... */
static int rio_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000}; static int rio_probe_addrs[] = { 0xc0000, 0xd0000, 0xe0000 };
#define NR_RIO_ADDRS ARRAY_SIZE(rio_probe_addrs) #define NR_RIO_ADDRS ARRAY_SIZE(rio_probe_addrs)
...@@ -262,21 +278,18 @@ static struct miscdevice rio_fw_device = { ...@@ -262,21 +278,18 @@ static struct miscdevice rio_fw_device = {
/* This doesn't work. Who's paranoid around here? Not me! */ /* This doesn't work. Who's paranoid around here? Not me! */
static inline int rio_paranoia_check(struct rio_port const * port, static inline int rio_paranoia_check(struct rio_port const *port, char *name, const char *routine)
char *name, const char *routine)
{ {
static const char *badmagic = static const char *badmagic = KERN_ERR "rio: Warning: bad rio port magic number for device %s in %s\n";
KERN_ERR "rio: Warning: bad rio port magic number for device %s in %s\n"; static const char *badinfo = KERN_ERR "rio: Warning: null rio port for device %s in %s\n";
static const char *badinfo =
KERN_ERR "rio: Warning: null rio port for device %s in %s\n";
if (!port) { if (!port) {
printk (badinfo, name, routine); printk(badinfo, name, routine);
return 1; return 1;
} }
if (port->magic != RIO_MAGIC) { if (port->magic != RIO_MAGIC) {
printk (badmagic, name, routine); printk(badmagic, name, routine);
return 1; return 1;
} }
...@@ -288,21 +301,21 @@ static inline int rio_paranoia_check(struct rio_port const * port, ...@@ -288,21 +301,21 @@ static inline int rio_paranoia_check(struct rio_port const * port,
#ifdef DEBUG #ifdef DEBUG
static void my_hd (void *ad, int len) static void my_hd(void *ad, int len)
{ {
int i, j, ch; int i, j, ch;
unsigned char *addr = ad; unsigned char *addr = ad;
for (i=0;i<len;i+=16) { for (i = 0; i < len; i += 16) {
rio_dprintk (RIO_DEBUG_PARAM, "%08x ", (int) addr+i); rio_dprintk(RIO_DEBUG_PARAM, "%08x ", (int) addr + i);
for (j=0;j<16;j++) { for (j = 0; j < 16; j++) {
rio_dprintk (RIO_DEBUG_PARAM, "%02x %s", addr[j+i], (j==7)?" ":""); rio_dprintk(RIO_DEBUG_PARAM, "%02x %s", addr[j + i], (j == 7) ? " " : "");
} }
for (j=0;j<16;j++) { for (j = 0; j < 16; j++) {
ch = addr[j+i]; ch = addr[j + i];
rio_dprintk (RIO_DEBUG_PARAM, "%c", (ch < 0x20)?'.':((ch > 0x7f)?'.':ch)); rio_dprintk(RIO_DEBUG_PARAM, "%c", (ch < 0x20) ? '.' : ((ch > 0x7f) ? '.' : ch));
} }
rio_dprintk (RIO_DEBUG_PARAM, "\n"); rio_dprintk(RIO_DEBUG_PARAM, "\n");
} }
} }
#else #else
...@@ -311,11 +324,11 @@ static void my_hd (void *ad, int len) ...@@ -311,11 +324,11 @@ static void my_hd (void *ad, int len)
/* Delay a number of jiffies, allowing a signal to interrupt */ /* Delay a number of jiffies, allowing a signal to interrupt */
int RIODelay (struct Port *PortP, int njiffies) int RIODelay(struct Port *PortP, int njiffies)
{ {
func_enter (); func_enter();
rio_dprintk (RIO_DEBUG_DELAY, "delaying %d jiffies\n", njiffies); rio_dprintk(RIO_DEBUG_DELAY, "delaying %d jiffies\n", njiffies);
msleep_interruptible(jiffies_to_msecs(njiffies)); msleep_interruptible(jiffies_to_msecs(njiffies));
func_exit(); func_exit();
...@@ -327,11 +340,11 @@ int RIODelay (struct Port *PortP, int njiffies) ...@@ -327,11 +340,11 @@ int RIODelay (struct Port *PortP, int njiffies)
/* Delay a number of jiffies, disallowing a signal to interrupt */ /* Delay a number of jiffies, disallowing a signal to interrupt */
int RIODelay_ni (struct Port *PortP, int njiffies) int RIODelay_ni(struct Port *PortP, int njiffies)
{ {
func_enter (); func_enter();
rio_dprintk (RIO_DEBUG_DELAY, "delaying %d jiffies (ni)\n", njiffies); rio_dprintk(RIO_DEBUG_DELAY, "delaying %d jiffies (ni)\n", njiffies);
msleep(jiffies_to_msecs(njiffies)); msleep(jiffies_to_msecs(njiffies));
func_exit(); func_exit();
return !RIO_FAIL; return !RIO_FAIL;
...@@ -350,47 +363,46 @@ int rio_ismodem(struct tty_struct *tty) ...@@ -350,47 +363,46 @@ int rio_ismodem(struct tty_struct *tty)
} }
static int rio_set_real_termios (void *ptr) static int rio_set_real_termios(void *ptr)
{ {
int rv, modem; int rv, modem;
struct tty_struct *tty; struct tty_struct *tty;
func_enter(); func_enter();
tty = ((struct Port *)ptr)->gs.tty; tty = ((struct Port *) ptr)->gs.tty;
modem = rio_ismodem(tty); modem = rio_ismodem(tty);
rv = RIOParam( (struct Port *) ptr, CONFIG, modem, 1); rv = RIOParam((struct Port *) ptr, CONFIG, modem, 1);
func_exit (); func_exit();
return rv; return rv;
} }
static void rio_reset_interrupt (struct Host *HostP) static void rio_reset_interrupt(struct Host *HostP)
{ {
func_enter(); func_enter();
switch( HostP->Type ) { switch (HostP->Type) {
case RIO_AT: case RIO_AT:
case RIO_MCA: case RIO_MCA:
case RIO_PCI: case RIO_PCI:
WBYTE(HostP->ResetInt , 0xff); WBYTE(HostP->ResetInt, 0xff);
} }
func_exit(); func_exit();
} }
static irqreturn_t rio_interrupt (int irq, void *ptr, struct pt_regs *regs) static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs)
{ {
struct Host *HostP; struct Host *HostP;
func_enter (); func_enter();
HostP = (struct Host*)ptr; /* &p->RIOHosts[(long)ptr]; */ HostP = (struct Host *) ptr; /* &p->RIOHosts[(long)ptr]; */
rio_dprintk (RIO_DEBUG_IFLOW, "rio: enter rio_interrupt (%d/%d)\n", rio_dprintk(RIO_DEBUG_IFLOW, "rio: enter rio_interrupt (%d/%d)\n", irq, HostP->Ivec);
irq, HostP->Ivec);
/* AAargh! The order in which to do these things is essential and /* AAargh! The order in which to do these things is essential and
not trivial. not trivial.
...@@ -419,13 +431,12 @@ static irqreturn_t rio_interrupt (int irq, void *ptr, struct pt_regs *regs) ...@@ -419,13 +431,12 @@ static irqreturn_t rio_interrupt (int irq, void *ptr, struct pt_regs *regs)
actual interrupt routine!. (Well, used to when I wrote that comment) */ actual interrupt routine!. (Well, used to when I wrote that comment) */
{ {
static int lastjif; static int lastjif;
static int nintr=0; static int nintr = 0;
if (lastjif == jiffies) { if (lastjif == jiffies) {
if (++nintr > IRQ_RATE_LIMIT) { if (++nintr > IRQ_RATE_LIMIT) {
free_irq (HostP->Ivec, ptr); free_irq(HostP->Ivec, ptr);
printk (KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n", printk(KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n", HostP->Ivec);
HostP->Ivec);
} }
} else { } else {
lastjif = jiffies; lastjif = jiffies;
...@@ -433,43 +444,40 @@ static irqreturn_t rio_interrupt (int irq, void *ptr, struct pt_regs *regs) ...@@ -433,43 +444,40 @@ static irqreturn_t rio_interrupt (int irq, void *ptr, struct pt_regs *regs)
} }
} }
#endif #endif
rio_dprintk (RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n"); rio_dprintk(RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n");
if (HostP->Ivec == irq) { if (HostP->Ivec == irq) {
/* Tell the card we've noticed the interrupt. */ /* Tell the card we've noticed the interrupt. */
rio_reset_interrupt (HostP); rio_reset_interrupt(HostP);
} }
if ((HostP->Flags & RUN_STATE) != RC_RUNNING) if ((HostP->Flags & RUN_STATE) != RC_RUNNING)
return IRQ_HANDLED; return IRQ_HANDLED;
if (test_and_set_bit (RIO_BOARD_INTR_LOCK, &HostP->locks)) { if (test_and_set_bit(RIO_BOARD_INTR_LOCK, &HostP->locks)) {
printk (KERN_ERR "Recursive interrupt! (host %d/irq%d)\n", printk(KERN_ERR "Recursive interrupt! (host %d/irq%d)\n", (int) ptr, HostP->Ivec);
(int) ptr, HostP->Ivec);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
RIOServiceHost(p, HostP, irq); RIOServiceHost(p, HostP, irq);
rio_dprintk ( RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n", rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n", (int) ptr, HostP->Type);
(int) ptr, HostP->Type);
clear_bit (RIO_BOARD_INTR_LOCK, &HostP->locks); clear_bit(RIO_BOARD_INTR_LOCK, &HostP->locks);
rio_dprintk (RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", rio_dprintk(RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", irq, HostP->Ivec);
irq, HostP->Ivec); func_exit();
func_exit ();
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void rio_pollfunc (unsigned long data) static void rio_pollfunc(unsigned long data)
{ {
func_enter (); func_enter();
rio_interrupt (0, &p->RIOHosts[data], NULL); rio_interrupt(0, &p->RIOHosts[data], NULL);
p->RIOHosts[data].timer.expires = jiffies + rio_poll; p->RIOHosts[data].timer.expires = jiffies + rio_poll;
add_timer (&p->RIOHosts[data].timer); add_timer(&p->RIOHosts[data].timer);
func_exit (); func_exit();
} }
...@@ -481,7 +489,7 @@ static void rio_pollfunc (unsigned long data) ...@@ -481,7 +489,7 @@ static void rio_pollfunc (unsigned long data)
/* Ehhm. I don't know how to fiddle with interrupts on the Specialix /* Ehhm. I don't know how to fiddle with interrupts on the Specialix
cards. .... Hmm. Ok I figured it out. You don't. -- REW */ cards. .... Hmm. Ok I figured it out. You don't. -- REW */
static void rio_disable_tx_interrupts (void * ptr) static void rio_disable_tx_interrupts(void *ptr)
{ {
func_enter(); func_enter();
...@@ -491,7 +499,7 @@ static void rio_disable_tx_interrupts (void * ptr) ...@@ -491,7 +499,7 @@ static void rio_disable_tx_interrupts (void * ptr)
} }
static void rio_enable_tx_interrupts (void * ptr) static void rio_enable_tx_interrupts(void *ptr)
{ {
struct Port *PortP = ptr; struct Port *PortP = ptr;
/* int hn; */ /* int hn; */
...@@ -515,13 +523,13 @@ static void rio_enable_tx_interrupts (void * ptr) ...@@ -515,13 +523,13 @@ static void rio_enable_tx_interrupts (void * ptr)
} }
static void rio_disable_rx_interrupts (void * ptr) static void rio_disable_rx_interrupts(void *ptr)
{ {
func_enter(); func_enter();
func_exit(); func_exit();
} }
static void rio_enable_rx_interrupts (void * ptr) static void rio_enable_rx_interrupts(void *ptr)
{ {
/* struct rio_port *port = ptr; */ /* struct rio_port *port = ptr; */
func_enter(); func_enter();
...@@ -530,7 +538,7 @@ static void rio_enable_rx_interrupts (void * ptr) ...@@ -530,7 +538,7 @@ static void rio_enable_rx_interrupts (void * ptr)
/* Jeez. Isn't this simple? */ /* Jeez. Isn't this simple? */
static int rio_get_CD (void * ptr) static int rio_get_CD(void *ptr)
{ {
struct Port *PortP = ptr; struct Port *PortP = ptr;
int rv; int rv;
...@@ -538,7 +546,7 @@ static int rio_get_CD (void * ptr) ...@@ -538,7 +546,7 @@ static int rio_get_CD (void * ptr)
func_enter(); func_enter();
rv = (PortP->ModemState & MSVR1_CD) != 0; rv = (PortP->ModemState & MSVR1_CD) != 0;
rio_dprintk (RIO_DEBUG_INIT, "Getting CD status: %d\n", rv); rio_dprintk(RIO_DEBUG_INIT, "Getting CD status: %d\n", rv);
func_exit(); func_exit();
return rv; return rv;
...@@ -547,7 +555,7 @@ static int rio_get_CD (void * ptr) ...@@ -547,7 +555,7 @@ static int rio_get_CD (void * ptr)
/* Jeez. Isn't this simple? Actually, we can sync with the actual port /* Jeez. Isn't this simple? Actually, we can sync with the actual port
by just pushing stuff into the queue going to the port... */ by just pushing stuff into the queue going to the port... */
static int rio_chars_in_buffer (void * ptr) static int rio_chars_in_buffer(void *ptr)
{ {
func_enter(); func_enter();
...@@ -557,26 +565,26 @@ static int rio_chars_in_buffer (void * ptr) ...@@ -557,26 +565,26 @@ static int rio_chars_in_buffer (void * ptr)
/* Nothing special here... */ /* Nothing special here... */
static void rio_shutdown_port (void * ptr) static void rio_shutdown_port(void *ptr)
{ {
struct Port *PortP; struct Port *PortP;
func_enter(); func_enter();
PortP = (struct Port *)ptr; PortP = (struct Port *) ptr;
PortP->gs.tty = NULL; PortP->gs.tty = NULL;
#if 0 #if 0
port->gs.flags &= ~ GS_ACTIVE; port->gs.flags &= ~GS_ACTIVE;
if (!port->gs.tty) { if (!port->gs.tty) {
rio_dprintk (RIO_DBUG_TTY, "No tty.\n"); rio_dprintk(RIO_DBUG_TTY, "No tty.\n");
return; return;
} }
if (!port->gs.tty->termios) { if (!port->gs.tty->termios) {
rio_dprintk (RIO_DEBUG_TTY, "No termios.\n"); rio_dprintk(RIO_DEBUG_TTY, "No termios.\n");
return; return;
} }
if (port->gs.tty->termios->c_cflag & HUPCL) { if (port->gs.tty->termios->c_cflag & HUPCL) {
rio_setsignals (port, 0, 0); rio_setsignals(port, 0, 0);
} }
#endif #endif
...@@ -591,16 +599,16 @@ static void rio_shutdown_port (void * ptr) ...@@ -591,16 +599,16 @@ static void rio_shutdown_port (void * ptr)
running minicom on a serial port that is driven by a modularized running minicom on a serial port that is driven by a modularized
driver. Have the modem hangup. Then remove the driver module. Then driver. Have the modem hangup. Then remove the driver module. Then
exit minicom. I expect an "oops". -- REW */ exit minicom. I expect an "oops". -- REW */
static void rio_hungup (void *ptr) static void rio_hungup(void *ptr)
{ {
struct Port *PortP; struct Port *PortP;
func_enter(); func_enter();
PortP = (struct Port *)ptr; PortP = (struct Port *) ptr;
PortP->gs.tty = NULL; PortP->gs.tty = NULL;
func_exit (); func_exit();
} }
...@@ -608,45 +616,42 @@ static void rio_hungup (void *ptr) ...@@ -608,45 +616,42 @@ static void rio_hungup (void *ptr)
this. this.
rs_close (...){save_flags;cli;real_close();dec_use_count;restore_flags;} rs_close (...){save_flags;cli;real_close();dec_use_count;restore_flags;}
*/ */
static void rio_close (void *ptr) static void rio_close(void *ptr)
{ {
struct Port *PortP; struct Port *PortP;
func_enter (); func_enter();
PortP = (struct Port *)ptr; PortP = (struct Port *) ptr;
riotclose (ptr); riotclose(ptr);
if(PortP->gs.count) { if (PortP->gs.count) {
printk (KERN_ERR "WARNING port count:%d\n", PortP->gs.count); printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.count);
PortP->gs.count = 0; PortP->gs.count = 0;
} }
PortP->gs.tty = NULL; PortP->gs.tty = NULL;
func_exit (); func_exit();
} }
static int rio_fw_ioctl (struct inode *inode, struct file *filp, static int rio_fw_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
int rc = 0; int rc = 0;
func_enter(); func_enter();
/* The "dev" argument isn't used. */ /* The "dev" argument isn't used. */
rc = riocontrol (p, 0, cmd, (void *)arg, capable(CAP_SYS_ADMIN)); rc = riocontrol(p, 0, cmd, (void *) arg, capable(CAP_SYS_ADMIN));
func_exit (); func_exit();
return rc; return rc;
} }
extern int RIOShortCommand(struct rio_info *p, struct Port *PortP, extern int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg);
int command, int len, int arg);
static int rio_ioctl (struct tty_struct * tty, struct file * filp, static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
int rc; int rc;
struct Port *PortP; struct Port *PortP;
...@@ -654,58 +659,54 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp, ...@@ -654,58 +659,54 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp,
func_enter(); func_enter();
PortP = (struct Port *)tty->driver_data; PortP = (struct Port *) tty->driver_data;
rc = 0; rc = 0;
switch (cmd) { switch (cmd) {
#if 0 #if 0
case TIOCGSOFTCAR: case TIOCGSOFTCAR:
rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), (unsigned int *) arg);
(unsigned int *) arg);
break; break;
#endif #endif
case TIOCSSOFTCAR: case TIOCSSOFTCAR:
if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
tty->termios->c_cflag = tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0);
(tty->termios->c_cflag & ~CLOCAL) |
(ival ? CLOCAL : 0);
} }
break; break;
case TIOCGSERIAL: case TIOCGSERIAL:
rc = -EFAULT; rc = -EFAULT;
if (access_ok(VERIFY_WRITE, (void *) arg, if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(struct serial_struct)))
sizeof(struct serial_struct)))
rc = gs_getserial(&PortP->gs, (struct serial_struct *) arg); rc = gs_getserial(&PortP->gs, (struct serial_struct *) arg);
break; break;
case TCSBRK: case TCSBRK:
if ( PortP->State & RIO_DELETED ) { if (PortP->State & RIO_DELETED) {
rio_dprintk (RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); rio_dprintk(RIO_DEBUG_TTY, "BREAK on deleted RTA\n");
rc = -EIO; rc = -EIO;
} else { } else {
if (RIOShortCommand(p, PortP, SBREAK, 2, 250) == RIO_FAIL) { if (RIOShortCommand(p, PortP, SBREAK, 2, 250) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
rc = -EIO; rc = -EIO;
} }
} }
break; break;
case TCSBRKP: case TCSBRKP:
if ( PortP->State & RIO_DELETED ) { if (PortP->State & RIO_DELETED) {
rio_dprintk (RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); rio_dprintk(RIO_DEBUG_TTY, "BREAK on deleted RTA\n");
rc = -EIO; rc = -EIO;
} else { } else {
int l; int l;
l = arg?arg*100:250; l = arg ? arg * 100 : 250;
if (l > 255) l = 255; if (l > 255)
if (RIOShortCommand(p, PortP, SBREAK, 2, arg?arg*100:250) == RIO_FAIL) { l = 255;
rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); if (RIOShortCommand(p, PortP, SBREAK, 2, arg ? arg * 100 : 250) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
rc = -EIO; rc = -EIO;
} }
} }
break; break;
case TIOCSSERIAL: case TIOCSSERIAL:
rc = -EFAULT; rc = -EFAULT;
if (access_ok(VERIFY_READ, (void *) arg, if (access_ok(VERIFY_READ, (void *) arg, sizeof(struct serial_struct)))
sizeof(struct serial_struct)))
rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg); rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg);
break; break;
#if 0 #if 0
...@@ -716,8 +717,7 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp, ...@@ -716,8 +717,7 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp,
*/ */
case TIOCMGET: case TIOCMGET:
rc = -EFAULT; rc = -EFAULT;
if (access_ok(VERIFY_WRITE, (void *) arg, if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(unsigned int))) {
sizeof(unsigned int))) {
rc = 0; rc = 0;
ival = rio_getsignals(port); ival = rio_getsignals(port);
put_user(ival, (unsigned int *) arg); put_user(ival, (unsigned int *) arg);
...@@ -725,20 +725,17 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp, ...@@ -725,20 +725,17 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp,
break; break;
case TIOCMBIS: case TIOCMBIS:
if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1), rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1), ((ival & TIOCM_RTS) ? 1 : -1));
((ival & TIOCM_RTS) ? 1 : -1));
} }
break; break;
case TIOCMBIC: case TIOCMBIC:
if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
rio_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1), rio_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1), ((ival & TIOCM_RTS) ? 0 : -1));
((ival & TIOCM_RTS) ? 0 : -1));
} }
break; break;
case TIOCMSET: case TIOCMSET:
if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0), rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0), ((ival & TIOCM_RTS) ? 1 : 0));
((ival & TIOCM_RTS) ? 1 : 0));
} }
break; break;
#endif #endif
...@@ -767,16 +764,16 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp, ...@@ -767,16 +764,16 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp,
* flow control scheme is in use for that port. -- Simon Allen * flow control scheme is in use for that port. -- Simon Allen
*/ */
static void rio_throttle (struct tty_struct * tty) static void rio_throttle(struct tty_struct *tty)
{ {
struct Port *port = (struct Port *)tty->driver_data; struct Port *port = (struct Port *) tty->driver_data;
func_enter(); func_enter();
/* If the port is using any type of input flow /* If the port is using any type of input flow
* control then throttle the port. * control then throttle the port.
*/ */
if((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty)) ) { if ((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty))) {
port->State |= RIO_THROTTLE_RX; port->State |= RIO_THROTTLE_RX;
} }
...@@ -784,9 +781,9 @@ static void rio_throttle (struct tty_struct * tty) ...@@ -784,9 +781,9 @@ static void rio_throttle (struct tty_struct * tty)
} }
static void rio_unthrottle (struct tty_struct * tty) static void rio_unthrottle(struct tty_struct *tty)
{ {
struct Port *port = (struct Port *)tty->driver_data; struct Port *port = (struct Port *) tty->driver_data;
func_enter(); func_enter();
/* Always unthrottle even if flow control is not enabled on /* Always unthrottle even if flow control is not enabled on
...@@ -809,27 +806,26 @@ static void rio_unthrottle (struct tty_struct * tty) ...@@ -809,27 +806,26 @@ static void rio_unthrottle (struct tty_struct * tty)
* ********************************************************************** */ * ********************************************************************** */
static struct vpd_prom *get_VPD_PROM (struct Host *hp) static struct vpd_prom *get_VPD_PROM(struct Host *hp)
{ {
static struct vpd_prom vpdp; static struct vpd_prom vpdp;
char *p; char *p;
int i; int i;
func_enter(); func_enter();
rio_dprintk (RIO_DEBUG_PROBE, "Going to verify vpd prom at %p.\n", rio_dprintk(RIO_DEBUG_PROBE, "Going to verify vpd prom at %p.\n", hp->Caddr + RIO_VPD_ROM);
hp->Caddr + RIO_VPD_ROM);
p = (char *) &vpdp; p = (char *) &vpdp;
for (i=0;i< sizeof (struct vpd_prom);i++) for (i = 0; i < sizeof(struct vpd_prom); i++)
*p++ = readb (hp->Caddr+RIO_VPD_ROM + i*2); *p++ = readb(hp->Caddr + RIO_VPD_ROM + i * 2);
/* read_rio_byte (hp, RIO_VPD_ROM + i*2); */ /* read_rio_byte (hp, RIO_VPD_ROM + i*2); */
/* Terminate the identifier string. /* Terminate the identifier string.
*** requires one extra byte in struct vpd_prom *** */ *** requires one extra byte in struct vpd_prom *** */
*p++=0; *p++ = 0;
if (rio_debug & RIO_DEBUG_PROBE) if (rio_debug & RIO_DEBUG_PROBE)
my_hd ((char *)&vpdp, 0x20); my_hd((char *) &vpdp, 0x20);
func_exit(); func_exit();
...@@ -889,7 +885,7 @@ static int rio_init_drivers(void) ...@@ -889,7 +885,7 @@ static int rio_init_drivers(void)
rio_driver2->flags = TTY_DRIVER_REAL_RAW; rio_driver2->flags = TTY_DRIVER_REAL_RAW;
tty_set_operations(rio_driver2, &rio_ops); tty_set_operations(rio_driver2, &rio_ops);
rio_dprintk (RIO_DEBUG_INIT, "set_termios = %p\n", gs_set_termios); rio_dprintk(RIO_DEBUG_INIT, "set_termios = %p\n", gs_set_termios);
if ((error = tty_register_driver(rio_driver))) if ((error = tty_register_driver(rio_driver)))
goto out2; goto out2;
...@@ -897,20 +893,19 @@ static int rio_init_drivers(void) ...@@ -897,20 +893,19 @@ static int rio_init_drivers(void)
goto out3; goto out3;
func_exit(); func_exit();
return 0; return 0;
out3: out3:
tty_unregister_driver(rio_driver); tty_unregister_driver(rio_driver);
out2: out2:
put_tty_driver(rio_driver2); put_tty_driver(rio_driver2);
out1: out1:
put_tty_driver(rio_driver); put_tty_driver(rio_driver);
out: out:
printk(KERN_ERR "rio: Couldn't register a rio driver, error = %d\n", printk(KERN_ERR "rio: Couldn't register a rio driver, error = %d\n", error);
error);
return 1; return 1;
} }
static void * ckmalloc (int size) static void *ckmalloc(int size)
{ {
void *p; void *p;
...@@ -922,7 +917,7 @@ static void * ckmalloc (int size) ...@@ -922,7 +917,7 @@ static void * ckmalloc (int size)
static int rio_init_datastructures (void) static int rio_init_datastructures(void)
{ {
int i; int i;
struct Port *port; struct Port *port;
...@@ -938,30 +933,27 @@ static int rio_init_datastructures (void) ...@@ -938,30 +933,27 @@ static int rio_init_datastructures (void)
#define HOST_SZ sizeof(struct Host) #define HOST_SZ sizeof(struct Host)
#define PORT_SZ sizeof(struct Port *) #define PORT_SZ sizeof(struct Port *)
#define TMIO_SZ sizeof(struct termios *) #define TMIO_SZ sizeof(struct termios *)
rio_dprintk (RIO_DEBUG_INIT, "getting : %d %d %d %d %d bytes\n", 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);
RI_SZ,
RIO_HOSTS * HOST_SZ, if (!(p = ckmalloc(RI_SZ)))
RIO_PORTS * PORT_SZ, goto free0;
RIO_PORTS * TMIO_SZ, if (!(p->RIOHosts = ckmalloc(RIO_HOSTS * HOST_SZ)))
RIO_PORTS * TMIO_SZ); goto free1;
if (!(p->RIOPortp = ckmalloc(RIO_PORTS * PORT_SZ)))
if (!(p = ckmalloc ( RI_SZ))) goto free0; goto free2;
if (!(p->RIOHosts = ckmalloc (RIO_HOSTS * HOST_SZ))) goto free1;
if (!(p->RIOPortp = ckmalloc (RIO_PORTS * PORT_SZ))) goto free2;
p->RIOConf = RIOConf; p->RIOConf = RIOConf;
rio_dprintk (RIO_DEBUG_INIT, "Got : %p %p %p\n", rio_dprintk(RIO_DEBUG_INIT, "Got : %p %p %p\n", p, p->RIOHosts, p->RIOPortp);
p, p->RIOHosts, p->RIOPortp);
#if 1 #if 1
for (i = 0; i < RIO_PORTS; i++) { for (i = 0; i < RIO_PORTS; i++) {
port = p->RIOPortp[i] = ckmalloc (sizeof (struct Port)); port = p->RIOPortp[i] = ckmalloc(sizeof(struct Port));
if (!port) { if (!port) {
goto free6; goto free6;
} }
rio_dprintk (RIO_DEBUG_INIT, "initing port %d (%d)\n", i, port->Mapped); rio_dprintk(RIO_DEBUG_INIT, "initing port %d (%d)\n", i, port->Mapped);
port->PortNum = i; port->PortNum = i;
port->gs.magic = RIO_MAGIC; port->gs.magic = RIO_MAGIC;
port->gs.close_delay = HZ/2; port->gs.close_delay = HZ / 2;
port->gs.closing_wait = 30 * HZ; port->gs.closing_wait = 30 * HZ;
port->gs.rd = &rio_real_driver; port->gs.rd = &rio_real_driver;
spin_lock_init(&port->portSem); spin_lock_init(&port->portSem);
...@@ -978,22 +970,21 @@ static int rio_init_datastructures (void) ...@@ -978,22 +970,21 @@ static int rio_init_datastructures (void)
if (rio_debug & RIO_DEBUG_INIT) { if (rio_debug & RIO_DEBUG_INIT) {
my_hd (&rio_real_driver, sizeof (rio_real_driver)); my_hd(&rio_real_driver, sizeof(rio_real_driver));
} }
func_exit(); func_exit();
return 0; return 0;
free6:for (i--;i>=0;i--) free6:for (i--; i >= 0; i--)
kfree (p->RIOPortp[i]); kfree(p->RIOPortp[i]);
/*free5: /*free5:
free4: free4:
free3:*/kfree (p->RIOPortp); free3:*/ kfree(p->RIOPortp);
free2:kfree (p->RIOHosts); free2:kfree(p->RIOHosts);
free1: free1:
rio_dprintk (RIO_DEBUG_INIT, "Not enough memory! %p %p %p\n", rio_dprintk(RIO_DEBUG_INIT, "Not enough memory! %p %p %p\n", p, p->RIOHosts, p->RIOPortp);
p, p->RIOHosts, p->RIOPortp);
kfree(p); kfree(p);
free0: free0:
return -ENOMEM; return -ENOMEM;
...@@ -1030,7 +1021,7 @@ static void __exit rio_release_drivers(void) ...@@ -1030,7 +1021,7 @@ static void __exit rio_release_drivers(void)
EEprom. As the bit is read/write for the CPU, we can fix it here, EEprom. As the bit is read/write for the CPU, we can fix it here,
if we detect that it isn't set correctly. -- REW */ if we detect that it isn't set correctly. -- REW */
static void fix_rio_pci (struct pci_dev *pdev) static void fix_rio_pci(struct pci_dev *pdev)
{ {
unsigned int hwbase; unsigned int hwbase;
unsigned long rebase; unsigned long rebase;
...@@ -1042,13 +1033,12 @@ static void fix_rio_pci (struct pci_dev *pdev) ...@@ -1042,13 +1033,12 @@ static void fix_rio_pci (struct pci_dev *pdev)
pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase); pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase);
hwbase &= PCI_BASE_ADDRESS_MEM_MASK; hwbase &= PCI_BASE_ADDRESS_MEM_MASK;
rebase = (ulong) ioremap(hwbase, 0x80); rebase = (ulong) ioremap(hwbase, 0x80);
t = readl (rebase + CNTRL_REG_OFFSET); t = readl(rebase + CNTRL_REG_OFFSET);
if (t != CNTRL_REG_GOODVALUE) { if (t != CNTRL_REG_GOODVALUE) {
printk (KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", t, CNTRL_REG_GOODVALUE);
t, CNTRL_REG_GOODVALUE); writel(CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET);
writel (CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET);
} }
iounmap((char*) rebase); iounmap((char *) rebase);
} }
#endif #endif
...@@ -1069,13 +1059,11 @@ static int __init rio_init(void) ...@@ -1069,13 +1059,11 @@ static int __init rio_init(void)
#endif #endif
func_enter(); func_enter();
rio_dprintk (RIO_DEBUG_INIT, "Initing rio module... (rio_debug=%d)\n", rio_dprintk(RIO_DEBUG_INIT, "Initing rio module... (rio_debug=%d)\n", rio_debug);
rio_debug);
if (abs ((long) (&rio_debug) - rio_debug) < 0x10000) { if (abs((long) (&rio_debug) - rio_debug) < 0x10000) {
printk (KERN_WARNING "rio: rio_debug is an address, instead of a value. " printk(KERN_WARNING "rio: rio_debug is an address, instead of a value. " "Assuming -1. Was %x/%p.\n", rio_debug, &rio_debug);
"Assuming -1. Was %x/%p.\n", rio_debug, &rio_debug); rio_debug = -1;
rio_debug=-1;
} }
if (misc_register(&rio_fw_device) < 0) { if (misc_register(&rio_fw_device) < 0) {
...@@ -1083,18 +1071,16 @@ static int __init rio_init(void) ...@@ -1083,18 +1071,16 @@ static int __init rio_init(void)
return -EIO; return -EIO;
} }
retval = rio_init_datastructures (); retval = rio_init_datastructures();
if (retval < 0) { if (retval < 0) {
misc_deregister(&rio_fw_device); misc_deregister(&rio_fw_device);
return retval; return retval;
} }
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
/* First look for the JET devices: */ /* First look for the JET devices: */
while ((pdev = pci_get_device (PCI_VENDOR_ID_SPECIALIX, while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, pdev))) {
PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, if (pci_enable_device(pdev))
pdev))) { continue;
if (pci_enable_device(pdev)) continue;
/* Specialix has a whole bunch of cards with /* Specialix has a whole bunch of cards with
0x2000 as the device ID. They say its because 0x2000 as the device ID. They say its because
...@@ -1104,15 +1090,14 @@ static int __init rio_init(void) ...@@ -1104,15 +1090,14 @@ static int __init rio_init(void)
whole dword at 0x2c and extract the word at 0x2e (SUBSYSTEM_ID) whole dword at 0x2c and extract the word at 0x2e (SUBSYSTEM_ID)
ourselves */ ourselves */
/* I don't know why the define doesn't work, constant 0x2c does --REW */ /* I don't know why the define doesn't work, constant 0x2c does --REW */
pci_read_config_dword (pdev, 0x2c, &tint); pci_read_config_dword(pdev, 0x2c, &tint);
tshort = (tint >> 16) & 0xffff; tshort = (tint >> 16) & 0xffff;
rio_dprintk (RIO_DEBUG_PROBE, "Got a specialix card: %x.\n", tint); rio_dprintk(RIO_DEBUG_PROBE, "Got a specialix card: %x.\n", tint);
if (tshort != 0x0100) { if (tshort != 0x0100) {
rio_dprintk (RIO_DEBUG_PROBE, "But it's not a RIO card (%d)...\n", rio_dprintk(RIO_DEBUG_PROBE, "But it's not a RIO card (%d)...\n", tshort);
tshort);
continue; continue;
} }
rio_dprintk (RIO_DEBUG_PROBE, "cp1\n"); rio_dprintk(RIO_DEBUG_PROBE, "cp1\n");
pci_read_config_dword(pdev, PCI_BASE_ADDRESS_2, &tint); pci_read_config_dword(pdev, PCI_BASE_ADDRESS_2, &tint);
...@@ -1127,31 +1112,24 @@ static int __init rio_init(void) ...@@ -1127,31 +1112,24 @@ static int __init rio_init(void)
hp->Copy = rio_pcicopy; hp->Copy = rio_pcicopy;
hp->Mode = RIO_PCI_BOOT_FROM_RAM; hp->Mode = RIO_PCI_BOOT_FROM_RAM;
spin_lock_init(&hp->HostLock); spin_lock_init(&hp->HostLock);
rio_reset_interrupt (hp); rio_reset_interrupt(hp);
rio_start_card_running (hp); rio_start_card_running(hp);
rio_dprintk (RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr);
(void *)p->RIOHosts[p->RIONumHosts].PaddrP, if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) {
p->RIOHosts[p->RIONumHosts].Caddr); rio_dprintk(RIO_DEBUG_INIT, "Done RIOBoardTest\n");
if (RIOBoardTest( p->RIOHosts[p->RIONumHosts].PaddrP,
p->RIOHosts[p->RIONumHosts].Caddr,
RIO_PCI, 0 ) == RIO_SUCCESS) {
rio_dprintk (RIO_DEBUG_INIT, "Done RIOBoardTest\n");
WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff);
p->RIOHosts[p->RIONumHosts].UniqueNum = p->RIOHosts[p->RIONumHosts].UniqueNum =
((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) &0xFF)<< 0)| ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) |
((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) &0xFF)<< 8)| ((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);
((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) &0xFF)<<16)| rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) &0xFF)<<24);
rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", fix_rio_pci(pdev);
p->RIOHosts[p->RIONumHosts].UniqueNum);
fix_rio_pci (pdev);
p->RIOLastPCISearch = RIO_SUCCESS; p->RIOLastPCISearch = RIO_SUCCESS;
p->RIONumHosts++; p->RIONumHosts++;
found++; found++;
} else { } else {
iounmap((char*) (p->RIOHosts[p->RIONumHosts].Caddr)); iounmap((char *) (p->RIOHosts[p->RIONumHosts].Caddr));
} }
} }
...@@ -1165,10 +1143,9 @@ static int __init rio_init(void) ...@@ -1165,10 +1143,9 @@ static int __init rio_init(void)
*/ */
/* Then look for the older RIO/PCI devices: */ /* Then look for the older RIO/PCI devices: */
while ((pdev = pci_get_device (PCI_VENDOR_ID_SPECIALIX, while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_RIO, pdev))) {
PCI_DEVICE_ID_SPECIALIX_RIO, if (pci_enable_device(pdev))
pdev))) { continue;
if (pci_enable_device(pdev)) continue;
#ifdef CONFIG_RIO_OLDPCI #ifdef CONFIG_RIO_OLDPCI
pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &tint); pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &tint);
...@@ -1186,41 +1163,33 @@ static int __init rio_init(void) ...@@ -1186,41 +1163,33 @@ static int __init rio_init(void)
hp->Mode = RIO_PCI_BOOT_FROM_RAM; hp->Mode = RIO_PCI_BOOT_FROM_RAM;
spin_lock_init(&hp->HostLock); spin_lock_init(&hp->HostLock);
rio_dprintk (RIO_DEBUG_PROBE, "Ivec: %x\n", hp->Ivec); rio_dprintk(RIO_DEBUG_PROBE, "Ivec: %x\n", hp->Ivec);
rio_dprintk (RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode); rio_dprintk(RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode);
rio_reset_interrupt (hp); rio_reset_interrupt(hp);
rio_start_card_running (hp); rio_start_card_running(hp);
rio_dprintk (RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr);
(void *)p->RIOHosts[p->RIONumHosts].PaddrP, if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) {
p->RIOHosts[p->RIONumHosts].Caddr);
if (RIOBoardTest( p->RIOHosts[p->RIONumHosts].PaddrP,
p->RIOHosts[p->RIONumHosts].Caddr,
RIO_PCI, 0 ) == RIO_SUCCESS) {
WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff);
p->RIOHosts[p->RIONumHosts].UniqueNum = p->RIOHosts[p->RIONumHosts].UniqueNum =
((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) &0xFF)<< 0)| ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) |
((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) &0xFF)<< 8)| ((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);
((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) &0xFF)<<16)| rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) &0xFF)<<24);
rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n",
p->RIOHosts[p->RIONumHosts].UniqueNum);
p->RIOLastPCISearch = RIO_SUCCESS; p->RIOLastPCISearch = RIO_SUCCESS;
p->RIONumHosts++; p->RIONumHosts++;
found++; found++;
} else { } else {
iounmap((char*) (p->RIOHosts[p->RIONumHosts].Caddr)); iounmap((char *) (p->RIOHosts[p->RIONumHosts].Caddr));
} }
#else #else
printk (KERN_ERR "Found an older RIO PCI card, but the driver is not " printk(KERN_ERR "Found an older RIO PCI card, but the driver is not " "compiled to support it.\n");
"compiled to support it.\n");
#endif #endif
} }
#endif /* PCI */ #endif /* PCI */
/* Now probe for ISA cards... */ /* Now probe for ISA cards... */
for (i=0;i<NR_RIO_ADDRS;i++) { for (i = 0; i < NR_RIO_ADDRS; i++) {
hp = &p->RIOHosts[p->RIONumHosts]; hp = &p->RIOHosts[p->RIONumHosts];
hp->PaddrP = rio_probe_addrs[i]; hp->PaddrP = rio_probe_addrs[i];
/* There was something about the IRQs of these cards. 'Forget what.--REW */ /* There was something about the IRQs of these cards. 'Forget what.--REW */
...@@ -1236,111 +1205,107 @@ static int __init rio_init(void) ...@@ -1236,111 +1205,107 @@ static int __init rio_init(void)
hp->Mode = 0; hp->Mode = 0;
spin_lock_init(&hp->HostLock); spin_lock_init(&hp->HostLock);
vpdp = get_VPD_PROM (hp); vpdp = get_VPD_PROM(hp);
rio_dprintk (RIO_DEBUG_PROBE, "Got VPD ROM\n"); rio_dprintk(RIO_DEBUG_PROBE, "Got VPD ROM\n");
okboard = 0; okboard = 0;
if ((strncmp (vpdp->identifier, RIO_ISA_IDENT, 16) == 0) || if ((strncmp(vpdp->identifier, RIO_ISA_IDENT, 16) == 0) || (strncmp(vpdp->identifier, RIO_ISA2_IDENT, 16) == 0) || (strncmp(vpdp->identifier, RIO_ISA3_IDENT, 16) == 0)) {
(strncmp (vpdp->identifier, RIO_ISA2_IDENT, 16) == 0) ||
(strncmp (vpdp->identifier, RIO_ISA3_IDENT, 16) == 0)) {
/* Board is present... */ /* Board is present... */
if (RIOBoardTest (hp->PaddrP, if (RIOBoardTest(hp->PaddrP, hp->Caddr, RIO_AT, 0) == RIO_SUCCESS) {
hp->Caddr, RIO_AT, 0) == RIO_SUCCESS) {
/* ... and feeling fine!!!! */ /* ... and feeling fine!!!! */
rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
p->RIOHosts[p->RIONumHosts].UniqueNum);
if (RIOAssignAT(p, hp->PaddrP, hp->Caddr, 0)) { if (RIOAssignAT(p, hp->PaddrP, hp->Caddr, 0)) {
rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, host%d uniqid = %x.\n", rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, host%d uniqid = %x.\n", p->RIONumHosts, p->RIOHosts[p->RIONumHosts - 1].UniqueNum);
p->RIONumHosts,
p->RIOHosts[p->RIONumHosts-1].UniqueNum);
okboard++; okboard++;
found++; found++;
} }
} }
if (!okboard) if (!okboard)
iounmap ((char*) (hp->Caddr)); iounmap((char *) (hp->Caddr));
} }
} }
for (i=0;i<p->RIONumHosts;i++) { for (i = 0; i < p->RIONumHosts; i++) {
hp = &p->RIOHosts[i]; hp = &p->RIOHosts[i];
if (hp->Ivec) { if (hp->Ivec) {
int mode = SA_SHIRQ; int mode = SA_SHIRQ;
if (hp->Ivec & 0x8000) {mode = 0; hp->Ivec &= 0x7fff;} if (hp->Ivec & 0x8000) {
rio_dprintk (RIO_DEBUG_INIT, "Requesting interrupt hp: %p rio_interrupt: %d Mode: %x\n", hp,hp->Ivec, hp->Mode); mode = 0;
retval = request_irq (hp->Ivec, rio_interrupt, mode, "rio", hp); hp->Ivec &= 0x7fff;
rio_dprintk (RIO_DEBUG_INIT, "Return value from request_irq: %d\n", retval); }
rio_dprintk(RIO_DEBUG_INIT, "Requesting interrupt hp: %p rio_interrupt: %d Mode: %x\n", hp, hp->Ivec, hp->Mode);
retval = request_irq(hp->Ivec, rio_interrupt, mode, "rio", hp);
rio_dprintk(RIO_DEBUG_INIT, "Return value from request_irq: %d\n", retval);
if (retval) { if (retval) {
printk(KERN_ERR "rio: Cannot allocate irq %d.\n", hp->Ivec); printk(KERN_ERR "rio: Cannot allocate irq %d.\n", hp->Ivec);
hp->Ivec = 0; hp->Ivec = 0;
} }
rio_dprintk (RIO_DEBUG_INIT, "Got irq %d.\n", hp->Ivec); rio_dprintk(RIO_DEBUG_INIT, "Got irq %d.\n", hp->Ivec);
if (hp->Ivec != 0){ if (hp->Ivec != 0) {
rio_dprintk (RIO_DEBUG_INIT, "Enabling interrupts on rio card.\n"); rio_dprintk(RIO_DEBUG_INIT, "Enabling interrupts on rio card.\n");
hp->Mode |= RIO_PCI_INT_ENABLE; hp->Mode |= RIO_PCI_INT_ENABLE;
} else } else
hp->Mode &= !RIO_PCI_INT_ENABLE; hp->Mode &= !RIO_PCI_INT_ENABLE;
rio_dprintk (RIO_DEBUG_INIT, "New Mode: %x\n", hp->Mode); rio_dprintk(RIO_DEBUG_INIT, "New Mode: %x\n", hp->Mode);
rio_start_card_running (hp); rio_start_card_running(hp);
} }
/* Init the timer "always" to make sure that it can safely be /* Init the timer "always" to make sure that it can safely be
deleted when we unload... */ deleted when we unload... */
init_timer (&hp->timer); init_timer(&hp->timer);
if (!hp->Ivec) { if (!hp->Ivec) {
rio_dprintk (RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_dprintk(RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_poll);
rio_poll);
hp->timer.data = i; hp->timer.data = i;
hp->timer.function = rio_pollfunc; hp->timer.function = rio_pollfunc;
hp->timer.expires = jiffies + rio_poll; hp->timer.expires = jiffies + rio_poll;
add_timer (&hp->timer); add_timer(&hp->timer);
} }
} }
if (found) { if (found) {
rio_dprintk (RIO_DEBUG_INIT, "rio: total of %d boards detected.\n", found); rio_dprintk(RIO_DEBUG_INIT, "rio: total of %d boards detected.\n", found);
rio_init_drivers (); rio_init_drivers();
} else { } else {
/* deregister the misc device we created earlier */ /* deregister the misc device we created earlier */
misc_deregister(&rio_fw_device); misc_deregister(&rio_fw_device);
} }
func_exit(); func_exit();
return found?0:-EIO; return found ? 0 : -EIO;
} }
static void __exit rio_exit (void) static void __exit rio_exit(void)
{ {
int i; int i;
struct Host *hp; struct Host *hp;
func_enter(); func_enter();
for (i=0,hp=p->RIOHosts;i<p->RIONumHosts;i++, hp++) { for (i = 0, hp = p->RIOHosts; i < p->RIONumHosts; i++, hp++) {
RIOHostReset (hp->Type, hp->CardP, hp->Slot); RIOHostReset(hp->Type, hp->CardP, hp->Slot);
if (hp->Ivec) { if (hp->Ivec) {
free_irq (hp->Ivec, hp); free_irq(hp->Ivec, hp);
rio_dprintk (RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec); rio_dprintk(RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec);
} }
/* It is safe/allowed to del_timer a non-active timer */ /* It is safe/allowed to del_timer a non-active timer */
del_timer (&hp->timer); del_timer(&hp->timer);
} }
if (misc_deregister(&rio_fw_device) < 0) { if (misc_deregister(&rio_fw_device) < 0) {
printk (KERN_INFO "rio: couldn't deregister control-device\n"); printk(KERN_INFO "rio: couldn't deregister control-device\n");
} }
rio_dprintk (RIO_DEBUG_CLEANUP, "Cleaning up drivers\n"); rio_dprintk(RIO_DEBUG_CLEANUP, "Cleaning up drivers\n");
rio_release_drivers (); rio_release_drivers();
/* Release dynamically allocated memory */ /* Release dynamically allocated memory */
kfree (p->RIOPortp); kfree(p->RIOPortp);
kfree (p->RIOHosts); kfree(p->RIOHosts);
kfree (p); kfree(p);
func_exit(); func_exit();
} }
...@@ -1368,4 +1333,3 @@ module_exit(rio_exit); ...@@ -1368,4 +1333,3 @@ module_exit(rio_exit);
* tab-width: 8 * tab-width: 8
* End: * End:
*/ */
...@@ -131,27 +131,27 @@ struct vpd_prom { ...@@ -131,27 +131,27 @@ struct vpd_prom {
#ifdef CONFIG_RIO_OLDPCI #ifdef CONFIG_RIO_OLDPCI
static inline void *rio_memcpy_toio (void *dummy, void *dest, void *source, int n) static inline void *rio_memcpy_toio(void *dummy, void *dest, void *source, int n)
{ {
char *dst = dest; char *dst = dest;
char *src = source; char *src = source;
while (n--) { while (n--) {
writeb (*src++, dst++); writeb(*src++, dst++);
(void) readb (dummy); (void) readb(dummy);
} }
return dest; return dest;
} }
static inline void *rio_memcpy_fromio (void *dest, void *source, int n) static inline void *rio_memcpy_fromio(void *dest, void *source, int n)
{ {
char *dst = dest; char *dst = dest;
char *src = source; char *src = source;
while (n--) while (n--)
*dst++ = readb (src++); *dst++ = readb(src++);
return dest; return dest;
} }
...@@ -184,4 +184,3 @@ static inline void *rio_memcpy_fromio (void *dest, void *source, int n) ...@@ -184,4 +184,3 @@ static inline void *rio_memcpy_fromio (void *dest, void *source, int n)
#define func_exit() #define func_exit()
#define func_enter2() #define func_enter2()
#endif #endif
...@@ -83,17 +83,16 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2"; ...@@ -83,17 +83,16 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2";
static struct IdentifyRta IdRta; static struct IdentifyRta IdRta;
static struct KillNeighbour KillUnit; static struct KillNeighbour KillUnit;
int int RIOFoadRta(struct Host *HostP, struct Map *MapP)
RIOFoadRta(struct Host *HostP, struct Map *MapP)
{ {
struct CmdBlk *CmdBlkP; struct CmdBlk *CmdBlkP;
rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA\n"); rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA\n");
CmdBlkP = RIOGetCmdBlk(); CmdBlkP = RIOGetCmdBlk();
if ( !CmdBlkP ) { if (!CmdBlkP) {
rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n"); rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n");
return -ENXIO; return -ENXIO;
} }
...@@ -107,24 +106,23 @@ RIOFoadRta(struct Host *HostP, struct Map *MapP) ...@@ -107,24 +106,23 @@ RIOFoadRta(struct Host *HostP, struct Map *MapP)
CmdBlkP->Packet.data[2] = IFOAD_MAGIC & 0xFF; CmdBlkP->Packet.data[2] = IFOAD_MAGIC & 0xFF;
CmdBlkP->Packet.data[3] = (IFOAD_MAGIC >> 8) & 0xFF; CmdBlkP->Packet.data[3] = (IFOAD_MAGIC >> 8) & 0xFF;
if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n"); rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n");
return -EIO; return -EIO;
} }
return 0; return 0;
} }
int int RIOZombieRta(struct Host *HostP, struct Map *MapP)
RIOZombieRta(struct Host *HostP, struct Map *MapP)
{ {
struct CmdBlk *CmdBlkP; struct CmdBlk *CmdBlkP;
rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA\n"); rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA\n");
CmdBlkP = RIOGetCmdBlk(); CmdBlkP = RIOGetCmdBlk();
if ( !CmdBlkP ) { if (!CmdBlkP) {
rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n"); rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n");
return -ENXIO; return -ENXIO;
} }
...@@ -138,32 +136,30 @@ RIOZombieRta(struct Host *HostP, struct Map *MapP) ...@@ -138,32 +136,30 @@ RIOZombieRta(struct Host *HostP, struct Map *MapP)
CmdBlkP->Packet.data[2] = ZOMBIE_MAGIC & 0xFF; CmdBlkP->Packet.data[2] = ZOMBIE_MAGIC & 0xFF;
CmdBlkP->Packet.data[3] = (ZOMBIE_MAGIC >> 8) & 0xFF; CmdBlkP->Packet.data[3] = (ZOMBIE_MAGIC >> 8) & 0xFF;
if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n"); rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n");
return -EIO; return -EIO;
} }
return 0; return 0;
} }
int int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP))
RIOCommandRta(struct rio_info *p, uint RtaUnique,
int (* func)(struct Host *HostP, struct Map *MapP))
{ {
uint Host; uint Host;
rio_dprintk (RIO_DEBUG_CMD, "Command RTA 0x%x func 0x%x\n", RtaUnique, (int)func); rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%x func 0x%x\n", RtaUnique, (int) func);
if ( !RtaUnique ) if (!RtaUnique)
return(0); return (0);
for ( Host = 0; Host < p->RIONumHosts; Host++ ) { for (Host = 0; Host < p->RIONumHosts; Host++) {
uint Rta; uint Rta;
struct Host *HostP = &p->RIOHosts[Host]; struct Host *HostP = &p->RIOHosts[Host];
for ( Rta = 0; Rta < RTAS_PER_HOST; Rta++ ) { for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) {
struct Map *MapP = &HostP->Mapping[Rta]; struct Map *MapP = &HostP->Mapping[Rta];
if ( MapP->RtaUniqueNum == RtaUnique ) { if (MapP->RtaUniqueNum == RtaUnique) {
uint Link; uint Link;
/* /*
...@@ -173,12 +169,12 @@ RIOCommandRta(struct rio_info *p, uint RtaUnique, ...@@ -173,12 +169,12 @@ RIOCommandRta(struct rio_info *p, uint RtaUnique,
** route *somewhere*. We care not where - if its got ** route *somewhere*. We care not where - if its got
** any connections, we can get to it. ** any connections, we can get to it.
*/ */
for ( Link = 0; Link < LINKS_PER_UNIT; Link++ ) { for (Link = 0; Link < LINKS_PER_UNIT; Link++) {
if ( MapP->Topology[Link].Unit <= (uchar)MAX_RUP ) { if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) {
/* /*
** Its worth trying the operation... ** Its worth trying the operation...
*/ */
return (*func)( HostP, MapP ); return (*func) (HostP, MapP);
} }
} }
} }
...@@ -188,25 +184,24 @@ RIOCommandRta(struct rio_info *p, uint RtaUnique, ...@@ -188,25 +184,24 @@ RIOCommandRta(struct rio_info *p, uint RtaUnique,
} }
int int RIOIdentifyRta(struct rio_info *p, caddr_t arg)
RIOIdentifyRta(struct rio_info *p, caddr_t arg)
{ {
uint Host; uint Host;
if ( copyin( (int)arg, (caddr_t)&IdRta, sizeof(IdRta) ) == COPYFAIL ) { if (copyin((int) arg, (caddr_t) & IdRta, sizeof(IdRta)) == COPYFAIL) {
rio_dprintk (RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n"); rio_dprintk(RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
for ( Host = 0 ; Host < p->RIONumHosts; Host++ ) { for (Host = 0; Host < p->RIONumHosts; Host++) {
uint Rta; uint Rta;
struct Host *HostP = &p->RIOHosts[Host]; struct Host *HostP = &p->RIOHosts[Host];
for ( Rta = 0; Rta < RTAS_PER_HOST; Rta++ ) { for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) {
struct Map *MapP = &HostP->Mapping[Rta]; struct Map *MapP = &HostP->Mapping[Rta];
if ( MapP->RtaUniqueNum == IdRta.RtaUnique ) { if (MapP->RtaUniqueNum == IdRta.RtaUnique) {
uint Link; uint Link;
/* /*
** now, lets just check we have a route to it... ** now, lets just check we have a route to it...
...@@ -215,19 +210,19 @@ RIOIdentifyRta(struct rio_info *p, caddr_t arg) ...@@ -215,19 +210,19 @@ RIOIdentifyRta(struct rio_info *p, caddr_t arg)
** route *somewhere*. We care not where - if its got ** route *somewhere*. We care not where - if its got
** any connections, we can get to it. ** any connections, we can get to it.
*/ */
for ( Link = 0; Link < LINKS_PER_UNIT; Link++ ) { for (Link = 0; Link < LINKS_PER_UNIT; Link++) {
if ( MapP->Topology[Link].Unit <= (uchar)MAX_RUP ) { if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) {
/* /*
** Its worth trying the operation... ** Its worth trying the operation...
*/ */
struct CmdBlk *CmdBlkP; struct CmdBlk *CmdBlkP;
rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA\n"); rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA\n");
CmdBlkP = RIOGetCmdBlk(); CmdBlkP = RIOGetCmdBlk();
if ( !CmdBlkP ) { if (!CmdBlkP) {
rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n"); rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n");
return -ENXIO; return -ENXIO;
} }
...@@ -240,8 +235,8 @@ RIOIdentifyRta(struct rio_info *p, caddr_t arg) ...@@ -240,8 +235,8 @@ RIOIdentifyRta(struct rio_info *p, caddr_t arg)
CmdBlkP->Packet.data[1] = 0; CmdBlkP->Packet.data[1] = 0;
CmdBlkP->Packet.data[2] = IdRta.ID; CmdBlkP->Packet.data[2] = IdRta.ID;
if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n"); rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n");
return -EIO; return -EIO;
} }
return 0; return 0;
...@@ -254,29 +249,28 @@ RIOIdentifyRta(struct rio_info *p, caddr_t arg) ...@@ -254,29 +249,28 @@ RIOIdentifyRta(struct rio_info *p, caddr_t arg)
} }
int int RIOKillNeighbour(struct rio_info *p, caddr_t arg)
RIOKillNeighbour(struct rio_info *p, caddr_t arg)
{ {
uint Host; uint Host;
uint ID; uint ID;
struct Host *HostP; struct Host *HostP;
struct CmdBlk *CmdBlkP; struct CmdBlk *CmdBlkP;
rio_dprintk (RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n"); rio_dprintk(RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n");
if ( copyin( (int)arg, (caddr_t)&KillUnit, sizeof(KillUnit) ) == COPYFAIL ) { if (copyin((int) arg, (caddr_t) & KillUnit, sizeof(KillUnit)) == COPYFAIL) {
rio_dprintk (RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n"); rio_dprintk(RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
if ( KillUnit.Link > 3 ) if (KillUnit.Link > 3)
return -ENXIO; return -ENXIO;
CmdBlkP = RIOGetCmdBlk(); CmdBlkP = RIOGetCmdBlk();
if ( !CmdBlkP ) { if (!CmdBlkP) {
rio_dprintk (RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n"); rio_dprintk(RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n");
return -ENXIO; return -ENXIO;
} }
...@@ -290,45 +284,43 @@ RIOKillNeighbour(struct rio_info *p, caddr_t arg) ...@@ -290,45 +284,43 @@ RIOKillNeighbour(struct rio_info *p, caddr_t arg)
CmdBlkP->Packet.data[2] = UFOAD_MAGIC & 0xFF; CmdBlkP->Packet.data[2] = UFOAD_MAGIC & 0xFF;
CmdBlkP->Packet.data[3] = (UFOAD_MAGIC >> 8) & 0xFF; CmdBlkP->Packet.data[3] = (UFOAD_MAGIC >> 8) & 0xFF;
for ( Host = 0; Host < p->RIONumHosts; Host++ ) { for (Host = 0; Host < p->RIONumHosts; Host++) {
ID = 0; ID = 0;
HostP = &p->RIOHosts[Host]; HostP = &p->RIOHosts[Host];
if ( HostP->UniqueNum == KillUnit.UniqueNum ) { if (HostP->UniqueNum == KillUnit.UniqueNum) {
if ( RIOQueueCmdBlk( HostP, RTAS_PER_HOST+KillUnit.Link, if (RIOQueueCmdBlk(HostP, RTAS_PER_HOST + KillUnit.Link, CmdBlkP) == RIO_FAIL) {
CmdBlkP) == RIO_FAIL ) { rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
return -EIO; return -EIO;
} }
return 0; return 0;
} }
for ( ID=0; ID < RTAS_PER_HOST; ID++ ) { for (ID = 0; ID < RTAS_PER_HOST; ID++) {
if ( HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum ) { if (HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum) {
CmdBlkP->Packet.dest_unit = ID+1; CmdBlkP->Packet.dest_unit = ID + 1;
if ( RIOQueueCmdBlk( HostP, ID, CmdBlkP) == RIO_FAIL ) { if (RIOQueueCmdBlk(HostP, ID, CmdBlkP) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
return -EIO; return -EIO;
} }
return 0; return 0;
} }
} }
} }
RIOFreeCmdBlk( CmdBlkP ); RIOFreeCmdBlk(CmdBlkP);
return -ENXIO; return -ENXIO;
} }
int int RIOSuspendBootRta(struct Host *HostP, int ID, int Link)
RIOSuspendBootRta(struct Host *HostP, int ID, int Link)
{ {
struct CmdBlk *CmdBlkP; struct CmdBlk *CmdBlkP;
rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link); rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link);
CmdBlkP = RIOGetCmdBlk(); CmdBlkP = RIOGetCmdBlk();
if ( !CmdBlkP ) { if (!CmdBlkP) {
rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n"); rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n");
return -ENXIO; return -ENXIO;
} }
...@@ -342,21 +334,20 @@ RIOSuspendBootRta(struct Host *HostP, int ID, int Link) ...@@ -342,21 +334,20 @@ RIOSuspendBootRta(struct Host *HostP, int ID, int Link)
CmdBlkP->Packet.data[2] = IWAIT_MAGIC & 0xFF; CmdBlkP->Packet.data[2] = IWAIT_MAGIC & 0xFF;
CmdBlkP->Packet.data[3] = (IWAIT_MAGIC >> 8) & 0xFF; CmdBlkP->Packet.data[3] = (IWAIT_MAGIC >> 8) & 0xFF;
if ( RIOQueueCmdBlk( HostP, ID - 1, CmdBlkP) == RIO_FAIL ) { if (RIOQueueCmdBlk(HostP, ID - 1, CmdBlkP) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n"); rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n");
return -EIO; return -EIO;
} }
return 0; return 0;
} }
int int RIOFoadWakeup(struct rio_info *p)
RIOFoadWakeup(struct rio_info *p)
{ {
int port; int port;
register struct Port *PortP; register struct Port *PortP;
unsigned long flags; unsigned long flags;
for ( port=0; port<RIO_PORTS; port++) { for (port = 0; port < RIO_PORTS; port++) {
PortP = p->RIOPortp[port]; PortP = p->RIOPortp[port];
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
...@@ -377,16 +368,15 @@ RIOFoadWakeup(struct rio_info *p) ...@@ -377,16 +368,15 @@ RIOFoadWakeup(struct rio_info *p)
PortP->TxBufferOut = 0; PortP->TxBufferOut = 0;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
} }
return(0); return (0);
} }
/* /*
** Incoming command on the COMMAND_RUP to be processed. ** Incoming command on the COMMAND_RUP to be processed.
*/ */
static int static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
{ {
struct PktCmd *PktCmdP = (struct PktCmd *)PacketP->data; struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data;
struct Port *PortP; struct Port *PortP;
struct UnixRup *UnixRupP; struct UnixRup *UnixRupP;
ushort SysPort; ushort SysPort;
...@@ -395,12 +385,12 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) ...@@ -395,12 +385,12 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
ushort subCommand; ushort subCommand;
unsigned long flags; unsigned long flags;
func_enter (); func_enter();
#ifdef CHECK #ifdef CHECK
CheckHost( Host ); CheckHost(Host);
CheckHostP( HostP ); CheckHostP(HostP);
CheckPacketP( PacketP ); CheckPacketP(PacketP);
#endif #endif
/* /*
...@@ -411,88 +401,77 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) ...@@ -411,88 +401,77 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
** we can use PhbNum to get the rup number for the appropriate 8 port ** we can use PhbNum to get the rup number for the appropriate 8 port
** block (for the first block, this should be equal to 'Rup'). ** block (for the first block, this should be equal to 'Rup').
*/ */
rup = RBYTE(PktCmdP->PhbNum) / (ushort)PORTS_PER_RTA; rup = RBYTE(PktCmdP->PhbNum) / (ushort) PORTS_PER_RTA;
UnixRupP = &HostP->UnixRups[rup]; UnixRupP = &HostP->UnixRups[rup];
SysPort = UnixRupP->BaseSysPort + SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA);
(RBYTE(PktCmdP->PhbNum) % (ushort)PORTS_PER_RTA); rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort);
rio_dprintk (RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort);
#ifdef CHECK #ifdef CHECK
CheckRup( rup ); CheckRup(rup);
CheckUnixRupP( UnixRupP ); CheckUnixRupP(UnixRupP);
#endif #endif
if ( UnixRupP->BaseSysPort == NO_PORT ) { if (UnixRupP->BaseSysPort == NO_PORT) {
rio_dprintk (RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n");
rio_dprintk (RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n");
rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", HostP - p->RIOHosts, HostP->Name);
HostP-p->RIOHosts, HostP->Name ); rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup);
rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup);
if (Rup >= (ushort) MAX_RUP) {
if ( Rup >= (ushort)MAX_RUP ) { rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name);
rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n",
HostP->Mapping[Rup].Name);
} else } else
rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name);
('A' + Rup - MAX_RUP), HostP->Name);
rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", PacketP->dest_unit, PacketP->dest_port);
rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", PacketP->src_unit, PacketP->src_port);
PacketP->dest_unit, PacketP->dest_port ); rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", PacketP->len, PacketP->len);
rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control);
PacketP->src_unit, PacketP->src_port ); rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum);
rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", PacketP->len,PacketP->len ); rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command);
rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control);
rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum );
rio_dprintk (RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, "
"Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command );
return TRUE; return TRUE;
} }
#ifdef CHECK #ifdef CHECK
CheckSysPort( SysPort ); CheckSysPort(SysPort);
#endif #endif
PortP = p->RIOPortp[ SysPort ]; PortP = p->RIOPortp[SysPort];
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
switch( RBYTE(PktCmdP->Command) ) { switch (RBYTE(PktCmdP->Command)) {
case BREAK_RECEIVED: case BREAK_RECEIVED:
rio_dprintk (RIO_DEBUG_CMD, "Received a break!\n"); rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n");
/* If the current line disc. is not multi-threading and /* If the current line disc. is not multi-threading and
the current processor is not the default, reset rup_intr the current processor is not the default, reset rup_intr
and return FALSE to ensure that the command packet is and return FALSE to ensure that the command packet is
not freed. */ not freed. */
/* Call tmgr HANGUP HERE */ /* Call tmgr HANGUP HERE */
/* Fix this later when every thing works !!!! RAMRAJ */ /* Fix this later when every thing works !!!! RAMRAJ */
gs_got_break (&PortP->gs); gs_got_break(&PortP->gs);
break; break;
case COMPLETE: case COMPLETE:
rio_dprintk (RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", RBYTE(PktCmdP->PhbNum), HostP - p->RIOHosts);
RBYTE(PktCmdP->PhbNum), HostP-p->RIOHosts);
subCommand = 1; subCommand = 1;
switch (RBYTE(PktCmdP->SubCommand)) { switch (RBYTE(PktCmdP->SubCommand)) {
case MEMDUMP : case MEMDUMP:
rio_dprintk (RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr));
RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr));
break; break;
case READ_REGISTER : case READ_REGISTER:
rio_dprintk (RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr)); rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr));
p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST); p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST);
break; break;
default : default:
subCommand = 0; subCommand = 0;
break; break;
} }
if (subCommand) if (subCommand)
break; break;
rio_dprintk (RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", RBYTE(PktCmdP->PortStatus), PortP->PortState);
RBYTE(PktCmdP->PortStatus),PortP->PortState);
if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) { if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) {
rio_dprintk (RIO_DEBUG_CMD, "Mark status & wakeup\n"); rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n");
PortP->PortState = RBYTE(PktCmdP->PortStatus); PortP->PortState = RBYTE(PktCmdP->PortStatus);
/* What should we do here ... /* What should we do here ...
wakeup( &PortP->PortState ); wakeup( &PortP->PortState );
*/ */
} else } else
rio_dprintk (RIO_DEBUG_CMD, "No change\n"); rio_dprintk(RIO_DEBUG_CMD, "No change\n");
/* FALLTHROUGH */ /* FALLTHROUGH */
case MODEM_STATUS: case MODEM_STATUS:
...@@ -502,21 +481,18 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) ...@@ -502,21 +481,18 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
** it's a convenient place to put them!). ** it's a convenient place to put them!).
*/ */
ReportedModemStatus = RBYTE(PktCmdP->ModemStatus); ReportedModemStatus = RBYTE(PktCmdP->ModemStatus);
if ((PortP->ModemState & MSVR1_HOST) == if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) {
(ReportedModemStatus & MSVR1_HOST)) { rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState);
rio_dprintk (RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState);
/* /*
** Update ModemState just in case tbusy or tstop states have ** Update ModemState just in case tbusy or tstop states have
** changed. ** changed.
*/ */
PortP->ModemState = ReportedModemStatus; PortP->ModemState = ReportedModemStatus;
} } else {
else { rio_dprintk(RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n", PortP->ModemState, ReportedModemStatus);
rio_dprintk (RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n",
PortP->ModemState, ReportedModemStatus);
PortP->ModemState = ReportedModemStatus; PortP->ModemState = ReportedModemStatus;
#ifdef MODEM_SUPPORT #ifdef MODEM_SUPPORT
if ( PortP->Mapped ) { if (PortP->Mapped) {
/***********************************************************\ /***********************************************************\
************************************************************* *************************************************************
*** *** *** ***
...@@ -533,25 +509,24 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) ...@@ -533,25 +509,24 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
if (PortP->gs.tty->termios == NULL) if (PortP->gs.tty->termios == NULL)
break; break;
if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) {
((PortP->State & (RIO_MOPEN|RIO_WOPEN)))) {
rio_dprintk (RIO_DEBUG_CMD, "Is there a Carrier?\n"); rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n");
/* /*
** Is there a carrier? ** Is there a carrier?
*/ */
if ( PortP->ModemState & MSVR1_CD ) { if (PortP->ModemState & MSVR1_CD) {
/* /*
** Has carrier just appeared? ** Has carrier just appeared?
*/ */
if (!(PortP->State & RIO_CARR_ON)) { if (!(PortP->State & RIO_CARR_ON)) {
rio_dprintk (RIO_DEBUG_CMD, "Carrier just came up.\n"); rio_dprintk(RIO_DEBUG_CMD, "Carrier just came up.\n");
PortP->State |= RIO_CARR_ON; PortP->State |= RIO_CARR_ON;
/* /*
** wakeup anyone in WOPEN ** wakeup anyone in WOPEN
*/ */
if (PortP->State & (PORT_ISOPEN | RIO_WOPEN) ) if (PortP->State & (PORT_ISOPEN | RIO_WOPEN))
wake_up_interruptible (&PortP->gs.open_wait); wake_up_interruptible(&PortP->gs.open_wait);
#ifdef STATS #ifdef STATS
PortP->Stat.ModemOnCnt++; PortP->Stat.ModemOnCnt++;
#endif #endif
...@@ -561,10 +536,10 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) ...@@ -561,10 +536,10 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
** Has carrier just dropped? ** Has carrier just dropped?
*/ */
if (PortP->State & RIO_CARR_ON) { if (PortP->State & RIO_CARR_ON) {
if (PortP->State & (PORT_ISOPEN|RIO_WOPEN|RIO_MOPEN)) if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN))
tty_hangup (PortP->gs.tty); tty_hangup(PortP->gs.tty);
PortP->State &= ~RIO_CARR_ON; PortP->State &= ~RIO_CARR_ON;
rio_dprintk (RIO_DEBUG_CMD, "Carrirer just went down\n"); rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n");
#ifdef STATS #ifdef STATS
PortP->Stat.ModemOffCnt++; PortP->Stat.ModemOffCnt++;
#endif #endif
...@@ -577,16 +552,16 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) ...@@ -577,16 +552,16 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
break; break;
default: default:
rio_dprintk (RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", RBYTE(PktCmdP->Command), HostP - p->RIOHosts);
RBYTE(PktCmdP->Command),HostP-p->RIOHosts);
break; break;
} }
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
func_exit (); func_exit();
return TRUE; return TRUE;
} }
/* /*
** The command mechanism: ** The command mechanism:
** Each rup has a chain of commands associated with it. ** 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,12 +575,11 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
/* /*
** Allocate an empty command block. ** Allocate an empty command block.
*/ */
struct CmdBlk * struct CmdBlk *RIOGetCmdBlk(void)
RIOGetCmdBlk(void)
{ {
struct CmdBlk *CmdBlkP; struct CmdBlk *CmdBlkP;
CmdBlkP = (struct CmdBlk *)sysbrk(sizeof(struct CmdBlk)); CmdBlkP = (struct CmdBlk *) sysbrk(sizeof(struct CmdBlk));
if (CmdBlkP) if (CmdBlkP)
bzero(CmdBlkP, sizeof(struct CmdBlk)); bzero(CmdBlkP, sizeof(struct CmdBlk));
...@@ -615,31 +589,29 @@ RIOGetCmdBlk(void) ...@@ -615,31 +589,29 @@ RIOGetCmdBlk(void)
/* /*
** Return a block to the head of the free list. ** Return a block to the head of the free list.
*/ */
void void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP)
RIOFreeCmdBlk(struct CmdBlk *CmdBlkP)
{ {
sysfree((void *)CmdBlkP, sizeof(struct CmdBlk)); sysfree((void *) CmdBlkP, sizeof(struct CmdBlk));
} }
/* /*
** attach a command block to the list of commands to be performed for ** attach a command block to the list of commands to be performed for
** a given rup. ** a given rup.
*/ */
int int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
{ {
struct CmdBlk **Base; struct CmdBlk **Base;
struct UnixRup *UnixRupP; struct UnixRup *UnixRupP;
unsigned long flags; unsigned long flags;
#ifdef CHECK #ifdef CHECK
CheckHostP( HostP ); CheckHostP(HostP);
CheckRup( Rup ); CheckRup(Rup);
CheckCmdBlkP( CmdBlkP ); CheckCmdBlkP(CmdBlkP);
#endif #endif
if ( Rup >= (ushort)(MAX_RUP+LINKS_PER_UNIT) ) { if (Rup >= (ushort) (MAX_RUP + LINKS_PER_UNIT)) {
rio_dprintk (RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n",Rup); rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup);
RIOFreeCmdBlk( CmdBlkP ); RIOFreeCmdBlk(CmdBlkP);
return RIO_FAIL; return RIO_FAIL;
} }
...@@ -651,18 +623,14 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) ...@@ -651,18 +623,14 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
** If the RUP is currently inactive, then put the request ** If the RUP is currently inactive, then put the request
** straight on the RUP.... ** straight on the RUP....
*/ */
if ( (UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP)
(RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE ) && : TRUE)) {
(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP)(CmdBlkP->PreArg,CmdBlkP) rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]);
:TRUE)) {
rio_dprintk (RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n",
CmdBlkP->Packet.data[0]);
/* /*
** Whammy! blat that pack! ** Whammy! blat that pack!
*/ */
HostP->Copy( (caddr_t)&CmdBlkP->Packet, HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt ), sizeof(PKT) );
/* /*
** place command packet on the pending position. ** place command packet on the pending position.
...@@ -672,33 +640,32 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) ...@@ -672,33 +640,32 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
/* /*
** set the command register ** set the command register
*/ */
WWORD(UnixRupP->RupP->txcontrol , TX_PACKET_READY); WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY);
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
return RIO_SUCCESS; return RIO_SUCCESS;
} }
rio_dprintk (RIO_DEBUG_CMD, "RUP active - en-queing\n"); rio_dprintk(RIO_DEBUG_CMD, "RUP active - en-queing\n");
if ( UnixRupP->CmdsWaitingP != NULL) if (UnixRupP->CmdsWaitingP != NULL)
rio_dprintk (RIO_DEBUG_CMD, "Rup active - command waiting\n"); rio_dprintk(RIO_DEBUG_CMD, "Rup active - command waiting\n");
if ( UnixRupP->CmdPendingP != NULL ) if (UnixRupP->CmdPendingP != NULL)
rio_dprintk (RIO_DEBUG_CMD, "Rup active - command pending\n"); rio_dprintk(RIO_DEBUG_CMD, "Rup active - command pending\n");
if ( RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE ) if (RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE)
rio_dprintk (RIO_DEBUG_CMD, "Rup active - command rup not ready\n"); rio_dprintk(RIO_DEBUG_CMD, "Rup active - command rup not ready\n");
Base = &UnixRupP->CmdsWaitingP; Base = &UnixRupP->CmdsWaitingP;
rio_dprintk (RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int)CmdBlkP,(int)Base); rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base);
while ( *Base ) { while (*Base) {
rio_dprintk (RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int)(*Base)); rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int) (*Base));
Base = &((*Base)->NextP); Base = &((*Base)->NextP);
rio_dprintk (RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n", rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base);
(int)CmdBlkP,(int)Base);
} }
rio_dprintk (RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n",(int)CmdBlkP,(int)Base); rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base);
*Base = CmdBlkP; *Base = CmdBlkP;
...@@ -713,8 +680,7 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) ...@@ -713,8 +680,7 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
** Here we go - if there is an empty rup, fill it! ** Here we go - if there is an empty rup, fill it!
** must be called at splrio() or higher. ** must be called at splrio() or higher.
*/ */
void void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
{ {
register struct CmdBlk *CmdBlkP; register struct CmdBlk *CmdBlkP;
register struct UnixRup *UnixRupP; register struct UnixRup *UnixRupP;
...@@ -723,7 +689,7 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP) ...@@ -723,7 +689,7 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
unsigned long flags; unsigned long flags;
Rup = MAX_RUP+LINKS_PER_UNIT; Rup = MAX_RUP + LINKS_PER_UNIT;
do { /* do this loop for each RUP */ do { /* do this loop for each RUP */
/* /*
...@@ -736,20 +702,18 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP) ...@@ -736,20 +702,18 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
/* /*
** First check for incoming commands: ** First check for incoming commands:
*/ */
if ( RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE ) { if (RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) {
int FreeMe; int FreeMe;
PacketP =(PKT *)RIO_PTR(HostP->Caddr,RWORD(UnixRupP->RupP->rxpkt)); PacketP = (PKT *) RIO_PTR(HostP->Caddr, RWORD(UnixRupP->RupP->rxpkt));
ShowPacket( DBG_CMD, PacketP ); ShowPacket(DBG_CMD, PacketP);
switch ( RBYTE(PacketP->dest_port) ) { switch (RBYTE(PacketP->dest_port)) {
case BOOT_RUP: case BOOT_RUP:
rio_dprintk (RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", RBYTE(PacketP->len) & 0x80 ? "Command" : "Data", RBYTE(PacketP->data[0]));
RBYTE(PacketP->len) & 0x80 ? "Command":"Data",
RBYTE(PacketP->data[0]));
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
FreeMe= RIOBootRup(p, Rup,HostP,PacketP); FreeMe = RIOBootRup(p, Rup, HostP, PacketP);
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
break; break;
...@@ -760,38 +724,35 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP) ...@@ -760,38 +724,35 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
** routine that uses the RUP lock. ** routine that uses the RUP lock.
*/ */
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
FreeMe= RIOCommandRup(p, Rup,HostP,PacketP); FreeMe = RIOCommandRup(p, Rup, HostP, PacketP);
if (PacketP->data[5] == MEMDUMP) { if (PacketP->data[5] == MEMDUMP) {
rio_dprintk (RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(ushort *) & (PacketP->data[6]));
*(ushort *) &(PacketP->data[6])); HostP->Copy((caddr_t) & (PacketP->data[8]), (caddr_t) p->RIOMemDump, 32);
HostP->Copy( (caddr_t)&(PacketP->data[8]),
(caddr_t)p->RIOMemDump, 32 );
} }
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
break; break;
case ROUTE_RUP: case ROUTE_RUP:
rio_spin_unlock_irqrestore( &UnixRupP->RupLock, flags); rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
FreeMe = RIORouteRup(p, Rup, HostP, PacketP ); FreeMe = RIORouteRup(p, Rup, HostP, PacketP);
rio_spin_lock_irqsave( &UnixRupP->RupLock, flags ); rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
break; break;
default: default:
rio_dprintk (RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port)); rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port));
FreeMe = 1; FreeMe = 1;
break; break;
} }
if ( FreeMe ) { if (FreeMe) {
rio_dprintk (RIO_DEBUG_CMD, "Free processed incoming command packet\n"); rio_dprintk(RIO_DEBUG_CMD, "Free processed incoming command packet\n");
put_free_end(HostP,PacketP); put_free_end(HostP, PacketP);
WWORD(UnixRupP->RupP->rxcontrol , RX_RUP_INACTIVE); WWORD(UnixRupP->RupP->rxcontrol, RX_RUP_INACTIVE);
if ( RWORD(UnixRupP->RupP->handshake)==PHB_HANDSHAKE_SET ) { if (RWORD(UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) {
rio_dprintk (RIO_DEBUG_CMD, "Handshake rup %d\n",Rup); rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup);
WWORD(UnixRupP->RupP->handshake, WWORD(UnixRupP->RupP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET);
PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET);
} }
} }
} }
...@@ -800,7 +761,7 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP) ...@@ -800,7 +761,7 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
** IF a command was running on the port, ** IF a command was running on the port,
** and it has completed, then tidy it up. ** and it has completed, then tidy it up.
*/ */
if ( (CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */ if ((CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */
(RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
/* /*
** we are idle. ** we are idle.
...@@ -809,19 +770,17 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP) ...@@ -809,19 +770,17 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
** So, wakeup whoever is waiting for it (and tell them ** So, wakeup whoever is waiting for it (and tell them
** what happened). ** what happened).
*/ */
if ( CmdBlkP->Packet.dest_port == BOOT_RUP ) if (CmdBlkP->Packet.dest_port == BOOT_RUP)
rio_dprintk (RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]);
CmdBlkP->Packet.len & 0x80 ? "Command":"Data",
CmdBlkP->Packet.data[0]);
rio_dprintk (RIO_DEBUG_CMD, "Command 0x%x completed\n",(int)CmdBlkP); rio_dprintk(RIO_DEBUG_CMD, "Command 0x%x completed\n", (int) CmdBlkP);
/* /*
** Clear the Rup lock to prevent mutual exclusion. ** Clear the Rup lock to prevent mutual exclusion.
*/ */
if ( CmdBlkP->PostFuncP ) { if (CmdBlkP->PostFuncP) {
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
(*CmdBlkP->PostFuncP) (CmdBlkP->PostArg,CmdBlkP); (*CmdBlkP->PostFuncP) (CmdBlkP->PostArg, CmdBlkP);
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
} }
...@@ -833,39 +792,34 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP) ...@@ -833,39 +792,34 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
/* /*
** ....and return the command block to the freelist. ** ....and return the command block to the freelist.
*/ */
RIOFreeCmdBlk( CmdBlkP ); RIOFreeCmdBlk(CmdBlkP);
} }
/* /*
** If there is a command for this rup, and the rup ** If there is a command for this rup, and the rup
** is idle, then process the command ** is idle, then process the command
*/ */
if ( (CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */ if ((CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */
(UnixRupP->CmdPendingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
(RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
/* /*
** if the pre-function is non-zero, call it. ** if the pre-function is non-zero, call it.
** If it returns RIO_FAIL then don't ** If it returns RIO_FAIL then don't
** send this command yet! ** send this command yet!
*/ */
#ifdef CHECK #ifdef CHECK
CheckCmdBlkP (CmdBlkP); CheckCmdBlkP(CmdBlkP);
#endif #endif
if ( !(CmdBlkP->PreFuncP ? if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) {
(*CmdBlkP->PreFuncP)(CmdBlkP->PreArg, CmdBlkP) : TRUE)) { rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%x\n", (int) CmdBlkP);
rio_dprintk (RIO_DEBUG_CMD, "Not ready to start command 0x%x\n",(int)CmdBlkP); } else {
} rio_dprintk(RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n", (int) CmdBlkP, CmdBlkP->Packet.data[0]);
else {
rio_dprintk (RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n",
(int)CmdBlkP, CmdBlkP->Packet.data[0]);
/* /*
** Whammy! blat that pack! ** Whammy! blat that pack!
*/ */
#ifdef CHECK #ifdef CHECK
CheckPacketP ((PKT *)RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt)); CheckPacketP((PKT *) RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt));
#endif #endif
HostP->Copy( (caddr_t)&CmdBlkP->Packet, HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
/* /*
** remove the command from the rup command queue... ** remove the command from the rup command queue...
...@@ -880,7 +834,7 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP) ...@@ -880,7 +834,7 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
/* /*
** set the command register ** set the command register
*/ */
WWORD(UnixRupP->RupP->txcontrol,TX_PACKET_READY); WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY);
/* /*
** the command block will be freed ** the command block will be freed
...@@ -889,67 +843,64 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP) ...@@ -889,67 +843,64 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
} }
} }
spin_unlock_irqrestore(&UnixRupP->RupLock, flags); spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
} while ( Rup ); } while (Rup);
} }
int int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP)
RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP)
{ {
struct Port * PortP = (struct Port *)iPortP; struct Port *PortP = (struct Port *) iPortP;
unsigned long flags; unsigned long flags;
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
#ifdef CHECK #ifdef CHECK
CheckPortP( PortP ); CheckPortP(PortP);
#endif #endif
PortP->WflushFlag++; PortP->WflushFlag++;
PortP->MagicFlags |= MAGIC_FLUSH; PortP->MagicFlags |= MAGIC_FLUSH;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return RIOUnUse( iPortP, CmdBlkP ); return RIOUnUse(iPortP, CmdBlkP);
} }
int int RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP)
RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP)
{ {
struct Port * PortP = (struct Port *)iPortP; struct Port *PortP = (struct Port *) iPortP;
PKT *PacketP; PKT *PacketP;
unsigned long flags; unsigned long flags;
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
while ( can_remove_receive(&PacketP, PortP) ) { while (can_remove_receive(&PacketP, PortP)) {
remove_receive(PortP); remove_receive(PortP);
ShowPacket(DBG_PROC, PacketP ); ShowPacket(DBG_PROC, PacketP);
put_free_end( PortP->HostP, PacketP ); put_free_end(PortP->HostP, PacketP);
} }
if ( RWORD(PortP->PhbP->handshake)==PHB_HANDSHAKE_SET ) { if (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) {
/* /*
** MAGIC! (Basically, handshake the RX buffer, so that ** MAGIC! (Basically, handshake the RX buffer, so that
** the RTAs upstream can be re-enabled.) ** the RTAs upstream can be re-enabled.)
*/ */
rio_dprintk (RIO_DEBUG_CMD, "Util: Set RX handshake bit\n"); rio_dprintk(RIO_DEBUG_CMD, "Util: Set RX handshake bit\n");
WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET); WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET);
} }
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return RIOUnUse( iPortP, CmdBlkP ); return RIOUnUse(iPortP, CmdBlkP);
} }
int int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP)
RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP)
{ {
struct Port * PortP = (struct Port *)iPortP; struct Port *PortP = (struct Port *) iPortP;
unsigned long flags; unsigned long flags;
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
#ifdef CHECK #ifdef CHECK
CheckPortP( PortP ); CheckPortP(PortP);
#endif #endif
rio_dprintk (RIO_DEBUG_CMD, "Decrement in use count for port\n"); rio_dprintk(RIO_DEBUG_CMD, "Decrement in use count for port\n");
if (PortP->InUse) { if (PortP->InUse) {
if ( --PortP->InUse != NOT_INUSE ) { if (--PortP->InUse != NOT_INUSE) {
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0; return 0;
} }
...@@ -977,8 +928,7 @@ RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP) ...@@ -977,8 +928,7 @@ RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP)
return 0; return 0;
} }
void void ShowPacket(uint Flags, struct PKT *PacketP)
ShowPacket(uint Flags, struct PKT *PacketP)
{ {
} }
......
...@@ -122,37 +122,41 @@ typedef struct ttystatics TERMIO; ...@@ -122,37 +122,41 @@ typedef struct ttystatics TERMIO;
** process to bog off. ** process to bog off.
*/ */
static int static int
(*RIOBootTable[MAX_PRODUCT])(struct rio_info *, struct DownLoad *) = (*RIOBootTable[MAX_PRODUCT]) (struct rio_info *, struct DownLoad *) = {
{ /* 0 */ RIOBootCodeHOST,
/* 0 */ RIOBootCodeHOST, /* Host Card */ /* Host Card */
/* 1 */ RIOBootCodeRTA, /* RTA */ /* 1 */ RIOBootCodeRTA,
/* RTA */
}; };
#define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff)) #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff))
int copyin (int arg, caddr_t dp, int siz) int copyin(int arg, caddr_t dp, int siz)
{ {
int rv; int rv;
rio_dprintk (RIO_DEBUG_CTRL, "Copying %d bytes from user %p to %p.\n", siz, (void *)arg, dp); rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes from user %p to %p.\n", siz, (void *) arg, dp);
rv = copy_from_user (dp, (void *)arg, siz); rv = copy_from_user(dp, (void *) arg, siz);
if (rv) return COPYFAIL; if (rv)
else return rv; return COPYFAIL;
else
return rv;
} }
static int copyout (caddr_t dp, int arg, int siz) static int copyout(caddr_t dp, int arg, int siz)
{ {
int rv; int rv;
rio_dprintk (RIO_DEBUG_CTRL, "Copying %d bytes to user %p from %p.\n", siz, (void *)arg, dp); rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes to user %p from %p.\n", siz, (void *) arg, dp);
rv = copy_to_user ((void *)arg, dp, siz); rv = copy_to_user((void *) arg, dp, siz);
if (rv) return COPYFAIL; if (rv)
else return rv; return COPYFAIL;
else
return rv;
} }
int int riocontrol(p, dev, cmd, arg, su)
riocontrol(p, dev, cmd, arg, su) struct rio_info *p;
struct rio_info * p;
dev_t dev; dev_t dev;
int cmd; int cmd;
caddr_t arg; caddr_t arg;
...@@ -168,13 +172,13 @@ int su; ...@@ -168,13 +172,13 @@ int su;
int retval = 0; int retval = 0;
unsigned long flags; unsigned long flags;
func_enter (); func_enter();
/* Confuse the compiler to think that we've initialized these */ /* Confuse the compiler to think that we've initialized these */
Host=0; Host = 0;
PortP = NULL; PortP = NULL;
rio_dprintk (RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%x\n", cmd, (int)arg); rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%x\n", cmd, (int) arg);
switch (cmd) { switch (cmd) {
/* /*
...@@ -185,22 +189,22 @@ int su; ...@@ -185,22 +189,22 @@ int su;
** otherwise just the specified host card will be changed. ** otherwise just the specified host card will be changed.
*/ */
case RIO_SET_TIMER: case RIO_SET_TIMER:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_TIMER to %dms\n", (uint)arg); rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %dms\n", (uint) arg);
{ {
int host, value; int host, value;
host = (uint)arg >> 16; host = (uint) arg >> 16;
value = (uint)arg & 0x0000ffff; value = (uint) arg & 0x0000ffff;
if (host == -1) { if (host == -1) {
for (host = 0; host < p->RIONumHosts; host++) { for (host = 0; host < p->RIONumHosts; host++) {
if (p->RIOHosts[host].Flags == RC_RUNNING) { if (p->RIOHosts[host].Flags == RC_RUNNING) {
WWORD(p->RIOHosts[host].ParmMapP->timer , value); WWORD(p->RIOHosts[host].ParmMapP->timer, value);
} }
} }
} else if (host >= p->RIONumHosts) { } else if (host >= p->RIONumHosts) {
return -EINVAL; return -EINVAL;
} else { } else {
if ( p->RIOHosts[host].Flags == RC_RUNNING ) { if (p->RIOHosts[host].Flags == RC_RUNNING) {
WWORD(p->RIOHosts[host].ParmMapP->timer , value); WWORD(p->RIOHosts[host].ParmMapP->timer, value);
} }
} }
} }
...@@ -211,9 +215,9 @@ int su; ...@@ -211,9 +215,9 @@ int su;
** 15.10.1998 ARG - ESIL 0760 part fix ** 15.10.1998 ARG - ESIL 0760 part fix
** Added driver ident string output. ** Added driver ident string output.
** **
#ifndef __THIS_RELEASE__ #ifndef __THIS_RELEASE__
#warning Driver Version string not defined ! #warning Driver Version string not defined !
#endif #endif
cprintf("%s %s %s %s\n", cprintf("%s %s %s %s\n",
RIO_DRV_STR, RIO_DRV_STR,
__THIS_RELEASE__, __THIS_RELEASE__,
...@@ -263,44 +267,41 @@ int su; ...@@ -263,44 +267,41 @@ int su;
*/ */
case RIO_FOAD_RTA: case RIO_FOAD_RTA:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n");
return RIOCommandRta(p, (uint)arg, RIOFoadRta); return RIOCommandRta(p, (uint) arg, RIOFoadRta);
case RIO_ZOMBIE_RTA: case RIO_ZOMBIE_RTA:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n");
return RIOCommandRta(p, (uint)arg, RIOZombieRta); return RIOCommandRta(p, (uint) arg, RIOZombieRta);
case RIO_IDENTIFY_RTA: case RIO_IDENTIFY_RTA:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n");
return RIOIdentifyRta(p, arg); return RIOIdentifyRta(p, arg);
case RIO_KILL_NEIGHBOUR: case RIO_KILL_NEIGHBOUR:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n");
return RIOKillNeighbour(p, arg); return RIOKillNeighbour(p, arg);
case SPECIAL_RUP_CMD: case SPECIAL_RUP_CMD:
{ {
struct CmdBlk *CmdBlkP; struct CmdBlk *CmdBlkP;
rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n"); rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n");
if (copyin((int)arg, (caddr_t)&SpecialRupCmd, if (copyin((int) arg, (caddr_t) & SpecialRupCmd, sizeof(SpecialRupCmd)) == COPYFAIL) {
sizeof(SpecialRupCmd)) == COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
CmdBlkP = RIOGetCmdBlk(); CmdBlkP = RIOGetCmdBlk();
if ( !CmdBlkP ) { if (!CmdBlkP) {
rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n"); rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n");
return -ENXIO; return -ENXIO;
} }
CmdBlkP->Packet = SpecialRupCmd.Packet; CmdBlkP->Packet = SpecialRupCmd.Packet;
if ( SpecialRupCmd.Host >= p->RIONumHosts ) if (SpecialRupCmd.Host >= p->RIONumHosts)
SpecialRupCmd.Host = 0; SpecialRupCmd.Host = 0;
rio_dprintk (RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", rio_dprintk(RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", SpecialRupCmd.Host, SpecialRupCmd.RupNum);
SpecialRupCmd.Host, SpecialRupCmd.RupNum); if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) {
if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host],
SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) {
cprintf("FAILED TO QUEUE SPECIAL RUP COMMAND\n"); cprintf("FAILED TO QUEUE SPECIAL RUP COMMAND\n");
} }
return 0; return 0;
...@@ -308,14 +309,14 @@ int su; ...@@ -308,14 +309,14 @@ int su;
case RIO_DEBUG_MEM: case RIO_DEBUG_MEM:
#ifdef DEBUG_MEM_SUPPORT #ifdef DEBUG_MEM_SUPPORT
RIO_DEBUG_CTRL, if (su) RIO_DEBUG_CTRL, if (su)
return rio_RIODebugMemory(RIO_DEBUG_CTRL, arg); return rio_RIODebugMemory(RIO_DEBUG_CTRL, arg);
else else
#endif #endif
return -EPERM; return -EPERM;
case RIO_ALL_MODEM: case RIO_ALL_MODEM:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n");
p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; p->RIOError.Error = IOCTL_COMMAND_UNKNOWN;
return -EINVAL; return -EINVAL;
...@@ -323,44 +324,41 @@ RIO_DEBUG_CTRL, if (su) ...@@ -323,44 +324,41 @@ RIO_DEBUG_CTRL, if (su)
/* /*
** Read the routing table from the device driver to user space ** Read the routing table from the device driver to user space
*/ */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_TABLE\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE\n");
if ((retval = RIOApel(p)) != 0) if ((retval = RIOApel(p)) != 0)
return retval; return retval;
if (copyout((caddr_t)p->RIOConnectTable, (int)arg, if (copyout((caddr_t) p->RIOConnectTable, (int) arg, TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) {
TOTAL_MAP_ENTRIES*sizeof(struct Map)) == COPYFAIL) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
{ {
int entry; int entry;
rio_dprintk (RIO_DEBUG_CTRL, "*****\nMAP ENTRIES\n"); rio_dprintk(RIO_DEBUG_CTRL, "*****\nMAP ENTRIES\n");
for ( entry=0; entry<TOTAL_MAP_ENTRIES; entry++ ) for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
{ if ((p->RIOConnectTable[entry].ID == 0) && (p->RIOConnectTable[entry].HostUniqueNum == 0) && (p->RIOConnectTable[entry].RtaUniqueNum == 0))
if ((p->RIOConnectTable[entry].ID == 0) && continue;
(p->RIOConnectTable[entry].HostUniqueNum == 0) &&
(p->RIOConnectTable[entry].RtaUniqueNum == 0)) continue; rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum);
rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum ); rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum ); rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID ); rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Flags = 0x%x\n", entry, (int) p->RIOConnectTable[entry].Flags);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2 ); rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.SysPort = 0x%x\n", entry, (int) p->RIOConnectTable[entry].SysPort);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Flags = 0x%x\n", entry, (int)p->RIOConnectTable[entry].Flags ); rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Unit);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.SysPort = 0x%x\n", entry, (int)p->RIOConnectTable[entry].SysPort ); rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Link);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[0].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Unit ); rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Unit);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[0].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Link ); rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Link);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[1].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Unit ); rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Unit);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[1].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Link ); rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Link);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[2].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Unit ); rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[3].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Unit);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[2].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Link ); rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[4].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Link);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[3].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Unit ); rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name);
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[4].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Link ); }
rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name ); rio_dprintk(RIO_DEBUG_CTRL, "*****\nEND MAP ENTRIES\n");
}
rio_dprintk (RIO_DEBUG_CTRL, "*****\nEND MAP ENTRIES\n");
} }
p->RIOQuickCheck = NOT_CHANGED; /* a table has been gotten */ p->RIOQuickCheck = NOT_CHANGED; /* a table has been gotten */
return 0; return 0;
...@@ -369,16 +367,15 @@ RIO_DEBUG_CTRL, if (su) ...@@ -369,16 +367,15 @@ RIO_DEBUG_CTRL, if (su)
/* /*
** Write the routing table to the device driver from user space ** Write the routing table to the device driver from user space
*/ */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE\n");
if ( !su ) { if (!su) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return -EPERM; return -EPERM;
} }
if ( copyin((int)arg, (caddr_t)&p->RIOConnectTable[0], if (copyin((int) arg, (caddr_t) & p->RIOConnectTable[0], TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) {
TOTAL_MAP_ENTRIES*sizeof(struct Map) ) == COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
...@@ -411,59 +408,55 @@ RIO_DEBUG_CTRL, if (su) ...@@ -411,59 +408,55 @@ RIO_DEBUG_CTRL, if (su)
*/ */
return RIONewTable(p); return RIONewTable(p);
case RIO_GET_BINDINGS : case RIO_GET_BINDINGS:
/* /*
** Send bindings table, containing unique numbers of RTAs owned ** Send bindings table, containing unique numbers of RTAs owned
** by this system to user space ** by this system to user space
*/ */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS\n");
if ( !su ) if (!su) {
{ rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return -EPERM; return -EPERM;
} }
if (copyout((caddr_t) p->RIOBindTab, (int)arg, if (copyout((caddr_t) p->RIOBindTab, (int) arg, (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) {
(sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
case RIO_PUT_BINDINGS : case RIO_PUT_BINDINGS:
/* /*
** Receive a bindings table, containing unique numbers of RTAs owned ** Receive a bindings table, containing unique numbers of RTAs owned
** by this system ** by this system
*/ */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS\n");
if ( !su ) if (!su) {
{ rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return -EPERM; return -EPERM;
} }
if (copyin((int)arg, (caddr_t)&p->RIOBindTab[0], if (copyin((int) arg, (caddr_t) & p->RIOBindTab[0], (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) {
(sizeof(ulong) * MAX_RTA_BINDINGS))==COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
case RIO_BIND_RTA : case RIO_BIND_RTA:
{ {
int EmptySlot = -1; int EmptySlot = -1;
/* /*
** Bind this RTA to host, so that it will be booted by ** Bind this RTA to host, so that it will be booted by
** host in 'boot owned RTAs' mode. ** host in 'boot owned RTAs' mode.
*/ */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_BIND_RTA\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA\n");
if ( !su ) { if (!su) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return -EPERM; return -EPERM;
} }
...@@ -475,8 +468,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -475,8 +468,7 @@ RIO_DEBUG_CTRL, if (su)
** Already exists - delete ** Already exists - delete
*/ */
p->RIOBindTab[Entry] = 0L; p->RIOBindTab[Entry] = 0L;
rio_dprintk (RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n", rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n", (int) arg);
(int) arg);
return 0; return 0;
} }
} }
...@@ -485,90 +477,85 @@ RIO_DEBUG_CTRL, if (su) ...@@ -485,90 +477,85 @@ RIO_DEBUG_CTRL, if (su)
*/ */
if (EmptySlot != -1) { if (EmptySlot != -1) {
p->RIOBindTab[EmptySlot] = (int) arg; p->RIOBindTab[EmptySlot] = (int) arg;
rio_dprintk (RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n", rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n", (int) arg);
(int) arg); } else {
} rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n", (int) arg);
else {
rio_dprintk (RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n",
(int) arg);
return -ENOMEM; return -ENOMEM;
} }
return 0; return 0;
} }
case RIO_RESUME : case RIO_RESUME:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n");
port = (uint) arg; port = (uint) arg;
if ((port < 0) || (port > 511)) { if ((port < 0) || (port > 511)) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
PortP = p->RIOPortp[port]; PortP = p->RIOPortp[port];
if (!PortP->Mapped) { if (!PortP->Mapped) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port); rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port);
p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM;
return -EINVAL; return -EINVAL;
} }
if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) { if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port); rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port);
return -EINVAL; return -EINVAL;
} }
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RESUME) == if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RESUME) == RIO_FAIL) {
RIO_FAIL) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME failed\n");
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return -EBUSY; return -EBUSY;
} } else {
else { rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port);
rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port);
PortP->State |= RIO_BUSY; PortP->State |= RIO_BUSY;
} }
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return retval; return retval;
case RIO_ASSIGN_RTA: case RIO_ASSIGN_RTA:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA\n");
if ( !su ) { if (!su) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return -EPERM; return -EPERM;
} }
if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt))
== COPYFAIL) { == COPYFAIL) {
rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n"); rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
return RIOAssignRta(p, &MapEnt); return RIOAssignRta(p, &MapEnt);
case RIO_CHANGE_NAME: case RIO_CHANGE_NAME:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_CHANGE_NAME\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME\n");
if ( !su ) { if (!su) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return -EPERM; return -EPERM;
} }
if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt))
== COPYFAIL) { == COPYFAIL) {
rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n"); rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
return RIOChangeName(p, &MapEnt); return RIOChangeName(p, &MapEnt);
case RIO_DELETE_RTA: case RIO_DELETE_RTA:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_DELETE_RTA\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA\n");
if ( !su ) { if (!su) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return -EPERM; return -EPERM;
} }
if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt))
== COPYFAIL ) { == COPYFAIL) {
rio_dprintk (RIO_DEBUG_CTRL, "Copy from data space failed\n"); rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
...@@ -591,21 +578,19 @@ RIO_DEBUG_CTRL, if (su) ...@@ -591,21 +578,19 @@ RIO_DEBUG_CTRL, if (su)
** **
*/ */
if (copyout((caddr_t)&p->RIORtaDisCons,(int)arg, if (copyout((caddr_t) & p->RIORtaDisCons, (int) arg, sizeof(uint)) == COPYFAIL) {
sizeof(uint))==COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
case RIO_LAST_ERROR: case RIO_LAST_ERROR:
if (copyout((caddr_t)&p->RIOError, (int)arg, if (copyout((caddr_t) & p->RIOError, (int) arg, sizeof(struct Error)) == COPYFAIL)
sizeof(struct Error)) ==COPYFAIL )
return -EFAULT; return -EFAULT;
return 0; return 0;
case RIO_GET_LOG: case RIO_GET_LOG:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_LOG\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_LOG\n");
#ifdef LOGGING #ifdef LOGGING
RIOGetLog(arg); RIOGetLog(arg);
return 0; return 0;
...@@ -614,23 +599,19 @@ RIO_DEBUG_CTRL, if (su) ...@@ -614,23 +599,19 @@ RIO_DEBUG_CTRL, if (su)
#endif #endif
case RIO_GET_MODTYPE: case RIO_GET_MODTYPE:
if ( copyin( (int)arg, (caddr_t)&port, if (copyin((int) arg, (caddr_t) & port, sizeof(uint)) == COPYFAIL) {
sizeof(uint)) == COPYFAIL )
{
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Get module type for port %d\n", port); rio_dprintk(RIO_DEBUG_CTRL, "Get module type for port %d\n", port);
if ( port < 0 || port > 511 ) if (port < 0 || port > 511) {
{ rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port);
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
PortP = (p->RIOPortp[port]); PortP = (p->RIOPortp[port]);
if (!PortP->Mapped) if (!PortP->Mapped) {
{ rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port);
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port);
p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM;
return -EINVAL; return -EINVAL;
} }
...@@ -638,12 +619,11 @@ RIO_DEBUG_CTRL, if (su) ...@@ -638,12 +619,11 @@ RIO_DEBUG_CTRL, if (su)
** Return module type of port ** Return module type of port
*/ */
port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes; port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes;
if (copyout((caddr_t)&port, (int)arg, if (copyout((caddr_t) & port, (int) arg, sizeof(uint)) == COPYFAIL) {
sizeof(uint)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
return(0); return (0);
/* /*
** 02.03.1999 ARG - ESIL 0820 fix ** 02.03.1999 ARG - ESIL 0820 fix
** We are no longer using "Boot Mode", so these ioctls ** We are no longer using "Boot Mode", so these ioctls
...@@ -670,8 +650,8 @@ RIO_DEBUG_CTRL, if (su) ...@@ -670,8 +650,8 @@ RIO_DEBUG_CTRL, if (su)
*/ */
case RIO_BLOCK_OPENS: case RIO_BLOCK_OPENS:
rio_dprintk (RIO_DEBUG_CTRL, "Opens block until booted\n"); rio_dprintk(RIO_DEBUG_CTRL, "Opens block until booted\n");
for ( Entry=0; Entry < RIO_PORTS; Entry++ ) { for (Entry = 0; Entry < RIO_PORTS; Entry++) {
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
p->RIOPortp[Entry]->WaitUntilBooted = 1; p->RIOPortp[Entry]->WaitUntilBooted = 1;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
...@@ -679,44 +659,42 @@ RIO_DEBUG_CTRL, if (su) ...@@ -679,44 +659,42 @@ RIO_DEBUG_CTRL, if (su)
return 0; return 0;
case RIO_SETUP_PORTS: case RIO_SETUP_PORTS:
rio_dprintk (RIO_DEBUG_CTRL, "Setup ports\n"); rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n");
if (copyin((int)arg, (caddr_t)&PortSetup, sizeof(PortSetup)) if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup))
== COPYFAIL ) { == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "EFAULT"); rio_dprintk(RIO_DEBUG_CTRL, "EFAULT");
return -EFAULT; return -EFAULT;
} }
if ( PortSetup.From > PortSetup.To || if (PortSetup.From > PortSetup.To || PortSetup.To >= RIO_PORTS) {
PortSetup.To >= RIO_PORTS ) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
rio_dprintk (RIO_DEBUG_CTRL, "ENXIO"); rio_dprintk(RIO_DEBUG_CTRL, "ENXIO");
return -ENXIO; return -ENXIO;
} }
if ( PortSetup.XpCps > p->RIOConf.MaxXpCps || if (PortSetup.XpCps > p->RIOConf.MaxXpCps || PortSetup.XpCps < p->RIOConf.MinXpCps) {
PortSetup.XpCps < p->RIOConf.MinXpCps ) {
p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE; p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE;
rio_dprintk (RIO_DEBUG_CTRL, "EINVAL"); rio_dprintk(RIO_DEBUG_CTRL, "EINVAL");
return -EINVAL; return -EINVAL;
} }
if ( !p->RIOPortp ) { if (!p->RIOPortp) {
cprintf("No p->RIOPortp array!\n"); cprintf("No p->RIOPortp array!\n");
rio_dprintk (RIO_DEBUG_CTRL, "No p->RIOPortp array!\n"); rio_dprintk(RIO_DEBUG_CTRL, "No p->RIOPortp array!\n");
return -EIO; return -EIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To); rio_dprintk(RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To);
for (loop=PortSetup.From; loop<=PortSetup.To; loop++) { for (loop = PortSetup.From; loop <= PortSetup.To; loop++) {
rio_dprintk (RIO_DEBUG_CTRL, "in loop (%d)!\n", loop); rio_dprintk(RIO_DEBUG_CTRL, "in loop (%d)!\n", loop);
#if 0 #if 0
PortP = p->RIOPortp[loop]; PortP = p->RIOPortp[loop];
if ( !PortP->TtyP ) if (!PortP->TtyP)
PortP->TtyP = &p->channel[loop]; PortP->TtyP = &p->channel[loop];
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
if ( PortSetup.IxAny ) if (PortSetup.IxAny)
PortP->Config |= RIO_IXANY; PortP->Config |= RIO_IXANY;
else else
PortP->Config &= ~RIO_IXANY; PortP->Config &= ~RIO_IXANY;
if ( PortSetup.IxOn ) if (PortSetup.IxOn)
PortP->Config |= RIO_IXON; PortP->Config |= RIO_IXON;
else else
PortP->Config &= ~RIO_IXON; PortP->Config &= ~RIO_IXON;
...@@ -734,74 +712,63 @@ RIO_DEBUG_CTRL, if (su) ...@@ -734,74 +712,63 @@ RIO_DEBUG_CTRL, if (su)
** Store settings if locking or unlocking port or if the ** Store settings if locking or unlocking port or if the
** port is not locked, when setting the store option. ** port is not locked, when setting the store option.
*/ */
if (PortP->Mapped && if (PortP->Mapped && ((PortSetup.Lock && !PortP->Lock) || (!PortP->Lock && (PortSetup.Store && !PortP->Store)))) {
((PortSetup.Lock && !PortP->Lock) ||
(!PortP->Lock &&
(PortSetup.Store && !PortP->Store)))) {
PortP->StoredTty.iflag = PortP->TtyP->tm.c_iflag; PortP->StoredTty.iflag = PortP->TtyP->tm.c_iflag;
PortP->StoredTty.oflag = PortP->TtyP->tm.c_oflag; PortP->StoredTty.oflag = PortP->TtyP->tm.c_oflag;
PortP->StoredTty.cflag = PortP->TtyP->tm.c_cflag; PortP->StoredTty.cflag = PortP->TtyP->tm.c_cflag;
PortP->StoredTty.lflag = PortP->TtyP->tm.c_lflag; PortP->StoredTty.lflag = PortP->TtyP->tm.c_lflag;
PortP->StoredTty.line = PortP->TtyP->tm.c_line; PortP->StoredTty.line = PortP->TtyP->tm.c_line;
bcopy(PortP->TtyP->tm.c_cc, PortP->StoredTty.cc, bcopy(PortP->TtyP->tm.c_cc, PortP->StoredTty.cc, NCC + 5);
NCC + 5);
} }
PortP->Lock = PortSetup.Lock; PortP->Lock = PortSetup.Lock;
PortP->Store = PortSetup.Store; PortP->Store = PortSetup.Store;
PortP->Xprint.XpCps = PortSetup.XpCps; PortP->Xprint.XpCps = PortSetup.XpCps;
bcopy(PortSetup.XpOn,PortP->Xprint.XpOn,MAX_XP_CTRL_LEN); bcopy(PortSetup.XpOn, PortP->Xprint.XpOn, MAX_XP_CTRL_LEN);
bcopy(PortSetup.XpOff,PortP->Xprint.XpOff,MAX_XP_CTRL_LEN); bcopy(PortSetup.XpOff, PortP->Xprint.XpOff, MAX_XP_CTRL_LEN);
PortP->Xprint.XpOn[MAX_XP_CTRL_LEN-1] = '\0'; PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
PortP->Xprint.XpOff[MAX_XP_CTRL_LEN-1] = '\0'; PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn)+ PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn) + RIOStrlen(PortP->Xprint.XpOff);
RIOStrlen(PortP->Xprint.XpOff); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
rio_spin_unlock_irqrestore( &PortP->portSem , flags);
#endif #endif
} }
rio_dprintk (RIO_DEBUG_CTRL, "after loop (%d)!\n", loop); rio_dprintk(RIO_DEBUG_CTRL, "after loop (%d)!\n", loop);
rio_dprintk (RIO_DEBUG_CTRL, "Retval:%x\n", retval); rio_dprintk(RIO_DEBUG_CTRL, "Retval:%x\n", retval);
return retval; return retval;
case RIO_GET_PORT_SETUP : case RIO_GET_PORT_SETUP:
rio_dprintk (RIO_DEBUG_CTRL, "Get port setup\n"); rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n");
if (copyin((int)arg, (caddr_t)&PortSetup, sizeof(PortSetup)) if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup))
== COPYFAIL ) { == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
if ( PortSetup.From >= RIO_PORTS ) { if (PortSetup.From >= RIO_PORTS) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -ENXIO; return -ENXIO;
} }
port = PortSetup.To = PortSetup.From; port = PortSetup.To = PortSetup.From;
PortSetup.IxAny = (p->RIOPortp[port]->Config & RIO_IXANY) ? PortSetup.IxAny = (p->RIOPortp[port]->Config & RIO_IXANY) ? 1 : 0;
1 : 0; PortSetup.IxOn = (p->RIOPortp[port]->Config & RIO_IXON) ? 1 : 0;
PortSetup.IxOn = (p->RIOPortp[port]->Config & RIO_IXON) ? PortSetup.Drain = (p->RIOPortp[port]->Config & RIO_WAITDRAIN) ? 1 : 0;
1 : 0;
PortSetup.Drain = (p->RIOPortp[port]->Config & RIO_WAITDRAIN) ?
1 : 0;
PortSetup.Store = p->RIOPortp[port]->Store; PortSetup.Store = p->RIOPortp[port]->Store;
PortSetup.Lock = p->RIOPortp[port]->Lock; PortSetup.Lock = p->RIOPortp[port]->Lock;
PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps; PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps;
bcopy(p->RIOPortp[port]->Xprint.XpOn, PortSetup.XpOn, bcopy(p->RIOPortp[port]->Xprint.XpOn, PortSetup.XpOn, MAX_XP_CTRL_LEN);
MAX_XP_CTRL_LEN); bcopy(p->RIOPortp[port]->Xprint.XpOff, PortSetup.XpOff, MAX_XP_CTRL_LEN);
bcopy(p->RIOPortp[port]->Xprint.XpOff, PortSetup.XpOff, PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
MAX_XP_CTRL_LEN); PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
PortSetup.XpOn[MAX_XP_CTRL_LEN-1] = '\0';
PortSetup.XpOff[MAX_XP_CTRL_LEN-1] = '\0'; if (copyout((caddr_t) & PortSetup, (int) arg, sizeof(PortSetup))
== COPYFAIL) {
if ( copyout((caddr_t)&PortSetup,(int)arg,sizeof(PortSetup))
==COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
return retval; return retval;
case RIO_GET_PORT_PARAMS : case RIO_GET_PORT_PARAMS:
rio_dprintk (RIO_DEBUG_CTRL, "Get port params\n"); rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n");
if (copyin( (int)arg, (caddr_t)&PortParams, if (copyin((int) arg, (caddr_t) & PortParams, sizeof(struct PortParams)) == COPYFAIL) {
sizeof(struct PortParams)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
...@@ -812,28 +779,27 @@ RIO_DEBUG_CTRL, if (su) ...@@ -812,28 +779,27 @@ RIO_DEBUG_CTRL, if (su)
PortP = (p->RIOPortp[PortParams.Port]); PortP = (p->RIOPortp[PortParams.Port]);
PortParams.Config = PortP->Config; PortParams.Config = PortP->Config;
PortParams.State = PortP->State; PortParams.State = PortP->State;
rio_dprintk (RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port); rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port);
if (copyout((caddr_t)&PortParams, (int)arg, if (copyout((caddr_t) & PortParams, (int) arg, sizeof(struct PortParams)) == COPYFAIL) {
sizeof(struct PortParams)) == COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
return retval; return retval;
case RIO_GET_PORT_TTY : case RIO_GET_PORT_TTY:
rio_dprintk (RIO_DEBUG_CTRL, "Get port tty\n"); rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n");
if (copyin((int)arg, (caddr_t)&PortTty, sizeof(struct PortTty)) if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty))
== COPYFAIL) { == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
if ( PortTty.port >= RIO_PORTS ) { if (PortTty.port >= RIO_PORTS) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port);
PortP = (p->RIOPortp[PortTty.port]); PortP = (p->RIOPortp[PortTty.port]);
#if 0 #if 0
PortTty.Tty.tm.c_iflag = PortP->TtyP->tm.c_iflag; PortTty.Tty.tm.c_iflag = PortP->TtyP->tm.c_iflag;
...@@ -841,20 +807,18 @@ RIO_DEBUG_CTRL, if (su) ...@@ -841,20 +807,18 @@ RIO_DEBUG_CTRL, if (su)
PortTty.Tty.tm.c_cflag = PortP->TtyP->tm.c_cflag; PortTty.Tty.tm.c_cflag = PortP->TtyP->tm.c_cflag;
PortTty.Tty.tm.c_lflag = PortP->TtyP->tm.c_lflag; PortTty.Tty.tm.c_lflag = PortP->TtyP->tm.c_lflag;
#endif #endif
if (copyout((caddr_t)&PortTty, (int)arg, if (copyout((caddr_t) & PortTty, (int) arg, sizeof(struct PortTty)) == COPYFAIL) {
sizeof(struct PortTty)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
return retval; return retval;
case RIO_SET_PORT_TTY : case RIO_SET_PORT_TTY:
if (copyin((int)arg, (caddr_t)&PortTty, if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty)) == COPYFAIL) {
sizeof(struct PortTty)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port); rio_dprintk(RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port);
if (PortTty.port >= (ushort) RIO_PORTS) { if (PortTty.port >= (ushort) RIO_PORTS) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -ENXIO; return -ENXIO;
...@@ -866,16 +830,16 @@ RIO_DEBUG_CTRL, if (su) ...@@ -866,16 +830,16 @@ RIO_DEBUG_CTRL, if (su)
PortP->TtyP->tm.c_oflag = PortTty.Tty.tm.c_oflag; PortP->TtyP->tm.c_oflag = PortTty.Tty.tm.c_oflag;
PortP->TtyP->tm.c_cflag = PortTty.Tty.tm.c_cflag; PortP->TtyP->tm.c_cflag = PortTty.Tty.tm.c_cflag;
PortP->TtyP->tm.c_lflag = PortTty.Tty.tm.c_lflag; PortP->TtyP->tm.c_lflag = PortTty.Tty.tm.c_lflag;
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
#endif #endif
RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP); RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP);
return retval; return retval;
case RIO_SET_PORT_PARAMS : case RIO_SET_PORT_PARAMS:
rio_dprintk (RIO_DEBUG_CTRL, "Set port params\n"); rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n");
if ( copyin((int)arg, (caddr_t)&PortParams, sizeof(PortParams)) if (copyin((int) arg, (caddr_t) & PortParams, sizeof(PortParams))
== COPYFAIL ) { == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
...@@ -886,17 +850,16 @@ RIO_DEBUG_CTRL, if (su) ...@@ -886,17 +850,16 @@ RIO_DEBUG_CTRL, if (su)
PortP = (p->RIOPortp[PortParams.Port]); PortP = (p->RIOPortp[PortParams.Port]);
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
PortP->Config = PortParams.Config; PortP->Config = PortParams.Config;
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return retval; return retval;
case RIO_GET_PORT_STATS : case RIO_GET_PORT_STATS:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n");
if ( copyin((int)arg, (caddr_t)&portStats, if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) {
sizeof(struct portStats)) == COPYFAIL ) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
if ( portStats.port >= RIO_PORTS ) { if (portStats.port >= RIO_PORTS) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -ENXIO; return -ENXIO;
} }
...@@ -907,17 +870,16 @@ RIO_DEBUG_CTRL, if (su) ...@@ -907,17 +870,16 @@ RIO_DEBUG_CTRL, if (su)
portStats.opens = PortP->opens; portStats.opens = PortP->opens;
portStats.closes = PortP->closes; portStats.closes = PortP->closes;
portStats.ioctls = PortP->ioctls; portStats.ioctls = PortP->ioctls;
if ( copyout((caddr_t)&portStats, (int)arg, if (copyout((caddr_t) & portStats, (int) arg, sizeof(struct portStats)) == COPYFAIL) {
sizeof(struct portStats)) == COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
return retval; return retval;
case RIO_RESET_PORT_STATS : case RIO_RESET_PORT_STATS:
port = (uint) arg; port = (uint) arg;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n");
if ( port >= RIO_PORTS ) { if (port >= RIO_PORTS) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -ENXIO; return -ENXIO;
} }
...@@ -931,77 +893,73 @@ RIO_DEBUG_CTRL, if (su) ...@@ -931,77 +893,73 @@ RIO_DEBUG_CTRL, if (su)
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return retval; return retval;
case RIO_GATHER_PORT_STATS : case RIO_GATHER_PORT_STATS:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n");
if ( copyin( (int)arg, (caddr_t)&portStats, if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) {
sizeof(struct portStats)) == COPYFAIL ) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
if ( portStats.port >= RIO_PORTS ) { if (portStats.port >= RIO_PORTS) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -ENXIO; return -ENXIO;
} }
PortP = (p->RIOPortp[portStats.port]); PortP = (p->RIOPortp[portStats.port]);
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
PortP->statsGather = portStats.gather; PortP->statsGather = portStats.gather;
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return retval; return retval;
#ifdef DEBUG_SUPPORTED #ifdef DEBUG_SUPPORTED
case RIO_READ_LEVELS: case RIO_READ_LEVELS:
{ {
int num; int num;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_LEVELS\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_LEVELS\n");
for ( num=0; RIODbInf[num].Flag; num++ ) ; for (num = 0; RIODbInf[num].Flag; num++);
rio_dprintk (RIO_DEBUG_CTRL, "%d levels to copy\n",num); rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copy\n", num);
if (copyout((caddr_t)RIODbInf,(int)arg, if (copyout((caddr_t) RIODbInf, (int) arg, sizeof(struct DbInf) * (num + 1)) == COPYFAIL) {
sizeof(struct DbInf)*(num+1))==COPYFAIL) { rio_dprintk(RIO_DEBUG_CTRL, "ReadLevels Copy failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "ReadLevels Copy failed\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_CTRL, "%d levels to copied\n",num); rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copied\n", num);
return retval; return retval;
} }
#endif #endif
case RIO_READ_CONFIG: case RIO_READ_CONFIG:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n");
if (copyout((caddr_t)&p->RIOConf, (int)arg, if (copyout((caddr_t) & p->RIOConf, (int) arg, sizeof(struct Conf)) == COPYFAIL) {
sizeof(struct Conf)) ==COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
return retval; return retval;
case RIO_SET_CONFIG: case RIO_SET_CONFIG:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n");
if ( !su ) { if (!su) {
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return -EPERM; return -EPERM;
} }
if ( copyin((int)arg, (caddr_t)&p->RIOConf, sizeof(struct Conf) ) if (copyin((int) arg, (caddr_t) & p->RIOConf, sizeof(struct Conf))
==COPYFAIL ) { == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
/* /*
** move a few value around ** move a few value around
*/ */
for (Host=0; Host < p->RIONumHosts; Host++) for (Host = 0; Host < p->RIONumHosts; Host++)
if ( (p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING ) if ((p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING)
WWORD(p->RIOHosts[Host].ParmMapP->timer , WWORD(p->RIOHosts[Host].ParmMapP->timer, p->RIOConf.Timer);
p->RIOConf.Timer);
return retval; return retval;
case RIO_START_POLLER: case RIO_START_POLLER:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_START_POLLER\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_START_POLLER\n");
return -EINVAL; return -EINVAL;
case RIO_STOP_POLLER: case RIO_STOP_POLLER:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n");
if ( !su ) { if (!su) {
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return -EPERM; return -EPERM;
} }
...@@ -1010,62 +968,49 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1010,62 +968,49 @@ RIO_DEBUG_CTRL, if (su)
case RIO_SETDEBUG: case RIO_SETDEBUG:
case RIO_GETDEBUG: case RIO_GETDEBUG:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n");
if ( copyin( (int)arg, (caddr_t)&DebugCtrl, sizeof(DebugCtrl) ) if (copyin((int) arg, (caddr_t) & DebugCtrl, sizeof(DebugCtrl))
==COPYFAIL ) { == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
if ( DebugCtrl.SysPort == NO_PORT ) { if (DebugCtrl.SysPort == NO_PORT) {
if ( cmd == RIO_SETDEBUG ) { if (cmd == RIO_SETDEBUG) {
if ( !su ) { if (!su) {
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return -EPERM; return -EPERM;
} }
p->rio_debug = DebugCtrl.Debug; p->rio_debug = DebugCtrl.Debug;
p->RIODebugWait = DebugCtrl.Wait; p->RIODebugWait = DebugCtrl.Wait;
rio_dprintk (RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 0x%x\n", rio_dprintk(RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 0x%x\n", p->rio_debug, p->RIODebugWait);
p->rio_debug,p->RIODebugWait); } else {
} rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait);
else {
rio_dprintk (RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n",
p->rio_debug,p->RIODebugWait);
DebugCtrl.Debug = p->rio_debug; DebugCtrl.Debug = p->rio_debug;
DebugCtrl.Wait = p->RIODebugWait; DebugCtrl.Wait = p->RIODebugWait;
if ( copyout((caddr_t)&DebugCtrl,(int)arg, if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) {
sizeof(DebugCtrl)) == COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort);
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n",
DebugCtrl.SysPort);
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
} }
} } else if (DebugCtrl.SysPort >= RIO_PORTS && DebugCtrl.SysPort != NO_PORT) {
else if ( DebugCtrl.SysPort >= RIO_PORTS && rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort);
DebugCtrl.SysPort != NO_PORT ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n",
DebugCtrl.SysPort);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -ENXIO; return -ENXIO;
} } else if (cmd == RIO_SETDEBUG) {
else if ( cmd == RIO_SETDEBUG ) { if (!su) {
if ( !su ) {
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return -EPERM; return -EPERM;
} }
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug; p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug;
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SETDEBUG 0x%x\n", rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug);
p->RIOPortp[DebugCtrl.SysPort]->Debug); } else {
} rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug);
else {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n",
p->RIOPortp[DebugCtrl.SysPort]->Debug);
DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug; DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug;
if ( copyout((caddr_t)&DebugCtrl,(int)arg, if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) {
sizeof(DebugCtrl))==COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
...@@ -1078,12 +1023,9 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1078,12 +1023,9 @@ RIO_DEBUG_CTRL, if (su)
** We return MAX_VERSION_LEN bytes, being a ** We return MAX_VERSION_LEN bytes, being a
** textual null terminated string. ** textual null terminated string.
*/ */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_VERSID\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n");
if ( copyout( (caddr_t)RIOVersid(), if (copyout((caddr_t) RIOVersid(), (int) arg, sizeof(struct rioVersion)) == COPYFAIL) {
(int)arg, rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host);
sizeof(struct rioVersion) ) == COPYFAIL )
{
rio_dprintk (RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host);
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
...@@ -1117,10 +1059,9 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1117,10 +1059,9 @@ RIO_DEBUG_CTRL, if (su)
** Enquire as to the number of hosts located ** Enquire as to the number of hosts located
** at init time. ** at init time.
*/ */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n");
if (copyout((caddr_t)&p->RIONumHosts, (int)arg, if (copyout((caddr_t) & p->RIONumHosts, (int) arg, sizeof(p->RIONumHosts)) == COPYFAIL) {
sizeof(p->RIONumHosts) )==COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
...@@ -1130,22 +1071,18 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1130,22 +1071,18 @@ RIO_DEBUG_CTRL, if (su)
/* /*
** Kill host. This may not be in the final version... ** Kill host. This may not be in the final version...
*/ */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_FOAD %d\n", (int)arg); rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %d\n", (int) arg);
if ( !su ) { if (!su) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return -EPERM; return -EPERM;
} }
p->RIOHalted = 1; p->RIOHalted = 1;
p->RIOSystemUp = 0; p->RIOSystemUp = 0;
for ( Host=0; Host<p->RIONumHosts; Host++ ) { for (Host = 0; Host < p->RIONumHosts; Host++) {
(void)RIOBoardTest( p->RIOHosts[Host].PaddrP, (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot);
p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, bzero((caddr_t) & p->RIOHosts[Host].Flags, ((int) &p->RIOHosts[Host].____end_marker____) - ((int) &p->RIOHosts[Host].Flags));
p->RIOHosts[Host].Slot );
bzero( (caddr_t)&p->RIOHosts[Host].Flags,
((int)&p->RIOHosts[Host].____end_marker____) -
((int)&p->RIOHosts[Host].Flags) );
p->RIOHosts[Host].Flags = RC_WAITING; p->RIOHosts[Host].Flags = RC_WAITING;
#if 0 #if 0
RIOSetupDataStructs(p); RIOSetupDataStructs(p);
...@@ -1156,18 +1093,17 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1156,18 +1093,17 @@ RIO_DEBUG_CTRL, if (su)
p->RIOBooting = 0; p->RIOBooting = 0;
#ifdef RINGBUFFER_SUPPORT #ifdef RINGBUFFER_SUPPORT
for( loop=0; loop<RIO_PORTS; loop++ ) for (loop = 0; loop < RIO_PORTS; loop++)
if ( p->RIOPortp[loop]->TxRingBuffer ) if (p->RIOPortp[loop]->TxRingBuffer)
sysfree((void *)p->RIOPortp[loop]->TxRingBuffer, sysfree((void *) p->RIOPortp[loop]->TxRingBuffer, RIOBufferSize);
RIOBufferSize );
#endif #endif
#if 0 #if 0
bzero((caddr_t)&p->RIOPortp[0],RIO_PORTS*sizeof(struct Port)); bzero((caddr_t) & p->RIOPortp[0], RIO_PORTS * sizeof(struct Port));
#else #else
printk ("HEEEEELP!\n"); printk("HEEEEELP!\n");
#endif #endif
for( loop=0; loop<RIO_PORTS; loop++ ) { for (loop = 0; loop < RIO_PORTS; loop++) {
#if 0 #if 0
p->RIOPortp[loop]->TtyP = &p->channel[loop]; p->RIOPortp[loop]->TtyP = &p->channel[loop];
#endif #endif
...@@ -1180,34 +1116,31 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1180,34 +1116,31 @@ RIO_DEBUG_CTRL, if (su)
return retval; return retval;
case RIO_DOWNLOAD: case RIO_DOWNLOAD:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD\n");
if ( !su ) { if (!su) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return -EPERM; return -EPERM;
} }
if ( copyin((int)arg, (caddr_t)&DownLoad, if (copyin((int) arg, (caddr_t) & DownLoad, sizeof(DownLoad)) == COPYFAIL) {
sizeof(DownLoad) )==COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n", rio_dprintk(RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n", DownLoad.ProductCode);
DownLoad.ProductCode);
/* /*
** It is important that the product code is an unsigned object! ** It is important that the product code is an unsigned object!
*/ */
if ( DownLoad.ProductCode > MAX_PRODUCT ) { if (DownLoad.ProductCode > MAX_PRODUCT) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", DownLoad.ProductCode);
DownLoad.ProductCode);
p->RIOError.Error = NO_SUCH_PRODUCT; p->RIOError.Error = NO_SUCH_PRODUCT;
return -ENXIO; return -ENXIO;
} }
/* /*
** do something! ** do something!
*/ */
retval = (*(RIOBootTable[DownLoad.ProductCode]))(p, &DownLoad); retval = (*(RIOBootTable[DownLoad.ProductCode])) (p, &DownLoad);
/* <-- Panic */ /* <-- Panic */
p->RIOHalted = 0; p->RIOHalted = 0;
/* /*
...@@ -1219,98 +1152,86 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1219,98 +1152,86 @@ RIO_DEBUG_CTRL, if (su)
{ {
uint host; uint host;
if (copyin((int)arg, (caddr_t)&host, if (copyin((int) arg, (caddr_t) & host, sizeof(host)) == COPYFAIL) {
sizeof(host) ) == COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
rio_dprintk (RIO_DEBUG_CTRL,
"RIO_HOST_REQ: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
/* /*
** Fetch the parmmap ** Fetch the parmmap
*/ */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_PARMS\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n");
if ( copyout( (caddr_t)p->RIOHosts[host].ParmMapP, if (copyout((caddr_t) p->RIOHosts[host].ParmMapP, (int) arg, sizeof(PARM_MAP)) == COPYFAIL) {
(int)arg, sizeof(PARM_MAP) )==COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n");
return -EFAULT; return -EFAULT;
} }
} }
return retval; return retval;
case RIO_HOST_REQ: case RIO_HOST_REQ:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n");
if (copyin((int)arg, (caddr_t)&HostReq, if (copyin((int) arg, (caddr_t) & HostReq, sizeof(HostReq)) == COPYFAIL) {
sizeof(HostReq) )==COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
if ( HostReq.HostNum >= p->RIONumHosts ) { if (HostReq.HostNum >= p->RIONumHosts) {
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n", rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n", HostReq.HostNum);
HostReq.HostNum);
return -ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum); rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum);
if (copyout((caddr_t)&p->RIOHosts[HostReq.HostNum], if (copyout((caddr_t) & p->RIOHosts[HostReq.HostNum], (int) HostReq.HostP, sizeof(struct Host)) == COPYFAIL) {
(int)HostReq.HostP,sizeof(struct Host) ) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n");
return -EFAULT; return -EFAULT;
} }
return retval; return retval;
case RIO_HOST_DPRAM: case RIO_HOST_DPRAM:
rio_dprintk (RIO_DEBUG_CTRL, "Request for DPRAM\n"); rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n");
if ( copyin( (int)arg, (caddr_t)&HostDpRam, if (copyin((int) arg, (caddr_t) & HostDpRam, sizeof(HostDpRam)) == COPYFAIL) {
sizeof(HostDpRam) )==COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
if ( HostDpRam.HostNum >= p->RIONumHosts ) { if (HostDpRam.HostNum >= p->RIONumHosts) {
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n", rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n", HostDpRam.HostNum);
HostDpRam.HostNum);
return -ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum); rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum);
if (p->RIOHosts[HostDpRam.HostNum].Type == RIO_PCI) { if (p->RIOHosts[HostDpRam.HostNum].Type == RIO_PCI) {
int off; int off;
/* It's hardware like this that really gets on my tits. */ /* It's hardware like this that really gets on my tits. */
static unsigned char copy[sizeof(struct DpRam)]; static unsigned char copy[sizeof(struct DpRam)];
for ( off=0; off<sizeof(struct DpRam); off++ ) for (off = 0; off < sizeof(struct DpRam); off++)
copy[off] = p->RIOHosts[HostDpRam.HostNum].Caddr[off]; copy[off] = p->RIOHosts[HostDpRam.HostNum].Caddr[off];
if ( copyout( (caddr_t)copy, (int)HostDpRam.DpRamP, if (copyout((caddr_t) copy, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) {
sizeof(struct DpRam) ) == COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
return -EFAULT; return -EFAULT;
} }
} } else if (copyout((caddr_t) p->RIOHosts[HostDpRam.HostNum].Caddr, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) {
else if (copyout((caddr_t)p->RIOHosts[HostDpRam.HostNum].Caddr,
(int)HostDpRam.DpRamP,
sizeof(struct DpRam) ) == COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
return -EFAULT; return -EFAULT;
} }
return retval; return retval;
case RIO_SET_BUSY: case RIO_SET_BUSY:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_BUSY\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n");
if ( (int)arg < 0 || (int)arg > 511 ) { if ((int) arg < 0 || (int) arg > 511) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n",(int)arg); rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n", (int) arg);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
p->RIOPortp[(int)arg]->State |= RIO_BUSY; p->RIOPortp[(int) arg]->State |= RIO_BUSY;
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return retval; return retval;
case RIO_HOST_PORT: case RIO_HOST_PORT:
...@@ -1318,26 +1239,22 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1318,26 +1239,22 @@ RIO_DEBUG_CTRL, if (su)
** The daemon want port information ** The daemon want port information
** (probably for debug reasons) ** (probably for debug reasons)
*/ */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n");
if ( copyin((int)arg, (caddr_t)&PortReq, if (copyin((int) arg, (caddr_t) & PortReq, sizeof(PortReq)) == COPYFAIL) {
sizeof(PortReq) )==COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
if (PortReq.SysPort >= RIO_PORTS) { /* SysPort is unsigned */ if (PortReq.SysPort >= RIO_PORTS) { /* SysPort is unsigned */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n", rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n", PortReq.SysPort);
PortReq.SysPort);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort); rio_dprintk(RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort);
if (copyout((caddr_t)p->RIOPortp[PortReq.SysPort], if (copyout((caddr_t) p->RIOPortp[PortReq.SysPort], (int) PortReq.PortP, sizeof(struct Port)) == COPYFAIL) {
(int)PortReq.PortP,
sizeof(struct Port) ) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n");
return -EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -1347,40 +1264,34 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1347,40 +1264,34 @@ RIO_DEBUG_CTRL, if (su)
** The daemon want rup information ** The daemon want rup information
** (probably for debug reasons) ** (probably for debug reasons)
*/ */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n");
if (copyin((int)arg, (caddr_t)&RupReq, if (copyin((int) arg, (caddr_t) & RupReq, sizeof(RupReq)) == COPYFAIL) {
sizeof(RupReq) )==COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */ if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n", rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n", RupReq.HostNum);
RupReq.HostNum);
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
return -ENXIO; return -ENXIO;
} }
if ( RupReq.RupNum >= MAX_RUP+LINKS_PER_UNIT ) { /* eek! */ if (RupReq.RupNum >= MAX_RUP + LINKS_PER_UNIT) { /* eek! */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n", rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n", RupReq.RupNum);
RupReq.RupNum);
p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
HostP = &p->RIOHosts[RupReq.HostNum]; HostP = &p->RIOHosts[RupReq.HostNum];
if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n", rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n", RupReq.HostNum);
RupReq.HostNum);
p->RIOError.Error = HOST_NOT_RUNNING; p->RIOError.Error = HOST_NOT_RUNNING;
return -EIO; return -EIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum);
RupReq.RupNum,RupReq.HostNum);
if (copyout((caddr_t)HostP->UnixRups[RupReq.RupNum].RupP, if (copyout((caddr_t) HostP->UnixRups[RupReq.RupNum].RupP, (int) RupReq.RupP, sizeof(struct RUP)) == COPYFAIL) {
(int)RupReq.RupP,sizeof(struct RUP) ) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n");
return -EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -1390,39 +1301,33 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1390,39 +1301,33 @@ RIO_DEBUG_CTRL, if (su)
** The daemon want lpb information ** The daemon want lpb information
** (probably for debug reasons) ** (probably for debug reasons)
*/ */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n");
if (copyin((int)arg, (caddr_t)&LpbReq, if (copyin((int) arg, (caddr_t) & LpbReq, sizeof(LpbReq)) == COPYFAIL) {
sizeof(LpbReq) )==COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
if (LpbReq.Host >= p->RIONumHosts) { /* host is unsigned */ if (LpbReq.Host >= p->RIONumHosts) { /* host is unsigned */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n", rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n", LpbReq.Host);
LpbReq.Host);
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
return -ENXIO; return -ENXIO;
} }
if ( LpbReq.Link >= LINKS_PER_UNIT ) { /* eek! */ if (LpbReq.Link >= LINKS_PER_UNIT) { /* eek! */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n", rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n", LpbReq.Link);
LpbReq.Link);
p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE; p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
HostP = &p->RIOHosts[LpbReq.Host]; HostP = &p->RIOHosts[LpbReq.Host];
if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) { if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n", rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n", LpbReq.Host);
LpbReq.Host );
p->RIOError.Error = HOST_NOT_RUNNING; p->RIOError.Error = HOST_NOT_RUNNING;
return -EIO; return -EIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host);
LpbReq.Link, LpbReq.Host);
if (copyout((caddr_t)&HostP->LinkStrP[LpbReq.Link], if (copyout((caddr_t) & HostP->LinkStrP[LpbReq.Link], (int) LpbReq.LpbP, sizeof(struct LPB)) == COPYFAIL) {
(int)LpbReq.LpbP,sizeof(struct LPB) ) == COPYFAIL) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
...@@ -1440,7 +1345,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1440,7 +1345,7 @@ RIO_DEBUG_CTRL, if (su)
return 0; return 0;
case RIO_SYSLOG_CONS: case RIO_SYSLOG_CONS:
p->RIOPrintLogState = PRINT_TO_LOG_CONS;/* syslog and console */ p->RIOPrintLogState = PRINT_TO_LOG_CONS; /* syslog and console */
return 0; return 0;
case RIO_CONS_ONLY: case RIO_CONS_ONLY:
...@@ -1448,7 +1353,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1448,7 +1353,7 @@ RIO_DEBUG_CTRL, if (su)
return 0; return 0;
case RIO_SIGNALS_ON: case RIO_SIGNALS_ON:
if ( p->RIOSignalProcess ) { if (p->RIOSignalProcess) {
p->RIOError.Error = SIGNALS_ALREADY_SET; p->RIOError.Error = SIGNALS_ALREADY_SET;
return -EBUSY; return -EBUSY;
} }
...@@ -1457,35 +1362,35 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1457,35 +1362,35 @@ RIO_DEBUG_CTRL, if (su)
return retval; return retval;
case RIO_SIGNALS_OFF: case RIO_SIGNALS_OFF:
if ( p->RIOSignalProcess != getpid() ) { if (p->RIOSignalProcess != getpid()) {
p->RIOError.Error = NOT_RECEIVING_PROCESS; p->RIOError.Error = NOT_RECEIVING_PROCESS;
return -EPERM; return -EPERM;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Clear signal process to zero\n"); rio_dprintk(RIO_DEBUG_CTRL, "Clear signal process to zero\n");
p->RIOSignalProcess = 0; p->RIOSignalProcess = 0;
return retval; return retval;
case RIO_SET_BYTE_MODE: case RIO_SET_BYTE_MODE:
for ( Host=0; Host<p->RIONumHosts; Host++ ) for (Host = 0; Host < p->RIONumHosts; Host++)
if ( p->RIOHosts[Host].Type == RIO_AT ) if (p->RIOHosts[Host].Type == RIO_AT)
p->RIOHosts[Host].Mode &= ~WORD_OPERATION; p->RIOHosts[Host].Mode &= ~WORD_OPERATION;
return retval; return retval;
case RIO_SET_WORD_MODE: case RIO_SET_WORD_MODE:
for ( Host=0; Host<p->RIONumHosts; Host++ ) for (Host = 0; Host < p->RIONumHosts; Host++)
if ( p->RIOHosts[Host].Type == RIO_AT ) if (p->RIOHosts[Host].Type == RIO_AT)
p->RIOHosts[Host].Mode |= WORD_OPERATION; p->RIOHosts[Host].Mode |= WORD_OPERATION;
return retval; return retval;
case RIO_SET_FAST_BUS: case RIO_SET_FAST_BUS:
for ( Host=0; Host<p->RIONumHosts; Host++ ) for (Host = 0; Host < p->RIONumHosts; Host++)
if ( p->RIOHosts[Host].Type == RIO_AT ) if (p->RIOHosts[Host].Type == RIO_AT)
p->RIOHosts[Host].Mode |= FAST_AT_BUS; p->RIOHosts[Host].Mode |= FAST_AT_BUS;
return retval; return retval;
case RIO_SET_SLOW_BUS: case RIO_SET_SLOW_BUS:
for ( Host=0; Host<p->RIONumHosts; Host++ ) for (Host = 0; Host < p->RIONumHosts; Host++)
if ( p->RIOHosts[Host].Type == RIO_AT ) if (p->RIOHosts[Host].Type == RIO_AT)
p->RIOHosts[Host].Mode &= ~FAST_AT_BUS; p->RIOHosts[Host].Mode &= ~FAST_AT_BUS;
return retval; return retval;
...@@ -1493,45 +1398,43 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1493,45 +1398,43 @@ RIO_DEBUG_CTRL, if (su)
case RIO_MAP_B50_TO_57600: case RIO_MAP_B50_TO_57600:
case RIO_MAP_B110_TO_110: case RIO_MAP_B110_TO_110:
case RIO_MAP_B110_TO_115200: case RIO_MAP_B110_TO_115200:
rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping\n"); rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n");
port = (uint) arg; port = (uint) arg;
if ( port < 0 || port > 511 ) { if (port < 0 || port > 511) {
rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
switch( cmd ) switch (cmd) {
{ case RIO_MAP_B50_TO_50:
case RIO_MAP_B50_TO_50 :
p->RIOPortp[port]->Config |= RIO_MAP_50_TO_50; p->RIOPortp[port]->Config |= RIO_MAP_50_TO_50;
break; break;
case RIO_MAP_B50_TO_57600 : case RIO_MAP_B50_TO_57600:
p->RIOPortp[port]->Config &= ~RIO_MAP_50_TO_50; p->RIOPortp[port]->Config &= ~RIO_MAP_50_TO_50;
break; break;
case RIO_MAP_B110_TO_110 : case RIO_MAP_B110_TO_110:
p->RIOPortp[port]->Config |= RIO_MAP_110_TO_110; p->RIOPortp[port]->Config |= RIO_MAP_110_TO_110;
break; break;
case RIO_MAP_B110_TO_115200 : case RIO_MAP_B110_TO_115200:
p->RIOPortp[port]->Config &= ~RIO_MAP_110_TO_110; p->RIOPortp[port]->Config &= ~RIO_MAP_110_TO_110;
break; break;
} }
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return retval; return retval;
case RIO_STREAM_INFO: case RIO_STREAM_INFO:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n");
return -EINVAL; return -EINVAL;
case RIO_SEND_PACKET: case RIO_SEND_PACKET:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n");
if ( copyin( (int)arg, (caddr_t)&SendPack, if (copyin((int) arg, (caddr_t) & SendPack, sizeof(SendPack)) == COPYFAIL) {
sizeof(SendPack) )==COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
if ( SendPack.PortNum >= 128 ) { if (SendPack.PortNum >= 128) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -ENXIO; return -ENXIO;
} }
...@@ -1539,156 +1442,143 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1539,156 +1442,143 @@ RIO_DEBUG_CTRL, if (su)
PortP = p->RIOPortp[SendPack.PortNum]; PortP = p->RIOPortp[SendPack.PortNum];
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
if ( !can_add_transmit(&PacketP,PortP) ) { if (!can_add_transmit(&PacketP, PortP)) {
p->RIOError.Error = UNIT_IS_IN_USE; p->RIOError.Error = UNIT_IS_IN_USE;
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return -ENOSPC; return -ENOSPC;
} }
for ( loop=0; loop<(ushort)(SendPack.Len & 127); loop++ ) for (loop = 0; loop < (ushort) (SendPack.Len & 127); loop++)
WBYTE(PacketP->data[loop], SendPack.Data[loop] ); WBYTE(PacketP->data[loop], SendPack.Data[loop]);
WBYTE(PacketP->len, SendPack.Len); WBYTE(PacketP->len, SendPack.Len);
add_transmit( PortP ); add_transmit(PortP);
/* /*
** Count characters transmitted for port statistics reporting ** Count characters transmitted for port statistics reporting
*/ */
if (PortP->statsGather) if (PortP->statsGather)
PortP->txchars += (SendPack.Len & 127); PortP->txchars += (SendPack.Len & 127);
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return retval; return retval;
case RIO_NO_MESG: case RIO_NO_MESG:
if ( su ) if (su)
p->RIONoMessage = 1; p->RIONoMessage = 1;
return su ? 0 : -EPERM; return su ? 0 : -EPERM;
case RIO_MESG: case RIO_MESG:
if ( su ) if (su)
p->RIONoMessage = 0; p->RIONoMessage = 0;
return su ? 0 : -EPERM; return su ? 0 : -EPERM;
case RIO_WHAT_MESG: case RIO_WHAT_MESG:
if ( copyout( (caddr_t)&p->RIONoMessage, (int)arg, if (copyout((caddr_t) & p->RIONoMessage, (int) arg, sizeof(p->RIONoMessage)) == COPYFAIL) {
sizeof(p->RIONoMessage) )==COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
case RIO_MEM_DUMP : case RIO_MEM_DUMP:
if (copyin((int)arg, (caddr_t)&SubCmd, if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) {
sizeof(struct SubCmdStruct)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Addr);
SubCmd.Host, SubCmd.Rup, SubCmd.Addr);
if (SubCmd.Rup >= MAX_RUP+LINKS_PER_UNIT ) { if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) {
p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
if (SubCmd.Host >= p->RIONumHosts ) { if (SubCmd.Host >= p->RIONumHosts) {
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
port = p->RIOHosts[SubCmd.Host]. port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort;
UnixRups[SubCmd.Rup].BaseSysPort;
PortP = p->RIOPortp[port]; PortP = p->RIOPortp[port];
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
if ( RIOPreemptiveCmd(p, PortP, MEMDUMP ) == RIO_FAIL ) { if (RIOPreemptiveCmd(p, PortP, MEMDUMP) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n");
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return -EBUSY; return -EBUSY;
} } else
else
PortP->State |= RIO_BUSY; PortP->State |= RIO_BUSY;
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if ( copyout( (caddr_t)p->RIOMemDump, (int)arg, if (copyout((caddr_t) p->RIOMemDump, (int) arg, MEMDUMP_SIZE) == COPYFAIL) {
MEMDUMP_SIZE) == COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
case RIO_TICK: case RIO_TICK:
if ((int)arg < 0 || (int)arg >= p->RIONumHosts) if ((int) arg < 0 || (int) arg >= p->RIONumHosts)
return -EINVAL; return -EINVAL;
rio_dprintk (RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int)arg); rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int) arg);
WBYTE(p->RIOHosts[(int)arg].SetInt , 0xff); WBYTE(p->RIOHosts[(int) arg].SetInt, 0xff);
return 0; return 0;
case RIO_TOCK: case RIO_TOCK:
if ((int)arg < 0 || (int)arg >= p->RIONumHosts) if ((int) arg < 0 || (int) arg >= p->RIONumHosts)
return -EINVAL; return -EINVAL;
rio_dprintk (RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int)arg); rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int) arg);
WBYTE((p->RIOHosts[(int)arg].ResetInt) , 0xff); WBYTE((p->RIOHosts[(int) arg].ResetInt), 0xff);
return 0; return 0;
case RIO_READ_CHECK: case RIO_READ_CHECK:
/* Check reads for pkts with data[0] the same */ /* Check reads for pkts with data[0] the same */
p->RIOReadCheck = !p->RIOReadCheck; p->RIOReadCheck = !p->RIOReadCheck;
if (copyout((caddr_t)&p->RIOReadCheck,(int)arg, if (copyout((caddr_t) & p->RIOReadCheck, (int) arg, sizeof(uint)) == COPYFAIL) {
sizeof(uint))== COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
case RIO_READ_REGISTER : case RIO_READ_REGISTER:
if (copyin((int)arg, (caddr_t)&SubCmd, if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) {
sizeof(struct SubCmdStruct)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return -EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER host %d rup %d port %d reg %x\n", rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER host %d rup %d port %d reg %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr);
SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr);
if (SubCmd.Port > 511) { if (SubCmd.Port > 511) {
rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", SubCmd.Port);
SubCmd.Port);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
if (SubCmd.Rup >= MAX_RUP+LINKS_PER_UNIT ) { if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) {
p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
if (SubCmd.Host >= p->RIONumHosts ) { if (SubCmd.Host >= p->RIONumHosts) {
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
port = p->RIOHosts[SubCmd.Host]. port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort + SubCmd.Port;
UnixRups[SubCmd.Rup].BaseSysPort + SubCmd.Port;
PortP = p->RIOPortp[port]; PortP = p->RIOPortp[port];
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
if (RIOPreemptiveCmd(p, PortP, READ_REGISTER) == RIO_FAIL) { if (RIOPreemptiveCmd(p, PortP, READ_REGISTER) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n"); rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n");
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return -EBUSY; return -EBUSY;
} } else
else
PortP->State |= RIO_BUSY; PortP->State |= RIO_BUSY;
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if (copyout((caddr_t)&p->CdRegister, (int)arg, if (copyout((caddr_t) & p->CdRegister, (int) arg, sizeof(uint)) == COPYFAIL) {
sizeof(uint)) == COPYFAIL ) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n");
rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT; return -EFAULT;
} }
...@@ -1700,23 +1590,23 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1700,23 +1590,23 @@ RIO_DEBUG_CTRL, if (su)
*/ */
case RIO_MAKE_DEV: case RIO_MAKE_DEV:
{ {
uint port = (uint)arg & RIO_MODEM_MASK; uint port = (uint) arg & RIO_MODEM_MASK;
switch ( (uint)arg & RIO_DEV_MASK ) { switch ((uint) arg & RIO_DEV_MASK) {
case RIO_DEV_DIRECT: case RIO_DEV_DIRECT:
arg = (caddr_t)drv_makedev(MAJOR(dev), port); arg = (caddr_t) drv_makedev(MAJOR(dev), port);
rio_dprintk (RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n",port, (int)arg); rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, (int) arg);
return (int)arg; return (int) arg;
case RIO_DEV_MODEM: case RIO_DEV_MODEM:
arg = (caddr_t)drv_makedev(MAJOR(dev), (port|RIO_MODEM_BIT) ); arg = (caddr_t) drv_makedev(MAJOR(dev), (port | RIO_MODEM_BIT));
rio_dprintk (RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n",port, (int)arg); rio_dprintk(RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n", port, (int) arg);
return (int)arg; return (int) arg;
case RIO_DEV_XPRINT: case RIO_DEV_XPRINT:
arg = (caddr_t)drv_makedev(MAJOR(dev), port); arg = (caddr_t) drv_makedev(MAJOR(dev), port);
rio_dprintk (RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n",port, (int)arg); rio_dprintk(RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n", port, (int) arg);
return (int)arg; return (int) arg;
} }
rio_dprintk (RIO_DEBUG_CTRL, "MAKE Device is called\n"); rio_dprintk(RIO_DEBUG_CTRL, "MAKE Device is called\n");
return -EINVAL; return -EINVAL;
} }
/* /*
...@@ -1729,33 +1619,31 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1729,33 +1619,31 @@ RIO_DEBUG_CTRL, if (su)
dev_t dv; dev_t dv;
int mino; int mino;
dv = (dev_t)((int)arg); dv = (dev_t) ((int) arg);
mino = RIO_UNMODEM(dv); mino = RIO_UNMODEM(dv);
if ( RIO_ISMODEM(dv) ) { if (RIO_ISMODEM(dv)) {
rio_dprintk (RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino); rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino);
arg = (caddr_t)(mino | RIO_DEV_MODEM); arg = (caddr_t) (mino | RIO_DEV_MODEM);
} } else {
else { rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino);
rio_dprintk (RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino); arg = (caddr_t) (mino | RIO_DEV_DIRECT);
arg = (caddr_t)(mino | RIO_DEV_DIRECT);
} }
return (int)arg; return (int) arg;
} }
} }
rio_dprintk (RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n",cmd); rio_dprintk(RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n", cmd);
p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; p->RIOError.Error = IOCTL_COMMAND_UNKNOWN;
func_exit (); func_exit();
return -EINVAL; return -EINVAL;
} }
/* /*
** Pre-emptive commands go on RUPs and are only one byte long. ** Pre-emptive commands go on RUPs and are only one byte long.
*/ */
int int RIOPreemptiveCmd(p, PortP, Cmd)
RIOPreemptiveCmd(p, PortP, Cmd) struct rio_info *p;
struct rio_info * p;
struct Port *PortP; struct Port *PortP;
uchar Cmd; uchar Cmd;
{ {
...@@ -1766,24 +1654,22 @@ uchar Cmd; ...@@ -1766,24 +1654,22 @@ uchar Cmd;
int port; int port;
#ifdef CHECK #ifdef CHECK
CheckPortP( PortP ); CheckPortP(PortP);
#endif #endif
if ( PortP->State & RIO_DELETED ) { if (PortP->State & RIO_DELETED) {
rio_dprintk (RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n"); rio_dprintk(RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n");
return RIO_FAIL; return RIO_FAIL;
} }
if (((int)((char)PortP->InUse) == -1) || ! (CmdBlkP = RIOGetCmdBlk()) ) { if (((int) ((char) PortP->InUse) == -1) || !(CmdBlkP = RIOGetCmdBlk())) {
rio_dprintk (RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", Cmd, PortP->PortNum);
Cmd, PortP->PortNum);
return RIO_FAIL; return RIO_FAIL;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n", rio_dprintk(RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n", (int) CmdBlkP, PortP->InUse);
(int)CmdBlkP,PortP->InUse);
PktCmdP = (struct PktCmd_M *)&CmdBlkP->Packet.data[0]; PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0];
CmdBlkP->Packet.src_unit = 0; CmdBlkP->Packet.src_unit = 0;
if (PortP->SecondBlock) if (PortP->SecondBlock)
...@@ -1795,9 +1681,9 @@ uchar Cmd; ...@@ -1795,9 +1681,9 @@ uchar Cmd;
CmdBlkP->Packet.dest_port = COMMAND_RUP; CmdBlkP->Packet.dest_port = COMMAND_RUP;
CmdBlkP->Packet.len = PKT_CMD_BIT | 2; CmdBlkP->Packet.len = PKT_CMD_BIT | 2;
CmdBlkP->PostFuncP = RIOUnUse; CmdBlkP->PostFuncP = RIOUnUse;
CmdBlkP->PostArg = (int)PortP; CmdBlkP->PostArg = (int) PortP;
PktCmdP->Command = Cmd; PktCmdP->Command = Cmd;
port = PortP->HostPort % (ushort)PORTS_PER_RTA; port = PortP->HostPort % (ushort) PORTS_PER_RTA;
/* /*
** Index ports 8-15 for 2nd block of 16 port RTA. ** Index ports 8-15 for 2nd block of 16 port RTA.
*/ */
...@@ -1805,42 +1691,40 @@ uchar Cmd; ...@@ -1805,42 +1691,40 @@ uchar Cmd;
port += (ushort) PORTS_PER_RTA; port += (ushort) PORTS_PER_RTA;
PktCmdP->PhbNum = port; PktCmdP->PhbNum = port;
switch ( Cmd ) { switch (Cmd) {
case MEMDUMP: case MEMDUMP:
rio_dprintk (RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n", rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n", (int) CmdBlkP, (int) SubCmd.Addr);
(int)CmdBlkP, (int)SubCmd.Addr);
PktCmdP->SubCommand = MEMDUMP; PktCmdP->SubCommand = MEMDUMP;
PktCmdP->SubAddr = SubCmd.Addr; PktCmdP->SubAddr = SubCmd.Addr;
break; break;
case FCLOSE: case FCLOSE:
rio_dprintk (RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%x\n",(int)CmdBlkP); rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%x\n", (int) CmdBlkP);
break; break;
case READ_REGISTER: case READ_REGISTER:
rio_dprintk (RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n", rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n", (int) SubCmd.Addr, (int) CmdBlkP);
(int)SubCmd.Addr, (int)CmdBlkP);
PktCmdP->SubCommand = READ_REGISTER; PktCmdP->SubCommand = READ_REGISTER;
PktCmdP->SubAddr = SubCmd.Addr; PktCmdP->SubAddr = SubCmd.Addr;
break; break;
case RESUME: case RESUME:
rio_dprintk (RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%x\n",(int)CmdBlkP); rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%x\n", (int) CmdBlkP);
break; break;
case RFLUSH: case RFLUSH:
rio_dprintk (RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%x\n",(int)CmdBlkP); rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%x\n", (int) CmdBlkP);
CmdBlkP->PostFuncP = RIORFlushEnable; CmdBlkP->PostFuncP = RIORFlushEnable;
break; break;
case SUSPEND: case SUSPEND:
rio_dprintk (RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%x\n",(int)CmdBlkP); rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%x\n", (int) CmdBlkP);
break; break;
case MGET : case MGET:
rio_dprintk (RIO_DEBUG_CTRL, "Queue MGET command blk 0x%x\n", (int)CmdBlkP); rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk 0x%x\n", (int) CmdBlkP);
break; break;
case MSET : case MSET:
case MBIC : case MBIC:
case MBIS : case MBIS:
CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; CmdBlkP->Packet.data[4] = (char) PortP->ModemLines;
rio_dprintk (RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%x\n", (int)CmdBlkP); rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%x\n", (int) CmdBlkP);
break; break;
case WFLUSH: case WFLUSH:
...@@ -1849,13 +1733,12 @@ uchar Cmd; ...@@ -1849,13 +1733,12 @@ uchar Cmd;
** allowed then we should not bother sending any more to the ** allowed then we should not bother sending any more to the
** RTA. ** RTA.
*/ */
if ((int)((char)PortP->WflushFlag) == (int)-1) { if ((int) ((char) PortP->WflushFlag) == (int) -1) {
rio_dprintk (RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!"); rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!");
RIOFreeCmdBlk(CmdBlkP); RIOFreeCmdBlk(CmdBlkP);
return(RIO_FAIL); return (RIO_FAIL);
} else { } else {
rio_dprintk (RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n", rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n", (int) CmdBlkP);
(int)CmdBlkP);
CmdBlkP->PostFuncP = RIOWFlushMark; CmdBlkP->PostFuncP = RIOWFlushMark;
} }
break; break;
...@@ -1863,7 +1746,7 @@ uchar Cmd; ...@@ -1863,7 +1746,7 @@ uchar Cmd;
PortP->InUse++; PortP->InUse++;
Ret = RIOQueueCmdBlk( PortP->HostP, rup, CmdBlkP ); Ret = RIOQueueCmdBlk(PortP->HostP, rup, CmdBlkP);
return Ret; return Ret;
} }
...@@ -51,7 +51,7 @@ struct rio_info { ...@@ -51,7 +51,7 @@ struct rio_info {
int RIOInstallAttempts; /* no. of rio-install() calls */ int RIOInstallAttempts; /* no. of rio-install() calls */
int RIOLastPCISearch; /* status of last search */ int RIOLastPCISearch; /* status of last search */
int RIONumHosts; /* Number of RIO Hosts */ int RIONumHosts; /* Number of RIO Hosts */
struct Host * RIOHosts; /* RIO Host values */ struct Host *RIOHosts; /* RIO Host values */
struct Port **RIOPortp; /* RIO port values */ struct Port **RIOPortp; /* RIO port values */
/* /*
** 02.03.1999 ARG - ESIL 0820 fix ** 02.03.1999 ARG - ESIL 0820 fix
...@@ -115,7 +115,7 @@ struct rio_info { ...@@ -115,7 +115,7 @@ struct rio_info {
struct Error RIOError; /* to Identify what went wrong */ struct Error RIOError; /* to Identify what went wrong */
struct Conf RIOConf; /* Configuration ??? */ struct Conf RIOConf; /* Configuration ??? */
struct ttystatics channel[RIO_PORTS]; /* channel information */ struct ttystatics channel[RIO_PORTS]; /* channel information */
char RIOBootPackets[1+(SIXTY_FOUR_K/RTA_BOOT_DATA_SIZE)] char RIOBootPackets[1 + (SIXTY_FOUR_K / RTA_BOOT_DATA_SIZE)]
[RTA_BOOT_DATA_SIZE]; [RTA_BOOT_DATA_SIZE];
struct Map RIOConnectTable[TOTAL_MAP_ENTRIES]; struct Map RIOConnectTable[TOTAL_MAP_ENTRIES];
struct Map RIOSavedTable[TOTAL_MAP_ENTRIES]; struct Map RIOSavedTable[TOTAL_MAP_ENTRIES];
......
...@@ -46,7 +46,7 @@ struct RioHostInfo { ...@@ -46,7 +46,7 @@ struct RioHostInfo {
int bus; /* ISA/EISA/MCA/PCI */ int bus; /* ISA/EISA/MCA/PCI */
int mode; /* pointer to host mode - INTERRUPT / POLLED */ int mode; /* pointer to host mode - INTERRUPT / POLLED */
struct old_sgttyb struct old_sgttyb
* Sg; /* pointer to default term characteristics */ *Sg; /* pointer to default term characteristics */
}; };
......
...@@ -88,12 +88,12 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2"; ...@@ -88,12 +88,12 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2";
static void RIOReceive(struct rio_info *, struct Port *); static void RIOReceive(struct rio_info *, struct Port *);
static char *firstchars (char *p, int nch) static char *firstchars(char *p, int nch)
{ {
static char buf[2][128]; static char buf[2][128];
static int t=0; static int t = 0;
t = ! t; t = !t;
memcpy (buf[t], p, nch); memcpy(buf[t], p, nch);
buf[t][nch] = 0; buf[t][nch] = 0;
return buf[t]; return buf[t];
} }
...@@ -101,26 +101,25 @@ static char *firstchars (char *p, int nch) ...@@ -101,26 +101,25 @@ static char *firstchars (char *p, int nch)
#define INCR( P, I ) ((P) = (((P)+(I)) & p->RIOBufferMask)) #define INCR( P, I ) ((P) = (((P)+(I)) & p->RIOBufferMask))
/* Enable and start the transmission of packets */ /* Enable and start the transmission of packets */
void void RIOTxEnable(en)
RIOTxEnable(en) char *en;
char * en;
{ {
struct Port * PortP; struct Port *PortP;
struct rio_info *p; struct rio_info *p;
struct tty_struct* tty; struct tty_struct *tty;
int c; int c;
struct PKT * PacketP; struct PKT *PacketP;
unsigned long flags; unsigned long flags;
PortP = (struct Port *)en; PortP = (struct Port *) en;
p = (struct rio_info *)PortP->p; p = (struct rio_info *) PortP->p;
tty = PortP->gs.tty; tty = PortP->gs.tty;
rio_dprintk (RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt);
PortP->PortNum, PortP->gs.xmit_cnt);
if (!PortP->gs.xmit_cnt) return; if (!PortP->gs.xmit_cnt)
return;
/* This routine is an order of magnitude simpler than the specialix /* This routine is an order of magnitude simpler than the specialix
...@@ -131,54 +130,49 @@ char * en; ...@@ -131,54 +130,49 @@ char * en;
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
while (can_add_transmit( &PacketP, PortP )) { while (can_add_transmit(&PacketP, PortP)) {
c = PortP->gs.xmit_cnt; c = PortP->gs.xmit_cnt;
if (c > PKT_MAX_DATA_LEN) c = PKT_MAX_DATA_LEN; if (c > PKT_MAX_DATA_LEN)
c = PKT_MAX_DATA_LEN;
/* Don't copy past the end of the source buffer */ /* Don't copy past the end of the source buffer */
if (c > SERIAL_XMIT_SIZE - PortP->gs.xmit_tail) if (c > SERIAL_XMIT_SIZE - PortP->gs.xmit_tail)
c = SERIAL_XMIT_SIZE - PortP->gs.xmit_tail; c = SERIAL_XMIT_SIZE - PortP->gs.xmit_tail;
{ int t; {
t = (c > 10)?10:c; int t;
t = (c > 10) ? 10 : c;
rio_dprintk (RIO_DEBUG_INTR, "rio: tx port %d: copying %d chars: %s - %s\n", rio_dprintk(RIO_DEBUG_INTR, "rio: tx port %d: copying %d chars: %s - %s\n", PortP->PortNum, c, firstchars(PortP->gs.xmit_buf + PortP->gs.xmit_tail, t), firstchars(PortP->gs.xmit_buf + PortP->gs.xmit_tail + c - t, t));
PortP->PortNum, c,
firstchars (PortP->gs.xmit_buf + PortP->gs.xmit_tail , t),
firstchars (PortP->gs.xmit_buf + PortP->gs.xmit_tail + c-t, t));
} }
/* If for one reason or another, we can't copy more data, /* If for one reason or another, we can't copy more data,
we're done! */ we're done! */
if (c == 0) break; if (c == 0)
break;
rio_memcpy_toio (PortP->HostP->Caddr, (caddr_t)PacketP->data, rio_memcpy_toio(PortP->HostP->Caddr, (caddr_t) PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c);
PortP->gs.xmit_buf + PortP->gs.xmit_tail, c);
/* udelay (1); */ /* udelay (1); */
writeb (c, &(PacketP->len)); writeb(c, &(PacketP->len));
if (!( PortP->State & RIO_DELETED ) ) { if (!(PortP->State & RIO_DELETED)) {
add_transmit ( PortP ); add_transmit(PortP);
/* /*
** Count chars tx'd for port statistics reporting ** Count chars tx'd for port statistics reporting
*/ */
if ( PortP->statsGather ) if (PortP->statsGather)
PortP->txchars += c; PortP->txchars += c;
} }
PortP->gs.xmit_tail = (PortP->gs.xmit_tail + c) & (SERIAL_XMIT_SIZE-1); PortP->gs.xmit_tail = (PortP->gs.xmit_tail + c) & (SERIAL_XMIT_SIZE - 1);
PortP->gs.xmit_cnt -= c; PortP->gs.xmit_cnt -= c;
} }
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2*PKT_MAX_DATA_LEN)) { if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) {
rio_dprintk (RIO_DEBUG_INTR, "Waking up.... ldisc:%d (%d/%d)....", rio_dprintk(RIO_DEBUG_INTR, "Waking up.... ldisc:%d (%d/%d)....", (int) (PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)), PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
(int)(PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)), if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && PortP->gs.tty->ldisc.write_wakeup)
PortP->gs.wakeup_chars, PortP->gs.xmit_cnt); (PortP->gs.tty->ldisc.write_wakeup) (PortP->gs.tty);
if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && rio_dprintk(RIO_DEBUG_INTR, "(%d/%d)\n", PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
PortP->gs.tty->ldisc.write_wakeup)
(PortP->gs.tty->ldisc.write_wakeup)(PortP->gs.tty);
rio_dprintk (RIO_DEBUG_INTR, "(%d/%d)\n",
PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
wake_up_interruptible(&PortP->gs.tty->write_wait); wake_up_interruptible(&PortP->gs.tty->write_wait);
} }
...@@ -192,38 +186,37 @@ char * en; ...@@ -192,38 +186,37 @@ char * en;
static int RupIntr; static int RupIntr;
static int RxIntr; static int RxIntr;
static int TxIntr; static int TxIntr;
void void RIOServiceHost(p, HostP, From)
RIOServiceHost(p, HostP, From) struct rio_info *p;
struct rio_info * p;
struct Host *HostP; struct Host *HostP;
int From; int From;
{ {
rio_spin_lock (&HostP->HostLock); rio_spin_lock(&HostP->HostLock);
if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) { if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
static int t =0; static int t = 0;
rio_spin_unlock (&HostP->HostLock); rio_spin_unlock(&HostP->HostLock);
if ((t++ % 200) == 0) if ((t++ % 200) == 0)
rio_dprintk (RIO_DEBUG_INTR, "Interrupt but host not running. flags=%x.\n", (int)HostP->Flags); rio_dprintk(RIO_DEBUG_INTR, "Interrupt but host not running. flags=%x.\n", (int) HostP->Flags);
return; return;
} }
rio_spin_unlock (&HostP->HostLock); rio_spin_unlock(&HostP->HostLock);
if ( RWORD( HostP->ParmMapP->rup_intr ) ) { if (RWORD(HostP->ParmMapP->rup_intr)) {
WWORD( HostP->ParmMapP->rup_intr , 0 ); WWORD(HostP->ParmMapP->rup_intr, 0);
p->RIORupCount++; p->RIORupCount++;
RupIntr++; RupIntr++;
rio_dprintk (RIO_DEBUG_INTR, "rio: RUP interrupt on host %d\n", HostP-p->RIOHosts); rio_dprintk(RIO_DEBUG_INTR, "rio: RUP interrupt on host %d\n", HostP - p->RIOHosts);
RIOPollHostCommands(p, HostP ); RIOPollHostCommands(p, HostP);
} }
if ( RWORD( HostP->ParmMapP->rx_intr ) ) { if (RWORD(HostP->ParmMapP->rx_intr)) {
int port; int port;
WWORD( HostP->ParmMapP->rx_intr , 0 ); WWORD(HostP->ParmMapP->rx_intr, 0);
p->RIORxCount++; p->RIORxCount++;
RxIntr++; RxIntr++;
rio_dprintk (RIO_DEBUG_INTR, "rio: RX interrupt on host %d\n", HostP-p->RIOHosts); rio_dprintk(RIO_DEBUG_INTR, "rio: RX interrupt on host %d\n", HostP - p->RIOHosts);
/* /*
** Loop through every port. If the port is mapped into ** Loop through every port. If the port is mapped into
** the system ( i.e. has /dev/ttyXXXX associated ) then it is ** the system ( i.e. has /dev/ttyXXXX associated ) then it is
...@@ -231,8 +224,7 @@ int From; ...@@ -231,8 +224,7 @@ int From;
** hanging on its receive queue and stuff them on the free ** hanging on its receive queue and stuff them on the free
** list; check for commands on the way. ** list; check for commands on the way.
*/ */
for ( port=p->RIOFirstPortsBooted; for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
port<p->RIOLastPortsBooted+PORTS_PER_RTA; port++ ) {
struct Port *PortP = p->RIOPortp[port]; struct Port *PortP = p->RIOPortp[port];
struct tty_struct *ttyP; struct tty_struct *ttyP;
struct PKT *PacketP; struct PKT *PacketP;
...@@ -242,7 +234,7 @@ int From; ...@@ -242,7 +234,7 @@ int From;
** has not been set up! ** has not been set up!
** Optimise: ports come in bundles of eight. ** Optimise: ports come in bundles of eight.
*/ */
if ( !PortP->Mapped ) { if (!PortP->Mapped) {
port += 7; port += 7;
continue; /* with the next port */ continue; /* with the next port */
} }
...@@ -251,7 +243,7 @@ int From; ...@@ -251,7 +243,7 @@ int From;
** If the host board isn't THIS host board, check the next one. ** If the host board isn't THIS host board, check the next one.
** optimise: ports come in bundles of eight. ** optimise: ports come in bundles of eight.
*/ */
if ( PortP->HostP != HostP ) { if (PortP->HostP != HostP) {
port += 7; port += 7;
continue; continue;
} }
...@@ -259,7 +251,7 @@ int From; ...@@ -259,7 +251,7 @@ int From;
/* /*
** Let us see - is the port open? If not, then don't service it. ** Let us see - is the port open? If not, then don't service it.
*/ */
if ( !( PortP->PortState & PORT_ISOPEN ) ) { if (!(PortP->PortState & PORT_ISOPEN)) {
continue; continue;
} }
...@@ -277,7 +269,7 @@ int From; ...@@ -277,7 +269,7 @@ int From;
/* /*
** Process received data if there is any. ** Process received data if there is any.
*/ */
if ( can_remove_receive( &PacketP, PortP ) ) if (can_remove_receive(&PacketP, PortP))
RIOReceive(p, PortP); RIOReceive(p, PortP);
/* /*
...@@ -285,36 +277,33 @@ int From; ...@@ -285,36 +277,33 @@ int From;
** it's handshake bit is set, then we must clear the handshake, ** it's handshake bit is set, then we must clear the handshake,
** so that that downstream RTA is re-enabled. ** so that that downstream RTA is re-enabled.
*/ */
if ( !can_remove_receive( &PacketP, PortP ) && if (!can_remove_receive(&PacketP, PortP) && (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET)) {
( RWORD( PortP->PhbP->handshake )==PHB_HANDSHAKE_SET ) ) {
/* /*
** MAGIC! ( Basically, handshake the RX buffer, so that ** MAGIC! ( Basically, handshake the RX buffer, so that
** the RTAs upstream can be re-enabled. ) ** the RTAs upstream can be re-enabled. )
*/ */
rio_dprintk (RIO_DEBUG_INTR, "Set RX handshake bit\n"); rio_dprintk(RIO_DEBUG_INTR, "Set RX handshake bit\n");
WWORD( PortP->PhbP->handshake, WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET);
PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET );
} }
rio_spin_unlock(&PortP->portSem); rio_spin_unlock(&PortP->portSem);
} }
} }
if ( RWORD( HostP->ParmMapP->tx_intr ) ) { if (RWORD(HostP->ParmMapP->tx_intr)) {
int port; int port;
WWORD( HostP->ParmMapP->tx_intr , 0); WWORD(HostP->ParmMapP->tx_intr, 0);
p->RIOTxCount++; p->RIOTxCount++;
TxIntr++; TxIntr++;
rio_dprintk (RIO_DEBUG_INTR, "rio: TX interrupt on host %d\n", HostP-p->RIOHosts); rio_dprintk(RIO_DEBUG_INTR, "rio: TX interrupt on host %d\n", HostP - p->RIOHosts);
/* /*
** Loop through every port. ** Loop through every port.
** If the port is mapped into the system ( i.e. has /dev/ttyXXXX ** If the port is mapped into the system ( i.e. has /dev/ttyXXXX
** associated ) then it is worth checking. ** associated ) then it is worth checking.
*/ */
for ( port=p->RIOFirstPortsBooted; for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
port<p->RIOLastPortsBooted+PORTS_PER_RTA; port++ ) {
struct Port *PortP = p->RIOPortp[port]; struct Port *PortP = p->RIOPortp[port];
struct tty_struct *ttyP; struct tty_struct *ttyP;
struct PKT *PacketP; struct PKT *PacketP;
...@@ -323,7 +312,7 @@ int From; ...@@ -323,7 +312,7 @@ int From;
** not mapped in - most of the RIOPortp[] information ** not mapped in - most of the RIOPortp[] information
** has not been set up! ** has not been set up!
*/ */
if ( !PortP->Mapped ) { if (!PortP->Mapped) {
port += 7; port += 7;
continue; /* with the next port */ continue; /* with the next port */
} }
...@@ -332,7 +321,7 @@ int From; ...@@ -332,7 +321,7 @@ int From;
** If the host board isn't running, then its data structures ** If the host board isn't running, then its data structures
** are no use to us - continue quietly. ** are no use to us - continue quietly.
*/ */
if ( PortP->HostP != HostP ) { if (PortP->HostP != HostP) {
port += 7; port += 7;
continue; /* with the next port */ continue; /* with the next port */
} }
...@@ -340,11 +329,11 @@ int From; ...@@ -340,11 +329,11 @@ int From;
/* /*
** Let us see - is the port open? If not, then don't service it. ** Let us see - is the port open? If not, then don't service it.
*/ */
if ( !( PortP->PortState & PORT_ISOPEN ) ) { if (!(PortP->PortState & PORT_ISOPEN)) {
continue; continue;
} }
rio_dprintk (RIO_DEBUG_INTR, "rio: Looking into port %d.\n", port); rio_dprintk(RIO_DEBUG_INTR, "rio: Looking into port %d.\n", port);
/* /*
** Lock the port before we begin working on it. ** Lock the port before we begin working on it.
*/ */
...@@ -354,8 +343,8 @@ int From; ...@@ -354,8 +343,8 @@ int From;
** If we can't add anything to the transmit queue, then ** If we can't add anything to the transmit queue, then
** we need do none of this processing. ** we need do none of this processing.
*/ */
if ( !can_add_transmit( &PacketP, PortP ) ) { if (!can_add_transmit(&PacketP, PortP)) {
rio_dprintk (RIO_DEBUG_INTR, "Can't add to port, so skipping.\n"); rio_dprintk(RIO_DEBUG_INTR, "Can't add to port, so skipping.\n");
rio_spin_unlock(&PortP->portSem); rio_spin_unlock(&PortP->portSem);
continue; continue;
} }
...@@ -367,7 +356,7 @@ int From; ...@@ -367,7 +356,7 @@ int From;
ttyP = PortP->gs.tty; ttyP = PortP->gs.tty;
/* If ttyP is NULL, the port is getting closed. Forget about it. */ /* If ttyP is NULL, the port is getting closed. Forget about it. */
if (!ttyP) { if (!ttyP) {
rio_dprintk (RIO_DEBUG_INTR, "no tty, so skipping.\n"); rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n");
rio_spin_unlock(&PortP->portSem); rio_spin_unlock(&PortP->portSem);
continue; continue;
} }
...@@ -409,9 +398,9 @@ int From; ...@@ -409,9 +398,9 @@ int From;
*/ */
/* For now don't handle RTA reboots. -- REW. /* For now don't handle RTA reboots. -- REW.
Reenabled. Otherwise RTA reboots didn't work. Duh. -- REW */ Reenabled. Otherwise RTA reboots didn't work. Duh. -- REW */
if ( PortP->MagicFlags ) { if (PortP->MagicFlags) {
#if 1 #if 1
if ( PortP->MagicFlags & MAGIC_REBOOT ) { if (PortP->MagicFlags & MAGIC_REBOOT) {
/* /*
** well, the RTA has been rebooted, and there is room ** well, the RTA has been rebooted, and there is room
** on its queue to add the open packet that is required. ** on its queue to add the open packet that is required.
...@@ -427,10 +416,7 @@ int From; ...@@ -427,10 +416,7 @@ int From;
PortP->InUse = NOT_INUSE; PortP->InUse = NOT_INUSE;
rio_spin_unlock(&PortP->portSem); rio_spin_unlock(&PortP->portSem);
if ( RIOParam(PortP, OPEN, ((PortP->Cor2Copy & if (RIOParam(PortP, OPEN, ((PortP->Cor2Copy & (COR2_RTSFLOW | COR2_CTSFLOW)) == (COR2_RTSFLOW | COR2_CTSFLOW)) ? TRUE : FALSE, DONT_SLEEP) == RIO_FAIL) {
(COR2_RTSFLOW|COR2_CTSFLOW ) )==
(COR2_RTSFLOW|COR2_CTSFLOW ) ) ?
TRUE : FALSE, DONT_SLEEP ) == RIO_FAIL ) {
continue; /* with next port */ continue; /* with next port */
} }
rio_spin_lock(&PortP->portSem); rio_spin_lock(&PortP->portSem);
...@@ -442,88 +428,84 @@ int From; ...@@ -442,88 +428,84 @@ int From;
** As mentioned above, this is a tacky hack to cope ** As mentioned above, this is a tacky hack to cope
** with WFLUSH ** with WFLUSH
*/ */
if ( PortP->WflushFlag ) { if (PortP->WflushFlag) {
rio_dprintk (RIO_DEBUG_INTR, "Want to WFLUSH mark this port\n"); rio_dprintk(RIO_DEBUG_INTR, "Want to WFLUSH mark this port\n");
if ( PortP->InUse ) if (PortP->InUse)
rio_dprintk (RIO_DEBUG_INTR, "FAILS - PORT IS IN USE\n"); rio_dprintk(RIO_DEBUG_INTR, "FAILS - PORT IS IN USE\n");
} }
while ( PortP->WflushFlag && while (PortP->WflushFlag && can_add_transmit(&PacketP, PortP) && (PortP->InUse == NOT_INUSE)) {
can_add_transmit( &PacketP, PortP ) &&
( PortP->InUse == NOT_INUSE ) ) {
int p; int p;
struct PktCmd *PktCmdP; struct PktCmd *PktCmdP;
rio_dprintk (RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n"); rio_dprintk(RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n");
/* /*
** make it look just like a WFLUSH command ** make it look just like a WFLUSH command
*/ */
PktCmdP = ( struct PktCmd * )&PacketP->data[0]; PktCmdP = (struct PktCmd *) &PacketP->data[0];
WBYTE( PktCmdP->Command , WFLUSH ); WBYTE(PktCmdP->Command, WFLUSH);
p = PortP->HostPort % ( ushort )PORTS_PER_RTA; p = PortP->HostPort % (ushort) PORTS_PER_RTA;
/* /*
** If second block of ports for 16 port RTA, add 8 ** If second block of ports for 16 port RTA, add 8
** to index 8-15. ** to index 8-15.
*/ */
if ( PortP->SecondBlock ) if (PortP->SecondBlock)
p += PORTS_PER_RTA; p += PORTS_PER_RTA;
WBYTE( PktCmdP->PhbNum, p ); WBYTE(PktCmdP->PhbNum, p);
/* /*
** to make debuggery easier ** to make debuggery easier
*/ */
WBYTE( PacketP->data[ 2], 'W' ); WBYTE(PacketP->data[2], 'W');
WBYTE( PacketP->data[ 3], 'F' ); WBYTE(PacketP->data[3], 'F');
WBYTE( PacketP->data[ 4], 'L' ); WBYTE(PacketP->data[4], 'L');
WBYTE( PacketP->data[ 5], 'U' ); WBYTE(PacketP->data[5], 'U');
WBYTE( PacketP->data[ 6], 'S' ); WBYTE(PacketP->data[6], 'S');
WBYTE( PacketP->data[ 7], 'H' ); WBYTE(PacketP->data[7], 'H');
WBYTE( PacketP->data[ 8], ' ' ); WBYTE(PacketP->data[8], ' ');
WBYTE( PacketP->data[ 9], '0'+PortP->WflushFlag ); WBYTE(PacketP->data[9], '0' + PortP->WflushFlag);
WBYTE( PacketP->data[10], ' ' ); WBYTE(PacketP->data[10], ' ');
WBYTE( PacketP->data[11], ' ' ); WBYTE(PacketP->data[11], ' ');
WBYTE( PacketP->data[12], '\0' ); WBYTE(PacketP->data[12], '\0');
/* /*
** its two bytes long! ** its two bytes long!
*/ */
WBYTE( PacketP->len , PKT_CMD_BIT | 2 ); WBYTE(PacketP->len, PKT_CMD_BIT | 2);
/* /*
** queue it! ** queue it!
*/ */
if ( !( PortP->State & RIO_DELETED ) ) { if (!(PortP->State & RIO_DELETED)) {
add_transmit( PortP ); add_transmit(PortP);
/* /*
** Count chars tx'd for port statistics reporting ** Count chars tx'd for port statistics reporting
*/ */
if ( PortP->statsGather ) if (PortP->statsGather)
PortP->txchars += 2; PortP->txchars += 2;
} }
if ( --( PortP->WflushFlag ) == 0 ) { if (--(PortP->WflushFlag) == 0) {
PortP->MagicFlags &= ~MAGIC_FLUSH; PortP->MagicFlags &= ~MAGIC_FLUSH;
} }
rio_dprintk (RIO_DEBUG_INTR, "Wflush count now stands at %d\n", rio_dprintk(RIO_DEBUG_INTR, "Wflush count now stands at %d\n", PortP->WflushFlag);
PortP->WflushFlag);
} }
if ( PortP->MagicFlags & MORE_OUTPUT_EYGOR ) { if (PortP->MagicFlags & MORE_OUTPUT_EYGOR) {
if ( PortP->MagicFlags & MAGIC_FLUSH ) { if (PortP->MagicFlags & MAGIC_FLUSH) {
PortP->MagicFlags |= MORE_OUTPUT_EYGOR; PortP->MagicFlags |= MORE_OUTPUT_EYGOR;
} } else {
else { if (!can_add_transmit(&PacketP, PortP)) {
if ( !can_add_transmit( &PacketP, PortP ) ) {
rio_spin_unlock(&PortP->portSem); rio_spin_unlock(&PortP->portSem);
continue; continue;
} }
rio_spin_unlock(&PortP->portSem); rio_spin_unlock(&PortP->portSem);
RIOTxEnable((char *)PortP); RIOTxEnable((char *) PortP);
rio_spin_lock(&PortP->portSem); rio_spin_lock(&PortP->portSem);
PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR; PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR;
} }
...@@ -535,13 +517,13 @@ int From; ...@@ -535,13 +517,13 @@ int From;
** If we can't add anything to the transmit queue, then ** If we can't add anything to the transmit queue, then
** we need do none of the remaining processing. ** we need do none of the remaining processing.
*/ */
if (!can_add_transmit( &PacketP, PortP ) ) { if (!can_add_transmit(&PacketP, PortP)) {
rio_spin_unlock(&PortP->portSem); rio_spin_unlock(&PortP->portSem);
continue; continue;
} }
rio_spin_unlock(&PortP->portSem); rio_spin_unlock(&PortP->portSem);
RIOTxEnable((char *)PortP); RIOTxEnable((char *) PortP);
} }
} }
} }
...@@ -551,18 +533,17 @@ int From; ...@@ -551,18 +533,17 @@ int From;
** NB: Called with the tty locked. The spl from the lockb( ) is passed. ** NB: Called with the tty locked. The spl from the lockb( ) is passed.
** we return the ttySpl level that we re-locked at. ** we return the ttySpl level that we re-locked at.
*/ */
static void static void RIOReceive(p, PortP)
RIOReceive(p, PortP) struct rio_info *p;
struct rio_info * p; struct Port *PortP;
struct Port * PortP;
{ {
struct tty_struct *TtyP; struct tty_struct *TtyP;
register ushort transCount; register ushort transCount;
struct PKT *PacketP; struct PKT *PacketP;
register uint DataCnt; register uint DataCnt;
uchar * ptr; uchar *ptr;
unsigned char *buf; unsigned char *buf;
int copied =0; int copied = 0;
static int intCount, RxIntCnt; static int intCount, RxIntCnt;
...@@ -588,25 +569,21 @@ struct Port * PortP; ...@@ -588,25 +569,21 @@ struct Port * PortP;
TtyP = PortP->gs.tty; TtyP = PortP->gs.tty;
if (!TtyP) { if (!TtyP) {
rio_dprintk (RIO_DEBUG_INTR, "RIOReceive: tty is null. \n"); rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n");
return; return;
} }
if (PortP->State & RIO_THROTTLE_RX) { if (PortP->State & RIO_THROTTLE_RX) {
rio_dprintk (RIO_DEBUG_INTR, "RIOReceive: Throttled. Can't handle more input.\n"); rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: Throttled. Can't handle more input.\n");
return; return;
} }
if ( PortP->State & RIO_DELETED ) if (PortP->State & RIO_DELETED) {
{ while (can_remove_receive(&PacketP, PortP)) {
while ( can_remove_receive( &PacketP, PortP ) ) remove_receive(PortP);
{ put_free_end(PortP->HostP, PacketP);
remove_receive( PortP );
put_free_end( PortP->HostP, PacketP );
}
} }
else } else {
{
/* /*
** loop, just so long as: ** loop, just so long as:
** i ) there's some data ( i.e. can_remove_receive ) ** i ) there's some data ( i.e. can_remove_receive )
...@@ -615,9 +592,8 @@ struct Port * PortP; ...@@ -615,9 +592,8 @@ struct Port * PortP;
** iv ) we haven't outstayed our welcome ** iv ) we haven't outstayed our welcome
*/ */
transCount = 1; transCount = 1;
while ( can_remove_receive(&PacketP, PortP) while (can_remove_receive(&PacketP, PortP)
&& transCount) && transCount) {
{
#ifdef STATS #ifdef STATS
PortP->Stat.RxIntCnt++; PortP->Stat.RxIntCnt++;
#endif /* STATS */ #endif /* STATS */
...@@ -626,21 +602,21 @@ struct Port * PortP; ...@@ -626,21 +602,21 @@ struct Port * PortP;
/* /*
** check that it is not a command! ** check that it is not a command!
*/ */
if ( PacketP->len & PKT_CMD_BIT ) { if (PacketP->len & PKT_CMD_BIT) {
rio_dprintk (RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n"); rio_dprintk(RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n");
/* rio_dprint(RIO_DEBUG_INTR, (" sysport = %d\n", p->RIOPortp->PortNum)); */ /* rio_dprint(RIO_DEBUG_INTR, (" sysport = %d\n", p->RIOPortp->PortNum)); */
rio_dprintk (RIO_DEBUG_INTR, " dest_unit = %d\n", PacketP->dest_unit); rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", PacketP->dest_unit);
rio_dprintk (RIO_DEBUG_INTR, " dest_port = %d\n", PacketP->dest_port); rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", PacketP->dest_port);
rio_dprintk (RIO_DEBUG_INTR, " src_unit = %d\n", PacketP->src_unit); rio_dprintk(RIO_DEBUG_INTR, " src_unit = %d\n", PacketP->src_unit);
rio_dprintk (RIO_DEBUG_INTR, " src_port = %d\n", PacketP->src_port); rio_dprintk(RIO_DEBUG_INTR, " src_port = %d\n", PacketP->src_port);
rio_dprintk (RIO_DEBUG_INTR, " len = %d\n", PacketP->len); rio_dprintk(RIO_DEBUG_INTR, " len = %d\n", PacketP->len);
rio_dprintk (RIO_DEBUG_INTR, " control = %d\n", PacketP->control); rio_dprintk(RIO_DEBUG_INTR, " control = %d\n", PacketP->control);
rio_dprintk (RIO_DEBUG_INTR, " csum = %d\n", PacketP->csum); rio_dprintk(RIO_DEBUG_INTR, " csum = %d\n", PacketP->csum);
rio_dprintk (RIO_DEBUG_INTR, " data bytes: "); rio_dprintk(RIO_DEBUG_INTR, " data bytes: ");
for ( DataCnt=0; DataCnt<PKT_MAX_DATA_LEN; DataCnt++ ) for (DataCnt = 0; DataCnt < PKT_MAX_DATA_LEN; DataCnt++)
rio_dprintk (RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]); rio_dprintk(RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]);
remove_receive( PortP ); remove_receive(PortP);
put_free_end( PortP->HostP, PacketP ); put_free_end(PortP->HostP, PacketP);
continue; /* with next packet */ continue; /* with next packet */
} }
...@@ -660,8 +636,7 @@ struct Port * PortP; ...@@ -660,8 +636,7 @@ struct Port * PortP;
*/ */
transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK); transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK);
rio_dprintk (RIO_DEBUG_REC, "port %d: Copy %d bytes\n", rio_dprintk(RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount);
PortP->PortNum, transCount);
/* /*
** To use the following 'kkprintfs' for debugging - change the '#undef' ** To use the following 'kkprintfs' for debugging - change the '#undef'
** to '#define', (this is the only place ___DEBUG_IT___ occurs in the ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the
...@@ -669,18 +644,12 @@ struct Port * PortP; ...@@ -669,18 +644,12 @@ struct Port * PortP;
*/ */
#undef ___DEBUG_IT___ #undef ___DEBUG_IT___
#ifdef ___DEBUG_IT___ #ifdef ___DEBUG_IT___
kkprintf("I:%d R:%d P:%d Q:%d C:%d F:%x ", kkprintf("I:%d R:%d P:%d Q:%d C:%d F:%x ", intCount, RxIntCnt, PortP->PortNum, TtyP->rxqueue.count, transCount, TtyP->flags);
intCount,
RxIntCnt,
PortP->PortNum,
TtyP->rxqueue.count,
transCount,
TtyP->flags );
#endif #endif
ptr = (uchar *) PacketP->data + PortP->RxDataStart; ptr = (uchar *) PacketP->data + PortP->RxDataStart;
tty_prepare_flip_string(TtyP, &buf, transCount); tty_prepare_flip_string(TtyP, &buf, transCount);
rio_memcpy_fromio (buf, ptr, transCount); rio_memcpy_fromio(buf, ptr, transCount);
#ifdef STATS #ifdef STATS
/* /*
** keep a count for statistical purposes ** keep a count for statistical purposes
...@@ -693,18 +662,17 @@ struct Port * PortP; ...@@ -693,18 +662,17 @@ struct Port * PortP;
#ifdef ___DEBUG_IT___ #ifdef ___DEBUG_IT___
kkprintf("T:%d L:%d\n", DataCnt, PacketP->len ); kkprintf("T:%d L:%d\n", DataCnt, PacketP->len);
#endif #endif
if ( PacketP->len == 0 ) if (PacketP->len == 0) {
{
/* /*
** If we have emptied the packet, then we can ** If we have emptied the packet, then we can
** free it, and reset the start pointer for ** free it, and reset the start pointer for
** the next packet. ** the next packet.
*/ */
remove_receive( PortP ); remove_receive(PortP);
put_free_end( PortP->HostP, PacketP ); put_free_end(PortP->HostP, PacketP);
PortP->RxDataStart = 0; PortP->RxDataStart = 0;
#ifdef STATS #ifdef STATS
/* /*
...@@ -716,8 +684,8 @@ struct Port * PortP; ...@@ -716,8 +684,8 @@ struct Port * PortP;
} }
} }
if (copied) { if (copied) {
rio_dprintk (RIO_DEBUG_REC, "port %d: pushing tty flip buffer: %d total bytes copied.\n", PortP->PortNum, copied); rio_dprintk(RIO_DEBUG_REC, "port %d: pushing tty flip buffer: %d total bytes copied.\n", PortP->PortNum, copied);
tty_flip_buffer_push (TtyP); tty_flip_buffer_push(TtyP);
} }
return; return;
...@@ -728,9 +696,8 @@ struct Port * PortP; ...@@ -728,9 +696,8 @@ struct Port * PortP;
** The proc routine called by the line discipline to do the work for it. ** The proc routine called by the line discipline to do the work for it.
** The proc routine works hand in hand with the interrupt routine. ** The proc routine works hand in hand with the interrupt routine.
*/ */
int int riotproc(p, tp, cmd, port)
riotproc(p, tp, cmd, port) struct rio_info *p;
struct rio_info * p;
register struct ttystatics *tp; register struct ttystatics *tp;
int cmd; int cmd;
int port; int port;
...@@ -741,26 +708,24 @@ int port; ...@@ -741,26 +708,24 @@ int port;
SysPort = port; /* Believe me, it works. */ SysPort = port; /* Believe me, it works. */
if ( SysPort < 0 || SysPort >= RIO_PORTS ) { if (SysPort < 0 || SysPort >= RIO_PORTS) {
rio_dprintk (RIO_DEBUG_INTR, "Illegal port %d derived from TTY in riotproc()\n",SysPort); rio_dprintk(RIO_DEBUG_INTR, "Illegal port %d derived from TTY in riotproc()\n", SysPort);
return 0; return 0;
} }
PortP = p->RIOPortp[SysPort]; PortP = p->RIOPortp[SysPort];
if ((uint)PortP->PhbP < (uint)PortP->Caddr || if ((uint) PortP->PhbP < (uint) PortP->Caddr || (uint) PortP->PhbP >= (uint) PortP->Caddr + SIXTY_FOUR_K) {
(uint)PortP->PhbP >= (uint)PortP->Caddr+SIXTY_FOUR_K ) { rio_dprintk(RIO_DEBUG_INTR, "RIO: NULL or BAD PhbP on sys port %d in proc routine\n", SysPort);
rio_dprintk (RIO_DEBUG_INTR, "RIO: NULL or BAD PhbP on sys port %d in proc routine\n", rio_dprintk(RIO_DEBUG_INTR, " PortP = 0x%x\n", PortP);
SysPort); rio_dprintk(RIO_DEBUG_INTR, " PortP->PhbP = 0x%x\n", PortP->PhbP);
rio_dprintk (RIO_DEBUG_INTR, " PortP = 0x%x\n",PortP); rio_dprintk(RIO_DEBUG_INTR, " PortP->Caddr = 0x%x\n", PortP->PhbP);
rio_dprintk (RIO_DEBUG_INTR, " PortP->PhbP = 0x%x\n",PortP->PhbP); rio_dprintk(RIO_DEBUG_INTR, " PortP->HostPort = 0x%x\n", PortP->HostPort);
rio_dprintk (RIO_DEBUG_INTR, " PortP->Caddr = 0x%x\n",PortP->PhbP);
rio_dprintk (RIO_DEBUG_INTR, " PortP->HostPort = 0x%x\n",PortP->HostPort);
return 0; return 0;
} }
switch(cmd) { switch (cmd) {
case T_WFLUSH: case T_WFLUSH:
rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH\n"); rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH\n");
/* /*
** Because of the spooky way the RIO works, we don't need ** Because of the spooky way the RIO works, we don't need
** to issue a flush command on any of the SET*F commands, ** to issue a flush command on any of the SET*F commands,
...@@ -772,27 +737,24 @@ int port; ...@@ -772,27 +737,24 @@ int port;
** here we only issue a WFLUSH command if we are in the interrupt ** here we only issue a WFLUSH command if we are in the interrupt
** routine, or we aren't executing a SET*F command. ** routine, or we aren't executing a SET*F command.
*/ */
if ( PortP->HostP->InIntr || !PortP->FlushCmdBodge ) { if (PortP->HostP->InIntr || !PortP->FlushCmdBodge) {
/* /*
** form a wflush packet - 1 byte long, no data ** form a wflush packet - 1 byte long, no data
*/ */
if ( PortP->State & RIO_DELETED ) { if (PortP->State & RIO_DELETED) {
rio_dprintk (RIO_DEBUG_INTR, "WFLUSH on deleted RTA\n"); rio_dprintk(RIO_DEBUG_INTR, "WFLUSH on deleted RTA\n");
} } else {
else { if (RIOPreemptiveCmd(p, PortP, WFLUSH) == RIO_FAIL) {
if ( RIOPreemptiveCmd(p, PortP, WFLUSH ) == RIO_FAIL ) { rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command failed\n");
rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command failed\n"); } else
} rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command\n");
else
rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command\n");
} }
/* /*
** WFLUSH operation - flush the data! ** WFLUSH operation - flush the data!
*/ */
PortP->TxBufferIn = PortP->TxBufferOut = 0; PortP->TxBufferIn = PortP->TxBufferOut = 0;
} } else {
else { rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command ignored\n");
rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command ignored\n");
} }
/* /*
** sort out the line discipline ** sort out the line discipline
...@@ -802,16 +764,15 @@ int port; ...@@ -802,16 +764,15 @@ int port;
break; break;
case T_RESUME: case T_RESUME:
rio_dprintk (RIO_DEBUG_INTR, "T_RESUME\n"); rio_dprintk(RIO_DEBUG_INTR, "T_RESUME\n");
/* /*
** send pre-emptive resume packet ** send pre-emptive resume packet
*/ */
if ( PortP->State & RIO_DELETED ) { if (PortP->State & RIO_DELETED) {
rio_dprintk (RIO_DEBUG_INTR, "RESUME on deleted RTA\n"); rio_dprintk(RIO_DEBUG_INTR, "RESUME on deleted RTA\n");
} } else {
else { if (RIOPreemptiveCmd(p, PortP, RESUME) == RIO_FAIL) {
if ( RIOPreemptiveCmd(p, PortP, RESUME ) == RIO_FAIL ) { rio_dprintk(RIO_DEBUG_INTR, "T_RESUME Command failed\n");
rio_dprintk (RIO_DEBUG_INTR, "T_RESUME Command failed\n");
} }
} }
/* /*
...@@ -822,7 +783,7 @@ int port; ...@@ -822,7 +783,7 @@ int port;
break; break;
case T_TIME: case T_TIME:
rio_dprintk (RIO_DEBUG_INTR, "T_TIME\n"); rio_dprintk(RIO_DEBUG_INTR, "T_TIME\n");
/* /*
** T_TIME is called when xDLY is set in oflags and ** T_TIME is called when xDLY is set in oflags and
** the line discipline timeout has expired. It's ** the line discipline timeout has expired. It's
...@@ -833,27 +794,26 @@ int port; ...@@ -833,27 +794,26 @@ int port;
** Fall through and re-start output ** Fall through and re-start output
*/ */
case T_OUTPUT: case T_OUTPUT:
start: start:
if ( PortP->MagicFlags & MAGIC_FLUSH ) { if (PortP->MagicFlags & MAGIC_FLUSH) {
PortP->MagicFlags |= MORE_OUTPUT_EYGOR; PortP->MagicFlags |= MORE_OUTPUT_EYGOR;
return 0; return 0;
} }
RIOTxEnable((char *)PortP); RIOTxEnable((char *) PortP);
PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR; PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR;
/*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"T_OUTPUT finished\n");*/ /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"T_OUTPUT finished\n"); */
break; break;
case T_SUSPEND: case T_SUSPEND:
rio_dprintk (RIO_DEBUG_INTR, "T_SUSPEND\n"); rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND\n");
/* /*
** send a suspend pre-emptive packet. ** send a suspend pre-emptive packet.
*/ */
if ( PortP->State & RIO_DELETED ) { if (PortP->State & RIO_DELETED) {
rio_dprintk (RIO_DEBUG_INTR, "SUSPEND deleted RTA\n"); rio_dprintk(RIO_DEBUG_INTR, "SUSPEND deleted RTA\n");
} } else {
else { if (RIOPreemptiveCmd(p, PortP, SUSPEND) == RIO_FAIL) {
if ( RIOPreemptiveCmd(p, PortP, SUSPEND ) == RIO_FAIL ) { rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND Command failed\n");
rio_dprintk (RIO_DEBUG_INTR, "T_SUSPEND Command failed\n");
} }
} }
/* /*
...@@ -862,38 +822,37 @@ int port; ...@@ -862,38 +822,37 @@ int port;
break; break;
case T_BLOCK: case T_BLOCK:
rio_dprintk (RIO_DEBUG_INTR, "T_BLOCK\n"); rio_dprintk(RIO_DEBUG_INTR, "T_BLOCK\n");
break; break;
case T_RFLUSH: case T_RFLUSH:
rio_dprintk (RIO_DEBUG_INTR, "T_RFLUSH\n"); rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH\n");
if ( PortP->State & RIO_DELETED ) { if (PortP->State & RIO_DELETED) {
rio_dprintk (RIO_DEBUG_INTR, "RFLUSH on deleted RTA\n"); rio_dprintk(RIO_DEBUG_INTR, "RFLUSH on deleted RTA\n");
PortP->RxDataStart = 0; PortP->RxDataStart = 0;
} } else {
else { if (RIOPreemptiveCmd(p, PortP, RFLUSH) == RIO_FAIL) {
if ( RIOPreemptiveCmd( p, PortP, RFLUSH ) == RIO_FAIL ) { rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH Command failed\n");
rio_dprintk (RIO_DEBUG_INTR, "T_RFLUSH Command failed\n");
return 0; return 0;
} }
PortP->RxDataStart = 0; PortP->RxDataStart = 0;
while ( can_remove_receive(&PacketP, PortP) ) { while (can_remove_receive(&PacketP, PortP)) {
remove_receive(PortP); remove_receive(PortP);
ShowPacket(DBG_PROC, PacketP ); ShowPacket(DBG_PROC, PacketP);
put_free_end(PortP->HostP, PacketP ); put_free_end(PortP->HostP, PacketP);
} }
if ( PortP->PhbP->handshake == PHB_HANDSHAKE_SET ) { if (PortP->PhbP->handshake == PHB_HANDSHAKE_SET) {
/* /*
** MAGIC! ** MAGIC!
*/ */
rio_dprintk (RIO_DEBUG_INTR, "Set receive handshake bit\n"); rio_dprintk(RIO_DEBUG_INTR, "Set receive handshake bit\n");
PortP->PhbP->handshake |= PHB_HANDSHAKE_RESET; PortP->PhbP->handshake |= PHB_HANDSHAKE_RESET;
} }
} }
break; break;
/* FALLTHROUGH */ /* FALLTHROUGH */
case T_UNBLOCK: case T_UNBLOCK:
rio_dprintk (RIO_DEBUG_INTR, "T_UNBLOCK\n"); rio_dprintk(RIO_DEBUG_INTR, "T_UNBLOCK\n");
/* /*
** If there is any data to receive set a timeout to service it. ** If there is any data to receive set a timeout to service it.
*/ */
...@@ -901,7 +860,7 @@ int port; ...@@ -901,7 +860,7 @@ int port;
break; break;
case T_BREAK: case T_BREAK:
rio_dprintk (RIO_DEBUG_INTR, "T_BREAK\n"); rio_dprintk(RIO_DEBUG_INTR, "T_BREAK\n");
/* /*
** Send a break command. For Sys V ** Send a break command. For Sys V
** this is a timed break, so we ** this is a timed break, so we
...@@ -910,13 +869,11 @@ int port; ...@@ -910,13 +869,11 @@ int port;
/* /*
** Build a BREAK command ** Build a BREAK command
*/ */
if ( PortP->State & RIO_DELETED ) { if (PortP->State & RIO_DELETED) {
rio_dprintk (RIO_DEBUG_INTR, "BREAK on deleted RTA\n"); rio_dprintk(RIO_DEBUG_INTR, "BREAK on deleted RTA\n");
} } else {
else { if (RIOShortCommand(PortP, SBREAK, 2, p->RIOConf.BreakInterval) == RIO_FAIL) {
if (RIOShortCommand(PortP,SBREAK,2, rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
p->RIOConf.BreakInterval)==RIO_FAIL) {
rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
} }
} }
...@@ -926,23 +883,23 @@ int port; ...@@ -926,23 +883,23 @@ int port;
break; break;
case T_INPUT: case T_INPUT:
rio_dprintk (RIO_DEBUG_INTR, "Proc T_INPUT called - I don't know what to do!\n"); rio_dprintk(RIO_DEBUG_INTR, "Proc T_INPUT called - I don't know what to do!\n");
break; break;
case T_PARM: case T_PARM:
rio_dprintk (RIO_DEBUG_INTR, "Proc T_PARM called - I don't know what to do!\n"); rio_dprintk(RIO_DEBUG_INTR, "Proc T_PARM called - I don't know what to do!\n");
break; break;
case T_SWTCH: case T_SWTCH:
rio_dprintk (RIO_DEBUG_INTR, "Proc T_SWTCH called - I don't know what to do!\n"); rio_dprintk(RIO_DEBUG_INTR, "Proc T_SWTCH called - I don't know what to do!\n");
break; break;
default: default:
rio_dprintk (RIO_DEBUG_INTR, "Proc UNKNOWN command %d\n",cmd); rio_dprintk(RIO_DEBUG_INTR, "Proc UNKNOWN command %d\n", cmd);
} }
/* /*
** T_OUTPUT returns without passing through this point! ** T_OUTPUT returns without passing through this point!
*/ */
/*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"riotproc done\n");*/ /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"riotproc done\n"); */
return(0); return (0);
} }
#endif #endif
...@@ -157,8 +157,7 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3"; ...@@ -157,8 +157,7 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3";
** NB. for MPX ** NB. for MPX
** tty lock must NOT have been previously acquired. ** tty lock must NOT have been previously acquired.
*/ */
int int RIOParam(PortP, cmd, Modem, SleepFlag)
RIOParam(PortP, cmd, Modem, SleepFlag)
struct Port *PortP; struct Port *PortP;
int cmd; int cmd;
int Modem; int Modem;
...@@ -169,27 +168,26 @@ int SleepFlag; ...@@ -169,27 +168,26 @@ int SleepFlag;
register struct phb_param *phb_param_ptr; register struct phb_param *phb_param_ptr;
PKT *PacketP; PKT *PacketP;
int res; int res;
uchar Cor1=0, Cor2=0, Cor4=0, Cor5=0; uchar Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0;
uchar TxXon=0, TxXoff=0, RxXon=0, RxXoff=0; uchar TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0;
uchar LNext=0, TxBaud=0, RxBaud=0; uchar LNext = 0, TxBaud = 0, RxBaud = 0;
int retries = 0xff; int retries = 0xff;
unsigned long flags; unsigned long flags;
func_enter (); func_enter();
TtyP = PortP->gs.tty; TtyP = PortP->gs.tty;
rio_dprintk (RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", rio_dprintk(RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP);
PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP);
if (!TtyP) { if (!TtyP) {
rio_dprintk (RIO_DEBUG_PARAM, "Can't call rioparam with null tty.\n"); rio_dprintk(RIO_DEBUG_PARAM, "Can't call rioparam with null tty.\n");
func_exit (); func_exit();
return RIO_FAIL; return RIO_FAIL;
} }
rio_spin_lock_irqsave(&PortP->portSem, flags ); rio_spin_lock_irqsave(&PortP->portSem, flags);
if (cmd == OPEN) { if (cmd == OPEN) {
/* /*
...@@ -207,9 +205,8 @@ int SleepFlag; ...@@ -207,9 +205,8 @@ int SleepFlag;
for (i = 0; i < NCC + 5; i++) for (i = 0; i < NCC + 5; i++)
PortP->StoredTty.cc[i] = TtyP->tm.c_cc[i]; PortP->StoredTty.cc[i] = TtyP->tm.c_cc[i];
PortP->FirstOpen = 0; PortP->FirstOpen = 0;
} } else if (PortP->Store || PortP->Lock) {
else if (PortP->Store || PortP->Lock) { rio_dprintk(RIO_DEBUG_PARAM, "OPEN: Restoring stored/locked params\n");
rio_dprintk (RIO_DEBUG_PARAM, "OPEN: Restoring stored/locked params\n");
TtyP->tm.c_iflag = PortP->StoredTty.iflag; TtyP->tm.c_iflag = PortP->StoredTty.iflag;
TtyP->tm.c_oflag = PortP->StoredTty.oflag; TtyP->tm.c_oflag = PortP->StoredTty.oflag;
TtyP->tm.c_cflag = PortP->StoredTty.cflag; TtyP->tm.c_cflag = PortP->StoredTty.cflag;
...@@ -224,209 +221,201 @@ int SleepFlag; ...@@ -224,209 +221,201 @@ int SleepFlag;
/* /*
** wait for space ** wait for space
*/ */
while ( !(res=can_add_transmit(&PacketP,PortP)) || while (!(res = can_add_transmit(&PacketP, PortP)) || (PortP->InUse != NOT_INUSE)) {
(PortP->InUse != NOT_INUSE) ) { if (retries-- <= 0) {
if (retries -- <= 0) {
break; break;
} }
if ( PortP->InUse != NOT_INUSE ) { if (PortP->InUse != NOT_INUSE) {
rio_dprintk (RIO_DEBUG_PARAM, "Port IN_USE for pre-emptive command\n"); rio_dprintk(RIO_DEBUG_PARAM, "Port IN_USE for pre-emptive command\n");
} }
if ( !res ) { if (!res) {
rio_dprintk (RIO_DEBUG_PARAM, "Port has no space on transmit queue\n"); rio_dprintk(RIO_DEBUG_PARAM, "Port has no space on transmit queue\n");
} }
if ( SleepFlag != OK_TO_SLEEP ) { if (SleepFlag != OK_TO_SLEEP) {
rio_spin_unlock_irqrestore( &PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
func_exit(); func_exit();
return RIO_FAIL; return RIO_FAIL;
} }
rio_dprintk (RIO_DEBUG_PARAM, "wait for can_add_transmit\n"); rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit\n");
rio_spin_unlock_irqrestore( &PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
retval = RIODelay(PortP, HUNDRED_MS); retval = RIODelay(PortP, HUNDRED_MS);
rio_spin_lock_irqsave( &PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
if (retval == RIO_FAIL) { if (retval == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n"); rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n");
rio_spin_unlock_irqrestore( &PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
pseterr(EINTR); pseterr(EINTR);
func_exit(); func_exit();
return RIO_FAIL; return RIO_FAIL;
} }
if ( PortP->State & RIO_DELETED ) { if (PortP->State & RIO_DELETED) {
rio_spin_unlock_irqrestore( &PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
func_exit (); func_exit();
return RIO_SUCCESS; return RIO_SUCCESS;
} }
} }
if (!res) { if (!res) {
rio_spin_unlock_irqrestore( &PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
func_exit (); func_exit();
return RIO_FAIL; return RIO_FAIL;
} }
rio_dprintk (RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n",res); rio_dprintk(RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n", res);
rio_dprintk (RIO_DEBUG_PARAM, "Packet is 0x%x\n",(int) PacketP); rio_dprintk(RIO_DEBUG_PARAM, "Packet is 0x%x\n", (int) PacketP);
phb_param_ptr = (struct phb_param *)PacketP->data; phb_param_ptr = (struct phb_param *) PacketP->data;
#if 0 #if 0
/* /*
** COR 1 ** COR 1
*/ */
if ( TtyP->tm.c_iflag & INPCK ) { if (TtyP->tm.c_iflag & INPCK) {
rio_dprintk (RIO_DEBUG_PARAM, "Parity checking on input enabled\n"); rio_dprintk(RIO_DEBUG_PARAM, "Parity checking on input enabled\n");
Cor1 |= COR1_INPCK; Cor1 |= COR1_INPCK;
} }
#endif #endif
switch ( TtyP->termios->c_cflag & CSIZE ) { switch (TtyP->termios->c_cflag & CSIZE) {
case CS5: case CS5:
{ {
rio_dprintk (RIO_DEBUG_PARAM, "5 bit data\n"); rio_dprintk(RIO_DEBUG_PARAM, "5 bit data\n");
Cor1 |= COR1_5BITS; Cor1 |= COR1_5BITS;
break; break;
} }
case CS6: case CS6:
{ {
rio_dprintk (RIO_DEBUG_PARAM, "6 bit data\n"); rio_dprintk(RIO_DEBUG_PARAM, "6 bit data\n");
Cor1 |= COR1_6BITS; Cor1 |= COR1_6BITS;
break; break;
} }
case CS7: case CS7:
{ {
rio_dprintk (RIO_DEBUG_PARAM, "7 bit data\n"); rio_dprintk(RIO_DEBUG_PARAM, "7 bit data\n");
Cor1 |= COR1_7BITS; Cor1 |= COR1_7BITS;
break; break;
} }
case CS8: case CS8:
{ {
rio_dprintk (RIO_DEBUG_PARAM, "8 bit data\n"); rio_dprintk(RIO_DEBUG_PARAM, "8 bit data\n");
Cor1 |= COR1_8BITS; Cor1 |= COR1_8BITS;
break; break;
} }
} }
if ( TtyP->termios->c_cflag & CSTOPB ) { if (TtyP->termios->c_cflag & CSTOPB) {
rio_dprintk (RIO_DEBUG_PARAM, "2 stop bits\n"); rio_dprintk(RIO_DEBUG_PARAM, "2 stop bits\n");
Cor1 |= COR1_2STOP; Cor1 |= COR1_2STOP;
} } else {
else { rio_dprintk(RIO_DEBUG_PARAM, "1 stop bit\n");
rio_dprintk (RIO_DEBUG_PARAM, "1 stop bit\n");
Cor1 |= COR1_1STOP; Cor1 |= COR1_1STOP;
} }
if ( TtyP->termios->c_cflag & PARENB ) { if (TtyP->termios->c_cflag & PARENB) {
rio_dprintk (RIO_DEBUG_PARAM, "Enable parity\n"); rio_dprintk(RIO_DEBUG_PARAM, "Enable parity\n");
Cor1 |= COR1_NORMAL; Cor1 |= COR1_NORMAL;
} } else {
else { rio_dprintk(RIO_DEBUG_PARAM, "Disable parity\n");
rio_dprintk (RIO_DEBUG_PARAM, "Disable parity\n");
Cor1 |= COR1_NOP; Cor1 |= COR1_NOP;
} }
if ( TtyP->termios->c_cflag & PARODD ) { if (TtyP->termios->c_cflag & PARODD) {
rio_dprintk (RIO_DEBUG_PARAM, "Odd parity\n"); rio_dprintk(RIO_DEBUG_PARAM, "Odd parity\n");
Cor1 |= COR1_ODD; Cor1 |= COR1_ODD;
} } else {
else { rio_dprintk(RIO_DEBUG_PARAM, "Even parity\n");
rio_dprintk (RIO_DEBUG_PARAM, "Even parity\n");
Cor1 |= COR1_EVEN; Cor1 |= COR1_EVEN;
} }
/* /*
** COR 2 ** COR 2
*/ */
if ( TtyP->termios->c_iflag & IXON ) { if (TtyP->termios->c_iflag & IXON) {
rio_dprintk (RIO_DEBUG_PARAM, "Enable start/stop output control\n"); rio_dprintk(RIO_DEBUG_PARAM, "Enable start/stop output control\n");
Cor2 |= COR2_IXON; Cor2 |= COR2_IXON;
} } else {
else { if (PortP->Config & RIO_IXON) {
if ( PortP->Config & RIO_IXON ) { rio_dprintk(RIO_DEBUG_PARAM, "Force enable start/stop output control\n");
rio_dprintk (RIO_DEBUG_PARAM, "Force enable start/stop output control\n");
Cor2 |= COR2_IXON; Cor2 |= COR2_IXON;
} } else
else rio_dprintk(RIO_DEBUG_PARAM, "IXON has been disabled.\n");
rio_dprintk (RIO_DEBUG_PARAM, "IXON has been disabled.\n");
} }
if (TtyP->termios->c_iflag & IXANY) { if (TtyP->termios->c_iflag & IXANY) {
if ( PortP->Config & RIO_IXANY ) { if (PortP->Config & RIO_IXANY) {
rio_dprintk (RIO_DEBUG_PARAM, "Enable any key to restart output\n"); rio_dprintk(RIO_DEBUG_PARAM, "Enable any key to restart output\n");
Cor2 |= COR2_IXANY; Cor2 |= COR2_IXANY;
} } else
else rio_dprintk(RIO_DEBUG_PARAM, "IXANY has been disabled due to sanity reasons.\n");
rio_dprintk (RIO_DEBUG_PARAM, "IXANY has been disabled due to sanity reasons.\n");
} }
if ( TtyP->termios->c_iflag & IXOFF ) { if (TtyP->termios->c_iflag & IXOFF) {
rio_dprintk (RIO_DEBUG_PARAM, "Enable start/stop input control 2\n"); rio_dprintk(RIO_DEBUG_PARAM, "Enable start/stop input control 2\n");
Cor2 |= COR2_IXOFF; Cor2 |= COR2_IXOFF;
} }
if ( TtyP->termios->c_cflag & HUPCL ) { if (TtyP->termios->c_cflag & HUPCL) {
rio_dprintk (RIO_DEBUG_PARAM, "Hangup on last close\n"); rio_dprintk(RIO_DEBUG_PARAM, "Hangup on last close\n");
Cor2 |= COR2_HUPCL; Cor2 |= COR2_HUPCL;
} }
if ( C_CRTSCTS (TtyP)) { if (C_CRTSCTS(TtyP)) {
rio_dprintk (RIO_DEBUG_PARAM, "Rx hardware flow control enabled\n"); rio_dprintk(RIO_DEBUG_PARAM, "Rx hardware flow control enabled\n");
Cor2 |= COR2_CTSFLOW; Cor2 |= COR2_CTSFLOW;
Cor2 |= COR2_RTSFLOW; Cor2 |= COR2_RTSFLOW;
} else { } else {
rio_dprintk (RIO_DEBUG_PARAM, "Rx hardware flow control disabled\n"); rio_dprintk(RIO_DEBUG_PARAM, "Rx hardware flow control disabled\n");
Cor2 &= ~COR2_CTSFLOW; Cor2 &= ~COR2_CTSFLOW;
Cor2 &= ~COR2_RTSFLOW; Cor2 &= ~COR2_RTSFLOW;
} }
if ( TtyP->termios->c_cflag & CLOCAL ) { if (TtyP->termios->c_cflag & CLOCAL) {
rio_dprintk (RIO_DEBUG_PARAM, "Local line\n"); rio_dprintk(RIO_DEBUG_PARAM, "Local line\n");
} } else {
else { rio_dprintk(RIO_DEBUG_PARAM, "Possible Modem line\n");
rio_dprintk (RIO_DEBUG_PARAM, "Possible Modem line\n");
} }
/* /*
** COR 4 (there is no COR 3) ** COR 4 (there is no COR 3)
*/ */
if ( TtyP->termios->c_iflag & IGNBRK ) { if (TtyP->termios->c_iflag & IGNBRK) {
rio_dprintk (RIO_DEBUG_PARAM, "Ignore break condition\n"); rio_dprintk(RIO_DEBUG_PARAM, "Ignore break condition\n");
Cor4 |= COR4_IGNBRK; Cor4 |= COR4_IGNBRK;
} }
if ( !(TtyP->termios->c_iflag & BRKINT) ) { if (!(TtyP->termios->c_iflag & BRKINT)) {
rio_dprintk (RIO_DEBUG_PARAM, "Break generates NULL condition\n"); rio_dprintk(RIO_DEBUG_PARAM, "Break generates NULL condition\n");
Cor4 |= COR4_NBRKINT; Cor4 |= COR4_NBRKINT;
} else { } else {
rio_dprintk (RIO_DEBUG_PARAM, "Interrupt on break condition\n"); rio_dprintk(RIO_DEBUG_PARAM, "Interrupt on break condition\n");
} }
if ( TtyP->termios->c_iflag & INLCR ) { if (TtyP->termios->c_iflag & INLCR) {
rio_dprintk (RIO_DEBUG_PARAM, "Map newline to carriage return on input\n"); rio_dprintk(RIO_DEBUG_PARAM, "Map newline to carriage return on input\n");
Cor4 |= COR4_INLCR; Cor4 |= COR4_INLCR;
} }
if ( TtyP->termios->c_iflag & IGNCR ) { if (TtyP->termios->c_iflag & IGNCR) {
rio_dprintk (RIO_DEBUG_PARAM, "Ignore carriage return on input\n"); rio_dprintk(RIO_DEBUG_PARAM, "Ignore carriage return on input\n");
Cor4 |= COR4_IGNCR; Cor4 |= COR4_IGNCR;
} }
if ( TtyP->termios->c_iflag & ICRNL ) { if (TtyP->termios->c_iflag & ICRNL) {
rio_dprintk (RIO_DEBUG_PARAM, "Map carriage return to newline on input\n"); rio_dprintk(RIO_DEBUG_PARAM, "Map carriage return to newline on input\n");
Cor4 |= COR4_ICRNL; Cor4 |= COR4_ICRNL;
} }
if ( TtyP->termios->c_iflag & IGNPAR ) { if (TtyP->termios->c_iflag & IGNPAR) {
rio_dprintk (RIO_DEBUG_PARAM, "Ignore characters with parity errors\n"); rio_dprintk(RIO_DEBUG_PARAM, "Ignore characters with parity errors\n");
Cor4 |= COR4_IGNPAR; Cor4 |= COR4_IGNPAR;
} }
if ( TtyP->termios->c_iflag & PARMRK ) { if (TtyP->termios->c_iflag & PARMRK) {
rio_dprintk (RIO_DEBUG_PARAM, "Mark parity errors\n"); rio_dprintk(RIO_DEBUG_PARAM, "Mark parity errors\n");
Cor4 |= COR4_PARMRK; Cor4 |= COR4_PARMRK;
} }
...@@ -455,26 +444,26 @@ int SleepFlag; ...@@ -455,26 +444,26 @@ int SleepFlag;
/* /*
** Could set LNE here if you wanted LNext processing. SVR4 will use it. ** Could set LNE here if you wanted LNext processing. SVR4 will use it.
*/ */
if ( TtyP->termios->c_iflag & ISTRIP ) { if (TtyP->termios->c_iflag & ISTRIP) {
rio_dprintk (RIO_DEBUG_PARAM, "Strip input characters\n"); rio_dprintk(RIO_DEBUG_PARAM, "Strip input characters\n");
if (! (PortP->State & RIO_TRIAD_MODE)) { if (!(PortP->State & RIO_TRIAD_MODE)) {
Cor5 |= COR5_ISTRIP; Cor5 |= COR5_ISTRIP;
} }
} }
if ( TtyP->termios->c_oflag & ONLCR ) { if (TtyP->termios->c_oflag & ONLCR) {
rio_dprintk (RIO_DEBUG_PARAM, "Map newline to carriage-return, newline on output\n"); rio_dprintk(RIO_DEBUG_PARAM, "Map newline to carriage-return, newline on output\n");
if ( PortP->CookMode == COOK_MEDIUM ) if (PortP->CookMode == COOK_MEDIUM)
Cor5 |= COR5_ONLCR; Cor5 |= COR5_ONLCR;
} }
if ( TtyP->termios->c_oflag & OCRNL ) { if (TtyP->termios->c_oflag & OCRNL) {
rio_dprintk (RIO_DEBUG_PARAM, "Map carriage return to newline on output\n"); rio_dprintk(RIO_DEBUG_PARAM, "Map carriage return to newline on output\n");
if ( PortP->CookMode == COOK_MEDIUM ) if (PortP->CookMode == COOK_MEDIUM)
Cor5 |= COR5_OCRNL; Cor5 |= COR5_OCRNL;
} }
if ( ( TtyP->termios->c_oflag & TABDLY) == TAB3 ) { if ((TtyP->termios->c_oflag & TABDLY) == TAB3) {
rio_dprintk (RIO_DEBUG_PARAM, "Tab delay 3 set\n"); rio_dprintk(RIO_DEBUG_PARAM, "Tab delay 3 set\n");
if ( PortP->CookMode == COOK_MEDIUM ) if (PortP->CookMode == COOK_MEDIUM)
Cor5 |= COR5_TAB3; Cor5 |= COR5_TAB3;
} }
...@@ -493,99 +482,112 @@ int SleepFlag; ...@@ -493,99 +482,112 @@ int SleepFlag;
/* /*
** Baud rate bytes ** Baud rate bytes
*/ */
rio_dprintk (RIO_DEBUG_PARAM, "Mapping of rx/tx baud %x (%x)\n", rio_dprintk(RIO_DEBUG_PARAM, "Mapping of rx/tx baud %x (%x)\n", TtyP->termios->c_cflag, CBAUD);
TtyP->termios->c_cflag, CBAUD);
switch (TtyP->termios->c_cflag & CBAUD) { switch (TtyP->termios->c_cflag & CBAUD) {
#define e(b) case B ## b : RxBaud = TxBaud = RIO_B ## b ;break #define e(b) case B ## b : RxBaud = TxBaud = RIO_B ## b ;break
e(50);e(75);e(110);e(134);e(150);e(200);e(300);e(600);e(1200); e(50);
e(1800);e(2400);e(4800);e(9600);e(19200);e(38400);e(57600); e(75);
e(110);
e(134);
e(150);
e(200);
e(300);
e(600);
e(1200);
e(1800);
e(2400);
e(4800);
e(9600);
e(19200);
e(38400);
e(57600);
e(115200); /* e(230400);e(460800); e(921600); */ e(115200); /* e(230400);e(460800); e(921600); */
} }
/* XXX MIssing conversion table. XXX */ /* XXX MIssing conversion table. XXX */
/* (TtyP->termios->c_cflag & V_CBAUD); */ /* (TtyP->termios->c_cflag & V_CBAUD); */
rio_dprintk (RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud); rio_dprintk(RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud);
/* /*
** Leftovers ** Leftovers
*/ */
if ( TtyP->termios->c_cflag & CREAD ) if (TtyP->termios->c_cflag & CREAD)
rio_dprintk (RIO_DEBUG_PARAM, "Enable receiver\n"); rio_dprintk(RIO_DEBUG_PARAM, "Enable receiver\n");
#ifdef RCV1EN #ifdef RCV1EN
if ( TtyP->termios->c_cflag & RCV1EN ) if (TtyP->termios->c_cflag & RCV1EN)
rio_dprintk (RIO_DEBUG_PARAM, "RCV1EN (?)\n"); rio_dprintk(RIO_DEBUG_PARAM, "RCV1EN (?)\n");
#endif #endif
#ifdef XMT1EN #ifdef XMT1EN
if ( TtyP->termios->c_cflag & XMT1EN ) if (TtyP->termios->c_cflag & XMT1EN)
rio_dprintk (RIO_DEBUG_PARAM, "XMT1EN (?)\n"); rio_dprintk(RIO_DEBUG_PARAM, "XMT1EN (?)\n");
#endif #endif
#if 0 #if 0
if ( TtyP->termios->c_cflag & LOBLK ) if (TtyP->termios->c_cflag & LOBLK)
rio_dprintk (RIO_DEBUG_PARAM, "LOBLK - JCL output blocks when not current\n"); rio_dprintk(RIO_DEBUG_PARAM, "LOBLK - JCL output blocks when not current\n");
#endif #endif
if ( TtyP->termios->c_lflag & ISIG ) if (TtyP->termios->c_lflag & ISIG)
rio_dprintk (RIO_DEBUG_PARAM, "Input character signal generating enabled\n"); rio_dprintk(RIO_DEBUG_PARAM, "Input character signal generating enabled\n");
if ( TtyP->termios->c_lflag & ICANON ) if (TtyP->termios->c_lflag & ICANON)
rio_dprintk (RIO_DEBUG_PARAM, "Canonical input: erase and kill enabled\n"); rio_dprintk(RIO_DEBUG_PARAM, "Canonical input: erase and kill enabled\n");
if ( TtyP->termios->c_lflag & XCASE ) if (TtyP->termios->c_lflag & XCASE)
rio_dprintk (RIO_DEBUG_PARAM, "Canonical upper/lower presentation\n"); rio_dprintk(RIO_DEBUG_PARAM, "Canonical upper/lower presentation\n");
if ( TtyP->termios->c_lflag & ECHO ) if (TtyP->termios->c_lflag & ECHO)
rio_dprintk (RIO_DEBUG_PARAM, "Enable input echo\n"); rio_dprintk(RIO_DEBUG_PARAM, "Enable input echo\n");
if ( TtyP->termios->c_lflag & ECHOE ) if (TtyP->termios->c_lflag & ECHOE)
rio_dprintk (RIO_DEBUG_PARAM, "Enable echo erase\n"); rio_dprintk(RIO_DEBUG_PARAM, "Enable echo erase\n");
if ( TtyP->termios->c_lflag & ECHOK ) if (TtyP->termios->c_lflag & ECHOK)
rio_dprintk (RIO_DEBUG_PARAM, "Enable echo kill\n"); rio_dprintk(RIO_DEBUG_PARAM, "Enable echo kill\n");
if ( TtyP->termios->c_lflag & ECHONL ) if (TtyP->termios->c_lflag & ECHONL)
rio_dprintk (RIO_DEBUG_PARAM, "Enable echo newline\n"); rio_dprintk(RIO_DEBUG_PARAM, "Enable echo newline\n");
if ( TtyP->termios->c_lflag & NOFLSH ) if (TtyP->termios->c_lflag & NOFLSH)
rio_dprintk (RIO_DEBUG_PARAM, "Disable flush after interrupt or quit\n"); rio_dprintk(RIO_DEBUG_PARAM, "Disable flush after interrupt or quit\n");
#ifdef TOSTOP #ifdef TOSTOP
if ( TtyP->termios->c_lflag & TOSTOP ) if (TtyP->termios->c_lflag & TOSTOP)
rio_dprintk (RIO_DEBUG_PARAM, "Send SIGTTOU for background output\n"); rio_dprintk(RIO_DEBUG_PARAM, "Send SIGTTOU for background output\n");
#endif #endif
#ifdef XCLUDE #ifdef XCLUDE
if ( TtyP->termios->c_lflag & XCLUDE ) if (TtyP->termios->c_lflag & XCLUDE)
rio_dprintk (RIO_DEBUG_PARAM, "Exclusive use of this line\n"); rio_dprintk(RIO_DEBUG_PARAM, "Exclusive use of this line\n");
#endif #endif
if ( TtyP->termios->c_iflag & IUCLC ) if (TtyP->termios->c_iflag & IUCLC)
rio_dprintk (RIO_DEBUG_PARAM, "Map uppercase to lowercase on input\n"); rio_dprintk(RIO_DEBUG_PARAM, "Map uppercase to lowercase on input\n");
if ( TtyP->termios->c_oflag & OPOST ) if (TtyP->termios->c_oflag & OPOST)
rio_dprintk (RIO_DEBUG_PARAM, "Enable output post-processing\n"); rio_dprintk(RIO_DEBUG_PARAM, "Enable output post-processing\n");
if ( TtyP->termios->c_oflag & OLCUC ) if (TtyP->termios->c_oflag & OLCUC)
rio_dprintk (RIO_DEBUG_PARAM, "Map lowercase to uppercase on output\n"); rio_dprintk(RIO_DEBUG_PARAM, "Map lowercase to uppercase on output\n");
if ( TtyP->termios->c_oflag & ONOCR ) if (TtyP->termios->c_oflag & ONOCR)
rio_dprintk (RIO_DEBUG_PARAM, "No carriage return output at column 0\n"); rio_dprintk(RIO_DEBUG_PARAM, "No carriage return output at column 0\n");
if ( TtyP->termios->c_oflag & ONLRET ) if (TtyP->termios->c_oflag & ONLRET)
rio_dprintk (RIO_DEBUG_PARAM, "Newline performs carriage return function\n"); rio_dprintk(RIO_DEBUG_PARAM, "Newline performs carriage return function\n");
if ( TtyP->termios->c_oflag & OFILL ) if (TtyP->termios->c_oflag & OFILL)
rio_dprintk (RIO_DEBUG_PARAM, "Use fill characters for delay\n"); rio_dprintk(RIO_DEBUG_PARAM, "Use fill characters for delay\n");
if ( TtyP->termios->c_oflag & OFDEL ) if (TtyP->termios->c_oflag & OFDEL)
rio_dprintk (RIO_DEBUG_PARAM, "Fill character is DEL\n"); rio_dprintk(RIO_DEBUG_PARAM, "Fill character is DEL\n");
if ( TtyP->termios->c_oflag & NLDLY ) if (TtyP->termios->c_oflag & NLDLY)
rio_dprintk (RIO_DEBUG_PARAM, "Newline delay set\n"); rio_dprintk(RIO_DEBUG_PARAM, "Newline delay set\n");
if ( TtyP->termios->c_oflag & CRDLY ) if (TtyP->termios->c_oflag & CRDLY)
rio_dprintk (RIO_DEBUG_PARAM, "Carriage return delay set\n"); rio_dprintk(RIO_DEBUG_PARAM, "Carriage return delay set\n");
if ( TtyP->termios->c_oflag & TABDLY ) if (TtyP->termios->c_oflag & TABDLY)
rio_dprintk (RIO_DEBUG_PARAM, "Tab delay set\n"); rio_dprintk(RIO_DEBUG_PARAM, "Tab delay set\n");
#if 0 #if 0
if ( TtyP->termios->c_oflag & BSDLY ) if (TtyP->termios->c_oflag & BSDLY)
rio_dprintk (RIO_DEBUG_PARAM, "Back-space delay set\n"); rio_dprintk(RIO_DEBUG_PARAM, "Back-space delay set\n");
if ( TtyP->termios->c_oflag & VTDLY ) if (TtyP->termios->c_oflag & VTDLY)
rio_dprintk (RIO_DEBUG_PARAM, "Vertical tab delay set\n"); rio_dprintk(RIO_DEBUG_PARAM, "Vertical tab delay set\n");
if ( TtyP->termios->c_oflag & FFDLY ) if (TtyP->termios->c_oflag & FFDLY)
rio_dprintk (RIO_DEBUG_PARAM, "Form-feed delay set\n"); rio_dprintk(RIO_DEBUG_PARAM, "Form-feed delay set\n");
#endif #endif
/* /*
** These things are kind of useful in a later life! ** These things are kind of useful in a later life!
*/ */
PortP->Cor2Copy = Cor2; PortP->Cor2Copy = Cor2;
if ( PortP->State & RIO_DELETED ) { if (PortP->State & RIO_DELETED) {
rio_spin_unlock_irqrestore( &PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
func_exit (); func_exit();
return RIO_FAIL; return RIO_FAIL;
} }
...@@ -609,7 +611,7 @@ int SleepFlag; ...@@ -609,7 +611,7 @@ int SleepFlag;
/* /*
** Set the length/command field ** Set the length/command field
*/ */
WBYTE(PacketP->len , 12 | PKT_CMD_BIT); WBYTE(PacketP->len, 12 | PKT_CMD_BIT);
/* /*
** The packet is formed - now, whack it off ** The packet is formed - now, whack it off
...@@ -622,13 +624,13 @@ int SleepFlag; ...@@ -622,13 +624,13 @@ int SleepFlag;
if (PortP->statsGather) if (PortP->statsGather)
PortP->txchars += 12; PortP->txchars += 12;
rio_spin_unlock_irqrestore( &PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
rio_dprintk (RIO_DEBUG_PARAM, "add_transmit returned.\n"); rio_dprintk(RIO_DEBUG_PARAM, "add_transmit returned.\n");
/* /*
** job done. ** job done.
*/ */
func_exit (); func_exit();
return RIO_SUCCESS; return RIO_SUCCESS;
} }
...@@ -638,16 +640,15 @@ int SleepFlag; ...@@ -638,16 +640,15 @@ int SleepFlag;
** We can add another packet to a transmit queue if the packet pointer pointed ** We can add another packet to a transmit queue if the packet pointer pointed
** to by the TxAdd pointer has PKT_IN_USE clear in its address. ** to by the TxAdd pointer has PKT_IN_USE clear in its address.
*/ */
int int can_add_transmit(PktP, PortP)
can_add_transmit(PktP, PortP)
PKT **PktP; PKT **PktP;
struct Port *PortP; struct Port *PortP;
{ {
register PKT *tp; register PKT *tp;
*PktP = tp = (PKT *)RIO_PTR(PortP->Caddr,RWORD(*PortP->TxAdd)); *PktP = tp = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->TxAdd));
return !((uint)tp & PKT_IN_USE); return !((uint) tp & PKT_IN_USE);
} }
/* /*
...@@ -655,25 +656,22 @@ struct Port *PortP; ...@@ -655,25 +656,22 @@ struct Port *PortP;
** and then move the TxAdd pointer along one position to point to the next ** and then move the TxAdd pointer along one position to point to the next
** packet pointer. You must wrap the pointer from the end back to the start. ** packet pointer. You must wrap the pointer from the end back to the start.
*/ */
void void add_transmit(PortP)
add_transmit(PortP)
struct Port *PortP; struct Port *PortP;
{ {
if (RWORD(*PortP->TxAdd) & PKT_IN_USE) { if (RWORD(*PortP->TxAdd) & PKT_IN_USE) {
rio_dprintk (RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!"); rio_dprintk(RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!");
} }
WWORD( *(ushort *)PortP->TxAdd, RWORD(*PortP->TxAdd) | PKT_IN_USE); WWORD(*(ushort *) PortP->TxAdd, RWORD(*PortP->TxAdd) | PKT_IN_USE);
PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : PortP->TxAdd + 1;
PortP->TxAdd + 1; WWORD(PortP->PhbP->tx_add, RIO_OFF(PortP->Caddr, PortP->TxAdd));
WWORD( PortP->PhbP->tx_add , RIO_OFF(PortP->Caddr,PortP->TxAdd) );
} }
/**************************************** /****************************************
* Put a packet onto the end of the * Put a packet onto the end of the
* free list * free list
****************************************/ ****************************************/
void void put_free_end(HostP, PktP)
put_free_end(HostP, PktP)
struct Host *HostP; struct Host *HostP;
PKT *PktP; PKT *PktP;
{ {
...@@ -688,24 +686,23 @@ PKT *PktP; ...@@ -688,24 +686,23 @@ PKT *PktP;
* *
************************************************/ ************************************************/
rio_dprintk (RIO_DEBUG_PFE, "put_free_end(PktP=%x)\n",(int)PktP); rio_dprintk(RIO_DEBUG_PFE, "put_free_end(PktP=%x)\n", (int) PktP);
if ((old_end=RWORD(HostP->ParmMapP->free_list_end)) != TPNULL) { if ((old_end = RWORD(HostP->ParmMapP->free_list_end)) != TPNULL) {
new_end = RIO_OFF(HostP->Caddr,PktP); new_end = RIO_OFF(HostP->Caddr, PktP);
tmp_pointer = (FREE_LIST *)RIO_PTR(HostP->Caddr,old_end); tmp_pointer = (FREE_LIST *) RIO_PTR(HostP->Caddr, old_end);
WWORD(tmp_pointer->next , new_end ); WWORD(tmp_pointer->next, new_end);
WWORD(((FREE_LIST *)PktP)->prev , old_end); WWORD(((FREE_LIST *) PktP)->prev, old_end);
WWORD(((FREE_LIST *)PktP)->next , TPNULL); WWORD(((FREE_LIST *) PktP)->next, TPNULL);
WWORD(HostP->ParmMapP->free_list_end, new_end); WWORD(HostP->ParmMapP->free_list_end, new_end);
} } else { /* First packet on the free list this should never happen! */
else { /* First packet on the free list this should never happen! */ rio_dprintk(RIO_DEBUG_PFE, "put_free_end(): This should never happen\n");
rio_dprintk (RIO_DEBUG_PFE, "put_free_end(): This should never happen\n"); WWORD(HostP->ParmMapP->free_list_end, RIO_OFF(HostP->Caddr, PktP));
WWORD(HostP->ParmMapP->free_list_end , RIO_OFF(HostP->Caddr,PktP)); tmp_pointer = (FREE_LIST *) PktP;
tmp_pointer = (FREE_LIST *)PktP; WWORD(tmp_pointer->prev, TPNULL);
WWORD(tmp_pointer->prev , TPNULL); WWORD(tmp_pointer->next, TPNULL);
WWORD(tmp_pointer->next , TPNULL); }
} rio_dprintk(RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock);
rio_dprintk (RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock);
rio_spin_unlock_irqrestore(&HostP->HostLock, flags); rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
} }
...@@ -715,14 +712,12 @@ PKT *PktP; ...@@ -715,14 +712,12 @@ PKT *PktP;
** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear, ** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear,
** then can_remove_receive() returns 0. ** then can_remove_receive() returns 0.
*/ */
int int can_remove_receive(PktP, PortP)
can_remove_receive(PktP, PortP)
PKT **PktP; PKT **PktP;
struct Port *PortP; struct Port *PortP;
{ {
if ( RWORD(*PortP->RxRemove) & PKT_IN_USE) { if (RWORD(*PortP->RxRemove) & PKT_IN_USE) {
*PktP = (PKT *)RIO_PTR(PortP->Caddr, *PktP = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->RxRemove) & ~PKT_IN_USE);
RWORD(*PortP->RxRemove) & ~PKT_IN_USE);
return 1; return 1;
} }
return 0; return 0;
...@@ -733,12 +728,10 @@ struct Port *PortP; ...@@ -733,12 +728,10 @@ struct Port *PortP;
** and then bump the pointers. Once the pointers get to the end, they must ** and then bump the pointers. Once the pointers get to the end, they must
** be wrapped back to the start. ** be wrapped back to the start.
*/ */
void void remove_receive(PortP)
remove_receive(PortP)
struct Port *PortP; struct Port *PortP;
{ {
WWORD( *PortP->RxRemove, RWORD(*PortP->RxRemove) & ~PKT_IN_USE ); WWORD(*PortP->RxRemove, RWORD(*PortP->RxRemove) & ~PKT_IN_USE);
PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : PortP->RxRemove + 1;
PortP->RxRemove + 1; WWORD(PortP->PhbP->rx_remove, RIO_OFF(PortP->Caddr, PortP->RxRemove));
WWORD( PortP->PhbP->rx_remove , RIO_OFF(PortP->Caddr, PortP->RxRemove) );
} }
/* Yeah. We have copyright on this one. Sure. */ /* Yeah. We have copyright on this one. Sure. */
void rio_pcicopy( char *from, char *to, int amount) void rio_pcicopy(char *from, char *to, int amount)
{ {
while ( amount-- ) while (amount--)
*to++ = *from++; *to++ = *from++;
} }
...@@ -93,9 +93,9 @@ static void RIOConCon(struct rio_info *, struct Host *, uint, uint, uint, uint, ...@@ -93,9 +93,9 @@ static void RIOConCon(struct rio_info *, struct Host *, uint, uint, uint, uint,
** Incoming on the ROUTE_RUP ** Incoming on the ROUTE_RUP
** I wrote this while I was tired. Forgive me. ** I wrote this while I was tired. Forgive me.
*/ */
int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ) int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
{ {
struct PktCmd *PktCmdP = (struct PktCmd *)PacketP->data; struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data;
struct PktCmd_M *PktReplyP; struct PktCmd_M *PktReplyP;
struct CmdBlk *CmdBlkP; struct CmdBlk *CmdBlkP;
struct Port *PortP; struct Port *PortP;
...@@ -124,8 +124,7 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ...@@ -124,8 +124,7 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
/* /*
** Is this unit telling us it's current link topology? ** Is this unit telling us it's current link topology?
*/ */
if ( RBYTE(PktCmdP->Command) == ROUTE_TOPOLOGY ) if (RBYTE(PktCmdP->Command) == ROUTE_TOPOLOGY) {
{
MapP = HostP->Mapping; MapP = HostP->Mapping;
/* /*
...@@ -135,17 +134,14 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ...@@ -135,17 +134,14 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
** from an RTA then we need to fill in the Mapping structure's ** from an RTA then we need to fill in the Mapping structure's
** Topology array for the unit. ** Topology array for the unit.
*/ */
if ( Rup >= (ushort)MAX_RUP ) if (Rup >= (ushort) MAX_RUP) {
{
ThisUnit = HOST_ID; ThisUnit = HOST_ID;
TopP = HostP->Topology; TopP = HostP->Topology;
MyType = "Host"; MyType = "Host";
MyName = HostP->Name; MyName = HostP->Name;
ThisLinkMin = ThisLinkMax = Rup - MAX_RUP; ThisLinkMin = ThisLinkMax = Rup - MAX_RUP;
} } else {
else ThisUnit = Rup + 1;
{
ThisUnit = Rup+1;
TopP = HostP->Mapping[Rup].Topology; TopP = HostP->Mapping[Rup].Topology;
MyType = "RTA"; MyType = "RTA";
MyName = HostP->Mapping[Rup].Name; MyName = HostP->Mapping[Rup].Name;
...@@ -159,47 +155,35 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ...@@ -159,47 +155,35 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
** place, then ignore this packet completely. ** place, then ignore this packet completely.
*/ */
Lies = 0; Lies = 0;
for ( ThisLink=ThisLinkMin + 1; ThisLink <= ThisLinkMax; ThisLink++) for (ThisLink = ThisLinkMin + 1; ThisLink <= ThisLinkMax; ThisLink++) {
{
/* /*
** it won't lie about network interconnect, total disconnects ** it won't lie about network interconnect, total disconnects
** and no-IDs. (or at least, it doesn't *matter* if it does) ** and no-IDs. (or at least, it doesn't *matter* if it does)
*/ */
if ( RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) > (ushort)MAX_RUP ) if (RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) > (ushort) MAX_RUP)
continue; continue;
for ( NewLink=ThisLinkMin; NewLink < ThisLink; NewLink++ ) for (NewLink = ThisLinkMin; NewLink < ThisLink; NewLink++) {
{ if ((RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) == RBYTE(PktCmdP->RouteTopology[NewLink].Unit)) && (RBYTE(PktCmdP->RouteTopology[ThisLink].Link) == RBYTE(PktCmdP->RouteTopology[NewLink].Link))) {
if ( (RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) ==
RBYTE(PktCmdP->RouteTopology[NewLink].Unit)) &&
(RBYTE(PktCmdP->RouteTopology[ThisLink].Link) ==
RBYTE(PktCmdP->RouteTopology[NewLink].Link)) )
{
Lies++; Lies++;
} }
} }
} }
if ( Lies ) if (Lies) {
{ rio_dprintk(RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n", Lies);
rio_dprintk (RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n",Lies); rio_dprintk(RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n",
rio_dprintk (RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n",
RBYTE(PktCmdP->RouteTopology[0].Unit), RBYTE(PktCmdP->RouteTopology[0].Unit),
'A'+RBYTE(PktCmdP->RouteTopology[0].Link), 'A' + RBYTE(PktCmdP->RouteTopology[0].Link),
RBYTE(PktCmdP->RouteTopology[1].Unit), RBYTE(PktCmdP->RouteTopology[1].Unit),
'A'+RBYTE(PktCmdP->RouteTopology[1].Link), 'A' + RBYTE(PktCmdP->RouteTopology[1].Link), RBYTE(PktCmdP->RouteTopology[2].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[2].Link), RBYTE(PktCmdP->RouteTopology[3].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[3].Link));
RBYTE(PktCmdP->RouteTopology[2].Unit),
'A'+RBYTE(PktCmdP->RouteTopology[2].Link),
RBYTE(PktCmdP->RouteTopology[3].Unit),
'A'+RBYTE(PktCmdP->RouteTopology[3].Link));
return TRUE; return TRUE;
} }
/* /*
** now, process each link. ** now, process each link.
*/ */
for ( ThisLink=ThisLinkMin; ThisLink <= ThisLinkMax; ThisLink++) for (ThisLink = ThisLinkMin; ThisLink <= ThisLinkMax; ThisLink++) {
{
/* /*
** this is what it was connected to ** this is what it was connected to
*/ */
...@@ -212,25 +196,14 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ...@@ -212,25 +196,14 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
NewUnit = RBYTE(PktCmdP->RouteTopology[ThisLink].Unit); NewUnit = RBYTE(PktCmdP->RouteTopology[ThisLink].Unit);
NewLink = RBYTE(PktCmdP->RouteTopology[ThisLink].Link); NewLink = RBYTE(PktCmdP->RouteTopology[ThisLink].Link);
if ( OldUnit != NewUnit || OldLink != NewLink ) if (OldUnit != NewUnit || OldLink != NewLink) {
{
/* /*
** something has changed! ** something has changed!
*/ */
if ( NewUnit > MAX_RUP && if (NewUnit > MAX_RUP && NewUnit != ROUTE_DISCONNECT && NewUnit != ROUTE_NO_ID && NewUnit != ROUTE_INTERCONNECT) {
NewUnit != ROUTE_DISCONNECT && rio_dprintk(RIO_DEBUG_ROUTE, "I have a link from %s %s to unit %d:%d - I don't like it.\n", MyType, MyName, NewUnit, NewLink);
NewUnit != ROUTE_NO_ID && } else {
NewUnit != ROUTE_INTERCONNECT )
{
rio_dprintk (RIO_DEBUG_ROUTE, "I have a link from %s %s to unit %d:%d - I don't like it.\n",
MyType,
MyName,
NewUnit,
NewLink);
}
else
{
/* /*
** put the new values in ** put the new values in
*/ */
...@@ -239,26 +212,23 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ...@@ -239,26 +212,23 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
RIOSetChange(p); RIOSetChange(p);
if ( OldUnit <= MAX_RUP ) if (OldUnit <= MAX_RUP) {
{
/* /*
** If something has become bust, then re-enable them messages ** If something has become bust, then re-enable them messages
*/ */
if (! p->RIONoMessage) if (!p->RIONoMessage)
RIOConCon(p,HostP,ThisUnit,ThisLink,OldUnit,OldLink,DISCONNECT); RIOConCon(p, HostP, ThisUnit, ThisLink, OldUnit, OldLink, DISCONNECT);
} }
if ( ( NewUnit <= MAX_RUP ) && !p->RIONoMessage ) if ((NewUnit <= MAX_RUP) && !p->RIONoMessage)
RIOConCon(p,HostP,ThisUnit,ThisLink,NewUnit,NewLink,CONNECT); RIOConCon(p, HostP, ThisUnit, ThisLink, NewUnit, NewLink, CONNECT);
if ( NewUnit == ROUTE_NO_ID ) if (NewUnit == ROUTE_NO_ID)
rio_dprintk (RIO_DEBUG_ROUTE, "%s %s (%c) is connected to an unconfigured unit.\n", rio_dprintk(RIO_DEBUG_ROUTE, "%s %s (%c) is connected to an unconfigured unit.\n", MyType, MyName, 'A' + ThisLink);
MyType,MyName,'A'+ThisLink);
if ( NewUnit == ROUTE_INTERCONNECT ) if (NewUnit == ROUTE_INTERCONNECT) {
{ if (!p->RIONoMessage)
if (! p->RIONoMessage) cprintf("%s '%s' (%c) is connected to another network.\n", MyType, MyName, 'A' + ThisLink);
cprintf("%s '%s' (%c) is connected to another network.\n", MyType,MyName,'A'+ThisLink);
} }
/* /*
...@@ -266,55 +236,35 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ...@@ -266,55 +236,35 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
** only appears once. Only disconnect the other end if it is pointing ** only appears once. Only disconnect the other end if it is pointing
** at us! ** at us!
*/ */
if ( OldUnit == HOST_ID ) if (OldUnit == HOST_ID) {
{ if (HostP->Topology[OldLink].Unit == ThisUnit && HostP->Topology[OldLink].Link == ThisLink) {
if ( HostP->Topology[OldLink].Unit == ThisUnit && rio_dprintk(RIO_DEBUG_ROUTE, "SETTING HOST (%c) TO DISCONNECTED!\n", OldLink + 'A');
HostP->Topology[OldLink].Link == ThisLink )
{
rio_dprintk (RIO_DEBUG_ROUTE, "SETTING HOST (%c) TO DISCONNECTED!\n", OldLink+'A');
HostP->Topology[OldLink].Unit = ROUTE_DISCONNECT; HostP->Topology[OldLink].Unit = ROUTE_DISCONNECT;
HostP->Topology[OldLink].Link = NO_LINK; HostP->Topology[OldLink].Link = NO_LINK;
} else {
rio_dprintk(RIO_DEBUG_ROUTE, "HOST(%c) WAS NOT CONNECTED TO %s (%c)!\n", OldLink + 'A', HostP->Mapping[ThisUnit - 1].Name, ThisLink + 'A');
}
} else if (OldUnit <= MAX_RUP) {
if (HostP->Mapping[OldUnit - 1].Topology[OldLink].Unit == ThisUnit && HostP->Mapping[OldUnit - 1].Topology[OldLink].Link == ThisLink) {
rio_dprintk(RIO_DEBUG_ROUTE, "SETTING RTA %s (%c) TO DISCONNECTED!\n", HostP->Mapping[OldUnit - 1].Name, OldLink + 'A');
HostP->Mapping[OldUnit - 1].Topology[OldLink].Unit = ROUTE_DISCONNECT;
HostP->Mapping[OldUnit - 1].Topology[OldLink].Link = NO_LINK;
} else {
rio_dprintk(RIO_DEBUG_ROUTE, "RTA %s (%c) WAS NOT CONNECTED TO %s (%c)\n", HostP->Mapping[OldUnit - 1].Name, OldLink + 'A', HostP->Mapping[ThisUnit - 1].Name, ThisLink + 'A');
}
} }
else if (NewUnit == HOST_ID) {
{ rio_dprintk(RIO_DEBUG_ROUTE, "MARKING HOST (%c) CONNECTED TO %s (%c)\n", NewLink + 'A', MyName, ThisLink + 'A');
rio_dprintk (RIO_DEBUG_ROUTE, "HOST(%c) WAS NOT CONNECTED TO %s (%c)!\n",
OldLink+'A',HostP->Mapping[ThisUnit-1].Name,ThisLink+'A');
}
}
else if ( OldUnit <= MAX_RUP )
{
if ( HostP->Mapping[OldUnit-1].Topology[OldLink].Unit == ThisUnit &&
HostP->Mapping[OldUnit-1].Topology[OldLink].Link == ThisLink )
{
rio_dprintk (RIO_DEBUG_ROUTE, "SETTING RTA %s (%c) TO DISCONNECTED!\n",
HostP->Mapping[OldUnit-1].Name,OldLink+'A');
HostP->Mapping[OldUnit-1].Topology[OldLink].Unit=ROUTE_DISCONNECT;
HostP->Mapping[OldUnit-1].Topology[OldLink].Link=NO_LINK;
}
else
{
rio_dprintk (RIO_DEBUG_ROUTE, "RTA %s (%c) WAS NOT CONNECTED TO %s (%c)\n",
HostP->Mapping[OldUnit-1].Name,OldLink+'A',
HostP->Mapping[ThisUnit-1].Name,ThisLink+'A');
}
}
if ( NewUnit == HOST_ID )
{
rio_dprintk (RIO_DEBUG_ROUTE, "MARKING HOST (%c) CONNECTED TO %s (%c)\n",
NewLink+'A',MyName,ThisLink+'A');
HostP->Topology[NewLink].Unit = ThisUnit; HostP->Topology[NewLink].Unit = ThisUnit;
HostP->Topology[NewLink].Link = ThisLink; HostP->Topology[NewLink].Link = ThisLink;
} } else if (NewUnit <= MAX_RUP) {
else if ( NewUnit <= MAX_RUP ) rio_dprintk(RIO_DEBUG_ROUTE, "MARKING RTA %s (%c) CONNECTED TO %s (%c)\n", HostP->Mapping[NewUnit - 1].Name, NewLink + 'A', MyName, ThisLink + 'A');
{ HostP->Mapping[NewUnit - 1].Topology[NewLink].Unit = ThisUnit;
rio_dprintk (RIO_DEBUG_ROUTE, "MARKING RTA %s (%c) CONNECTED TO %s (%c)\n", HostP->Mapping[NewUnit - 1].Topology[NewLink].Link = ThisLink;
HostP->Mapping[NewUnit-1].Name,NewLink+'A',MyName,ThisLink+'A');
HostP->Mapping[NewUnit-1].Topology[NewLink].Unit=ThisUnit;
HostP->Mapping[NewUnit-1].Topology[NewLink].Link=ThisLink;
} }
} }
RIOSetChange(p); RIOSetChange(p);
RIOCheckIsolated(p, HostP, OldUnit ); RIOCheckIsolated(p, HostP, OldUnit);
} }
} }
return TRUE; return TRUE;
...@@ -323,55 +273,43 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ...@@ -323,55 +273,43 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
/* /*
** The only other command we recognise is a route_request command ** The only other command we recognise is a route_request command
*/ */
if ( RBYTE(PktCmdP->Command) != ROUTE_REQUEST ) if (RBYTE(PktCmdP->Command) != ROUTE_REQUEST) {
{ rio_dprintk(RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %d ROUTE_RUP\n", RBYTE(PktCmdP->Command), Rup, (int) HostP);
rio_dprintk (RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %d ROUTE_RUP\n",
RBYTE(PktCmdP->Command),Rup,(int)HostP);
return TRUE; return TRUE;
} }
RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + (RBYTE(PktCmdP->UniqNum[1]) << 8) + (RBYTE(PktCmdP->UniqNum[2]) << 16) + (RBYTE(PktCmdP->UniqNum[3]) << 24);
(RBYTE(PktCmdP->UniqNum[1]) << 8) +
(RBYTE(PktCmdP->UniqNum[2]) << 16) +
(RBYTE(PktCmdP->UniqNum[3]) << 24);
/* /*
** Determine if 8 or 16 port RTA ** Determine if 8 or 16 port RTA
*/ */
RtaType = GetUnitType(RtaUniq); RtaType = GetUnitType(RtaUniq);
rio_dprintk (RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq); rio_dprintk(RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq);
Mod = RBYTE(PktCmdP->ModuleTypes); Mod = RBYTE(PktCmdP->ModuleTypes);
Mod1 = LONYBLE(Mod); Mod1 = LONYBLE(Mod);
if (RtaType == TYPE_RTA16) if (RtaType == TYPE_RTA16) {
{
/* /*
** Only one ident is set for a 16 port RTA. To make compatible ** Only one ident is set for a 16 port RTA. To make compatible
** with 8 port, set 2nd ident in Mod2 to the same as Mod1. ** with 8 port, set 2nd ident in Mod2 to the same as Mod1.
*/ */
Mod2 = Mod1; Mod2 = Mod1;
rio_dprintk (RIO_DEBUG_ROUTE, "Backplane type is %s (all ports)\n", rio_dprintk(RIO_DEBUG_ROUTE, "Backplane type is %s (all ports)\n", p->RIOModuleTypes[Mod1].Name);
p->RIOModuleTypes[Mod1].Name); } else {
}
else
{
Mod2 = HINYBLE(Mod); Mod2 = HINYBLE(Mod);
rio_dprintk (RIO_DEBUG_ROUTE, "Module types are %s (ports 0-3) and %s (ports 4-7)\n", rio_dprintk(RIO_DEBUG_ROUTE, "Module types are %s (ports 0-3) and %s (ports 4-7)\n", p->RIOModuleTypes[Mod1].Name, p->RIOModuleTypes[Mod2].Name);
p->RIOModuleTypes[Mod1].Name, p->RIOModuleTypes[Mod2].Name);
} }
if ( RtaUniq == 0xffffffff ) if (RtaUniq == 0xffffffff) {
{ ShowPacket(DBG_SPECIAL, PacketP);
ShowPacket( DBG_SPECIAL, PacketP );
} }
/* /*
** try to unhook a command block from the command free list. ** try to unhook a command block from the command free list.
*/ */
if ( !(CmdBlkP = RIOGetCmdBlk()) ) if (!(CmdBlkP = RIOGetCmdBlk())) {
{ rio_dprintk(RIO_DEBUG_ROUTE, "No command blocks to route RTA! come back later.\n");
rio_dprintk (RIO_DEBUG_ROUTE, "No command blocks to route RTA! come back later.\n");
return 0; return 0;
} }
...@@ -384,12 +322,10 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ...@@ -384,12 +322,10 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
CmdBlkP->Packet.src_port = ROUTE_RUP; CmdBlkP->Packet.src_port = ROUTE_RUP;
CmdBlkP->Packet.len = PKT_CMD_BIT | 1; CmdBlkP->Packet.len = PKT_CMD_BIT | 1;
CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL; CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL;
PktReplyP = (struct PktCmd_M *)CmdBlkP->Packet.data; PktReplyP = (struct PktCmd_M *) CmdBlkP->Packet.data;
if (! RIOBootOk(p, HostP, RtaUniq)) if (!RIOBootOk(p, HostP, RtaUniq)) {
{ rio_dprintk(RIO_DEBUG_ROUTE, "RTA %x tried to get an ID, but does not belong - FOAD it!\n", RtaUniq);
rio_dprintk (RIO_DEBUG_ROUTE, "RTA %x tried to get an ID, but does not belong - FOAD it!\n",
RtaUniq);
PktReplyP->Command = ROUTE_FOAD; PktReplyP->Command = ROUTE_FOAD;
HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
RIOQueueCmdBlk(HostP, Rup, CmdBlkP); RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
...@@ -399,48 +335,33 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ...@@ -399,48 +335,33 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
/* /*
** Check to see if the RTA is configured for this host ** Check to see if the RTA is configured for this host
*/ */
for ( ThisUnit=0; ThisUnit<MAX_RUP; ThisUnit++ ) for (ThisUnit = 0; ThisUnit < MAX_RUP; ThisUnit++) {
{ rio_dprintk(RIO_DEBUG_ROUTE, "Entry %d Flags=%s %s UniqueNum=0x%x\n",
rio_dprintk (RIO_DEBUG_ROUTE, "Entry %d Flags=%s %s UniqueNum=0x%x\n", ThisUnit, HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE ? "Slot-In-Use" : "Not In Use", HostP->Mapping[ThisUnit].Flags & SLOT_TENTATIVE ? "Slot-Tentative" : "Not Tentative", HostP->Mapping[ThisUnit].RtaUniqueNum);
ThisUnit,
HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE ?
"Slot-In-Use":"Not In Use",
HostP->Mapping[ThisUnit].Flags & SLOT_TENTATIVE ?
"Slot-Tentative":"Not Tentative",
HostP->Mapping[ThisUnit].RtaUniqueNum);
/* /*
** We have an entry for it. ** We have an entry for it.
*/ */
if ( (HostP->Mapping[ThisUnit].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) && if ((HostP->Mapping[ThisUnit].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) && (HostP->Mapping[ThisUnit].RtaUniqueNum == RtaUniq)) {
(HostP->Mapping[ThisUnit].RtaUniqueNum == RtaUniq) ) if (RtaType == TYPE_RTA16) {
{
if (RtaType == TYPE_RTA16)
{
ThisUnit2 = HostP->Mapping[ThisUnit].ID2 - 1; ThisUnit2 = HostP->Mapping[ThisUnit].ID2 - 1;
rio_dprintk (RIO_DEBUG_ROUTE, "Found unit 0x%x at slots %d+%d\n", rio_dprintk(RIO_DEBUG_ROUTE, "Found unit 0x%x at slots %d+%d\n", RtaUniq, ThisUnit, ThisUnit2);
RtaUniq,ThisUnit,ThisUnit2); } else
} rio_dprintk(RIO_DEBUG_ROUTE, "Found unit 0x%x at slot %d\n", RtaUniq, ThisUnit);
else
rio_dprintk (RIO_DEBUG_ROUTE, "Found unit 0x%x at slot %d\n",
RtaUniq,ThisUnit);
/* /*
** If we have no knowledge of booting it, then the host has ** If we have no knowledge of booting it, then the host has
** been re-booted, and so we must kill the RTA, so that it ** been re-booted, and so we must kill the RTA, so that it
** will be booted again (potentially with new bins) ** will be booted again (potentially with new bins)
** and it will then re-ask for an ID, which we will service. ** and it will then re-ask for an ID, which we will service.
*/ */
if ( (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && if ((HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && !(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED)) {
!(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED) ) if (!(HostP->Mapping[ThisUnit].Flags & MSG_DONE)) {
{ if (!p->RIONoMessage)
if ( !(HostP->Mapping[ThisUnit].Flags & MSG_DONE) ) cprintf("RTA '%s' is being updated.\n", HostP->Mapping[ThisUnit].Name);
{
if ( !p->RIONoMessage )
cprintf("RTA '%s' is being updated.\n",HostP->Mapping[ThisUnit].Name);
HostP->Mapping[ThisUnit].Flags |= MSG_DONE; HostP->Mapping[ThisUnit].Flags |= MSG_DONE;
} }
PktReplyP->Command = ROUTE_FOAD; PktReplyP->Command = ROUTE_FOAD;
HostP->Copy("RT_FOAD",PktReplyP->CommandText,7); HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
RIOQueueCmdBlk(HostP, Rup, CmdBlkP); RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
return TRUE; return TRUE;
} }
...@@ -452,61 +373,49 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ...@@ -452,61 +373,49 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
** RTA with ID 1!!!! ** RTA with ID 1!!!!
*/ */
PktReplyP->Command = ROUTE_ALLOCATE; PktReplyP->Command = ROUTE_ALLOCATE;
PktReplyP->IDNum = ThisUnit+1; PktReplyP->IDNum = ThisUnit + 1;
if (RtaType == TYPE_RTA16) if (RtaType == TYPE_RTA16) {
{
if (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) if (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE)
/* /*
** Adjust the phb and tx pkt dest_units for 2nd block of 8 ** Adjust the phb and tx pkt dest_units for 2nd block of 8
** only if the RTA has ports associated (SLOT_IN_USE) ** only if the RTA has ports associated (SLOT_IN_USE)
*/ */
RIOFixPhbs(p, HostP, ThisUnit2); RIOFixPhbs(p, HostP, ThisUnit2);
PktReplyP->IDNum2 = ThisUnit2+1; PktReplyP->IDNum2 = ThisUnit2 + 1;
rio_dprintk (RIO_DEBUG_ROUTE, "RTA '%s' has been allocated IDs %d+%d\n", rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated IDs %d+%d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum, PktReplyP->IDNum2);
HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum, PktReplyP->IDNum2); } else {
}
else
{
PktReplyP->IDNum2 = ROUTE_NO_ID; PktReplyP->IDNum2 = ROUTE_NO_ID;
rio_dprintk (RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n", rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum);
HostP->Mapping[ThisUnit].Name,PktReplyP->IDNum);
} }
HostP->Copy("RT_ALLOCAT",PktReplyP->CommandText,10); HostP->Copy("RT_ALLOCAT", PktReplyP->CommandText, 10);
RIOQueueCmdBlk( HostP, Rup, CmdBlkP); RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
/* /*
** If this is a freshly booted RTA, then we need to re-open ** If this is a freshly booted RTA, then we need to re-open
** the ports, if any where open, so that data may once more ** the ports, if any where open, so that data may once more
** flow around the system! ** flow around the system!
*/ */
if ( (HostP->Mapping[ThisUnit].Flags & RTA_NEWBOOT) && if ((HostP->Mapping[ThisUnit].Flags & RTA_NEWBOOT) && (HostP->Mapping[ThisUnit].SysPort != NO_PORT)) {
(HostP->Mapping[ThisUnit].SysPort != NO_PORT) )
{
/* /*
** look at the ports associated with this beast and ** look at the ports associated with this beast and
** see if any where open. If they was, then re-open ** see if any where open. If they was, then re-open
** them, using the info from the tty flags. ** them, using the info from the tty flags.
*/ */
for ( port=0; port<PORTS_PER_RTA; port++ ) for (port = 0; port < PORTS_PER_RTA; port++) {
{ PortP = p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort];
PortP = p->RIOPortp[port+HostP->Mapping[ThisUnit].SysPort]; if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) {
if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) ) rio_dprintk(RIO_DEBUG_ROUTE, "Re-opened this port\n");
{
rio_dprintk (RIO_DEBUG_ROUTE, "Re-opened this port\n");
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
PortP->MagicFlags |= MAGIC_REBOOT; PortP->MagicFlags |= MAGIC_REBOOT;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
} }
} }
if (RtaType == TYPE_RTA16) if (RtaType == TYPE_RTA16) {
{ for (port = 0; port < PORTS_PER_RTA; port++) {
for ( port=0; port<PORTS_PER_RTA; port++ ) PortP = p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort];
{ if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) {
PortP = p->RIOPortp[port+HostP->Mapping[ThisUnit2].SysPort]; rio_dprintk(RIO_DEBUG_ROUTE, "Re-opened this port\n");
if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) )
{
rio_dprintk (RIO_DEBUG_ROUTE, "Re-opened this port\n");
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
PortP->MagicFlags |= MAGIC_REBOOT; PortP->MagicFlags |= MAGIC_REBOOT;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
...@@ -527,24 +436,19 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ...@@ -527,24 +436,19 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
** or none-xprint, then we need to transfer that info over to the ** or none-xprint, then we need to transfer that info over to the
** relevant ports. ** relevant ports.
*/ */
if ( HostP->Mapping[ThisUnit].SysPort != NO_PORT ) if (HostP->Mapping[ThisUnit].SysPort != NO_PORT) {
{ for (port = 0; port < PORTS_PER_MODULE; port++) {
for ( port=0; port<PORTS_PER_MODULE; port++ ) p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK;
{ p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port];
p->RIOPortp[port+HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK; p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK;
p->RIOPortp[port+HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port];
p->RIOModuleTypes[Mod1].Flags[port];
p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK;
p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port];
} }
if (RtaType == TYPE_RTA16) if (RtaType == TYPE_RTA16) {
{ for (port = 0; port < PORTS_PER_MODULE; port++) {
for ( port=0; port<PORTS_PER_MODULE; port++ ) p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK;
{ p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port];
p->RIOPortp[port+HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK; p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK;
p->RIOPortp[port+HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port]; p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port];
p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK;
p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port];
} }
} }
} }
...@@ -562,11 +466,10 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ...@@ -562,11 +466,10 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
** then we reset it and it will go round the loop of being booted ** then we reset it and it will go round the loop of being booted
** we can then worry about trying to fit it into the table. ** we can then worry about trying to fit it into the table.
*/ */
for ( ThisUnit=0; ThisUnit<HostP->NumExtraBooted; ThisUnit++ ) for (ThisUnit = 0; ThisUnit < HostP->NumExtraBooted; ThisUnit++)
if ( HostP->ExtraUnits[ThisUnit] == RtaUniq ) if (HostP->ExtraUnits[ThisUnit] == RtaUniq)
break; break;
if ( ThisUnit == HostP->NumExtraBooted && ThisUnit != MAX_EXTRA_UNITS ) if (ThisUnit == HostP->NumExtraBooted && ThisUnit != MAX_EXTRA_UNITS) {
{
/* /*
** if the unit wasn't in the table, and the table wasn't full, then ** if the unit wasn't in the table, and the table wasn't full, then
** we reset the unit, because we didn't boot it. ** we reset the unit, because we didn't boot it.
...@@ -579,50 +482,41 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ...@@ -579,50 +482,41 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
*/ */
static int UnknownMesgDone = 0; static int UnknownMesgDone = 0;
if ( !UnknownMesgDone ) if (!UnknownMesgDone) {
{ if (!p->RIONoMessage)
if (! p->RIONoMessage)
cprintf("One or more unknown RTAs are being updated.\n"); cprintf("One or more unknown RTAs are being updated.\n");
UnknownMesgDone = 1; UnknownMesgDone = 1;
} }
PktReplyP->Command = ROUTE_FOAD; PktReplyP->Command = ROUTE_FOAD;
HostP->Copy("RT_FOAD",PktReplyP->CommandText,7); HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
} } else {
else
{
/* /*
** we did boot it (as an extra), and there may now be a table ** we did boot it (as an extra), and there may now be a table
** slot free (because of a delete), so we will try to make ** slot free (because of a delete), so we will try to make
** a tentative entry for it, so that the configurator can see it ** a tentative entry for it, so that the configurator can see it
** and fill in the details for us. ** and fill in the details for us.
*/ */
if (RtaType == TYPE_RTA16) if (RtaType == TYPE_RTA16) {
{ if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0) {
if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0)
{
RIODefaultName(p, HostP, ThisUnit); RIODefaultName(p, HostP, ThisUnit);
FillSlot(ThisUnit, ThisUnit2, RtaUniq, HostP); FillSlot(ThisUnit, ThisUnit2, RtaUniq, HostP);
} }
} } else {
else if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0) {
{
if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0)
{
RIODefaultName(p, HostP, ThisUnit); RIODefaultName(p, HostP, ThisUnit);
FillSlot(ThisUnit, 0, RtaUniq, HostP); FillSlot(ThisUnit, 0, RtaUniq, HostP);
} }
} }
PktReplyP->Command = ROUTE_USED; PktReplyP->Command = ROUTE_USED;
HostP->Copy("RT_USED",PktReplyP->CommandText,7); HostP->Copy("RT_USED", PktReplyP->CommandText, 7);
} }
RIOQueueCmdBlk( HostP, Rup, CmdBlkP); RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
return TRUE; return TRUE;
} }
void void RIOFixPhbs(p, HostP, unit)
RIOFixPhbs(p, HostP, unit)
struct rio_info *p; struct rio_info *p;
struct Host *HostP; struct Host *HostP;
uint unit; uint unit;
...@@ -632,7 +526,7 @@ uint unit; ...@@ -632,7 +526,7 @@ uint unit;
unsigned long flags; unsigned long flags;
int PortN = HostP->Mapping[unit].SysPort; int PortN = HostP->Mapping[unit].SysPort;
rio_dprintk (RIO_DEBUG_ROUTE, "RIOFixPhbs unit %d sysport %d\n", unit, PortN); rio_dprintk(RIO_DEBUG_ROUTE, "RIOFixPhbs unit %d sysport %d\n", unit, PortN);
if (PortN != -1) { if (PortN != -1) {
ushort dest_unit = HostP->Mapping[unit].ID2; ushort dest_unit = HostP->Mapping[unit].ID2;
...@@ -660,7 +554,7 @@ uint unit; ...@@ -660,7 +554,7 @@ uint unit;
** unset, so go no further. ** unset, so go no further.
*/ */
if (PortP->TxStart == 0) { if (PortP->TxStart == 0) {
rio_dprintk (RIO_DEBUG_ROUTE, "Tx pkts not set up yet\n"); rio_dprintk(RIO_DEBUG_ROUTE, "Tx pkts not set up yet\n");
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
break; break;
} }
...@@ -687,19 +581,16 @@ uint unit; ...@@ -687,19 +581,16 @@ uint unit;
** card. This needs to be translated into a 32 bit pointer ** card. This needs to be translated into a 32 bit pointer
** so it can be accessed from the driver. ** so it can be accessed from the driver.
*/ */
Pkt = (PKT *) RIO_PTR(HostP->Caddr,RINDW(TxPktP)); Pkt = (PKT *) RIO_PTR(HostP->Caddr, RINDW(TxPktP));
/* /*
** If the packet is used, reset it. ** If the packet is used, reset it.
*/ */
Pkt = (PKT *)((uint)Pkt & ~PKT_IN_USE); Pkt = (PKT *) ((uint) Pkt & ~PKT_IN_USE);
WBYTE(Pkt->dest_unit, dest_unit); WBYTE(Pkt->dest_unit, dest_unit);
WBYTE(Pkt->dest_port, dest_port); WBYTE(Pkt->dest_port, dest_port);
} }
rio_dprintk (RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", rio_dprintk(RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", RWORD(PortP->PhbP->destination) & 0xff, (RWORD(PortP->PhbP->destination) >> 8) & 0xff, dest_unit, dest_port);
RWORD(PortP->PhbP->destination) & 0xff,
(RWORD(PortP->PhbP->destination) >> 8) & 0xff,
dest_unit, dest_port);
WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8));
WWORD(PortP->PhbP->link, link); WWORD(PortP->PhbP->link, link);
...@@ -709,9 +600,10 @@ uint unit; ...@@ -709,9 +600,10 @@ uint unit;
** Now make sure the range of ports to be serviced includes ** Now make sure the range of ports to be serviced includes
** the 2nd 8 on this 16 port RTA. ** the 2nd 8 on this 16 port RTA.
*/ */
if (link > 3) return; if (link > 3)
return;
if (((unit * 8) + 7) > RWORD(HostP->LinkStrP[link].last_port)) { if (((unit * 8) + 7) > RWORD(HostP->LinkStrP[link].last_port)) {
rio_dprintk (RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7); rio_dprintk(RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7);
WWORD(HostP->LinkStrP[link].last_port, (unit * 8) + 7); WWORD(HostP->LinkStrP[link].last_port, (unit * 8) + 7);
} }
} }
...@@ -723,9 +615,8 @@ uint unit; ...@@ -723,9 +615,8 @@ uint unit;
** the world about it. This is done to ensure that the configurator ** the world about it. This is done to ensure that the configurator
** only gets up-to-date information about what is going on. ** only gets up-to-date information about what is going on.
*/ */
static int static int RIOCheckIsolated(p, HostP, UnitId)
RIOCheckIsolated(p, HostP, UnitId) struct rio_info *p;
struct rio_info * p;
struct Host *HostP; struct Host *HostP;
uint UnitId; uint UnitId;
{ {
...@@ -733,16 +624,16 @@ uint UnitId; ...@@ -733,16 +624,16 @@ uint UnitId;
rio_spin_lock_irqsave(&HostP->HostLock, flags); rio_spin_lock_irqsave(&HostP->HostLock, flags);
#ifdef CHECK #ifdef CHECK
CheckHostP( HostP ); CheckHostP(HostP);
CheckUnitId( UnitId ); CheckUnitId(UnitId);
#endif #endif
if ( RIOCheck( HostP, UnitId ) ) { if (RIOCheck(HostP, UnitId)) {
rio_dprintk (RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId); rio_dprintk(RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId);
rio_spin_unlock_irqrestore(&HostP->HostLock, flags); rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
return(0); return (0);
} }
RIOIsolate(p, HostP, UnitId ); RIOIsolate(p, HostP, UnitId);
RIOSetChange(p); RIOSetChange(p);
rio_spin_unlock_irqrestore(&HostP->HostLock, flags); rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
return 1; return 1;
...@@ -753,85 +644,83 @@ uint UnitId; ...@@ -753,85 +644,83 @@ uint UnitId;
** all the units attached to it. This will mean that the entire ** all the units attached to it. This will mean that the entire
** subnet will re-introduce itself. ** subnet will re-introduce itself.
*/ */
static int static int RIOIsolate(p, HostP, UnitId)
RIOIsolate(p, HostP, UnitId) struct rio_info *p;
struct rio_info * p; struct Host *HostP;
struct Host * HostP;
uint UnitId; uint UnitId;
{ {
uint link, unit; uint link, unit;
#ifdef CHECK #ifdef CHECK
CheckHostP( HostP ); CheckHostP(HostP);
CheckUnitId( UnitId ); CheckUnitId(UnitId);
#endif #endif
UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */ UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */
if ( UnitId >= MAX_RUP ) /* dontcha just lurv unsigned maths! */ if (UnitId >= MAX_RUP) /* dontcha just lurv unsigned maths! */
return(0); return (0);
if ( HostP->Mapping[UnitId].Flags & BEEN_HERE ) if (HostP->Mapping[UnitId].Flags & BEEN_HERE)
return(0); return (0);
HostP->Mapping[UnitId].Flags |= BEEN_HERE; HostP->Mapping[UnitId].Flags |= BEEN_HERE;
if ( p->RIOPrintDisabled == DO_PRINT ) if (p->RIOPrintDisabled == DO_PRINT)
rio_dprintk (RIO_DEBUG_ROUTE, "RIOMesgIsolated %s", HostP->Mapping[UnitId].Name); rio_dprintk(RIO_DEBUG_ROUTE, "RIOMesgIsolated %s", HostP->Mapping[UnitId].Name);
for ( link=0; link<LINKS_PER_UNIT; link++) { for (link = 0; link < LINKS_PER_UNIT; link++) {
unit = HostP->Mapping[UnitId].Topology[link].Unit; unit = HostP->Mapping[UnitId].Topology[link].Unit;
HostP->Mapping[UnitId].Topology[link].Unit = ROUTE_DISCONNECT; HostP->Mapping[UnitId].Topology[link].Unit = ROUTE_DISCONNECT;
HostP->Mapping[UnitId].Topology[link].Link = NO_LINK; HostP->Mapping[UnitId].Topology[link].Link = NO_LINK;
RIOIsolate(p, HostP, unit ); RIOIsolate(p, HostP, unit);
} }
HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; HostP->Mapping[UnitId].Flags &= ~BEEN_HERE;
return 1; return 1;
} }
static int static int RIOCheck(HostP, UnitId)
RIOCheck(HostP, UnitId)
struct Host *HostP; struct Host *HostP;
uint UnitId; uint UnitId;
{ {
unsigned char link; unsigned char link;
#ifdef CHECK #ifdef CHECK
CheckHostP( HostP ); CheckHostP(HostP);
CheckUnitId( UnitId ); CheckUnitId(UnitId);
#endif #endif
/* rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */ /* rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */
rio_dprintk (RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId); rio_dprintk(RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId);
if ( UnitId == HOST_ID ) { if (UnitId == HOST_ID) {
/* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is NOT isolated - it IS the host!\n", UnitId)); */ /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is NOT isolated - it IS the host!\n", UnitId)); */
return 1; return 1;
} }
UnitId--; UnitId--;
if ( UnitId >= MAX_RUP ) { if (UnitId >= MAX_RUP) {
/* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d - ignored.\n", UnitId)); */ /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d - ignored.\n", UnitId)); */
return 0; return 0;
} }
for ( link=0; link<LINKS_PER_UNIT; link++ ) { for (link = 0; link < LINKS_PER_UNIT; link++) {
if ( HostP->Mapping[UnitId].Topology[link].Unit==HOST_ID ) { if (HostP->Mapping[UnitId].Topology[link].Unit == HOST_ID) {
/* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected directly to host via link (%c).\n", /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected directly to host via link (%c).\n",
UnitId, 'A'+link)); */ UnitId, 'A'+link)); */
return 1; return 1;
} }
} }
if ( HostP->Mapping[UnitId].Flags & BEEN_HERE ) { if (HostP->Mapping[UnitId].Flags & BEEN_HERE) {
/* rio_dprint(RIO_DEBUG_ROUTE, ("Been to Unit %d before - ignoring\n", UnitId)); */ /* rio_dprint(RIO_DEBUG_ROUTE, ("Been to Unit %d before - ignoring\n", UnitId)); */
return 0; return 0;
} }
HostP->Mapping[UnitId].Flags |= BEEN_HERE; HostP->Mapping[UnitId].Flags |= BEEN_HERE;
for ( link=0; link < LINKS_PER_UNIT; link++ ) { for (link = 0; link < LINKS_PER_UNIT; link++) {
/* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d check link (%c)\n", UnitId,'A'+link)); */ /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d check link (%c)\n", UnitId,'A'+link)); */
if ( RIOCheck( HostP, HostP->Mapping[UnitId].Topology[link].Unit ) ) { if (RIOCheck(HostP, HostP->Mapping[UnitId].Topology[link].Unit)) {
/* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected to something that knows the host via link (%c)\n", UnitId,link+'A')); */ /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected to something that knows the host via link (%c)\n", UnitId,link+'A')); */
HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; HostP->Mapping[UnitId].Flags &= ~BEEN_HERE;
return 1; return 1;
...@@ -849,49 +738,45 @@ uint UnitId; ...@@ -849,49 +738,45 @@ uint UnitId;
** Returns the type of unit (host, 16/8 port RTA) ** Returns the type of unit (host, 16/8 port RTA)
*/ */
uint uint GetUnitType(Uniq)
GetUnitType(Uniq)
uint Uniq; uint Uniq;
{ {
switch ( (Uniq >> 28) & 0xf) switch ((Uniq >> 28) & 0xf) {
{
case RIO_AT: case RIO_AT:
case RIO_MCA: case RIO_MCA:
case RIO_EISA: case RIO_EISA:
case RIO_PCI: case RIO_PCI:
rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: Host\n"); rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: Host\n");
return(TYPE_HOST); return (TYPE_HOST);
case RIO_RTA_16: case RIO_RTA_16:
rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: 16 port RTA\n"); rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: 16 port RTA\n");
return(TYPE_RTA16); return (TYPE_RTA16);
case RIO_RTA: case RIO_RTA:
rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: 8 port RTA\n"); rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: 8 port RTA\n");
return(TYPE_RTA8); return (TYPE_RTA8);
default : default:
rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: Unrecognised\n"); rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: Unrecognised\n");
return(99); return (99);
} }
} }
int int RIOSetChange(p)
RIOSetChange(p) struct rio_info *p;
struct rio_info * p;
{ {
if ( p->RIOQuickCheck != NOT_CHANGED ) if (p->RIOQuickCheck != NOT_CHANGED)
return(0); return (0);
p->RIOQuickCheck = CHANGED; p->RIOQuickCheck = CHANGED;
if ( p->RIOSignalProcess ) { if (p->RIOSignalProcess) {
rio_dprintk (RIO_DEBUG_ROUTE, "Send SIG-HUP"); rio_dprintk(RIO_DEBUG_ROUTE, "Send SIG-HUP");
/* /*
psignal( RIOSignalProcess, SIGHUP ); psignal( RIOSignalProcess, SIGHUP );
*/ */
} }
return(0); return (0);
} }
static void static void RIOConCon(p, HostP, FromId, FromLink, ToId, ToLink, Change)
RIOConCon(p, HostP, FromId, FromLink, ToId, ToLink, Change) struct rio_info *p;
struct rio_info * p;
struct Host *HostP; struct Host *HostP;
uint FromId; uint FromId;
uint FromLink; uint FromLink;
...@@ -933,16 +818,16 @@ int Change; ...@@ -933,16 +818,16 @@ int Change;
** connections and disconnections. ** connections and disconnections.
*/ */
if (Change == CONNECT) { if (Change == CONNECT) {
if (p->RIORtaDisCons) p->RIORtaDisCons--; if (p->RIORtaDisCons)
} p->RIORtaDisCons--;
else { } else {
p->RIORtaDisCons++; p->RIORtaDisCons++;
} }
if ( p->RIOPrintDisabled == DONT_PRINT ) if (p->RIOPrintDisabled == DONT_PRINT)
return; return;
if ( FromId > ToId ) { if (FromId > ToId) {
tp = FromId; tp = FromId;
FromId = ToId; FromId = ToId;
ToId = tp; ToId = tp;
...@@ -951,19 +836,13 @@ int Change; ...@@ -951,19 +836,13 @@ int Change;
ToLink = tp; ToLink = tp;
} }
FromName = FromId ? HostP->Mapping[FromId-1].Name : HostP->Name; FromName = FromId ? HostP->Mapping[FromId - 1].Name : HostP->Name;
FromType = FromId ? "RTA" : "HOST"; FromType = FromId ? "RTA" : "HOST";
ToName = ToId ? HostP->Mapping[ToId-1].Name : HostP->Name; ToName = ToId ? HostP->Mapping[ToId - 1].Name : HostP->Name;
ToType = ToId ? "RTA" : "HOST"; ToType = ToId ? "RTA" : "HOST";
rio_dprintk (RIO_DEBUG_ROUTE, "Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", rio_dprintk(RIO_DEBUG_ROUTE, "Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected");
FromType, FromName, 'A'+FromLink, cprintf("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected");
ToType, ToName, 'A'+ToLink,
(Change==CONNECT) ? "established" : "disconnected");
cprintf("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n",
FromType, FromName, 'A'+FromLink,
ToType, ToName, 'A'+ToLink,
(Change==CONNECT) ? "established" : "disconnected");
} }
/* /*
...@@ -972,8 +851,7 @@ int Change; ...@@ -972,8 +851,7 @@ int Change;
** Delete and RTA entry from the saved table given to us ** Delete and RTA entry from the saved table given to us
** by the configuration program. ** by the configuration program.
*/ */
static int static int RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
{ {
int entry; int entry;
...@@ -982,11 +860,9 @@ RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap) ...@@ -982,11 +860,9 @@ RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
** zeroing it because we may have two entries to delete if ** zeroing it because we may have two entries to delete if
** it's a 16 port RTA. ** it's a 16 port RTA.
*/ */
for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
{ if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) {
if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) bzero((caddr_t) & p->RIOSavedTable[entry], sizeof(struct Map));
{
bzero((caddr_t)&p->RIOSavedTable[entry], sizeof(struct Map));
} }
} }
return 0; return 0;
...@@ -999,20 +875,18 @@ RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap) ...@@ -999,20 +875,18 @@ RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
** Scan the unit links to and return zero if the unit is completely ** Scan the unit links to and return zero if the unit is completely
** disconnected. ** disconnected.
*/ */
static int static int RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
{ {
int link; int link;
rio_dprintk (RIO_DEBUG_ROUTE, "RIOFreeDisconnect unit %d\n", unit); rio_dprintk(RIO_DEBUG_ROUTE, "RIOFreeDisconnect unit %d\n", unit);
/* /*
** If the slot is tentative and does not belong to the ** If the slot is tentative and does not belong to the
** second half of a 16 port RTA then scan to see if ** second half of a 16 port RTA then scan to see if
** is disconnected. ** is disconnected.
*/ */
for (link = 0; link < LINKS_PER_UNIT; link++) for (link = 0; link < LINKS_PER_UNIT; link++) {
{
if (HostP->Mapping[unit].Topology[link].Unit != ROUTE_DISCONNECT) if (HostP->Mapping[unit].Topology[link].Unit != ROUTE_DISCONNECT)
break; break;
} }
...@@ -1028,17 +902,14 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) ...@@ -1028,17 +902,14 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
** made this slot tentative and not yet received a topology update. ** made this slot tentative and not yet received a topology update.
** Lets check how long ago we made it tentative. ** Lets check how long ago we made it tentative.
*/ */
rio_dprintk (RIO_DEBUG_ROUTE, "Just about to check LBOLT on entry %d\n", unit); rio_dprintk(RIO_DEBUG_ROUTE, "Just about to check LBOLT on entry %d\n", unit);
if (drv_getparm(LBOLT, (ulong_t *) &current_time)) if (drv_getparm(LBOLT, (ulong_t *) & current_time))
rio_dprintk (RIO_DEBUG_ROUTE, "drv_getparm(LBOLT,....) Failed.\n"); rio_dprintk(RIO_DEBUG_ROUTE, "drv_getparm(LBOLT,....) Failed.\n");
elapse_time = current_time - TentTime[unit]; elapse_time = current_time - TentTime[unit];
rio_dprintk (RIO_DEBUG_ROUTE, "elapse %d = current %d - tent %d (%d usec)\n", rio_dprintk(RIO_DEBUG_ROUTE, "elapse %d = current %d - tent %d (%d usec)\n", elapse_time, current_time, TentTime[unit], drv_hztousec(elapse_time));
elapse_time, current_time, TentTime[unit], drv_hztousec(elapse_time)); if (drv_hztousec(elapse_time) < WAIT_TO_FINISH) {
if (drv_hztousec(elapse_time) < WAIT_TO_FINISH) rio_dprintk(RIO_DEBUG_ROUTE, "Skipping slot %d, not timed out yet %d\n", unit, drv_hztousec(elapse_time));
{
rio_dprintk (RIO_DEBUG_ROUTE, "Skipping slot %d, not timed out yet %d\n",
unit, drv_hztousec(elapse_time));
return 1; return 1;
} }
#endif #endif
...@@ -1047,12 +918,11 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) ...@@ -1047,12 +918,11 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
** We have found an usable slot. ** We have found an usable slot.
** If it is half of a 16 port RTA then delete the other half. ** If it is half of a 16 port RTA then delete the other half.
*/ */
if (HostP->Mapping[unit].ID2 != 0) if (HostP->Mapping[unit].ID2 != 0) {
{ int nOther = (HostP->Mapping[unit].ID2) - 1;
int nOther = (HostP->Mapping[unit].ID2) -1;
rio_dprintk (RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther); rio_dprintk(RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther);
bzero((caddr_t)&HostP->Mapping[nOther], sizeof(struct Map)); bzero((caddr_t) & HostP->Mapping[nOther], sizeof(struct Map));
} }
RIORemoveFromSavedTable(p, &HostP->Mapping[unit]); RIORemoveFromSavedTable(p, &HostP->Mapping[unit]);
...@@ -1066,10 +936,9 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) ...@@ -1066,10 +936,9 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
** This function scans the given host table for either one ** This function scans the given host table for either one
** or two free unit ID's. ** or two free unit ID's.
*/ */
int int RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint * pID1, uint * pID2)
RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2)
{ {
int unit,tempID; int unit, tempID;
/* /*
** Initialise the ID's to MAX_RUP. ** Initialise the ID's to MAX_RUP.
...@@ -1085,21 +954,18 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) ...@@ -1085,21 +954,18 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2)
** We scan for free slots first and then if that is not successful ** We scan for free slots first and then if that is not successful
** we start all over again looking for tentative slots we can re-use. ** we start all over again looking for tentative slots we can re-use.
*/ */
for (unit = 0; unit < MAX_RUP; unit++) for (unit = 0; unit < MAX_RUP; unit++) {
{ rio_dprintk(RIO_DEBUG_ROUTE, "Scanning unit %d\n", unit);
rio_dprintk (RIO_DEBUG_ROUTE, "Scanning unit %d\n",unit);
/* /*
** If the flags are zero then the slot is empty. ** If the flags are zero then the slot is empty.
*/ */
if (HostP->Mapping[unit].Flags == 0) if (HostP->Mapping[unit].Flags == 0) {
{ rio_dprintk(RIO_DEBUG_ROUTE, " This slot is empty.\n");
rio_dprintk (RIO_DEBUG_ROUTE, " This slot is empty.\n");
/* /*
** If we haven't allocated the first ID then do it now. ** If we haven't allocated the first ID then do it now.
*/ */
if (*pID1 == MAX_RUP) if (*pID1 == MAX_RUP) {
{ rio_dprintk(RIO_DEBUG_ROUTE, "Make tentative entry for first unit %d\n", unit);
rio_dprintk (RIO_DEBUG_ROUTE, "Make tentative entry for first unit %d\n", unit);
*pID1 = unit; *pID1 = unit;
/* /*
...@@ -1108,13 +974,11 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) ...@@ -1108,13 +974,11 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2)
*/ */
if (pID2 == NULL) if (pID2 == NULL)
return 0; return 0;
} } else {
else
{
/* /*
** Allocate the second slot and return. ** Allocate the second slot and return.
*/ */
rio_dprintk (RIO_DEBUG_ROUTE, "Make tentative entry for second unit %d\n", unit); rio_dprintk(RIO_DEBUG_ROUTE, "Make tentative entry for second unit %d\n", unit);
*pID2 = unit; *pID2 = unit;
return 0; return 0;
} }
...@@ -1126,18 +990,13 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) ...@@ -1126,18 +990,13 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2)
** need to start all over again looking for tentative slots ** need to start all over again looking for tentative slots
** that we can re-use. ** that we can re-use.
*/ */
rio_dprintk (RIO_DEBUG_ROUTE, "Starting to scan for tentative slots\n"); rio_dprintk(RIO_DEBUG_ROUTE, "Starting to scan for tentative slots\n");
for (unit = 0; unit < MAX_RUP; unit++) for (unit = 0; unit < MAX_RUP; unit++) {
{ if (((HostP->Mapping[unit].Flags & SLOT_TENTATIVE) || (HostP->Mapping[unit].Flags == 0)) && !(HostP->Mapping[unit].Flags & RTA16_SECOND_SLOT)) {
if (((HostP->Mapping[unit].Flags & SLOT_TENTATIVE) || rio_dprintk(RIO_DEBUG_ROUTE, " Slot %d looks promising.\n", unit);
(HostP->Mapping[unit].Flags == 0)) && !
(HostP->Mapping[unit].Flags & RTA16_SECOND_SLOT )) if (unit == *pID1) {
{ rio_dprintk(RIO_DEBUG_ROUTE, " No it isn't, its the 1st half\n");
rio_dprintk (RIO_DEBUG_ROUTE, " Slot %d looks promising.\n",unit);
if(unit == *pID1)
{
rio_dprintk (RIO_DEBUG_ROUTE, " No it isn't, its the 1st half\n");
continue; continue;
} }
...@@ -1155,9 +1014,8 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) ...@@ -1155,9 +1014,8 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2)
/* /*
** If we haven't allocated the first ID then do it now. ** If we haven't allocated the first ID then do it now.
*/ */
if (*pID1 == MAX_RUP) if (*pID1 == MAX_RUP) {
{ rio_dprintk(RIO_DEBUG_ROUTE, "Grab tentative entry for first unit %d\n", unit);
rio_dprintk (RIO_DEBUG_ROUTE, "Grab tentative entry for first unit %d\n", unit);
*pID1 = unit; *pID1 = unit;
/* /*
...@@ -1171,14 +1029,11 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) ...@@ -1171,14 +1029,11 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2)
*/ */
if (pID2 == NULL) if (pID2 == NULL)
return 0; return 0;
} } else {
else
{
/* /*
** Allocate the second slot and return. ** Allocate the second slot and return.
*/ */
rio_dprintk (RIO_DEBUG_ROUTE, "Grab tentative/empty entry for second unit %d\n", rio_dprintk(RIO_DEBUG_ROUTE, "Grab tentative/empty entry for second unit %d\n", unit);
unit);
*pID2 = unit; *pID2 = unit;
/* /*
...@@ -1193,9 +1048,8 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) ...@@ -1193,9 +1048,8 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2)
** Better check and swap them over. ** Better check and swap them over.
*/ */
if (*pID1 > *pID2) if (*pID1 > *pID2) {
{ rio_dprintk(RIO_DEBUG_ROUTE, "Swapping IDS %d %d\n", *pID1, *pID2);
rio_dprintk (RIO_DEBUG_ROUTE, "Swapping IDS %d %d\n", *pID1, *pID2);
tempID = *pID1; tempID = *pID1;
*pID1 = *pID2; *pID1 = *pID2;
*pID2 = tempID; *pID2 = tempID;
......
...@@ -47,8 +47,7 @@ static char *_riospace_h_sccs_ = "@(#)riospace.h 1.2"; ...@@ -47,8 +47,7 @@ static char *_riospace_h_sccs_ = "@(#)riospace.h 1.2";
** In particular, it won't be able to see changes to RIO_SLOTS ** In particular, it won't be able to see changes to RIO_SLOTS
*/ */
struct Conf struct Conf {
{
char Locator[24]; char Locator[24];
unsigned int StartupTime; unsigned int StartupTime;
unsigned int SlowCook; unsigned int SlowCook;
...@@ -86,15 +85,13 @@ struct Conf ...@@ -86,15 +85,13 @@ struct Conf
/* /*
** Board data structure. This is used for configuration info ** Board data structure. This is used for configuration info
*/ */
struct Brd struct Brd {
{
unsigned char Type; /* RIO_EISA, RIO_MCA, RIO_AT, RIO_EMPTY... */ unsigned char Type; /* RIO_EISA, RIO_MCA, RIO_AT, RIO_EMPTY... */
unsigned char Ivec; /* POLLED or ivec number */ unsigned char Ivec; /* POLLED or ivec number */
unsigned char Mode; /* Control stuff, see below */ unsigned char Mode; /* Control stuff, see below */
}; };
struct Board struct Board {
{
char Locator[RIO_LOCATOR_LEN]; char Locator[RIO_LOCATOR_LEN];
int NumSlots; int NumSlots;
struct Brd Boards[MAX_RIO_BOARDS]; struct Brd Boards[MAX_RIO_BOARDS];
......
...@@ -91,9 +91,8 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2"; ...@@ -91,9 +91,8 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2";
** A configuration table has been loaded. It is now up to us ** A configuration table has been loaded. It is now up to us
** to sort it out and use the information contained therein. ** to sort it out and use the information contained therein.
*/ */
int int RIONewTable(p)
RIONewTable(p) struct rio_info *p;
struct rio_info * p;
{ {
int Host, Host1, Host2, NameIsUnique, Entry, SubEnt; int Host, Host1, Host2, NameIsUnique, Entry, SubEnt;
struct Map *MapP; struct Map *MapP;
...@@ -121,8 +120,8 @@ struct rio_info * p; ...@@ -121,8 +120,8 @@ struct rio_info * p;
** (9) That names aren't duplicated ** (9) That names aren't duplicated
** xx (10) That hosts that actually exist are mentioned in the table. xx ** xx (10) That hosts that actually exist are mentioned in the table. xx
*/ */
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n"); rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n");
if ( p->RIOSystemUp ) { /* (1) */ if (p->RIOSystemUp) { /* (1) */
p->RIOError.Error = HOST_HAS_ALREADY_BEEN_BOOTED; p->RIOError.Error = HOST_HAS_ALREADY_BEEN_BOOTED;
return -EBUSY; return -EBUSY;
} }
...@@ -131,19 +130,19 @@ struct rio_info * p; ...@@ -131,19 +130,19 @@ struct rio_info * p;
p->RIOError.Entry = -1; p->RIOError.Entry = -1;
p->RIOError.Other = -1; p->RIOError.Other = -1;
for ( Entry=0; Entry<TOTAL_MAP_ENTRIES; Entry++ ) { for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) {
MapP = &p->RIOConnectTable[Entry]; MapP = &p->RIOConnectTable[Entry];
if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) { if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) {
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(2)\n"); rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(2)\n");
cptr = MapP->Name; /* (2) */ cptr = MapP->Name; /* (2) */
cptr[MAX_NAME_LEN-1]='\0'; cptr[MAX_NAME_LEN - 1] = '\0';
if ( cptr[0]=='\0' ) { if (cptr[0] == '\0') {
bcopy(MapP->RtaUniqueNum?"RTA NN":"HOST NN",MapP->Name,8); bcopy(MapP->RtaUniqueNum ? "RTA NN" : "HOST NN", MapP->Name, 8);
MapP->Name[5] = '0'+Entry/10; MapP->Name[5] = '0' + Entry / 10;
MapP->Name[6] = '0'+Entry%10; MapP->Name[6] = '0' + Entry % 10;
} }
while ( *cptr ) { while (*cptr) {
if ( *cptr<' ' || *cptr>'~' ) { if (*cptr < ' ' || *cptr > '~') {
p->RIOError.Error = BAD_CHARACTER_IN_NAME; p->RIOError.Error = BAD_CHARACTER_IN_NAME;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return -ENXIO; return -ENXIO;
...@@ -156,27 +155,27 @@ struct rio_info * p; ...@@ -156,27 +155,27 @@ struct rio_info * p;
** If the entry saved was a tentative entry then just forget ** If the entry saved was a tentative entry then just forget
** about it. ** about it.
*/ */
if ( MapP->Flags & SLOT_TENTATIVE ) { if (MapP->Flags & SLOT_TENTATIVE) {
MapP->HostUniqueNum = 0; MapP->HostUniqueNum = 0;
MapP->RtaUniqueNum = 0; MapP->RtaUniqueNum = 0;
continue; continue;
} }
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(3)\n"); rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(3)\n");
if ( !MapP->RtaUniqueNum && !MapP->HostUniqueNum ) { /* (3) */ if (!MapP->RtaUniqueNum && !MapP->HostUniqueNum) { /* (3) */
if ( MapP->ID || MapP->SysPort || MapP->Flags ) { if (MapP->ID || MapP->SysPort || MapP->Flags) {
rio_dprintk (RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n",MapP->Name); rio_dprintk(RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n", MapP->Name);
p->RIOError.Error = TABLE_ENTRY_ISNT_PROPERLY_NULL; p->RIOError.Error = TABLE_ENTRY_ISNT_PROPERLY_NULL;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return -ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n"); rio_dprintk(RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n");
continue; continue;
} }
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(4)\n"); rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(4)\n");
for ( Host=0; Host<p->RIONumHosts; Host++ ) { /* (4) */ for (Host = 0; Host < p->RIONumHosts; Host++) { /* (4) */
if ( p->RIOHosts[Host].UniqueNum==MapP->HostUniqueNum ) { if (p->RIOHosts[Host].UniqueNum == MapP->HostUniqueNum) {
HostP = &p->RIOHosts[Host]; HostP = &p->RIOHosts[Host];
/* /*
** having done the lookup, we don't really want to do ** having done the lookup, we don't really want to do
...@@ -187,9 +186,8 @@ struct rio_info * p; ...@@ -187,9 +186,8 @@ struct rio_info * p;
} }
} }
if ( Host >= p->RIONumHosts ) { if (Host >= p->RIONumHosts) {
rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n", rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n", MapP->Name, MapP->HostUniqueNum);
MapP->Name, MapP->HostUniqueNum);
MapP->HostUniqueNum = 0; MapP->HostUniqueNum = 0;
/* MapP->RtaUniqueNum = 0; */ /* MapP->RtaUniqueNum = 0; */
/* MapP->ID = 0; */ /* MapP->ID = 0; */
...@@ -199,28 +197,23 @@ struct rio_info * p; ...@@ -199,28 +197,23 @@ struct rio_info * p;
continue; continue;
} }
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(5)\n"); rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(5)\n");
if ( MapP->RtaUniqueNum ) { /* (5) */ if (MapP->RtaUniqueNum) { /* (5) */
if ( !MapP->ID ) { if (!MapP->ID) {
rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an ID of zero!\n", rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an ID of zero!\n", MapP->Name);
MapP->Name);
p->RIOError.Error = ZERO_RTA_ID; p->RIOError.Error = ZERO_RTA_ID;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return -ENXIO; return -ENXIO;
} }
if ( MapP->ID > MAX_RUP ) { if (MapP->ID > MAX_RUP) {
rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an invalid ID %d\n", rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an invalid ID %d\n", MapP->Name, MapP->ID);
MapP->Name, MapP->ID);
p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return -ENXIO; return -ENXIO;
} }
for ( SubEnt=0; SubEnt<Entry; SubEnt++ ) { for (SubEnt = 0; SubEnt < Entry; SubEnt++) {
if ( MapP->HostUniqueNum == if (MapP->HostUniqueNum == p->RIOConnectTable[SubEnt].HostUniqueNum && MapP->ID == p->RIOConnectTable[SubEnt].ID) {
p->RIOConnectTable[SubEnt].HostUniqueNum && rio_dprintk(RIO_DEBUG_TABLE, "Dupl. ID number allocated to RTA %s and RTA %s\n", MapP->Name, p->RIOConnectTable[SubEnt].Name);
MapP->ID == p->RIOConnectTable[SubEnt].ID ) {
rio_dprintk (RIO_DEBUG_TABLE, "Dupl. ID number allocated to RTA %s and RTA %s\n",
MapP->Name, p->RIOConnectTable[SubEnt].Name);
p->RIOError.Error = DUPLICATED_RTA_ID; p->RIOError.Error = DUPLICATED_RTA_ID;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
p->RIOError.Other = SubEnt; p->RIOError.Other = SubEnt;
...@@ -230,56 +223,48 @@ struct rio_info * p; ...@@ -230,56 +223,48 @@ struct rio_info * p;
** If the RtaUniqueNum is the same, it may be looking at both ** If the RtaUniqueNum is the same, it may be looking at both
** entries for a 16 port RTA, so check the ids ** entries for a 16 port RTA, so check the ids
*/ */
if ((MapP->RtaUniqueNum == if ((MapP->RtaUniqueNum == p->RIOConnectTable[SubEnt].RtaUniqueNum)
p->RIOConnectTable[SubEnt].RtaUniqueNum)
&& (MapP->ID2 != p->RIOConnectTable[SubEnt].ID)) { && (MapP->ID2 != p->RIOConnectTable[SubEnt].ID)) {
rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n",MapP->Name); rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", MapP->Name);
rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", p->RIOConnectTable[SubEnt].Name);
p->RIOConnectTable[SubEnt].Name);
p->RIOError.Error = DUPLICATE_UNIQUE_NUMBER; p->RIOError.Error = DUPLICATE_UNIQUE_NUMBER;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
p->RIOError.Other = SubEnt; p->RIOError.Other = SubEnt;
return -ENXIO; return -ENXIO;
} }
} }
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n"); rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n");
/* (7a) */ /* (7a) */
if ((MapP->SysPort != NO_PORT)&&(MapP->SysPort % PORTS_PER_RTA)) { if ((MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA)) {
rio_dprintk (RIO_DEBUG_TABLE, "TTY Port number %d-RTA %s is not a multiple of %d!\n", rio_dprintk(RIO_DEBUG_TABLE, "TTY Port number %d-RTA %s is not a multiple of %d!\n", (int) MapP->SysPort, MapP->Name, PORTS_PER_RTA);
(int)MapP->SysPort,MapP->Name, PORTS_PER_RTA);
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return -ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n"); rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n");
/* (7b) */ /* (7b) */
if ((MapP->SysPort != NO_PORT)&&(MapP->SysPort >= RIO_PORTS)) { if ((MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS)) {
rio_dprintk (RIO_DEBUG_TABLE, "TTY Port number %d for RTA %s is too big\n", rio_dprintk(RIO_DEBUG_TABLE, "TTY Port number %d for RTA %s is too big\n", (int) MapP->SysPort, MapP->Name);
(int)MapP->SysPort, MapP->Name);
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return -ENXIO; return -ENXIO;
} }
for ( SubEnt=0; SubEnt<Entry; SubEnt++ ) { for (SubEnt = 0; SubEnt < Entry; SubEnt++) {
if ( p->RIOConnectTable[SubEnt].Flags & RTA16_SECOND_SLOT ) if (p->RIOConnectTable[SubEnt].Flags & RTA16_SECOND_SLOT)
continue; continue;
if ( p->RIOConnectTable[SubEnt].RtaUniqueNum ) { if (p->RIOConnectTable[SubEnt].RtaUniqueNum) {
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(8)\n"); rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(8)\n");
/* (8) */ /* (8) */
if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort == if ((MapP->SysPort != NO_PORT) && (MapP->SysPort == p->RIOConnectTable[SubEnt].SysPort)) {
p->RIOConnectTable[SubEnt].SysPort) ) { rio_dprintk(RIO_DEBUG_TABLE, "RTA %s:same TTY port # as RTA %s (%d)\n", MapP->Name, p->RIOConnectTable[SubEnt].Name, (int) MapP->SysPort);
rio_dprintk (RIO_DEBUG_TABLE, "RTA %s:same TTY port # as RTA %s (%d)\n",
MapP->Name, p->RIOConnectTable[SubEnt].Name,
(int)MapP->SysPort);
p->RIOError.Error = TTY_NUMBER_IN_USE; p->RIOError.Error = TTY_NUMBER_IN_USE;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
p->RIOError.Other = SubEnt; p->RIOError.Other = SubEnt;
return -ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n"); rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n");
if (strcmp(MapP->Name, if (strcmp(MapP->Name, p->RIOConnectTable[SubEnt].Name) == 0 && !(MapP->Flags & RTA16_SECOND_SLOT)) { /* (9) */
p->RIOConnectTable[SubEnt].Name)==0 && !(MapP->Flags & RTA16_SECOND_SLOT)) { /* (9) */ rio_dprintk(RIO_DEBUG_TABLE, "RTA name %s used twice\n", MapP->Name);
rio_dprintk (RIO_DEBUG_TABLE, "RTA name %s used twice\n", MapP->Name);
p->RIOError.Error = NAME_USED_TWICE; p->RIOError.Error = NAME_USED_TWICE;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
p->RIOError.Other = SubEnt; p->RIOError.Other = SubEnt;
...@@ -287,19 +272,16 @@ struct rio_info * p; ...@@ -287,19 +272,16 @@ struct rio_info * p;
} }
} }
} }
} } else { /* (6) */
else { /* (6) */ rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(6)\n");
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(6)\n"); if (MapP->ID) {
if ( MapP->ID ) { rio_dprintk(RIO_DEBUG_TABLE, "RIO:HOST %s has been allocated ID that isn't zero!\n", MapP->Name);
rio_dprintk (RIO_DEBUG_TABLE, "RIO:HOST %s has been allocated ID that isn't zero!\n",
MapP->Name);
p->RIOError.Error = HOST_ID_NOT_ZERO; p->RIOError.Error = HOST_ID_NOT_ZERO;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return -ENXIO; return -ENXIO;
} }
if ( MapP->SysPort != NO_PORT ) { if (MapP->SysPort != NO_PORT) {
rio_dprintk (RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n", rio_dprintk(RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n", MapP->Name);
MapP->Name);
p->RIOError.Error = HOST_SYSPORT_BAD; p->RIOError.Error = HOST_SYSPORT_BAD;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return -ENXIO; return -ENXIO;
...@@ -314,26 +296,24 @@ struct rio_info * p; ...@@ -314,26 +296,24 @@ struct rio_info * p;
/* /*
** Zero the (old) entries for each host... ** Zero the (old) entries for each host...
*/ */
for ( Host=0; Host<RIO_HOSTS; Host++ ) { for (Host = 0; Host < RIO_HOSTS; Host++) {
for ( Entry=0; Entry<MAX_RUP; Entry++ ) { for (Entry = 0; Entry < MAX_RUP; Entry++) {
bzero((caddr_t)&p->RIOHosts[Host].Mapping[Entry], bzero((caddr_t) & p->RIOHosts[Host].Mapping[Entry], sizeof(struct Map));
sizeof(struct Map));
} }
bzero((caddr_t)&p->RIOHosts[Host].Name[0], bzero((caddr_t) & p->RIOHosts[Host].Name[0], sizeof(p->RIOHosts[Host].Name));
sizeof(p->RIOHosts[Host].Name) );
} }
/* /*
** Copy in the new table entries ** Copy in the new table entries
*/ */
for ( Entry=0; Entry< TOTAL_MAP_ENTRIES; Entry++ ) { for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) {
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: Copy table for Host entry %d\n", Entry); rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: Copy table for Host entry %d\n", Entry);
MapP = &p->RIOConnectTable[Entry]; MapP = &p->RIOConnectTable[Entry];
/* /*
** Now, if it is an empty slot ignore it! ** Now, if it is an empty slot ignore it!
*/ */
if ( MapP->HostUniqueNum==0 ) if (MapP->HostUniqueNum == 0)
continue; continue;
/* /*
...@@ -344,9 +324,9 @@ struct rio_info * p; ...@@ -344,9 +324,9 @@ struct rio_info * p;
/* /*
** If it is a host, then we only need to fill in the name field. ** If it is a host, then we only need to fill in the name field.
*/ */
if ( MapP->ID==0 ) { if (MapP->ID == 0) {
rio_dprintk (RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name); rio_dprintk(RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name);
bcopy(MapP->Name,HostP->Name,MAX_NAME_LEN); bcopy(MapP->Name, HostP->Name, MAX_NAME_LEN);
continue; continue;
} }
...@@ -355,10 +335,10 @@ struct rio_info * p; ...@@ -355,10 +335,10 @@ struct rio_info * p;
** and the port mapping entries. Notice that entry zero is for ** and the port mapping entries. Notice that entry zero is for
** ID one. ** ID one.
*/ */
HostMapP = &HostP->Mapping[MapP->ID-1]; HostMapP = &HostP->Mapping[MapP->ID - 1];
if (MapP->Flags & SLOT_IN_USE) { if (MapP->Flags & SLOT_IN_USE) {
rio_dprintk (RIO_DEBUG_TABLE, "Rta entry found. Name %s\n", MapP->Name); rio_dprintk(RIO_DEBUG_TABLE, "Rta entry found. Name %s\n", MapP->Name);
/* /*
** structure assign, then sort out the bits we shouldn't have done ** structure assign, then sort out the bits we shouldn't have done
*/ */
...@@ -368,32 +348,29 @@ struct rio_info * p; ...@@ -368,32 +348,29 @@ struct rio_info * p;
if (MapP->Flags & RTA16_SECOND_SLOT) if (MapP->Flags & RTA16_SECOND_SLOT)
HostMapP->Flags |= RTA16_SECOND_SLOT; HostMapP->Flags |= RTA16_SECOND_SLOT;
RIOReMapPorts(p, HostP, HostMapP ); RIOReMapPorts(p, HostP, HostMapP);
} } else {
else { rio_dprintk(RIO_DEBUG_TABLE, "TENTATIVE Rta entry found. Name %s\n", MapP->Name);
rio_dprintk (RIO_DEBUG_TABLE, "TENTATIVE Rta entry found. Name %s\n", MapP->Name);
} }
} }
for ( Entry=0; Entry< TOTAL_MAP_ENTRIES; Entry++ ) { for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) {
p->RIOSavedTable[Entry] = p->RIOConnectTable[Entry]; p->RIOSavedTable[Entry] = p->RIOConnectTable[Entry];
} }
for ( Host=0; Host<p->RIONumHosts; Host++ ) { for (Host = 0; Host < p->RIONumHosts; Host++) {
for ( SubEnt=0; SubEnt<LINKS_PER_UNIT; SubEnt++ ) { for (SubEnt = 0; SubEnt < LINKS_PER_UNIT; SubEnt++) {
p->RIOHosts[Host].Topology[SubEnt].Unit = ROUTE_DISCONNECT; p->RIOHosts[Host].Topology[SubEnt].Unit = ROUTE_DISCONNECT;
p->RIOHosts[Host].Topology[SubEnt].Link = NO_LINK; p->RIOHosts[Host].Topology[SubEnt].Link = NO_LINK;
} }
for ( Entry=0; Entry<MAX_RUP; Entry++ ) { for (Entry = 0; Entry < MAX_RUP; Entry++) {
for ( SubEnt=0; SubEnt<LINKS_PER_UNIT; SubEnt++ ) { for (SubEnt = 0; SubEnt < LINKS_PER_UNIT; SubEnt++) {
p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Unit = p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Unit = ROUTE_DISCONNECT;
ROUTE_DISCONNECT; p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Link = NO_LINK;
p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Link =
NO_LINK;
} }
} }
if ( !p->RIOHosts[Host].Name[0] ) { if (!p->RIOHosts[Host].Name[0]) {
bcopy("HOST 1",p->RIOHosts[Host].Name,7); bcopy("HOST 1", p->RIOHosts[Host].Name, 7);
p->RIOHosts[Host].Name[5] += Host; p->RIOHosts[Host].Name[5] += Host;
} }
/* /*
...@@ -403,7 +380,7 @@ struct rio_info * p; ...@@ -403,7 +380,7 @@ struct rio_info * p;
NameIsUnique = 0; NameIsUnique = 0;
while (!NameIsUnique) { while (!NameIsUnique) {
NameIsUnique = 1; NameIsUnique = 1;
for ( Host2=0; Host2<p->RIONumHosts; Host2++ ) { for (Host2 = 0; Host2 < p->RIONumHosts; Host2++) {
if (Host2 == Host) if (Host2 == Host)
continue; continue;
if (strcmp(p->RIOHosts[Host].Name, p->RIOHosts[Host2].Name) if (strcmp(p->RIOHosts[Host].Name, p->RIOHosts[Host2].Name)
...@@ -419,13 +396,12 @@ struct rio_info * p; ...@@ -419,13 +396,12 @@ struct rio_info * p;
/* /*
** Rename host if name already used. ** Rename host if name already used.
*/ */
if (Host1 != Host) if (Host1 != Host) {
{ rio_dprintk(RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name);
rio_dprintk (RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name); bcopy("HOST 1", p->RIOHosts[Host].Name, 7);
bcopy("HOST 1",p->RIOHosts[Host].Name,7);
p->RIOHosts[Host].Name[5] += Host1; p->RIOHosts[Host].Name[5] += Host1;
} }
rio_dprintk (RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name); rio_dprintk(RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name);
} }
return 0; return 0;
} }
...@@ -434,9 +410,8 @@ struct rio_info * p; ...@@ -434,9 +410,8 @@ struct rio_info * p;
** User process needs the config table - build it from first ** User process needs the config table - build it from first
** principles. ** principles.
*/ */
int int RIOApel(p)
RIOApel(p) struct rio_info *p;
struct rio_info * p;
{ {
int Host; int Host;
int link; int link;
...@@ -448,33 +423,32 @@ struct rio_info * p; ...@@ -448,33 +423,32 @@ struct rio_info * p;
disable(oldspl); /* strange but true! */ disable(oldspl); /* strange but true! */
rio_dprintk (RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n"); rio_dprintk(RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n");
bzero((caddr_t)&p->RIOConnectTable[0], bzero((caddr_t) & p->RIOConnectTable[0], sizeof(struct Map) * TOTAL_MAP_ENTRIES);
sizeof(struct Map) * TOTAL_MAP_ENTRIES );
for ( Host=0; Host<RIO_HOSTS; Host++ ) { for (Host = 0; Host < RIO_HOSTS; Host++) {
rio_dprintk (RIO_DEBUG_TABLE, "Processing host %d\n", Host); rio_dprintk(RIO_DEBUG_TABLE, "Processing host %d\n", Host);
HostP = &p->RIOHosts[Host]; HostP = &p->RIOHosts[Host];
MapP = &p->RIOConnectTable[Next++]; MapP = &p->RIOConnectTable[Next++];
MapP->HostUniqueNum = HostP->UniqueNum; MapP->HostUniqueNum = HostP->UniqueNum;
if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) if ((HostP->Flags & RUN_STATE) != RC_RUNNING)
continue; continue;
MapP->RtaUniqueNum = 0; MapP->RtaUniqueNum = 0;
MapP->ID = 0; MapP->ID = 0;
MapP->Flags = SLOT_IN_USE; MapP->Flags = SLOT_IN_USE;
MapP->SysPort = NO_PORT; MapP->SysPort = NO_PORT;
for ( link=0; link<LINKS_PER_UNIT; link++ ) for (link = 0; link < LINKS_PER_UNIT; link++)
MapP->Topology[link] = HostP->Topology[link]; MapP->Topology[link] = HostP->Topology[link];
bcopy(HostP->Name,MapP->Name,MAX_NAME_LEN); bcopy(HostP->Name, MapP->Name, MAX_NAME_LEN);
for ( Rup=0; Rup<MAX_RUP; Rup++ ) { for (Rup = 0; Rup < MAX_RUP; Rup++) {
if ( HostP->Mapping[Rup].Flags & (SLOT_IN_USE|SLOT_TENTATIVE) ) { if (HostP->Mapping[Rup].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) {
p->RIOConnectTable[Next] = HostP->Mapping[Rup]; p->RIOConnectTable[Next] = HostP->Mapping[Rup];
if ( HostP->Mapping[Rup].Flags & SLOT_IN_USE) if (HostP->Mapping[Rup].Flags & SLOT_IN_USE)
p->RIOConnectTable[Next].Flags |= SLOT_IN_USE; p->RIOConnectTable[Next].Flags |= SLOT_IN_USE;
if ( HostP->Mapping[Rup].Flags & SLOT_TENTATIVE) if (HostP->Mapping[Rup].Flags & SLOT_TENTATIVE)
p->RIOConnectTable[Next].Flags |= SLOT_TENTATIVE; p->RIOConnectTable[Next].Flags |= SLOT_TENTATIVE;
if ( HostP->Mapping[Rup].Flags & RTA16_SECOND_SLOT ) if (HostP->Mapping[Rup].Flags & RTA16_SECOND_SLOT)
p->RIOConnectTable[Next].Flags |= RTA16_SECOND_SLOT; p->RIOConnectTable[Next].Flags |= RTA16_SECOND_SLOT;
Next++; Next++;
} }
...@@ -489,8 +463,7 @@ struct rio_info * p; ...@@ -489,8 +463,7 @@ struct rio_info * p;
** if the entry is suitably inactive, then we can gob on it and remove ** if the entry is suitably inactive, then we can gob on it and remove
** it from the table. ** it from the table.
*/ */
int int RIODeleteRta(p, MapP)
RIODeleteRta(p, MapP)
struct rio_info *p; struct rio_info *p;
struct Map *MapP; struct Map *MapP;
{ {
...@@ -502,33 +475,31 @@ struct Map *MapP; ...@@ -502,33 +475,31 @@ struct Map *MapP;
int work_done = 0; int work_done = 0;
unsigned long lock_flags, sem_flags; unsigned long lock_flags, sem_flags;
rio_dprintk (RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n", rio_dprintk(RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n", MapP->HostUniqueNum, MapP->RtaUniqueNum);
MapP->HostUniqueNum, MapP->RtaUniqueNum);
for ( host=0; host < p->RIONumHosts; host++ ) { for (host = 0; host < p->RIONumHosts; host++) {
HostP = &p->RIOHosts[host]; HostP = &p->RIOHosts[host];
rio_spin_lock_irqsave( &HostP->HostLock, lock_flags ); rio_spin_lock_irqsave(&HostP->HostLock, lock_flags);
if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) { if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags); rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags);
continue; continue;
} }
for ( entry=0; entry<MAX_RUP; entry++ ) { for (entry = 0; entry < MAX_RUP; entry++) {
if ( MapP->RtaUniqueNum == HostP->Mapping[entry].RtaUniqueNum ) { if (MapP->RtaUniqueNum == HostP->Mapping[entry].RtaUniqueNum) {
HostMapP = &HostP->Mapping[entry]; HostMapP = &HostP->Mapping[entry];
rio_dprintk (RIO_DEBUG_TABLE, "Found entry offset %d on host %s\n", rio_dprintk(RIO_DEBUG_TABLE, "Found entry offset %d on host %s\n", entry, HostP->Name);
entry, HostP->Name);
/* /*
** Check all four links of the unit are disconnected ** Check all four links of the unit are disconnected
*/ */
for ( link=0; link< LINKS_PER_UNIT; link++ ) { for (link = 0; link < LINKS_PER_UNIT; link++) {
if ( HostMapP->Topology[link].Unit != ROUTE_DISCONNECT ) { if (HostMapP->Topology[link].Unit != ROUTE_DISCONNECT) {
rio_dprintk (RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n"); rio_dprintk(RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n");
p->RIOError.Error = UNIT_IS_IN_USE; p->RIOError.Error = UNIT_IS_IN_USE;
rio_spin_unlock_irqrestore( &HostP->HostLock, lock_flags); rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags);
return -EBUSY; return -EBUSY;
} }
} }
...@@ -538,18 +509,18 @@ struct Map *MapP; ...@@ -538,18 +509,18 @@ struct Map *MapP;
*/ */
SysPort = HostMapP->SysPort; SysPort = HostMapP->SysPort;
if ( SysPort != NO_PORT ) { if (SysPort != NO_PORT) {
for (port=SysPort; port < SysPort+PORTS_PER_RTA; port++) { for (port = SysPort; port < SysPort + PORTS_PER_RTA; port++) {
PortP = p->RIOPortp[port]; PortP = p->RIOPortp[port];
rio_dprintk (RIO_DEBUG_TABLE, "Unmap port\n"); rio_dprintk(RIO_DEBUG_TABLE, "Unmap port\n");
rio_spin_lock_irqsave( &PortP->portSem, sem_flags ); rio_spin_lock_irqsave(&PortP->portSem, sem_flags);
PortP->Mapped = 0; PortP->Mapped = 0;
if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) ) { if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) {
rio_dprintk (RIO_DEBUG_TABLE, "Gob on port\n"); rio_dprintk(RIO_DEBUG_TABLE, "Gob on port\n");
PortP->TxBufferIn = PortP->TxBufferOut = 0; PortP->TxBufferIn = PortP->TxBufferOut = 0;
/* What should I do /* What should I do
wakeup( &PortP->TxBufferIn ); wakeup( &PortP->TxBufferIn );
...@@ -575,8 +546,7 @@ struct Map *MapP; ...@@ -575,8 +546,7 @@ struct Map *MapP;
WORD *TxPktP; WORD *TxPktP;
PKT *Pkt; PKT *Pkt;
for (TxPktP = PortP->TxStart; for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) {
TxPktP <= PortP->TxEnd; TxPktP++) {
/* /*
** *TxPktP is the pointer to the ** *TxPktP is the pointer to the
** transmit packet on the host card. ** transmit packet on the host card.
...@@ -584,28 +554,19 @@ struct Map *MapP; ...@@ -584,28 +554,19 @@ struct Map *MapP;
** a 32 bit pointer so it can be ** a 32 bit pointer so it can be
** accessed from the driver. ** accessed from the driver.
*/ */
Pkt = (PKT *) RIO_PTR(HostP->Caddr, Pkt = (PKT *) RIO_PTR(HostP->Caddr, RWORD(*TxPktP));
RWORD(*TxPktP)); 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);
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);
WWORD(Pkt->dest_unit, dest_unit); WWORD(Pkt->dest_unit, dest_unit);
WWORD(Pkt->dest_port, dest_port); WWORD(Pkt->dest_port, dest_port);
} }
rio_dprintk (RIO_DEBUG_TABLE, rio_dprintk(RIO_DEBUG_TABLE, "Port %d phb destination: Old %x:%x New %x:%x\n", port, PortP->PhbP->destination & 0xff, (PortP->PhbP->destination >> 8) & 0xff, dest_unit, dest_port);
"Port %d phb destination: Old %x:%x New %x:%x\n", WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8));
port, PortP->PhbP->destination & 0xff,
(PortP->PhbP->destination >> 8) & 0xff,
dest_unit, dest_port);
WWORD(PortP->PhbP->destination,
dest_unit + (dest_port << 8));
} }
rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags); rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags);
} }
} }
rio_dprintk (RIO_DEBUG_TABLE, "Entry nulled.\n"); rio_dprintk(RIO_DEBUG_TABLE, "Entry nulled.\n");
bzero((char *)HostMapP,sizeof(struct Map)); bzero((char *) HostMapP, sizeof(struct Map));
work_done++; work_done++;
} }
} }
...@@ -613,25 +574,25 @@ struct Map *MapP; ...@@ -613,25 +574,25 @@ struct Map *MapP;
} }
/* XXXXX lock me up */ /* XXXXX lock me up */
for ( entry=0; entry< TOTAL_MAP_ENTRIES; entry++ ) { for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
if ( p->RIOSavedTable[entry].RtaUniqueNum == MapP->RtaUniqueNum ) { if (p->RIOSavedTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) {
bzero((char *)&p->RIOSavedTable[entry],sizeof(struct Map)); bzero((char *) &p->RIOSavedTable[entry], sizeof(struct Map));
work_done++; work_done++;
} }
if ( p->RIOConnectTable[entry].RtaUniqueNum == MapP->RtaUniqueNum ) { if (p->RIOConnectTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) {
bzero((char *)&p->RIOConnectTable[entry],sizeof(struct Map)); bzero((char *) &p->RIOConnectTable[entry], sizeof(struct Map));
work_done++; work_done++;
} }
} }
if ( work_done ) if (work_done)
return 0; return 0;
rio_dprintk (RIO_DEBUG_TABLE, "Couldn't find entry to be deleted\n"); rio_dprintk(RIO_DEBUG_TABLE, "Couldn't find entry to be deleted\n");
p->RIOError.Error = COULDNT_FIND_ENTRY; p->RIOError.Error = COULDNT_FIND_ENTRY;
return -ENXIO; return -ENXIO;
} }
int RIOAssignRta( struct rio_info *p, struct Map *MapP ) int RIOAssignRta(struct rio_info *p, struct Map *MapP)
{ {
int host; int host;
struct Map *HostMapP; struct Map *HostMapP;
...@@ -639,32 +600,25 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) ...@@ -639,32 +600,25 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
int link; int link;
rio_dprintk (RIO_DEBUG_TABLE, "Assign entry on host %x, rta %x, ID %d, Sysport %d\n", 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);
MapP->HostUniqueNum,MapP->RtaUniqueNum,
MapP->ID, (int)MapP->SysPort);
if ((MapP->ID != (ushort)-1) && if ((MapP->ID != (ushort) - 1) && ((int) MapP->ID < (int) 1 || (int) MapP->ID > MAX_RUP)) {
((int)MapP->ID < (int)1 || (int)MapP->ID > MAX_RUP )) rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n");
{
rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n");
p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
if (MapP->RtaUniqueNum == 0) if (MapP->RtaUniqueNum == 0) {
{ rio_dprintk(RIO_DEBUG_TABLE, "Rta Unique number zero!\n");
rio_dprintk (RIO_DEBUG_TABLE, "Rta Unique number zero!\n");
p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO; p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO;
return -EINVAL; return -EINVAL;
} }
if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA) ) if ((MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA)) {
{ rio_dprintk(RIO_DEBUG_TABLE, "Port %d not multiple of %d!\n", (int) MapP->SysPort, PORTS_PER_RTA);
rio_dprintk (RIO_DEBUG_TABLE, "Port %d not multiple of %d!\n",(int)MapP->SysPort,PORTS_PER_RTA);
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS) ) if ((MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS)) {
{ rio_dprintk(RIO_DEBUG_TABLE, "Port %d not valid!\n", (int) MapP->SysPort);
rio_dprintk (RIO_DEBUG_TABLE, "Port %d not valid!\n",(int)MapP->SysPort);
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
...@@ -672,25 +626,20 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) ...@@ -672,25 +626,20 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
/* /*
** Copy the name across to the map entry. ** Copy the name across to the map entry.
*/ */
MapP->Name[MAX_NAME_LEN-1] = '\0'; MapP->Name[MAX_NAME_LEN - 1] = '\0';
sptr = MapP->Name; sptr = MapP->Name;
while ( *sptr ) while (*sptr) {
{ if (*sptr < ' ' || *sptr > '~') {
if ( *sptr<' ' || *sptr>'~' ) rio_dprintk(RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n");
{
rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n");
p->RIOError.Error = BAD_CHARACTER_IN_NAME; p->RIOError.Error = BAD_CHARACTER_IN_NAME;
return -EINVAL; return -EINVAL;
} }
sptr++; sptr++;
} }
for ( host=0; host < p->RIONumHosts; host++ ) for (host = 0; host < p->RIONumHosts; host++) {
{ if (MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum) {
if ( MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum ) if ((p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING) {
{
if ( (p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING )
{
p->RIOError.Error = HOST_NOT_RUNNING; p->RIOError.Error = HOST_NOT_RUNNING;
return -ENXIO; return -ENXIO;
} }
...@@ -699,12 +648,10 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) ...@@ -699,12 +648,10 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
** Now we have a host we need to allocate an ID ** Now we have a host we need to allocate an ID
** if the entry does not already have one. ** if the entry does not already have one.
*/ */
if (MapP->ID == (ushort)-1) if (MapP->ID == (ushort) - 1) {
{
int nNewID; int nNewID;
rio_dprintk (RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", rio_dprintk(RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", MapP->Name);
MapP->Name);
/* /*
** The idea here is to allow RTA's to be assigned ** The idea here is to allow RTA's to be assigned
** before they actually appear on the network. ** before they actually appear on the network.
...@@ -716,49 +663,41 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) ...@@ -716,49 +663,41 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
** 16 port entry then find the other half and ** 16 port entry then find the other half and
** make sure the 2 cross reference each other. ** make sure the 2 cross reference each other.
*/ */
if (RIOFindFreeID(p, &p->RIOHosts[host], &nNewID, NULL) != 0) if (RIOFindFreeID(p, &p->RIOHosts[host], &nNewID, NULL) != 0) {
{
p->RIOError.Error = COULDNT_FIND_ENTRY; p->RIOError.Error = COULDNT_FIND_ENTRY;
return -EBUSY; return -EBUSY;
} }
MapP->ID = (ushort)nNewID + 1; MapP->ID = (ushort) nNewID + 1;
rio_dprintk (RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID); rio_dprintk(RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID);
HostMapP = &p->RIOHosts[host].Mapping[nNewID]; HostMapP = &p->RIOHosts[host].Mapping[nNewID];
HostMapP->RtaUniqueNum = MapP->RtaUniqueNum; HostMapP->RtaUniqueNum = MapP->RtaUniqueNum;
HostMapP->HostUniqueNum = MapP->HostUniqueNum; HostMapP->HostUniqueNum = MapP->HostUniqueNum;
HostMapP->ID = MapP->ID; HostMapP->ID = MapP->ID;
for (link = 0; link < LINKS_PER_UNIT; link++) for (link = 0; link < LINKS_PER_UNIT; link++) {
{
HostMapP->Topology[link].Unit = ROUTE_DISCONNECT; HostMapP->Topology[link].Unit = ROUTE_DISCONNECT;
HostMapP->Topology[link].Link = NO_LINK; HostMapP->Topology[link].Link = NO_LINK;
} }
if (MapP->Flags & RTA16_SECOND_SLOT) if (MapP->Flags & RTA16_SECOND_SLOT) {
{
int unit; int unit;
for (unit = 0; unit < MAX_RUP; unit++) for (unit = 0; unit < MAX_RUP; unit++)
if (p->RIOHosts[host].Mapping[unit].RtaUniqueNum == if (p->RIOHosts[host].Mapping[unit].RtaUniqueNum == MapP->RtaUniqueNum)
MapP->RtaUniqueNum)
break; break;
if (unit == MAX_RUP) if (unit == MAX_RUP) {
{
p->RIOError.Error = COULDNT_FIND_ENTRY; p->RIOError.Error = COULDNT_FIND_ENTRY;
return -EBUSY; return -EBUSY;
} }
HostMapP->Flags |= RTA16_SECOND_SLOT; HostMapP->Flags |= RTA16_SECOND_SLOT;
HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID; HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID;
p->RIOHosts[host].Mapping[unit].ID2 = MapP->ID; p->RIOHosts[host].Mapping[unit].ID2 = MapP->ID;
rio_dprintk (RIO_DEBUG_TABLE, "Cross referenced id %d to ID %d.\n", rio_dprintk(RIO_DEBUG_TABLE, "Cross referenced id %d to ID %d.\n", MapP->ID, p->RIOHosts[host].Mapping[unit].ID);
MapP->ID,
p->RIOHosts[host].Mapping[unit].ID);
} }
} }
HostMapP = &p->RIOHosts[host].Mapping[MapP->ID-1]; HostMapP = &p->RIOHosts[host].Mapping[MapP->ID - 1];
if ( HostMapP->Flags & SLOT_IN_USE ) if (HostMapP->Flags & SLOT_IN_USE) {
{ rio_dprintk(RIO_DEBUG_TABLE, "Map table slot for ID %d is already in use.\n", MapP->ID);
rio_dprintk (RIO_DEBUG_TABLE, "Map table slot for ID %d is already in use.\n", MapP->ID);
p->RIOError.Error = ID_ALREADY_IN_USE; p->RIOError.Error = ID_ALREADY_IN_USE;
return -EBUSY; return -EBUSY;
} }
...@@ -769,45 +708,42 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) ...@@ -769,45 +708,42 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
*/ */
HostMapP->SysPort = MapP->SysPort; HostMapP->SysPort = MapP->SysPort;
if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) if ((MapP->Flags & RTA16_SECOND_SLOT) == 0)
CCOPY( MapP->Name, HostMapP->Name, MAX_NAME_LEN ); CCOPY(MapP->Name, HostMapP->Name, MAX_NAME_LEN);
HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED; HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED;
#ifdef NEED_TO_FIX #ifdef NEED_TO_FIX
RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID-1]); RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID - 1]);
#endif #endif
if (MapP->Flags & RTA16_SECOND_SLOT) if (MapP->Flags & RTA16_SECOND_SLOT)
HostMapP->Flags |= RTA16_SECOND_SLOT; HostMapP->Flags |= RTA16_SECOND_SLOT;
RIOReMapPorts( p, &p->RIOHosts[host], HostMapP ); RIOReMapPorts(p, &p->RIOHosts[host], HostMapP);
/* /*
** Adjust 2nd block of 8 phbs ** Adjust 2nd block of 8 phbs
*/ */
if (MapP->Flags & RTA16_SECOND_SLOT) if (MapP->Flags & RTA16_SECOND_SLOT)
RIOFixPhbs(p, &p->RIOHosts[host], HostMapP->ID - 1); RIOFixPhbs(p, &p->RIOHosts[host], HostMapP->ID - 1);
if ( HostMapP->SysPort != NO_PORT ) if (HostMapP->SysPort != NO_PORT) {
{ if (HostMapP->SysPort < p->RIOFirstPortsBooted)
if ( HostMapP->SysPort < p->RIOFirstPortsBooted )
p->RIOFirstPortsBooted = HostMapP->SysPort; p->RIOFirstPortsBooted = HostMapP->SysPort;
if ( HostMapP->SysPort > p->RIOLastPortsBooted ) if (HostMapP->SysPort > p->RIOLastPortsBooted)
p->RIOLastPortsBooted = HostMapP->SysPort; p->RIOLastPortsBooted = HostMapP->SysPort;
} }
if (MapP->Flags & RTA16_SECOND_SLOT) if (MapP->Flags & RTA16_SECOND_SLOT)
rio_dprintk (RIO_DEBUG_TABLE, "Second map of RTA %s added to configuration\n", rio_dprintk(RIO_DEBUG_TABLE, "Second map of RTA %s added to configuration\n", p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name);
p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name);
else else
rio_dprintk (RIO_DEBUG_TABLE, "RTA %s added to configuration\n", MapP->Name); rio_dprintk(RIO_DEBUG_TABLE, "RTA %s added to configuration\n", MapP->Name);
return 0; return 0;
} }
} }
p->RIOError.Error = UNKNOWN_HOST_NUMBER; p->RIOError.Error = UNKNOWN_HOST_NUMBER;
rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); rio_dprintk(RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum);
return -ENXIO; return -ENXIO;
} }
int int RIOReMapPorts(p, HostP, HostMapP)
RIOReMapPorts(p, HostP, HostMapP) struct rio_info *p;
struct rio_info * p;
struct Host *HostP; struct Host *HostP;
struct Map *HostMapP; struct Map *HostMapP;
{ {
...@@ -819,41 +755,39 @@ struct Map *HostMapP; ...@@ -819,41 +755,39 @@ struct Map *HostMapP;
unsigned long flags; unsigned long flags;
#ifdef CHECK #ifdef CHECK
CheckHostP( HostP ); CheckHostP(HostP);
CheckHostMapP( HostMapP ); CheckHostMapP(HostMapP);
#endif #endif
rio_dprintk (RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int)HostMapP->SysPort, HostMapP->ID); rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID);
/* /*
** We need to tell the UnixRups which sysport the rup corresponds to ** We need to tell the UnixRups which sysport the rup corresponds to
*/ */
HostP->UnixRups[HostMapP->ID-1].BaseSysPort = HostMapP->SysPort; HostP->UnixRups[HostMapP->ID - 1].BaseSysPort = HostMapP->SysPort;
if ( HostMapP->SysPort == NO_PORT ) if (HostMapP->SysPort == NO_PORT)
return(0); return (0);
RtaType = GetUnitType(HostMapP->RtaUniqueNum); RtaType = GetUnitType(HostMapP->RtaUniqueNum);
rio_dprintk (RIO_DEBUG_TABLE, "Mapping sysport %d-%d\n", rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d-%d\n", (int) HostMapP->SysPort, (int) HostMapP->SysPort + PORTS_PER_RTA - 1);
(int)HostMapP->SysPort, (int)HostMapP->SysPort+PORTS_PER_RTA-1);
/* /*
** now map each of its eight ports ** now map each of its eight ports
*/ */
for ( SubEnt=0; SubEnt<PORTS_PER_RTA; SubEnt++) { for (SubEnt = 0; SubEnt < PORTS_PER_RTA; SubEnt++) {
rio_dprintk (RIO_DEBUG_TABLE, "subent = %d, HostMapP->SysPort = %d\n", rio_dprintk(RIO_DEBUG_TABLE, "subent = %d, HostMapP->SysPort = %d\n", SubEnt, (int) HostMapP->SysPort);
SubEnt, (int)HostMapP->SysPort); SysPort = HostMapP->SysPort + SubEnt; /* portnumber within system */
SysPort = HostMapP->SysPort+SubEnt; /* portnumber within system */
/* portnumber on host */ /* portnumber on host */
HostPort = (HostMapP->ID-1)*PORTS_PER_RTA+SubEnt; HostPort = (HostMapP->ID - 1) * PORTS_PER_RTA + SubEnt;
rio_dprintk (RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp); rio_dprintk(RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp);
PortP = p->RIOPortp[SysPort]; PortP = p->RIOPortp[SysPort];
#if 0 #if 0
PortP->TtyP = &p->channel[SysPort]; PortP->TtyP = &p->channel[SysPort];
#endif #endif
rio_dprintk (RIO_DEBUG_TABLE, "Map port\n"); rio_dprintk(RIO_DEBUG_TABLE, "Map port\n");
/* /*
** Point at all the real neat data structures ** Point at all the real neat data structures
...@@ -868,15 +802,13 @@ struct Map *HostMapP; ...@@ -868,15 +802,13 @@ struct Map *HostMapP;
*/ */
if ((HostP->Flags & RUN_STATE) == RC_RUNNING) { if ((HostP->Flags & RUN_STATE) == RC_RUNNING) {
struct PHB *PhbP = PortP->PhbP = &HostP->PhbP[HostPort]; struct PHB *PhbP = PortP->PhbP = &HostP->PhbP[HostPort];
PortP->TxAdd =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->tx_add)); PortP->TxAdd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_add));
PortP->TxStart =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->tx_start)); PortP->TxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_start));
PortP->TxEnd =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->tx_end)); PortP->TxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_end));
PortP->RxRemove=(WORD *)RIO_PTR(HostP->Caddr, PortP->RxRemove = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_remove));
RWORD(PhbP->rx_remove)); PortP->RxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_start));
PortP->RxStart =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->rx_start)); PortP->RxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_end));
PortP->RxEnd =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->rx_end)); } else
}
else
PortP->PhbP = NULL; PortP->PhbP = NULL;
/* /*
...@@ -890,8 +822,7 @@ struct Map *HostMapP; ...@@ -890,8 +822,7 @@ struct Map *HostMapP;
if (HostMapP->Flags & RTA16_SECOND_SLOT) { if (HostMapP->Flags & RTA16_SECOND_SLOT) {
PortP->ID2 = HostMapP->ID2 - 1; PortP->ID2 = HostMapP->ID2 - 1;
PortP->SecondBlock = TRUE; PortP->SecondBlock = TRUE;
} } else {
else {
PortP->ID2 = 0; PortP->ID2 = 0;
PortP->SecondBlock = FALSE; PortP->SecondBlock = FALSE;
} }
...@@ -901,10 +832,10 @@ struct Map *HostMapP; ...@@ -901,10 +832,10 @@ struct Map *HostMapP;
** If the port was already mapped then thats all we need to do. ** If the port was already mapped then thats all we need to do.
*/ */
if (PortP->Mapped) { if (PortP->Mapped) {
rio_spin_unlock_irqrestore( &PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
continue; continue;
} } else
else HostMapP->Flags &= ~RTA_NEWBOOT; HostMapP->Flags &= ~RTA_NEWBOOT;
PortP->State = 0; PortP->State = 0;
PortP->Config = 0; PortP->Config = 0;
...@@ -914,15 +845,12 @@ struct Map *HostMapP; ...@@ -914,15 +845,12 @@ struct Map *HostMapP;
** Note: For 16 port RTA, all ports are of the same type. ** Note: For 16 port RTA, all ports are of the same type.
*/ */
if (RtaType == TYPE_RTA16) { if (RtaType == TYPE_RTA16) {
PortP->Config |= p->RIOModuleTypes[HostP->UnixRups PortP->Config |= p->RIOModuleTypes[HostP->UnixRups[HostMapP->ID - 1].ModTypes].Flags[SubEnt % PORTS_PER_MODULE];
[HostMapP->ID-1].ModTypes].Flags[SubEnt % PORTS_PER_MODULE];
} else { } else {
if ( SubEnt < PORTS_PER_MODULE ) if (SubEnt < PORTS_PER_MODULE)
PortP->Config |= p->RIOModuleTypes[LONYBLE(HostP->UnixRups PortP->Config |= p->RIOModuleTypes[LONYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
[HostMapP->ID-1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
else else
PortP->Config |= p->RIOModuleTypes[HINYBLE(HostP->UnixRups PortP->Config |= p->RIOModuleTypes[HINYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
[HostMapP->ID-1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
} }
/* /*
...@@ -933,7 +861,7 @@ struct Map *HostMapP; ...@@ -933,7 +861,7 @@ struct Map *HostMapP;
PortP->ModemState = 0; PortP->ModemState = 0;
PortP->CookMode = COOK_WELL; PortP->CookMode = COOK_WELL;
PortP->ParamSem = 0; PortP->ParamSem = 0;
PortP->FlushCmdBodge= 0; PortP->FlushCmdBodge = 0;
PortP->WflushFlag = 0; PortP->WflushFlag = 0;
PortP->MagicFlags = 0; PortP->MagicFlags = 0;
PortP->Lock = 0; PortP->Lock = 0;
...@@ -947,7 +875,7 @@ struct Map *HostMapP; ...@@ -947,7 +875,7 @@ struct Map *HostMapP;
PortP->Cor2Copy = 0; PortP->Cor2Copy = 0;
PortP->Name = &HostMapP->Name[0]; PortP->Name = &HostMapP->Name[0];
#ifdef STATS #ifdef STATS
bzero( (caddr_t)&PortP->Stat, sizeof(struct RIOStats) ); bzero((caddr_t) & PortP->Stat, sizeof(struct RIOStats));
#endif #endif
PortP->statsGather = 0; PortP->statsGather = 0;
PortP->txchars = 0; PortP->txchars = 0;
...@@ -955,11 +883,11 @@ struct Map *HostMapP; ...@@ -955,11 +883,11 @@ struct Map *HostMapP;
PortP->opens = 0; PortP->opens = 0;
PortP->closes = 0; PortP->closes = 0;
PortP->ioctls = 0; PortP->ioctls = 0;
if ( PortP->TxRingBuffer ) if (PortP->TxRingBuffer)
bzero( PortP->TxRingBuffer, p->RIOBufferSize ); bzero(PortP->TxRingBuffer, p->RIOBufferSize);
else if ( p->RIOBufferSize ) { else if (p->RIOBufferSize) {
PortP->TxRingBuffer = sysbrk(p->RIOBufferSize); PortP->TxRingBuffer = sysbrk(p->RIOBufferSize);
bzero( PortP->TxRingBuffer, p->RIOBufferSize ); bzero(PortP->TxRingBuffer, p->RIOBufferSize);
} }
PortP->TxBufferOut = 0; PortP->TxBufferOut = 0;
PortP->TxBufferIn = 0; PortP->TxBufferIn = 0;
...@@ -970,7 +898,7 @@ struct Map *HostMapP; ...@@ -970,7 +898,7 @@ struct Map *HostMapP;
** If the same, we have received the same rx pkt from the RTA ** If the same, we have received the same rx pkt from the RTA
** twice. Initialise to a value not equal to PHB_RX_TGL or 0. ** twice. Initialise to a value not equal to PHB_RX_TGL or 0.
*/ */
PortP->LastRxTgl = ~(uchar)PHB_RX_TGL; PortP->LastRxTgl = ~(uchar) PHB_RX_TGL;
/* /*
** and mark the port as usable ** and mark the port as usable
...@@ -978,67 +906,64 @@ struct Map *HostMapP; ...@@ -978,67 +906,64 @@ struct Map *HostMapP;
PortP->Mapped = 1; PortP->Mapped = 1;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
} }
if ( HostMapP->SysPort < p->RIOFirstPortsMapped ) if (HostMapP->SysPort < p->RIOFirstPortsMapped)
p->RIOFirstPortsMapped = HostMapP->SysPort; p->RIOFirstPortsMapped = HostMapP->SysPort;
if ( HostMapP->SysPort > p->RIOLastPortsMapped ) if (HostMapP->SysPort > p->RIOLastPortsMapped)
p->RIOLastPortsMapped = HostMapP->SysPort; p->RIOLastPortsMapped = HostMapP->SysPort;
return 0; return 0;
} }
int int RIOChangeName(p, MapP)
RIOChangeName(p, MapP)
struct rio_info *p; struct rio_info *p;
struct Map* MapP; struct Map *MapP;
{ {
int host; int host;
struct Map *HostMapP; struct Map *HostMapP;
char *sptr; char *sptr;
rio_dprintk (RIO_DEBUG_TABLE, "Change name entry on host %x, rta %x, ID %d, Sysport %d\n", rio_dprintk(RIO_DEBUG_TABLE, "Change name entry on host %x, rta %x, ID %d, Sysport %d\n", MapP->HostUniqueNum, MapP->RtaUniqueNum, MapP->ID, (int) MapP->SysPort);
MapP->HostUniqueNum,MapP->RtaUniqueNum,
MapP->ID, (int)MapP->SysPort);
if ( MapP->ID > MAX_RUP ) { if (MapP->ID > MAX_RUP) {
rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n");
p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
return -EINVAL; return -EINVAL;
} }
MapP->Name[MAX_NAME_LEN-1] = '\0'; MapP->Name[MAX_NAME_LEN - 1] = '\0';
sptr = MapP->Name; sptr = MapP->Name;
while ( *sptr ) { while (*sptr) {
if ( *sptr<' ' || *sptr>'~' ) { if (*sptr < ' ' || *sptr > '~') {
rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); rio_dprintk(RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n");
p->RIOError.Error = BAD_CHARACTER_IN_NAME; p->RIOError.Error = BAD_CHARACTER_IN_NAME;
return -EINVAL; return -EINVAL;
} }
sptr++; sptr++;
} }
for ( host=0; host < p->RIONumHosts; host++ ) { for (host = 0; host < p->RIONumHosts; host++) {
if ( MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum ) { if (MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum) {
if ( (p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING ) { if ((p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING) {
p->RIOError.Error = HOST_NOT_RUNNING; p->RIOError.Error = HOST_NOT_RUNNING;
return -ENXIO; return -ENXIO;
} }
if ( MapP->ID==0 ) { if (MapP->ID == 0) {
CCOPY( MapP->Name, p->RIOHosts[host].Name, MAX_NAME_LEN ); CCOPY(MapP->Name, p->RIOHosts[host].Name, MAX_NAME_LEN);
return 0; return 0;
} }
HostMapP = &p->RIOHosts[host].Mapping[MapP->ID-1]; HostMapP = &p->RIOHosts[host].Mapping[MapP->ID - 1];
if ( HostMapP->RtaUniqueNum != MapP->RtaUniqueNum ) { if (HostMapP->RtaUniqueNum != MapP->RtaUniqueNum) {
p->RIOError.Error = RTA_NUMBER_WRONG; p->RIOError.Error = RTA_NUMBER_WRONG;
return -ENXIO; return -ENXIO;
} }
CCOPY( MapP->Name, HostMapP->Name, MAX_NAME_LEN ); CCOPY(MapP->Name, HostMapP->Name, MAX_NAME_LEN);
return 0; return 0;
} }
} }
p->RIOError.Error = UNKNOWN_HOST_NUMBER; p->RIOError.Error = UNKNOWN_HOST_NUMBER;
rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); rio_dprintk(RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum);
return -ENXIO; return -ENXIO;
} }
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS #ifdef SCCS
static char *_rio_riotime_h_sccs = "@(#)riotime.h 1.1" ; static char *_rio_riotime_h_sccs = "@(#)riotime.h 1.1";
#endif #endif
#endif #endif
......
...@@ -90,13 +90,11 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3"; ...@@ -90,13 +90,11 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3";
#include "sam.h" #include "sam.h"
#if 0 #if 0
static void ttyseth_pv(struct Port *, struct ttystatics *, static void ttyseth_pv(struct Port *, struct ttystatics *, struct termios *sg, int);
struct termios *sg, int);
#endif #endif
static void RIOClearUp(struct Port *PortP); static void RIOClearUp(struct Port *PortP);
int RIOShortCommand(struct rio_info *p, struct Port *PortP, int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg);
int command, int len, int arg);
#if 0 #if 0
static int RIOCookMode(struct ttystatics *); static int RIOCookMode(struct ttystatics *);
...@@ -117,9 +115,7 @@ extern int conv_bv[]; /* now defined in ttymgr.c */ ...@@ -117,9 +115,7 @@ extern int conv_bv[]; /* now defined in ttymgr.c */
#endif #endif
#ifdef NEED_THIS2 #ifdef NEED_THIS2
static struct old_sgttyb static struct old_sgttyb default_sg = {
default_sg =
{
B19200, B19200, /* input and output speed */ B19200, B19200, /* input and output speed */
'H' - '@', /* erase char */ 'H' - '@', /* erase char */
-1, /* 2nd erase char */ -1, /* 2nd erase char */
...@@ -145,8 +141,7 @@ default_sg = ...@@ -145,8 +141,7 @@ default_sg =
extern struct rio_info *p; extern struct rio_info *p;
int int riotopen(struct tty_struct *tty, struct file *filp)
riotopen(struct tty_struct * tty, struct file * filp)
{ {
register uint SysPort; register uint SysPort;
int Modem; int Modem;
...@@ -155,7 +150,7 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -155,7 +150,7 @@ riotopen(struct tty_struct * tty, struct file * filp)
unsigned long flags; unsigned long flags;
int retval = 0; int retval = 0;
func_enter (); func_enter();
/* Make sure driver_data is NULL in case the rio isn't booted jet. Else gs_close /* Make sure driver_data is NULL in case the rio isn't booted jet. Else gs_close
is going to oops. is going to oops.
...@@ -165,16 +160,14 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -165,16 +160,14 @@ riotopen(struct tty_struct * tty, struct file * filp)
SysPort = rio_minor(tty); SysPort = rio_minor(tty);
Modem = rio_ismodem(tty); Modem = rio_ismodem(tty);
if ( p->RIOFailed ) { if (p->RIOFailed) {
rio_dprintk (RIO_DEBUG_TTY, "System initialisation failed\n"); rio_dprintk(RIO_DEBUG_TTY, "System initialisation failed\n");
pseterr(ENXIO); pseterr(ENXIO);
func_exit (); func_exit();
return -ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_TTY, "port open SysPort %d (%s) (mapped:%d)\n", rio_dprintk(RIO_DEBUG_TTY, "port open SysPort %d (%s) (mapped:%d)\n", SysPort, Modem ? "Modem" : "tty", p->RIOPortp[SysPort]->Mapped);
SysPort, Modem ? "Modem" : "tty",
p->RIOPortp[SysPort]->Mapped);
/* /*
** Validate that we have received a legitimate request. ** Validate that we have received a legitimate request.
...@@ -183,7 +176,7 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -183,7 +176,7 @@ riotopen(struct tty_struct * tty, struct file * filp)
** has been mapped onto a host. ** has been mapped onto a host.
*/ */
if (SysPort >= RIO_PORTS) { /* out of range ? */ if (SysPort >= RIO_PORTS) { /* out of range ? */
rio_dprintk (RIO_DEBUG_TTY, "Illegal port number %d\n",SysPort); rio_dprintk(RIO_DEBUG_TTY, "Illegal port number %d\n", SysPort);
pseterr(ENXIO); pseterr(ENXIO);
func_exit(); func_exit();
return -ENXIO; return -ENXIO;
...@@ -193,14 +186,14 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -193,14 +186,14 @@ riotopen(struct tty_struct * tty, struct file * filp)
** Grab pointer to the port stucture ** Grab pointer to the port stucture
*/ */
PortP = p->RIOPortp[SysPort]; /* Get control struc */ PortP = p->RIOPortp[SysPort]; /* Get control struc */
rio_dprintk (RIO_DEBUG_TTY, "PortP: %p\n", PortP); rio_dprintk(RIO_DEBUG_TTY, "PortP: %p\n", PortP);
if ( !PortP->Mapped ) { /* we aren't mapped yet! */ if (!PortP->Mapped) { /* we aren't mapped yet! */
/* /*
** The system doesn't know which RTA this port ** The system doesn't know which RTA this port
** corresponds to. ** corresponds to.
*/ */
rio_dprintk (RIO_DEBUG_TTY, "port not mapped into system\n"); rio_dprintk(RIO_DEBUG_TTY, "port not mapped into system\n");
func_exit (); func_exit();
pseterr(ENXIO); pseterr(ENXIO);
return -ENXIO; return -ENXIO;
} }
...@@ -210,10 +203,9 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -210,10 +203,9 @@ riotopen(struct tty_struct * tty, struct file * filp)
PortP->gs.tty = tty; PortP->gs.tty = tty;
PortP->gs.count++; PortP->gs.count++;
rio_dprintk (RIO_DEBUG_TTY, "%d bytes in tx buffer\n", rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt);
PortP->gs.xmit_cnt);
retval = gs_init_port (&PortP->gs); retval = gs_init_port(&PortP->gs);
if (retval) { if (retval) {
PortP->gs.count--; PortP->gs.count--;
return -ENXIO; return -ENXIO;
...@@ -222,10 +214,10 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -222,10 +214,10 @@ riotopen(struct tty_struct * tty, struct file * filp)
** If the host hasn't been booted yet, then ** If the host hasn't been booted yet, then
** fail ** fail
*/ */
if ( (PortP->HostP->Flags & RUN_STATE) != RC_RUNNING ) { if ((PortP->HostP->Flags & RUN_STATE) != RC_RUNNING) {
rio_dprintk (RIO_DEBUG_TTY, "Host not running\n"); rio_dprintk(RIO_DEBUG_TTY, "Host not running\n");
pseterr(ENXIO); pseterr(ENXIO);
func_exit (); func_exit();
return -ENXIO; return -ENXIO;
} }
...@@ -237,26 +229,26 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -237,26 +229,26 @@ riotopen(struct tty_struct * tty, struct file * filp)
#if 0 #if 0
if (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { if (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) {
if (PortP->WaitUntilBooted) { if (PortP->WaitUntilBooted) {
rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot\n"); rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot\n");
do { do {
if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n"); rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n");
func_exit (); func_exit();
return -EINTR; return -EINTR;
} }
if (repeat_this -- <= 0) { if (repeat_this-- <= 0) {
rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n");
RIOPreemptiveCmd(p, PortP, FCLOSE ); RIOPreemptiveCmd(p, PortP, FCLOSE);
pseterr(EINTR); pseterr(EINTR);
func_exit (); func_exit();
return -EIO; return -EIO;
} }
} while(!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)); } while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED));
rio_dprintk (RIO_DEBUG_TTY, "RTA has been booted\n"); rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n");
} else { } else {
rio_dprintk (RIO_DEBUG_TTY, "RTA never booted\n"); rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n");
pseterr(ENXIO); pseterr(ENXIO);
func_exit (); func_exit();
return 0; return 0;
} }
} }
...@@ -265,11 +257,11 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -265,11 +257,11 @@ riotopen(struct tty_struct * tty, struct file * filp)
easier to read and shorter. Now, if it works too that would easier to read and shorter. Now, if it works too that would
be great... -- REW be great... -- REW
*/ */
rio_dprintk (RIO_DEBUG_TTY, "Checking if RTA has booted... \n"); rio_dprintk(RIO_DEBUG_TTY, "Checking if RTA has booted... \n");
while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) {
if (!PortP->WaitUntilBooted) { if (!PortP->WaitUntilBooted) {
rio_dprintk (RIO_DEBUG_TTY, "RTA never booted\n"); rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n");
func_exit (); func_exit();
return -ENXIO; return -ENXIO;
} }
...@@ -278,29 +270,29 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -278,29 +270,29 @@ riotopen(struct tty_struct * tty, struct file * filp)
now. --REW now. --REW
*/ */
if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_TTY, "RTA_wait_for_boot: EINTR in delay \n"); rio_dprintk(RIO_DEBUG_TTY, "RTA_wait_for_boot: EINTR in delay \n");
func_exit (); func_exit();
return -EINTR; return -EINTR;
} }
if (repeat_this -- <= 0) { if (repeat_this-- <= 0) {
rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n");
func_exit (); func_exit();
return -EIO; return -EIO;
} }
} }
rio_dprintk (RIO_DEBUG_TTY, "RTA has been booted\n"); rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n");
#endif #endif
#if 0 #if 0
tp = PortP->TtyP; /* get tty struct */ tp = PortP->TtyP; /* get tty struct */
#endif #endif
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
if ( p->RIOHalted ) { if (p->RIOHalted) {
goto bombout; goto bombout;
} }
#if 0 #if 0
retval = gs_init_port(&PortP->gs); retval = gs_init_port(&PortP->gs);
if (retval){ if (retval) {
func_exit (); func_exit();
return retval; return retval;
} }
#endif #endif
...@@ -310,11 +302,11 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -310,11 +302,11 @@ riotopen(struct tty_struct * tty, struct file * filp)
** we should wait here (politely), waiting ** we should wait here (politely), waiting
** for it to finish, so that it doesn't close us! ** for it to finish, so that it doesn't close us!
*/ */
while ( (PortP->State & RIO_CLOSING) && !p->RIOHalted ) { while ((PortP->State & RIO_CLOSING) && !p->RIOHalted) {
rio_dprintk (RIO_DEBUG_TTY, "Waiting for RIO_CLOSING to go away\n"); rio_dprintk(RIO_DEBUG_TTY, "Waiting for RIO_CLOSING to go away\n");
if (repeat_this -- <= 0) { if (repeat_this-- <= 0) {
rio_dprintk (RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n");
RIOPreemptiveCmd(p, PortP, FCLOSE ); RIOPreemptiveCmd(p, PortP, FCLOSE);
retval = -EINTR; retval = -EINTR;
goto bombout; goto bombout;
} }
...@@ -327,15 +319,15 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -327,15 +319,15 @@ riotopen(struct tty_struct * tty, struct file * filp)
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
} }
if ( !PortP->Mapped ) { if (!PortP->Mapped) {
rio_dprintk (RIO_DEBUG_TTY, "Port unmapped while closing!\n"); rio_dprintk(RIO_DEBUG_TTY, "Port unmapped while closing!\n");
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
retval = -ENXIO; retval = -ENXIO;
func_exit (); func_exit();
return retval; return retval;
} }
if ( p->RIOHalted ) { if (p->RIOHalted) {
goto bombout; goto bombout;
} }
...@@ -346,12 +338,12 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -346,12 +338,12 @@ riotopen(struct tty_struct * tty, struct file * filp)
*/ */
/* Uh? Suppose I turn these on and then another process opens /* Uh? Suppose I turn these on and then another process opens
the port again? The flags get cleared! Not good. -- REW */ the port again? The flags get cleared! Not good. -- REW */
if ( !(PortP->State & (RIO_LOPEN | RIO_MOPEN)) ) { if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
PortP->Config &= ~(RIO_CTSFLOW|RIO_RTSFLOW); PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW);
} }
if (!(PortP->firstOpen)) { /* First time ? */ if (!(PortP->firstOpen)) { /* First time ? */
rio_dprintk (RIO_DEBUG_TTY, "First open for this port\n"); rio_dprintk(RIO_DEBUG_TTY, "First open for this port\n");
PortP->firstOpen++; PortP->firstOpen++;
...@@ -363,26 +355,26 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -363,26 +355,26 @@ riotopen(struct tty_struct * tty, struct file * filp)
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
#ifdef NEED_THIS #ifdef NEED_THIS
ttyseth(PortP, tp, (struct old_sgttyb *)&default_sg); ttyseth(PortP, tp, (struct old_sgttyb *) &default_sg);
#endif #endif
/* Someone explain to me why this delay/config is /* Someone explain to me why this delay/config is
here. If I read the docs correctly the "open" here. If I read the docs correctly the "open"
command piggybacks the parameters immediately. command piggybacks the parameters immediately.
-- REW */ -- REW */
RIOParam(PortP,OPEN,Modem,OK_TO_SLEEP); /* Open the port */ RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP); /* Open the port */
#if 0 #if 0
/* This delay of 1 second was annoying. I removed it. -- REW */ /* This delay of 1 second was annoying. I removed it. -- REW */
RIODelay(PortP, HUNDRED_MS*10); RIODelay(PortP, HUNDRED_MS * 10);
RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); /* Config the port */ RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); /* Config the port */
#endif #endif
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
/* /*
** wait for the port to be not closed. ** wait for the port to be not closed.
*/ */
while ( !(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted ) { while (!(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted) {
rio_dprintk (RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n",PortP->PortState); rio_dprintk(RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n", PortP->PortState);
/* /*
** 15.10.1998 ARG - ESIL 0759 ** 15.10.1998 ARG - ESIL 0759
** (Part) fix for port being trashed when opened whilst RTA "disconnected" ** (Part) fix for port being trashed when opened whilst RTA "disconnected"
...@@ -399,60 +391,56 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -399,60 +391,56 @@ riotopen(struct tty_struct * tty, struct file * filp)
*/ */
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n"); rio_dprintk(RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n");
RIOPreemptiveCmd(p, PortP, FCLOSE ); RIOPreemptiveCmd(p, PortP, FCLOSE);
func_exit (); func_exit();
return -EINTR; return -EINTR;
} }
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
} }
if ( p->RIOHalted ) { if (p->RIOHalted) {
retval = -EIO; retval = -EIO;
bombout: bombout:
/* RIOClearUp( PortP ); */ /* RIOClearUp( PortP ); */
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return retval; return retval;
} }
rio_dprintk (RIO_DEBUG_TTY, "PORT_ISOPEN found\n"); rio_dprintk(RIO_DEBUG_TTY, "PORT_ISOPEN found\n");
} }
#ifdef MODEM_SUPPORT #ifdef MODEM_SUPPORT
if (Modem) { if (Modem) {
rio_dprintk (RIO_DEBUG_TTY, "Modem - test for carrier\n"); rio_dprintk(RIO_DEBUG_TTY, "Modem - test for carrier\n");
/* /*
** ACTION ** ACTION
** insert test for carrier here. -- ??? ** insert test for carrier here. -- ???
** I already see that test here. What's the deal? -- REW ** I already see that test here. What's the deal? -- REW
*/ */
if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) {
{ rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort);
rio_dprintk (RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort);
/* /*
tp->tm.c_state |= CARR_ON; tp->tm.c_state |= CARR_ON;
wakeup((caddr_t) &tp->tm.c_canq); wakeup((caddr_t) &tp->tm.c_canq);
*/ */
PortP->State |= RIO_CARR_ON; PortP->State |= RIO_CARR_ON;
wake_up_interruptible (&PortP->gs.open_wait); wake_up_interruptible(&PortP->gs.open_wait);
} } else { /* no carrier - wait for DCD */
else /* no carrier - wait for DCD */
{
/* /*
while (!(PortP->gs.tty->termios->c_state & CARR_ON) && while (!(PortP->gs.tty->termios->c_state & CARR_ON) &&
!(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted )
*/ */
while (!(PortP->State & RIO_CARR_ON) && while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) {
!(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) {
rio_dprintk (RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n",SysPort); rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort);
/* /*
PortP->gs.tty->termios->c_state |= WOPEN; PortP->gs.tty->termios->c_state |= WOPEN;
*/ */
PortP->State |= RIO_WOPEN; PortP->State |= RIO_WOPEN;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if (RIODelay (PortP, HUNDRED_MS) == RIO_FAIL) if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL)
#if 0 #if 0
if ( sleep((caddr_t)&tp->tm.c_canqo, TTIPRI|PCATCH)) if (sleep((caddr_t) & tp->tm.c_canqo, TTIPRI | PCATCH))
#endif #endif
{ {
/* /*
...@@ -460,26 +448,24 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -460,26 +448,24 @@ riotopen(struct tty_struct * tty, struct file * filp)
** to do here. -- ??? ** to do here. -- ???
** I think it's OK. -- REW ** I think it's OK. -- REW
*/ */
rio_dprintk (RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", SysPort);
SysPort); RIOPreemptiveCmd(p, PortP, FCLOSE);
RIOPreemptiveCmd( p, PortP, FCLOSE );
/* /*
tp->tm.c_state &= ~WOPEN; tp->tm.c_state &= ~WOPEN;
*/ */
PortP->State &= ~RIO_WOPEN; PortP->State &= ~RIO_WOPEN;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
func_exit (); func_exit();
return -EINTR; return -EINTR;
} }
} }
PortP->State &= ~RIO_WOPEN; PortP->State &= ~RIO_WOPEN;
} }
if ( p->RIOHalted ) if (p->RIOHalted)
goto bombout; goto bombout;
rio_dprintk (RIO_DEBUG_TTY, "Setting RIO_MOPEN\n"); rio_dprintk(RIO_DEBUG_TTY, "Setting RIO_MOPEN\n");
PortP->State |= RIO_MOPEN; PortP->State |= RIO_MOPEN;
} } else
else
#endif #endif
{ {
/* /*
...@@ -490,11 +476,11 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -490,11 +476,11 @@ riotopen(struct tty_struct * tty, struct file * filp)
PortP->State |= RIO_LOPEN; PortP->State |= RIO_LOPEN;
} }
if ( p->RIOHalted ) { if (p->RIOHalted) {
goto bombout; goto bombout;
} }
rio_dprintk (RIO_DEBUG_TTY, "high level open done\n"); rio_dprintk(RIO_DEBUG_TTY, "high level open done\n");
#ifdef STATS #ifdef STATS
PortP->Stat.OpenCnt++; PortP->Stat.OpenCnt++;
...@@ -506,8 +492,8 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -506,8 +492,8 @@ riotopen(struct tty_struct * tty, struct file * filp)
PortP->opens++; PortP->opens++;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
rio_dprintk (RIO_DEBUG_TTY, "Returning from open\n"); rio_dprintk(RIO_DEBUG_TTY, "Returning from open\n");
func_exit (); func_exit();
return 0; return 0;
} }
...@@ -517,8 +503,7 @@ riotopen(struct tty_struct * tty, struct file * filp) ...@@ -517,8 +503,7 @@ riotopen(struct tty_struct * tty, struct file * filp)
** As there are two interfaces to the port (Modem and tty), we need to ** As there are two interfaces to the port (Modem and tty), we need to
** check that both are closed before we close the device. ** check that both are closed before we close the device.
*/ */
int int riotclose(void *ptr)
riotclose(void *ptr)
{ {
#if 0 #if 0
register uint SysPort = dev; register uint SysPort = dev;
...@@ -530,18 +515,18 @@ riotclose(void *ptr) ...@@ -530,18 +515,18 @@ riotclose(void *ptr)
int repeat_this = -1; /* Congrats to those having 15 years of int repeat_this = -1; /* Congrats to those having 15 years of
uptime! (You get to break the driver.) */ uptime! (You get to break the driver.) */
unsigned long end_time; unsigned long end_time;
struct tty_struct * tty; struct tty_struct *tty;
unsigned long flags; unsigned long flags;
int Modem; int Modem;
int rv = 0; int rv = 0;
rio_dprintk (RIO_DEBUG_TTY, "port close SysPort %d\n",PortP->PortNum); rio_dprintk(RIO_DEBUG_TTY, "port close SysPort %d\n", PortP->PortNum);
/* PortP = p->RIOPortp[SysPort]; */ /* PortP = p->RIOPortp[SysPort]; */
rio_dprintk (RIO_DEBUG_TTY, "Port is at address 0x%x\n",(int)PortP); rio_dprintk(RIO_DEBUG_TTY, "Port is at address 0x%x\n", (int) PortP);
/* tp = PortP->TtyP;*/ /* Get tty */ /* tp = PortP->TtyP; *//* Get tty */
tty = PortP->gs.tty; tty = PortP->gs.tty;
rio_dprintk (RIO_DEBUG_TTY, "TTY is at address 0x%x\n",(int)tty); rio_dprintk(RIO_DEBUG_TTY, "TTY is at address 0x%x\n", (int) tty);
if (PortP->gs.closing_wait) if (PortP->gs.closing_wait)
end_time = jiffies + PortP->gs.closing_wait; end_time = jiffies + PortP->gs.closing_wait;
...@@ -554,7 +539,7 @@ riotclose(void *ptr) ...@@ -554,7 +539,7 @@ riotclose(void *ptr)
system with large caches this won't work . Better find out when system with large caches this won't work . Better find out when
this doesn't work asap, and fix the cause. -- REW */ this doesn't work asap, and fix the cause. -- REW */
RIODelay(PortP, HUNDRED_MS*10); /* To flush the cache */ RIODelay(PortP, HUNDRED_MS * 10); /* To flush the cache */
#endif #endif
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
...@@ -564,18 +549,18 @@ riotclose(void *ptr) ...@@ -564,18 +549,18 @@ riotclose(void *ptr)
*/ */
PortP->State |= RIO_CLOSING; PortP->State |= RIO_CLOSING;
if ( (PortP->State & RIO_DELETED) ) { if ((PortP->State & RIO_DELETED)) {
rio_dprintk (RIO_DEBUG_TTY, "Close on deleted RTA\n"); rio_dprintk(RIO_DEBUG_TTY, "Close on deleted RTA\n");
deleted = 1; deleted = 1;
} }
if ( p->RIOHalted ) { if (p->RIOHalted) {
RIOClearUp( PortP ); RIOClearUp(PortP);
rv = -EIO; rv = -EIO;
goto close_end; goto close_end;
} }
rio_dprintk (RIO_DEBUG_TTY, "Clear bits\n"); rio_dprintk(RIO_DEBUG_TTY, "Clear bits\n");
/* /*
** clear the open bits for this device ** clear the open bits for this device
*/ */
...@@ -589,12 +574,12 @@ riotclose(void *ptr) ...@@ -589,12 +574,12 @@ riotclose(void *ptr)
** bit for the OTHER mode of operation, to see if THAT is ** bit for the OTHER mode of operation, to see if THAT is
** still active! ** still active!
*/ */
if ( (PortP->State & (RIO_LOPEN|RIO_MOPEN)) ) { if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
/* /*
** The port is still open for the other task - ** The port is still open for the other task -
** return, pretending that we are still active. ** return, pretending that we are still active.
*/ */
rio_dprintk (RIO_DEBUG_TTY, "Channel %d still open !\n",PortP->PortNum); rio_dprintk(RIO_DEBUG_TTY, "Channel %d still open !\n", PortP->PortNum);
PortP->State &= ~RIO_CLOSING; PortP->State &= ~RIO_CLOSING;
if (PortP->firstOpen) if (PortP->firstOpen)
PortP->firstOpen--; PortP->firstOpen--;
...@@ -602,7 +587,7 @@ riotclose(void *ptr) ...@@ -602,7 +587,7 @@ riotclose(void *ptr)
return -EIO; return -EIO;
} }
rio_dprintk (RIO_DEBUG_TTY, "Closing down - everything must go!\n"); rio_dprintk(RIO_DEBUG_TTY, "Closing down - everything must go!\n");
PortP->State &= ~RIO_DYNOROD; PortP->State &= ~RIO_DYNOROD;
...@@ -611,22 +596,21 @@ riotclose(void *ptr) ...@@ -611,22 +596,21 @@ riotclose(void *ptr)
** to drain down before closing. Bye-bye.... ** to drain down before closing. Bye-bye....
** (We never meant to do this) ** (We never meant to do this)
*/ */
rio_dprintk (RIO_DEBUG_TTY, "Timeout 1 starts\n"); rio_dprintk(RIO_DEBUG_TTY, "Timeout 1 starts\n");
if (!deleted) if (!deleted)
while ( (PortP->InUse != NOT_INUSE) && !p->RIOHalted && while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted && (PortP->TxBufferIn != PortP->TxBufferOut)) {
(PortP->TxBufferIn != PortP->TxBufferOut) ) {
cprintf("Need to flush the ttyport\n"); cprintf("Need to flush the ttyport\n");
if (repeat_this -- <= 0) { if (repeat_this-- <= 0) {
rv = -EINTR; rv = -EINTR;
rio_dprintk (RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n");
RIOPreemptiveCmd(p, PortP, FCLOSE); RIOPreemptiveCmd(p, PortP, FCLOSE);
goto close_end; goto close_end;
} }
rio_dprintk (RIO_DEBUG_TTY, "Calling timeout to flush in closing\n"); rio_dprintk(RIO_DEBUG_TTY, "Calling timeout to flush in closing\n");
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if (RIODelay_ni(PortP, HUNDRED_MS*10) == RIO_FAIL) { if (RIODelay_ni(PortP, HUNDRED_MS * 10) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n"); rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n");
rv = -EINTR; rv = -EINTR;
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
goto close_end; goto close_end;
...@@ -638,12 +622,12 @@ riotclose(void *ptr) ...@@ -638,12 +622,12 @@ riotclose(void *ptr)
repeat_this = 0xff; repeat_this = 0xff;
PortP->InUse = 0; PortP->InUse = 0;
if ( (PortP->State & (RIO_LOPEN|RIO_MOPEN)) ) { if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
/* /*
** The port has been re-opened for the other task - ** The port has been re-opened for the other task -
** return, pretending that we are still active. ** return, pretending that we are still active.
*/ */
rio_dprintk (RIO_DEBUG_TTY, "Channel %d re-open!\n", PortP->PortNum); rio_dprintk(RIO_DEBUG_TTY, "Channel %d re-open!\n", PortP->PortNum);
PortP->State &= ~RIO_CLOSING; PortP->State &= ~RIO_CLOSING;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if (PortP->firstOpen) if (PortP->firstOpen)
...@@ -651,8 +635,8 @@ riotclose(void *ptr) ...@@ -651,8 +635,8 @@ riotclose(void *ptr)
return -EIO; return -EIO;
} }
if ( p->RIOHalted ) { if (p->RIOHalted) {
RIOClearUp( PortP ); RIOClearUp(PortP);
goto close_end; goto close_end;
} }
...@@ -667,26 +651,25 @@ riotclose(void *ptr) ...@@ -667,26 +651,25 @@ riotclose(void *ptr)
if (!deleted) if (!deleted)
while (try && (PortP->PortState & PORT_ISOPEN)) { while (try && (PortP->PortState & PORT_ISOPEN)) {
try--; try--;
if (time_after (jiffies, end_time)) { if (time_after(jiffies, end_time)) {
rio_dprintk (RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n" ); rio_dprintk(RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n");
RIOPreemptiveCmd(p, PortP,FCLOSE); RIOPreemptiveCmd(p, PortP, FCLOSE);
break; break;
} }
rio_dprintk (RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", rio_dprintk(RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", PortP->PortState & PORT_ISOPEN);
PortP->PortState & PORT_ISOPEN);
if ( p->RIOHalted ) { if (p->RIOHalted) {
RIOClearUp( PortP ); RIOClearUp(PortP);
goto close_end; goto close_end;
} }
if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n"); rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n");
RIOPreemptiveCmd(p, PortP,FCLOSE); RIOPreemptiveCmd(p, PortP, FCLOSE);
break; break;
} }
} }
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
rio_dprintk (RIO_DEBUG_TTY, "Close: try was %d on completion\n", try ); rio_dprintk(RIO_DEBUG_TTY, "Close: try was %d on completion\n", try);
/* RIOPreemptiveCmd(p, PortP, FCLOSE); */ /* RIOPreemptiveCmd(p, PortP, FCLOSE); */
...@@ -694,7 +677,7 @@ riotclose(void *ptr) ...@@ -694,7 +677,7 @@ riotclose(void *ptr)
** 15.10.1998 ARG - ESIL 0761 part fix ** 15.10.1998 ARG - ESIL 0761 part fix
** RIO has it's own CTSFLOW and RTSFLOW flags in 'Config' in the port structure,** we need to make sure that the flags are clear when the port is opened. ** RIO has it's own CTSFLOW and RTSFLOW flags in 'Config' in the port structure,** we need to make sure that the flags are clear when the port is opened.
*/ */
PortP->Config &= ~(RIO_CTSFLOW|RIO_RTSFLOW); PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW);
#ifdef STATS #ifdef STATS
PortP->Stat.CloseCnt++; PortP->Stat.CloseCnt++;
...@@ -705,17 +688,17 @@ riotclose(void *ptr) ...@@ -705,17 +688,17 @@ riotclose(void *ptr)
if (PortP->statsGather) if (PortP->statsGather)
PortP->closes++; PortP->closes++;
close_end: close_end:
/* XXX: Why would a "DELETED" flag be reset here? I'd have /* XXX: Why would a "DELETED" flag be reset here? I'd have
thought that a "deleted" flag means that the port was thought that a "deleted" flag means that the port was
permanently gone, but here we can make it reappear by it permanently gone, but here we can make it reappear by it
being in close during the "deletion". being in close during the "deletion".
*/ */
PortP->State &= ~(RIO_CLOSING|RIO_DELETED); PortP->State &= ~(RIO_CLOSING | RIO_DELETED);
if (PortP->firstOpen) if (PortP->firstOpen)
PortP->firstOpen--; PortP->firstOpen--;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
rio_dprintk (RIO_DEBUG_TTY, "Return from close\n"); rio_dprintk(RIO_DEBUG_TTY, "Return from close\n");
return rv; return rv;
} }
...@@ -728,8 +711,7 @@ riotclose(void *ptr) ...@@ -728,8 +711,7 @@ riotclose(void *ptr)
** COOK_MEDIUM if the card can do all the processing necessary. ** COOK_MEDIUM if the card can do all the processing necessary.
*/ */
#if 0 #if 0
static int static int RIOCookMode(struct ttystatics *tp)
RIOCookMode(struct ttystatics *tp)
{ {
/* /*
** We can't handle tm.c_mstate != 0 on SCO ** We can't handle tm.c_mstate != 0 on SCO
...@@ -740,18 +722,18 @@ RIOCookMode(struct ttystatics *tp) ...@@ -740,18 +722,18 @@ RIOCookMode(struct ttystatics *tp)
*/ */
#ifdef CHECK #ifdef CHECK
CheckTtyP( tp ); CheckTtyP(tp);
#endif #endif
if (!(tp->tm.c_oflag & OPOST)) /* No post processing */ if (!(tp->tm.c_oflag & OPOST)) /* No post processing */
return COOK_RAW; /* Raw mode o/p */ return COOK_RAW; /* Raw mode o/p */
if ( tp->tm.c_lflag & XCASE ) if (tp->tm.c_lflag & XCASE)
return COOK_WELL; /* Use line disc */ return COOK_WELL; /* Use line disc */
if (tp->tm.c_oflag & ~(OPOST | ONLCR | OCRNL | TAB3 ) ) if (tp->tm.c_oflag & ~(OPOST | ONLCR | OCRNL | TAB3))
return COOK_WELL; /* Use line disc for strange modes */ return COOK_WELL; /* Use line disc for strange modes */
if ( tp->tm.c_oflag == OPOST ) /* If only OPOST is set, do RAW */ if (tp->tm.c_oflag == OPOST) /* If only OPOST is set, do RAW */
return COOK_RAW; return COOK_RAW;
/* /*
...@@ -761,11 +743,10 @@ RIOCookMode(struct ttystatics *tp) ...@@ -761,11 +743,10 @@ RIOCookMode(struct ttystatics *tp)
} }
#endif #endif
static void static void RIOClearUp(PortP)
RIOClearUp(PortP)
struct Port *PortP; struct Port *PortP;
{ {
rio_dprintk (RIO_DEBUG_TTY, "RIOHalted set\n"); rio_dprintk(RIO_DEBUG_TTY, "RIOHalted set\n");
PortP->Config = 0; /* Direct semaphore */ PortP->Config = 0; /* Direct semaphore */
PortP->PortState = 0; PortP->PortState = 0;
PortP->firstOpen = 0; PortP->firstOpen = 0;
...@@ -788,22 +769,21 @@ struct Port *PortP; ...@@ -788,22 +769,21 @@ struct Port *PortP;
** Other values of len aren't allowed, and will cause ** Other values of len aren't allowed, and will cause
** a panic. ** a panic.
*/ */
int RIOShortCommand(struct rio_info *p, struct Port *PortP, int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg)
int command, int len, int arg)
{ {
PKT *PacketP; PKT *PacketP;
int retries = 20; /* at 10 per second -> 2 seconds */ int retries = 20; /* at 10 per second -> 2 seconds */
unsigned long flags; unsigned long flags;
rio_dprintk (RIO_DEBUG_TTY, "entering shortcommand.\n"); rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n");
#ifdef CHECK #ifdef CHECK
CheckPortP( PortP ); CheckPortP(PortP);
if ( len < 1 || len > 2 ) if (len < 1 || len > 2)
cprintf(("STUPID LENGTH %d\n",len)); cprintf(("STUPID LENGTH %d\n", len));
#endif #endif
if ( PortP->State & RIO_DELETED ) { if (PortP->State & RIO_DELETED) {
rio_dprintk (RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n");
return RIO_FAIL; return RIO_FAIL;
} }
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
...@@ -812,9 +792,8 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, ...@@ -812,9 +792,8 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP,
** If the port is in use for pre-emptive command, then wait for it to ** If the port is in use for pre-emptive command, then wait for it to
** be free again. ** be free again.
*/ */
while ( (PortP->InUse != NOT_INUSE) && !p->RIOHalted ) { while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted) {
rio_dprintk (RIO_DEBUG_TTY, "Waiting for not in use (%d)\n", rio_dprintk(RIO_DEBUG_TTY, "Waiting for not in use (%d)\n", retries);
retries);
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if (retries-- <= 0) { if (retries-- <= 0) {
return RIO_FAIL; return RIO_FAIL;
...@@ -824,26 +803,26 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, ...@@ -824,26 +803,26 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP,
} }
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
} }
if ( PortP->State & RIO_DELETED ) { if (PortP->State & RIO_DELETED) {
rio_dprintk (RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n");
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return RIO_FAIL; return RIO_FAIL;
} }
while ( !can_add_transmit(&PacketP,PortP) && !p->RIOHalted ) { while (!can_add_transmit(&PacketP, PortP) && !p->RIOHalted) {
rio_dprintk (RIO_DEBUG_TTY, "Waiting to add short command to queue (%d)\n", retries); rio_dprintk(RIO_DEBUG_TTY, "Waiting to add short command to queue (%d)\n", retries);
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if (retries-- <= 0) { if (retries-- <= 0) {
rio_dprintk (RIO_DEBUG_TTY, "out of tries. Failing\n"); rio_dprintk(RIO_DEBUG_TTY, "out of tries. Failing\n");
return RIO_FAIL; return RIO_FAIL;
} }
if ( RIODelay_ni(PortP, HUNDRED_MS)==RIO_FAIL ) { if (RIODelay_ni(PortP, HUNDRED_MS) == RIO_FAIL) {
return RIO_FAIL; return RIO_FAIL;
} }
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
} }
if ( p->RIOHalted ) { if (p->RIOHalted) {
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return RIO_FAIL; return RIO_FAIL;
} }
...@@ -851,15 +830,15 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, ...@@ -851,15 +830,15 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP,
/* /*
** set the command byte and the argument byte ** set the command byte and the argument byte
*/ */
WBYTE(PacketP->data[0] , command); WBYTE(PacketP->data[0], command);
if ( len==2 ) if (len == 2)
WBYTE(PacketP->data[1] , arg); WBYTE(PacketP->data[1], arg);
/* /*
** set the length of the packet and set the command bit. ** set the length of the packet and set the command bit.
*/ */
WBYTE(PacketP->len , PKT_CMD_BIT | len); WBYTE(PacketP->len, PKT_CMD_BIT | len);
add_transmit(PortP); add_transmit(PortP);
/* /*
...@@ -878,8 +857,7 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, ...@@ -878,8 +857,7 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP,
** This is an ioctl interface. This is the twentieth century. You know what ** This is an ioctl interface. This is the twentieth century. You know what
** its all about. ** its all about.
*/ */
int int riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
{ {
register struct Port *PortP; register struct Port *PortP;
register struct ttystatics *tp; register struct ttystatics *tp;
...@@ -895,11 +873,10 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -895,11 +873,10 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
int Modem = rio_ismodem(tty); int Modem = rio_ismodem(tty);
int ioctl_processed; int ioctl_processed;
rio_dprintk (RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", rio_dprintk(RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", SysPort, cmd, arg, Modem ? "Modem" : "tty");
SysPort, cmd, arg, Modem?"Modem":"tty") ;
if ( SysPort >= RIO_PORTS ) { if (SysPort >= RIO_PORTS) {
rio_dprintk (RIO_DEBUG_TTY, "Bad port number %d\n", SysPort); rio_dprintk(RIO_DEBUG_TTY, "Bad port number %d\n", SysPort);
return -ENXIO; return -ENXIO;
} }
...@@ -912,14 +889,14 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -912,14 +889,14 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
PortP->Stat.IoctlCnt++; PortP->Stat.IoctlCnt++;
#endif #endif
if ( PortP->State & RIO_DELETED ) { if (PortP->State & RIO_DELETED) {
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return -EIO; return -EIO;
} }
if ( p->RIOHalted ) { if (p->RIOHalted) {
RIOClearUp( PortP ); RIOClearUp(PortP);
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return -EIO; return -EIO;
} }
...@@ -936,7 +913,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -936,7 +913,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
switch (cmd) { switch (cmd) {
case TCRIOTRIAD: case TCRIOTRIAD:
if ( arg ) if (arg)
PortP->State |= RIO_TRIAD_MODE; PortP->State |= RIO_TRIAD_MODE;
else else
PortP->State &= ~RIO_TRIAD_MODE; PortP->State &= ~RIO_TRIAD_MODE;
...@@ -952,26 +929,24 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -952,26 +929,24 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
** Hence we call RIOParam here. ** Hence we call RIOParam here.
*/ */
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
return 0; return 0;
case TCRIOTSTATE: case TCRIOTSTATE:
rio_dprintk (RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", rio_dprintk(RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", arg ? "en" : "dis");
arg ? "en" : "dis"); /* MonitorTstate = 0 ; */
/* MonitorTstate = 0 ;*/
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
return 0; return 0;
case TCRIOSTATE: /* current state of Modem input pins */ case TCRIOSTATE: /* current state of Modem input pins */
rio_dprintk (RIO_DEBUG_TTY, "TCRIOSTATE\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE\n");
if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL) if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL)
rio_dprintk (RIO_DEBUG_TTY, "TCRIOSTATE command failed\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE command failed\n");
PortP->State |= RIO_BUSY; PortP->State |= RIO_BUSY;
current = PortP->ModemState; current = PortP->ModemState;
if ( copyout((caddr_t)&current, (int)arg, if (copyout((caddr_t) & current, (int) arg, sizeof(current)) == COPYFAIL) {
sizeof(current))==COPYFAIL ) { rio_dprintk(RIO_DEBUG_TTY, "Copyout failed\n");
rio_dprintk (RIO_DEBUG_TTY, "Copyout failed\n");
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
pseterr(EFAULT); pseterr(EFAULT);
} }
...@@ -980,76 +955,68 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -980,76 +955,68 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
case TCRIOMBIS: /* Set modem lines */ case TCRIOMBIS: /* Set modem lines */
case TCRIOMBIC: /* Clear modem lines */ case TCRIOMBIC: /* Clear modem lines */
rio_dprintk (RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n");
if (cmd == TCRIOMBIS) { if (cmd == TCRIOMBIS) {
uint state; uint state;
state = (uint)arg; state = (uint) arg;
PortP->ModemState |= (ushort)state; PortP->ModemState |= (ushort) state;
PortP->ModemLines = (ulong) arg; PortP->ModemLines = (ulong) arg;
if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL) if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL)
rio_dprintk (RIO_DEBUG_TTY, rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS command failed\n");
"TCRIOMBIS command failed\n"); } else {
}
else {
uint state; uint state;
state = (uint)arg; state = (uint) arg;
PortP->ModemState &= ~(ushort)state; PortP->ModemState &= ~(ushort) state;
PortP->ModemLines = (ulong) arg; PortP->ModemLines = (ulong) arg;
if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL) if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL)
rio_dprintk (RIO_DEBUG_TTY, "TCRIOMBIC command failed\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIC command failed\n");
} }
PortP->State |= RIO_BUSY; PortP->State |= RIO_BUSY;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0; return 0;
case TCRIOXPON: /* set Xprint ON string */ case TCRIOXPON: /* set Xprint ON string */
rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPON\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPON\n");
if ( copyin((int)arg, (caddr_t)PortP->Xprint.XpOn, if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOn, MAX_XP_CTRL_LEN) == COPYFAIL) {
MAX_XP_CTRL_LEN)==COPYFAIL ) { rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n");
rio_dprintk (RIO_DEBUG_TTY, "Copyin failed\n");
PortP->Xprint.XpOn[0] = '\0'; PortP->Xprint.XpOn[0] = '\0';
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
pseterr(EFAULT); pseterr(EFAULT);
} }
PortP->Xprint.XpOn[MAX_XP_CTRL_LEN-1] = '\0'; PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn)+ PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff);
strlen(PortP->Xprint.XpOff);
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0; return 0;
case TCRIOXPOFF: /* set Xprint OFF string */ case TCRIOXPOFF: /* set Xprint OFF string */
rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPOFF\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPOFF\n");
if ( copyin( (int)arg, (caddr_t)PortP->Xprint.XpOff, if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOff, MAX_XP_CTRL_LEN) == COPYFAIL) {
MAX_XP_CTRL_LEN)==COPYFAIL ) { rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n");
rio_dprintk (RIO_DEBUG_TTY, "Copyin failed\n");
PortP->Xprint.XpOff[0] = '\0'; PortP->Xprint.XpOff[0] = '\0';
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
pseterr(EFAULT); pseterr(EFAULT);
} }
PortP->Xprint.XpOff[MAX_XP_CTRL_LEN-1] = '\0'; PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn)+ PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff);
strlen(PortP->Xprint.XpOff);
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0; return 0;
case TCRIOXPCPS: /* set Xprint CPS string */ case TCRIOXPCPS: /* set Xprint CPS string */
rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPCPS\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPCPS\n");
if ( (uint)arg > p->RIOConf.MaxXpCps || if ((uint) arg > p->RIOConf.MaxXpCps || (uint) arg < p->RIOConf.MinXpCps) {
(uint)arg < p->RIOConf.MinXpCps ) { rio_dprintk(RIO_DEBUG_TTY, "%d CPS out of range\n", arg);
rio_dprintk (RIO_DEBUG_TTY, "%d CPS out of range\n",arg);
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
pseterr(EINVAL); pseterr(EINVAL);
return 0; return 0;
} }
PortP->Xprint.XpCps = (uint)arg; PortP->Xprint.XpCps = (uint) arg;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0; return 0;
case TCRIOXPRINT: case TCRIOXPRINT:
rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPRINT\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPRINT\n");
if ( copyout((caddr_t)&PortP->Xprint, (int)arg, if (copyout((caddr_t) & PortP->Xprint, (int) arg, sizeof(struct Xprint)) == COPYFAIL) {
sizeof(struct Xprint))==COPYFAIL ) {
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
pseterr(EFAULT); pseterr(EFAULT);
} }
...@@ -1057,25 +1024,25 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -1057,25 +1024,25 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
return 0; return 0;
case TCRIOIXANYON: case TCRIOIXANYON:
rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXANYON\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYON\n");
PortP->Config |= RIO_IXANY; PortP->Config |= RIO_IXANY;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0; return 0;
case TCRIOIXANYOFF: case TCRIOIXANYOFF:
rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXANYOFF\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYOFF\n");
PortP->Config &= ~RIO_IXANY; PortP->Config &= ~RIO_IXANY;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0; return 0;
case TCRIOIXONON: case TCRIOIXONON:
rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXONON\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONON\n");
PortP->Config |= RIO_IXON; PortP->Config |= RIO_IXON;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0; return 0;
case TCRIOIXONOFF: case TCRIOIXONOFF:
rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXONOFF\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONOFF\n");
PortP->Config &= ~RIO_IXON; PortP->Config &= ~RIO_IXON;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0; return 0;
...@@ -1085,31 +1052,31 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -1085,31 +1052,31 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
** Added support for CTS and RTS flow control ioctls : ** Added support for CTS and RTS flow control ioctls :
*/ */
case TCRIOCTSFLOWEN: case TCRIOCTSFLOWEN:
rio_dprintk (RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n");
PortP->Config |= RIO_CTSFLOW; PortP->Config |= RIO_CTSFLOW;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
return 0; return 0;
case TCRIOCTSFLOWDIS: case TCRIOCTSFLOWDIS:
rio_dprintk (RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n");
PortP->Config &= ~RIO_CTSFLOW; PortP->Config &= ~RIO_CTSFLOW;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
return 0; return 0;
case TCRIORTSFLOWEN: case TCRIORTSFLOWEN:
rio_dprintk (RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n");
PortP->Config |= RIO_RTSFLOW; PortP->Config |= RIO_RTSFLOW;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
return 0; return 0;
case TCRIORTSFLOWDIS: case TCRIORTSFLOWDIS:
rio_dprintk (RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n"); rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n");
PortP->Config &= ~RIO_RTSFLOW; PortP->Config &= ~RIO_RTSFLOW;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
return 0; return 0;
/* end ESIL 0761 part fix */ /* end ESIL 0761 part fix */
...@@ -1124,20 +1091,20 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -1124,20 +1091,20 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
case OTIOCSETP: case OTIOCSETP:
case OTIOCSETN: case OTIOCSETN:
ioctl_processed++; ioctl_processed++;
ttyseth(PortP, tp, (struct old_sgttyb *)arg); ttyseth(PortP, tp, (struct old_sgttyb *) arg);
break; break;
case TCSETA: case TCSETA:
case TCSETAW: case TCSETAW:
case TCSETAF: case TCSETAF:
ioctl_processed++; ioctl_processed++;
rio_dprintk (RIO_DEBUG_TTY, "NON POSIX ioctl\n"); rio_dprintk(RIO_DEBUG_TTY, "NON POSIX ioctl\n");
ttyseth_pv(PortP, tp, (struct termios *)arg, 0); ttyseth_pv(PortP, tp, (struct termios *) arg, 0);
break; break;
case TCSETAP: /* posix tcsetattr() */ case TCSETAP: /* posix tcsetattr() */
case TCSETAWP: /* posix tcsetattr() */ case TCSETAWP: /* posix tcsetattr() */
case TCSETAFP: /* posix tcsetattr() */ case TCSETAFP: /* posix tcsetattr() */
rio_dprintk (RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n"); rio_dprintk(RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n");
ttyseth_pv(PortP, tp, (struct termios *)arg, 1); ttyseth_pv(PortP, tp, (struct termios *) arg, 1);
ioctl_processed++; ioctl_processed++;
break; break;
} }
...@@ -1147,7 +1114,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -1147,7 +1114,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
** non-busy state wait until all output has drained ** non-busy state wait until all output has drained
*/ */
if (!ioctl_processed) if (!ioctl_processed)
switch(cmd) { switch (cmd) {
case TCSETAW: case TCSETAW:
case TCSETAF: case TCSETAF:
case TCSETA: case TCSETA:
...@@ -1171,7 +1138,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -1171,7 +1138,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
#endif #endif
case TIOCSETD: case TIOCSETD:
case TIOCSETN: case TIOCSETN:
rio_dprintk (RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n"); rio_dprintk(RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n");
/* /*
** Wait for drain here, at least as far as the double buffer ** Wait for drain here, at least as far as the double buffer
** being empty. ** being empty.
...@@ -1181,7 +1148,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -1181,7 +1148,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
/* XXX Is the locking OK together with locking /* XXX Is the locking OK together with locking
in txenable? (Deadlock?) -- REW */ in txenable? (Deadlock?) -- REW */
RIOTxEnable((char *)PortP); RIOTxEnable((char *) PortP);
break; break;
default: default:
break; break;
...@@ -1192,8 +1159,8 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -1192,8 +1159,8 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
old_oflag = tp->tm.c_oflag; old_oflag = tp->tm.c_oflag;
oldcook = PortP->CookMode; oldcook = PortP->CookMode;
if ( p->RIOHalted ) { if (p->RIOHalted) {
RIOClearUp( PortP ); RIOClearUp(PortP);
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
pseterr(EIO); pseterr(EIO);
return 0; return 0;
...@@ -1214,8 +1181,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -1214,8 +1181,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
tp->tm.c_line = PortP->StoredTty.line; tp->tm.c_line = PortP->StoredTty.line;
for (i = 0; i < NCC + 1; i++) for (i = 0; i < NCC + 1; i++)
tp->tm.c_cc[i] = PortP->StoredTty.cc[i]; tp->tm.c_cc[i] = PortP->StoredTty.cc[i];
} } else {
else {
/* /*
** If the port is set to store the parameters, and it is ** If the port is set to store the parameters, and it is
** reconfigured, we want to save the current tty struct so it ** reconfigured, we want to save the current tty struct so it
...@@ -1232,14 +1198,11 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -1232,14 +1198,11 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
} }
} }
changed = (tp->tm.c_cflag != old_cflag) || changed = (tp->tm.c_cflag != old_cflag) || (tp->tm.c_iflag != old_iflag) || (tp->tm.c_oflag != old_oflag);
(tp->tm.c_iflag != old_iflag) ||
(tp->tm.c_oflag != old_oflag);
PortP->CookMode = RIOCookMode(tp); /* Set new cooking mode */ PortP->CookMode = RIOCookMode(tp); /* Set new cooking mode */
rio_dprintk (RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", rio_dprintk(RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", changed, PortP->CookMode, oldcook);
changed,PortP->CookMode,oldcook);
#ifdef MODEM_SUPPORT #ifdef MODEM_SUPPORT
/* /*
...@@ -1247,12 +1210,12 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -1247,12 +1210,12 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
*/ */
if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) { if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) {
tp->tm.c_state |= CARR_ON; tp->tm.c_state |= CARR_ON;
wakeup ((caddr_t)&tp->tm.c_canq); wakeup((caddr_t) & tp->tm.c_canq);
} }
#endif #endif
if ( p->RIOHalted ) { if (p->RIOHalted) {
RIOClearUp( PortP ); RIOClearUp(PortP);
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
pseterr(EIO); pseterr(EIO);
return 0; return 0;
...@@ -1262,14 +1225,14 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -1262,14 +1225,14 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
*/ */
if (changed || oldcook != PortP->CookMode || (ioctl_processed)) { if (changed || oldcook != PortP->CookMode || (ioctl_processed)) {
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
rio_dprintk (RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n"); rio_dprintk(RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n");
RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
} }
if (p->RIOHalted) { if (p->RIOHalted) {
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
RIOClearUp( PortP ); RIOClearUp(PortP);
pseterr(EIO); pseterr(EIO);
return 0; return 0;
} }
...@@ -1280,36 +1243,32 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) ...@@ -1280,36 +1243,32 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
/* /*
ttyseth -- set hardware dependent tty settings ttyseth -- set hardware dependent tty settings
*/ */
void void ttyseth(PortP, s, sg)
ttyseth(PortP, s, sg) struct Port *PortP;
struct Port * PortP; struct ttystatics *s;
struct ttystatics * s;
struct old_sgttyb *sg; struct old_sgttyb *sg;
{ {
struct old_sgttyb * tsg; struct old_sgttyb *tsg;
struct termios *tp = &s->tm; struct termios *tp = &s->tm;
tsg = &s->sg; tsg = &s->sg;
if (sg->sg_flags & (EVENP|ODDP)) { if (sg->sg_flags & (EVENP | ODDP)) {
tp->c_cflag &= PARENB; tp->c_cflag &= PARENB;
if (sg->sg_flags & EVENP) { if (sg->sg_flags & EVENP) {
if (sg->sg_flags & ODDP) { if (sg->sg_flags & ODDP) {
tp->c_cflag &= V_CS7; tp->c_cflag &= V_CS7;
tp->c_cflag &= ~PARENB; tp->c_cflag &= ~PARENB;
} } else {
else {
tp->c_cflag &= V_CS7; tp->c_cflag &= V_CS7;
tp->c_cflag &= PARENB; tp->c_cflag &= PARENB;
tp->c_cflag &= PARODD; tp->c_cflag &= PARODD;
} }
} } else if (sg->sg_flags & ODDP) {
else if (sg->sg_flags & ODDP) {
tp->c_cflag &= V_CS7; tp->c_cflag &= V_CS7;
tp->c_cflag &= PARENB; tp->c_cflag &= PARENB;
tp->c_cflag &= PARODD; tp->c_cflag &= PARODD;
} } else {
else {
tp->c_cflag &= V_CS7; tp->c_cflag &= V_CS7;
tp->c_cflag &= PARENB; tp->c_cflag &= PARENB;
} }
...@@ -1320,16 +1279,16 @@ struct old_sgttyb *sg; ...@@ -1320,16 +1279,16 @@ struct old_sgttyb *sg;
* I will have to use separate sets of flags to store them in the * I will have to use separate sets of flags to store them in the
* Port structure. * Port structure.
*/ */
if ( !sg->sg_ospeed ) if (!sg->sg_ospeed)
sg->sg_ospeed = sg->sg_ispeed; sg->sg_ospeed = sg->sg_ispeed;
else else
sg->sg_ispeed = sg->sg_ospeed; sg->sg_ispeed = sg->sg_ospeed;
if (sg->sg_ispeed > V_EXTB ) if (sg->sg_ispeed > V_EXTB)
sg->sg_ispeed = V_EXTB; sg->sg_ispeed = V_EXTB;
if (sg->sg_ispeed < V_B0) if (sg->sg_ispeed < V_B0)
sg->sg_ispeed = V_B0; sg->sg_ispeed = V_B0;
*tsg = *sg; *tsg = *sg;
tp->c_cflag = (tp->c_cflag & ~V_CBAUD) | conv_bv[(int)sg->sg_ispeed]; tp->c_cflag = (tp->c_cflag & ~V_CBAUD) | conv_bv[(int) sg->sg_ispeed];
} }
/* /*
...@@ -1338,8 +1297,7 @@ struct old_sgttyb *sg; ...@@ -1338,8 +1297,7 @@ struct old_sgttyb *sg;
sysv = 0 => (POSIX): struct termios *sg sysv = 0 => (POSIX): struct termios *sg
sysv != 0 => (System V): struct termio *sg sysv != 0 => (System V): struct termio *sg
*/ */
static void static void ttyseth_pv(PortP, s, sg, sysv)
ttyseth_pv(PortP, s, sg, sysv)
struct Port *PortP; struct Port *PortP;
struct ttystatics *s; struct ttystatics *s;
struct termios *sg; struct termios *sg;
...@@ -1353,11 +1311,10 @@ int sysv; ...@@ -1353,11 +1311,10 @@ int sysv;
if (sysv) { if (sysv) {
/* sg points to a System V termio structure */ /* sg points to a System V termio structure */
csize = ((struct termio *)sg)->c_cflag & CSIZE; csize = ((struct termio *) sg)->c_cflag & CSIZE;
cread = ((struct termio *)sg)->c_cflag & CREAD; cread = ((struct termio *) sg)->c_cflag & CREAD;
speed = conv_vb[((struct termio *)sg)->c_cflag & V_CBAUD]; speed = conv_vb[((struct termio *) sg)->c_cflag & V_CBAUD];
} } else {
else {
/* sg points to a POSIX termios structure */ /* sg points to a POSIX termios structure */
csize = sg->c_cflag & CSIZE; csize = sg->c_cflag & CSIZE;
cread = sg->c_cflag & CREAD; cread = sg->c_cflag & CREAD;
...@@ -1366,8 +1323,7 @@ int sysv; ...@@ -1366,8 +1323,7 @@ int sysv;
if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) { if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) {
s->sg.sg_ispeed = speed; s->sg.sg_ispeed = speed;
s->sg.sg_ospeed = speed; s->sg.sg_ospeed = speed;
s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) | s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) | conv_bv[(int) s->sg.sg_ispeed];
conv_bv[(int)s->sg.sg_ispeed];
} }
} }
#endif #endif
...@@ -97,16 +97,16 @@ typedef short NUMBER; ...@@ -97,16 +97,16 @@ typedef short NUMBER;
typedef short *NUMBER_ptr; typedef short *NUMBER_ptr;
typedef unsigned short *WORD_ptr; typedef unsigned short *WORD_ptr;
typedef unsigned char *BYTE_ptr; typedef unsigned char *BYTE_ptr;
typedef unsigned char uchar ; typedef unsigned char uchar;
typedef unsigned short ushort ; typedef unsigned short ushort;
typedef unsigned int uint ; typedef unsigned int uint;
typedef unsigned long ulong ; typedef unsigned long ulong;
typedef unsigned char u_char ; typedef unsigned char u_char;
typedef unsigned short u_short ; typedef unsigned short u_short;
typedef unsigned int u_int ; typedef unsigned int u_int;
typedef unsigned long u_long ; typedef unsigned long u_long;
typedef unsigned short ERROR ; typedef unsigned short ERROR;
typedef unsigned long ID ; typedef unsigned long ID;
typedef char *char_ptr; typedef char *char_ptr;
typedef Channel *Channel_ptr; typedef Channel *Channel_ptr;
typedef struct FREE_LIST *FREE_LIST_ptr; typedef struct FREE_LIST *FREE_LIST_ptr;
...@@ -132,4 +132,3 @@ typedef struct RUP RUP; ...@@ -132,4 +132,3 @@ typedef struct RUP RUP;
#endif /* __riotypes__ */ #endif /* __riotypes__ */
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -60,8 +60,7 @@ ...@@ -60,8 +60,7 @@
/* The PARM_MAP structure defines global values relating to the Host Card / RTA /* The PARM_MAP structure defines global values relating to the Host Card / RTA
and is the main structure from which all other structures are referenced. */ and is the main structure from which all other structures are referenced. */
typedef struct _PARM_MAP typedef struct _PARM_MAP {
{
_u16 phb_ptr; /* 0x00 Pointer to the PHB array */ _u16 phb_ptr; /* 0x00 Pointer to the PHB array */
_u16 phb_num_ptr; /* 0x02 Ptr to Number of PHB's */ _u16 phb_num_ptr; /* 0x02 Ptr to Number of PHB's */
_u16 free_list; /* 0x04 Free List pointer */ _u16 free_list; /* 0x04 Free List pointer */
...@@ -184,8 +183,7 @@ typedef struct _PARM_MAP ...@@ -184,8 +183,7 @@ typedef struct _PARM_MAP
attached to the system and there is normally an array of MAX_RUPS (=16) structures attached to the system and there is normally an array of MAX_RUPS (=16) structures
in a host card, defined by PARM_MAP->rup. */ in a host card, defined by PARM_MAP->rup. */
typedef struct _RUP typedef struct _RUP {
{
_u16 txpkt; /* 0x00 Outgoing packet */ _u16 txpkt; /* 0x00 Outgoing packet */
_u16 rxpkt; /* 0x02 ncoming packet */ _u16 rxpkt; /* 0x02 ncoming packet */
_u16 link; /* 0x04 Which link to send packet down ? */ _u16 link; /* 0x04 Which link to send packet down ? */
...@@ -234,8 +232,7 @@ typedef struct _RUP ...@@ -234,8 +232,7 @@ typedef struct _RUP
to the system and there is normally an array of MAX_PHBS (=128) structures to the system and there is normally an array of MAX_PHBS (=128) structures
in a host card, defined by PARM_MAP->phb_ptr and PARM_MAP->phb_num_ptr. */ in a host card, defined by PARM_MAP->phb_ptr and PARM_MAP->phb_num_ptr. */
typedef struct _PHB typedef struct _PHB {
{
_u16 source; /* 0x00 Location of the PHB in the host card */ _u16 source; /* 0x00 Location of the PHB in the host card */
_u16 handshake; /* 0x02 Used to manage receive packet flow control */ _u16 handshake; /* 0x02 Used to manage receive packet flow control */
_u16 status; /* 0x04 Internal port transmit/receive status */ _u16 status; /* 0x04 Internal port transmit/receive status */
...@@ -291,13 +288,12 @@ typedef struct _PHB ...@@ -291,13 +288,12 @@ typedef struct _PHB
and there is normally an array of MAX_LINKS (=4) structures in a host card, and there is normally an array of MAX_LINKS (=4) structures in a host card,
defined by PARM_MAP->link_str_ptr. */ defined by PARM_MAP->link_str_ptr. */
typedef struct _LPB typedef struct _LPB {
{
_u16 link_number; /* 0x00 Link Number */ _u16 link_number; /* 0x00 Link Number */
_u16 in_ch; /* 0x02 Link In Channel */ _u16 in_ch; /* 0x02 Link In Channel */
_u16 out_ch; /* 0x04 Link Out Channel */ _u16 out_ch; /* 0x04 Link Out Channel */
_u8 attached_serial[4]; /* 0x06 Attached serial number */ _u8 attached_serial[4]; /* 0x06 Attached serial number */
_u8 attached_host_serial[4];/* 0x0A Serial number of Host who booted other end */ _u8 attached_host_serial[4]; /* 0x0A Serial number of Host who booted other end */
_u16 descheduled; /* 0x0E Currently Descheduled */ _u16 descheduled; /* 0x0E Currently Descheduled */
_u16 state; /* 0x10 Current state */ _u16 state; /* 0x10 Current state */
_u16 send_poll; /* 0x12 Send a Poll Packet */ _u16 send_poll; /* 0x12 Send a Poll Packet */
...@@ -380,8 +376,7 @@ typedef struct _LPB ...@@ -380,8 +376,7 @@ typedef struct _LPB
/* Used to overlay packet headers when allocating/freeing packets from the free list */ /* Used to overlay packet headers when allocating/freeing packets from the free list */
typedef struct _FREE_LIST typedef struct _FREE_LIST {
{
_u16 next; /* 0x00 offset of next list item */ _u16 next; /* 0x00 offset of next list item */
_u16 prev; /* 0x02 offset of previous list item */ _u16 prev; /* 0x02 offset of previous list item */
...@@ -403,8 +398,7 @@ typedef struct _FREE_LIST ...@@ -403,8 +398,7 @@ typedef struct _FREE_LIST
#define PKT_MAX_DATA_LEN 72 /* Size of packet data */ #define PKT_MAX_DATA_LEN 72 /* Size of packet data */
typedef struct _PKT typedef struct _PKT {
{
_u8 dest_unit; /* 0x00 Destination Unit Id */ _u8 dest_unit; /* 0x00 Destination Unit Id */
_u8 dest_port; /* 0x01 Destination Port */ _u8 dest_port; /* 0x01 Destination Port */
_u8 src_unit; /* 0x02 Source Unit Id */ _u8 src_unit; /* 0x02 Source Unit Id */
......
...@@ -39,19 +39,19 @@ ...@@ -39,19 +39,19 @@
#ifndef lint #ifndef lint
#ifdef SCCS #ifdef SCCS
static char *_rio_rom_h_sccs = "@(#)rom.h 1.1" ; static char *_rio_rom_h_sccs = "@(#)rom.h 1.1";
#endif #endif
#endif #endif
typedef struct ROM ROM ; typedef struct ROM ROM;
struct ROM { struct ROM {
u_short slx ; u_short slx;
char pcb_letter_rev ; char pcb_letter_rev;
char pcb_number_rev ; char pcb_number_rev;
char serial[4] ; char serial[4];
char year ; char year;
char week ; char week;
} ; };
#endif #endif
...@@ -60,5 +60,3 @@ struct ROM { ...@@ -60,5 +60,3 @@ struct ROM {
#define ROM_LENGTH 0x20 #define ROM_LENGTH 0x20
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -74,14 +74,14 @@ typedef struct COST_ROUTE COST_ROUTE; ...@@ -74,14 +74,14 @@ typedef struct COST_ROUTE COST_ROUTE;
struct COST_ROUTE { struct COST_ROUTE {
unsigned char cost; /* Cost down this link */ unsigned char cost; /* Cost down this link */
unsigned char route[NODE_BYTES]; /* Nodes thorough this route */ unsigned char route[NODE_BYTES]; /* Nodes thorough this route */
} ; };
typedef struct ROUTE_STR ROUTE_STR ; typedef struct ROUTE_STR ROUTE_STR;
struct ROUTE_STR { struct ROUTE_STR {
COST_ROUTE cost_route[MAX_LINKS]; COST_ROUTE cost_route[MAX_LINKS];
/* cost / route for this link */ /* cost / route for this link */
ushort favoured; /* favoured link */ ushort favoured; /* favoured link */
} ; };
#define NO_LINK (short) 5 /* Link unattached */ #define NO_LINK (short) 5 /* Link unattached */
...@@ -105,4 +105,3 @@ struct ROUTE_STR { ...@@ -105,4 +105,3 @@ struct ROUTE_STR {
#endif #endif
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS_LABELS #ifdef SCCS_LABELS
static char *_rio_rtahw_h_sccs = "@(#)rtahw.h 1.5" ; static char *_rio_rtahw_h_sccs = "@(#)rtahw.h 1.5";
#endif #endif
#endif #endif
......
...@@ -74,9 +74,8 @@ struct RUP { ...@@ -74,9 +74,8 @@ struct RUP {
WORD status; /* Status */ WORD status; /* Status */
WORD txcontrol; /* Transmit control */ WORD txcontrol; /* Transmit control */
WORD rxcontrol; /* Receive control */ WORD rxcontrol; /* Receive control */
}; };
#endif #endif
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS_LABELS #ifdef SCCS_LABELS
static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1" ; static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1";
#endif #endif
#endif #endif
...@@ -48,4 +48,3 @@ static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1" ; ...@@ -48,4 +48,3 @@ static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1" ;
#define STATUS_TOPOLOGY 2 #define STATUS_TOPOLOGY 2
#endif #endif
...@@ -60,15 +60,12 @@ ...@@ -60,15 +60,12 @@
#define RX FALSE #define RX FALSE
typedef struct FREE_LIST FREE_LIST ; typedef struct FREE_LIST FREE_LIST;
struct FREE_LIST { struct FREE_LIST {
FREE_LIST_ptr next ; FREE_LIST_ptr next;
FREE_LIST_ptr prev ; FREE_LIST_ptr prev;
} ; };
#endif #endif
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -43,7 +43,7 @@ typedef struct { ...@@ -43,7 +43,7 @@ typedef struct {
unsigned int result; /* Result value */ unsigned int result; /* Result value */
unsigned int dataIn; unsigned int dataIn;
unsigned int dataOut; unsigned int dataOut;
}selftestStruct; } selftestStruct;
/* /*
** The different tests are identified by the following data values. ** The different tests are identified by the following data values.
......
...@@ -37,27 +37,26 @@ ...@@ -37,27 +37,26 @@
#ifndef lint #ifndef lint
#ifdef SCCS_LABELS #ifdef SCCS_LABELS
static char *_rio_sysmap_h_sccs = "@(#)sysmap.h 1.1" ; static char *_rio_sysmap_h_sccs = "@(#)sysmap.h 1.1";
#endif #endif
#endif #endif
#define SYSTEM_MAP_LEN 64 /* Len of System Map array */ #define SYSTEM_MAP_LEN 64 /* Len of System Map array */
typedef struct SYS_MAP SYS_MAP ; typedef struct SYS_MAP SYS_MAP;
typedef struct SYS_MAP_LINK SYS_MAP_LINK ; typedef struct SYS_MAP_LINK SYS_MAP_LINK;
struct SYS_MAP_LINK { struct SYS_MAP_LINK {
short id ; /* Unit Id */ short id; /* Unit Id */
short link ; /* Id's Link */ short link; /* Id's Link */
short been_here ; /* Used by map_gen */ short been_here; /* Used by map_gen */
} ; };
struct SYS_MAP { struct SYS_MAP {
char serial_num[4] ; char serial_num[4];
SYS_MAP_LINK link[4] ; SYS_MAP_LINK link[4];
} ; };
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#ifndef lint #ifndef lint
#ifdef SCCS_LABELS #ifdef SCCS_LABELS
static char *_rio_defaults_h_sccs = "@(#)timeouts.h 1.3" ; static char *_rio_defaults_h_sccs = "@(#)timeouts.h 1.3";
#endif #endif
#endif #endif
...@@ -48,4 +48,3 @@ static char *_rio_defaults_h_sccs = "@(#)timeouts.h 1.3" ; ...@@ -48,4 +48,3 @@ static char *_rio_defaults_h_sccs = "@(#)timeouts.h 1.3" ;
/*********** end of file ***********/ /*********** end of file ***********/
...@@ -40,8 +40,7 @@ static char *_top_h_sccs_ = "@(#)top.h 1.2"; ...@@ -40,8 +40,7 @@ static char *_top_h_sccs_ = "@(#)top.h 1.2";
/* /*
** Topology information ** Topology information
*/ */
struct Top struct Top {
{
uchar Unit; uchar Unit;
uchar Link; uchar Link;
}; };
......
...@@ -41,8 +41,7 @@ static char *_unixrup_h_sccs_ = "@(#)unixrup.h 1.2"; ...@@ -41,8 +41,7 @@ static char *_unixrup_h_sccs_ = "@(#)unixrup.h 1.2";
** UnixRup data structure. This contains pointers to actual RUPs on the ** UnixRup data structure. This contains pointers to actual RUPs on the
** host card, and all the command/boot control stuff. ** host card, and all the command/boot control stuff.
*/ */
struct UnixRup struct UnixRup {
{
struct CmdBlk *CmdsWaitingP; /* Commands waiting to be done */ struct CmdBlk *CmdsWaitingP; /* Commands waiting to be done */
struct CmdBlk *CmdPendingP; /* The command currently being sent */ struct CmdBlk *CmdPendingP; /* The command currently being sent */
struct RUP *RupP; /* the Rup to send it to */ struct RUP *RupP; /* the Rup to send it to */
...@@ -50,7 +49,7 @@ struct UnixRup ...@@ -50,7 +49,7 @@ struct UnixRup
uint BaseSysPort; /* SysPort of first tty on this RTA */ uint BaseSysPort; /* SysPort of first tty on this RTA */
uint ModTypes; /* Modules on this RTA */ uint ModTypes; /* Modules on this RTA */
spinlock_t RupLock; /* Lock structure for MPX */ spinlock_t RupLock; /* Lock structure for MPX */
/* struct lockb RupLock; */ /* Lock structure for MPX */ /* struct lockb RupLock; *//* Lock structure for MPX */
}; };
#endif /* __rio_unixrup_h__ */ #endif /* __rio_unixrup_h__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment