dect
/
linux-2.6
Archived
13
0
Fork 0

[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: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Andrew Morton 2006-01-11 12:17:49 -08:00 committed by Linus Torvalds
parent a941564458
commit 8d8706e2f8
72 changed files with 7230 additions and 7879 deletions

View File

@ -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
*/
struct s_Ctrl
{
struct s_Ctrl {
BYTE DpCtl; /* 7C00 */
BYTE Dp_Unused2_[127];
BYTE DpIntSet; /* 7C80 */
@ -67,8 +66,7 @@ struct s_Ctrl
/*
** The PROM data area on the host (0x7C00), Read Only
*/
struct s_Prom
{
struct s_Prom {
WORD DpSlxCode[2];
WORD DpRev;
WORD Dp_Unused6_;
@ -83,8 +81,7 @@ struct s_Prom
/*
** 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_Prom DpProm;
};
@ -92,22 +89,19 @@ union u_CtrlProm /* This is the control/PROM area (0x7C00) */
/*
** 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];
WORD DpParmMapAd;
};
struct s_StartUpS
{
struct s_StartUpS {
BYTE Dp_Unused9_[DP_STARTUP_ADDR];
BYTE Dp_LongJump[0x4];
BYTE Dp_Unused10_[2];
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];
struct s_ParmMapS DpParmMapS;
struct s_StartUpS DpStartUpS;
@ -116,8 +110,7 @@ union u_Sram2ParmMap /* This is the top of memory (0x7E00-0x7FFF) */
/*
** This is the DP RAM overlay.
*/
struct DpRam
{
struct DpRam {
BYTE DpSram1[DP_SRAM1_SIZE]; /* 0000 - 7BFF */
union u_CtrlProm DpCtrlProm; /* 7C00 - 7DFF */
union u_Sram2ParmMap DpSram2ParmMap; /* 7E00 - 7FFF */

View File

@ -59,4 +59,3 @@ struct BOOT_PKT {
#endif
/*********** end of file ***********/

View File

@ -97,8 +97,7 @@
#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 divisor, /* The divisor */
prescaler; /* The pre-scaler */

View File

@ -81,4 +81,3 @@ static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1" ;
#endif
/*********** end of file ***********/

View File

@ -44,8 +44,7 @@ static char *_cmdblk_h_sccs_ = "@(#)cmdblk.h 1.2";
** a rup.
*/
struct CmdBlk
{
struct CmdBlk {
struct CmdBlk *NextP; /* Pointer to next command block */
struct PKT Packet; /* A packet, to copy to the rup */
/* The func to call to check if OK */

View File

@ -54,8 +54,7 @@ static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h 1.2";
** This structure overlays a PktCmd->CmdData structure, and so starts
** at Data[2] in the actual pkt!
*/
struct BootSequence
{
struct BootSequence {
WORD NumPackets;
WORD LoadBase;
WORD CodeSize;
@ -63,17 +62,14 @@ struct BootSequence
#define BOOT_SEQUENCE_LEN 8
struct SamTop
{
struct SamTop {
BYTE Unit;
BYTE Link;
};
struct CmdHdr
{
struct CmdHdr {
BYTE PcCommand;
union
{
union {
BYTE PcPhbNum;
BYTE PcLinkNum;
BYTE PcIDNum;
@ -81,28 +77,22 @@ struct CmdHdr
};
struct PktCmd
{
union
{
struct
{
struct PktCmd {
union {
struct {
struct CmdHdr CmdHdr;
struct BootSequence PcBootSequence;
} S1;
struct
{
struct {
WORD PcSequence;
BYTE PcBootData[RTA_BOOT_DATA_SIZE];
} S2;
struct
{
struct {
WORD __crud__;
BYTE PcUniqNum[4]; /* this is really a uint. */
BYTE PcModuleTypes; /* what modules are fitted */
} S3;
struct
{
struct {
struct CmdHdr CmdHdr;
BYTE __undefined__;
BYTE PcModemStatus;
@ -111,57 +101,46 @@ struct PktCmd
WORD PcSubAddr; /* Address for command */
BYTE PcSubData[64]; /* Date area for command */
} S4;
struct
{
struct {
struct CmdHdr CmdHdr;
BYTE PcCommandText[1];
BYTE __crud__[20];
BYTE PcIDNum2; /* It had to go somewhere! */
} S5;
struct
{
struct {
struct CmdHdr CmdHdr;
struct SamTop Topology[LINKS_PER_UNIT];
} S6;
} U1;
};
struct PktCmd_M
{
union
{
struct
{
struct
{
struct PktCmd_M {
union {
struct {
struct {
uchar PcCommand;
union
{
union {
uchar PcPhbNum;
uchar PcLinkNum;
uchar PcIDNum;
} U0;
} CmdHdr;
struct
{
struct {
ushort NumPackets;
ushort LoadBase;
ushort CodeSize;
} PcBootSequence;
} S1;
struct
{
struct {
ushort PcSequence;
uchar PcBootData[RTA_BOOT_DATA_SIZE];
} S2;
struct
{
struct {
ushort __crud__;
uchar PcUniqNum[4]; /* this is really a uint. */
uchar PcModuleTypes; /* what modules are fitted */
} S3;
struct
{
struct {
ushort __cmd_hdr__;
uchar __undefined__;
uchar PcModemStatus;
@ -170,15 +149,13 @@ struct PktCmd_M
ushort PcSubAddr;
uchar PcSubData[64];
} S4;
struct
{
struct {
ushort __cmd_hdr__;
uchar PcCommandText[1];
uchar __crud__[20];
uchar PcIDNum2; /* Tacked on end */
} S5;
struct
{
struct {
ushort __cmd_hdr__;
struct Top Topology[LINKS_PER_UNIT];
} S6;

View File

@ -59,4 +59,3 @@
#endif
/*********** end of file ***********/

View File

@ -44,15 +44,13 @@ static char *_daemon_h_sccs_ = "@(#)daemon.h 1.3";
** structures used on /dev/rio
*/
struct Error
{
struct Error {
uint Error;
uint Entry;
uint Other;
};
struct DownLoad
{
struct DownLoad {
char *DataP;
uint Count;
uint ProductCode;
@ -69,8 +67,7 @@ struct DownLoad
#define MAX_XP_CTRL_LEN 16 /* ALSO IN PORT.H */
#endif
struct PortSetup
{
struct PortSetup {
uint From; /* Set/Clear XP & IXANY Control from this port.... */
uint To; /* .... to this port */
uint XpCps; /* at this speed */
@ -83,28 +80,24 @@ struct PortSetup
uchar Drain; /* close only when drained */
};
struct LpbReq
{
struct LpbReq {
uint Host;
uint Link;
struct LPB *LpbP;
};
struct RupReq
{
struct RupReq {
uint HostNum;
uint RupNum;
struct RUP *RupP;
};
struct PortReq
{
struct PortReq {
uint SysPort;
struct Port *PortP;
};
struct StreamInfo
{
struct StreamInfo {
uint SysPort;
#if 0
queue_t RQueue;
@ -115,59 +108,50 @@ struct StreamInfo
#endif
};
struct HostReq
{
struct HostReq {
uint HostNum;
struct Host *HostP;
};
struct HostDpRam
{
struct HostDpRam {
uint HostNum;
struct DpRam *DpRamP;
};
struct DebugCtrl
{
struct DebugCtrl {
uint SysPort;
uint Debug;
uint Wait;
};
struct MapInfo
{
struct MapInfo {
uint FirstPort; /* 8 ports, starting from this (tty) number */
uint RtaUnique; /* reside on this RTA (unique number) */
};
struct MapIn
{
struct MapIn {
uint NumEntries; /* How many port sets are we mapping? */
struct MapInfo *MapInfoP; /* Pointer to (user space) info */
};
struct SendPack
{
struct SendPack {
unsigned int PortNum;
unsigned char Len;
unsigned char Data[PKT_MAX_DATA_LEN];
};
struct SpecialRupCmd
{
struct SpecialRupCmd {
struct PKT Packet;
unsigned short Host;
unsigned short RupNum;
};
struct IdentifyRta
{
struct IdentifyRta {
ulong RtaUnique;
uchar ID;
};
struct KillNeighbour
{
struct KillNeighbour {
ulong UniqueNum;
uchar Link;
};

View File

@ -56,4 +56,3 @@ static char *_rio_defaults_h_sccs = "@(#)defaults.h 1.1" ;
/*********** end of file ***********/

View File

@ -46,5 +46,3 @@ static char *_rio_enable_h_sccs = "@(#)enable.h 1.1" ;
/*********** end of file ***********/

View File

@ -80,6 +80,3 @@
/*********** end of file ***********/

View File

@ -151,4 +151,3 @@ struct FORM_PARTITION {
#endif
/*********** end of file ***********/

View File

@ -54,8 +54,7 @@ void FillSlot(int, int, uint, struct Host *);
/* riocmd.c */
int RIOFoadRta(struct Host *, struct Map *);
int RIOZombieRta(struct Host *, struct Map *);
int RIOCommandRta(struct rio_info *, uint, int (* func)( struct Host *,
struct Map *));
int RIOCommandRta(struct rio_info *, uint, int (*func) (struct Host *, struct Map *));
int RIOIdentifyRta(struct rio_info *, caddr_t);
int RIOKillNeighbour(struct rio_info *, caddr_t);
int RIOSuspendBootRta(struct Host *, int, int);

View File

@ -49,8 +49,7 @@ static char *_host_h_sccs_ = "@(#)host.h 1.2";
** Host data structure. This is used for the software equiv. of
** the host.
*/
struct Host
{
struct Host {
uchar Type; /* RIO_EISA, RIO_MCA, ... */
uchar Ivec; /* POLLED or ivec number */
uchar Mode; /* Control stuff */

View File

@ -53,5 +53,3 @@ static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2" ;
/*********** end of file ***********/

View File

@ -118,5 +118,3 @@ the definitions from Linux, and is incompatible... */
#define RIO_B64000 0x12 /* 64000 baud */
#define RIO_B115200 0x13 /* 115200 baud */
#define RIO_B2000 0x14 /* 2000 baud */

View File

@ -50,6 +50,3 @@ static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1" ;
/*********** end of file ***********/

View File

@ -50,6 +50,3 @@ static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1" ;
/*********** end of file ***********/

View File

@ -48,6 +48,3 @@ static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1" ;
/*********** end of file ***********/

View File

@ -46,8 +46,7 @@ static char *_map_h_sccs_ = "@(#)map.h 1.2";
#define TOTAL_MAP_ENTRIES (MAX_MAP_ENTRY*RIO_SLOTS)
#define MAX_NAME_LEN 32
struct Map
{
struct Map {
uint HostUniqueNum; /* Supporting hosts unique number */
uint RtaUniqueNum; /* Unique number */
/*

View File

@ -42,8 +42,7 @@ static char *_param_h_sccs_ = "@(#)param.h 1.2";
** 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 Cor1; /* with what is expected at the other end. */
BYTE Cor2; /* to confirm that you've got it right, */

View File

@ -46,8 +46,7 @@
typedef struct PARM_MAP PARM_MAP;
struct PARM_MAP
{
struct PARM_MAP {
PHB_ptr phb_ptr; /* Pointer to the PHB array */
WORD_ptr phb_num_ptr; /* Ptr to Number of PHB's */
FREE_LIST_ptr free_list; /* Free List pointer */
@ -92,5 +91,3 @@ WORD dying_count; /* Count of processes dead */
#endif
/*********** end of file ***********/

View File

@ -163,11 +163,9 @@ struct PHB {
#ifdef INKERNEL
WORD source;
#else
union
{
union {
ushort source; /* Complete source */
struct
{
struct {
unsigned char unit; /* Source unit */
unsigned char port; /* Source port */
} s2;
@ -180,11 +178,9 @@ struct PHB {
#ifdef INKERNEL
WORD destination;
#else
union
{
union {
ushort destination; /* Complete destination */
struct
{
struct {
unsigned char unit; /* Destination unit */
unsigned char port; /* Destination port */
} s1;
@ -211,17 +207,14 @@ struct PHB {
PKT_ptr_ptr tx_remove;
#endif
#ifdef HOST
union
{
struct
{
union {
struct {
PKT_ptr_ptr tx_start_ptr_ptr;
PKT_ptr_ptr tx_end_ptr_ptr;
PKT_ptr_ptr tx_add_ptr_ptr;
PKT_ptr_ptr tx_remove_ptr_ptr;
} s1;
struct
{
struct {
ushort *tx_start_ptr;
ushort *tx_end_ptr;
ushort *tx_add_ptr;
@ -251,17 +244,14 @@ struct PHB {
PKT_ptr_ptr rx_remove;
#endif
#ifdef HOST
union
{
struct
{
union {
struct {
PKT_ptr_ptr rx_start_ptr_ptr;
PKT_ptr_ptr rx_end_ptr_ptr;
PKT_ptr_ptr rx_add_ptr_ptr;
PKT_ptr_ptr rx_remove_ptr_ptr;
} s1;
struct
{
struct {
ushort *rx_start_ptr;
ushort *rx_end_ptr;
ushort *rx_add_ptr;
@ -290,4 +280,3 @@ struct PHB {
#endif
/*********** end of file ***********/

View File

@ -76,20 +76,16 @@ struct PKT {
BYTE src_unit; /* Source Unit Id */
BYTE src_port; /* Source POrt */
#else
union
{
union {
ushort destination; /* Complete destination */
struct
{
struct {
unsigned char unit; /* Destination unit */
unsigned char port; /* Destination port */
} s1;
} u1;
union
{
union {
ushort source; /* Complete source */
struct
{
struct {
unsigned char unit; /* Source unit */
unsigned char port; /* Source port */
} s2;
@ -99,11 +95,9 @@ struct PKT {
BYTE len;
BYTE control;
#else
union
{
union {
ushort control;
struct
{
struct {
unsigned char len;
unsigned char control;
} s3;
@ -116,5 +110,3 @@ struct PKT {
#endif
/*********** end of file ***********/

View File

@ -71,6 +71,3 @@ static char *_rio_poll_h_sccs = "@(#)poll.h 1.2" ;
#endif
/*********** end of file ***********/

View File

@ -46,8 +46,7 @@ static char *_port_h_sccs_ = "@(#)port.h 1.3";
*/
#ifdef STATS
struct RIOStats
{
struct RIOStats {
/*
** interrupt statistics
*/
@ -91,8 +90,7 @@ struct RIOStats
/*
** Port data structure
*/
struct Port
{
struct Port {
struct gs_port gs;
int PortNum; /* RIO port no., 0-511 */
struct Host *HostP;
@ -177,8 +175,7 @@ struct Port
/*
** Transparent print stuff
*/
struct Xprint
{
struct Xprint {
#ifndef MAX_XP_CTRL_LEN
#define MAX_XP_CTRL_LEN 16 /* ALSO IN DAEMON.H */
#endif
@ -226,8 +223,7 @@ struct Port
char *p; /* save the global struc here .. */
};
struct ModuleInfo
{
struct ModuleInfo {
char *Name;
uint Flags[4]; /* one per port on a module */
};

View File

@ -115,5 +115,3 @@
#endif
/*********** end of file ***********/

View File

@ -64,4 +64,3 @@ struct Q_BUF {
/*********** end of file ***********/

View File

@ -216,8 +216,7 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3";
#define RIO_PRI (PZERO+10)
#define RIO_CLOSE_PRI PZERO-1 /* uninterruptible sleeps for close */
typedef struct DbInf
{
typedef struct DbInf {
uint Flag;
char Name[8];
} DbInf;

View File

@ -145,29 +145,46 @@ more than 512 ports.... */
/* These constants are derived from SCO Source */
static struct Conf
RIOConf =
{
RIOConf = {
/* locator */ "RIO Config here",
/* startuptime */ HZ*2, /* how long to wait for card to run */
/* slowcook */ 0, /* TRUE -> always use line disc. */
/* intrpolltime */ 1, /* The frequency of OUR polls */
/* breakinterval */ 25, /* x10 mS XXX: units seem to be 1ms not 10! -- REW*/
/* timer */ 10, /* mS */
/* startuptime */ HZ * 2,
/* how long to wait for card to run */
/* slowcook */ 0,
/* TRUE -> always use line disc. */
/* 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,
/* HostLoadBase */ 0x7C00,
/* XpHz */ 5, /* number of Xprint hits per second */
/* XpCps */ 120, /* Xprint characters per second */
/* XpOn */ "\033d#", /* start Xprint for a wyse 60 */
/* XpOff */ "\024", /* end Xprint for a wyse 60 */
/* MaxXpCps */ 2000, /* highest Xprint speed */
/* MinXpCps */ 10, /* slowest Xprint speed */
/* 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 */
/* XpHz */ 5,
/* number of Xprint hits per second */
/* XpCps */ 120,
/* Xprint characters per second */
/* XpOn */ "\033d#",
/* start Xprint for a wyse 60 */
/* XpOff */ "\024",
/* end Xprint for a wyse 60 */
/* MaxXpCps */ 2000,
/* highest Xprint speed */
/* MinXpCps */ 10,
/* slowest Xprint speed */
/* 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 */
};
@ -185,8 +202,7 @@ static int rio_set_real_termios (void *ptr);
static void rio_hungup(void *ptr);
static void rio_close(void *ptr);
static int rio_chars_in_buffer(void *ptr);
static int rio_fw_ioctl (struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
static int rio_fw_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
static int rio_init_drivers(void);
static void my_hd(void *addr, int len);
@ -262,14 +278,11 @@ static struct miscdevice rio_fw_device = {
/* This doesn't work. Who's paranoid around here? Not me! */
static inline int rio_paranoia_check(struct rio_port const * port,
char *name, const char *routine)
static inline int rio_paranoia_check(struct rio_port const *port, char *name, const char *routine)
{
static const char *badmagic =
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 *badmagic = 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";
if (!port) {
printk(badinfo, name, routine);
@ -389,8 +402,7 @@ static irqreturn_t rio_interrupt (int irq, void *ptr, struct pt_regs *regs)
func_enter();
HostP = (struct Host *) ptr; /* &p->RIOHosts[(long)ptr]; */
rio_dprintk (RIO_DEBUG_IFLOW, "rio: enter rio_interrupt (%d/%d)\n",
irq, HostP->Ivec);
rio_dprintk(RIO_DEBUG_IFLOW, "rio: enter rio_interrupt (%d/%d)\n", irq, HostP->Ivec);
/* AAargh! The order in which to do these things is essential and
not trivial.
@ -424,8 +436,7 @@ static irqreturn_t rio_interrupt (int irq, void *ptr, struct pt_regs *regs)
if (lastjif == jiffies) {
if (++nintr > IRQ_RATE_LIMIT) {
free_irq(HostP->Ivec, ptr);
printk (KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n",
HostP->Ivec);
printk(KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n", HostP->Ivec);
}
} else {
lastjif = jiffies;
@ -443,19 +454,16 @@ static irqreturn_t rio_interrupt (int irq, void *ptr, struct pt_regs *regs)
return IRQ_HANDLED;
if (test_and_set_bit(RIO_BOARD_INTR_LOCK, &HostP->locks)) {
printk (KERN_ERR "Recursive interrupt! (host %d/irq%d)\n",
(int) ptr, HostP->Ivec);
printk(KERN_ERR "Recursive interrupt! (host %d/irq%d)\n", (int) ptr, HostP->Ivec);
return IRQ_HANDLED;
}
RIOServiceHost(p, HostP, irq);
rio_dprintk ( RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n",
(int) ptr, HostP->Type);
rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n", (int) ptr, HostP->Type);
clear_bit(RIO_BOARD_INTR_LOCK, &HostP->locks);
rio_dprintk (RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n",
irq, HostP->Ivec);
rio_dprintk(RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", irq, HostP->Ivec);
func_exit();
return IRQ_HANDLED;
}
@ -629,8 +637,7 @@ static void rio_close (void *ptr)
static int rio_fw_ioctl (struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
static int rio_fw_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
{
int rc = 0;
func_enter();
@ -642,11 +649,9 @@ static int rio_fw_ioctl (struct inode *inode, struct file *filp,
return rc;
}
extern int RIOShortCommand(struct rio_info *p, struct Port *PortP,
int command, int len, int arg);
extern int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg);
static int rio_ioctl (struct tty_struct * tty, struct file * filp,
unsigned int cmd, unsigned long arg)
static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, unsigned long arg)
{
int rc;
struct Port *PortP;
@ -660,21 +665,17 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp,
switch (cmd) {
#if 0
case TIOCGSOFTCAR:
rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0),
(unsigned int *) arg);
rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), (unsigned int *) arg);
break;
#endif
case TIOCSSOFTCAR:
if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
tty->termios->c_cflag =
(tty->termios->c_cflag & ~CLOCAL) |
(ival ? CLOCAL : 0);
tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0);
}
break;
case TIOCGSERIAL:
rc = -EFAULT;
if (access_ok(VERIFY_WRITE, (void *) arg,
sizeof(struct serial_struct)))
if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(struct serial_struct)))
rc = gs_getserial(&PortP->gs, (struct serial_struct *) arg);
break;
case TCSBRK:
@ -695,7 +696,8 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp,
} else {
int l;
l = arg ? arg * 100 : 250;
if (l > 255) l = 255;
if (l > 255)
l = 255;
if (RIOShortCommand(p, PortP, SBREAK, 2, arg ? arg * 100 : 250) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
rc = -EIO;
@ -704,8 +706,7 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp,
break;
case TIOCSSERIAL:
rc = -EFAULT;
if (access_ok(VERIFY_READ, (void *) arg,
sizeof(struct serial_struct)))
if (access_ok(VERIFY_READ, (void *) arg, sizeof(struct serial_struct)))
rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg);
break;
#if 0
@ -716,8 +717,7 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp,
*/
case TIOCMGET:
rc = -EFAULT;
if (access_ok(VERIFY_WRITE, (void *) arg,
sizeof(unsigned int))) {
if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(unsigned int))) {
rc = 0;
ival = rio_getsignals(port);
put_user(ival, (unsigned int *) arg);
@ -725,20 +725,17 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp,
break;
case TIOCMBIS:
if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1),
((ival & TIOCM_RTS) ? 1 : -1));
rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1), ((ival & TIOCM_RTS) ? 1 : -1));
}
break;
case TIOCMBIC:
if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
rio_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1),
((ival & TIOCM_RTS) ? 0 : -1));
rio_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1), ((ival & TIOCM_RTS) ? 0 : -1));
}
break;
case TIOCMSET:
if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0),
((ival & TIOCM_RTS) ? 1 : 0));
rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0), ((ival & TIOCM_RTS) ? 1 : 0));
}
break;
#endif
@ -816,8 +813,7 @@ static struct vpd_prom *get_VPD_PROM (struct Host *hp)
int i;
func_enter();
rio_dprintk (RIO_DEBUG_PROBE, "Going to verify vpd prom at %p.\n",
hp->Caddr + RIO_VPD_ROM);
rio_dprintk(RIO_DEBUG_PROBE, "Going to verify vpd prom at %p.\n", hp->Caddr + RIO_VPD_ROM);
p = (char *) &vpdp;
for (i = 0; i < sizeof(struct vpd_prom); i++)
@ -904,8 +900,7 @@ out2:
out1:
put_tty_driver(rio_driver);
out:
printk(KERN_ERR "rio: Couldn't register a rio driver, error = %d\n",
error);
printk(KERN_ERR "rio: Couldn't register a rio driver, error = %d\n", error);
return 1;
}
@ -938,19 +933,16 @@ static int rio_init_datastructures (void)
#define HOST_SZ sizeof(struct Host)
#define PORT_SZ sizeof(struct Port *)
#define TMIO_SZ sizeof(struct termios *)
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);
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);
if (!(p = ckmalloc ( RI_SZ))) goto free0;
if (!(p->RIOHosts = ckmalloc (RIO_HOSTS * HOST_SZ))) goto free1;
if (!(p->RIOPortp = ckmalloc (RIO_PORTS * PORT_SZ))) goto free2;
if (!(p = ckmalloc(RI_SZ)))
goto free0;
if (!(p->RIOHosts = ckmalloc(RIO_HOSTS * HOST_SZ)))
goto free1;
if (!(p->RIOPortp = ckmalloc(RIO_PORTS * PORT_SZ)))
goto free2;
p->RIOConf = RIOConf;
rio_dprintk (RIO_DEBUG_INIT, "Got : %p %p %p\n",
p, p->RIOHosts, p->RIOPortp);
rio_dprintk(RIO_DEBUG_INIT, "Got : %p %p %p\n", p, p->RIOHosts, p->RIOPortp);
#if 1
for (i = 0; i < RIO_PORTS; i++) {
@ -992,8 +984,7 @@ static int rio_init_datastructures (void)
free3:*/ kfree(p->RIOPortp);
free2:kfree(p->RIOHosts);
free1:
rio_dprintk (RIO_DEBUG_INIT, "Not enough memory! %p %p %p\n",
p, p->RIOHosts, p->RIOPortp);
rio_dprintk(RIO_DEBUG_INIT, "Not enough memory! %p %p %p\n", p, p->RIOHosts, p->RIOPortp);
kfree(p);
free0:
return -ENOMEM;
@ -1044,8 +1035,7 @@ static void fix_rio_pci (struct pci_dev *pdev)
rebase = (ulong) ioremap(hwbase, 0x80);
t = readl(rebase + CNTRL_REG_OFFSET);
if (t != CNTRL_REG_GOODVALUE) {
printk (KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n",
t, CNTRL_REG_GOODVALUE);
printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", t, CNTRL_REG_GOODVALUE);
writel(CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET);
}
iounmap((char *) rebase);
@ -1069,12 +1059,10 @@ static int __init rio_init(void)
#endif
func_enter();
rio_dprintk (RIO_DEBUG_INIT, "Initing rio module... (rio_debug=%d)\n",
rio_debug);
rio_dprintk(RIO_DEBUG_INIT, "Initing rio module... (rio_debug=%d)\n", rio_debug);
if (abs((long) (&rio_debug) - rio_debug) < 0x10000) {
printk (KERN_WARNING "rio: rio_debug is an address, instead of a value. "
"Assuming -1. Was %x/%p.\n", rio_debug, &rio_debug);
printk(KERN_WARNING "rio: rio_debug is an address, instead of a value. " "Assuming -1. Was %x/%p.\n", rio_debug, &rio_debug);
rio_debug = -1;
}
@ -1088,13 +1076,11 @@ static int __init rio_init(void)
misc_deregister(&rio_fw_device);
return retval;
}
#ifdef CONFIG_PCI
/* First look for the JET devices: */
while ((pdev = pci_get_device (PCI_VENDOR_ID_SPECIALIX,
PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8,
pdev))) {
if (pci_enable_device(pdev)) continue;
while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, pdev))) {
if (pci_enable_device(pdev))
continue;
/* Specialix has a whole bunch of cards with
0x2000 as the device ID. They say its because
@ -1108,8 +1094,7 @@ static int __init rio_init(void)
tshort = (tint >> 16) & 0xffff;
rio_dprintk(RIO_DEBUG_PROBE, "Got a specialix card: %x.\n", tint);
if (tshort != 0x0100) {
rio_dprintk (RIO_DEBUG_PROBE, "But it's not a RIO card (%d)...\n",
tshort);
rio_dprintk(RIO_DEBUG_PROBE, "But it's not a RIO card (%d)...\n", tshort);
continue;
}
rio_dprintk(RIO_DEBUG_PROBE, "cp1\n");
@ -1130,21 +1115,14 @@ static int __init rio_init(void)
rio_reset_interrupt(hp);
rio_start_card_running(hp);
rio_dprintk (RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n",
(void *)p->RIOHosts[p->RIONumHosts].PaddrP,
p->RIOHosts[p->RIONumHosts].Caddr);
if (RIOBoardTest( p->RIOHosts[p->RIONumHosts].PaddrP,
p->RIOHosts[p->RIONumHosts].Caddr,
RIO_PCI, 0 ) == RIO_SUCCESS) {
rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr);
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);
p->RIOHosts[p->RIONumHosts].UniqueNum =
((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) |
((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);
rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n",
p->RIOHosts[p->RIONumHosts].UniqueNum);
((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);
rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
fix_rio_pci(pdev);
p->RIOLastPCISearch = RIO_SUCCESS;
@ -1165,10 +1143,9 @@ static int __init rio_init(void)
*/
/* Then look for the older RIO/PCI devices: */
while ((pdev = pci_get_device (PCI_VENDOR_ID_SPECIALIX,
PCI_DEVICE_ID_SPECIALIX_RIO,
pdev))) {
if (pci_enable_device(pdev)) continue;
while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_RIO, pdev))) {
if (pci_enable_device(pdev))
continue;
#ifdef CONFIG_RIO_OLDPCI
pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &tint);
@ -1191,20 +1168,13 @@ static int __init rio_init(void)
rio_reset_interrupt(hp);
rio_start_card_running(hp);
rio_dprintk (RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n",
(void *)p->RIOHosts[p->RIONumHosts].PaddrP,
p->RIOHosts[p->RIONumHosts].Caddr);
if (RIOBoardTest( p->RIOHosts[p->RIONumHosts].PaddrP,
p->RIOHosts[p->RIONumHosts].Caddr,
RIO_PCI, 0 ) == RIO_SUCCESS) {
rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, 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);
p->RIOHosts[p->RIONumHosts].UniqueNum =
((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) |
((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);
rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n",
p->RIOHosts[p->RIONumHosts].UniqueNum);
((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);
rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
p->RIOLastPCISearch = RIO_SUCCESS;
p->RIONumHosts++;
@ -1213,8 +1183,7 @@ static int __init rio_init(void)
iounmap((char *) (p->RIOHosts[p->RIONumHosts].Caddr));
}
#else
printk (KERN_ERR "Found an older RIO PCI card, but the driver is not "
"compiled to support it.\n");
printk(KERN_ERR "Found an older RIO PCI card, but the driver is not " "compiled to support it.\n");
#endif
}
#endif /* PCI */
@ -1239,19 +1208,13 @@ static int __init rio_init(void)
vpdp = get_VPD_PROM(hp);
rio_dprintk(RIO_DEBUG_PROBE, "Got VPD ROM\n");
okboard = 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)) {
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)) {
/* Board is present... */
if (RIOBoardTest (hp->PaddrP,
hp->Caddr, RIO_AT, 0) == RIO_SUCCESS) {
if (RIOBoardTest(hp->PaddrP, hp->Caddr, RIO_AT, 0) == RIO_SUCCESS) {
/* ... and feeling fine!!!! */
rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n",
p->RIOHosts[p->RIONumHosts].UniqueNum);
rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
if (RIOAssignAT(p, hp->PaddrP, hp->Caddr, 0)) {
rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, host%d uniqid = %x.\n",
p->RIONumHosts,
p->RIOHosts[p->RIONumHosts-1].UniqueNum);
rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, host%d uniqid = %x.\n", p->RIONumHosts, p->RIOHosts[p->RIONumHosts - 1].UniqueNum);
okboard++;
found++;
}
@ -1267,7 +1230,10 @@ static int __init rio_init(void)
hp = &p->RIOHosts[i];
if (hp->Ivec) {
int mode = SA_SHIRQ;
if (hp->Ivec & 0x8000) {mode = 0; hp->Ivec &= 0x7fff;}
if (hp->Ivec & 0x8000) {
mode = 0;
hp->Ivec &= 0x7fff;
}
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);
@ -1289,8 +1255,7 @@ static int __init rio_init(void)
init_timer(&hp->timer);
if (!hp->Ivec) {
rio_dprintk (RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n",
rio_poll);
rio_dprintk(RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_poll);
hp->timer.data = i;
hp->timer.function = rio_pollfunc;
hp->timer.expires = jiffies + rio_poll;
@ -1368,4 +1333,3 @@ module_exit(rio_exit);
* tab-width: 8
* End:
*/

View File

@ -184,4 +184,3 @@ static inline void *rio_memcpy_fromio (void *dest, void *source, int n)
#define func_exit()
#define func_enter2()
#endif

View File

@ -83,8 +83,7 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2";
static struct IdentifyRta IdRta;
static struct KillNeighbour KillUnit;
int
RIOFoadRta(struct Host *HostP, struct Map *MapP)
int RIOFoadRta(struct Host *HostP, struct Map *MapP)
{
struct CmdBlk *CmdBlkP;
@ -114,8 +113,7 @@ RIOFoadRta(struct Host *HostP, struct Map *MapP)
return 0;
}
int
RIOZombieRta(struct Host *HostP, struct Map *MapP)
int RIOZombieRta(struct Host *HostP, struct Map *MapP)
{
struct CmdBlk *CmdBlkP;
@ -145,9 +143,7 @@ RIOZombieRta(struct Host *HostP, struct Map *MapP)
return 0;
}
int
RIOCommandRta(struct rio_info *p, uint RtaUnique,
int (* func)(struct Host *HostP, struct Map *MapP))
int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP))
{
uint Host;
@ -188,8 +184,7 @@ RIOCommandRta(struct rio_info *p, uint RtaUnique,
}
int
RIOIdentifyRta(struct rio_info *p, caddr_t arg)
int RIOIdentifyRta(struct rio_info *p, caddr_t arg)
{
uint Host;
@ -254,8 +249,7 @@ RIOIdentifyRta(struct rio_info *p, caddr_t arg)
}
int
RIOKillNeighbour(struct rio_info *p, caddr_t arg)
int RIOKillNeighbour(struct rio_info *p, caddr_t arg)
{
uint Host;
uint ID;
@ -295,8 +289,7 @@ RIOKillNeighbour(struct rio_info *p, caddr_t arg)
HostP = &p->RIOHosts[Host];
if (HostP->UniqueNum == KillUnit.UniqueNum) {
if ( RIOQueueCmdBlk( HostP, RTAS_PER_HOST+KillUnit.Link,
CmdBlkP) == RIO_FAIL ) {
if (RIOQueueCmdBlk(HostP, RTAS_PER_HOST + KillUnit.Link, CmdBlkP) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
return -EIO;
}
@ -318,8 +311,7 @@ RIOKillNeighbour(struct rio_info *p, caddr_t arg)
return -ENXIO;
}
int
RIOSuspendBootRta(struct Host *HostP, int ID, int Link)
int RIOSuspendBootRta(struct Host *HostP, int ID, int Link)
{
struct CmdBlk *CmdBlkP;
@ -349,8 +341,7 @@ RIOSuspendBootRta(struct Host *HostP, int ID, int Link)
return 0;
}
int
RIOFoadWakeup(struct rio_info *p)
int RIOFoadWakeup(struct rio_info *p)
{
int port;
register struct Port *PortP;
@ -383,8 +374,7 @@ RIOFoadWakeup(struct rio_info *p)
/*
** Incoming command on the COMMAND_RUP to be processed.
*/
static int
RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
{
struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data;
struct Port *PortP;
@ -413,8 +403,7 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
*/
rup = RBYTE(PktCmdP->PhbNum) / (ushort) PORTS_PER_RTA;
UnixRupP = &HostP->UnixRups[rup];
SysPort = UnixRupP->BaseSysPort +
(RBYTE(PktCmdP->PhbNum) % (ushort)PORTS_PER_RTA);
SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA);
rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort);
#ifdef CHECK
@ -424,29 +413,22 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
if (UnixRupP->BaseSysPort == NO_PORT) {
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, "CONTROL information: Host number %d, name ``%s''\n",
HostP-p->RIOHosts, HostP->Name );
rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", HostP - p->RIOHosts, HostP->Name);
rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", 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
rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n",
('A' + Rup - MAX_RUP), HostP->Name);
rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('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: Source 0x%x:0x%x\n",
PacketP->src_unit, PacketP->src_port );
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: Source 0x%x:0x%x\n", PacketP->src_unit, PacketP->src_port);
rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", PacketP->len, PacketP->len);
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 );
rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command);
return TRUE;
}
#ifdef CHECK
CheckSysPort(SysPort);
#endif
@ -465,13 +447,11 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
break;
case COMPLETE:
rio_dprintk (RIO_DEBUG_CMD, "Command complete on phb %d host %d\n",
RBYTE(PktCmdP->PhbNum), HostP-p->RIOHosts);
rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", RBYTE(PktCmdP->PhbNum), HostP - p->RIOHosts);
subCommand = 1;
switch (RBYTE(PktCmdP->SubCommand)) {
case MEMDUMP:
rio_dprintk (RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n",
RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr));
rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr));
break;
case READ_REGISTER:
rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr));
@ -483,8 +463,7 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
}
if (subCommand)
break;
rio_dprintk (RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n",
RBYTE(PktCmdP->PortStatus),PortP->PortState);
rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", RBYTE(PktCmdP->PortStatus), PortP->PortState);
if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) {
rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n");
PortP->PortState = RBYTE(PktCmdP->PortStatus);
@ -502,18 +481,15 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
** it's a convenient place to put them!).
*/
ReportedModemStatus = RBYTE(PktCmdP->ModemStatus);
if ((PortP->ModemState & MSVR1_HOST) ==
(ReportedModemStatus & MSVR1_HOST)) {
if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) {
rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState);
/*
** Update ModemState just in case tbusy or tstop states have
** changed.
*/
PortP->ModemState = ReportedModemStatus;
}
else {
rio_dprintk (RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n",
PortP->ModemState, ReportedModemStatus);
} else {
rio_dprintk(RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n", PortP->ModemState, ReportedModemStatus);
PortP->ModemState = ReportedModemStatus;
#ifdef MODEM_SUPPORT
if (PortP->Mapped) {
@ -533,8 +509,7 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
if (PortP->gs.tty->termios == NULL)
break;
if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) &&
((PortP->State & (RIO_MOPEN|RIO_WOPEN)))) {
if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) {
rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n");
/*
@ -577,8 +552,7 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
break;
default:
rio_dprintk (RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n",
RBYTE(PktCmdP->Command),HostP-p->RIOHosts);
rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", RBYTE(PktCmdP->Command), HostP - p->RIOHosts);
break;
}
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
@ -587,6 +561,7 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
return TRUE;
}
/*
** The command mechanism:
** Each rup has a chain of commands associated with it.
@ -600,8 +575,7 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
/*
** Allocate an empty command block.
*/
struct CmdBlk *
RIOGetCmdBlk(void)
struct CmdBlk *RIOGetCmdBlk(void)
{
struct CmdBlk *CmdBlkP;
@ -615,8 +589,7 @@ RIOGetCmdBlk(void)
/*
** Return a block to the head of the free list.
*/
void
RIOFreeCmdBlk(struct CmdBlk *CmdBlkP)
void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP)
{
sysfree((void *) CmdBlkP, sizeof(struct CmdBlk));
}
@ -625,8 +598,7 @@ RIOFreeCmdBlk(struct CmdBlk *CmdBlkP)
** attach a command block to the list of commands to be performed for
** a given rup.
*/
int
RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
{
struct CmdBlk **Base;
struct UnixRup *UnixRupP;
@ -651,18 +623,14 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
** If the RUP is currently inactive, then put the request
** straight on the RUP....
*/
if ( (UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) &&
(RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE ) &&
(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP)(CmdBlkP->PreArg,CmdBlkP)
if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP)
: TRUE)) {
rio_dprintk (RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n",
CmdBlkP->Packet.data[0]);
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!
*/
HostP->Copy( (caddr_t)&CmdBlkP->Packet,
RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt ), sizeof(PKT) );
HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
/*
** place command packet on the pending position.
@ -694,8 +662,7 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
while (*Base) {
rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int) (*Base));
Base = &((*Base)->NextP);
rio_dprintk (RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n",
(int)CmdBlkP,(int)Base);
rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd 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);
@ -713,8 +680,7 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
** Here we go - if there is an empty rup, fill it!
** must be called at splrio() or higher.
*/
void
RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
{
register struct CmdBlk *CmdBlkP;
register struct UnixRup *UnixRupP;
@ -745,9 +711,7 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
switch (RBYTE(PacketP->dest_port)) {
case BOOT_RUP:
rio_dprintk (RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n",
RBYTE(PacketP->len) & 0x80 ? "Command":"Data",
RBYTE(PacketP->data[0]));
rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", RBYTE(PacketP->len) & 0x80 ? "Command" : "Data", RBYTE(PacketP->data[0]));
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
FreeMe = RIOBootRup(p, Rup, HostP, PacketP);
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
@ -762,10 +726,8 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
FreeMe = RIOCommandRup(p, Rup, HostP, PacketP);
if (PacketP->data[5] == MEMDUMP) {
rio_dprintk (RIO_DEBUG_CMD, "Memdump from 0x%x complete\n",
*(ushort *) &(PacketP->data[6]));
HostP->Copy( (caddr_t)&(PacketP->data[8]),
(caddr_t)p->RIOMemDump, 32 );
rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(ushort *) & (PacketP->data[6]));
HostP->Copy((caddr_t) & (PacketP->data[8]), (caddr_t) p->RIOMemDump, 32);
}
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
break;
@ -790,8 +752,7 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
if (RWORD(UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) {
rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup);
WWORD(UnixRupP->RupP->handshake,
PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET);
WWORD(UnixRupP->RupP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET);
}
}
}
@ -810,9 +771,7 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
** what happened).
*/
if (CmdBlkP->Packet.dest_port == BOOT_RUP)
rio_dprintk (RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n",
CmdBlkP->Packet.len & 0x80 ? "Command":"Data",
CmdBlkP->Packet.data[0]);
rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]);
rio_dprintk(RIO_DEBUG_CMD, "Command 0x%x completed\n", (int) CmdBlkP);
@ -841,8 +800,7 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
** is idle, then process the command
*/
if ((CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */
(UnixRupP->CmdPendingP == NULL) &&
(RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
(UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
/*
** if the pre-function is non-zero, call it.
** If it returns RIO_FAIL then don't
@ -851,21 +809,17 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
#ifdef CHECK
CheckCmdBlkP(CmdBlkP);
#endif
if ( !(CmdBlkP->PreFuncP ?
(*CmdBlkP->PreFuncP)(CmdBlkP->PreArg, CmdBlkP) : TRUE)) {
if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) {
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!
*/
#ifdef CHECK
CheckPacketP((PKT *) RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt));
#endif
HostP->Copy( (caddr_t)&CmdBlkP->Packet,
RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
/*
** remove the command from the rup command queue...
@ -892,8 +846,7 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
} while (Rup);
}
int
RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP)
int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP)
{
struct Port *PortP = (struct Port *) iPortP;
unsigned long flags;
@ -908,8 +861,7 @@ RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP)
return RIOUnUse(iPortP, CmdBlkP);
}
int
RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP)
int RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP)
{
struct Port *PortP = (struct Port *) iPortP;
PKT *PacketP;
@ -935,8 +887,7 @@ RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP)
return RIOUnUse(iPortP, CmdBlkP);
}
int
RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP)
int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP)
{
struct Port *PortP = (struct Port *) iPortP;
unsigned long flags;
@ -977,8 +928,7 @@ RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP)
return 0;
}
void
ShowPacket(uint Flags, struct PKT *PacketP)
void ShowPacket(uint Flags, struct PKT *PacketP)
{
}

View File

@ -122,10 +122,11 @@ typedef struct ttystatics TERMIO;
** process to bog off.
*/
static int
(*RIOBootTable[MAX_PRODUCT])(struct rio_info *, struct DownLoad *) =
{
/* 0 */ RIOBootCodeHOST, /* Host Card */
/* 1 */ RIOBootCodeRTA, /* RTA */
(*RIOBootTable[MAX_PRODUCT]) (struct rio_info *, struct DownLoad *) = {
/* 0 */ RIOBootCodeHOST,
/* Host Card */
/* 1 */ RIOBootCodeRTA,
/* RTA */
};
#define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff))
@ -136,8 +137,10 @@ int copyin (int arg, caddr_t dp, int siz)
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);
if (rv) return COPYFAIL;
else return rv;
if (rv)
return COPYFAIL;
else
return rv;
}
static int copyout(caddr_t dp, int arg, int siz)
@ -146,12 +149,13 @@ static int copyout (caddr_t dp, int arg, int siz)
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);
if (rv) return COPYFAIL;
else return rv;
if (rv)
return COPYFAIL;
else
return rv;
}
int
riocontrol(p, dev, cmd, arg, su)
int riocontrol(p, dev, cmd, arg, su)
struct rio_info *p;
dev_t dev;
int cmd;
@ -283,8 +287,7 @@ int su;
struct CmdBlk *CmdBlkP;
rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n");
if (copyin((int)arg, (caddr_t)&SpecialRupCmd,
sizeof(SpecialRupCmd)) == COPYFAIL ) {
if (copyin((int) arg, (caddr_t) & SpecialRupCmd, sizeof(SpecialRupCmd)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n");
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
@ -297,10 +300,8 @@ int su;
CmdBlkP->Packet = SpecialRupCmd.Packet;
if (SpecialRupCmd.Host >= p->RIONumHosts)
SpecialRupCmd.Host = 0;
rio_dprintk (RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n",
SpecialRupCmd.Host, SpecialRupCmd.RupNum);
if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host],
SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", SpecialRupCmd.Host, SpecialRupCmd.RupNum);
if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) {
cprintf("FAILED TO QUEUE SPECIAL RUP COMMAND\n");
}
return 0;
@ -328,8 +329,7 @@ RIO_DEBUG_CTRL, if (su)
if ((retval = RIOApel(p)) != 0)
return retval;
if (copyout((caddr_t)p->RIOConnectTable, (int)arg,
TOTAL_MAP_ENTRIES*sizeof(struct Map)) == COPYFAIL) {
if (copyout((caddr_t) p->RIOConnectTable, (int) arg, TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n");
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
@ -338,11 +338,9 @@ RIO_DEBUG_CTRL, if (su)
{
int entry;
rio_dprintk(RIO_DEBUG_CTRL, "*****\nMAP ENTRIES\n");
for ( entry=0; entry<TOTAL_MAP_ENTRIES; entry++ )
{
if ((p->RIOConnectTable[entry].ID == 0) &&
(p->RIOConnectTable[entry].HostUniqueNum == 0) &&
(p->RIOConnectTable[entry].RtaUniqueNum == 0)) continue;
for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
if ((p->RIOConnectTable[entry].ID == 0) && (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);
@ -376,8 +374,7 @@ RIO_DEBUG_CTRL, if (su)
p->RIOError.Error = NOT_SUPER_USER;
return -EPERM;
}
if ( copyin((int)arg, (caddr_t)&p->RIOConnectTable[0],
TOTAL_MAP_ENTRIES*sizeof(struct Map) ) == COPYFAIL ) {
if (copyin((int) arg, (caddr_t) & p->RIOConnectTable[0], TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n");
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
@ -418,14 +415,12 @@ RIO_DEBUG_CTRL, if (su)
*/
rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS\n");
if ( !su )
{
if (!su) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n");
p->RIOError.Error = NOT_SUPER_USER;
return -EPERM;
}
if (copyout((caddr_t) p->RIOBindTab, (int)arg,
(sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL ) {
if (copyout((caddr_t) p->RIOBindTab, (int) arg, (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n");
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
@ -439,14 +434,12 @@ RIO_DEBUG_CTRL, if (su)
*/
rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS\n");
if ( !su )
{
if (!su) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n");
p->RIOError.Error = NOT_SUPER_USER;
return -EPERM;
}
if (copyin((int)arg, (caddr_t)&p->RIOBindTab[0],
(sizeof(ulong) * MAX_RTA_BINDINGS))==COPYFAIL ) {
if (copyin((int) arg, (caddr_t) & p->RIOBindTab[0], (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n");
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
@ -475,8 +468,7 @@ RIO_DEBUG_CTRL, if (su)
** Already exists - delete
*/
p->RIOBindTab[Entry] = 0L;
rio_dprintk (RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n",
(int) arg);
rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n", (int) arg);
return 0;
}
}
@ -485,12 +477,9 @@ RIO_DEBUG_CTRL, if (su)
*/
if (EmptySlot != -1) {
p->RIOBindTab[EmptySlot] = (int) arg;
rio_dprintk (RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n",
(int) arg);
}
else {
rio_dprintk (RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n",
(int) arg);
rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n", (int) arg);
} else {
rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n", (int) arg);
return -ENOMEM;
}
return 0;
@ -516,13 +505,11 @@ RIO_DEBUG_CTRL, if (su)
}
rio_spin_lock_irqsave(&PortP->portSem, flags);
if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RESUME) ==
RIO_FAIL) {
if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RESUME) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME failed\n");
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return -EBUSY;
}
else {
} else {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port);
PortP->State |= RIO_BUSY;
}
@ -591,16 +578,14 @@ RIO_DEBUG_CTRL, if (su)
**
*/
if (copyout((caddr_t)&p->RIORtaDisCons,(int)arg,
sizeof(uint))==COPYFAIL) {
if (copyout((caddr_t) & p->RIORtaDisCons, (int) arg, sizeof(uint)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
}
return 0;
case RIO_LAST_ERROR:
if (copyout((caddr_t)&p->RIOError, (int)arg,
sizeof(struct Error)) ==COPYFAIL )
if (copyout((caddr_t) & p->RIOError, (int) arg, sizeof(struct Error)) == COPYFAIL)
return -EFAULT;
return 0;
@ -614,22 +599,18 @@ RIO_DEBUG_CTRL, if (su)
#endif
case RIO_GET_MODTYPE:
if ( copyin( (int)arg, (caddr_t)&port,
sizeof(uint)) == COPYFAIL )
{
if (copyin((int) arg, (caddr_t) & port, sizeof(uint)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
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);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -EINVAL;
}
PortP = (p->RIOPortp[port]);
if (!PortP->Mapped)
{
if (!PortP->Mapped) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port);
p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM;
return -EINVAL;
@ -638,8 +619,7 @@ RIO_DEBUG_CTRL, if (su)
** Return module type of port
*/
port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes;
if (copyout((caddr_t)&port, (int)arg,
sizeof(uint)) == COPYFAIL) {
if (copyout((caddr_t) & port, (int) arg, sizeof(uint)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
}
@ -686,14 +666,12 @@ RIO_DEBUG_CTRL, if (su)
rio_dprintk(RIO_DEBUG_CTRL, "EFAULT");
return -EFAULT;
}
if ( PortSetup.From > PortSetup.To ||
PortSetup.To >= RIO_PORTS ) {
if (PortSetup.From > PortSetup.To || PortSetup.To >= RIO_PORTS) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
rio_dprintk(RIO_DEBUG_CTRL, "ENXIO");
return -ENXIO;
}
if ( PortSetup.XpCps > p->RIOConf.MaxXpCps ||
PortSetup.XpCps < p->RIOConf.MinXpCps ) {
if (PortSetup.XpCps > p->RIOConf.MaxXpCps || PortSetup.XpCps < p->RIOConf.MinXpCps) {
p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE;
rio_dprintk(RIO_DEBUG_CTRL, "EINVAL");
return -EINVAL;
@ -734,17 +712,13 @@ RIO_DEBUG_CTRL, if (su)
** Store settings if locking or unlocking port or if the
** port is not locked, when setting the store option.
*/
if (PortP->Mapped &&
((PortSetup.Lock && !PortP->Lock) ||
(!PortP->Lock &&
(PortSetup.Store && !PortP->Store)))) {
if (PortP->Mapped && ((PortSetup.Lock && !PortP->Lock) || (!PortP->Lock && (PortSetup.Store && !PortP->Store)))) {
PortP->StoredTty.iflag = PortP->TtyP->tm.c_iflag;
PortP->StoredTty.oflag = PortP->TtyP->tm.c_oflag;
PortP->StoredTty.cflag = PortP->TtyP->tm.c_cflag;
PortP->StoredTty.lflag = PortP->TtyP->tm.c_lflag;
PortP->StoredTty.line = PortP->TtyP->tm.c_line;
bcopy(PortP->TtyP->tm.c_cc, PortP->StoredTty.cc,
NCC + 5);
bcopy(PortP->TtyP->tm.c_cc, PortP->StoredTty.cc, NCC + 5);
}
PortP->Lock = PortSetup.Lock;
PortP->Store = PortSetup.Store;
@ -753,8 +727,7 @@ RIO_DEBUG_CTRL, if (su)
bcopy(PortSetup.XpOff, PortP->Xprint.XpOff, MAX_XP_CTRL_LEN);
PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn)+
RIOStrlen(PortP->Xprint.XpOff);
PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn) + RIOStrlen(PortP->Xprint.XpOff);
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
#endif
}
@ -775,19 +748,14 @@ RIO_DEBUG_CTRL, if (su)
}
port = PortSetup.To = PortSetup.From;
PortSetup.IxAny = (p->RIOPortp[port]->Config & RIO_IXANY) ?
1 : 0;
PortSetup.IxOn = (p->RIOPortp[port]->Config & RIO_IXON) ?
1 : 0;
PortSetup.Drain = (p->RIOPortp[port]->Config & RIO_WAITDRAIN) ?
1 : 0;
PortSetup.IxAny = (p->RIOPortp[port]->Config & RIO_IXANY) ? 1 : 0;
PortSetup.IxOn = (p->RIOPortp[port]->Config & RIO_IXON) ? 1 : 0;
PortSetup.Drain = (p->RIOPortp[port]->Config & RIO_WAITDRAIN) ? 1 : 0;
PortSetup.Store = p->RIOPortp[port]->Store;
PortSetup.Lock = p->RIOPortp[port]->Lock;
PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps;
bcopy(p->RIOPortp[port]->Xprint.XpOn, PortSetup.XpOn,
MAX_XP_CTRL_LEN);
bcopy(p->RIOPortp[port]->Xprint.XpOff, PortSetup.XpOff,
MAX_XP_CTRL_LEN);
bcopy(p->RIOPortp[port]->Xprint.XpOn, PortSetup.XpOn, MAX_XP_CTRL_LEN);
bcopy(p->RIOPortp[port]->Xprint.XpOff, PortSetup.XpOff, MAX_XP_CTRL_LEN);
PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
@ -800,8 +768,7 @@ RIO_DEBUG_CTRL, if (su)
case RIO_GET_PORT_PARAMS:
rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n");
if (copyin( (int)arg, (caddr_t)&PortParams,
sizeof(struct PortParams)) == COPYFAIL) {
if (copyin((int) arg, (caddr_t) & PortParams, sizeof(struct PortParams)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
@ -814,8 +781,7 @@ RIO_DEBUG_CTRL, if (su)
PortParams.State = PortP->State;
rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port);
if (copyout((caddr_t)&PortParams, (int)arg,
sizeof(struct PortParams)) == COPYFAIL ) {
if (copyout((caddr_t) & PortParams, (int) arg, sizeof(struct PortParams)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
}
@ -841,16 +807,14 @@ RIO_DEBUG_CTRL, if (su)
PortTty.Tty.tm.c_cflag = PortP->TtyP->tm.c_cflag;
PortTty.Tty.tm.c_lflag = PortP->TtyP->tm.c_lflag;
#endif
if (copyout((caddr_t)&PortTty, (int)arg,
sizeof(struct PortTty)) == COPYFAIL) {
if (copyout((caddr_t) & PortTty, (int) arg, sizeof(struct PortTty)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
}
return retval;
case RIO_SET_PORT_TTY:
if (copyin((int)arg, (caddr_t)&PortTty,
sizeof(struct PortTty)) == COPYFAIL) {
if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
@ -891,8 +855,7 @@ RIO_DEBUG_CTRL, if (su)
case RIO_GET_PORT_STATS:
rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n");
if ( copyin((int)arg, (caddr_t)&portStats,
sizeof(struct portStats)) == COPYFAIL ) {
if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
@ -907,8 +870,7 @@ RIO_DEBUG_CTRL, if (su)
portStats.opens = PortP->opens;
portStats.closes = PortP->closes;
portStats.ioctls = PortP->ioctls;
if ( copyout((caddr_t)&portStats, (int)arg,
sizeof(struct portStats)) == COPYFAIL ) {
if (copyout((caddr_t) & portStats, (int) arg, sizeof(struct portStats)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
}
@ -933,8 +895,7 @@ RIO_DEBUG_CTRL, if (su)
case RIO_GATHER_PORT_STATS:
rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n");
if ( copyin( (int)arg, (caddr_t)&portStats,
sizeof(struct portStats)) == COPYFAIL ) {
if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
@ -955,8 +916,7 @@ RIO_DEBUG_CTRL, if (su)
rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_LEVELS\n");
for (num = 0; RIODbInf[num].Flag; num++);
rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copy\n", num);
if (copyout((caddr_t)RIODbInf,(int)arg,
sizeof(struct DbInf)*(num+1))==COPYFAIL) {
if (copyout((caddr_t) RIODbInf, (int) arg, sizeof(struct DbInf) * (num + 1)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "ReadLevels Copy failed\n");
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
@ -968,8 +928,7 @@ RIO_DEBUG_CTRL, if (su)
case RIO_READ_CONFIG:
rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n");
if (copyout((caddr_t)&p->RIOConf, (int)arg,
sizeof(struct Conf)) ==COPYFAIL ) {
if (copyout((caddr_t) & p->RIOConf, (int) arg, sizeof(struct Conf)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
}
@ -991,8 +950,7 @@ RIO_DEBUG_CTRL, if (su)
*/
for (Host = 0; Host < p->RIONumHosts; Host++)
if ((p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING)
WWORD(p->RIOHosts[Host].ParmMapP->timer ,
p->RIOConf.Timer);
WWORD(p->RIOHosts[Host].ParmMapP->timer, p->RIOConf.Timer);
return retval;
case RIO_START_POLLER:
@ -1024,31 +982,22 @@ RIO_DEBUG_CTRL, if (su)
}
p->rio_debug = DebugCtrl.Debug;
p->RIODebugWait = DebugCtrl.Wait;
rio_dprintk (RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 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);
rio_dprintk(RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 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.Wait = p->RIODebugWait;
if ( copyout((caddr_t)&DebugCtrl,(int)arg,
sizeof(DebugCtrl)) == COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n",
DebugCtrl.SysPort);
if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort);
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
}
}
}
else if ( DebugCtrl.SysPort >= RIO_PORTS &&
DebugCtrl.SysPort != NO_PORT ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n",
DebugCtrl.SysPort);
} else if (DebugCtrl.SysPort >= RIO_PORTS && 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;
return -ENXIO;
}
else if ( cmd == RIO_SETDEBUG ) {
} else if (cmd == RIO_SETDEBUG) {
if (!su) {
p->RIOError.Error = NOT_SUPER_USER;
return -EPERM;
@ -1056,15 +1005,11 @@ RIO_DEBUG_CTRL, if (su)
rio_spin_lock_irqsave(&PortP->portSem, flags);
p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug;
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SETDEBUG 0x%x\n",
p->RIOPortp[DebugCtrl.SysPort]->Debug);
}
else {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n",
p->RIOPortp[DebugCtrl.SysPort]->Debug);
rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG 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;
if ( copyout((caddr_t)&DebugCtrl,(int)arg,
sizeof(DebugCtrl))==COPYFAIL ) {
if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n");
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
@ -1079,10 +1024,7 @@ RIO_DEBUG_CTRL, if (su)
** textual null terminated string.
*/
rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n");
if ( copyout( (caddr_t)RIOVersid(),
(int)arg,
sizeof(struct rioVersion) ) == COPYFAIL )
{
if (copyout((caddr_t) RIOVersid(), (int) arg, 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;
return -EFAULT;
@ -1118,8 +1060,7 @@ RIO_DEBUG_CTRL, if (su)
** at init time.
*/
rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n");
if (copyout((caddr_t)&p->RIONumHosts, (int)arg,
sizeof(p->RIONumHosts) )==COPYFAIL ) {
if (copyout((caddr_t) & p->RIONumHosts, (int) arg, sizeof(p->RIONumHosts)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n");
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
@ -1140,12 +1081,8 @@ RIO_DEBUG_CTRL, if (su)
p->RIOSystemUp = 0;
for (Host = 0; Host < p->RIONumHosts; Host++) {
(void)RIOBoardTest( p->RIOHosts[Host].PaddrP,
p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type,
p->RIOHosts[Host].Slot );
bzero( (caddr_t)&p->RIOHosts[Host].Flags,
((int)&p->RIOHosts[Host].____end_marker____) -
((int)&p->RIOHosts[Host].Flags) );
(void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, 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;
#if 0
RIOSetupDataStructs(p);
@ -1158,8 +1095,7 @@ RIO_DEBUG_CTRL, if (su)
#ifdef RINGBUFFER_SUPPORT
for (loop = 0; loop < RIO_PORTS; loop++)
if (p->RIOPortp[loop]->TxRingBuffer)
sysfree((void *)p->RIOPortp[loop]->TxRingBuffer,
RIOBufferSize );
sysfree((void *) p->RIOPortp[loop]->TxRingBuffer, RIOBufferSize);
#endif
#if 0
bzero((caddr_t) & p->RIOPortp[0], RIO_PORTS * sizeof(struct Port));
@ -1186,21 +1122,18 @@ RIO_DEBUG_CTRL, if (su)
p->RIOError.Error = NOT_SUPER_USER;
return -EPERM;
}
if ( copyin((int)arg, (caddr_t)&DownLoad,
sizeof(DownLoad) )==COPYFAIL ) {
if (copyin((int) arg, (caddr_t) & DownLoad, sizeof(DownLoad)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
rio_dprintk (RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n",
DownLoad.ProductCode);
rio_dprintk(RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n", DownLoad.ProductCode);
/*
** It is important that the product code is an unsigned object!
*/
if (DownLoad.ProductCode > MAX_PRODUCT) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n",
DownLoad.ProductCode);
rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", DownLoad.ProductCode);
p->RIOError.Error = NO_SUCH_PRODUCT;
return -ENXIO;
}
@ -1219,10 +1152,8 @@ RIO_DEBUG_CTRL, if (su)
{
uint host;
if (copyin((int)arg, (caddr_t)&host,
sizeof(host) ) == COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL,
"RIO_HOST_REQ: Copy in from user space failed\n");
if (copyin((int) arg, (caddr_t) & host, sizeof(host)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
@ -1230,8 +1161,7 @@ RIO_DEBUG_CTRL, if (su)
** Fetch the parmmap
*/
rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n");
if ( copyout( (caddr_t)p->RIOHosts[host].ParmMapP,
(int)arg, sizeof(PARM_MAP) )==COPYFAIL ) {
if (copyout((caddr_t) p->RIOHosts[host].ParmMapP, (int) arg, sizeof(PARM_MAP)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n");
return -EFAULT;
@ -1241,22 +1171,19 @@ RIO_DEBUG_CTRL, if (su)
case RIO_HOST_REQ:
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n");
if (copyin((int)arg, (caddr_t)&HostReq,
sizeof(HostReq) )==COPYFAIL ) {
if (copyin((int) arg, (caddr_t) & HostReq, sizeof(HostReq)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
if (HostReq.HostNum >= p->RIONumHosts) {
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n",
HostReq.HostNum);
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n", HostReq.HostNum);
return -ENXIO;
}
rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum);
if (copyout((caddr_t)&p->RIOHosts[HostReq.HostNum],
(int)HostReq.HostP,sizeof(struct Host) ) == COPYFAIL) {
if (copyout((caddr_t) & p->RIOHosts[HostReq.HostNum], (int) HostReq.HostP, sizeof(struct Host)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n");
return -EFAULT;
@ -1265,16 +1192,14 @@ RIO_DEBUG_CTRL, if (su)
case RIO_HOST_DPRAM:
rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n");
if ( copyin( (int)arg, (caddr_t)&HostDpRam,
sizeof(HostDpRam) )==COPYFAIL ) {
if (copyin((int) arg, (caddr_t) & HostDpRam, sizeof(HostDpRam)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
if (HostDpRam.HostNum >= p->RIONumHosts) {
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n",
HostDpRam.HostNum);
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n", HostDpRam.HostNum);
return -ENXIO;
}
rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum);
@ -1285,16 +1210,12 @@ RIO_DEBUG_CTRL, if (su)
static unsigned char copy[sizeof(struct DpRam)];
for (off = 0; off < sizeof(struct DpRam); off++)
copy[off] = p->RIOHosts[HostDpRam.HostNum].Caddr[off];
if ( copyout( (caddr_t)copy, (int)HostDpRam.DpRamP,
sizeof(struct DpRam) ) == COPYFAIL ) {
if (copyout((caddr_t) copy, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
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;
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
return -EFAULT;
@ -1319,23 +1240,19 @@ RIO_DEBUG_CTRL, if (su)
** (probably for debug reasons)
*/
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n");
if ( copyin((int)arg, (caddr_t)&PortReq,
sizeof(PortReq) )==COPYFAIL ) {
if (copyin((int) arg, (caddr_t) & PortReq, sizeof(PortReq)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
if (PortReq.SysPort >= RIO_PORTS) { /* SysPort is unsigned */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n",
PortReq.SysPort);
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n", PortReq.SysPort);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -ENXIO;
}
rio_dprintk(RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort);
if (copyout((caddr_t)p->RIOPortp[PortReq.SysPort],
(int)PortReq.PortP,
sizeof(struct Port) ) == COPYFAIL) {
if (copyout((caddr_t) p->RIOPortp[PortReq.SysPort], (int) PortReq.PortP, sizeof(struct Port)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n");
return -EFAULT;
@ -1348,37 +1265,31 @@ RIO_DEBUG_CTRL, if (su)
** (probably for debug reasons)
*/
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n");
if (copyin((int)arg, (caddr_t)&RupReq,
sizeof(RupReq) )==COPYFAIL ) {
if (copyin((int) arg, (caddr_t) & RupReq, sizeof(RupReq)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n",
RupReq.HostNum);
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n", RupReq.HostNum);
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
return -ENXIO;
}
if (RupReq.RupNum >= MAX_RUP + LINKS_PER_UNIT) { /* eek! */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n",
RupReq.RupNum);
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n", RupReq.RupNum);
p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
return -EINVAL;
}
HostP = &p->RIOHosts[RupReq.HostNum];
if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n",
RupReq.HostNum);
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n", RupReq.HostNum);
p->RIOError.Error = HOST_NOT_RUNNING;
return -EIO;
}
rio_dprintk (RIO_DEBUG_CTRL, "Request for rup %d from host %d\n",
RupReq.RupNum,RupReq.HostNum);
rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum);
if (copyout((caddr_t)HostP->UnixRups[RupReq.RupNum].RupP,
(int)RupReq.RupP,sizeof(struct RUP) ) == COPYFAIL) {
if (copyout((caddr_t) HostP->UnixRups[RupReq.RupNum].RupP, (int) RupReq.RupP, sizeof(struct RUP)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n");
return -EFAULT;
@ -1391,37 +1302,31 @@ RIO_DEBUG_CTRL, if (su)
** (probably for debug reasons)
*/
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n");
if (copyin((int)arg, (caddr_t)&LpbReq,
sizeof(LpbReq) )==COPYFAIL ) {
if (copyin((int) arg, (caddr_t) & LpbReq, sizeof(LpbReq)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n");
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
if (LpbReq.Host >= p->RIONumHosts) { /* host is unsigned */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n",
LpbReq.Host);
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n", LpbReq.Host);
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
return -ENXIO;
}
if (LpbReq.Link >= LINKS_PER_UNIT) { /* eek! */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n",
LpbReq.Link);
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n", LpbReq.Link);
p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE;
return -EINVAL;
}
HostP = &p->RIOHosts[LpbReq.Host];
if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n",
LpbReq.Host );
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n", LpbReq.Host);
p->RIOError.Error = HOST_NOT_RUNNING;
return -EIO;
}
rio_dprintk (RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n",
LpbReq.Link, LpbReq.Host);
rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host);
if (copyout((caddr_t)&HostP->LinkStrP[LpbReq.Link],
(int)LpbReq.LpbP,sizeof(struct LPB) ) == COPYFAIL) {
if (copyout((caddr_t) & HostP->LinkStrP[LpbReq.Link], (int) LpbReq.LpbP, sizeof(struct LPB)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n");
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
@ -1501,8 +1406,7 @@ RIO_DEBUG_CTRL, if (su)
return -EINVAL;
}
rio_spin_lock_irqsave(&PortP->portSem, flags);
switch( cmd )
{
switch (cmd) {
case RIO_MAP_B50_TO_50:
p->RIOPortp[port]->Config |= RIO_MAP_50_TO_50;
break;
@ -1525,8 +1429,7 @@ RIO_DEBUG_CTRL, if (su)
case RIO_SEND_PACKET:
rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n");
if ( copyin( (int)arg, (caddr_t)&SendPack,
sizeof(SendPack) )==COPYFAIL ) {
if (copyin((int) arg, (caddr_t) & SendPack, sizeof(SendPack)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n");
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
@ -1570,8 +1473,7 @@ RIO_DEBUG_CTRL, if (su)
return su ? 0 : -EPERM;
case RIO_WHAT_MESG:
if ( copyout( (caddr_t)&p->RIONoMessage, (int)arg,
sizeof(p->RIONoMessage) )==COPYFAIL ) {
if (copyout((caddr_t) & p->RIONoMessage, (int) arg, sizeof(p->RIONoMessage)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n");
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
@ -1579,13 +1481,11 @@ RIO_DEBUG_CTRL, if (su)
return 0;
case RIO_MEM_DUMP:
if (copyin((int)arg, (caddr_t)&SubCmd,
sizeof(struct SubCmdStruct)) == COPYFAIL) {
if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n",
SubCmd.Host, SubCmd.Rup, SubCmd.Addr);
rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Addr);
if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) {
p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
@ -1597,8 +1497,7 @@ RIO_DEBUG_CTRL, if (su)
return -EINVAL;
}
port = p->RIOHosts[SubCmd.Host].
UnixRups[SubCmd.Rup].BaseSysPort;
port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort;
PortP = p->RIOPortp[port];
@ -1608,13 +1507,11 @@ RIO_DEBUG_CTRL, if (su)
rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n");
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return -EBUSY;
}
else
} else
PortP->State |= RIO_BUSY;
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if ( copyout( (caddr_t)p->RIOMemDump, (int)arg,
MEMDUMP_SIZE) == COPYFAIL ) {
if (copyout((caddr_t) p->RIOMemDump, (int) arg, MEMDUMP_SIZE) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n");
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
@ -1638,25 +1535,21 @@ RIO_DEBUG_CTRL, if (su)
case RIO_READ_CHECK:
/* Check reads for pkts with data[0] the same */
p->RIOReadCheck = !p->RIOReadCheck;
if (copyout((caddr_t)&p->RIOReadCheck,(int)arg,
sizeof(uint))== COPYFAIL) {
if (copyout((caddr_t) & p->RIOReadCheck, (int) arg, sizeof(uint)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
}
return 0;
case RIO_READ_REGISTER:
if (copyin((int)arg, (caddr_t)&SubCmd,
sizeof(struct SubCmdStruct)) == COPYFAIL) {
if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
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);
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);
if (SubCmd.Port > 511) {
rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n",
SubCmd.Port);
rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", SubCmd.Port);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return -EINVAL;
}
@ -1671,8 +1564,7 @@ RIO_DEBUG_CTRL, if (su)
return -EINVAL;
}
port = p->RIOHosts[SubCmd.Host].
UnixRups[SubCmd.Rup].BaseSysPort + SubCmd.Port;
port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort + SubCmd.Port;
PortP = p->RIOPortp[port];
rio_spin_lock_irqsave(&PortP->portSem, flags);
@ -1681,13 +1573,11 @@ RIO_DEBUG_CTRL, if (su)
rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n");
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return -EBUSY;
}
else
} else
PortP->State |= RIO_BUSY;
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if (copyout((caddr_t)&p->CdRegister, (int)arg,
sizeof(uint)) == COPYFAIL ) {
if (copyout((caddr_t) & p->CdRegister, (int) arg, sizeof(uint)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n");
p->RIOError.Error = COPYOUT_FAILED;
return -EFAULT;
@ -1735,8 +1625,7 @@ RIO_DEBUG_CTRL, if (su)
if (RIO_ISMODEM(dv)) {
rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino);
arg = (caddr_t) (mino | RIO_DEV_MODEM);
}
else {
} else {
rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino);
arg = (caddr_t) (mino | RIO_DEV_DIRECT);
}
@ -1753,8 +1642,7 @@ RIO_DEBUG_CTRL, if (su)
/*
** Pre-emptive commands go on RUPs and are only one byte long.
*/
int
RIOPreemptiveCmd(p, PortP, Cmd)
int RIOPreemptiveCmd(p, PortP, Cmd)
struct rio_info *p;
struct Port *PortP;
uchar Cmd;
@ -1775,13 +1663,11 @@ uchar Cmd;
}
if (((int) ((char) PortP->InUse) == -1) || !(CmdBlkP = RIOGetCmdBlk())) {
rio_dprintk (RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n",
Cmd, PortP->PortNum);
rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", Cmd, PortP->PortNum);
return RIO_FAIL;
}
rio_dprintk (RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n",
(int)CmdBlkP,PortP->InUse);
rio_dprintk(RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n", (int) CmdBlkP, PortP->InUse);
PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0];
@ -1807,8 +1693,7 @@ uchar Cmd;
switch (Cmd) {
case MEMDUMP:
rio_dprintk (RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n",
(int)CmdBlkP, (int)SubCmd.Addr);
rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n", (int) CmdBlkP, (int) SubCmd.Addr);
PktCmdP->SubCommand = MEMDUMP;
PktCmdP->SubAddr = SubCmd.Addr;
break;
@ -1816,8 +1701,7 @@ uchar Cmd;
rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%x\n", (int) CmdBlkP);
break;
case READ_REGISTER:
rio_dprintk (RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n",
(int)SubCmd.Addr, (int)CmdBlkP);
rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n", (int) SubCmd.Addr, (int) CmdBlkP);
PktCmdP->SubCommand = READ_REGISTER;
PktCmdP->SubAddr = SubCmd.Addr;
break;
@ -1854,8 +1738,7 @@ uchar Cmd;
RIOFreeCmdBlk(CmdBlkP);
return (RIO_FAIL);
} else {
rio_dprintk (RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n",
(int)CmdBlkP);
rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n", (int) CmdBlkP);
CmdBlkP->PostFuncP = RIOWFlushMark;
}
break;

View File

@ -101,8 +101,7 @@ static char *firstchars (char *p, int nch)
#define INCR( P, I ) ((P) = (((P)+(I)) & p->RIOBufferMask))
/* Enable and start the transmission of packets */
void
RIOTxEnable(en)
void RIOTxEnable(en)
char *en;
{
struct Port *PortP;
@ -117,10 +116,10 @@ char * en;
tty = PortP->gs.tty;
rio_dprintk (RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n",
PortP->PortNum, PortP->gs.xmit_cnt);
rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", 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
@ -133,26 +132,25 @@ char * en;
while (can_add_transmit(&PacketP, PortP)) {
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 */
if (c > SERIAL_XMIT_SIZE - PortP->gs.xmit_tail)
c = SERIAL_XMIT_SIZE - PortP->gs.xmit_tail;
{ int t;
{
int t;
t = (c > 10) ? 10 : c;
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));
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));
}
/* If for one reason or another, we can't copy more data,
we're done! */
if (c == 0) break;
if (c == 0)
break;
rio_memcpy_toio (PortP->HostP->Caddr, (caddr_t)PacketP->data,
PortP->gs.xmit_buf + PortP->gs.xmit_tail, c);
rio_memcpy_toio(PortP->HostP->Caddr, (caddr_t) PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c);
/* udelay (1); */
writeb(c, &(PacketP->len));
@ -171,14 +169,10 @@ char * en;
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
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)....",
(int)(PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)),
PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
PortP->gs.tty->ldisc.write_wakeup)
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);
if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && 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);
rio_dprintk(RIO_DEBUG_INTR, "(%d/%d)\n", PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
wake_up_interruptible(&PortP->gs.tty->write_wait);
}
@ -192,8 +186,7 @@ char * en;
static int RupIntr;
static int RxIntr;
static int TxIntr;
void
RIOServiceHost(p, HostP, From)
void RIOServiceHost(p, HostP, From)
struct rio_info *p;
struct Host *HostP;
int From;
@ -231,8 +224,7 @@ int From;
** hanging on its receive queue and stuff them on the free
** list; check for commands on the way.
*/
for ( port=p->RIOFirstPortsBooted;
port<p->RIOLastPortsBooted+PORTS_PER_RTA; port++ ) {
for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
struct Port *PortP = p->RIOPortp[port];
struct tty_struct *ttyP;
struct PKT *PacketP;
@ -285,15 +277,13 @@ int From;
** it's handshake bit is set, then we must clear the handshake,
** so that that downstream RTA is re-enabled.
*/
if ( !can_remove_receive( &PacketP, PortP ) &&
( RWORD( PortP->PhbP->handshake )==PHB_HANDSHAKE_SET ) ) {
if (!can_remove_receive(&PacketP, PortP) && (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET)) {
/*
** MAGIC! ( Basically, handshake the RX buffer, so that
** the RTAs upstream can be re-enabled. )
*/
rio_dprintk(RIO_DEBUG_INTR, "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(&PortP->portSem);
}
@ -313,8 +303,7 @@ int From;
** If the port is mapped into the system ( i.e. has /dev/ttyXXXX
** associated ) then it is worth checking.
*/
for ( port=p->RIOFirstPortsBooted;
port<p->RIOLastPortsBooted+PORTS_PER_RTA; port++ ) {
for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
struct Port *PortP = p->RIOPortp[port];
struct tty_struct *ttyP;
struct PKT *PacketP;
@ -427,10 +416,7 @@ int From;
PortP->InUse = NOT_INUSE;
rio_spin_unlock(&PortP->portSem);
if ( RIOParam(PortP, OPEN, ((PortP->Cor2Copy &
(COR2_RTSFLOW|COR2_CTSFLOW ) )==
(COR2_RTSFLOW|COR2_CTSFLOW ) ) ?
TRUE : FALSE, DONT_SLEEP ) == RIO_FAIL ) {
if (RIOParam(PortP, OPEN, ((PortP->Cor2Copy & (COR2_RTSFLOW | COR2_CTSFLOW)) == (COR2_RTSFLOW | COR2_CTSFLOW)) ? TRUE : FALSE, DONT_SLEEP) == RIO_FAIL) {
continue; /* with next port */
}
rio_spin_lock(&PortP->portSem);
@ -449,9 +435,7 @@ int From;
rio_dprintk(RIO_DEBUG_INTR, "FAILS - PORT IS IN USE\n");
}
while ( PortP->WflushFlag &&
can_add_transmit( &PacketP, PortP ) &&
( PortP->InUse == NOT_INUSE ) ) {
while (PortP->WflushFlag && can_add_transmit(&PacketP, PortP) && (PortP->InUse == NOT_INUSE)) {
int p;
struct PktCmd *PktCmdP;
@ -510,14 +494,12 @@ int From;
PortP->MagicFlags &= ~MAGIC_FLUSH;
}
rio_dprintk (RIO_DEBUG_INTR, "Wflush count now stands at %d\n",
PortP->WflushFlag);
rio_dprintk(RIO_DEBUG_INTR, "Wflush count now stands at %d\n", PortP->WflushFlag);
}
if (PortP->MagicFlags & MORE_OUTPUT_EYGOR) {
if (PortP->MagicFlags & MAGIC_FLUSH) {
PortP->MagicFlags |= MORE_OUTPUT_EYGOR;
}
else {
} else {
if (!can_add_transmit(&PacketP, PortP)) {
rio_spin_unlock(&PortP->portSem);
continue;
@ -551,8 +533,7 @@ int From;
** NB: Called with the tty locked. The spl from the lockb( ) is passed.
** we return the ttySpl level that we re-locked at.
*/
static void
RIOReceive(p, PortP)
static void RIOReceive(p, PortP)
struct rio_info *p;
struct Port *PortP;
{
@ -597,16 +578,12 @@ struct Port * PortP;
return;
}
if ( PortP->State & RIO_DELETED )
{
while ( can_remove_receive( &PacketP, PortP ) )
{
if (PortP->State & RIO_DELETED) {
while (can_remove_receive(&PacketP, PortP)) {
remove_receive(PortP);
put_free_end(PortP->HostP, PacketP);
}
}
else
{
} else {
/*
** loop, just so long as:
** i ) there's some data ( i.e. can_remove_receive )
@ -616,8 +593,7 @@ struct Port * PortP;
*/
transCount = 1;
while (can_remove_receive(&PacketP, PortP)
&& transCount)
{
&& transCount) {
#ifdef STATS
PortP->Stat.RxIntCnt++;
#endif /* STATS */
@ -660,8 +636,7 @@ struct Port * PortP;
*/
transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK);
rio_dprintk (RIO_DEBUG_REC, "port %d: Copy %d bytes\n",
PortP->PortNum, transCount);
rio_dprintk(RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount);
/*
** To use the following 'kkprintfs' for debugging - change the '#undef'
** to '#define', (this is the only place ___DEBUG_IT___ occurs in the
@ -669,13 +644,7 @@ struct Port * PortP;
*/
#undef ___DEBUG_IT___
#ifdef ___DEBUG_IT___
kkprintf("I:%d R:%d P:%d Q:%d C:%d F:%x ",
intCount,
RxIntCnt,
PortP->PortNum,
TtyP->rxqueue.count,
transCount,
TtyP->flags );
kkprintf("I:%d R:%d P:%d Q:%d C:%d F:%x ", intCount, RxIntCnt, PortP->PortNum, TtyP->rxqueue.count, transCount, TtyP->flags);
#endif
ptr = (uchar *) PacketP->data + PortP->RxDataStart;
@ -696,8 +665,7 @@ struct Port * PortP;
kkprintf("T:%d L:%d\n", DataCnt, PacketP->len);
#endif
if ( PacketP->len == 0 )
{
if (PacketP->len == 0) {
/*
** If we have emptied the packet, then we can
** free it, and reset the start pointer for
@ -728,8 +696,7 @@ struct Port * PortP;
** 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.
*/
int
riotproc(p, tp, cmd, port)
int riotproc(p, tp, cmd, port)
struct rio_info *p;
register struct ttystatics *tp;
int cmd;
@ -747,10 +714,8 @@ int port;
}
PortP = p->RIOPortp[SysPort];
if ((uint)PortP->PhbP < (uint)PortP->Caddr ||
(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);
if ((uint) PortP->PhbP < (uint) PortP->Caddr || (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, " PortP = 0x%x\n", PortP);
rio_dprintk(RIO_DEBUG_INTR, " PortP->PhbP = 0x%x\n", PortP->PhbP);
rio_dprintk(RIO_DEBUG_INTR, " PortP->Caddr = 0x%x\n", PortP->PhbP);
@ -778,20 +743,17 @@ int port;
*/
if (PortP->State & RIO_DELETED) {
rio_dprintk(RIO_DEBUG_INTR, "WFLUSH on deleted RTA\n");
}
else {
} else {
if (RIOPreemptiveCmd(p, PortP, WFLUSH) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command failed\n");
}
else
} else
rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command\n");
}
/*
** WFLUSH operation - flush the data!
*/
PortP->TxBufferIn = PortP->TxBufferOut = 0;
}
else {
} else {
rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command ignored\n");
}
/*
@ -808,8 +770,7 @@ int port;
*/
if (PortP->State & RIO_DELETED) {
rio_dprintk(RIO_DEBUG_INTR, "RESUME on deleted RTA\n");
}
else {
} else {
if (RIOPreemptiveCmd(p, PortP, RESUME) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_INTR, "T_RESUME Command failed\n");
}
@ -850,8 +811,7 @@ start:
*/
if (PortP->State & RIO_DELETED) {
rio_dprintk(RIO_DEBUG_INTR, "SUSPEND deleted RTA\n");
}
else {
} else {
if (RIOPreemptiveCmd(p, PortP, SUSPEND) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND Command failed\n");
}
@ -870,8 +830,7 @@ start:
if (PortP->State & RIO_DELETED) {
rio_dprintk(RIO_DEBUG_INTR, "RFLUSH on deleted RTA\n");
PortP->RxDataStart = 0;
}
else {
} else {
if (RIOPreemptiveCmd(p, PortP, RFLUSH) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH Command failed\n");
return 0;
@ -912,10 +871,8 @@ start:
*/
if (PortP->State & RIO_DELETED) {
rio_dprintk(RIO_DEBUG_INTR, "BREAK on deleted RTA\n");
}
else {
if (RIOShortCommand(PortP,SBREAK,2,
p->RIOConf.BreakInterval)==RIO_FAIL) {
} else {
if (RIOShortCommand(PortP, SBREAK, 2, p->RIOConf.BreakInterval) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
}
}

View File

@ -157,8 +157,7 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3";
** NB. for MPX
** tty lock must NOT have been previously acquired.
*/
int
RIOParam(PortP, cmd, Modem, SleepFlag)
int RIOParam(PortP, cmd, Modem, SleepFlag)
struct Port *PortP;
int cmd;
int Modem;
@ -179,8 +178,7 @@ int SleepFlag;
TtyP = PortP->gs.tty;
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);
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);
if (!TtyP) {
rio_dprintk(RIO_DEBUG_PARAM, "Can't call rioparam with null tty.\n");
@ -207,8 +205,7 @@ int SleepFlag;
for (i = 0; i < NCC + 5; i++)
PortP->StoredTty.cc[i] = TtyP->tm.c_cc[i];
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");
TtyP->tm.c_iflag = PortP->StoredTty.iflag;
TtyP->tm.c_oflag = PortP->StoredTty.oflag;
@ -224,8 +221,7 @@ int SleepFlag;
/*
** wait for space
*/
while ( !(res=can_add_transmit(&PacketP,PortP)) ||
(PortP->InUse != NOT_INUSE) ) {
while (!(res = can_add_transmit(&PacketP, PortP)) || (PortP->InUse != NOT_INUSE)) {
if (retries-- <= 0) {
break;
}
@ -317,8 +313,7 @@ int SleepFlag;
if (TtyP->termios->c_cflag & CSTOPB) {
rio_dprintk(RIO_DEBUG_PARAM, "2 stop bits\n");
Cor1 |= COR1_2STOP;
}
else {
} else {
rio_dprintk(RIO_DEBUG_PARAM, "1 stop bit\n");
Cor1 |= COR1_1STOP;
}
@ -326,16 +321,14 @@ int SleepFlag;
if (TtyP->termios->c_cflag & PARENB) {
rio_dprintk(RIO_DEBUG_PARAM, "Enable parity\n");
Cor1 |= COR1_NORMAL;
}
else {
} else {
rio_dprintk(RIO_DEBUG_PARAM, "Disable parity\n");
Cor1 |= COR1_NOP;
}
if (TtyP->termios->c_cflag & PARODD) {
rio_dprintk(RIO_DEBUG_PARAM, "Odd parity\n");
Cor1 |= COR1_ODD;
}
else {
} else {
rio_dprintk(RIO_DEBUG_PARAM, "Even parity\n");
Cor1 |= COR1_EVEN;
}
@ -346,13 +339,11 @@ int SleepFlag;
if (TtyP->termios->c_iflag & IXON) {
rio_dprintk(RIO_DEBUG_PARAM, "Enable start/stop output control\n");
Cor2 |= COR2_IXON;
}
else {
} else {
if (PortP->Config & RIO_IXON) {
rio_dprintk(RIO_DEBUG_PARAM, "Force enable start/stop output control\n");
Cor2 |= COR2_IXON;
}
else
} else
rio_dprintk(RIO_DEBUG_PARAM, "IXON has been disabled.\n");
}
@ -360,8 +351,7 @@ int SleepFlag;
if (PortP->Config & RIO_IXANY) {
rio_dprintk(RIO_DEBUG_PARAM, "Enable any key to restart output\n");
Cor2 |= COR2_IXANY;
}
else
} else
rio_dprintk(RIO_DEBUG_PARAM, "IXANY has been disabled due to sanity reasons.\n");
}
@ -388,8 +378,7 @@ int SleepFlag;
if (TtyP->termios->c_cflag & CLOCAL) {
rio_dprintk(RIO_DEBUG_PARAM, "Local line\n");
}
else {
} else {
rio_dprintk(RIO_DEBUG_PARAM, "Possible Modem line\n");
}
@ -493,13 +482,26 @@ int SleepFlag;
/*
** Baud rate bytes
*/
rio_dprintk (RIO_DEBUG_PARAM, "Mapping of rx/tx baud %x (%x)\n",
TtyP->termios->c_cflag, CBAUD);
rio_dprintk(RIO_DEBUG_PARAM, "Mapping of rx/tx baud %x (%x)\n", TtyP->termios->c_cflag, CBAUD);
switch (TtyP->termios->c_cflag & CBAUD) {
#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(1800);e(2400);e(4800);e(9600);e(19200);e(38400);e(57600);
e(50);
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); */
}
@ -638,8 +640,7 @@ int SleepFlag;
** 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.
*/
int
can_add_transmit(PktP, PortP)
int can_add_transmit(PktP, PortP)
PKT **PktP;
struct Port *PortP;
{
@ -655,16 +656,14 @@ struct Port *PortP;
** 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.
*/
void
add_transmit(PortP)
void add_transmit(PortP)
struct Port *PortP;
{
if (RWORD(*PortP->TxAdd) & PKT_IN_USE) {
rio_dprintk(RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!");
}
WWORD(*(ushort *) PortP->TxAdd, RWORD(*PortP->TxAdd) | PKT_IN_USE);
PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart :
PortP->TxAdd + 1;
PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : PortP->TxAdd + 1;
WWORD(PortP->PhbP->tx_add, RIO_OFF(PortP->Caddr, PortP->TxAdd));
}
@ -672,8 +671,7 @@ struct Port *PortP;
* Put a packet onto the end of the
* free list
****************************************/
void
put_free_end(HostP, PktP)
void put_free_end(HostP, PktP)
struct Host *HostP;
PKT *PktP;
{
@ -697,8 +695,7 @@ PKT *PktP;
WWORD(((FREE_LIST *) PktP)->prev, old_end);
WWORD(((FREE_LIST *) PktP)->next, TPNULL);
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");
WWORD(HostP->ParmMapP->free_list_end, RIO_OFF(HostP->Caddr, PktP));
tmp_pointer = (FREE_LIST *) PktP;
@ -715,14 +712,12 @@ PKT *PktP;
** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear,
** then can_remove_receive() returns 0.
*/
int
can_remove_receive(PktP, PortP)
int can_remove_receive(PktP, PortP)
PKT **PktP;
struct Port *PortP;
{
if (RWORD(*PortP->RxRemove) & PKT_IN_USE) {
*PktP = (PKT *)RIO_PTR(PortP->Caddr,
RWORD(*PortP->RxRemove) & ~PKT_IN_USE);
*PktP = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->RxRemove) & ~PKT_IN_USE);
return 1;
}
return 0;
@ -733,12 +728,10 @@ struct Port *PortP;
** and then bump the pointers. Once the pointers get to the end, they must
** be wrapped back to the start.
*/
void
remove_receive(PortP)
void remove_receive(PortP)
struct Port *PortP;
{
WWORD(*PortP->RxRemove, RWORD(*PortP->RxRemove) & ~PKT_IN_USE);
PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart :
PortP->RxRemove + 1;
PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : PortP->RxRemove + 1;
WWORD(PortP->PhbP->rx_remove, RIO_OFF(PortP->Caddr, PortP->RxRemove));
}

View File

@ -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?
*/
if ( RBYTE(PktCmdP->Command) == ROUTE_TOPOLOGY )
{
if (RBYTE(PktCmdP->Command) == ROUTE_TOPOLOGY) {
MapP = HostP->Mapping;
/*
@ -135,16 +134,13 @@ 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
** Topology array for the unit.
*/
if ( Rup >= (ushort)MAX_RUP )
{
if (Rup >= (ushort) MAX_RUP) {
ThisUnit = HOST_ID;
TopP = HostP->Topology;
MyType = "Host";
MyName = HostP->Name;
ThisLinkMin = ThisLinkMax = Rup - MAX_RUP;
}
else
{
} else {
ThisUnit = Rup + 1;
TopP = HostP->Mapping[Rup].Topology;
MyType = "RTA";
@ -159,8 +155,7 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
** place, then ignore this packet completely.
*/
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
** and no-IDs. (or at least, it doesn't *matter* if it does)
@ -168,38 +163,27 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
if (RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) > (ushort) MAX_RUP)
continue;
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)) )
{
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))) {
Lies++;
}
}
}
if ( Lies )
{
if (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",
RBYTE(PktCmdP->RouteTopology[0].Unit),
'A' + RBYTE(PktCmdP->RouteTopology[0].Link),
RBYTE(PktCmdP->RouteTopology[1].Unit),
'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));
'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));
return TRUE;
}
/*
** now, process each link.
*/
for ( ThisLink=ThisLinkMin; ThisLink <= ThisLinkMax; ThisLink++)
{
for (ThisLink = ThisLinkMin; ThisLink <= ThisLinkMax; ThisLink++) {
/*
** this is what it was connected to
*/
@ -212,25 +196,14 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
NewUnit = RBYTE(PktCmdP->RouteTopology[ThisLink].Unit);
NewLink = RBYTE(PktCmdP->RouteTopology[ThisLink].Link);
if ( OldUnit != NewUnit || OldLink != NewLink )
{
if (OldUnit != NewUnit || OldLink != NewLink) {
/*
** something has changed!
*/
if ( NewUnit > MAX_RUP &&
NewUnit != ROUTE_DISCONNECT &&
NewUnit != ROUTE_NO_ID &&
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
{
if (NewUnit > MAX_RUP && NewUnit != ROUTE_DISCONNECT && NewUnit != ROUTE_NO_ID && 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
*/
@ -239,8 +212,7 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
RIOSetChange(p);
if ( OldUnit <= MAX_RUP )
{
if (OldUnit <= MAX_RUP) {
/*
** If something has become bust, then re-enable them messages
*/
@ -252,11 +224,9 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
RIOConCon(p, HostP, ThisUnit, ThisLink, NewUnit, NewLink, CONNECT);
if (NewUnit == ROUTE_NO_ID)
rio_dprintk (RIO_DEBUG_ROUTE, "%s %s (%c) is connected to an unconfigured unit.\n",
MyType,MyName,'A'+ThisLink);
rio_dprintk(RIO_DEBUG_ROUTE, "%s %s (%c) is connected to an unconfigured unit.\n", MyType, MyName, 'A' + ThisLink);
if ( NewUnit == ROUTE_INTERCONNECT )
{
if (NewUnit == ROUTE_INTERCONNECT) {
if (!p->RIONoMessage)
cprintf("%s '%s' (%c) is connected to another network.\n", MyType, MyName, 'A' + ThisLink);
}
@ -266,49 +236,29 @@ 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
** at us!
*/
if ( OldUnit == HOST_ID )
{
if ( HostP->Topology[OldLink].Unit == ThisUnit &&
HostP->Topology[OldLink].Link == ThisLink )
{
if (OldUnit == HOST_ID) {
if (HostP->Topology[OldLink].Unit == ThisUnit && 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].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
{
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');
} 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 {
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');
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].Link = ThisLink;
}
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');
} 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;
HostP->Mapping[NewUnit - 1].Topology[NewLink].Link = ThisLink;
}
@ -323,17 +273,12 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
/*
** The only other command we recognise is a route_request command
*/
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);
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);
return TRUE;
}
RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) +
(RBYTE(PktCmdP->UniqNum[1]) << 8) +
(RBYTE(PktCmdP->UniqNum[2]) << 16) +
(RBYTE(PktCmdP->UniqNum[3]) << 24);
RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + (RBYTE(PktCmdP->UniqNum[1]) << 8) + (RBYTE(PktCmdP->UniqNum[2]) << 16) + (RBYTE(PktCmdP->UniqNum[3]) << 24);
/*
** Determine if 8 or 16 port RTA
@ -344,33 +289,26 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
Mod = RBYTE(PktCmdP->ModuleTypes);
Mod1 = LONYBLE(Mod);
if (RtaType == TYPE_RTA16)
{
if (RtaType == TYPE_RTA16) {
/*
** 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.
*/
Mod2 = Mod1;
rio_dprintk (RIO_DEBUG_ROUTE, "Backplane type is %s (all ports)\n",
p->RIOModuleTypes[Mod1].Name);
}
else
{
rio_dprintk(RIO_DEBUG_ROUTE, "Backplane type is %s (all ports)\n", p->RIOModuleTypes[Mod1].Name);
} else {
Mod2 = HINYBLE(Mod);
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);
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);
}
if ( RtaUniq == 0xffffffff )
{
if (RtaUniq == 0xffffffff) {
ShowPacket(DBG_SPECIAL, PacketP);
}
/*
** 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");
return 0;
}
@ -386,10 +324,8 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL;
PktReplyP = (struct PktCmd_M *) CmdBlkP->Packet.data;
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);
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);
PktReplyP->Command = ROUTE_FOAD;
HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
@ -399,42 +335,27 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
/*
** 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",
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.
*/
if ( (HostP->Mapping[ThisUnit].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) &&
(HostP->Mapping[ThisUnit].RtaUniqueNum == RtaUniq) )
{
if (RtaType == TYPE_RTA16)
{
if ((HostP->Mapping[ThisUnit].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) && (HostP->Mapping[ThisUnit].RtaUniqueNum == RtaUniq)) {
if (RtaType == TYPE_RTA16) {
ThisUnit2 = HostP->Mapping[ThisUnit].ID2 - 1;
rio_dprintk (RIO_DEBUG_ROUTE, "Found unit 0x%x at slots %d+%d\n",
RtaUniq,ThisUnit,ThisUnit2);
}
else
rio_dprintk (RIO_DEBUG_ROUTE, "Found unit 0x%x at slot %d\n",
RtaUniq,ThisUnit);
rio_dprintk(RIO_DEBUG_ROUTE, "Found unit 0x%x at slots %d+%d\n", RtaUniq, ThisUnit, ThisUnit2);
} 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
** been re-booted, and so we must kill the RTA, so that it
** will be booted again (potentially with new bins)
** and it will then re-ask for an ID, which we will service.
*/
if ( (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) &&
!(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED) )
{
if ( !(HostP->Mapping[ThisUnit].Flags & MSG_DONE) )
{
if ((HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && !(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED)) {
if (!(HostP->Mapping[ThisUnit].Flags & MSG_DONE)) {
if (!p->RIONoMessage)
cprintf("RTA '%s' is being updated.\n", HostP->Mapping[ThisUnit].Name);
HostP->Mapping[ThisUnit].Flags |= MSG_DONE;
@ -453,8 +374,7 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
*/
PktReplyP->Command = ROUTE_ALLOCATE;
PktReplyP->IDNum = ThisUnit + 1;
if (RtaType == TYPE_RTA16)
{
if (RtaType == TYPE_RTA16) {
if (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE)
/*
** Adjust the phb and tx pkt dest_units for 2nd block of 8
@ -462,14 +382,10 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
*/
RIOFixPhbs(p, HostP, ThisUnit2);
PktReplyP->IDNum2 = ThisUnit2 + 1;
rio_dprintk (RIO_DEBUG_ROUTE, "RTA '%s' has been allocated IDs %d+%d\n",
HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum, PktReplyP->IDNum2);
}
else
{
rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated IDs %d+%d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum, PktReplyP->IDNum2);
} else {
PktReplyP->IDNum2 = ROUTE_NO_ID;
rio_dprintk (RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n",
HostP->Mapping[ThisUnit].Name,PktReplyP->IDNum);
rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum);
}
HostP->Copy("RT_ALLOCAT", PktReplyP->CommandText, 10);
@ -480,32 +396,25 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
** the ports, if any where open, so that data may once more
** flow around the system!
*/
if ( (HostP->Mapping[ThisUnit].Flags & RTA_NEWBOOT) &&
(HostP->Mapping[ThisUnit].SysPort != NO_PORT) )
{
if ((HostP->Mapping[ThisUnit].Flags & RTA_NEWBOOT) && (HostP->Mapping[ThisUnit].SysPort != NO_PORT)) {
/*
** look at the ports associated with this beast and
** see if any where open. If they was, then re-open
** 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];
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_spin_lock_irqsave(&PortP->portSem, flags);
PortP->MagicFlags |= MAGIC_REBOOT;
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
}
}
if (RtaType == TYPE_RTA16)
{
for ( port=0; port<PORTS_PER_RTA; port++ )
{
if (RtaType == TYPE_RTA16) {
for (port = 0; port < PORTS_PER_RTA; port++) {
PortP = p->RIOPortp[port + HostP->Mapping[ThisUnit2].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_spin_lock_irqsave(&PortP->portSem, flags);
PortP->MagicFlags |= MAGIC_REBOOT;
@ -527,20 +436,15 @@ 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
** relevant ports.
*/
if ( HostP->Mapping[ThisUnit].SysPort != NO_PORT )
{
for ( port=0; port<PORTS_PER_MODULE; port++ )
{
if (HostP->Mapping[ThisUnit].SysPort != NO_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 |= 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)
{
for ( port=0; port<PORTS_PER_MODULE; port++ )
{
if (RtaType == TYPE_RTA16) {
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 + PORTS_PER_MODULE + HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK;
@ -565,8 +469,7 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
for (ThisUnit = 0; ThisUnit < HostP->NumExtraBooted; ThisUnit++)
if (HostP->ExtraUnits[ThisUnit] == RtaUniq)
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
** we reset the unit, because we didn't boot it.
@ -579,8 +482,7 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
*/
static int UnknownMesgDone = 0;
if ( !UnknownMesgDone )
{
if (!UnknownMesgDone) {
if (!p->RIONoMessage)
cprintf("One or more unknown RTAs are being updated.\n");
UnknownMesgDone = 1;
@ -588,27 +490,20 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
PktReplyP->Command = ROUTE_FOAD;
HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
}
else
{
} else {
/*
** 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
** a tentative entry for it, so that the configurator can see it
** and fill in the details for us.
*/
if (RtaType == TYPE_RTA16)
{
if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0)
{
if (RtaType == TYPE_RTA16) {
if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0) {
RIODefaultName(p, HostP, ThisUnit);
FillSlot(ThisUnit, ThisUnit2, RtaUniq, HostP);
}
}
else
{
if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0)
{
} else {
if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0) {
RIODefaultName(p, HostP, ThisUnit);
FillSlot(ThisUnit, 0, RtaUniq, HostP);
}
@ -621,8 +516,7 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP
}
void
RIOFixPhbs(p, HostP, unit)
void RIOFixPhbs(p, HostP, unit)
struct rio_info *p;
struct Host *HostP;
uint unit;
@ -696,10 +590,7 @@ uint unit;
WBYTE(Pkt->dest_unit, dest_unit);
WBYTE(Pkt->dest_port, dest_port);
}
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);
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);
WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8));
WWORD(PortP->PhbP->link, link);
@ -709,7 +600,8 @@ uint unit;
** Now make sure the range of ports to be serviced includes
** 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)) {
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);
@ -723,8 +615,7 @@ uint unit;
** the world about it. This is done to ensure that the configurator
** only gets up-to-date information about what is going on.
*/
static int
RIOCheckIsolated(p, HostP, UnitId)
static int RIOCheckIsolated(p, HostP, UnitId)
struct rio_info *p;
struct Host *HostP;
uint UnitId;
@ -753,8 +644,7 @@ uint UnitId;
** all the units attached to it. This will mean that the entire
** subnet will re-introduce itself.
*/
static int
RIOIsolate(p, HostP, UnitId)
static int RIOIsolate(p, HostP, UnitId)
struct rio_info *p;
struct Host *HostP;
uint UnitId;
@ -788,8 +678,7 @@ uint UnitId;
return 1;
}
static int
RIOCheck(HostP, UnitId)
static int RIOCheck(HostP, UnitId)
struct Host *HostP;
uint UnitId;
{
@ -849,12 +738,10 @@ uint UnitId;
** Returns the type of unit (host, 16/8 port RTA)
*/
uint
GetUnitType(Uniq)
uint GetUnitType(Uniq)
uint Uniq;
{
switch ( (Uniq >> 28) & 0xf)
{
switch ((Uniq >> 28) & 0xf) {
case RIO_AT:
case RIO_MCA:
case RIO_EISA:
@ -873,8 +760,7 @@ uint Uniq;
}
}
int
RIOSetChange(p)
int RIOSetChange(p)
struct rio_info *p;
{
if (p->RIOQuickCheck != NOT_CHANGED)
@ -889,8 +775,7 @@ struct rio_info * p;
return (0);
}
static void
RIOConCon(p, HostP, FromId, FromLink, ToId, ToLink, Change)
static void RIOConCon(p, HostP, FromId, FromLink, ToId, ToLink, Change)
struct rio_info *p;
struct Host *HostP;
uint FromId;
@ -933,9 +818,9 @@ int Change;
** connections and disconnections.
*/
if (Change == CONNECT) {
if (p->RIORtaDisCons) p->RIORtaDisCons--;
}
else {
if (p->RIORtaDisCons)
p->RIORtaDisCons--;
} else {
p->RIORtaDisCons++;
}
@ -956,14 +841,8 @@ int Change;
ToName = ToId ? HostP->Mapping[ToId - 1].Name : HostP->Name;
ToType = ToId ? "RTA" : "HOST";
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");
cprintf("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n",
FromType, FromName, 'A'+FromLink,
ToType, ToName, 'A'+ToLink,
(Change==CONNECT) ? "established" : "disconnected");
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");
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;
** Delete and RTA entry from the saved table given to us
** by the configuration program.
*/
static int
RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
static int RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
{
int entry;
@ -982,10 +860,8 @@ RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
** zeroing it because we may have two entries to delete if
** it's a 16 port RTA.
*/
for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++)
{
if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum)
{
for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) {
bzero((caddr_t) & p->RIOSavedTable[entry], sizeof(struct Map));
}
}
@ -999,8 +875,7 @@ RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
** Scan the unit links to and return zero if the unit is completely
** disconnected.
*/
static int
RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
static int RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
{
int link;
@ -1011,8 +886,7 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
** second half of a 16 port RTA then scan to see if
** 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)
break;
}
@ -1033,12 +907,9 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
rio_dprintk(RIO_DEBUG_ROUTE, "drv_getparm(LBOLT,....) Failed.\n");
elapse_time = current_time - TentTime[unit];
rio_dprintk (RIO_DEBUG_ROUTE, "elapse %d = current %d - tent %d (%d usec)\n",
elapse_time, current_time, TentTime[unit], drv_hztousec(elapse_time));
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, "elapse %d = current %d - tent %d (%d usec)\n", elapse_time, current_time, TentTime[unit], drv_hztousec(elapse_time));
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));
return 1;
}
#endif
@ -1047,8 +918,7 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
** We have found an usable slot.
** 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;
rio_dprintk(RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther);
@ -1066,8 +936,7 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
** This function scans the given host table for either one
** or two free unit ID's.
*/
int
RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2)
int RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint * pID1, uint * pID2)
{
int unit, tempID;
@ -1085,20 +954,17 @@ 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 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);
/*
** 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");
/*
** 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);
*pID1 = unit;
@ -1108,9 +974,7 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2)
*/
if (pID2 == NULL)
return 0;
}
else
{
} else {
/*
** Allocate the second slot and return.
*/
@ -1127,16 +991,11 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2)
** that we can re-use.
*/
rio_dprintk(RIO_DEBUG_ROUTE, "Starting to scan for tentative slots\n");
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 ))
{
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)) {
rio_dprintk(RIO_DEBUG_ROUTE, " Slot %d looks promising.\n", unit);
if(unit == *pID1)
{
if (unit == *pID1) {
rio_dprintk(RIO_DEBUG_ROUTE, " No it isn't, its the 1st half\n");
continue;
}
@ -1155,8 +1014,7 @@ 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 (*pID1 == MAX_RUP)
{
if (*pID1 == MAX_RUP) {
rio_dprintk(RIO_DEBUG_ROUTE, "Grab tentative entry for first unit %d\n", unit);
*pID1 = unit;
@ -1171,14 +1029,11 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2)
*/
if (pID2 == NULL)
return 0;
}
else
{
} else {
/*
** Allocate the second slot and return.
*/
rio_dprintk (RIO_DEBUG_ROUTE, "Grab tentative/empty entry for second unit %d\n",
unit);
rio_dprintk(RIO_DEBUG_ROUTE, "Grab tentative/empty entry for second unit %d\n", unit);
*pID2 = unit;
/*
@ -1193,8 +1048,7 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2)
** Better check and swap them over.
*/
if (*pID1 > *pID2)
{
if (*pID1 > *pID2) {
rio_dprintk(RIO_DEBUG_ROUTE, "Swapping IDS %d %d\n", *pID1, *pID2);
tempID = *pID1;
*pID1 = *pID2;

View File

@ -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
*/
struct Conf
{
struct Conf {
char Locator[24];
unsigned int StartupTime;
unsigned int SlowCook;
@ -86,15 +85,13 @@ struct Conf
/*
** 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 Ivec; /* POLLED or ivec number */
unsigned char Mode; /* Control stuff, see below */
};
struct Board
{
struct Board {
char Locator[RIO_LOCATOR_LEN];
int NumSlots;
struct Brd Boards[MAX_RIO_BOARDS];

View File

@ -91,8 +91,7 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2";
** A configuration table has been loaded. It is now up to us
** to sort it out and use the information contained therein.
*/
int
RIONewTable(p)
int RIONewTable(p)
struct rio_info *p;
{
int Host, Host1, Host2, NameIsUnique, Entry, SubEnt;
@ -188,8 +187,7 @@ struct rio_info * p;
}
if (Host >= p->RIONumHosts) {
rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n",
MapP->Name, MapP->HostUniqueNum);
rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n", MapP->Name, MapP->HostUniqueNum);
MapP->HostUniqueNum = 0;
/* MapP->RtaUniqueNum = 0; */
/* MapP->ID = 0; */
@ -202,25 +200,20 @@ struct rio_info * p;
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(5)\n");
if (MapP->RtaUniqueNum) { /* (5) */
if (!MapP->ID) {
rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an ID of zero!\n",
MapP->Name);
rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an ID of zero!\n", MapP->Name);
p->RIOError.Error = ZERO_RTA_ID;
p->RIOError.Entry = Entry;
return -ENXIO;
}
if (MapP->ID > MAX_RUP) {
rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an invalid ID %d\n",
MapP->Name, MapP->ID);
rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an invalid ID %d\n", MapP->Name, MapP->ID);
p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
p->RIOError.Entry = Entry;
return -ENXIO;
}
for (SubEnt = 0; SubEnt < Entry; SubEnt++) {
if ( MapP->HostUniqueNum ==
p->RIOConnectTable[SubEnt].HostUniqueNum &&
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);
if (MapP->HostUniqueNum == p->RIOConnectTable[SubEnt].HostUniqueNum && 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.Entry = Entry;
p->RIOError.Other = SubEnt;
@ -230,12 +223,10 @@ struct rio_info * p;
** If the RtaUniqueNum is the same, it may be looking at both
** entries for a 16 port RTA, so check the ids
*/
if ((MapP->RtaUniqueNum ==
p->RIOConnectTable[SubEnt].RtaUniqueNum)
if ((MapP->RtaUniqueNum == p->RIOConnectTable[SubEnt].RtaUniqueNum)
&& (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",
p->RIOConnectTable[SubEnt].Name);
rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", p->RIOConnectTable[SubEnt].Name);
p->RIOError.Error = DUPLICATE_UNIQUE_NUMBER;
p->RIOError.Entry = Entry;
p->RIOError.Other = SubEnt;
@ -245,8 +236,7 @@ struct rio_info * p;
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n");
/* (7a) */
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",
(int)MapP->SysPort,MapP->Name, PORTS_PER_RTA);
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);
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
p->RIOError.Entry = Entry;
return -ENXIO;
@ -254,8 +244,7 @@ struct rio_info * p;
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n");
/* (7b) */
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",
(int)MapP->SysPort, MapP->Name);
rio_dprintk(RIO_DEBUG_TABLE, "TTY Port number %d for RTA %s is too big\n", (int) MapP->SysPort, MapP->Name);
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
p->RIOError.Entry = Entry;
return -ENXIO;
@ -266,19 +255,15 @@ struct rio_info * p;
if (p->RIOConnectTable[SubEnt].RtaUniqueNum) {
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(8)\n");
/* (8) */
if ( (MapP->SysPort != NO_PORT) && (MapP->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);
if ((MapP->SysPort != NO_PORT) && (MapP->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);
p->RIOError.Error = TTY_NUMBER_IN_USE;
p->RIOError.Entry = Entry;
p->RIOError.Other = SubEnt;
return -ENXIO;
}
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n");
if (strcmp(MapP->Name,
p->RIOConnectTable[SubEnt].Name)==0 && !(MapP->Flags & RTA16_SECOND_SLOT)) { /* (9) */
if (strcmp(MapP->Name, p->RIOConnectTable[SubEnt].Name) == 0 && !(MapP->Flags & RTA16_SECOND_SLOT)) { /* (9) */
rio_dprintk(RIO_DEBUG_TABLE, "RTA name %s used twice\n", MapP->Name);
p->RIOError.Error = NAME_USED_TWICE;
p->RIOError.Entry = Entry;
@ -287,19 +272,16 @@ struct rio_info * p;
}
}
}
}
else { /* (6) */
} else { /* (6) */
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(6)\n");
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.Entry = Entry;
return -ENXIO;
}
if (MapP->SysPort != NO_PORT) {
rio_dprintk (RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n",
MapP->Name);
rio_dprintk(RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n", MapP->Name);
p->RIOError.Error = HOST_SYSPORT_BAD;
p->RIOError.Entry = Entry;
return -ENXIO;
@ -316,11 +298,9 @@ struct rio_info * p;
*/
for (Host = 0; Host < RIO_HOSTS; Host++) {
for (Entry = 0; Entry < MAX_RUP; Entry++) {
bzero((caddr_t)&p->RIOHosts[Host].Mapping[Entry],
sizeof(struct Map));
bzero((caddr_t) & p->RIOHosts[Host].Mapping[Entry], sizeof(struct Map));
}
bzero((caddr_t)&p->RIOHosts[Host].Name[0],
sizeof(p->RIOHosts[Host].Name) );
bzero((caddr_t) & p->RIOHosts[Host].Name[0], sizeof(p->RIOHosts[Host].Name));
}
/*
@ -369,8 +349,7 @@ struct rio_info * p;
HostMapP->Flags |= RTA16_SECOND_SLOT;
RIOReMapPorts(p, HostP, HostMapP);
}
else {
} else {
rio_dprintk(RIO_DEBUG_TABLE, "TENTATIVE Rta entry found. Name %s\n", MapP->Name);
}
}
@ -386,10 +365,8 @@ struct rio_info * p;
}
for (Entry = 0; Entry < MAX_RUP; Entry++) {
for (SubEnt = 0; SubEnt < LINKS_PER_UNIT; SubEnt++) {
p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Unit =
ROUTE_DISCONNECT;
p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Link =
NO_LINK;
p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Unit = ROUTE_DISCONNECT;
p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Link = NO_LINK;
}
}
if (!p->RIOHosts[Host].Name[0]) {
@ -419,8 +396,7 @@ struct rio_info * p;
/*
** 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);
bcopy("HOST 1", p->RIOHosts[Host].Name, 7);
p->RIOHosts[Host].Name[5] += Host1;
@ -434,8 +410,7 @@ struct rio_info * p;
** User process needs the config table - build it from first
** principles.
*/
int
RIOApel(p)
int RIOApel(p)
struct rio_info *p;
{
int Host;
@ -450,8 +425,7 @@ struct rio_info * p;
rio_dprintk(RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n");
bzero((caddr_t)&p->RIOConnectTable[0],
sizeof(struct Map) * TOTAL_MAP_ENTRIES );
bzero((caddr_t) & p->RIOConnectTable[0], sizeof(struct Map) * TOTAL_MAP_ENTRIES);
for (Host = 0; Host < RIO_HOSTS; Host++) {
rio_dprintk(RIO_DEBUG_TABLE, "Processing host %d\n", Host);
@ -489,8 +463,7 @@ struct rio_info * p;
** if the entry is suitably inactive, then we can gob on it and remove
** it from the table.
*/
int
RIODeleteRta(p, MapP)
int RIODeleteRta(p, MapP)
struct rio_info *p;
struct Map *MapP;
{
@ -502,8 +475,7 @@ struct Map *MapP;
int work_done = 0;
unsigned long lock_flags, sem_flags;
rio_dprintk (RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n",
MapP->HostUniqueNum, MapP->RtaUniqueNum);
rio_dprintk(RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n", MapP->HostUniqueNum, MapP->RtaUniqueNum);
for (host = 0; host < p->RIONumHosts; host++) {
HostP = &p->RIOHosts[host];
@ -518,8 +490,7 @@ struct Map *MapP;
for (entry = 0; entry < MAX_RUP; entry++) {
if (MapP->RtaUniqueNum == HostP->Mapping[entry].RtaUniqueNum) {
HostMapP = &HostP->Mapping[entry];
rio_dprintk (RIO_DEBUG_TABLE, "Found entry offset %d on host %s\n",
entry, HostP->Name);
rio_dprintk(RIO_DEBUG_TABLE, "Found entry offset %d on host %s\n", entry, HostP->Name);
/*
** Check all four links of the unit are disconnected
@ -575,8 +546,7 @@ struct Map *MapP;
WORD *TxPktP;
PKT *Pkt;
for (TxPktP = PortP->TxStart;
TxPktP <= PortP->TxEnd; TxPktP++) {
for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) {
/*
** *TxPktP is the pointer to the
** transmit packet on the host card.
@ -584,22 +554,13 @@ struct Map *MapP;
** a 32 bit pointer so it can be
** accessed from the driver.
*/
Pkt = (PKT *) RIO_PTR(HostP->Caddr,
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);
Pkt = (PKT *) RIO_PTR(HostP->Caddr, 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);
WWORD(Pkt->dest_unit, dest_unit);
WWORD(Pkt->dest_port, dest_port);
}
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);
WWORD(PortP->PhbP->destination,
dest_unit + (dest_port << 8));
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);
WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8));
}
rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags);
}
@ -639,31 +600,24 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
int link;
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);
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);
if ((MapP->ID != (ushort)-1) &&
((int)MapP->ID < (int)1 || (int)MapP->ID > MAX_RUP ))
{
if ((MapP->ID != (ushort) - 1) && ((int) MapP->ID < (int) 1 || (int) MapP->ID > MAX_RUP)) {
rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n");
p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
return -EINVAL;
}
if (MapP->RtaUniqueNum == 0)
{
if (MapP->RtaUniqueNum == 0) {
rio_dprintk(RIO_DEBUG_TABLE, "Rta Unique number zero!\n");
p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO;
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);
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
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);
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
return -EINVAL;
@ -674,10 +628,8 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
*/
MapP->Name[MAX_NAME_LEN - 1] = '\0';
sptr = MapP->Name;
while ( *sptr )
{
if ( *sptr<' ' || *sptr>'~' )
{
while (*sptr) {
if (*sptr < ' ' || *sptr > '~') {
rio_dprintk(RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n");
p->RIOError.Error = BAD_CHARACTER_IN_NAME;
return -EINVAL;
@ -685,12 +637,9 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
sptr++;
}
for ( host=0; host < p->RIONumHosts; host++ )
{
if ( MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum )
{
if ( (p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING )
{
for (host = 0; host < p->RIONumHosts; host++) {
if (MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum) {
if ((p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING) {
p->RIOError.Error = HOST_NOT_RUNNING;
return -ENXIO;
}
@ -699,12 +648,10 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
** Now we have a host we need to allocate an ID
** if the entry does not already have one.
*/
if (MapP->ID == (ushort)-1)
{
if (MapP->ID == (ushort) - 1) {
int nNewID;
rio_dprintk (RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n",
MapP->Name);
rio_dprintk(RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", MapP->Name);
/*
** The idea here is to allow RTA's to be assigned
** before they actually appear on the network.
@ -716,8 +663,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
** 16 port entry then find the other half and
** 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;
return -EBUSY;
}
@ -727,37 +673,30 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
HostMapP->RtaUniqueNum = MapP->RtaUniqueNum;
HostMapP->HostUniqueNum = MapP->HostUniqueNum;
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].Link = NO_LINK;
}
if (MapP->Flags & RTA16_SECOND_SLOT)
{
if (MapP->Flags & RTA16_SECOND_SLOT) {
int unit;
for (unit = 0; unit < MAX_RUP; unit++)
if (p->RIOHosts[host].Mapping[unit].RtaUniqueNum ==
MapP->RtaUniqueNum)
if (p->RIOHosts[host].Mapping[unit].RtaUniqueNum == MapP->RtaUniqueNum)
break;
if (unit == MAX_RUP)
{
if (unit == MAX_RUP) {
p->RIOError.Error = COULDNT_FIND_ENTRY;
return -EBUSY;
}
HostMapP->Flags |= RTA16_SECOND_SLOT;
HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID;
p->RIOHosts[host].Mapping[unit].ID2 = MapP->ID;
rio_dprintk (RIO_DEBUG_TABLE, "Cross referenced id %d to ID %d.\n",
MapP->ID,
p->RIOHosts[host].Mapping[unit].ID);
rio_dprintk(RIO_DEBUG_TABLE, "Cross referenced id %d to ID %d.\n", MapP->ID, p->RIOHosts[host].Mapping[unit].ID);
}
}
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);
p->RIOError.Error = ID_ALREADY_IN_USE;
return -EBUSY;
@ -784,16 +723,14 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
if (MapP->Flags & RTA16_SECOND_SLOT)
RIOFixPhbs(p, &p->RIOHosts[host], HostMapP->ID - 1);
if ( HostMapP->SysPort != NO_PORT )
{
if (HostMapP->SysPort != NO_PORT) {
if (HostMapP->SysPort < p->RIOFirstPortsBooted)
p->RIOFirstPortsBooted = HostMapP->SysPort;
if (HostMapP->SysPort > p->RIOLastPortsBooted)
p->RIOLastPortsBooted = HostMapP->SysPort;
}
if (MapP->Flags & RTA16_SECOND_SLOT)
rio_dprintk (RIO_DEBUG_TABLE, "Second map of RTA %s added to configuration\n",
p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name);
rio_dprintk(RIO_DEBUG_TABLE, "Second map of RTA %s added to configuration\n", p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name);
else
rio_dprintk(RIO_DEBUG_TABLE, "RTA %s added to configuration\n", MapP->Name);
return 0;
@ -805,8 +742,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
}
int
RIOReMapPorts(p, HostP, HostMapP)
int RIOReMapPorts(p, HostP, HostMapP)
struct rio_info *p;
struct Host *HostP;
struct Map *HostMapP;
@ -834,15 +770,13 @@ struct Map *HostMapP;
return (0);
RtaType = GetUnitType(HostMapP->RtaUniqueNum);
rio_dprintk (RIO_DEBUG_TABLE, "Mapping sysport %d-%d\n",
(int)HostMapP->SysPort, (int)HostMapP->SysPort+PORTS_PER_RTA-1);
rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d-%d\n", (int) HostMapP->SysPort, (int) HostMapP->SysPort + PORTS_PER_RTA - 1);
/*
** now map each of its eight ports
*/
for (SubEnt = 0; SubEnt < PORTS_PER_RTA; SubEnt++) {
rio_dprintk (RIO_DEBUG_TABLE, "subent = %d, HostMapP->SysPort = %d\n",
SubEnt, (int)HostMapP->SysPort);
rio_dprintk(RIO_DEBUG_TABLE, "subent = %d, HostMapP->SysPort = %d\n", SubEnt, (int) HostMapP->SysPort);
SysPort = HostMapP->SysPort + SubEnt; /* portnumber within system */
/* portnumber on host */
@ -871,12 +805,10 @@ struct Map *HostMapP;
PortP->TxAdd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_add));
PortP->TxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_start));
PortP->TxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_end));
PortP->RxRemove=(WORD *)RIO_PTR(HostP->Caddr,
RWORD(PhbP->rx_remove));
PortP->RxRemove = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_remove));
PortP->RxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_start));
PortP->RxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_end));
}
else
} else
PortP->PhbP = NULL;
/*
@ -890,8 +822,7 @@ struct Map *HostMapP;
if (HostMapP->Flags & RTA16_SECOND_SLOT) {
PortP->ID2 = HostMapP->ID2 - 1;
PortP->SecondBlock = TRUE;
}
else {
} else {
PortP->ID2 = 0;
PortP->SecondBlock = FALSE;
}
@ -903,8 +834,8 @@ struct Map *HostMapP;
if (PortP->Mapped) {
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
continue;
}
else HostMapP->Flags &= ~RTA_NEWBOOT;
} else
HostMapP->Flags &= ~RTA_NEWBOOT;
PortP->State = 0;
PortP->Config = 0;
@ -914,15 +845,12 @@ struct Map *HostMapP;
** Note: For 16 port RTA, all ports are of the same type.
*/
if (RtaType == TYPE_RTA16) {
PortP->Config |= p->RIOModuleTypes[HostP->UnixRups
[HostMapP->ID-1].ModTypes].Flags[SubEnt % PORTS_PER_MODULE];
PortP->Config |= p->RIOModuleTypes[HostP->UnixRups[HostMapP->ID - 1].ModTypes].Flags[SubEnt % PORTS_PER_MODULE];
} else {
if (SubEnt < PORTS_PER_MODULE)
PortP->Config |= p->RIOModuleTypes[LONYBLE(HostP->UnixRups
[HostMapP->ID-1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
PortP->Config |= p->RIOModuleTypes[LONYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
else
PortP->Config |= p->RIOModuleTypes[HINYBLE(HostP->UnixRups
[HostMapP->ID-1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
PortP->Config |= p->RIOModuleTypes[HINYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
}
/*
@ -986,8 +914,7 @@ struct Map *HostMapP;
return 0;
}
int
RIOChangeName(p, MapP)
int RIOChangeName(p, MapP)
struct rio_info *p;
struct Map *MapP;
{
@ -995,9 +922,7 @@ struct Map* MapP;
struct Map *HostMapP;
char *sptr;
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);
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);
if (MapP->ID > MAX_RUP) {
rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n");

View File

@ -90,13 +90,11 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3";
#include "sam.h"
#if 0
static void ttyseth_pv(struct Port *, struct ttystatics *,
struct termios *sg, int);
static void ttyseth_pv(struct Port *, struct ttystatics *, struct termios *sg, int);
#endif
static void RIOClearUp(struct Port *PortP);
int RIOShortCommand(struct rio_info *p, struct Port *PortP,
int command, int len, int arg);
int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg);
#if 0
static int RIOCookMode(struct ttystatics *);
@ -117,9 +115,7 @@ extern int conv_bv[]; /* now defined in ttymgr.c */
#endif
#ifdef NEED_THIS2
static struct old_sgttyb
default_sg =
{
static struct old_sgttyb default_sg = {
B19200, B19200, /* input and output speed */
'H' - '@', /* erase char */
-1, /* 2nd erase char */
@ -145,8 +141,7 @@ default_sg =
extern struct rio_info *p;
int
riotopen(struct tty_struct * tty, struct file * filp)
int riotopen(struct tty_struct *tty, struct file *filp)
{
register uint SysPort;
int Modem;
@ -172,9 +167,7 @@ riotopen(struct tty_struct * tty, struct file * filp)
return -ENXIO;
}
rio_dprintk (RIO_DEBUG_TTY, "port open SysPort %d (%s) (mapped:%d)\n",
SysPort, Modem ? "Modem" : "tty",
p->RIOPortp[SysPort]->Mapped);
rio_dprintk(RIO_DEBUG_TTY, "port open SysPort %d (%s) (mapped:%d)\n", SysPort, Modem ? "Modem" : "tty", p->RIOPortp[SysPort]->Mapped);
/*
** Validate that we have received a legitimate request.
@ -210,8 +203,7 @@ riotopen(struct tty_struct * tty, struct file * filp)
PortP->gs.tty = tty;
PortP->gs.count++;
rio_dprintk (RIO_DEBUG_TTY, "%d bytes in tx buffer\n",
PortP->gs.xmit_cnt);
rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt);
retval = gs_init_port(&PortP->gs);
if (retval) {
@ -416,7 +408,6 @@ bombout:
}
rio_dprintk(RIO_DEBUG_TTY, "PORT_ISOPEN found\n");
}
#ifdef MODEM_SUPPORT
if (Modem) {
rio_dprintk(RIO_DEBUG_TTY, "Modem - test for carrier\n");
@ -425,8 +416,7 @@ bombout:
** insert test for carrier here. -- ???
** 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);
/*
tp->tm.c_state |= CARR_ON;
@ -434,15 +424,13 @@ bombout:
*/
PortP->State |= RIO_CARR_ON;
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) &&
!(filp->f_flags & O_NONBLOCK) && !p->RIOHalted )
*/
while (!(PortP->State & RIO_CARR_ON) &&
!(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) {
while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) {
rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort);
/*
@ -460,8 +448,7 @@ bombout:
** to do here. -- ???
** I think it's OK. -- REW
*/
rio_dprintk (RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n",
SysPort);
rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", SysPort);
RIOPreemptiveCmd(p, PortP, FCLOSE);
/*
tp->tm.c_state &= ~WOPEN;
@ -478,8 +465,7 @@ bombout:
goto bombout;
rio_dprintk(RIO_DEBUG_TTY, "Setting RIO_MOPEN\n");
PortP->State |= RIO_MOPEN;
}
else
} else
#endif
{
/*
@ -517,8 +503,7 @@ bombout:
** As there are two interfaces to the port (Modem and tty), we need to
** check that both are closed before we close the device.
*/
int
riotclose(void *ptr)
int riotclose(void *ptr)
{
#if 0
register uint SysPort = dev;
@ -614,8 +599,7 @@ riotclose(void *ptr)
rio_dprintk(RIO_DEBUG_TTY, "Timeout 1 starts\n");
if (!deleted)
while ( (PortP->InUse != NOT_INUSE) && !p->RIOHalted &&
(PortP->TxBufferIn != PortP->TxBufferOut) ) {
while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted && (PortP->TxBufferIn != PortP->TxBufferOut)) {
cprintf("Need to flush the ttyport\n");
if (repeat_this-- <= 0) {
rv = -EINTR;
@ -672,8 +656,7 @@ riotclose(void *ptr)
RIOPreemptiveCmd(p, PortP, FCLOSE);
break;
}
rio_dprintk (RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n",
PortP->PortState & PORT_ISOPEN);
rio_dprintk(RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", PortP->PortState & PORT_ISOPEN);
if (p->RIOHalted) {
RIOClearUp(PortP);
@ -728,8 +711,7 @@ close_end:
** COOK_MEDIUM if the card can do all the processing necessary.
*/
#if 0
static int
RIOCookMode(struct ttystatics *tp)
static int RIOCookMode(struct ttystatics *tp)
{
/*
** We can't handle tm.c_mstate != 0 on SCO
@ -761,8 +743,7 @@ RIOCookMode(struct ttystatics *tp)
}
#endif
static void
RIOClearUp(PortP)
static void RIOClearUp(PortP)
struct Port *PortP;
{
rio_dprintk(RIO_DEBUG_TTY, "RIOHalted set\n");
@ -788,8 +769,7 @@ struct Port *PortP;
** Other values of len aren't allowed, and will cause
** a panic.
*/
int RIOShortCommand(struct rio_info *p, struct Port *PortP,
int command, int len, int arg)
int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg)
{
PKT *PacketP;
int retries = 20; /* at 10 per second -> 2 seconds */
@ -813,8 +793,7 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP,
** be free again.
*/
while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted) {
rio_dprintk (RIO_DEBUG_TTY, "Waiting for not in use (%d)\n",
retries);
rio_dprintk(RIO_DEBUG_TTY, "Waiting for not in use (%d)\n", retries);
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if (retries-- <= 0) {
return RIO_FAIL;
@ -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
** its all about.
*/
int
riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
int riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
{
register struct Port *PortP;
register struct ttystatics *tp;
@ -895,8 +873,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
int Modem = rio_ismodem(tty);
int ioctl_processed;
rio_dprintk (RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n",
SysPort, cmd, arg, Modem?"Modem":"tty") ;
rio_dprintk(RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", SysPort, cmd, arg, Modem ? "Modem" : "tty");
if (SysPort >= RIO_PORTS) {
rio_dprintk(RIO_DEBUG_TTY, "Bad port number %d\n", SysPort);
@ -956,8 +933,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
return 0;
case TCRIOTSTATE:
rio_dprintk (RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n",
arg ? "en" : "dis");
rio_dprintk(RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", arg ? "en" : "dis");
/* MonitorTstate = 0 ; */
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
@ -969,8 +945,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE command failed\n");
PortP->State |= RIO_BUSY;
current = PortP->ModemState;
if ( copyout((caddr_t)&current, (int)arg,
sizeof(current))==COPYFAIL ) {
if (copyout((caddr_t) & current, (int) arg, sizeof(current)) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_TTY, "Copyout failed\n");
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
pseterr(EFAULT);
@ -987,10 +962,8 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
PortP->ModemState |= (ushort) state;
PortP->ModemLines = (ulong) arg;
if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL)
rio_dprintk (RIO_DEBUG_TTY,
"TCRIOMBIS command failed\n");
}
else {
rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS command failed\n");
} else {
uint state;
state = (uint) arg;
@ -1005,38 +978,33 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
case TCRIOXPON: /* set Xprint ON string */
rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPON\n");
if ( copyin((int)arg, (caddr_t)PortP->Xprint.XpOn,
MAX_XP_CTRL_LEN)==COPYFAIL ) {
if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOn, MAX_XP_CTRL_LEN) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n");
PortP->Xprint.XpOn[0] = '\0';
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
pseterr(EFAULT);
}
PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn)+
strlen(PortP->Xprint.XpOff);
PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff);
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0;
case TCRIOXPOFF: /* set Xprint OFF string */
rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPOFF\n");
if ( copyin( (int)arg, (caddr_t)PortP->Xprint.XpOff,
MAX_XP_CTRL_LEN)==COPYFAIL ) {
if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOff, MAX_XP_CTRL_LEN) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n");
PortP->Xprint.XpOff[0] = '\0';
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
pseterr(EFAULT);
}
PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn)+
strlen(PortP->Xprint.XpOff);
PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff);
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0;
case TCRIOXPCPS: /* set Xprint CPS string */
rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPCPS\n");
if ( (uint)arg > p->RIOConf.MaxXpCps ||
(uint)arg < p->RIOConf.MinXpCps ) {
if ((uint) arg > p->RIOConf.MaxXpCps || (uint) arg < p->RIOConf.MinXpCps) {
rio_dprintk(RIO_DEBUG_TTY, "%d CPS out of range\n", arg);
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
pseterr(EINVAL);
@ -1048,8 +1016,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
case TCRIOXPRINT:
rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPRINT\n");
if ( copyout((caddr_t)&PortP->Xprint, (int)arg,
sizeof(struct Xprint))==COPYFAIL ) {
if (copyout((caddr_t) & PortP->Xprint, (int) arg, sizeof(struct Xprint)) == COPYFAIL) {
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
pseterr(EFAULT);
}
@ -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;
for (i = 0; i < NCC + 1; i++)
tp->tm.c_cc[i] = PortP->StoredTty.cc[i];
}
else {
} else {
/*
** If the port is set to store the parameters, and it is
** 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)
}
}
changed = (tp->tm.c_cflag != old_cflag) ||
(tp->tm.c_iflag != old_iflag) ||
(tp->tm.c_oflag != old_oflag);
changed = (tp->tm.c_cflag != old_cflag) || (tp->tm.c_iflag != old_iflag) || (tp->tm.c_oflag != old_oflag);
PortP->CookMode = RIOCookMode(tp); /* Set new cooking mode */
rio_dprintk (RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n",
changed,PortP->CookMode,oldcook);
rio_dprintk(RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", changed, PortP->CookMode, oldcook);
#ifdef MODEM_SUPPORT
/*
@ -1280,8 +1243,7 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
/*
ttyseth -- set hardware dependent tty settings
*/
void
ttyseth(PortP, s, sg)
void ttyseth(PortP, s, sg)
struct Port *PortP;
struct ttystatics *s;
struct old_sgttyb *sg;
@ -1297,19 +1259,16 @@ struct old_sgttyb *sg;
if (sg->sg_flags & ODDP) {
tp->c_cflag &= V_CS7;
tp->c_cflag &= ~PARENB;
}
else {
} else {
tp->c_cflag &= V_CS7;
tp->c_cflag &= PARENB;
tp->c_cflag &= PARODD;
}
}
else if (sg->sg_flags & ODDP) {
} else if (sg->sg_flags & ODDP) {
tp->c_cflag &= V_CS7;
tp->c_cflag &= PARENB;
tp->c_cflag &= PARODD;
}
else {
} else {
tp->c_cflag &= V_CS7;
tp->c_cflag &= PARENB;
}
@ -1338,8 +1297,7 @@ struct old_sgttyb *sg;
sysv = 0 => (POSIX): struct termios *sg
sysv != 0 => (System V): struct termio *sg
*/
static void
ttyseth_pv(PortP, s, sg, sysv)
static void ttyseth_pv(PortP, s, sg, sysv)
struct Port *PortP;
struct ttystatics *s;
struct termios *sg;
@ -1356,8 +1314,7 @@ int sysv;
csize = ((struct termio *) sg)->c_cflag & CSIZE;
cread = ((struct termio *) sg)->c_cflag & CREAD;
speed = conv_vb[((struct termio *) sg)->c_cflag & V_CBAUD];
}
else {
} else {
/* sg points to a POSIX termios structure */
csize = sg->c_cflag & CSIZE;
cread = sg->c_cflag & CREAD;
@ -1366,8 +1323,7 @@ int sysv;
if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) {
s->sg.sg_ispeed = speed;
s->sg.sg_ospeed = speed;
s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) |
conv_bv[(int)s->sg.sg_ispeed];
s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) | conv_bv[(int) s->sg.sg_ispeed];
}
}
#endif

View File

@ -132,4 +132,3 @@ typedef struct RUP RUP;
#endif /* __riotypes__ */
/*********** end of file ***********/

View File

@ -60,8 +60,7 @@
/* 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. */
typedef struct _PARM_MAP
{
typedef struct _PARM_MAP {
_u16 phb_ptr; /* 0x00 Pointer to the PHB array */
_u16 phb_num_ptr; /* 0x02 Ptr to Number of PHB's */
_u16 free_list; /* 0x04 Free List pointer */
@ -184,8 +183,7 @@ typedef struct _PARM_MAP
attached to the system and there is normally an array of MAX_RUPS (=16) structures
in a host card, defined by PARM_MAP->rup. */
typedef struct _RUP
{
typedef struct _RUP {
_u16 txpkt; /* 0x00 Outgoing packet */
_u16 rxpkt; /* 0x02 ncoming packet */
_u16 link; /* 0x04 Which link to send packet down ? */
@ -234,8 +232,7 @@ typedef struct _RUP
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. */
typedef struct _PHB
{
typedef struct _PHB {
_u16 source; /* 0x00 Location of the PHB in the host card */
_u16 handshake; /* 0x02 Used to manage receive packet flow control */
_u16 status; /* 0x04 Internal port transmit/receive status */
@ -291,8 +288,7 @@ typedef struct _PHB
and there is normally an array of MAX_LINKS (=4) structures in a host card,
defined by PARM_MAP->link_str_ptr. */
typedef struct _LPB
{
typedef struct _LPB {
_u16 link_number; /* 0x00 Link Number */
_u16 in_ch; /* 0x02 Link In Channel */
_u16 out_ch; /* 0x04 Link Out Channel */
@ -380,8 +376,7 @@ typedef struct _LPB
/* 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 prev; /* 0x02 offset of previous list item */
@ -403,8 +398,7 @@ typedef struct _FREE_LIST
#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_port; /* 0x01 Destination Port */
_u8 src_unit; /* 0x02 Source Unit Id */

View File

@ -60,5 +60,3 @@ struct ROM {
#define ROM_LENGTH 0x20
/*********** end of file ***********/

View File

@ -105,4 +105,3 @@ struct ROUTE_STR {
#endif
/*********** end of file ***********/

View File

@ -79,4 +79,3 @@ struct RUP {
#endif
/*********** end of file ***********/

View File

@ -48,4 +48,3 @@ static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1" ;
#define STATUS_TOPOLOGY 2
#endif

View File

@ -69,6 +69,3 @@ struct FREE_LIST {
#endif
/*********** end of file ***********/

View File

@ -60,4 +60,3 @@ struct SYS_MAP {
/*********** end of file ***********/

View File

@ -48,4 +48,3 @@ static char *_rio_defaults_h_sccs = "@(#)timeouts.h 1.3" ;
/*********** end of file ***********/

View File

@ -40,8 +40,7 @@ static char *_top_h_sccs_ = "@(#)top.h 1.2";
/*
** Topology information
*/
struct Top
{
struct Top {
uchar Unit;
uchar Link;
};

View File

@ -41,8 +41,7 @@ static char *_unixrup_h_sccs_ = "@(#)unixrup.h 1.2";
** UnixRup data structure. This contains pointers to actual RUPs on the
** host card, and all the command/boot control stuff.
*/
struct UnixRup
{
struct UnixRup {
struct CmdBlk *CmdsWaitingP; /* Commands waiting to be done */
struct CmdBlk *CmdPendingP; /* The command currently being sent */
struct RUP *RupP; /* the Rup to send it to */